From: Richard Basch Date: Sat, 13 Apr 1996 01:30:50 +0000 (+0000) Subject: Renamed the functions to be preceded with krb5_ (I ran into a naming X-Git-Tag: krb5-1.0-beta6~212 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=fb6282bd8355eee6629956477cbba6021e9c8dd3;p=krb5.git Renamed the functions to be preceded with krb5_ (I ran into a naming conflict with the standard MD5 library calls in another application, and this version has non-standard calling arguments.) git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@7804 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/crypto/md5/ChangeLog b/src/lib/crypto/md5/ChangeLog index e7f991a38..86c6873da 100644 --- a/src/lib/crypto/md5/ChangeLog +++ b/src/lib/crypto/md5/ChangeLog @@ -1,3 +1,8 @@ +Fri Apr 12 21:27:35 1996 Richard Basch + + * rsa-md5.h md5crypto.c md5glue.c md5.c t_cksum.c t_mddriver.c: + Renamed the global functions to be krb5_ + Thu Mar 28 09:50:58 1996 Richard Basch * md5crypto.c: Added support for CKSUMTYPE_RSA_MD5_DES3 diff --git a/src/lib/crypto/md5/md5.c b/src/lib/crypto/md5/md5.c index 1cf645e8b..09e62a294 100644 --- a/src/lib/crypto/md5/md5.c +++ b/src/lib/crypto/md5/md5.c @@ -48,9 +48,9 @@ *********************************************************************** ** Message-digest routines: ** ** To form the message digest for a message M ** - ** (1) Initialize a context buffer mdContext using MD5Init ** - ** (2) Call MD5Update on mdContext and M ** - ** (3) Call MD5Final on mdContext ** + ** (1) Initialize a context buffer mdContext using krb5_MD5Init ** + ** (2) Call krb5_MD5Update on mdContext and M ** + ** (3) Call krb5_MD5Final on mdContext ** ** The message digest is now in mdContext->digest[0...15] ** *********************************************************************** */ @@ -101,12 +101,12 @@ static unsigned char PADDING[64] = { (a) += (b); \ } -/* The routine MD5Init initializes the message-digest context +/* The routine krb5_MD5Init initializes the message-digest context mdContext. All fields are set to zero. */ void -MD5Init (mdContext) -MD5_CTX FAR *mdContext; +krb5_MD5Init (mdContext) +krb5_MD5_CTX FAR *mdContext; { mdContext->i[0] = mdContext->i[1] = (krb5_ui_4)0; @@ -118,13 +118,13 @@ MD5_CTX FAR *mdContext; mdContext->buf[3] = UL(0x10325476); } -/* The routine MD5Update updates the message-digest context to +/* The routine krb5_MD5Update updates the message-digest context to account for the presence of each of the characters inBuf[0..inLen-1] in the message whose digest is being computed. */ void -MD5Update (mdContext, inBuf, inLen) -MD5_CTX FAR *mdContext; +krb5_MD5Update (mdContext, inBuf, inLen) +krb5_MD5_CTX FAR *mdContext; unsigned char FAR *inBuf; unsigned int inLen; { @@ -158,12 +158,12 @@ unsigned int inLen; } } -/* The routine MD5Final terminates the message-digest computation and +/* The routine krb5_MD5Final terminates the message-digest computation and ends with the desired message digest in mdContext->digest[0...15]. */ void -MD5Final (mdContext) -MD5_CTX FAR *mdContext; +krb5_MD5Final (mdContext) +krb5_MD5_CTX FAR *mdContext; { krb5_ui_4 in[16]; int mdi; @@ -179,7 +179,7 @@ MD5_CTX FAR *mdContext; /* pad out to 56 mod 64 */ padLen = (mdi < 56) ? (56 - mdi) : (120 - mdi); - MD5Update (mdContext, PADDING, padLen); + krb5_MD5Update (mdContext, PADDING, padLen); /* append length in bits and transform */ for (i = 0, ii = 0; i < 14; i++, ii += 4) diff --git a/src/lib/crypto/md5/md5crypto.c b/src/lib/crypto/md5/md5crypto.c index d993c22b5..b82b5894e 100644 --- a/src/lib/crypto/md5/md5crypto.c +++ b/src/lib/crypto/md5/md5crypto.c @@ -5,11 +5,11 @@ /* Windows needs to these prototypes for the assignment below */ krb5_error_code -md5_crypto_sum_func PROTOTYPE((krb5_pointer in, size_t in_length, +krb5_md5_crypto_sum_func PROTOTYPE((krb5_pointer in, size_t in_length, krb5_pointer seed, size_t seed_length, krb5_checksum FAR *outcksum)); krb5_error_code -md5_crypto_verify_func PROTOTYPE((krb5_checksum FAR *cksum, krb5_pointer in, +krb5_md5_crypto_verify_func PROTOTYPE((krb5_checksum FAR *cksum, krb5_pointer in, size_t in_length, krb5_pointer seed, size_t seed_length)); /* @@ -19,7 +19,7 @@ md5_crypto_verify_func PROTOTYPE((krb5_checksum FAR *cksum, krb5_pointer in, * * If MD5_K5BETA_COMPAT is defined, then compatability mode is enabled. That * means that both checksum functions are compiled and available for use and - * the additional interface md5_crypto_compat_ctl() is defined. + * the additional interface krb5_md5_crypto_compat_ctl() is defined. * * If MD5_K5BETA_COMPAT_DEF is defined and compatability mode is enabled, then * the compatible behaviour becomes the default. @@ -27,23 +27,23 @@ md5_crypto_verify_func PROTOTYPE((krb5_checksum FAR *cksum, krb5_pointer in, */ static void -md5_calculate_cksum(md5ctx, in, in_length, confound, confound_length) - MD5_CTX *md5ctx; +krb5_md5_calculate_cksum(md5ctx, in, in_length, confound, confound_length) + krb5_MD5_CTX *md5ctx; krb5_pointer in; size_t in_length; krb5_pointer confound; size_t confound_length; { - MD5Init(md5ctx); + krb5_MD5Init(md5ctx); if (confound && confound_length) - MD5Update(md5ctx, confound, confound_length); - MD5Update(md5ctx, in, in_length); - MD5Final(md5ctx); + krb5_MD5Update(md5ctx, confound, confound_length); + krb5_MD5Update(md5ctx, in, in_length); + krb5_MD5Final(md5ctx); } #ifdef MD5_K5BETA_COMPAT krb5_error_code -md5_crypto_compat_sum_func(in, in_length, seed, seed_length, outcksum) +krb5_md5_crypto_compat_sum_func(in, in_length, seed, seed_length, outcksum) krb5_pointer in; size_t in_length; krb5_pointer seed; @@ -56,11 +56,11 @@ krb5_checksum FAR *outcksum; krb5_keyblock keyblock; krb5_error_code retval; - MD5_CTX working; + krb5_MD5_CTX working; - MD5Init(&working); - MD5Update(&working, input, in_length); - MD5Final(&working); + krb5_MD5Init(&working); + krb5_MD5Update(&working, input, in_length); + krb5_MD5Final(&working); outcksum->checksum_type = CKSUMTYPE_RSA_MD5_DES; outcksum->length = RSA_MD5_DES_CKSUM_LENGTH; @@ -91,7 +91,7 @@ krb5_checksum FAR *outcksum; #endif /* MD5_K5BETA_COMPAT */ krb5_error_code -md5_crypto_sum_func(in, in_length, seed, seed_length, outcksum) +krb5_md5_crypto_sum_func(in, in_length, seed, seed_length, outcksum) krb5_pointer in; size_t in_length; krb5_pointer seed; @@ -107,7 +107,7 @@ krb5_checksum FAR *outcksum; krb5_error_code retval; size_t i; - MD5_CTX working; + krb5_MD5_CTX working; /* Generate the confounder in place */ if (retval = krb5_random_confounder(RSA_MD5_DES_CONFOUND_LENGTH, @@ -115,7 +115,7 @@ krb5_checksum FAR *outcksum; return(retval); /* Calculate the checksum */ - md5_calculate_cksum(&working, + krb5_md5_calculate_cksum(&working, (krb5_pointer) outtmp, (size_t) RSA_MD5_DES_CONFOUND_LENGTH, in, @@ -159,7 +159,7 @@ krb5_checksum FAR *outcksum; } krb5_error_code -md5_crypto_verify_func(cksum, in, in_length, seed, seed_length) +krb5_md5_crypto_verify_func(cksum, in, in_length, seed, seed_length) krb5_checksum FAR *cksum; krb5_pointer in; size_t in_length; @@ -175,7 +175,7 @@ size_t seed_length; krb5_error_code retval; size_t i; - MD5_CTX working; + krb5_MD5_CTX working; retval = 0; if (cksum->checksum_type == CKSUMTYPE_RSA_MD5_DES) { @@ -195,7 +195,7 @@ size_t seed_length; */ /* Recalculate the checksum with no confounder */ - md5_calculate_cksum(&working, + krb5_md5_calculate_cksum(&working, (krb5_pointer) NULL, (size_t) 0, in, @@ -268,7 +268,7 @@ size_t seed_length; return(retval); /* Now that we have the decrypted checksum, try to regenerate it */ - md5_calculate_cksum(&working, + krb5_md5_calculate_cksum(&working, (krb5_pointer) outtmp, (size_t) RSA_MD5_DES_CONFOUND_LENGTH, in, @@ -325,7 +325,7 @@ size_t seed_length; return(retval); /* Now that we have the decrypted checksum, try to regenerate it */ - md5_calculate_cksum(&working, + krb5_md5_calculate_cksum(&working, (krb5_pointer) outtmp, (size_t) RSA_MD5_DES_CONFOUND_LENGTH, in, @@ -352,8 +352,8 @@ krb5_checksum_entry rsa_md5_des_cksumtable_entry = #if defined(MD5_K5BETA_COMPAT) && defined(MD5_K5BETA_COMPAT_DEF) { 0, - md5_crypto_compat_sum_func, - md5_crypto_verify_func, + krb5_md5_crypto_compat_sum_func, + krb5_md5_crypto_verify_func, RSA_MD5_DES_CKSUM_LENGTH, 1, /* is collision proof */ 1, /* uses key */ @@ -361,8 +361,8 @@ krb5_checksum_entry rsa_md5_des_cksumtable_entry = #else /* MD5_K5BETA_COMPAT && MD5_K5BETA_COMPAT_DEF */ { 0, - md5_crypto_sum_func, - md5_crypto_verify_func, + krb5_md5_crypto_sum_func, + krb5_md5_crypto_verify_func, RSA_MD5_DES_CKSUM_LENGTH+RSA_MD5_DES_CONFOUND_LENGTH, 1, /* is collision proof */ 1, /* uses key */ @@ -374,16 +374,16 @@ krb5_checksum_entry rsa_md5_des_cksumtable_entry = * Turn on/off compatible checksum generation. */ void -md5_crypto_compat_ctl(scompat) +krb5_md5_crypto_compat_ctl(scompat) krb5_boolean scompat; { if (scompat) { - rsa_md5_des_cksumtable_entry.sum_func = md5_crypto_compat_sum_func; + rsa_md5_des_cksumtable_entry.sum_func = krb5_md5_crypto_compat_sum_func; rsa_md5_des_cksumtable_entry.checksum_length = RSA_MD5_DES_CKSUM_LENGTH; } else { - rsa_md5_des_cksumtable_entry.sum_func = md5_crypto_sum_func; + rsa_md5_des_cksumtable_entry.sum_func = krb5_md5_crypto_sum_func; rsa_md5_des_cksumtable_entry.checksum_length = RSA_MD5_DES_CKSUM_LENGTH + RSA_MD5_DES_CONFOUND_LENGTH; } diff --git a/src/lib/crypto/md5/md5glue.c b/src/lib/crypto/md5/md5glue.c index d23a72f02..84ea3e9e7 100644 --- a/src/lib/crypto/md5/md5glue.c +++ b/src/lib/crypto/md5/md5glue.c @@ -4,15 +4,15 @@ /* Windows needs to these prototypes for the assignment below */ krb5_error_code -md5_sum_func PROTOTYPE((krb5_pointer in, size_t in_length, +krb5_md5_sum_func PROTOTYPE((krb5_pointer in, size_t in_length, krb5_pointer seed, size_t seed_length, krb5_checksum *outcksum)); krb5_error_code -md5_verify_func PROTOTYPE((krb5_checksum FAR *cksum, krb5_pointer in, +krb5_md5_verify_func PROTOTYPE((krb5_checksum FAR *cksum, krb5_pointer in, size_t in_length, krb5_pointer seed, size_t seed_length)); krb5_error_code -md5_sum_func(in, in_length, seed, seed_length, outcksum) +krb5_md5_sum_func(in, in_length, seed, seed_length, outcksum) krb5_pointer in; size_t in_length; krb5_pointer seed; @@ -20,11 +20,11 @@ size_t seed_length; krb5_checksum FAR *outcksum; { krb5_octet *input = (krb5_octet *)in; - MD5_CTX working; + krb5_MD5_CTX working; - MD5Init(&working); - MD5Update(&working, input, in_length); - MD5Final(&working); + krb5_MD5Init(&working); + krb5_MD5Update(&working, input, in_length); + krb5_MD5Final(&working); outcksum->checksum_type = CKSUMTYPE_RSA_MD5; outcksum->length = RSA_MD5_CKSUM_LENGTH; @@ -36,7 +36,7 @@ krb5_checksum FAR *outcksum; } krb5_error_code -md5_verify_func(cksum, in, in_length, seed, seed_length) +krb5_md5_verify_func(cksum, in, in_length, seed, seed_length) krb5_checksum FAR *cksum; krb5_pointer in; size_t in_length; @@ -44,15 +44,15 @@ krb5_pointer seed; size_t seed_length; { krb5_octet *input = (krb5_octet *)in; - MD5_CTX working; + krb5_MD5_CTX working; krb5_error_code retval; retval = 0; if (cksum->checksum_type == CKSUMTYPE_RSA_MD5) { if (cksum->length == RSA_MD5_CKSUM_LENGTH) { - MD5Init(&working); - MD5Update(&working, input, in_length); - MD5Final(&working); + krb5_MD5Init(&working); + krb5_MD5Update(&working, input, in_length); + krb5_MD5Final(&working); if (memcmp((char *) cksum->contents, (char *) &working.digest[0], @@ -70,8 +70,8 @@ size_t seed_length; krb5_checksum_entry rsa_md5_cksumtable_entry = { 0, - md5_sum_func, - md5_verify_func, + krb5_md5_sum_func, + krb5_md5_verify_func, RSA_MD5_CKSUM_LENGTH, 1, /* is collision proof */ 0, /* doesn't use key */ diff --git a/src/lib/crypto/md5/rsa-md5.h b/src/lib/crypto/md5/rsa-md5.h index 64c3c6bae..084ae7360 100644 --- a/src/lib/crypto/md5/rsa-md5.h +++ b/src/lib/crypto/md5/rsa-md5.h @@ -46,16 +46,16 @@ typedef struct { krb5_ui_4 buf[4]; /* scratch buffer */ unsigned char in[64]; /* input buffer */ unsigned char digest[16]; /* actual digest after MD5Final call */ -} MD5_CTX; +} krb5_MD5_CTX; #if (defined(__STDC__) || defined(_WINDOWS)) && !defined(KRB5_NO_PROTOTYPES) -extern void MD5Init(MD5_CTX FAR *); -extern void MD5Update (MD5_CTX FAR *, unsigned char FAR *, unsigned int); -extern void MD5Final (MD5_CTX FAR *); +extern void krb5_MD5Init(krb5_MD5_CTX FAR *); +extern void krb5_MD5Update(krb5_MD5_CTX FAR *,unsigned char FAR *,unsigned int); +extern void krb5_MD5Final(krb5_MD5_CTX FAR *); #else -extern void MD5Init(); -extern void MD5Update (); -extern void MD5Final (); +extern void krb5_MD5Init(); +extern void krb5_MD5Update(); +extern void krb5_MD5Final(); #endif #define RSA_MD5_CKSUM_LENGTH 16 diff --git a/src/lib/crypto/md5/t_cksum.c b/src/lib/crypto/md5/t_cksum.c index 74677aef9..d9d4f2aec 100644 --- a/src/lib/crypto/md5/t_cksum.c +++ b/src/lib/crypto/md5/t_cksum.c @@ -48,9 +48,9 @@ #else /* MD4_K5BETA_COMPAT */ #undef K5BETA_COMPAT #endif /* MD4_K5BETA_COMPAT */ -#define CKSUM_FUNCTION md4_crypto_sum_func -#define COMPAT_FUNCTION md4_crypto_compat_sum_func -#define VERIFY_FUNCTION md4_crypto_verify_func +#define CKSUM_FUNCTION krb5_md4_crypto_sum_func +#define COMPAT_FUNCTION krb5_md4_crypto_compat_sum_func +#define VERIFY_FUNCTION krb5_md4_crypto_verify_func #endif /* MD == 4 */ #if MD == 5 @@ -62,9 +62,9 @@ #else /* MD5_K5BETA_COMPAT */ #undef K5BETA_COMPAT #endif /* MD5_K5BETA_COMPAT */ -#define CKSUM_FUNCTION md5_crypto_sum_func -#define COMPAT_FUNCTION md5_crypto_compat_sum_func -#define VERIFY_FUNCTION md5_crypto_verify_func +#define CKSUM_FUNCTION krb5_md5_crypto_sum_func +#define COMPAT_FUNCTION krb5_md5_crypto_compat_sum_func +#define VERIFY_FUNCTION krb5_md5_crypto_verify_func #endif /* MD == 5 */ static void diff --git a/src/lib/crypto/md5/t_mddriver.c b/src/lib/crypto/md5/t_mddriver.c index 9b642b7df..407e5863c 100644 --- a/src/lib/crypto/md5/t_mddriver.c +++ b/src/lib/crypto/md5/t_mddriver.c @@ -50,17 +50,17 @@ struct md_test_entry { }; #if MD == 2 -#define MD_CTX MD2_CTX -#define MDInit MD2Init -#define MDUpdate MD2Update -#define MDFinal MD2Final +#define MD_CTX krb5_MD2_CTX +#define MDInit krb5_MD2Init +#define MDUpdate krb5_MD2Update +#define MDFinal krb5_MD2Final #endif #if MD == 4 -#define MD_CTX MD4_CTX -#define MDInit MD4Init -#define MDUpdate MD4Update -#define MDFinal MD4Final +#define MD_CTX krb5_MD4_CTX +#define MDInit krb5_MD4Init +#define MDUpdate krb5_MD4Update +#define MDFinal krb5_MD4Final #define HAVE_TEST_SUITE /* Test suite from RFC 1320 */ @@ -93,10 +93,10 @@ struct md_test_entry md_test_suite[] = { #endif #if MD == 5 -#define MD_CTX MD5_CTX -#define MDInit MD5Init -#define MDUpdate MD5Update -#define MDFinal MD5Final +#define MD_CTX krb5_MD5_CTX +#define MDInit krb5_MD5Init +#define MDUpdate krb5_MD5Update +#define MDFinal krb5_MD5Final #define HAVE_TEST_SUITE /* Test suite from RFC 1321 */