From cc4cb2db8722e141a6abbd3a527338d8075c238d Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Tue, 17 Feb 2004 23:36:41 +0000 Subject: [PATCH] * afsstring2key.c (krb5_afs_encrypt): Drop EDFLAG as an argument, make it local instead, since we always pass 0. (afs_crypt): Call changed. (krb5_afs_crypt_setkey, krb5_afs_encrypt): Use memcpy. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16094 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/crypto/des/ChangeLog | 7 +++++++ src/lib/crypto/des/afsstring2key.c | 20 ++++++++++++++++---- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/lib/crypto/des/ChangeLog b/src/lib/crypto/des/ChangeLog index e537e3c26..ae28fa253 100644 --- a/src/lib/crypto/des/ChangeLog +++ b/src/lib/crypto/des/ChangeLog @@ -1,3 +1,10 @@ +2004-02-17 Ken Raeburn + + * afsstring2key.c (krb5_afs_encrypt): Drop EDFLAG as an argument, + make it local instead, since we always pass 0. + (afs_crypt): Call changed. + (krb5_afs_crypt_setkey, krb5_afs_encrypt): Use memcpy. + 2003-12-19 Ken Raeburn * f_cbc.c (mit_des_zeroblock): Define, as a single cblock, not the diff --git a/src/lib/crypto/des/afsstring2key.c b/src/lib/crypto/des/afsstring2key.c index 0fe65ba01..264414b76 100644 --- a/src/lib/crypto/des/afsstring2key.c +++ b/src/lib/crypto/des/afsstring2key.c @@ -188,7 +188,7 @@ mit_afs_string_to_key (keyblock, data, salt) */ static void krb5_afs_crypt_setkey (char*, char*, char(*)[48]); -static void krb5_afs_encrypt (char*,long,char*,char (*)[48]); +static void krb5_afs_encrypt (char*,char*,char (*)[48]); /* * Initial permutation, @@ -382,7 +382,7 @@ char *afs_crypt(pw, salt, iobuf) } for(i=0; i<25; i++) - krb5_afs_encrypt(block,0,E,KS); + krb5_afs_encrypt(block,E,KS); for(i=0; i<11; i++){ c = 0; @@ -454,20 +454,24 @@ static void krb5_afs_crypt_setkey(key, E, KS) } } +#if 0 for(i=0;i<48;i++) { E[i] = e[i]; } +#else + memcpy(E, e, 48); +#endif } /* * The payoff: encrypt a block. */ -static void krb5_afs_encrypt(block, edflag, E, KS) +static void krb5_afs_encrypt(block, E, KS) char *block; - long edflag; char *E, (*KS)[48]; { + const long edflag = 0; int i, ii; int t, j, k; char tempL[32]; @@ -502,8 +506,12 @@ static void krb5_afs_encrypt(block, edflag, E, KS) * Save the R array, * which will be the new L. */ +#if 0 for (j=0; j<32; j++) tempL[j] = R[j]; +#else + memcpy(tempL, R, 32); +#endif /* * Expand R to 48 bits using the E selector; * exclusive-or with the current key bits. @@ -545,8 +553,12 @@ static void krb5_afs_encrypt(block, edflag, E, KS) * Finally, the new L (the original R) * is copied back. */ +#if 0 for (j=0; j<32; j++) L[j] = tempL[j]; +#else + memcpy(L, tempL, 32); +#endif } /* * The output L and R are reversed. -- 2.26.2