From 33f01d51e794870dd432269482f1c265ab44c37f Mon Sep 17 00:00:00 2001 From: Richard Basch Date: Sat, 13 Apr 1996 01:40:05 +0000 Subject: [PATCH] Renamed the functions to begin with krb5_ (like was done with MD5) git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@7805 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/crypto/md4/ChangeLog | 5 ++++ src/lib/crypto/md4/md4.c | 14 ++++----- src/lib/crypto/md4/md4crypto.c | 54 +++++++++++++++++----------------- src/lib/crypto/md4/md4driver.c | 34 ++++++++++----------- src/lib/crypto/md4/md4glue.c | 28 +++++++++--------- src/lib/crypto/md4/rsa-md4.h | 14 ++++----- 6 files changed, 77 insertions(+), 72 deletions(-) diff --git a/src/lib/crypto/md4/ChangeLog b/src/lib/crypto/md4/ChangeLog index 702d9ec25..f6b0c97a4 100644 --- a/src/lib/crypto/md4/ChangeLog +++ b/src/lib/crypto/md4/ChangeLog @@ -1,3 +1,8 @@ +Fri Apr 12 21:38:33 1996 Richard Basch + + * md4driver.c md4glue.c md4.c rsa-md4.h md4crypto.c: + Renamed the functions to be preceded with krb5_ + Fri Oct 6 22:00:15 1995 Theodore Y. Ts'o * Makefile.in: Remove ##DOS!include of config/windows.in. diff --git a/src/lib/crypto/md4/md4.c b/src/lib/crypto/md4/md4.c index 878b81df2..baa9dc102 100644 --- a/src/lib/crypto/md4/md4.c +++ b/src/lib/crypto/md4/md4.c @@ -83,8 +83,8 @@ static unsigned char PADDING[64] = { (a) = ROTATE_LEFT ((a), (s));} void -MD4Init (mdContext) -MD4_CTX FAR *mdContext; +krb5_MD4Init (mdContext) +krb5_MD4_CTX FAR *mdContext; { mdContext->i[0] = mdContext->i[1] = (krb5_ui_4)0; @@ -97,8 +97,8 @@ MD4_CTX FAR *mdContext; } void -MD4Update (mdContext, inBuf, inLen) -MD4_CTX FAR *mdContext; +krb5_MD4Update (mdContext, inBuf, inLen) +krb5_MD4_CTX FAR *mdContext; unsigned char FAR *inBuf; unsigned int inLen; { @@ -133,8 +133,8 @@ unsigned int inLen; } void -MD4Final (mdContext) -MD4_CTX FAR *mdContext; +krb5_MD4Final (mdContext) +krb5_MD4_CTX FAR *mdContext; { krb5_ui_4 in[16]; int mdi; @@ -150,7 +150,7 @@ MD4_CTX FAR *mdContext; /* pad out to 56 mod 64 */ padLen = (mdi < 56) ? (56 - mdi) : (120 - mdi); - MD4Update (mdContext, PADDING, padLen); + krb5_MD4Update (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/md4/md4crypto.c b/src/lib/crypto/md4/md4crypto.c index 72434d289..7d908e0e5 100644 --- a/src/lib/crypto/md4/md4crypto.c +++ b/src/lib/crypto/md4/md4crypto.c @@ -31,11 +31,11 @@ /* Windows needs to these prototypes for the assignment below */ krb5_error_code -md4_crypto_sum_func PROTOTYPE((krb5_pointer in, size_t in_length, +krb5_md4_crypto_sum_func PROTOTYPE((krb5_pointer in, size_t in_length, krb5_pointer seed, size_t seed_length, krb5_checksum *outcksum)); krb5_error_code -md4_crypto_verify_func PROTOTYPE((krb5_checksum FAR *cksum, krb5_pointer in, +krb5_md4_crypto_verify_func PROTOTYPE((krb5_checksum FAR *cksum, krb5_pointer in, size_t in_length, krb5_pointer seed, size_t seed_length)); /* @@ -53,18 +53,18 @@ md4_crypto_verify_func PROTOTYPE((krb5_checksum FAR *cksum, krb5_pointer in, */ static void -md4_calculate_cksum(md4ctx, in, in_length, confound, confound_length) - MD4_CTX *md4ctx; +krb5_md4_calculate_cksum(md4ctx, in, in_length, confound, confound_length) + krb5_MD4_CTX *md4ctx; krb5_pointer in; size_t in_length; krb5_pointer confound; size_t confound_length; { - MD4Init(md4ctx); + krb5_MD4Init(md4ctx); if (confound && confound_length) - MD4Update(md4ctx, confound, confound_length); - MD4Update(md4ctx, in, in_length); - MD4Final(md4ctx); + krb5_MD4Update(md4ctx, confound, confound_length); + krb5_MD4Update(md4ctx, in, in_length); + krb5_MD4Final(md4ctx); } #ifdef MD4_K5BETA_COMPAT @@ -73,7 +73,7 @@ md4_calculate_cksum(md4ctx, in, in_length, confound, confound_length) * K5 Beta implementations. Sigh... */ krb5_error_code -md4_crypto_compat_sum_func(in, in_length, seed, seed_length, outcksum) +krb5_md4_crypto_compat_sum_func(in, in_length, seed, seed_length, outcksum) krb5_pointer in; size_t in_length; krb5_pointer seed; @@ -86,11 +86,11 @@ krb5_checksum FAR *outcksum; krb5_keyblock keyblock; krb5_error_code retval; - MD4_CTX working; + krb5_MD4_CTX working; - MD4Init(&working); - MD4Update(&working, input, in_length); - MD4Final(&working); + krb5_MD4Init(&working); + krb5_MD4Update(&working, input, in_length); + krb5_MD4Final(&working); outcksum->checksum_type = CKSUMTYPE_RSA_MD4_DES; outcksum->length = RSA_MD4_DES_CKSUM_LENGTH; @@ -124,7 +124,7 @@ krb5_checksum FAR *outcksum; * Generate the RSA-MD4-DES checksum correctly. */ krb5_error_code -md4_crypto_sum_func(in, in_length, seed, seed_length, outcksum) +krb5_md4_crypto_sum_func(in, in_length, seed, seed_length, outcksum) krb5_pointer in; size_t in_length; krb5_pointer seed; @@ -140,7 +140,7 @@ krb5_checksum FAR *outcksum; krb5_error_code retval; size_t i; - MD4_CTX working; + krb5_MD4_CTX working; /* Generate the confounder in place */ if (retval = krb5_random_confounder(RSA_MD4_DES_CONFOUND_LENGTH, @@ -148,7 +148,7 @@ krb5_checksum FAR *outcksum; return(retval); /* Calculate the checksum */ - md4_calculate_cksum(&working, + krb5_md4_calculate_cksum(&working, (krb5_pointer) outtmp, (size_t) RSA_MD4_DES_CONFOUND_LENGTH, in, @@ -192,7 +192,7 @@ krb5_checksum FAR *outcksum; } krb5_error_code -md4_crypto_verify_func(cksum, in, in_length, seed, seed_length) +krb5_md4_crypto_verify_func(cksum, in, in_length, seed, seed_length) krb5_checksum FAR *cksum; krb5_pointer in; size_t in_length; @@ -208,7 +208,7 @@ size_t seed_length; krb5_error_code retval; size_t i; - MD4_CTX working; + krb5_MD4_CTX working; retval = 0; if (cksum->checksum_type == CKSUMTYPE_RSA_MD4_DES) { @@ -228,7 +228,7 @@ size_t seed_length; */ /* Recalculate the checksum with no confounder */ - md4_calculate_cksum(&working, + krb5_md4_calculate_cksum(&working, (krb5_pointer) NULL, (size_t) 0, in, @@ -301,7 +301,7 @@ size_t seed_length; return(retval); /* Now that we have the decrypted checksum, try to regenerate it */ - md4_calculate_cksum(&working, + krb5_md4_calculate_cksum(&working, (krb5_pointer) outtmp, (size_t) RSA_MD4_DES_CONFOUND_LENGTH, in, @@ -328,8 +328,8 @@ krb5_checksum_entry rsa_md4_des_cksumtable_entry = #if defined(MD4_K5BETA_COMPAT) && defined(MD4_K5BETA_COMPAT_DEF) { 0, - md4_crypto_compat_sum_func, - md4_crypto_verify_func, + krb5_md4_crypto_compat_sum_func, + krb5_md4_crypto_verify_func, RSA_MD4_DES_CKSUM_LENGTH, 1, /* is collision proof */ 1, /* uses key */ @@ -337,8 +337,8 @@ krb5_checksum_entry rsa_md4_des_cksumtable_entry = #else /* MD4_K5BETA_COMPAT && MD4_K5BETA_COMPAT_DEF */ { 0, - md4_crypto_sum_func, - md4_crypto_verify_func, + krb5_md4_crypto_sum_func, + krb5_md4_crypto_verify_func, RSA_MD4_DES_CKSUM_LENGTH+RSA_MD4_DES_CONFOUND_LENGTH, 1, /* is collision proof */ 1, /* uses key */ @@ -350,16 +350,16 @@ krb5_checksum_entry rsa_md4_des_cksumtable_entry = * Turn on/off compatible checksum generation. */ void -md4_crypto_compat_ctl(scompat) +krb5_md4_crypto_compat_ctl(scompat) krb5_boolean scompat; { if (scompat) { - rsa_md4_des_cksumtable_entry.sum_func = md4_crypto_compat_sum_func; + rsa_md4_des_cksumtable_entry.sum_func = krb5_md4_crypto_compat_sum_func; rsa_md4_des_cksumtable_entry.checksum_length = RSA_MD4_DES_CKSUM_LENGTH; } else { - rsa_md4_des_cksumtable_entry.sum_func = md4_crypto_sum_func; + rsa_md4_des_cksumtable_entry.sum_func = krb5_md4_crypto_sum_func; rsa_md4_des_cksumtable_entry.checksum_length = RSA_MD4_DES_CKSUM_LENGTH + RSA_MD4_DES_CONFOUND_LENGTH; } diff --git a/src/lib/crypto/md4/md4driver.c b/src/lib/crypto/md4/md4driver.c index 1d80eca48..425ef2954 100644 --- a/src/lib/crypto/md4/md4driver.c +++ b/src/lib/crypto/md4/md4driver.c @@ -33,7 +33,7 @@ Each byte is printed with high-order hexadecimal digit first. */ static void MDPrint (mdContext) -MD4_CTX *mdContext; +krb5_MD4_CTX *mdContext; { int i; @@ -56,7 +56,7 @@ static long TEST_BYTES = (long)TEST_BLOCK_SIZE * (long)TEST_BLOCKS; */ static void MDTimeTrial () { - MD4_CTX mdContext; + krb5_MD4_CTX mdContext; time_t endTime, startTime; unsigned char data[TEST_BLOCK_SIZE]; unsigned int i; @@ -70,10 +70,10 @@ static void MDTimeTrial () time (&startTime); /* digest data in TEST_BLOCK_SIZE byte blocks */ - MD4Init (&mdContext); + krb5_MD4Init (&mdContext); for (i = TEST_BLOCKS; i > 0; i--) - MD4Update (&mdContext, data, TEST_BLOCK_SIZE); - MD4Final (&mdContext); + krb5_MD4Update (&mdContext, data, TEST_BLOCK_SIZE); + krb5_MD4Final (&mdContext); /* stop timer, get time difference */ time (&endTime); MDPrint (&mdContext); @@ -92,12 +92,12 @@ static void MDTimeTrial () static void MDString (inString) char *inString; { - MD4_CTX mdContext; + krb5_MD4_CTX mdContext; unsigned int len = strlen (inString); - MD4Init (&mdContext); - MD4Update (&mdContext, inString, len); - MD4Final (&mdContext); + krb5_MD4Init (&mdContext); + krb5_MD4Update (&mdContext, inString, len); + krb5_MD4Final (&mdContext); MDPrint (&mdContext); printf (" \"%s\"\n\n", inString); } @@ -114,7 +114,7 @@ char *filename; #else FILE *inFile = fopen (filename, "r"); #endif - MD4_CTX mdContext; + krb5_MD4_CTX mdContext; int bytes; unsigned char data[1024]; @@ -123,10 +123,10 @@ char *filename; return; } - MD4Init (&mdContext); + krb5_MD4Init (&mdContext); while ((bytes = fread (data, 1, 1024, inFile)) != 0) - MD4Update (&mdContext, data, bytes); - MD4Final (&mdContext); + krb5_MD4Update (&mdContext, data, bytes); + krb5_MD4Final (&mdContext); MDPrint (&mdContext); printf (" %s\n", filename); fclose (inFile); @@ -138,14 +138,14 @@ char *filename; */ static void MDFilter () { - MD4_CTX mdContext; + krb5_MD4_CTX mdContext; int bytes; unsigned char data[16]; - MD4Init (&mdContext); + krb5_MD4Init (&mdContext); while ((bytes = fread (data, 1, 16, stdin)) != 0) - MD4Update (&mdContext, data, bytes); - MD4Final (&mdContext); + krb5_MD4Update (&mdContext, data, bytes); + krb5_MD4Final (&mdContext); MDPrint (&mdContext); printf ("\n"); } diff --git a/src/lib/crypto/md4/md4glue.c b/src/lib/crypto/md4/md4glue.c index 3af2f09f0..5edbd1514 100644 --- a/src/lib/crypto/md4/md4glue.c +++ b/src/lib/crypto/md4/md4glue.c @@ -29,15 +29,15 @@ /* Windows needs to these prototypes for the assignment below */ krb5_error_code -md4_sum_func PROTOTYPE((krb5_pointer in, size_t in_length, +krb5_md4_sum_func PROTOTYPE((krb5_pointer in, size_t in_length, krb5_pointer seed, size_t seed_length, krb5_checksum *outcksum)); krb5_error_code -md4_verify_func PROTOTYPE((krb5_checksum FAR *cksum, krb5_pointer in, +krb5_md4_verify_func PROTOTYPE((krb5_checksum FAR *cksum, krb5_pointer in, size_t in_length, krb5_pointer seed, size_t seed_length)); krb5_error_code -md4_sum_func(in, in_length, seed, seed_length, outcksum) +krb5_md4_sum_func(in, in_length, seed, seed_length, outcksum) krb5_pointer in; size_t in_length; krb5_pointer seed; @@ -45,11 +45,11 @@ size_t seed_length; krb5_checksum FAR *outcksum; { krb5_octet *input = (krb5_octet *)in; - MD4_CTX working; + krb5_MD4_CTX working; - MD4Init(&working); - MD4Update(&working, input, in_length); - MD4Final(&working); + krb5_MD4Init(&working); + krb5_MD4Update(&working, input, in_length); + krb5_MD4Final(&working); outcksum->checksum_type = CKSUMTYPE_RSA_MD4; outcksum->length = RSA_MD4_CKSUM_LENGTH; @@ -62,7 +62,7 @@ krb5_checksum FAR *outcksum; } krb5_error_code -md4_verify_func(cksum, in, in_length, seed, seed_length) +krb5_md4_verify_func(cksum, in, in_length, seed, seed_length) krb5_checksum FAR *cksum; krb5_pointer in; size_t in_length; @@ -70,15 +70,15 @@ krb5_pointer seed; size_t seed_length; { krb5_octet *input = (krb5_octet *)in; - MD4_CTX working; + krb5_MD4_CTX working; krb5_error_code retval; retval = 0; if (cksum->checksum_type == CKSUMTYPE_RSA_MD4) { if (cksum->length == RSA_MD4_CKSUM_LENGTH) { - MD4Init(&working); - MD4Update(&working, input, in_length); - MD4Final(&working); + krb5_MD4Init(&working); + krb5_MD4Update(&working, input, in_length); + krb5_MD4Final(&working); if (memcmp((char *) cksum->contents, (char *) &working.digest[0], @@ -96,8 +96,8 @@ size_t seed_length; krb5_checksum_entry rsa_md4_cksumtable_entry = { 0, - md4_sum_func, - md4_verify_func, + krb5_md4_sum_func, + krb5_md4_verify_func, RSA_MD4_CKSUM_LENGTH, 1, /* is collision proof */ 0, /* doesn't use key */ diff --git a/src/lib/crypto/md4/rsa-md4.h b/src/lib/crypto/md4/rsa-md4.h index 13d99a2cb..761309297 100644 --- a/src/lib/crypto/md4/rsa-md4.h +++ b/src/lib/crypto/md4/rsa-md4.h @@ -80,16 +80,16 @@ typedef struct { krb5_ui_4 buf[4]; /* scratch buffer */ unsigned char in[64]; /* input buffer */ unsigned char digest[16]; /* actual digest after MD4Final call */ -} MD4_CTX; +} krb5_MD4_CTX; #if defined(__STDC__) || defined(_WINDOWS) -extern void MD4Init(MD4_CTX FAR *); -extern void MD4Update(MD4_CTX FAR *, unsigned char FAR *, unsigned int); -extern void MD4Final(MD4_CTX FAR *); +extern void krb5_MD4Init(krb5_MD4_CTX FAR *); +extern void krb5_MD4Update(krb5_MD4_CTX FAR *, unsigned char FAR *, unsigned int); +extern void krb5_MD4Final(krb5_MD4_CTX FAR *); #else -void MD4Init (); -void MD4Update (); -void MD4Final (); +void krb5_MD4Init (); +void krb5_MD4Update (); +void krb5_MD4Final (); #endif /* -- 2.26.2