2 * Copyright 2022 The OpenSSL Project Authors. All Rights Reserved.
4 * Licensed under the Apache License 2.0 (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
10 #include <openssl/evp.h>
11 #include <openssl/provider.h>
14 static OSSL_LIB_CTX *libctx = NULL;
15 static OSSL_PROVIDER *libprov = NULL;
17 typedef enum OPTION_choice {
24 const OPTIONS *test_get_options(void)
26 static const OPTIONS test_options[] = {
27 OPT_TEST_OPTIONS_DEFAULT_USAGE,
28 { "config", OPT_CONFIG_FILE, '<',
29 "The configuration file to use for the libctx" },
35 static int test_fips_version(int n)
37 const char *version = test_get_argument(n);
39 if (!TEST_ptr(version))
41 return TEST_int_eq(fips_provider_version_match(libctx, version), 1);
46 char *config_file = NULL;
50 while ((o = opt_next()) != OPT_EOF) {
53 config_file = opt_arg();
63 if (!test_get_libctx(&libctx, NULL, config_file, &libprov, NULL))
66 n = test_get_argument_count();
70 ADD_ALL_TESTS(test_fips_version, n);
74 void cleanup_tests(void)
76 OSSL_PROVIDER_unload(libprov);
77 OSSL_LIB_CTX_free(libctx);