diff --git a/tests/api.c b/tests/api.c index a2a8f3441..49dcf4fc9 100644 --- a/tests/api.c +++ b/tests/api.c @@ -34843,10 +34843,12 @@ static int test_wc_dilithium_der(void) 1), WC_NO_ERR_TRACE(BAD_FUNC_ARG)); ExpectIntEQ(wc_Dilithium_PrivateKeyToDer(key, der, DILITHIUM_MAX_DER_SIZE), 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), - WC_NO_ERR_TRACE(BAD_FUNC_ARG)); + WC_NO_ERR_TRACE(ASN_PARSE_E)); 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 ExpectIntEQ(wc_dilithium_set_level(key, WC_ML_DSA_44), 0);