From 644c5dd366913d9297db8e0693a754e2d45c9089 Mon Sep 17 00:00:00 2001 From: Pauli Date: Tue, 23 Feb 2021 11:48:35 +1000 Subject: [PATCH] prov: upport modified gettable/settable ctx calls for ciphers Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/14240) --- .../implementations/ciphers/cipher_aes_cbc_hmac_sha.c | 6 ++++-- providers/implementations/ciphers/cipher_aes_ocb.c | 6 ++++-- providers/implementations/ciphers/cipher_aes_siv.c | 7 ++++--- providers/implementations/ciphers/cipher_aes_xts.c | 3 ++- providers/implementations/ciphers/cipher_chacha20.c | 6 ++++-- .../implementations/ciphers/cipher_chacha20_poly1305.c | 2 +- providers/implementations/ciphers/cipher_null.c | 6 ++++-- providers/implementations/ciphers/cipher_rc4_hmac_md5.c | 6 ++++-- providers/implementations/ciphers/ciphercommon.c | 6 +++--- providers/implementations/include/prov/ciphercommon.h | 6 ++++-- 10 files changed, 34 insertions(+), 20 deletions(-) diff --git a/providers/implementations/ciphers/cipher_aes_cbc_hmac_sha.c b/providers/implementations/ciphers/cipher_aes_cbc_hmac_sha.c index abefc20ab2..b78687ceae 100644 --- a/providers/implementations/ciphers/cipher_aes_cbc_hmac_sha.c +++ b/providers/implementations/ciphers/cipher_aes_cbc_hmac_sha.c @@ -59,7 +59,8 @@ 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(ossl_unused void *provctx) +const OSSL_PARAM *aes_settable_ctx_params(ossl_unused void *cctx, + ossl_unused void *provctx) { return cipher_aes_known_settable_ctx_params; } @@ -278,7 +279,8 @@ static const OSSL_PARAM cipher_aes_known_gettable_ctx_params[] = { OSSL_PARAM_octet_string(OSSL_CIPHER_PARAM_UPDATED_IV, NULL, 0), OSSL_PARAM_END }; -const OSSL_PARAM *aes_gettable_ctx_params(ossl_unused void *provctx) +const OSSL_PARAM *aes_gettable_ctx_params(ossl_unused void *cctx, + ossl_unused 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 69ee9f2cc5..627f146273 100644 --- a/providers/implementations/ciphers/cipher_aes_ocb.c +++ b/providers/implementations/ciphers/cipher_aes_ocb.c @@ -469,7 +469,8 @@ 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(ossl_unused void *p_ctx) +static const OSSL_PARAM *cipher_ocb_gettable_ctx_params(ossl_unused void *cctx, + ossl_unused void *p_ctx) { return cipher_ocb_known_gettable_ctx_params; } @@ -480,7 +481,8 @@ 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(ossl_unused void *p_ctx) +static const OSSL_PARAM *cipher_ocb_settable_ctx_params(ossl_unused void *cctx, + ossl_unused void *p_ctx) { return cipher_ocb_known_settable_ctx_params; } diff --git a/providers/implementations/ciphers/cipher_aes_siv.c b/providers/implementations/ciphers/cipher_aes_siv.c index 25409bf0a8..9a75f6f5b7 100644 --- a/providers/implementations/ciphers/cipher_aes_siv.c +++ b/providers/implementations/ciphers/cipher_aes_siv.c @@ -183,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; } @@ -233,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; } @@ -248,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; \ diff --git a/providers/implementations/ciphers/cipher_aes_xts.c b/providers/implementations/ciphers/cipher_aes_xts.c index e4b18b2719..13552b2a76 100644 --- a/providers/implementations/ciphers/cipher_aes_xts.c +++ b/providers/implementations/ciphers/cipher_aes_xts.c @@ -218,7 +218,8 @@ static const OSSL_PARAM aes_xts_known_settable_ctx_params[] = { OSSL_PARAM_END }; -static const OSSL_PARAM *aes_xts_settable_ctx_params(ossl_unused void *provctx) +static const OSSL_PARAM *aes_xts_settable_ctx_params(ossl_unused void *cctx, + ossl_unused 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 bee1bb925b..9bce5b0914 100644 --- a/providers/implementations/ciphers/cipher_chacha20.c +++ b/providers/implementations/ciphers/cipher_chacha20.c @@ -95,7 +95,8 @@ 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(ossl_unused void *provctx) +const OSSL_PARAM *chacha20_gettable_ctx_params(ossl_unused void *cctx, + ossl_unused void *provctx) { return chacha20_known_gettable_ctx_params; } @@ -135,7 +136,8 @@ 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(ossl_unused void *provctx) +const OSSL_PARAM *chacha20_settable_ctx_params(ossl_unused void *cctx, + ossl_unused 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 5d9ffad801..78ede20b44 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_END }; static const OSSL_PARAM *chacha20_poly1305_gettable_ctx_params - (ossl_unused void *provctx) + (ossl_unused void *cctx, ossl_unused 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 9d33a26f8d..00c97aad7a 100644 --- a/providers/implementations/ciphers/cipher_null.c +++ b/providers/implementations/ciphers/cipher_null.c @@ -111,7 +111,8 @@ 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(ossl_unused void *provctx) +static const OSSL_PARAM *null_gettable_ctx_params(ossl_unused void *cctx, + ossl_unused void *provctx) { return null_known_gettable_ctx_params; } @@ -147,7 +148,8 @@ 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(ossl_unused void *provctx) +static const OSSL_PARAM *null_settable_ctx_params(ossl_unused void *cctx, + ossl_unused 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 c69b9aecb8..533820cd80 100644 --- a/providers/implementations/ciphers/cipher_rc4_hmac_md5.c +++ b/providers/implementations/ciphers/cipher_rc4_hmac_md5.c @@ -77,7 +77,8 @@ 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(ossl_unused void *provctx) +const OSSL_PARAM *rc4_hmac_md5_gettable_ctx_params(ossl_unused void *cctx, + ossl_unused void *provctx) { return rc4_hmac_md5_known_gettable_ctx_params; } @@ -112,7 +113,8 @@ 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(ossl_unused void *provctx) +const OSSL_PARAM *rc4_hmac_md5_settable_ctx_params(ossl_unused void *cctx, + ossl_unused 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 b32f564bf7..3d2fb5b8f8 100644 --- a/providers/implementations/ciphers/ciphercommon.c +++ b/providers/implementations/ciphers/ciphercommon.c @@ -33,7 +33,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 *ossl_cipher_generic_gettable_params(void *provctx) +const OSSL_PARAM *ossl_cipher_generic_gettable_params(ossl_unused void *provctx) { return cipher_known_gettable_params; } @@ -141,7 +141,7 @@ static const OSSL_PARAM cipher_aead_known_gettable_ctx_params[] = { OSSL_PARAM_END }; const OSSL_PARAM *ossl_cipher_aead_gettable_ctx_params( - ossl_unused void *provctx + ossl_unused void *cctx, ossl_unused void *provctx ) { return cipher_aead_known_gettable_ctx_params; @@ -156,7 +156,7 @@ static const OSSL_PARAM cipher_aead_known_settable_ctx_params[] = { OSSL_PARAM_END }; const OSSL_PARAM *ossl_cipher_aead_settable_ctx_params( - ossl_unused void *provctx + ossl_unused void *cctx, ossl_unused void *provctx ) { return cipher_aead_known_settable_ctx_params; diff --git a/providers/implementations/include/prov/ciphercommon.h b/providers/implementations/include/prov/ciphercommon.h index c0d7a04b24..d5212c3c81 100644 --- a/providers/implementations/include/prov/ciphercommon.h +++ b/providers/implementations/include/prov/ciphercommon.h @@ -333,7 +333,8 @@ static const OSSL_PARAM name##_known_gettable_ctx_params[] = { \ #define CIPHER_DEFAULT_GETTABLE_CTX_PARAMS_END(name) \ OSSL_PARAM_END \ }; \ -const OSSL_PARAM * name##_gettable_ctx_params(ossl_unused void *provctx) \ +const OSSL_PARAM * name##_gettable_ctx_params(ossl_unused void *cctx, \ + ossl_unused void *provctx) \ { \ return name##_known_gettable_ctx_params; \ } @@ -345,7 +346,8 @@ static const OSSL_PARAM name##_known_settable_ctx_params[] = { \ #define CIPHER_DEFAULT_SETTABLE_CTX_PARAMS_END(name) \ OSSL_PARAM_END \ }; \ -const OSSL_PARAM * name##_settable_ctx_params(ossl_unused void *provctx) \ +const OSSL_PARAM * name##_settable_ctx_params(ossl_unused void *cctx, \ + ossl_unused void *provctx) \ { \ return name##_known_settable_ctx_params; \ } -- 2.34.1