Add explicit uint8_t casts for Blake2's key length.

via @evoskuil
This commit is contained in:
Frank Denis 2014-04-09 18:45:59 -07:00 committed by evoskuil
parent cb2ce89a03
commit aa2bd4d09b

View File

@ -56,8 +56,8 @@ crypto_generichash_blake2b_init(crypto_generichash_blake2b_state *state,
if (blake2b_init(state, (uint8_t) outlen) != 0) {
return -1;
}
} else if (blake2b_init_key(state, (uint8_t) outlen, key,
(uint8_t) keylen /* Is cast from size_t to uint8_t safe here? */ ) != 0) {
} else if (blake2b_init_key(state, (uint8_t) outlen, key,
(uint8_t) keylen) != 0) {
return -1;
}
return 0;
@ -82,8 +82,8 @@ crypto_generichash_blake2b_init_salt_personal(crypto_generichash_blake2b_state *
return -1;
}
} else if (blake2b_init_key_salt_personal(state,
(uint8_t)outlen, key,
(uint8_t)keylen, /* Is cast from size_t to uint8_t safe here? */
(uint8_t) outlen, key,
(uint8_t) keylen,
salt, personal) != 0) {
return -1;
}