Skip to content

Commit 0fbfbb8

Browse files
committed
se050: refuse invalid digest sz in ECDSA
1 parent e6a7be8 commit 0fbfbb8

1 file changed

Lines changed: 4 additions & 10 deletions

File tree

wolfcrypt/src/port/nxp/se050_port.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2146,11 +2146,8 @@ int se050_ecc_sign_hash_ex(const byte* in, word32 inLen, MATH_INT_T* r, MATH_INT
21462146

21472147
algorithm = se050_map_hash_alg(inLen);
21482148
if (algorithm == kAlgorithm_None) {
2149-
inLen = keySize; /* try key size */
2150-
algorithm = se050_map_hash_alg(inLen);
2151-
}
2152-
if (algorithm == kAlgorithm_None) {
2153-
return ECC_CURVE_OID_E;
2149+
WOLFSSL_MSG("SE050 ECDSA sign only supports SHA-1/224/256/384/512 digest sizes");
2150+
return BAD_LENGTH_E;
21542151
}
21552152

21562153
if (wolfSSL_CryptHwMutexLock() != 0) {
@@ -2317,11 +2314,8 @@ int se050_ecc_verify_hash_ex(const byte* hash, word32 hashLen, MATH_INT_T* r,
23172314

23182315
algorithm = se050_map_hash_alg(hashLen);
23192316
if (algorithm == kAlgorithm_None) {
2320-
hashLen = keySize; /* try key size */
2321-
algorithm = se050_map_hash_alg(hashLen);
2322-
}
2323-
if (algorithm == kAlgorithm_None) {
2324-
return ECC_CURVE_OID_E;
2317+
WOLFSSL_MSG("SE050 ECDSA verify only supports SHA-1/224/256/384/512 digest sizes");
2318+
return BAD_LENGTH_E;
23252319
}
23262320

23272321
if (wolfSSL_CryptHwMutexLock() != 0) {

0 commit comments

Comments
 (0)