ERR: fix comment typo in err.c
[openssl.git] / test / tls-provider.c
index 4025d9ee168d185d68212c20b9fac06a024570e0..924ede501bc30c26b944df7fca04a60e85d82d9e 100644 (file)
@@ -9,7 +9,7 @@
 
 #include <string.h>
 #include <openssl/core_names.h>
-#include <openssl/core_numbers.h>
+#include <openssl/core_dispatch.h>
 #include <openssl/rand.h>
 #include <openssl/params.h>
 /* For TLS1_3_VERSION */
@@ -86,12 +86,12 @@ static int tls_prov_get_capabilities(void *provctx, const char *capability,
  * together. Don't use this!
  */
 
-static OSSL_OP_keyexch_newctx_fn xor_newctx;
-static OSSL_OP_keyexch_init_fn xor_init;
-static OSSL_OP_keyexch_set_peer_fn xor_set_peer;
-static OSSL_OP_keyexch_derive_fn xor_derive;
-static OSSL_OP_keyexch_freectx_fn xor_freectx;
-static OSSL_OP_keyexch_dupctx_fn xor_dupctx;
+static OSSL_FUNC_keyexch_newctx_fn xor_newctx;
+static OSSL_FUNC_keyexch_init_fn xor_init;
+static OSSL_FUNC_keyexch_set_peer_fn xor_set_peer;
+static OSSL_FUNC_keyexch_derive_fn xor_derive;
+static OSSL_FUNC_keyexch_freectx_fn xor_freectx;
+static OSSL_FUNC_keyexch_dupctx_fn xor_dupctx;
 
 typedef struct {
     XORKEY *key;
@@ -180,25 +180,29 @@ static const OSSL_DISPATCH xor_keyexch_functions[] = {
 };
 
 static const OSSL_ALGORITHM tls_prov_keyexch[] = {
-    { "XOR", "provider=tls-provider", xor_keyexch_functions },
+    /*
+     * Obviously this is not FIPS approved, but in order to test in conjuction
+     * with the FIPS provider we pretend that it is.
+     */
+    { "XOR", "provider=tls-provider,fips=yes", xor_keyexch_functions },
     { NULL, NULL, NULL }
 };
 
 /* Key Management for the dummy XOR key exchange algorithm */
 
-static OSSL_OP_keymgmt_new_fn xor_newdata;
-static OSSL_OP_keymgmt_free_fn xor_freedata;
-static OSSL_OP_keymgmt_has_fn xor_has;
-static OSSL_OP_keymgmt_copy_fn xor_copy;
-static OSSL_OP_keymgmt_gen_init_fn xor_gen_init;
-static OSSL_OP_keymgmt_gen_set_params_fn xor_gen_set_params;
-static OSSL_OP_keymgmt_gen_settable_params_fn xor_gen_settable_params;
-static OSSL_OP_keymgmt_gen_fn xor_gen;
-static OSSL_OP_keymgmt_gen_cleanup_fn xor_gen_cleanup;
-static OSSL_OP_keymgmt_get_params_fn xor_get_params;
-static OSSL_OP_keymgmt_gettable_params_fn xor_gettable_params;
-static OSSL_OP_keymgmt_set_params_fn xor_set_params;
-static OSSL_OP_keymgmt_settable_params_fn xor_settable_params;
+static OSSL_FUNC_keymgmt_new_fn xor_newdata;
+static OSSL_FUNC_keymgmt_free_fn xor_freedata;
+static OSSL_FUNC_keymgmt_has_fn xor_has;
+static OSSL_FUNC_keymgmt_copy_fn xor_copy;
+static OSSL_FUNC_keymgmt_gen_init_fn xor_gen_init;
+static OSSL_FUNC_keymgmt_gen_set_params_fn xor_gen_set_params;
+static OSSL_FUNC_keymgmt_gen_settable_params_fn xor_gen_settable_params;
+static OSSL_FUNC_keymgmt_gen_fn xor_gen;
+static OSSL_FUNC_keymgmt_gen_cleanup_fn xor_gen_cleanup;
+static OSSL_FUNC_keymgmt_get_params_fn xor_get_params;
+static OSSL_FUNC_keymgmt_gettable_params_fn xor_gettable_params;
+static OSSL_FUNC_keymgmt_set_params_fn xor_set_params;
+static OSSL_FUNC_keymgmt_settable_params_fn xor_settable_params;
 
 static void *xor_newdata(void *provctx)
 {
@@ -286,7 +290,7 @@ static const OSSL_PARAM xor_params[] = {
     OSSL_PARAM_END
 };
 
-static const OSSL_PARAM *xor_gettable_params(void)
+static const OSSL_PARAM *xor_gettable_params(void *provctx)
 {
     return xor_params;
 }
@@ -313,7 +317,7 @@ static const OSSL_PARAM xor_known_settable_params[] = {
     OSSL_PARAM_END
 };
 
-static const OSSL_PARAM *xor_settable_params(void)
+static const OSSL_PARAM *xor_settable_params(void *provctx)
 {
     return xor_known_settable_params;
 }
@@ -414,7 +418,11 @@ static const OSSL_DISPATCH xor_keymgmt_functions[] = {
 };
 
 static const OSSL_ALGORITHM tls_prov_keymgmt[] = {
-    { "XOR", "provider=tls-provider", xor_keymgmt_functions },
+    /*
+     * Obviously this is not FIPS approved, but in order to test in conjuction
+     * with the FIPS provider we pretend that it is.
+     */
+    { "XOR", "provider=tls-provider,fips=yes", xor_keymgmt_functions },
     { NULL, NULL, NULL }
 };