summaryrefslogtreecommitdiffstats
path: root/providers/implementations/ciphers
diff options
context:
space:
mode:
authorPauli <paul.dale@oracle.com>2020-08-05 13:23:32 +1000
committerPauli <paul.dale@oracle.com>2020-08-07 08:02:14 +1000
commitaf5e1e852d4858860d4b7210cafe7bdf39e73f80 (patch)
treee2b5ea35d43150dcf9f1ff5e771e41daef4d891b /providers/implementations/ciphers
parent18ec26babc1da90befc0bf5671bc8072428c5bab (diff)
gettables: provider changes to pass the provider context.
Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/12581)
Diffstat (limited to 'providers/implementations/ciphers')
-rw-r--r--providers/implementations/ciphers/cipher_aes_cbc_hmac_sha.c4
-rw-r--r--providers/implementations/ciphers/cipher_aes_ocb.c7
-rw-r--r--providers/implementations/ciphers/cipher_aes_siv.c20
-rw-r--r--providers/implementations/ciphers/cipher_aes_xts.c2
-rw-r--r--providers/implementations/ciphers/cipher_chacha20.c4
-rw-r--r--providers/implementations/ciphers/cipher_chacha20_poly1305.c2
-rw-r--r--providers/implementations/ciphers/cipher_null.c4
-rw-r--r--providers/implementations/ciphers/cipher_rc4_hmac_md5.c4
-rw-r--r--providers/implementations/ciphers/ciphercommon.c6
9 files changed, 34 insertions, 19 deletions
diff --git a/providers/implementations/ciphers/cipher_aes_cbc_hmac_sha.c b/providers/implementations/ciphers/cipher_aes_cbc_hmac_sha.c
index 046a66c56d..6cf6a1b111 100644
--- a/providers/implementations/ciphers/cipher_aes_cbc_hmac_sha.c
+++ b/providers/implementations/ciphers/cipher_aes_cbc_hmac_sha.c
@@ -59,7 +59,7 @@ static const OSSL_PARAM cipher_aes_known_settable_ctx_params[] = {
OSSL_PARAM_size_t(OSSL_CIPHER_PARAM_KEYLEN, NULL),
OSSL_PARAM_END
};
-const OSSL_PARAM *aes_settable_ctx_params(void)
+const OSSL_PARAM *aes_settable_ctx_params(void *provctx)
{
return cipher_aes_known_settable_ctx_params;
}
@@ -250,7 +250,7 @@ static const OSSL_PARAM cipher_aes_known_gettable_ctx_params[] = {
OSSL_PARAM_octet_string(OSSL_CIPHER_PARAM_IV, NULL, 0),
OSSL_PARAM_END
};
-const OSSL_PARAM *aes_gettable_ctx_params(void)
+const OSSL_PARAM *aes_gettable_ctx_params(void *provctx)
{
return cipher_aes_known_gettable_ctx_params;
}
diff --git a/providers/implementations/ciphers/cipher_aes_ocb.c b/providers/implementations/ciphers/cipher_aes_ocb.c
index 230b353c50..162945f922 100644
--- a/providers/implementations/ciphers/cipher_aes_ocb.c
+++ b/providers/implementations/ciphers/cipher_aes_ocb.c
@@ -39,6 +39,8 @@ static OSSL_FUNC_cipher_freectx_fn aes_ocb_freectx;
static OSSL_FUNC_cipher_dupctx_fn aes_ocb_dupctx;
static OSSL_FUNC_cipher_get_ctx_params_fn aes_ocb_get_ctx_params;
static OSSL_FUNC_cipher_set_ctx_params_fn aes_ocb_set_ctx_params;
+static OSSL_FUNC_cipher_gettable_ctx_params_fn cipher_ocb_gettable_ctx_params;
+static OSSL_FUNC_cipher_settable_ctx_params_fn cipher_ocb_settable_ctx_params;
/*
* The following methods could be moved into PROV_AES_OCB_HW if
@@ -437,7 +439,7 @@ static const OSSL_PARAM cipher_ocb_known_gettable_ctx_params[] = {
OSSL_PARAM_octet_string(OSSL_CIPHER_PARAM_AEAD_TAG, NULL, 0),
OSSL_PARAM_END
};
-static const OSSL_PARAM *cipher_ocb_gettable_ctx_params(void)
+static const OSSL_PARAM *cipher_ocb_gettable_ctx_params(void *provctx)
{
return cipher_ocb_known_gettable_ctx_params;
}
@@ -448,7 +450,7 @@ static const OSSL_PARAM cipher_ocb_known_settable_ctx_params[] = {
OSSL_PARAM_octet_string(OSSL_CIPHER_PARAM_AEAD_TAG, NULL, 0),
OSSL_PARAM_END
};
-static const OSSL_PARAM *cipher_ocb_settable_ctx_params(void)
+static const OSSL_PARAM *cipher_ocb_settable_ctx_params(void *provctx)
{
return cipher_ocb_known_settable_ctx_params;
}
@@ -513,4 +515,3 @@ const OSSL_DISPATCH aes##kbits##mode##_functions[] = { \
IMPLEMENT_cipher(ocb, OCB, AES_OCB_FLAGS, 256, 128, OCB_DEFAULT_IV_LEN * 8);
IMPLEMENT_cipher(ocb, OCB, AES_OCB_FLAGS, 192, 128, OCB_DEFAULT_IV_LEN * 8);
IMPLEMENT_cipher(ocb, OCB, AES_OCB_FLAGS, 128, 128, OCB_DEFAULT_IV_LEN * 8);
-
diff --git a/providers/implementations/ciphers/cipher_aes_siv.c b/providers/implementations/ciphers/cipher_aes_siv.c
index 84c078da82..2432c6a280 100644
--- a/providers/implementations/ciphers/cipher_aes_siv.c
+++ b/providers/implementations/ciphers/cipher_aes_siv.c
@@ -166,7 +166,7 @@ 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(void)
+static const OSSL_PARAM *aes_siv_gettable_ctx_params(void *provctx)
{
return aes_siv_known_gettable_ctx_params;
}
@@ -216,19 +216,33 @@ 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(void)
+static const OSSL_PARAM *aes_siv_settable_ctx_params(void *provctx)
{
return aes_siv_known_settable_ctx_params;
}
#define IMPLEMENT_cipher(alg, lc, UCMODE, flags, kbits, blkbits, ivbits) \
+static OSSL_FUNC_cipher_newctx_fn alg##kbits##lc##_newctx; \
+static OSSL_FUNC_cipher_freectx_fn alg##_##lc##_freectx; \
+static OSSL_FUNC_cipher_dupctx_fn lc##_dupctx; \
+static OSSL_FUNC_cipher_encrypt_init_fn lc##_einit; \
+static OSSL_FUNC_cipher_decrypt_init_fn lc##_dinit; \
+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; \
+static OSSL_FUNC_cipher_set_ctx_params_fn alg##_##lc##_set_ctx_params; \
+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); \
} \
-static OSSL_FUNC_cipher_newctx_fn alg##kbits##lc##_newctx; \
static void * alg##kbits##lc##_newctx(void *provctx) \
{ \
return alg##_##lc##_newctx(provctx, 2*kbits, EVP_CIPH_##UCMODE##_MODE, \
diff --git a/providers/implementations/ciphers/cipher_aes_xts.c b/providers/implementations/ciphers/cipher_aes_xts.c
index f564075abe..5430b6da1b 100644
--- a/providers/implementations/ciphers/cipher_aes_xts.c
+++ b/providers/implementations/ciphers/cipher_aes_xts.c
@@ -211,7 +211,7 @@ static const OSSL_PARAM aes_xts_known_settable_ctx_params[] = {
OSSL_PARAM_END
};
-static const OSSL_PARAM *aes_xts_settable_ctx_params(void)
+static const OSSL_PARAM *aes_xts_settable_ctx_params(void *provctx)
{
return aes_xts_known_settable_ctx_params;
}
diff --git a/providers/implementations/ciphers/cipher_chacha20.c b/providers/implementations/ciphers/cipher_chacha20.c
index 6759b0e0f9..5d5e62870d 100644
--- a/providers/implementations/ciphers/cipher_chacha20.c
+++ b/providers/implementations/ciphers/cipher_chacha20.c
@@ -91,7 +91,7 @@ static const OSSL_PARAM chacha20_known_gettable_ctx_params[] = {
OSSL_PARAM_size_t(OSSL_CIPHER_PARAM_IVLEN, NULL),
OSSL_PARAM_END
};
-const OSSL_PARAM *chacha20_gettable_ctx_params(void)
+const OSSL_PARAM *chacha20_gettable_ctx_params(void *provctx)
{
return chacha20_known_gettable_ctx_params;
}
@@ -131,7 +131,7 @@ static const OSSL_PARAM chacha20_known_settable_ctx_params[] = {
OSSL_PARAM_size_t(OSSL_CIPHER_PARAM_IVLEN, NULL),
OSSL_PARAM_END
};
-const OSSL_PARAM *chacha20_settable_ctx_params(void)
+const OSSL_PARAM *chacha20_settable_ctx_params(void *provctx)
{
return chacha20_known_settable_ctx_params;
}
diff --git a/providers/implementations/ciphers/cipher_chacha20_poly1305.c b/providers/implementations/ciphers/cipher_chacha20_poly1305.c
index a93f722551..0174337c81 100644
--- a/providers/implementations/ciphers/cipher_chacha20_poly1305.c
+++ b/providers/implementations/ciphers/cipher_chacha20_poly1305.c
@@ -135,7 +135,7 @@ static const OSSL_PARAM chacha20_poly1305_known_gettable_ctx_params[] = {
OSSL_PARAM_size_t(OSSL_CIPHER_PARAM_AEAD_TLS1_AAD_PAD, NULL),
OSSL_PARAM_END
};
-static const OSSL_PARAM *chacha20_poly1305_gettable_ctx_params(void)
+static const OSSL_PARAM *chacha20_poly1305_gettable_ctx_params(void *provctx)
{
return chacha20_poly1305_known_gettable_ctx_params;
}
diff --git a/providers/implementations/ciphers/cipher_null.c b/providers/implementations/ciphers/cipher_null.c
index 713d29e3e8..c524a83f4a 100644
--- a/providers/implementations/ciphers/cipher_null.c
+++ b/providers/implementations/ciphers/cipher_null.c
@@ -95,7 +95,7 @@ static const OSSL_PARAM null_known_gettable_ctx_params[] = {
};
static OSSL_FUNC_cipher_gettable_ctx_params_fn null_gettable_ctx_params;
-static const OSSL_PARAM *null_gettable_ctx_params(void)
+static const OSSL_PARAM *null_gettable_ctx_params(void *provctx)
{
return null_known_gettable_ctx_params;
}
@@ -131,7 +131,7 @@ static const OSSL_PARAM null_known_settable_ctx_params[] = {
};
static OSSL_FUNC_cipher_settable_ctx_params_fn null_settable_ctx_params;
-static const OSSL_PARAM *null_settable_ctx_params(void)
+static const OSSL_PARAM *null_settable_ctx_params(void *provctx)
{
return null_known_settable_ctx_params;
}
diff --git a/providers/implementations/ciphers/cipher_rc4_hmac_md5.c b/providers/implementations/ciphers/cipher_rc4_hmac_md5.c
index d9535e23ce..e17584a0ab 100644
--- a/providers/implementations/ciphers/cipher_rc4_hmac_md5.c
+++ b/providers/implementations/ciphers/cipher_rc4_hmac_md5.c
@@ -72,7 +72,7 @@ static const OSSL_PARAM rc4_hmac_md5_known_gettable_ctx_params[] = {
OSSL_PARAM_size_t(OSSL_CIPHER_PARAM_AEAD_TLS1_AAD_PAD, NULL),
OSSL_PARAM_END
};
-const OSSL_PARAM *rc4_hmac_md5_gettable_ctx_params(void)
+const OSSL_PARAM *rc4_hmac_md5_gettable_ctx_params(void *provctx)
{
return rc4_hmac_md5_known_gettable_ctx_params;
}
@@ -107,7 +107,7 @@ static const OSSL_PARAM rc4_hmac_md5_known_settable_ctx_params[] = {
OSSL_PARAM_octet_string(OSSL_CIPHER_PARAM_AEAD_TLS1_AAD, NULL, 0),
OSSL_PARAM_END
};
-const OSSL_PARAM *rc4_hmac_md5_settable_ctx_params(void)
+const OSSL_PARAM *rc4_hmac_md5_settable_ctx_params(void *provctx)
{
return rc4_hmac_md5_known_settable_ctx_params;
}
diff --git a/providers/implementations/ciphers/ciphercommon.c b/providers/implementations/ciphers/ciphercommon.c
index 2d119a7b39..dd25f00db4 100644
--- a/providers/implementations/ciphers/ciphercommon.c
+++ b/providers/implementations/ciphers/ciphercommon.c
@@ -29,7 +29,7 @@ static const OSSL_PARAM cipher_known_gettable_params[] = {
{ OSSL_CIPHER_PARAM_TLS_MAC, OSSL_PARAM_OCTET_PTR, NULL, 0, OSSL_PARAM_UNMODIFIED },
OSSL_PARAM_END
};
-const OSSL_PARAM *cipher_generic_gettable_params(void)
+const OSSL_PARAM *cipher_generic_gettable_params(void *provctx)
{
return cipher_known_gettable_params;
}
@@ -117,7 +117,7 @@ static const OSSL_PARAM cipher_aead_known_gettable_ctx_params[] = {
OSSL_PARAM_octet_string(OSSL_CIPHER_PARAM_AEAD_TLS1_GET_IV_GEN, NULL, 0),
OSSL_PARAM_END
};
-const OSSL_PARAM *cipher_aead_gettable_ctx_params(void)
+const OSSL_PARAM *cipher_aead_gettable_ctx_params(void *provctx)
{
return cipher_aead_known_gettable_ctx_params;
}
@@ -130,7 +130,7 @@ static const OSSL_PARAM cipher_aead_known_settable_ctx_params[] = {
OSSL_PARAM_octet_string(OSSL_CIPHER_PARAM_AEAD_TLS1_SET_IV_INV, NULL, 0),
OSSL_PARAM_END
};
-const OSSL_PARAM *cipher_aead_settable_ctx_params(void)
+const OSSL_PARAM *cipher_aead_settable_ctx_params(void *provctx)
{
return cipher_aead_known_settable_ctx_params;
}