2004-02-17 Ken Raeburn <raeburn@mit.edu>
+ * f_tables.h (DES_DO_ENCRYPT, DES_DO_DECRYPT): Allocate temporary
+ variable locally instead of taking the extra argument.
+ * d3_cbc.c (krb5int_des3_cbc_encrypt): Don't pass the extra
+ argument, and delete the automatic variable.
+ (krb5int_des3_cbc_decrypt): Likewise.
+ * f_cbc.c (krb5int_des_cbc_encrypt, krb5int_des_cbc_decrypt):
+ Likewise.
+ * f_cksum.c (mit_des_cbc_cksum): Likewise.
+
* afsstring2key.c (krb5_afs_encrypt): Drop EDFLAG as an argument,
make it local instead, since we always pass 0.
(afs_crypt): Call changed.
const mit_des_cblock ivec)
{
register unsigned DES_INT32 left, right;
- register unsigned DES_INT32 temp;
const unsigned DES_INT32 *kp1, *kp2, *kp3;
const unsigned char *ip;
unsigned char *op;
/*
* Encrypt what we have
*/
- DES_DO_ENCRYPT(left, right, temp, kp1);
- DES_DO_DECRYPT(left, right, temp, kp2);
- DES_DO_ENCRYPT(left, right, temp, kp3);
+ DES_DO_ENCRYPT(left, right, kp1);
+ DES_DO_DECRYPT(left, right, kp2);
+ DES_DO_ENCRYPT(left, right, kp3);
/*
* Copy the results out
const mit_des_cblock ivec)
{
register unsigned DES_INT32 left, right;
- register unsigned DES_INT32 temp;
const unsigned DES_INT32 *kp1, *kp2, *kp3;
const unsigned char *ip;
unsigned char *op;
/*
* Decrypt this.
*/
- DES_DO_DECRYPT(left, right, temp, kp3);
- DES_DO_ENCRYPT(left, right, temp, kp2);
- DES_DO_DECRYPT(left, right, temp, kp1);
+ DES_DO_DECRYPT(left, right, kp3);
+ DES_DO_ENCRYPT(left, right, kp2);
+ DES_DO_DECRYPT(left, right, kp1);
/*
* Xor with the old cipher to get plain
const mit_des_cblock ivec)
{
register unsigned DES_INT32 left, right;
- register unsigned DES_INT32 temp;
const unsigned DES_INT32 *kp;
const unsigned char *ip;
unsigned char *op;
/*
* Encrypt what we have
*/
- DES_DO_ENCRYPT(left, right, temp, kp);
+ DES_DO_ENCRYPT(left, right, kp);
/*
* Copy the results out
const mit_des_cblock ivec)
{
register unsigned DES_INT32 left, right;
- register unsigned DES_INT32 temp;
const unsigned DES_INT32 *kp;
const unsigned char *ip;
unsigned char *op;
/*
* Decrypt this.
*/
- DES_DO_DECRYPT(left, right, temp, kp);
+ DES_DO_DECRYPT(left, right, kp);
/*
* Xor with the old cipher to get plain
const krb5_octet *ivec;
{
register unsigned DES_INT32 left, right;
- register unsigned DES_INT32 temp;
const unsigned DES_INT32 *kp;
const unsigned char *ip;
unsigned char *op;
* Encrypt what we have
*/
kp = (const unsigned DES_INT32 *)schedule;
- DES_DO_ENCRYPT(left, right, temp, kp);
+ DES_DO_ENCRYPT(left, right, kp);
}
/*
* at each stage of the encryption, so that by comparing the output to
* a known good machine, the location of the first error can be found.
*/
-#define DES_DO_ENCRYPT(left, right, temp, kp) \
+#define DES_DO_ENCRYPT(left, right, kp) \
do { \
register int i; \
+ register unsigned DES_INT32 temp1; \
DEB (("do_encrypt %8lX %8lX \n", left, right)); \
- DES_INITIAL_PERM((left), (right), (temp)); \
+ DES_INITIAL_PERM((left), (right), (temp1)); \
DEB ((" after IP %8lX %8lX\n", left, right)); \
for (i = 0; i < 8; i++) { \
- DES_SP_ENCRYPT_ROUND((left), (right), (temp), (kp)); \
+ DES_SP_ENCRYPT_ROUND((left), (right), (temp1), (kp)); \
DEB ((" round %2d %8lX %8lX \n", i*2, left, right)); \
- DES_SP_ENCRYPT_ROUND((right), (left), (temp), (kp)); \
+ DES_SP_ENCRYPT_ROUND((right), (left), (temp1), (kp)); \
DEB ((" round %2d %8lX %8lX \n", 1+i*2, left, right)); \
} \
- DES_FINAL_PERM((left), (right), (temp)); \
+ DES_FINAL_PERM((left), (right), (temp1)); \
(kp) -= (2 * 16); \
DEB ((" after FP %8lX %8lX \n", left, right)); \
} while (0)
-#define DES_DO_DECRYPT(left, right, temp, kp) \
+#define DES_DO_DECRYPT(left, right, kp) \
do { \
register int i; \
- DES_INITIAL_PERM((left), (right), (temp)); \
+ register unsigned DES_INT32 temp2; \
+ DES_INITIAL_PERM((left), (right), (temp2)); \
(kp) += (2 * 16); \
for (i = 0; i < 8; i++) { \
- DES_SP_DECRYPT_ROUND((left), (right), (temp), (kp)); \
- DES_SP_DECRYPT_ROUND((right), (left), (temp), (kp)); \
+ DES_SP_DECRYPT_ROUND((left), (right), (temp2), (kp)); \
+ DES_SP_DECRYPT_ROUND((right), (left), (temp2), (kp)); \
} \
- DES_FINAL_PERM((left), (right), (temp)); \
+ DES_FINAL_PERM((left), (right), (temp2)); \
} while (0)
/*