/*
- * Copyright 2007-2019 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2007-2020 The OpenSSL Project Authors. All Rights Reserved.
* Copyright Nokia 2007-2019
* Copyright Siemens AG 2015-2019
*
#include "cmp_testlib.h"
#include "../crypto/crmf/crmf_local.h" /* for manipulating POPO signature */
+DEFINE_STACK_OF(OSSL_CRMF_MSG)
static const char *server_f;
static const char *client_f;
OPENSSL_free(fixture);
}
-static int print_to_bio_out(const char *func, const char *file, int line,
- OSSL_CMP_severity level, const char *msg)
-{
- return OSSL_CMP_print_to_bio(bio_out, func, file, line, level, msg);
-}
-
static time_t test_time_valid = 0, test_time_after_expiration = 0;
static CMP_VFY_TEST_FIXTURE *set_up(const char *const test_case_name)
return NULL;
}
X509_VERIFY_PARAM_set_time(X509_STORE_get0_param(ts), test_time_valid);
- X509_STORE_set_verify_cb(ts, OSSL_CMP_print_cert_verify_cb);
+ X509_STORE_set_verify_cb(ts, X509_STORE_CTX_print_verify_cb);
return fixture;
}
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);
EXECUTE_TEST(execute_verify_popo_test, tear_down);
return result;
}
+#endif
static int execute_validate_msg_test(CMP_VFY_TEST_FIXTURE *fixture)
{
}
-static int test_validate_with_sender(X509_NAME *name, int expected)
+static int test_validate_with_sender(const X509_NAME *name, int expected)
{
SETUP_TEST_FIXTURE(CMP_VFY_TEST_FIXTURE, set_up);
fixture->expected = expected;
nonce_data, nonce_len))) {
tear_down((*fixture));
(*fixture) = NULL;
- }
- else if (trid_data != NULL) {
+ } else if (trid_data != NULL) {
ASN1_OCTET_STRING *trid = ASN1_OCTET_STRING_new();
if (trid == NULL
|| !ASN1_OCTET_STRING_set(trid, trid_data,
}
}
+#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);
EXECUTE_TEST(execute_MSG_check_received_test, tear_down);
return result;
}
+#endif
static int test_MSG_check_received_no_protection_permissive_cb(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);
EXECUTE_TEST(execute_MSG_check_received_test, tear_down);
return result;
}
+#endif
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);
EXECUTE_TEST(execute_MSG_check_received_test, tear_down);
return result;
}
+#endif
void cleanup_tests(void)
{
ts.tm_year += 10; /* February 18th 2028 */
test_time_after_expiration = mktime(&ts);
+ if (!test_skip_common_options()) {
+ TEST_error("Error parsing test options\n");
+ return 0;
+ }
+
RAND_bytes(rand_data, OSSL_CMP_TRANSACTIONID_LENGTH);
if (!TEST_ptr(server_f = test_get_argument(0))
|| !TEST_ptr(client_f = test_get_argument(1))
/* 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);
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;