qcacld-3.0: Avoid to use incorrect key length
Current parameter passed to lim_get_crypto_digest_len will be either SHA386 or SHA256, won't return -EINVAL in any case. For later considering, return 0 if parameter not the 2 crypto types. Change-Id: I6cd7481a06106138df7ba18fbe9ed4eece246607 CRs-Fixed: 2751809
This commit is contained in:
parent
b71c7963a8
commit
8a00b3fe63
@ -61,7 +61,8 @@ static int lim_get_crypto_digest_len(uint8_t *type)
|
||||
return SHA384_DIGEST_SIZE;
|
||||
else if (!strcmp(type, HMAC_SHA256_CRYPTO_TYPE))
|
||||
return SHA256_DIGEST_SIZE;
|
||||
return -EINVAL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -283,6 +284,11 @@ static QDF_STATUS lim_get_key_from_prf(uint8_t *type, uint8_t *secret,
|
||||
uint8_t crypto_digest_len = lim_get_crypto_digest_len(type);
|
||||
uint8_t tmp_hash[SHA384_DIGEST_SIZE] = {0};
|
||||
|
||||
if (!crypto_digest_len) {
|
||||
pe_err("Incorrect crypto length");
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
|
||||
addr[0] = count;
|
||||
len[0] = sizeof(count);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user