+Fri Apr 12 21:38:33 1996 Richard Basch <basch@lehman.com>
+
+ * 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 <tytso@dcl>
* Makefile.in: Remove ##DOS!include of config/windows.in.
(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;
}
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;
{
}
void
-MD4Final (mdContext)
-MD4_CTX FAR *mdContext;
+krb5_MD4Final (mdContext)
+krb5_MD4_CTX FAR *mdContext;
{
krb5_ui_4 in[16];
int mdi;
/* 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)
/* 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));
/*
*/
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
* 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;
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;
* 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;
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,
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,
}
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;
krb5_error_code retval;
size_t i;
- MD4_CTX working;
+ krb5_MD4_CTX working;
retval = 0;
if (cksum->checksum_type == CKSUMTYPE_RSA_MD4_DES) {
*/
/* Recalculate the checksum with no confounder */
- md4_calculate_cksum(&working,
+ krb5_md4_calculate_cksum(&working,
(krb5_pointer) NULL,
(size_t) 0,
in,
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,
#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 */
#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 */
* 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;
}
Each byte is printed with high-order hexadecimal digit first.
*/
static void MDPrint (mdContext)
-MD4_CTX *mdContext;
+krb5_MD4_CTX *mdContext;
{
int i;
*/
static void MDTimeTrial ()
{
- MD4_CTX mdContext;
+ krb5_MD4_CTX mdContext;
time_t endTime, startTime;
unsigned char data[TEST_BLOCK_SIZE];
unsigned int i;
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);
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);
}
#else
FILE *inFile = fopen (filename, "r");
#endif
- MD4_CTX mdContext;
+ krb5_MD4_CTX mdContext;
int bytes;
unsigned char data[1024];
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);
*/
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");
}
/* 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;
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;
}
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;
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],
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 */
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
/*