Fix 1DES/3DES cast bug and build
This commit is contained in:
@@ -40,9 +40,8 @@
|
||||
*/
|
||||
|
||||
KRB5_LIB_FUNCTION void KRB5_LIB_CALL
|
||||
_krb5_xor (DES_cblock *key, const unsigned char *b)
|
||||
_krb5_xor8(unsigned char *a, const unsigned char *b)
|
||||
{
|
||||
unsigned char *a = (unsigned char*)key;
|
||||
a[0] ^= b[0];
|
||||
a[1] ^= b[1];
|
||||
a[2] ^= b[2];
|
||||
|
@@ -65,7 +65,7 @@ krb5_DES_random_to_key(krb5_context context,
|
||||
memcpy(k, data, key->keyvalue.length);
|
||||
DES_set_odd_parity(k);
|
||||
if(DES_is_weak_key(k))
|
||||
_krb5_xor(k, (const unsigned char*)"\0\0\0\0\0\0\0\xf0");
|
||||
_krb5_xor8(*k, (const unsigned char*)"\0\0\0\0\0\0\0\xf0");
|
||||
}
|
||||
|
||||
static struct _krb5_key_type keytype_des_old = {
|
||||
|
@@ -278,6 +278,6 @@ _krb5_DES3_random_to_key(krb5_context context,
|
||||
for (i = 0; i < 3; i++) {
|
||||
DES_set_odd_parity(&k[i]);
|
||||
if(DES_is_weak_key(&k[i]))
|
||||
_krb5_xor(&k[i], (const unsigned char*)"\0\0\0\0\0\0\0\xf0");
|
||||
_krb5_xor8(k[i], (const unsigned char*)"\0\0\0\0\0\0\0\xf0");
|
||||
}
|
||||
}
|
||||
|
@@ -71,7 +71,7 @@ DES3_string_to_key(krb5_context context,
|
||||
memcpy(keys + i, tmp + i * 8, sizeof(keys[i]));
|
||||
DES_set_odd_parity(keys + i);
|
||||
if(DES_is_weak_key(keys + i))
|
||||
_krb5_xor(keys + i, (const unsigned char*)"\0\0\0\0\0\0\0\xf0");
|
||||
_krb5_xor8(*(keys + i), (const unsigned char*)"\0\0\0\0\0\0\0\xf0");
|
||||
DES_set_key_unchecked(keys + i, &s[i]);
|
||||
}
|
||||
memset(&ivec, 0, sizeof(ivec));
|
||||
@@ -84,7 +84,7 @@ DES3_string_to_key(krb5_context context,
|
||||
memcpy(keys + i, tmp + i * 8, sizeof(keys[i]));
|
||||
DES_set_odd_parity(keys + i);
|
||||
if(DES_is_weak_key(keys + i))
|
||||
_krb5_xor(keys + i, (const unsigned char*)"\0\0\0\0\0\0\0\xf0");
|
||||
_krb5_xor8(*(keys + i), (const unsigned char*)"\0\0\0\0\0\0\0\xf0");
|
||||
}
|
||||
memset(tmp, 0, sizeof(tmp));
|
||||
}
|
||||
|
Reference in New Issue
Block a user