From dca97cb25bcd947fc594d156393e1c70dd38937a Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Wed, 12 Jun 2002 08:37:21 +0000 Subject: * hppa1.1/udiv-qrnnd.S: Changes for PIC by Randolph Chung. * rsa.c (generate): Use e = 65537 for now. --- NEWS | 7 +++ THANKS | 2 + cipher/ChangeLog | 12 +++++ cipher/md.c | 3 +- cipher/pubkey.c | 3 +- cipher/rsa.c | 13 +++--- configure.ac | 13 +++--- mpi/ChangeLog | 4 ++ mpi/hppa1.1/udiv-qrnnd.S | 14 +++--- src/gcrypt.h | 114 +++++++++++++++++++++++++++++++---------------- 10 files changed, 128 insertions(+), 57 deletions(-) diff --git a/NEWS b/NEWS index 47bfb7d3..031caeb1 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,10 @@ +Noteworthy changes in version CVS-head +------------------------------------------------ + + * Interface changes relative to the 1.1.7 release: +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Noteworthy changes in version 1.1.7 (2002-05-21) ------------------------------------------------ diff --git a/THANKS b/THANKS index f2fb0fc4..69f61a25 100644 --- a/THANKS +++ b/THANKS @@ -42,6 +42,7 @@ Ian McKellar imckellar@harvestroad.com.au Janusz A. Urbanowicz alex@bofh.torun.pl James Troup james@nocrew.org Jean-loup Gailly gzip@prep.ai.mit.edu +Jeff Johnson jbj@redhat.com Jens Bachem bachem@rrz.uni-koeln.de J Horacio MG homega@ciberia.es Joachim Backes backes@rhrk.uni-kl.de @@ -82,6 +83,7 @@ QingLong qinglong@bolizm.ihep.su Ralf Hildebrandt Ralf.Hildebrandt@innominate.com Ralph Gillen gillen@theochem.uni-duesseldorf.de Rami Lehti Rami.Lehti@finland.sun.com +Randolph Chung tausq@debian.org Rat ratinox@peorth.gweep.net Reinhard Wobst R.Wobst@ifw-dresden.de Rémi Guyomarch rguyom@mail.dotcom.fr diff --git a/cipher/ChangeLog b/cipher/ChangeLog index f3381d9d..9b76c8e3 100644 --- a/cipher/ChangeLog +++ b/cipher/ChangeLog @@ -1,8 +1,20 @@ +2002-06-12 Werner Koch + + * rsa.c (generate): Use e = 65537 for now. + +2002-06-11 Werner Koch + + * pubkey.c (gcry_pk_get_keygrip): Allow a "protected-private-key". + 2002-06-05 Timo Schulz * cipher.c (gcry_cipher_encrypt, gcry_cipher_decrypt): Check that the input size is a multiple of the blocksize. +2002-05-23 Werner Koch + + * md.c (oid_table): Add an rsadsi OID for MD5. + 2002-05-21 Werner Koch * primegen.c, elgamal.c, dsa.c (progress): Do not print anything diff --git a/cipher/md.c b/cipher/md.c index 8be11269..c915aadf 100644 --- a/cipher/md.c +++ b/cipher/md.c @@ -45,7 +45,8 @@ static struct { { "1.3.14.3.2.26", GCRY_MD_SHA1 }, /* rsaSignatureWithripemd160 */ { "1.3.36.3.3.1.2", GCRY_MD_RMD160 }, - + /* RSADSI digestAlgorithm MD5 */ + { "1.2.840.113549.2.5", GCRY_MD_MD5 }, {NULL} }; diff --git a/cipher/pubkey.c b/cipher/pubkey.c index ec9d2414..c11d2267 100644 --- a/cipher/pubkey.c +++ b/cipher/pubkey.c @@ -1520,7 +1520,6 @@ gcry_pk_get_nbits( GCRY_SEXP key ) /* Return the so called KEYGRIP which is the SHA-1 hash of the public key parameters expressed in a way depended on the algorithm. - This value is known in pkcs#15 as the subjectKeyHash. ARRAY must either be 20 bytes long or NULL; in the later case a newly allocated array of that size is return, other wiese the array @@ -1542,6 +1541,8 @@ gcry_pk_get_keygrip (GCRY_SEXP key, unsigned char *array) list = gcry_sexp_find_token (key, "public-key", 0); if (!list) list = gcry_sexp_find_token (key, "private-key", 0); + if (!list) + list = gcry_sexp_find_token (key, "protected-private-key", 0); if (!list) return NULL; /* no public- or private-key object */ diff --git a/cipher/rsa.c b/cipher/rsa.c index 9e2d62e9..0487b736 100644 --- a/cipher/rsa.c +++ b/cipher/rsa.c @@ -140,13 +140,16 @@ generate( RSA_secret_key *sk, unsigned nbits ) e=41 0.75 ms e=257 0.95 ms e=65537 1.80 ms - */ + + Note: Due to Sphinx requirements we temorrary change the + exponent until we can rework the interface to provide more + parameters than just the modulus length. */ e = mpi_alloc( (32+BITS_PER_MPI_LIMB-1)/BITS_PER_MPI_LIMB ); - mpi_set_ui( e, 41); - if( !gcry_mpi_gcd(t1, e, phi) ) { + mpi_set_ui (e, 65537); + if( !gcry_mpi_gcd(t1, e, phi) ) { /* actually never triggered ;-) */ mpi_set_ui( e, 257); if( !gcry_mpi_gcd(t1, e, phi) ) { - mpi_set_ui( e, 65537); + mpi_set_ui( e, 41); while( !gcry_mpi_gcd(t1, e, phi) ) /* (while gcd is not 1) */ mpi_add_ui( e, e, 2); } @@ -347,7 +350,7 @@ secret(MPI output, MPI input, RSA_secret_key *skey ) *********************************************/ int -_gcry_rsa_generate( int algo, unsigned nbits, MPI *skey, MPI **retfactors ) +_gcry_rsa_generate (int algo, unsigned int nbits, MPI *skey, MPI **retfactors) { RSA_secret_key sk; diff --git a/configure.ac b/configure.ac index 1326c8c0..74581501 100644 --- a/configure.ac +++ b/configure.ac @@ -25,7 +25,7 @@ AC_PREREQ(2.53) # (Interfaces removed: CURRENT++, AGE=0, REVISION=0) # (Interfaces added: CURRENT++, AGE++, REVISION=0) # (No interfaces changed: REVISION++) -AC_INIT(libgcrypt,1.1.7) +AC_INIT(libgcrypt,1.1.8-cvs) LIBGCRYPT_LT_CURRENT=4 LIBGCRYPT_LT_AGE=3 LIBGCRYPT_LT_REVISION=0 @@ -711,14 +711,15 @@ echo if test "$print_egd_notice" = "yes"; then cat < + + * hppa1.1/udiv-qrnnd.S: Changes for PIC by Randolph Chung. + 2002-05-15 Werner Koch * config.links: Chnage the way the mpi modules are determined. diff --git a/mpi/hppa1.1/udiv-qrnnd.S b/mpi/hppa1.1/udiv-qrnnd.S index 75908aa5..22a13da0 100644 --- a/mpi/hppa1.1/udiv-qrnnd.S +++ b/mpi/hppa1.1/udiv-qrnnd.S @@ -36,10 +36,11 @@ * d gr23 */ - .code + .data .label L$0000 .word 0x43f00000 .word 0x0 + .code .export __udiv_qrnnd .label __udiv_qrnnd .proc @@ -49,13 +50,14 @@ stws %r25,-16(0,%r30) ; n_hi stws %r24,-12(0,%r30) ; n_lo - ldil L'L$0000,%r19 ; ' - ldo R'L$0000(%r19),%r19 ; ' + stw %r19,-32(%r30) + addil LT%L$0000,%r19 + ldw RT%L$0000(%r1),%r1 fldds -16(0,%r30),%fr5 stws %r23,-12(0,%r30) comib,<= 0,%r25,L$1 fcnvxf,dbl,dbl %fr5,%fr5 - fldds 0(0,%r19),%fr4 + fldds 0(0,%r1),%fr4 fadd,dbl %fr4,%fr5,%fr5 .label L$1 fcpy,sgl %fr0,%fr6L @@ -72,8 +74,8 @@ ldws -12(0,%r30),%r21 ldws -16(0,%r30),%r20 sub %r24,%r21,%r22 - subb %r25,%r20,%r19 - comib,= 0,%r19,L$2 + subb %r25,%r20,%r1 + comib,= 0,%r1,L$2 ldo -64(%r30),%r30 add %r22,%r23,%r22 diff --git a/src/gcrypt.h b/src/gcrypt.h index 5e74e8d7..d5fbaf68 100644 --- a/src/gcrypt.h +++ b/src/gcrypt.h @@ -25,47 +25,50 @@ #ifdef __cplusplus extern "C" { +#if 0 /* keep Emacsens's auto-indent happy */ +} +#endif #endif -/* - * The version of this header should match the one of the library - * It should not be used by a program because gcry_check_version() - * should reurn the same version. The purpose of this macro is to - * let autoconf (using the AM_PATH_GCRYPT macro) check that this - * header matches the installed library. - * Note: Do not edit the next line as configure may fix the string here. - */ -#define GCRYPT_VERSION "1.1.7" - +/* The version of this header should match the one of the library It + should not be used by a program because gcry_check_version() should + reurn the same version. The purpose of this macro is to let + autoconf (using the AM_PATH_GCRYPT macro) check that this header + matches the installed library. Note: Do not edit the next line as + configure may fix the string here. */ +#define GCRYPT_VERSION "1.1.8-cvs" +/* Internal: We can't to use the convenience macros for the multi + precision integer functions when build this library. */ #ifdef _GCRYPT_IN_LIBGCRYPT # ifndef GCRYPT_NO_MPI_MACROS # define GCRYPT_NO_MPI_MACROS 1 # endif #endif +/* The data object used to hold a multi precision integer. GcryMPI is + the preferred one. */ struct gcry_mpi; typedef struct gcry_mpi *GCRY_MPI; typedef struct gcry_mpi *GcryMPI; -/******************************************* - * * - * error handling etc. * - * * - *******************************************/ + +/* Error handling etc. */ -/* FIXME: We should use the same values as they were used in GnuPG 1.0. - * gpg --status-fd may print some of these values */ -enum { +/* The error numbers used by Libgcrypt. */ +/* FIXME: We should use the same values as they were used in GnuPG + 1.0. gpg --status-fd may print some of these values. */ +enum + { GCRYERR_SUCCESS = 0, /* "no error" */ GCRYERR_GENERAL = 1, /* catch all the other errors code */ - + GCRYERR_INV_PK_ALGO = 4, /* invalid public key algorithm */ GCRYERR_INV_MD_ALGO = 5, /* invalid message digest algorithm */ GCRYERR_BAD_PUBLIC_KEY = 6, /* Bad public key */ GCRYERR_BAD_SECRET_KEY = 7, /* Bad secret key */ GCRYERR_BAD_SIGNATURE = 8, /* Bad signature */ - + GCRYERR_INV_CIPHER_ALGO = 12, /* invalid cipher algorithm */ GCRYERR_BAD_MPI = 30, GCRYERR_WRONG_PK_ALGO = 41, /* wrong public key algorithm */ @@ -101,15 +104,20 @@ enum { GCRYERR_SEXP_BAD_HEX_CHAR = 211, GCRYERR_SEXP_ODD_HEX_NUMBERS = 212, GCRYERR_SEXP_BAD_OCT_CHAR = 213 + }; -}; - -const char *gcry_check_version( const char *req_version ); +/* Check that the library fulfills the version requirement. */ +const char *gcry_check_version (const char *req_version); +/* Return the error number for the last failed function call. */ int gcry_errno(void); -const char *gcry_strerror( int ec ); -enum gcry_ctl_cmds { +/* Map an error number to a string. */ +const char *gcry_strerror (int ec); + +/* Codes used with the gcry_control function. */ +enum gcry_ctl_cmds + { GCRYCTL_SET_KEY = 1, GCRYCTL_SET_IV = 2, GCRYCTL_CFB_SYNC = 3, @@ -149,21 +157,33 @@ enum gcry_ctl_cmds { GCRYCTL_INITIALIZATION_FINISHED = 38, GCRYCTL_INITIALIZATION_FINISHED_P = 39, GCRYCTL_ANY_INITIALIZATION_P = 40 -}; + }; -int gcry_control( enum gcry_ctl_cmds, ... ); +/* Perform various operations defined by CMD. */ +int gcry_control (enum gcry_ctl_cmds CMD, ...); -enum gcry_random_level { +/* The possible values for the random quality. The rule of thumb is + to usef use WEAK for random number which don't need to be + cryptographically strong, STRONG for session keys and VERY_STRONG + for key material. */ +enum gcry_random_level + { GCRY_WEAK_RANDOM = 0, GCRY_STRONG_RANDOM = 1, GCRY_VERY_STRONG_RANDOM = 2 -}; + }; + +/* S-expression management. */ + +/* The object to represent an S-expression as used with the + public key functions. GcrySexp is the preferrred form. */ struct gcry_sexp; typedef struct gcry_sexp *GCRY_SEXP; -typedef struct gcry_sexp *GcrySexp; /* this type looks more pretty */ +typedef struct gcry_sexp *GcrySexp; +/* The possible values for the S-expression format. */ enum gcry_sexp_format { GCRYSEXP_FMT_DEFAULT = 0, GCRYSEXP_FMT_CANON = 1, @@ -171,21 +191,39 @@ enum gcry_sexp_format { GCRYSEXP_FMT_ADVANCED = 3 }; -int gcry_sexp_new (GCRY_SEXP *retsexp, const void *buffer, size_t length, +/* Create an new S-expression object from BUFFER of size LENGTH aand + return it in RETSEXP. With AUTODETECT set to 0 the data in BUFFER + is expected to be in canonized format */ +int gcry_sexp_new (GcrySexp *retsexp, const void *buffer, size_t length, int autodetect); -int gcry_sexp_create (GCRY_SEXP *retsexp, void *buffer, size_t length, - int autodetect, void (*freefnc)(void*) ); -int gcry_sexp_sscan (GCRY_SEXP *retsexp, size_t *erroff, + +/* Same as gcry_sexp_new but allows to pass a FREEFNC which has the + effect to transfer ownership of BUFFER to the created object. */ +int gcry_sexp_create (GcrySexp *retsexp, void *buffer, size_t length, + int autodetect, void (*freefnc)(void*) ); + +/* Scan BUFFER and return a new S-expression object in RETSEXP. This + function expects a printf like string in BUFFER. */ +int gcry_sexp_sscan (GcrySexp *retsexp, size_t *erroff, const char *buffer, size_t length ); -int gcry_sexp_build (GCRY_SEXP *retsexp, size_t *erroff, + +/* Same as gcry_sexp_sscan but expects a string in FORMAT and can thus + only be used for certain encodings. */ +int gcry_sexp_build (GcrySexp *retsexp, size_t *erroff, const char *format, ... ); -void gcry_sexp_release (GCRY_SEXP sexp); +/* Release the S-expression object SEXP */ +void gcry_sexp_release (GcrySexp sexp); + +/* Calculate the length of an canonized S-expresion in BUFFER and + check for a valid encoding. */ size_t gcry_sexp_canon_len (const unsigned char *buffer, size_t length, size_t *erroff, int *errcode); -size_t gcry_sexp_sprint (GCRY_SEXP sexp, int mode, char *buffer, - size_t maxlength ); +/* Copies the S-expression object SEXP into BUFFER using the format + specified in MODE. */ +size_t gcry_sexp_sprint (GCRY_SEXP sexp, int mode, char *buffer, + size_t maxlength ); void gcry_sexp_dump( const GCRY_SEXP a ); GCRY_SEXP gcry_sexp_cons( const GCRY_SEXP a, const GCRY_SEXP b ); -- cgit v1.2.1