From 78b4aba9f814e7866bc47a4b6552fb3b2b992cfa Mon Sep 17 00:00:00 2001 From: "Dr. David von Oheimb" Date: Mon, 20 Apr 2020 17:19:50 +0200 Subject: [PATCH] Fix test_cmp_vfy failures with FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION [extended tests] Reviewed-by: Matt Caswell Reviewed-by: David von Oheimb (Merged from https://github.com/openssl/openssl/pull/11585) --- test/cmp_vfy_test.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/cmp_vfy_test.c b/test/cmp_vfy_test.c index 9fca675ef1..e2dd80bef7 100644 --- a/test/cmp_vfy_test.c +++ b/test/cmp_vfy_test.c @@ -109,6 +109,7 @@ static int test_verify_popo(void) return result; } +#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION static int test_verify_popo_bad(void) { SETUP_TEST_FIXTURE(CMP_VFY_TEST_FIXTURE, set_up); @@ -116,6 +117,7 @@ static int test_verify_popo_bad(void) EXECUTE_TEST(execute_verify_popo_test, tear_down); return result; } +#endif static int execute_validate_msg_test(CMP_VFY_TEST_FIXTURE *fixture) { @@ -444,6 +446,7 @@ static void setup_check_received(CMP_VFY_TEST_FIXTURE **fixture, int expected, } } +#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION static int test_MSG_check_received_no_protection_no_cb(void) { SETUP_TEST_FIXTURE(CMP_VFY_TEST_FIXTURE, set_up); @@ -459,6 +462,7 @@ static int test_MSG_check_received_no_protection_restrictive_cb(void) EXECUTE_TEST(execute_MSG_check_received_test, tear_down); return result; } +#endif static int test_MSG_check_received_no_protection_permissive_cb(void) { @@ -484,6 +488,7 @@ static int test_MSG_check_received_check_transaction_id(void) return result; } +#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION static int test_MSG_check_received_check_transaction_id_bad(void) { SETUP_TEST_FIXTURE(CMP_VFY_TEST_FIXTURE, set_up); @@ -491,6 +496,7 @@ static int test_MSG_check_received_check_transaction_id_bad(void) EXECUTE_TEST(execute_MSG_check_received_test, tear_down); return result; } +#endif static int test_MSG_check_received_check_recipient_nonce(void) { @@ -507,6 +513,7 @@ static int test_MSG_check_received_check_recipient_nonce(void) return result; } +#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION static int test_MSG_check_received_check_recipient_nonce_bad(void) { SETUP_TEST_FIXTURE(CMP_VFY_TEST_FIXTURE, set_up); @@ -514,6 +521,7 @@ static int test_MSG_check_received_check_recipient_nonce_bad(void) EXECUTE_TEST(execute_MSG_check_received_test, tear_down); return result; } +#endif void cleanup_tests(void) { @@ -596,7 +604,9 @@ int setup_tests(void) /* Message validation tests */ ADD_TEST(test_verify_popo); +#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION ADD_TEST(test_verify_popo_bad); +#endif ADD_TEST(test_validate_msg_signature_trusted_ok); ADD_TEST(test_validate_msg_signature_trusted_expired); ADD_TEST(test_validate_msg_signature_srvcert_wrong); @@ -617,13 +627,19 @@ int setup_tests(void) ADD_TEST(test_validate_cert_path_expired); ADD_TEST(test_validate_cert_path_wrong_anchor); +#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION ADD_TEST(test_MSG_check_received_no_protection_no_cb); ADD_TEST(test_MSG_check_received_no_protection_restrictive_cb); +#endif ADD_TEST(test_MSG_check_received_no_protection_permissive_cb); ADD_TEST(test_MSG_check_received_check_transaction_id); +#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION ADD_TEST(test_MSG_check_received_check_transaction_id_bad); +#endif ADD_TEST(test_MSG_check_received_check_recipient_nonce); +#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION ADD_TEST(test_MSG_check_received_check_recipient_nonce_bad); +#endif return 1; -- 2.25.1