prov: upport modified gettable/settable ctx calls for ciphers
[openssl.git] / providers / implementations / ciphers / cipher_aes_siv.c
index e427c6baf3dc7e055f476743292cdb7d200406c7..9a75f6f5b762cc4274b48b59e959e25b5516c460 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2019-2020 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
  * this file except in compliance with the License.  You can obtain a copy
  */
 #include "internal/deprecated.h"
 
+#include <openssl/proverr.h>
 #include "cipher_aes_siv.h"
 #include "prov/implementations.h"
 #include "prov/providercommon.h"
-#include "prov/providercommonerr.h"
 #include "prov/ciphercommon_aead.h"
 #include "prov/provider_ctx.h"
 
@@ -37,10 +37,9 @@ static void *aes_siv_newctx(void *provctx, size_t keybits, unsigned int mode,
     if (ctx != NULL) {
         ctx->taglen = SIV_LEN;
         ctx->mode = mode;
-        ctx->flags = flags;
         ctx->keylen = keybits / 8;
         ctx->hw = ossl_prov_cipher_hw_aes_siv(keybits);
-        ctx->libctx = PROV_LIBRARY_CONTEXT_OF(provctx);
+        ctx->libctx = PROV_LIBCTX_OF(provctx);
     }
     return ctx;
 }
@@ -184,7 +183,8 @@ static const OSSL_PARAM aes_siv_known_gettable_ctx_params[] = {
     OSSL_PARAM_octet_string(OSSL_CIPHER_PARAM_AEAD_TAG, NULL, 0),
     OSSL_PARAM_END
 };
-static const OSSL_PARAM *aes_siv_gettable_ctx_params(ossl_unused void *provctx)
+static const OSSL_PARAM *aes_siv_gettable_ctx_params(ossl_unused void *cctx,
+                                                     ossl_unused void *provctx)
 {
     return aes_siv_known_gettable_ctx_params;
 }
@@ -234,7 +234,8 @@ static const OSSL_PARAM aes_siv_known_settable_ctx_params[] = {
     OSSL_PARAM_octet_string(OSSL_CIPHER_PARAM_AEAD_TAG, NULL, 0),
     OSSL_PARAM_END
 };
-static const OSSL_PARAM *aes_siv_settable_ctx_params(ossl_unused void *provctx)
+static const OSSL_PARAM *aes_siv_settable_ctx_params(ossl_unused void *cctx,
+                                                     ossl_unused void *provctx)
 {
     return aes_siv_known_settable_ctx_params;
 }
@@ -249,7 +250,6 @@ static OSSL_FUNC_cipher_update_fn lc##_stream_update;                          \
 static OSSL_FUNC_cipher_final_fn lc##_stream_final;                            \
 static OSSL_FUNC_cipher_cipher_fn lc##_cipher;                                 \
 static OSSL_FUNC_cipher_get_params_fn alg##_##kbits##_##lc##_get_params;       \
-static OSSL_FUNC_cipher_gettable_params_fn alg##_##lc##_gettable_ctx_params;   \
 static OSSL_FUNC_cipher_get_ctx_params_fn alg##_##lc##_get_ctx_params;         \
 static OSSL_FUNC_cipher_gettable_ctx_params_fn                                 \
             alg##_##lc##_gettable_ctx_params;                                  \
@@ -258,8 +258,8 @@ static OSSL_FUNC_cipher_settable_ctx_params_fn                                 \
             alg##_##lc##_settable_ctx_params;                                  \
 static int alg##_##kbits##_##lc##_get_params(OSSL_PARAM params[])              \
 {                                                                              \
-    return cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,         \
-                                     flags, 2*kbits, blkbits, ivbits);         \
+    return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,    \
+                                          flags, 2*kbits, blkbits, ivbits);    \
 }                                                                              \
 static void * alg##kbits##lc##_newctx(void *provctx)                           \
 {                                                                              \
@@ -278,7 +278,7 @@ const OSSL_DISPATCH ossl_##alg##kbits##lc##_functions[] = {                    \
     { OSSL_FUNC_CIPHER_GET_PARAMS,                                             \
       (void (*)(void)) alg##_##kbits##_##lc##_get_params },                    \
     { OSSL_FUNC_CIPHER_GETTABLE_PARAMS,                                        \
-      (void (*)(void))cipher_generic_gettable_params },                        \
+      (void (*)(void))ossl_cipher_generic_gettable_params },                   \
     { OSSL_FUNC_CIPHER_GET_CTX_PARAMS,                                         \
       (void (*)(void)) alg##_##lc##_get_ctx_params },                          \
     { OSSL_FUNC_CIPHER_GETTABLE_CTX_PARAMS,                                    \