diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/property_test.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/test/property_test.c b/test/property_test.c index ca407b2ba4..aad43b9184 100644 --- a/test/property_test.c +++ b/test/property_test.c @@ -9,6 +9,7 @@ */ #include <stdarg.h> +#include <openssl/evp.h> #include "testutil.h" #include "internal/nelem.h" #include "internal/property.h" @@ -383,6 +384,35 @@ err: return res; } +static int test_fips_mode(void) +{ + int ret = 0; + OPENSSL_CTX *ctx = NULL; + + if (!TEST_ptr(ctx = OPENSSL_CTX_new())) + goto err; + + ret = TEST_true(EVP_set_default_properties(ctx, "default=yes,fips=yes")) + && TEST_true(EVP_default_properties_is_fips_enabled(ctx)) + && TEST_true(EVP_set_default_properties(ctx, "fips=no,default=yes")) + && TEST_false(EVP_default_properties_is_fips_enabled(ctx)) + && TEST_true(EVP_set_default_properties(ctx, "fips=no")) + && TEST_false(EVP_default_properties_is_fips_enabled(ctx)) + && TEST_true(EVP_set_default_properties(ctx, "fips!=no")) + && TEST_true(EVP_default_properties_is_fips_enabled(ctx)) + && TEST_true(EVP_set_default_properties(ctx, "fips=no")) + && TEST_false(EVP_default_properties_is_fips_enabled(ctx)) + && TEST_true(EVP_set_default_properties(ctx, "fips=no,default=yes")) + && TEST_true(EVP_default_properties_enable_fips(ctx, 1)) + && TEST_true(EVP_default_properties_is_fips_enabled(ctx)) + && TEST_true(EVP_default_properties_enable_fips(ctx, 0)) + && TEST_false(EVP_default_properties_is_fips_enabled(ctx)); +err: + OPENSSL_CTX_free(ctx); + return ret; +} + + int setup_tests(void) { ADD_TEST(test_property_string); @@ -393,5 +423,6 @@ int setup_tests(void) ADD_TEST(test_register_deregister); ADD_TEST(test_property); ADD_TEST(test_query_cache_stochastic); + ADD_TEST(test_fips_mode); return 1; } |