Fix test_cmp_vfy failures with FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
authorDr. David von Oheimb <David.von.Oheimb@siemens.com>
Mon, 20 Apr 2020 15:19:50 +0000 (17:19 +0200)
committerDr. David von Oheimb <David.von.Oheimb@siemens.com>
Tue, 21 Apr 2020 05:58:55 +0000 (07:58 +0200)
[extended tests]

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
(Merged from https://github.com/openssl/openssl/pull/11585)

test/cmp_vfy_test.c

index 9fca675ef17bea0c5d4092e6c618695fed7b10d5..e2dd80bef702fa8295c68bca3f85d68108a0b074 100644 (file)
@@ -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;