From: Pauli Date: Thu, 19 Jun 2025 01:40:16 +0000 (+1000) Subject: cipher: declare common OSSL_PARAM structures and helper functions X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f9865ab9eedfd6907e0e45649f1600a88449e04f;p=thirdparty%2Fopenssl.git cipher: declare common OSSL_PARAM structures and helper functions Reviewed-by: Richard Levitte Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/27859) --- diff --git a/providers/implementations/digests/digestcommon.c b/providers/implementations/digests/digestcommon.c.in similarity index 100% rename from providers/implementations/digests/digestcommon.c rename to providers/implementations/digests/digestcommon.c.in diff --git a/providers/implementations/include/prov/ciphercommon.h b/providers/implementations/include/prov/ciphercommon.h index 46efdc80033..b5f0b92c432 100644 --- a/providers/implementations/include/prov/ciphercommon.h +++ b/providers/implementations/include/prov/ciphercommon.h @@ -362,6 +362,30 @@ const OSSL_PARAM * name##_settable_ctx_params(ossl_unused void *cctx, \ return name##_known_settable_ctx_params; \ } +struct ossl_cipher_get_ctx_param_list_st { + OSSL_PARAM *keylen; /* all ciphers */ + OSSL_PARAM *ivlen; /* all ciphers */ + OSSL_PARAM *pad; /* all ciphers */ + OSSL_PARAM *num; /* all ciphers */ + OSSL_PARAM *iv; /* all ciphers */ + OSSL_PARAM *updiv; /* all ciphers */ + OSSL_PARAM *tlsmac; /* generic cipher */ +}; + +struct ossl_cipher_set_ctx_param_list_st { + OSSL_PARAM *pad; /* all ciphers */ + OSSL_PARAM *num; /* all ciphers */ + OSSL_PARAM *bits; /* generic cipher */ + OSSL_PARAM *tlsvers; /* generic cipher */ + OSSL_PARAM *tlsmacsize; /* generic cipher */ + OSSL_PARAM *keylen; /* variable key length ciphers */ +}; + +int ossl_cipher_common_get_ctx_params + (PROV_CIPHER_CTX *ctx, const struct ossl_cipher_get_ctx_param_list_st *p); +int ossl_cipher_common_set_ctx_params + (PROV_CIPHER_CTX *ctx, const struct ossl_cipher_set_ctx_param_list_st *p); + int ossl_cipher_generic_initiv(PROV_CIPHER_CTX *ctx, const unsigned char *iv, size_t ivlen);