mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-07-29 11:41:15 +03:00
Don't directly access key_bitlen
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
This commit is contained in:
@ -129,7 +129,7 @@ const mbedtls_cipher_info_t *mbedtls_cipher_info_from_values(
|
||||
|
||||
for (def = mbedtls_cipher_definitions; def->info != NULL; def++) {
|
||||
if (def->info->base->cipher == cipher_id &&
|
||||
def->info->key_bitlen == (unsigned) key_bitlen &&
|
||||
mbedtls_cipher_info_get_key_bitlen(def->info) == (unsigned) key_bitlen &&
|
||||
def->info->mode == mode) {
|
||||
return def->info;
|
||||
}
|
||||
@ -323,7 +323,7 @@ int mbedtls_cipher_setkey(mbedtls_cipher_context_t *ctx,
|
||||
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||
|
||||
if ((ctx->cipher_info->flags & MBEDTLS_CIPHER_VARIABLE_KEY_LEN) == 0 &&
|
||||
(int) ctx->cipher_info->key_bitlen != key_bitlen) {
|
||||
(int) mbedtls_cipher_info_get_key_bitlen(ctx->cipher_info) != key_bitlen) {
|
||||
return MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA;
|
||||
}
|
||||
|
||||
|
@ -151,7 +151,7 @@ int mbedtls_pkcs12_pbe(mbedtls_asn1_buf *pbe_params, int mode,
|
||||
return MBEDTLS_ERR_PKCS12_FEATURE_UNAVAILABLE;
|
||||
}
|
||||
|
||||
keylen = cipher_info->key_bitlen / 8;
|
||||
keylen = mbedtls_cipher_info_get_key_bitlen(cipher_info) / 8;
|
||||
|
||||
if ((ret = pkcs12_pbe_derive_key_iv(pbe_params, md_type, pwd, pwdlen,
|
||||
key, keylen,
|
||||
|
@ -176,7 +176,7 @@ int mbedtls_pkcs5_pbes2(const mbedtls_asn1_buf *pbe_params, int mode,
|
||||
* The value of keylen from pkcs5_parse_pbkdf2_params() is ignored
|
||||
* since it is optional and we don't know if it was set or not
|
||||
*/
|
||||
keylen = cipher_info->key_bitlen / 8;
|
||||
keylen = mbedtls_cipher_info_get_key_bitlen(cipher_info) / 8;
|
||||
|
||||
if (enc_scheme_params.tag != MBEDTLS_ASN1_OCTET_STRING ||
|
||||
enc_scheme_params.len != cipher_info->iv_size) {
|
||||
|
Reference in New Issue
Block a user