forked from wolfSSL/wolfssl
update test in api.c to handle new dilithium security level DER parsing
This commit is contained in:
@ -34843,10 +34843,12 @@ static int test_wc_dilithium_der(void)
|
|||||||
1), WC_NO_ERR_TRACE(BAD_FUNC_ARG));
|
1), WC_NO_ERR_TRACE(BAD_FUNC_ARG));
|
||||||
ExpectIntEQ(wc_Dilithium_PrivateKeyToDer(key, der, DILITHIUM_MAX_DER_SIZE),
|
ExpectIntEQ(wc_Dilithium_PrivateKeyToDer(key, der, DILITHIUM_MAX_DER_SIZE),
|
||||||
WC_NO_ERR_TRACE(BAD_FUNC_ARG));
|
WC_NO_ERR_TRACE(BAD_FUNC_ARG));
|
||||||
|
/* When security level is not set, we attempt to parse it from DER. Since
|
||||||
|
* the supplied DER is invalid, this should fail with ASN parsing error */
|
||||||
ExpectIntEQ(wc_Dilithium_PublicKeyDecode(der, &idx, key, pubDerLen),
|
ExpectIntEQ(wc_Dilithium_PublicKeyDecode(der, &idx, key, pubDerLen),
|
||||||
WC_NO_ERR_TRACE(BAD_FUNC_ARG));
|
WC_NO_ERR_TRACE(ASN_PARSE_E));
|
||||||
ExpectIntEQ(wc_Dilithium_PrivateKeyDecode(der, &idx, key, privDerLen),
|
ExpectIntEQ(wc_Dilithium_PrivateKeyDecode(der, &idx, key, privDerLen),
|
||||||
WC_NO_ERR_TRACE(BAD_FUNC_ARG));
|
WC_NO_ERR_TRACE(ASN_PARSE_E));
|
||||||
|
|
||||||
#ifndef WOLFSSL_NO_ML_DSA_44
|
#ifndef WOLFSSL_NO_ML_DSA_44
|
||||||
ExpectIntEQ(wc_dilithium_set_level(key, WC_ML_DSA_44), 0);
|
ExpectIntEQ(wc_dilithium_set_level(key, WC_ML_DSA_44), 0);
|
||||||
|
Reference in New Issue
Block a user