1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 08:08:50 -05:00

ntlm_core: Prefer sizeof(key) rather than hard coded sizes

This commit is contained in:
Steve Holme 2015-01-28 20:55:06 +00:00
parent 58e39b4da5
commit c469369b86

View File

@ -181,7 +181,7 @@ static void setup_des_key(const unsigned char *key_56,
extend_key_56_to_64(key_56, key); extend_key_56_to_64(key_56, key);
/* Set the key */ /* Set the key */
gcry_cipher_setkey(*des, key, 8); gcry_cipher_setkey(*des, key, sizeof(key));
} }
#elif defined(USE_NSS) #elif defined(USE_NSS)
@ -214,7 +214,7 @@ static bool encrypt_des(const unsigned char *in, unsigned char *out,
/* Import the key */ /* Import the key */
key_item.data = (unsigned char *)key; key_item.data = (unsigned char *)key;
key_item.len = /* hard-wired */ 8; key_item.len = sizeof(key);
symkey = PK11_ImportSymKey(slot, mech, PK11_OriginUnwrap, CKA_ENCRYPT, symkey = PK11_ImportSymKey(slot, mech, PK11_OriginUnwrap, CKA_ENCRYPT,
&key_item, NULL); &key_item, NULL);
if(!symkey) if(!symkey)
@ -276,7 +276,7 @@ static bool encrypt_des(const unsigned char *in, unsigned char *out,
/* Setup the cipher control structure */ /* Setup the cipher control structure */
ctl.Func_ID = ENCRYPT_ONLY; ctl.Func_ID = ENCRYPT_ONLY;
ctl.Data_Len = 8; ctl.Data_Len = sizeof(key);
/* Expand the 56-bit key to 64-bits */ /* Expand the 56-bit key to 64-bits */
extend_key_56_to_64(key_56, ctl.Crypto_Key); extend_key_56_to_64(key_56, ctl.Crypto_Key);