From: Anas Nashif Date: Wed, 7 Nov 2012 17:07:14 +0000 (-0800) Subject: add packaging X-Git-Tag: submit/tizen_4.0_base/20180816.092824~11 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=400567e150733f4d719bdb48904908d551819fb8;p=platform%2Fupstream%2Flibgcrypt.git add packaging --- diff --git a/packaging/baselibs.conf b/packaging/baselibs.conf new file mode 100644 index 0000000..9df1a0a --- /dev/null +++ b/packaging/baselibs.conf @@ -0,0 +1,6 @@ +libgcrypt11 + obsoletes "libgcrypt- <= " + provides "libgcrypt- = " +libgcrypt-devel + requires -libgcrypt- + requires "libgcrypt11- = " diff --git a/packaging/libgcrypt-1.4.1-rijndael_no_strict_aliasing.patch b/packaging/libgcrypt-1.4.1-rijndael_no_strict_aliasing.patch new file mode 100644 index 0000000..1e4c9f4 --- /dev/null +++ b/packaging/libgcrypt-1.4.1-rijndael_no_strict_aliasing.patch @@ -0,0 +1,16 @@ +Index: libgcrypt-1.4.1/cipher/Makefile.am +=================================================================== +--- libgcrypt-1.4.1.orig/cipher/Makefile.am 2008-11-11 17:13:59.000000000 +0100 ++++ libgcrypt-1.4.1/cipher/Makefile.am 2008-11-11 17:18:58.000000000 +0100 +@@ -92,3 +92,11 @@ ac.o: $(srcdir)/ac.c + + ac.lo: $(srcdir)/ac.c + `echo $(LTCOMPILE) -fno-strict-aliasing -c $(srcdir)/ac.c` ++ ++# rijndael.c needs -fno-strict-aliasing ++rijndael.o: $(srcdir)/rijndael.c ++ `echo $(COMPILE) -fno-strict-aliasing -c $(srcdir)/rijndael.c` ++ ++rijndael.lo: $(srcdir)/rijndael.c ++ `echo $(LTCOMPILE) -fno-strict-aliasing -c $(srcdir)/rijndael.c` ++ diff --git a/packaging/libgcrypt-1.5.0-idea.patch b/packaging/libgcrypt-1.5.0-idea.patch new file mode 100644 index 0000000..2f77f2c --- /dev/null +++ b/packaging/libgcrypt-1.5.0-idea.patch @@ -0,0 +1,63 @@ +diff -ur libgcrypt-1.5.0/cipher/cipher.c libgcrypt-1.5.0f/cipher/cipher.c +--- libgcrypt-1.5.0/cipher/cipher.c 2011-04-19 16:06:57.000000000 +0200 ++++ libgcrypt-1.5.0f/cipher/cipher.c 2011-12-25 00:45:18.391287616 +0100 +@@ -60,6 +60,12 @@ + { &_gcry_cipher_spec_blowfish, + &dummy_extra_spec, GCRY_CIPHER_BLOWFISH }, + #endif ++#if USE_IDEA ++ { &_gcry_cipher_spec_idea, ++ &dummy_extra_spec, GCRY_CIPHER_IDEA }, ++#else ++# warn IDEA not supported ++#endif + #if USE_DES + { &_gcry_cipher_spec_des, + &dummy_extra_spec, GCRY_CIPHER_DES }, +diff -ur libgcrypt-1.5.0/cipher/Makefile.am libgcrypt-1.5.0f/cipher/Makefile.am +--- libgcrypt-1.5.0/cipher/Makefile.am 2011-03-11 09:47:39.000000000 +0100 ++++ libgcrypt-1.5.0f/cipher/Makefile.am 2011-12-25 00:39:27.051857406 +0100 +@@ -51,6 +51,7 @@ + dsa.c \ + elgamal.c \ + ecc.c \ ++idea.c \ + md4.c \ + md5.c \ + rijndael.c rijndael-tables.h \ +diff -ur libgcrypt-1.5.0/configure.ac libgcrypt-1.5.0f/configure.ac +--- libgcrypt-1.5.0/configure.ac 2011-06-29 10:53:22.000000000 +0200 ++++ libgcrypt-1.5.0f/configure.ac 2011-12-25 00:39:27.050857305 +0100 +@@ -155,7 +155,7 @@ + LIBGCRYPT_CONFIG_HOST="$host" + + # Definitions for symmetric ciphers. +-available_ciphers="arcfour blowfish cast5 des aes twofish serpent rfc2268 seed" ++available_ciphers="arcfour blowfish cast5 des aes twofish serpent rfc2268 seed idea" + available_ciphers="$available_ciphers camellia" + enabled_ciphers="" + +@@ -1005,6 +1005,12 @@ + AC_DEFINE(USE_CAST5, 1, [Defined if this module should be included]) + fi + ++LIST_MEMBER(idea, $enabled_ciphers) ++if test "$found" = "1" ; then ++ GCRYPT_CIPHERS="$GCRYPT_CIPHERS idea.lo" ++ AC_DEFINE(USE_IDEA, 1, [Defined if this module should be included]) ++fi ++ + LIST_MEMBER(des, $enabled_ciphers) + if test "$found" = "1" ; then + GCRYPT_CIPHERS="$GCRYPT_CIPHERS des.lo" +diff -ur libgcrypt-1.5.0/src/cipher.h libgcrypt-1.5.0f/src/cipher.h +--- libgcrypt-1.5.0/src/cipher.h 2011-06-10 10:53:41.000000000 +0200 ++++ libgcrypt-1.5.0f/src/cipher.h 2011-12-25 00:40:25.323733275 +0100 +@@ -118,6 +118,7 @@ + + /* Declarations for the cipher specifications. */ + extern gcry_cipher_spec_t _gcry_cipher_spec_blowfish; ++extern gcry_cipher_spec_t _gcry_cipher_spec_idea; + extern gcry_cipher_spec_t _gcry_cipher_spec_des; + extern gcry_cipher_spec_t _gcry_cipher_spec_tripledes; + extern gcry_cipher_spec_t _gcry_cipher_spec_arcfour; diff --git a/packaging/libgcrypt-1.5.0-idea_codecleanup.patch b/packaging/libgcrypt-1.5.0-idea_codecleanup.patch new file mode 100644 index 0000000..27e813b --- /dev/null +++ b/packaging/libgcrypt-1.5.0-idea_codecleanup.patch @@ -0,0 +1,164 @@ +diff -ur libgcrypt-1.5.0/cipher/idea.c libgcrypt-1.5.0f/cipher/idea.c +--- libgcrypt-1.5.0/cipher/idea.c 2011-12-25 00:45:06.747113267 +0100 ++++ libgcrypt-1.5.0f/cipher/idea.c 2011-12-25 00:45:18.393287816 +0100 +@@ -89,6 +89,9 @@ + #include + #include + #include ++#include "g10lib.h" ++#include "types.h" ++#include "cipher.h" + + #if !defined(BIG_ENDIAN_HOST) && !defined(LITTLE_ENDIAN_HOST) + /* Try to handle endianness if we didn't get it from config.h */ +@@ -103,9 +106,6 @@ + #endif + #endif + +-typedef unsigned short u16; /* Note: Make sure this is a 16 bit type. */ +-typedef unsigned long u32; /* Note: Make sure this is a 32 bit type. */ +- + /* end configurable stuff */ + + +@@ -116,8 +116,8 @@ + + /* local stuff */ + +-#define FNCCAST_SETKEY(f) ((int(*)(void*, unsigned char*, unsigned int))(f)) +-#define FNCCAST_CRYPT(f) ((void(*)(void*, unsigned char*, unsigned char*))(f)) ++#define FNCCAST_SETKEY(f) ((int(*)(void*, byte*, unsigned int))(f)) ++#define FNCCAST_CRYPT(f) ((void(*)(void*, byte*, byte*))(f)) + + #define IDEA_KEYSIZE 16 + #define IDEA_BLOCKSIZE 8 +@@ -131,11 +131,9 @@ + } IDEA_context; + + +-static int do_setkey( IDEA_context *c, unsigned char *key, unsigned keylen ); +-static void encrypt_block( IDEA_context *bc, unsigned char *outbuf, +- unsigned char *inbuf ); +-static void decrypt_block( IDEA_context *bc, unsigned char *outbuf, +- unsigned char *inbuf ); ++static gcry_err_code_t do_setkey( void *data, const byte *key, unsigned keylen ); ++static void encrypt_block( void *data, byte *outbuf, const byte *inbuf ); ++static void decrypt_block( void *data, byte *outbuf, const byte *inbuf ); + static int selftest(int); + + +@@ -170,7 +168,7 @@ + + + static void +-expand_key( unsigned char *userkey, u16 *ek ) ++expand_key( const byte *userkey, u16 *ek ) + { + int i,j; + +@@ -233,7 +231,7 @@ + + + static void +-cipher( unsigned char *outbuf, unsigned char *inbuf, u16 *key ) ++cipher( byte *outbuf, const byte *inbuf, u16 *key ) + { + u16 x1, x2, x3,x4, s2, s3; + u16 *in, *out; +@@ -309,25 +307,28 @@ + } + + +-static int +-do_setkey( IDEA_context *c, unsigned char *key, unsigned keylen ) ++static gcry_err_code_t ++do_setkey( void *data, const byte *key, unsigned keylen ) + { ++ IDEA_context *c = (IDEA_context*)data; + assert(keylen == 16); + c->have_dk = 0; + expand_key( key, c->ek ); + invert_key( c->ek, c->dk ); +- return 0; ++ return GPG_ERR_NO_ERROR; + } + + static void +-encrypt_block( IDEA_context *c, unsigned char *outbuf, unsigned char *inbuf ) ++encrypt_block( void *data, byte *outbuf, const byte *inbuf ) + { ++ IDEA_context *c = (IDEA_context*)data; + cipher( outbuf, inbuf, c->ek ); + } + + static void +-decrypt_block( IDEA_context *c, unsigned char *outbuf, unsigned char *inbuf ) ++decrypt_block( void *data, byte *outbuf, const byte *inbuf ) + { ++ IDEA_context *c = (IDEA_context*)data; + if( !c->have_dk ) { + c->have_dk = 1; + invert_key( c->ek, c->dk ); +@@ -340,9 +341,9 @@ + selftest( int check_decrypt ) + { + static struct { +- unsigned char key[16]; +- unsigned char plain[8]; +- unsigned char cipher[8]; ++ byte key[16]; ++ byte plain[8]; ++ byte cipher[8]; + } test_vectors[] = { + { { 0x00, 0x01, 0x00, 0x02, 0x00, 0x03, 0x00, 0x04, + 0x00, 0x05, 0x00, 0x06, 0x00, 0x07, 0x00, 0x08 }, +@@ -390,7 +391,7 @@ + { 0xF5, 0xDB, 0x1A, 0xC4, 0x5E, 0x5E, 0xF9, 0xF9 } } + }; + IDEA_context c; +- unsigned char buffer[8]; ++ byte buffer[8]; + int i; + + for(i=0; i < DIM(test_vectors); i++ ) { +@@ -425,12 +426,12 @@ + const char * + idea_get_info( int algo, size_t *keylen, + size_t *blocksize, size_t *contextsize, +- int (**r_setkey)( void *c, unsigned char *key, ++ int (**r_setkey)( void *c, byte *key, + unsigned keylen ), +- void (**r_encrypt)( void *c, unsigned char *outbuf, +- unsigned char *inbuf ), +- void (**r_decrypt)( void *c, unsigned char *outbuf, +- unsigned char *inbuf ) ++ void (**r_encrypt)( void *c, byte *outbuf, ++ byte *inbuf ), ++ void (**r_decrypt)( void *c, byte *outbuf, ++ byte *inbuf ) + ) + { + static int initialized = 0; +@@ -451,7 +452,22 @@ + return NULL; + } + ++static gcry_err_code_t idea_setkey(void *data, const byte *key, unsigned keylen) ++{ ++ static int initialized = 0; ++ if(!initialized) { ++ initialized = 1; ++ if (selftest(0) || selftest(1)) ++ return GPG_ERR_CIPHER_ALGO; ++ } ++ return do_setkey(data, key, keylen); ++} + ++gcry_cipher_spec_t _gcry_cipher_spec_idea = ++{ ++ "IDEA", NULL, NULL, 8, 128, sizeof (IDEA_context), ++ idea_setkey, encrypt_block, decrypt_block ++}; + + const char * const gnupgext_version = "IDEA ($Revision: 1.11 $)"; + diff --git a/packaging/libgcrypt-ppc64.patch b/packaging/libgcrypt-ppc64.patch new file mode 100644 index 0000000..8dbecfc --- /dev/null +++ b/packaging/libgcrypt-ppc64.patch @@ -0,0 +1,27 @@ +Index: libgcrypt-1.4.0/mpi/config.links +=================================================================== +--- libgcrypt-1.4.0.orig/mpi/config.links ++++ libgcrypt-1.4.0/mpi/config.links +@@ -237,11 +237,11 @@ case "${host}" in + ;; + + ppc620-*-* | \ +- powerpc64*-*-*) ++ powerpc64-*-*) + mpi_sflags="-Wa,-mppc" + path="powerpc64" + ;; +- powerpc*-*-linux*) ++ powerpc-*-linux*) + echo '/* configured for powerpc/ELF */' >>./mpi/asm-syntax.h + echo '#define ELF_SYNTAX' >>./mpi/asm-syntax.h + cat $srcdir/mpi/powerpc32/syntax.h >>./mpi/asm-syntax.h +@@ -276,7 +276,7 @@ case "${host}" in + mpi_sflags="-Wa,-mppc" + path="powerpc32" + ;; +- powerpc*-*-*) ++ powerpc-*-*) + mpi_sflags="-Wa,-mppc" + path="powerpc32" + ;; diff --git a/packaging/libgcrypt-sparcv9.diff b/packaging/libgcrypt-sparcv9.diff new file mode 100644 index 0000000..68dabc7 --- /dev/null +++ b/packaging/libgcrypt-sparcv9.diff @@ -0,0 +1,23 @@ +Avoid link-time error + +../src/.libs/libgcrypt.so: undefined reference to `__udiv_qrnnd' + +by choosing v8-like insns for 32-bit v9 mode too. + +--- + mpi/longlong.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +Index: libgcrypt-1.4.4/mpi/longlong.h +=================================================================== +--- libgcrypt-1.4.4.orig/mpi/longlong.h ++++ libgcrypt-1.4.4/mpi/longlong.h +@@ -1133,7 +1133,7 @@ extern USItype __udiv_qrnnd (); + "rJ" ((USItype)(al)), \ + "rI" ((USItype)(bl)) \ + __CLOBBER_CC) +-#if defined (__sparc_v8__) ++#if defined (__sparc_v8__) || defined(__sparc_v9__) + /* Don't match immediate range because, 1) it is not often useful, + 2) the 'I' flag thinks of the range as a 13 bit signed interval, + while we want to match a 13 bit interval, sign extended to 32 bits, diff --git a/packaging/libgcrypt-strict-aliasing.patch b/packaging/libgcrypt-strict-aliasing.patch new file mode 100644 index 0000000..ab63659 --- /dev/null +++ b/packaging/libgcrypt-strict-aliasing.patch @@ -0,0 +1,15 @@ +Index: cipher/Makefile.am +=================================================================== +--- cipher/Makefile.am.orig 2009-12-11 16:31:38.000000000 +0100 ++++ cipher/Makefile.am 2010-11-19 10:53:55.818890156 +0100 +@@ -80,3 +80,10 @@ + + tiger.lo: $(srcdir)/tiger.c + `echo $(LTCOMPILE) -c $(srcdir)/tiger.c | $(o_flag_munging) ` ++ ++# We need to build ac.c with -fno-strict-aliasing ++ac.o: $(srcdir)/ac.c ++ `echo $(COMPILE) -fno-strict-aliasing -c $(srcdir)/ac.c` ++ ++ac.lo: $(srcdir)/ac.c ++ `echo $(LTCOMPILE) -fno-strict-aliasing -c $(srcdir)/ac.c` diff --git a/packaging/libgcrypt.spec b/packaging/libgcrypt.spec new file mode 100644 index 0000000..4eaa4d4 --- /dev/null +++ b/packaging/libgcrypt.spec @@ -0,0 +1,113 @@ +# +# spec file for package libgcrypt +# +# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# + + +Name: libgcrypt +Version: 1.5.0 +Release: 0 +License: GPL-2.0+ ; LGPL-2.1+ +Summary: The GNU Crypto Library +%define libsoname %{name} +Url: http://directory.fsf.org/wiki/Libgcrypt +Group: Development/Libraries/C and C++ +Source: %{name}-%{version}.tar.bz2 +Source2: baselibs.conf +Source3: idea.c.gz +Patch0: %{name}-ppc64.patch +Patch1: %{name}-strict-aliasing.patch +Patch3: %{name}-1.4.1-rijndael_no_strict_aliasing.patch +Patch4: %{name}-sparcv9.diff +Patch5: %{name}-1.5.0-idea.patch +Patch6: %{name}-1.5.0-idea_codecleanup.patch +BuildRequires: libgpg-error-devel >= 1.8 +BuildRequires: libtool +BuildRoot: %{_tmppath}/%{name}-%{version}-build + +%description +Libgcrypt is a general purpose crypto library based on the code used in +GnuPG (alpha version). + +%package devel +License: GFDL-1.1 ; GPL-2.0+ ; LGPL-2.1+ ; MIT +Summary: The GNU Crypto Library +Group: Development/Libraries/C and C++ +Requires: %{libsoname} = %{version} +Requires: glibc-devel +Requires: libgpg-error-devel >= 1.8 + +%description devel +Libgcrypt is a general purpose crypto library based on the code used in +GnuPG (alpha version). + +This package contains needed files to compile and link against the +library. + +%prep +%setup -q +gzip -dc < %{SOURCE3} > cipher/idea.c +%patch0 -p1 +%patch1 +%patch3 -p1 +%patch4 -p1 +%patch5 -p1 +%patch6 -p1 + +%build +# define ciphers to build +ENABLE_CIPHER="arcfour blowfish cast5 des aes twofish serpent rfc2268 seed camellia idea" +ENABLE_PUBKEY="dsa elgamal rsa ecc" +ENABLE_DIGEST="crc md4 md5 rmd160 sha1 sha256 sha512 tiger whirlpool" +# +autoreconf -fi +%configure --with-pic \ + --enable-noexecstack \ + --disable-static \ + --enable-ciphers="$ENABLE_CIPHER" \ + --enable-pubkey-ciphers="$ENABLE_PUBKEY" \ + --enable-digests="$ENABLE_DIGEST" +make %{?_smp_mflags} + +%check +# Nice idea. however this uses /dev/random, which hangs +# on hardware without random feeds. +#make check + +%install +%make_install +# +rm %{buildroot}%{_libdir}/%{name}.la + +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig + +%files +%defattr(-,root,root) +%{_libdir}/%{name}.so.11* + +%files devel +%defattr(-,root,root) +%{_infodir}/gcrypt.info.gz +%{_infodir}/gcrypt.info-1.gz +%{_bindir}/dumpsexp +%{_bindir}/hmac256 +%{_bindir}/%{name}-config +%{_libdir}/%{name}.so +%{_includedir}/gcrypt*.h +%{_datadir}/aclocal/%{name}.m4 + +%changelog