diff options
44 files changed, 382 insertions, 370 deletions
diff --git a/providers/common/include/prov/providercommon.h b/providers/common/include/prov/providercommon.h index 44e9c812aa..d90492c723 100644 --- a/providers/common/include/prov/providercommon.h +++ b/providers/common/include/prov/providercommon.h @@ -14,8 +14,8 @@ const OSSL_CORE_HANDLE *FIPS_get_core_handle(OPENSSL_CTX *ctx); const char *ossl_prov_util_nid_to_name(int nid); -int cipher_capable_aes_cbc_hmac_sha1(void); -int cipher_capable_aes_cbc_hmac_sha256(void); +int ossl_cipher_capable_aes_cbc_hmac_sha1(void); +int ossl_cipher_capable_aes_cbc_hmac_sha256(void); OSSL_FUNC_provider_get_capabilities_fn provider_get_capabilities; diff --git a/providers/defltprov.c b/providers/defltprov.c index 06ce516041..48f0c88098 100644 --- a/providers/defltprov.c +++ b/providers/defltprov.c @@ -205,13 +205,13 @@ static const OSSL_ALGORITHM_CAPABLE deflt_ciphers[] = { ALG("AES-128-WRAP-PAD:id-aes128-wrap-pad:AES128-WRAP-PAD", ossl_aes128wrappad_functions), ALGC("AES-128-CBC-HMAC-SHA1", ossl_aes128cbc_hmac_sha1_functions, - cipher_capable_aes_cbc_hmac_sha1), + ossl_cipher_capable_aes_cbc_hmac_sha1), ALGC("AES-256-CBC-HMAC-SHA1", ossl_aes256cbc_hmac_sha1_functions, - cipher_capable_aes_cbc_hmac_sha1), + ossl_cipher_capable_aes_cbc_hmac_sha1), ALGC("AES-128-CBC-HMAC-SHA256", ossl_aes128cbc_hmac_sha256_functions, - cipher_capable_aes_cbc_hmac_sha256), + ossl_cipher_capable_aes_cbc_hmac_sha256), ALGC("AES-256-CBC-HMAC-SHA256", ossl_aes256cbc_hmac_sha256_functions, - cipher_capable_aes_cbc_hmac_sha256), + ossl_cipher_capable_aes_cbc_hmac_sha256), #ifndef OPENSSL_NO_ARIA ALG("ARIA-256-GCM", ossl_aria256gcm_functions), ALG("ARIA-192-GCM", ossl_aria192gcm_functions), diff --git a/providers/fips/fipsprov.c b/providers/fips/fipsprov.c index 1cbe5ed454..005ad2bb54 100644 --- a/providers/fips/fipsprov.c +++ b/providers/fips/fipsprov.c @@ -385,13 +385,13 @@ static const OSSL_ALGORITHM_CAPABLE fips_ciphers[] = { ALG("AES-128-WRAP-PAD:id-aes128-wrap-pad:AES128-WRAP-PAD", ossl_aes128wrappad_functions), ALGC("AES-128-CBC-HMAC-SHA1", ossl_aes128cbc_hmac_sha1_functions, - cipher_capable_aes_cbc_hmac_sha1), + ossl_cipher_capable_aes_cbc_hmac_sha1), ALGC("AES-256-CBC-HMAC-SHA1", ossl_aes256cbc_hmac_sha1_functions, - cipher_capable_aes_cbc_hmac_sha1), + ossl_cipher_capable_aes_cbc_hmac_sha1), ALGC("AES-128-CBC-HMAC-SHA256", ossl_aes128cbc_hmac_sha256_functions, - cipher_capable_aes_cbc_hmac_sha256), + ossl_cipher_capable_aes_cbc_hmac_sha256), ALGC("AES-256-CBC-HMAC-SHA256", ossl_aes256cbc_hmac_sha256_functions, - cipher_capable_aes_cbc_hmac_sha256), + ossl_cipher_capable_aes_cbc_hmac_sha256), #ifndef OPENSSL_NO_DES ALG("DES-EDE3-ECB:DES-EDE3", ossl_tdes_ede3_ecb_functions), ALG("DES-EDE3-CBC:DES3", ossl_tdes_ede3_cbc_functions), diff --git a/providers/implementations/ciphers/cipher_aes.c b/providers/implementations/ciphers/cipher_aes.c index f2d75d7010..2f469c131a 100644 --- a/providers/implementations/ciphers/cipher_aes.c +++ b/providers/implementations/ciphers/cipher_aes.c @@ -27,7 +27,7 @@ static void aes_freectx(void *vctx) { PROV_AES_CTX *ctx = (PROV_AES_CTX *)vctx; - cipher_generic_reset_ctx((PROV_CIPHER_CTX *)vctx); + ossl_cipher_generic_reset_ctx((PROV_CIPHER_CTX *)vctx); OPENSSL_clear_free(ctx, sizeof(*ctx)); } diff --git a/providers/implementations/ciphers/cipher_aes_cbc_hmac_sha.c b/providers/implementations/ciphers/cipher_aes_cbc_hmac_sha.c index 16916fdc47..1ff2a29590 100644 --- a/providers/implementations/ciphers/cipher_aes_cbc_hmac_sha.c +++ b/providers/implementations/ciphers/cipher_aes_cbc_hmac_sha.c @@ -42,12 +42,12 @@ static OSSL_FUNC_cipher_get_ctx_params_fn aes_get_ctx_params; static OSSL_FUNC_cipher_gettable_ctx_params_fn aes_gettable_ctx_params; static OSSL_FUNC_cipher_set_ctx_params_fn aes_set_ctx_params; static OSSL_FUNC_cipher_settable_ctx_params_fn aes_settable_ctx_params; -# define aes_gettable_params cipher_generic_gettable_params -# define aes_einit cipher_generic_einit -# define aes_dinit cipher_generic_dinit -# define aes_update cipher_generic_stream_update -# define aes_final cipher_generic_stream_final -# define aes_cipher cipher_generic_cipher +# define aes_gettable_params ossl_cipher_generic_gettable_params +# define aes_einit ossl_cipher_generic_einit +# define aes_dinit ossl_cipher_generic_dinit +# define aes_update ossl_cipher_generic_stream_update +# define aes_final ossl_cipher_generic_stream_final +# define aes_cipher ossl_cipher_generic_cipher static const OSSL_PARAM cipher_aes_known_settable_ctx_params[] = { OSSL_PARAM_octet_string(OSSL_CIPHER_PARAM_AEAD_MAC_KEY, NULL, 0), @@ -290,9 +290,9 @@ static void base_init(void *provctx, PROV_AES_HMAC_SHA_CTX *ctx, size_t kbits, size_t blkbits, size_t ivbits, uint64_t flags) { - cipher_generic_initkey(&ctx->base, kbits, blkbits, ivbits, - EVP_CIPH_CBC_MODE, flags, - &meths->base, provctx); + ossl_cipher_generic_initkey(&ctx->base, kbits, blkbits, ivbits, + EVP_CIPH_CBC_MODE, flags, + &meths->base, provctx); ctx->hw = (PROV_CIPHER_HW_AES_HMAC_SHA *)ctx->base.hw; } @@ -318,7 +318,7 @@ static void aes_cbc_hmac_sha1_freectx(void *vctx) PROV_AES_HMAC_SHA1_CTX *ctx = (PROV_AES_HMAC_SHA1_CTX *)vctx; if (ctx != NULL) { - cipher_generic_reset_ctx((PROV_CIPHER_CTX *)vctx); + ossl_cipher_generic_reset_ctx((PROV_CIPHER_CTX *)vctx); OPENSSL_clear_free(ctx, sizeof(*ctx)); } } @@ -345,7 +345,7 @@ static void aes_cbc_hmac_sha256_freectx(void *vctx) PROV_AES_HMAC_SHA256_CTX *ctx = (PROV_AES_HMAC_SHA256_CTX *)vctx; if (ctx != NULL) { - cipher_generic_reset_ctx((PROV_CIPHER_CTX *)vctx); + ossl_cipher_generic_reset_ctx((PROV_CIPHER_CTX *)vctx); OPENSSL_clear_free(ctx, sizeof(*ctx)); } } @@ -359,8 +359,8 @@ static void *nm##_##kbits##_##sub##_newctx(void *provctx) \ static OSSL_FUNC_cipher_get_params_fn nm##_##kbits##_##sub##_get_params; \ static int nm##_##kbits##_##sub##_get_params(OSSL_PARAM params[]) \ { \ - return cipher_generic_get_params(params, EVP_CIPH_CBC_MODE, \ - flags, kbits, blkbits, ivbits); \ + return ossl_cipher_generic_get_params(params, EVP_CIPH_CBC_MODE, \ + flags, kbits, blkbits, ivbits); \ } \ const OSSL_DISPATCH ossl_##nm##kbits##sub##_functions[] = { \ { OSSL_FUNC_CIPHER_NEWCTX, (void (*)(void))nm##_##kbits##_##sub##_newctx },\ diff --git a/providers/implementations/ciphers/cipher_aes_cbc_hmac_sha.h b/providers/implementations/ciphers/cipher_aes_cbc_hmac_sha.h index 75c450c350..6aaf3f06fb 100644 --- a/providers/implementations/ciphers/cipher_aes_cbc_hmac_sha.h +++ b/providers/implementations/ciphers/cipher_aes_cbc_hmac_sha.h @@ -10,8 +10,8 @@ #include "prov/ciphercommon.h" #include "crypto/aes_platform.h" -int cipher_capable_aes_cbc_hmac_sha1(void); -int cipher_capable_aes_cbc_hmac_sha256(void); +int ossl_cipher_capable_aes_cbc_hmac_sha1(void); +int ossl_cipher_capable_aes_cbc_hmac_sha256(void); typedef struct prov_cipher_hw_aes_hmac_sha_ctx_st { PROV_CIPHER_HW base; /* must be first */ diff --git a/providers/implementations/ciphers/cipher_aes_cbc_hmac_sha1_hw.c b/providers/implementations/ciphers/cipher_aes_cbc_hmac_sha1_hw.c index b3aebbe052..f8db563d18 100644 --- a/providers/implementations/ciphers/cipher_aes_cbc_hmac_sha1_hw.c +++ b/providers/implementations/ciphers/cipher_aes_cbc_hmac_sha1_hw.c @@ -17,7 +17,7 @@ #include "cipher_aes_cbc_hmac_sha.h" #if !defined(AES_CBC_HMAC_SHA_CAPABLE) || !defined(AESNI_CAPABLE) -int cipher_capable_aes_cbc_hmac_sha1(void) +int ossl_cipher_capable_aes_cbc_hmac_sha1(void) { return 0; } @@ -37,7 +37,7 @@ void aesni_cbc_sha1_enc(const void *inp, void *out, size_t blocks, const AES_KEY *key, unsigned char iv[16], SHA_CTX *ctx, const void *in0); -int cipher_capable_aes_cbc_hmac_sha1(void) +int ossl_cipher_capable_aes_cbc_hmac_sha1(void) { return AESNI_CBC_HMAC_SHA_CAPABLE; } diff --git a/providers/implementations/ciphers/cipher_aes_cbc_hmac_sha256_hw.c b/providers/implementations/ciphers/cipher_aes_cbc_hmac_sha256_hw.c index 8e738bcd10..8587c414cd 100644 --- a/providers/implementations/ciphers/cipher_aes_cbc_hmac_sha256_hw.c +++ b/providers/implementations/ciphers/cipher_aes_cbc_hmac_sha256_hw.c @@ -17,7 +17,7 @@ #include "cipher_aes_cbc_hmac_sha.h" #if !defined(AES_CBC_HMAC_SHA_CAPABLE) || !defined(AESNI_CAPABLE) -int cipher_capable_aes_cbc_hmac_sha256(void) +int ossl_cipher_capable_aes_cbc_hmac_sha256(void) { return 0; } @@ -37,7 +37,7 @@ int aesni_cbc_sha256_enc(const void *inp, void *out, size_t blocks, const AES_KEY *key, unsigned char iv[16], SHA256_CTX *ctx, const void *in0); -int cipher_capable_aes_cbc_hmac_sha256(void) +int ossl_cipher_capable_aes_cbc_hmac_sha256(void) { return AESNI_CBC_HMAC_SHA_CAPABLE && aesni_cbc_sha256_enc(NULL, NULL, 0, NULL, NULL, NULL, NULL); diff --git a/providers/implementations/ciphers/cipher_aes_cts.inc b/providers/implementations/ciphers/cipher_aes_cts.inc index 559a7b2bf6..6eb85a083f 100644 --- a/providers/implementations/ciphers/cipher_aes_cts.inc +++ b/providers/implementations/ciphers/cipher_aes_cts.inc @@ -35,7 +35,7 @@ static int aes_cbc_cts_get_ctx_params(void *vctx, OSSL_PARAM params[]) return 0; } } - return cipher_generic_get_ctx_params(vctx, params); + return ossl_cipher_generic_get_ctx_params(vctx, params); } CIPHER_DEFAULT_SETTABLE_CTX_PARAMS_START(aes_cbc_cts) @@ -58,7 +58,7 @@ static int aes_cbc_cts_set_ctx_params(void *vctx, const OSSL_PARAM params[]) ctx->cts_mode = (unsigned int)id; } - return cipher_generic_set_ctx_params(vctx, params); + return ossl_cipher_generic_set_ctx_params(vctx, params); err: ERR_raise(ERR_LIB_PROV, PROV_R_FAILED_TO_SET_PARAMETER); return 0; @@ -70,25 +70,25 @@ err: static OSSL_FUNC_cipher_get_params_fn alg##_##kbits##_##lcmode##_get_params; \ static int alg##_cts_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ { \ - return cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, flags, \ - kbits, blkbits, ivbits); \ + return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, flags, \ + kbits, blkbits, ivbits); \ } \ const OSSL_DISPATCH ossl_##alg##kbits##lcmode##_cts_functions[] = { \ { OSSL_FUNC_CIPHER_NEWCTX, \ (void (*)(void)) alg##_##kbits##_##lcmode##_newctx }, \ { OSSL_FUNC_CIPHER_FREECTX, (void (*)(void)) alg##_freectx }, \ { OSSL_FUNC_CIPHER_DUPCTX, (void (*)(void)) alg##_dupctx }, \ - { OSSL_FUNC_CIPHER_ENCRYPT_INIT, (void (*)(void))cipher_generic_einit }, \ - { OSSL_FUNC_CIPHER_DECRYPT_INIT, (void (*)(void))cipher_generic_dinit }, \ + { OSSL_FUNC_CIPHER_ENCRYPT_INIT, (void (*)(void))ossl_cipher_generic_einit }, \ + { OSSL_FUNC_CIPHER_DECRYPT_INIT, (void (*)(void))ossl_cipher_generic_dinit }, \ { OSSL_FUNC_CIPHER_UPDATE, \ - (void (*)(void)) alg##_##lcmode##_cts_block_update }, \ + (void (*)(void)) ossl_##alg##_##lcmode##_cts_block_update }, \ { OSSL_FUNC_CIPHER_FINAL, \ - (void (*)(void)) alg##_##lcmode##_cts_block_final }, \ - { OSSL_FUNC_CIPHER_CIPHER, (void (*)(void))cipher_generic_cipher }, \ + (void (*)(void)) ossl_##alg##_##lcmode##_cts_block_final }, \ + { OSSL_FUNC_CIPHER_CIPHER, (void (*)(void))ossl_cipher_generic_cipher }, \ { OSSL_FUNC_CIPHER_GET_PARAMS, \ (void (*)(void)) alg##_cts_##kbits##_##lcmode##_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))aes_cbc_cts_get_ctx_params }, \ { OSSL_FUNC_CIPHER_SET_CTX_PARAMS, \ diff --git a/providers/implementations/ciphers/cipher_aes_hw.c b/providers/implementations/ciphers/cipher_aes_hw.c index 50809313ec..0b6f06f915 100644 --- a/providers/implementations/ciphers/cipher_aes_hw.c +++ b/providers/implementations/ciphers/cipher_aes_hw.c @@ -126,7 +126,7 @@ IMPLEMENT_CIPHER_HW_COPYCTX(cipher_hw_aes_copyctx, PROV_AES_CTX) #define PROV_CIPHER_HW_aes_mode(mode) \ static const PROV_CIPHER_HW aes_##mode = { \ cipher_hw_aes_initkey, \ - cipher_hw_generic_##mode, \ + ossl_cipher_hw_generic_##mode, \ cipher_hw_aes_copyctx \ }; \ PROV_CIPHER_HW_declare(mode) \ diff --git a/providers/implementations/ciphers/cipher_aes_hw_aesni.inc b/providers/implementations/ciphers/cipher_aes_hw_aesni.inc index 8d3aef69b7..22bc1ce1db 100644 --- a/providers/implementations/ciphers/cipher_aes_hw_aesni.inc +++ b/providers/implementations/ciphers/cipher_aes_hw_aesni.inc @@ -12,11 +12,11 @@ * This file is included by cipher_aes_hw.c */ -#define cipher_hw_aesni_ofb128 cipher_hw_generic_ofb128 -#define cipher_hw_aesni_cfb128 cipher_hw_generic_cfb128 -#define cipher_hw_aesni_cfb8 cipher_hw_generic_cfb8 -#define cipher_hw_aesni_cfb1 cipher_hw_generic_cfb1 -#define cipher_hw_aesni_ctr cipher_hw_generic_ctr +#define cipher_hw_aesni_ofb128 ossl_cipher_hw_generic_ofb128 +#define cipher_hw_aesni_cfb128 ossl_cipher_hw_generic_cfb128 +#define cipher_hw_aesni_cfb8 ossl_cipher_hw_generic_cfb8 +#define cipher_hw_aesni_cfb1 ossl_cipher_hw_generic_cfb1 +#define cipher_hw_aesni_ctr ossl_cipher_hw_generic_ctr static int cipher_hw_aesni_initkey(PROV_CIPHER_CTX *dat, const unsigned char *key, size_t keylen) diff --git a/providers/implementations/ciphers/cipher_aes_hw_s390x.inc b/providers/implementations/ciphers/cipher_aes_hw_s390x.inc index 523e869c79..f6f5e68559 100644 --- a/providers/implementations/ciphers/cipher_aes_hw_s390x.inc +++ b/providers/implementations/ciphers/cipher_aes_hw_s390x.inc @@ -17,9 +17,9 @@ #define s390x_aes_cbc_initkey cipher_hw_aes_initkey #define s390x_aes_cfb1_initkey cipher_hw_aes_initkey #define s390x_aes_ctr_initkey cipher_hw_aes_initkey -#define s390x_aes_cbc_cipher_hw cipher_hw_generic_cbc -#define s390x_aes_cfb1_cipher_hw cipher_hw_generic_cfb1 -#define s390x_aes_ctr_cipher_hw cipher_hw_generic_ctr +#define s390x_aes_cbc_cipher_hw ossl_cipher_hw_generic_cbc +#define s390x_aes_cfb1_cipher_hw ossl_cipher_hw_generic_cfb1 +#define s390x_aes_ctr_cipher_hw ossl_cipher_hw_generic_ctr #define S390X_aes_128_ofb128_CAPABLE S390X_aes_128_ofb_CAPABLE #define S390X_aes_192_ofb128_CAPABLE S390X_aes_192_ofb_CAPABLE diff --git a/providers/implementations/ciphers/cipher_aes_ocb.c b/providers/implementations/ciphers/cipher_aes_ocb.c index c96718bf22..7cb3f6a764 100644 --- a/providers/implementations/ciphers/cipher_aes_ocb.c +++ b/providers/implementations/ciphers/cipher_aes_ocb.c @@ -122,7 +122,7 @@ static int aes_ocb_init(void *vctx, const unsigned char *key, size_t keylen, } ctx->base.ivlen = ivlen; } - if (!cipher_generic_initiv(&ctx->base, iv, ivlen)) + if (!ossl_cipher_generic_initiv(&ctx->base, iv, ivlen)) return 0; ctx->iv_state = IV_STATE_BUFFERED; } @@ -307,8 +307,8 @@ static void *aes_ocb_newctx(void *provctx, size_t kbits, size_t blkbits, ctx = OPENSSL_zalloc(sizeof(*ctx)); if (ctx != NULL) { - cipher_generic_initkey(ctx, kbits, blkbits, ivbits, mode, flags, - ossl_prov_cipher_hw_aes_ocb(kbits), NULL); + ossl_cipher_generic_initkey(ctx, kbits, blkbits, ivbits, mode, flags, + ossl_prov_cipher_hw_aes_ocb(kbits), NULL); ctx->taglen = OCB_DEFAULT_TAG_LEN; } return ctx; @@ -320,7 +320,7 @@ static void aes_ocb_freectx(void *vctx) if (ctx != NULL) { aes_generic_ocb_cleanup(ctx); - cipher_generic_reset_ctx((PROV_CIPHER_CTX *)vctx); + ossl_cipher_generic_reset_ctx((PROV_CIPHER_CTX *)vctx); OPENSSL_clear_free(ctx, sizeof(*ctx)); } } @@ -509,8 +509,8 @@ static int aes_ocb_cipher(void *vctx, unsigned char *out, size_t *outl, static OSSL_FUNC_cipher_get_params_fn aes_##kbits##_##mode##_get_params; \ static int aes_##kbits##_##mode##_get_params(OSSL_PARAM params[]) \ { \ - return cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ - flags, kbits, blkbits, ivbits); \ + return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ + flags, kbits, blkbits, ivbits); \ } \ static OSSL_FUNC_cipher_newctx_fn aes_##kbits##_##mode##_newctx; \ static void *aes_##kbits##_##mode##_newctx(void *provctx) \ @@ -535,7 +535,7 @@ const OSSL_DISPATCH ossl_##aes##kbits##mode##_functions[] = { \ { OSSL_FUNC_CIPHER_SET_CTX_PARAMS, \ (void (*)(void))aes_##mode##_set_ctx_params }, \ { OSSL_FUNC_CIPHER_GETTABLE_PARAMS, \ - (void (*)(void))cipher_generic_gettable_params }, \ + (void (*)(void))ossl_cipher_generic_gettable_params }, \ { OSSL_FUNC_CIPHER_GETTABLE_CTX_PARAMS, \ (void (*)(void))cipher_ocb_gettable_ctx_params }, \ { OSSL_FUNC_CIPHER_SETTABLE_CTX_PARAMS, \ diff --git a/providers/implementations/ciphers/cipher_aes_siv.c b/providers/implementations/ciphers/cipher_aes_siv.c index e427c6baf3..6e986554f1 100644 --- a/providers/implementations/ciphers/cipher_aes_siv.c +++ b/providers/implementations/ciphers/cipher_aes_siv.c @@ -258,7 +258,7 @@ 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, \ + 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, \ diff --git a/providers/implementations/ciphers/cipher_aes_wrp.c b/providers/implementations/ciphers/cipher_aes_wrp.c index 50c56eba1f..3918161b46 100644 --- a/providers/implementations/ciphers/cipher_aes_wrp.c +++ b/providers/implementations/ciphers/cipher_aes_wrp.c @@ -59,8 +59,8 @@ static void *aes_wrap_newctx(size_t kbits, size_t blkbits, wctx = OPENSSL_zalloc(sizeof(*wctx)); ctx = (PROV_CIPHER_CTX *)wctx; if (ctx != NULL) { - cipher_generic_initkey(ctx, kbits, blkbits, ivbits, mode, flags, - NULL, NULL); + ossl_cipher_generic_initkey(ctx, kbits, blkbits, ivbits, mode, flags, + NULL, NULL); ctx->pad = (ctx->ivlen == AES_WRAP_PAD_IVLEN); } return wctx; @@ -70,7 +70,7 @@ static void aes_wrap_freectx(void *vctx) { PROV_AES_WRAP_CTX *wctx = (PROV_AES_WRAP_CTX *)vctx; - cipher_generic_reset_ctx((PROV_CIPHER_CTX *)vctx); + ossl_cipher_generic_reset_ctx((PROV_CIPHER_CTX *)vctx); OPENSSL_clear_free(wctx, sizeof(*wctx)); } @@ -92,7 +92,7 @@ static int aes_wrap_init(void *vctx, const unsigned char *key, wctx->wrapfn = enc ? CRYPTO_128_wrap : CRYPTO_128_unwrap; if (iv != NULL) { - if (!cipher_generic_initiv(ctx, iv, ivlen)) + if (!ossl_cipher_generic_initiv(ctx, iv, ivlen)) return 0; } if (key != NULL) { @@ -228,8 +228,8 @@ static int aes_wrap_set_ctx_params(void *vctx, const OSSL_PARAM params[]) static OSSL_FUNC_cipher_get_params_fn aes_##kbits##_##fname##_get_params; \ static int aes_##kbits##_##fname##_get_params(OSSL_PARAM params[]) \ { \ - return cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ - flags, kbits, blkbits, ivbits); \ + return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE,\ + flags, kbits, blkbits, ivbits); \ } \ static OSSL_FUNC_cipher_newctx_fn aes_##kbits##fname##_newctx; \ static void *aes_##kbits##fname##_newctx(void *provctx) \ @@ -248,15 +248,15 @@ static int aes_wrap_set_ctx_params(void *vctx, const OSSL_PARAM params[]) { OSSL_FUNC_CIPHER_GET_PARAMS, \ (void (*)(void))aes_##kbits##_##fname##_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))cipher_generic_get_ctx_params }, \ + (void (*)(void))ossl_cipher_generic_get_ctx_params }, \ { OSSL_FUNC_CIPHER_SET_CTX_PARAMS, \ (void (*)(void))aes_wrap_set_ctx_params }, \ { OSSL_FUNC_CIPHER_GETTABLE_CTX_PARAMS, \ - (void (*)(void))cipher_generic_gettable_ctx_params }, \ + (void (*)(void))ossl_cipher_generic_gettable_ctx_params }, \ { OSSL_FUNC_CIPHER_SETTABLE_CTX_PARAMS, \ - (void (*)(void))cipher_generic_settable_ctx_params }, \ + (void (*)(void))ossl_cipher_generic_settable_ctx_params }, \ { 0, NULL } \ } diff --git a/providers/implementations/ciphers/cipher_aes_xts.c b/providers/implementations/ciphers/cipher_aes_xts.c index ca40bbde0e..7ccad56198 100644 --- a/providers/implementations/ciphers/cipher_aes_xts.c +++ b/providers/implementations/ciphers/cipher_aes_xts.c @@ -82,7 +82,7 @@ static int aes_xts_init(void *vctx, const unsigned char *key, size_t keylen, ctx->enc = enc; if (iv != NULL) { - if (!cipher_generic_initiv(vctx, iv, ivlen)) + if (!ossl_cipher_generic_initiv(vctx, iv, ivlen)) return 0; } if (key != NULL) { @@ -115,8 +115,9 @@ static void *aes_xts_newctx(void *provctx, unsigned int mode, uint64_t flags, PROV_AES_XTS_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx)); if (ctx != NULL) { - cipher_generic_initkey(&ctx->base, kbits, blkbits, ivbits, mode, flags, - ossl_prov_cipher_hw_aes_xts(kbits), NULL); + ossl_cipher_generic_initkey(&ctx->base, kbits, blkbits, ivbits, mode, + flags, ossl_prov_cipher_hw_aes_xts(kbits), + NULL); } return ctx; } @@ -125,7 +126,7 @@ static void aes_xts_freectx(void *vctx) { PROV_AES_XTS_CTX *ctx = (PROV_AES_XTS_CTX *)vctx; - cipher_generic_reset_ctx((PROV_CIPHER_CTX *)vctx); + ossl_cipher_generic_reset_ctx((PROV_CIPHER_CTX *)vctx); OPENSSL_clear_free(ctx, sizeof(*ctx)); } @@ -256,7 +257,7 @@ static int aes_xts_set_ctx_params(void *vctx, const OSSL_PARAM params[]) static OSSL_FUNC_cipher_get_params_fn aes_##kbits##_##lcmode##_get_params; \ static int aes_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ { \ - return cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ + return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ flags, 2 * kbits, AES_XTS_BLOCK_BITS, \ AES_XTS_IV_BITS); \ } \ @@ -278,11 +279,11 @@ const OSSL_DISPATCH ossl_aes##kbits##xts_functions[] = { \ { OSSL_FUNC_CIPHER_GET_PARAMS, \ (void (*)(void))aes_##kbits##_##lcmode##_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))cipher_generic_get_ctx_params }, \ + (void (*)(void))ossl_cipher_generic_get_ctx_params }, \ { OSSL_FUNC_CIPHER_GETTABLE_CTX_PARAMS, \ - (void (*)(void))cipher_generic_gettable_ctx_params }, \ + (void (*)(void))ossl_cipher_generic_gettable_ctx_params }, \ { OSSL_FUNC_CIPHER_SET_CTX_PARAMS, \ (void (*)(void))aes_xts_set_ctx_params }, \ { OSSL_FUNC_CIPHER_SETTABLE_CTX_PARAMS, \ diff --git a/providers/implementations/ciphers/cipher_aria.c b/providers/implementations/ciphers/cipher_aria.c index a85162fad5..be69c39bab 100644 --- a/providers/implementations/ciphers/cipher_aria.c +++ b/providers/implementations/ciphers/cipher_aria.c @@ -20,7 +20,7 @@ static void aria_freectx(void *vctx) { PROV_ARIA_CTX *ctx = (PROV_ARIA_CTX *)vctx; - cipher_generic_reset_ctx((PROV_CIPHER_CTX *)vctx); + ossl_cipher_generic_reset_ctx((PROV_CIPHER_CTX *)vctx); OPENSSL_clear_free(ctx, sizeof(*ctx)); } diff --git a/providers/implementations/ciphers/cipher_aria_hw.c b/providers/implementations/ciphers/cipher_aria_hw.c index 6486474ec2..e5490e68b4 100644 --- a/providers/implementations/ciphers/cipher_aria_hw.c +++ b/providers/implementations/ciphers/cipher_aria_hw.c @@ -34,7 +34,7 @@ IMPLEMENT_CIPHER_HW_COPYCTX(cipher_hw_aria_copyctx, PROV_ARIA_CTX) # define PROV_CIPHER_HW_aria_mode(mode) \ static const PROV_CIPHER_HW aria_##mode = { \ cipher_hw_aria_initkey, \ - cipher_hw_chunked_##mode, \ + ossl_cipher_hw_chunked_##mode, \ cipher_hw_aria_copyctx \ }; \ const PROV_CIPHER_HW *ossl_prov_cipher_hw_aria_##mode(size_t keybits) \ diff --git a/providers/implementations/ciphers/cipher_blowfish.c b/providers/implementations/ciphers/cipher_blowfish.c index f4ab8f5352..6320f560a0 100644 --- a/providers/implementations/ciphers/cipher_blowfish.c +++ b/providers/implementations/ciphers/cipher_blowfish.c @@ -28,7 +28,7 @@ static void blowfish_freectx(void *vctx) { PROV_BLOWFISH_CTX *ctx = (PROV_BLOWFISH_CTX *)vctx; - cipher_generic_reset_ctx((PROV_CIPHER_CTX *)vctx); + ossl_cipher_generic_reset_ctx((PROV_CIPHER_CTX *)vctx); OPENSSL_clear_free(ctx, sizeof(*ctx)); } diff --git a/providers/implementations/ciphers/cipher_camellia.c b/providers/implementations/ciphers/cipher_camellia.c index 90cb1c18be..02bef547fd 100644 --- a/providers/implementations/ciphers/cipher_camellia.c +++ b/providers/implementations/ciphers/cipher_camellia.c @@ -26,7 +26,7 @@ static void camellia_freectx(void *vctx) { PROV_CAMELLIA_CTX *ctx = (PROV_CAMELLIA_CTX *)vctx; - cipher_generic_reset_ctx((PROV_CIPHER_CTX *)vctx); + ossl_cipher_generic_reset_ctx((PROV_CIPHER_CTX *)vctx); OPENSSL_clear_free(ctx, sizeof(*ctx)); } diff --git a/providers/implementations/ciphers/cipher_camellia_hw.c b/providers/implementations/ciphers/cipher_camellia_hw.c index af4db4405a..e8ada99a7e 100644 --- a/providers/implementations/ciphers/cipher_camellia_hw.c +++ b/providers/implementations/ciphers/cipher_camellia_hw.c @@ -54,7 +54,7 @@ IMPLEMENT_CIPHER_HW_COPYCTX(cipher_hw_camellia_copyctx, PROV_CAMELLIA_CTX) #define PROV_CIPHER_HW_camellia_mode(mode) \ static const PROV_CIPHER_HW camellia_##mode = { \ cipher_hw_camellia_initkey, \ - cipher_hw_generic_##mode, \ + ossl_cipher_hw_generic_##mode, \ cipher_hw_camellia_copyctx \ }; \ PROV_CIPHER_HW_declare(mode) \ diff --git a/providers/implementations/ciphers/cipher_cast5.c b/providers/implementations/ciphers/cipher_cast5.c index 1551f690ad..7c686013d8 100644 --- a/providers/implementations/ciphers/cipher_cast5.c +++ b/providers/implementations/ciphers/cipher_cast5.c @@ -29,7 +29,7 @@ static void cast5_freectx(void *vctx) { PROV_CAST_CTX *ctx = (PROV_CAST_CTX *)vctx; - cipher_generic_reset_ctx((PROV_CIPHER_CTX *)vctx); + ossl_cipher_generic_reset_ctx((PROV_CIPHER_CTX *)vctx); OPENSSL_clear_free(ctx, sizeof(*ctx)); } diff --git a/providers/implementations/ciphers/cipher_chacha20.c b/providers/implementations/ciphers/cipher_chacha20.c index 89493c3fbc..8e0727ae47 100644 --- a/providers/implementations/ciphers/cipher_chacha20.c +++ b/providers/implementations/ciphers/cipher_chacha20.c @@ -27,19 +27,19 @@ static OSSL_FUNC_cipher_get_ctx_params_fn chacha20_get_ctx_params; static OSSL_FUNC_cipher_set_ctx_params_fn chacha20_set_ctx_params; static OSSL_FUNC_cipher_gettable_ctx_params_fn chacha20_gettable_ctx_params; static OSSL_FUNC_cipher_settable_ctx_params_fn chacha20_settable_ctx_params; -#define chacha20_cipher cipher_generic_cipher -#define chacha20_update cipher_generic_stream_update -#define chacha20_final cipher_generic_stream_final -#define chacha20_gettable_params cipher_generic_gettable_params +#define chacha20_cipher ossl_cipher_generic_cipher +#define chacha20_update ossl_cipher_generic_stream_update +#define chacha20_final ossl_cipher_generic_stream_final +#define chacha20_gettable_params ossl_cipher_generic_gettable_params void chacha20_initctx(PROV_CHACHA20_CTX *ctx) { - cipher_generic_initkey(ctx, CHACHA20_KEYLEN * 8, - CHACHA20_BLKLEN * 8, - CHACHA20_IVLEN * 8, - 0, CHACHA20_FLAGS, - ossl_prov_cipher_hw_chacha20(CHACHA20_KEYLEN * 8), - NULL); + ossl_cipher_generic_initkey(ctx, CHACHA20_KEYLEN * 8, + CHACHA20_BLKLEN * 8, + CHACHA20_IVLEN * 8, + 0, CHACHA20_FLAGS, + ossl_prov_cipher_hw_chacha20(CHACHA20_KEYLEN * 8), + NULL); } static void *chacha20_newctx(void *provctx) @@ -60,17 +60,17 @@ static void chacha20_freectx(void *vctx) PROV_CHACHA20_CTX *ctx = (PROV_CHACHA20_CTX *)vctx; if (ctx != NULL) { - cipher_generic_reset_ctx((PROV_CIPHER_CTX *)vctx); + ossl_cipher_generic_reset_ctx((PROV_CIPHER_CTX *)vctx); OPENSSL_clear_free(ctx, sizeof(*ctx)); } } static int chacha20_get_params(OSSL_PARAM params[]) { - return cipher_generic_get_params(params, 0, CHACHA20_FLAGS, - CHACHA20_KEYLEN * 8, - CHACHA20_BLKLEN * 8, - CHACHA20_IVLEN * 8); + return ossl_cipher_generic_get_params(params, 0, CHACHA20_FLAGS, + CHACHA20_KEYLEN * 8, + CHACHA20_BLKLEN * 8, + CHACHA20_IVLEN * 8); } static int chacha20_get_ctx_params(void *vctx, OSSL_PARAM params[]) @@ -147,7 +147,7 @@ int chacha20_einit(void *vctx, const unsigned char *key, size_t keylen, int ret; /* The generic function checks for ossl_prov_is_running() */ - ret= cipher_generic_einit(vctx, key, keylen, iv, ivlen); + ret= ossl_cipher_generic_einit(vctx, key, keylen, iv, ivlen); if (ret && iv != NULL) { PROV_CIPHER_CTX *ctx = (PROV_CIPHER_CTX *)vctx; PROV_CIPHER_HW_CHACHA20 *hw = (PROV_CIPHER_HW_CHACHA20 *)ctx->hw; @@ -163,7 +163,7 @@ int chacha20_dinit(void *vctx, const unsigned char *key, size_t keylen, int ret; /* The generic function checks for ossl_prov_is_running() */ - ret= cipher_generic_dinit(vctx, key, keylen, iv, ivlen); + ret= ossl_cipher_generic_dinit(vctx, key, keylen, iv, ivlen); if (ret && iv != NULL) { PROV_CIPHER_CTX *ctx = (PROV_CIPHER_CTX *)vctx; PROV_CIPHER_HW_CHACHA20 *hw = (PROV_CIPHER_HW_CHACHA20 *)ctx->hw; diff --git a/providers/implementations/ciphers/cipher_chacha20_poly1305.c b/providers/implementations/ciphers/cipher_chacha20_poly1305.c index 474d43b7fe..7a9cc5c20f 100644 --- a/providers/implementations/ciphers/cipher_chacha20_poly1305.c +++ b/providers/implementations/ciphers/cipher_chacha20_poly1305.c @@ -38,8 +38,8 @@ static OSSL_FUNC_cipher_set_ctx_params_fn chacha20_poly1305_set_ctx_params; static OSSL_FUNC_cipher_cipher_fn chacha20_poly1305_cipher; static OSSL_FUNC_cipher_final_fn chacha20_poly1305_final; static OSSL_FUNC_cipher_gettable_ctx_params_fn chacha20_poly1305_gettable_ctx_params; -#define chacha20_poly1305_settable_ctx_params cipher_aead_settable_ctx_params -#define chacha20_poly1305_gettable_params cipher_generic_gettable_params +#define chacha20_poly1305_settable_ctx_params ossl_cipher_aead_settable_ctx_params +#define chacha20_poly1305_gettable_params ossl_cipher_generic_gettable_params #define chacha20_poly1305_update chacha20_poly1305_cipher static void *chacha20_poly1305_newctx(void *provctx) @@ -51,14 +51,14 @@ static void *chacha20_poly1305_newctx(void *provctx) ctx = OPENSSL_zalloc(sizeof(*ctx)); if (ctx != NULL) { - cipher_generic_initkey(&ctx->base, CHACHA20_POLY1305_KEYLEN * 8, - CHACHA20_POLY1305_BLKLEN * 8, - CHACHA20_POLY1305_IVLEN * 8, - CHACHA20_POLY1305_MODE, - CHACHA20_POLY1305_FLAGS, - ossl_prov_cipher_hw_chacha20_poly1305( - CHACHA20_POLY1305_KEYLEN * 8), - NULL); + ossl_cipher_generic_initkey(&ctx->base, CHACHA20_POLY1305_KEYLEN * 8, + CHACHA20_POLY1305_BLKLEN * 8, + CHACHA20_POLY1305_IVLEN * 8, + CHACHA20_POLY1305_MODE, + CHACHA20_POLY1305_FLAGS, + ossl_prov_cipher_hw_chacha20_poly1305( + CHACHA20_POLY1305_KEYLEN * 8), + NULL); ctx->nonce_len = CHACHA20_POLY1305_IVLEN; ctx->tls_payload_length = NO_TLS_PAYLOAD_LENGTH; chacha20_initctx(&ctx->chacha); @@ -71,17 +71,17 @@ static void chacha20_poly1305_freectx(void *vctx) PROV_CHACHA20_POLY1305_CTX *ctx = (PROV_CHACHA20_POLY1305_CTX *)vctx; if (ctx != NULL) { - cipher_generic_reset_ctx((PROV_CIPHER_CTX *)vctx); + ossl_cipher_generic_reset_ctx((PROV_CIPHER_CTX *)vctx); OPENSSL_clear_free(ctx, sizeof(*ctx)); } } static int chacha20_poly1305_get_params(OSSL_PARAM params[]) { - return cipher_generic_get_params(params, 0, CHACHA20_POLY1305_FLAGS, - CHACHA20_POLY1305_KEYLEN * 8, - CHACHA20_POLY1305_BLKLEN * 8, - CHACHA20_POLY1305_IVLEN * 8); + return ossl_cipher_generic_get_params(params, 0, CHACHA20_POLY1305_FLAGS, + CHACHA20_POLY1305_KEYLEN * 8, + CHACHA20_POLY1305_BLKLEN * 8, + CHACHA20_POLY1305_IVLEN * 8); } static int chacha20_poly1305_get_ctx_params(void *vctx, OSSL_PARAM params[]) @@ -235,7 +235,7 @@ static int chacha20_poly1305_einit(void *vctx, const unsigned char *key, int ret; /* The generic function checks for ossl_prov_is_running() */ - ret = cipher_generic_einit(vctx, key, keylen, iv, ivlen); + ret = ossl_cipher_generic_einit(vctx, key, keylen, iv, ivlen); if (ret && iv != NULL) { PROV_CIPHER_CTX *ctx = (PROV_CIPHER_CTX *)vctx; PROV_CIPHER_HW_CHACHA20_POLY1305 *hw = @@ -253,7 +253,7 @@ static int chacha20_poly1305_dinit(void *vctx, const unsigned char *key, int ret; /* The generic function checks for ossl_prov_is_running() */ - ret = cipher_generic_dinit(vctx, key, keylen, iv, ivlen); + ret = ossl_cipher_generic_dinit(vctx, key, keylen, iv, ivlen); if (ret && iv != NULL) { PROV_CIPHER_CTX *ctx = (PROV_CIPHER_CTX *)vctx; PROV_CIPHER_HW_CHACHA20_POLY1305 *hw = diff --git a/providers/implementations/ciphers/cipher_des.c b/providers/implementations/ciphers/cipher_des.c index 7b6f2d7da5..345adfab60 100644 --- a/providers/implementations/ciphers/cipher_des.c +++ b/providers/implementations/ciphers/cipher_des.c @@ -40,8 +40,8 @@ static void *des_newctx(void *provctx, size_t kbits, size_t blkbits, ctx = OPENSSL_zalloc(sizeof(*ctx)); if (ctx != NULL) - cipher_generic_initkey(ctx, kbits, blkbits, ivbits, mode, flags, hw, - provctx); + ossl_cipher_generic_initkey(ctx, kbits, blkbits, ivbits, mode, flags, + hw, provctx); return ctx; } @@ -67,7 +67,7 @@ static void des_freectx(void *vctx) { PROV_DES_CTX *ctx = (PROV_DES_CTX *)vctx; - cipher_generic_reset_ctx((PROV_CIPHER_CTX *)vctx); + ossl_cipher_generic_reset_ctx((PROV_CIPHER_CTX *)vctx); OPENSSL_clear_free(ctx, sizeof(*ctx)); } @@ -84,7 +84,7 @@ static int des_init(void *vctx, const unsigned char *key, size_t keylen, ctx->enc = enc; if (iv != NULL) { - if (!cipher_generic_initiv(ctx, iv, ivlen)) + if (!ossl_cipher_generic_initiv(ctx, iv, ivlen)) return 0; } @@ -131,7 +131,7 @@ static int des_get_ctx_params(void *vctx, OSSL_PARAM params[]) PROV_CIPHER_CTX *ctx = (PROV_CIPHER_CTX *)vctx; OSSL_PARAM *p; - if (!cipher_generic_get_ctx_params(vctx, params)) + if (!ossl_cipher_generic_get_ctx_params(vctx, params)) return 0; p = OSSL_PARAM_locate(params, OSSL_CIPHER_PARAM_RANDOM_KEY); @@ -154,16 +154,16 @@ static void *des_##lcmode##_newctx(void *provctx) \ static OSSL_FUNC_cipher_get_params_fn des_##lcmode##_get_params; \ static int des_##lcmode##_get_params(OSSL_PARAM params[]) \ { \ - return cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, flags, \ - kbits, blkbits, ivbits); \ + return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ + flags, kbits, blkbits, ivbits); \ } \ const OSSL_DISPATCH ossl_##des_##lcmode##_functions[] = { \ { OSSL_FUNC_CIPHER_ENCRYPT_INIT, (void (*)(void))des_einit }, \ { OSSL_FUNC_CIPHER_DECRYPT_INIT, (void (*)(void))des_dinit }, \ { OSSL_FUNC_CIPHER_UPDATE, \ - (void (*)(void))cipher_generic_##block##_update }, \ - { OSSL_FUNC_CIPHER_FINAL, (void (*)(void))cipher_generic_##block##_final },\ - { OSSL_FUNC_CIPHER_CIPHER, (void (*)(void))cipher_generic_cipher }, \ + (void (*)(void))ossl_cipher_generic_##block##_update }, \ + { OSSL_FUNC_CIPHER_FINAL, (void (*)(void))ossl_cipher_generic_##block##_final },\ + { OSSL_FUNC_CIPHER_CIPHER, (void (*)(void))ossl_cipher_generic_cipher }, \ { OSSL_FUNC_CIPHER_NEWCTX, \ (void (*)(void))des_##lcmode##_newctx }, \ { OSSL_FUNC_CIPHER_DUPCTX, (void (*)(void))des_dupctx }, \ @@ -171,14 +171,14 @@ const OSSL_DISPATCH ossl_##des_##lcmode##_functions[] = { \ { OSSL_FUNC_CIPHER_GET_PARAMS, \ (void (*)(void))des_##lcmode##_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))des_get_ctx_params }, \ { OSSL_FUNC_CIPHER_GETTABLE_CTX_PARAMS, \ (void (*)(void))des_gettable_ctx_params }, \ { OSSL_FUNC_CIPHER_SET_CTX_PARAMS, \ - (void (*)(void))cipher_generic_set_ctx_params }, \ + (void (*)(void))ossl_cipher_generic_set_ctx_params }, \ { OSSL_FUNC_CIPHER_SETTABLE_CTX_PARAMS, \ - (void (*)(void))cipher_generic_settable_ctx_params }, \ + (void (*)(void))ossl_cipher_generic_settable_ctx_params }, \ { 0, NULL } \ } diff --git a/providers/implementations/ciphers/cipher_idea.c b/providers/implementations/ciphers/cipher_idea.c index 624c8cb8fc..bc716290a4 100644 --- a/providers/implementations/ciphers/cipher_idea.c +++ b/providers/implementations/ciphers/cipher_idea.c @@ -27,7 +27,7 @@ static void idea_freectx(void *vctx) { PROV_IDEA_CTX *ctx = (PROV_IDEA_CTX *)vctx; - cipher_generic_reset_ctx((PROV_CIPHER_CTX *)vctx); + ossl_cipher_generic_reset_ctx((PROV_CIPHER_CTX *)vctx); OPENSSL_clear_free(ctx, sizeof(*ctx)); } diff --git a/providers/implementations/ciphers/cipher_null.c b/providers/implementations/ciphers/cipher_null.c index ce8edcf785..c3ebb25c28 100644 --- a/providers/implementations/ciphers/cipher_null.c +++ b/providers/implementations/ciphers/cipher_null.c @@ -100,7 +100,7 @@ static int null_final(void *vctx, unsigned char *out, size_t *outl, static OSSL_FUNC_cipher_get_params_fn null_get_params; static int null_get_params(OSSL_PARAM params[]) { - return cipher_generic_get_params(params, 0, 0, 0, 8, 0); + return ossl_cipher_generic_get_params(params, 0, 0, 0, 8, 0); } static const OSSL_PARAM null_known_gettable_ctx_params[] = { @@ -182,7 +182,7 @@ const OSSL_DISPATCH ossl_null_functions[] = { { OSSL_FUNC_CIPHER_CIPHER, (void (*)(void))null_cipher }, { OSSL_FUNC_CIPHER_GET_PARAMS, (void (*)(void)) null_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))null_get_ctx_params }, { OSSL_FUNC_CIPHER_GETTABLE_CTX_PARAMS, (void (*)(void))null_gettable_ctx_params }, diff --git a/providers/implementations/ciphers/cipher_rc2.c b/providers/implementations/ciphers/cipher_rc2.c index 2a303ceef4..b7c244f245 100644 --- a/providers/implementations/ciphers/cipher_rc2.c +++ b/providers/implementations/ciphers/cipher_rc2.c @@ -33,7 +33,7 @@ static void rc2_freectx(void *vctx) { PROV_RC2_CTX *ctx = (PROV_RC2_CTX *)vctx; - cipher_generic_reset_ctx((PROV_CIPHER_CTX *)vctx); + ossl_cipher_generic_reset_ctx((PROV_CIPHER_CTX *)vctx); OPENSSL_clear_free(ctx, sizeof(*ctx)); } @@ -88,7 +88,7 @@ static int rc2_get_ctx_params(void *vctx, OSSL_PARAM params[]) PROV_RC2_CTX *ctx = (PROV_RC2_CTX *)vctx; OSSL_PARAM *p; - if (!cipher_generic_get_ctx_params(vctx, params)) + if (!ossl_cipher_generic_get_ctx_params(vctx, params)) return 0; p = OSSL_PARAM_locate(params, OSSL_CIPHER_PARAM_RC2_KEYBITS); if (p != NULL && !OSSL_PARAM_set_size_t(p, ctx->key_bits)) { @@ -142,7 +142,7 @@ static int rc2_set_ctx_params(void *vctx, OSSL_PARAM params[]) PROV_RC2_CTX *ctx = (PROV_RC2_CTX *)vctx; const OSSL_PARAM *p; - if (!cipher_var_keylen_set_ctx_params(vctx, params)) + if (!ossl_cipher_var_keylen_set_ctx_params(vctx, params)) return 0; p = OSSL_PARAM_locate_const(params, OSSL_CIPHER_PARAM_RC2_KEYBITS); if (p != NULL) { @@ -165,7 +165,7 @@ static int rc2_set_ctx_params(void *vctx, OSSL_PARAM params[]) || ((size_t)ASN1_TYPE_get_int_octetstring(type, &num, iv, ctx->base.ivlen) != ctx->base.ivlen) - || !cipher_generic_initiv(&ctx->base, iv, ctx->base.ivlen) + || !ossl_cipher_generic_initiv(&ctx->base, iv, ctx->base.ivlen) || (ctx->key_bits = rc2_magic_to_keybits(num)) == 0) { ERR_raise(ERR_LIB_PROV, PROV_R_FAILED_TO_SET_PARAMETER); ret = 0; @@ -197,18 +197,18 @@ CIPHER_DEFAULT_SETTABLE_CTX_PARAMS_END(rc2) static OSSL_FUNC_cipher_get_params_fn alg##_##kbits##_##lcmode##_get_params; \ static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ { \ - return cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, flags, \ - kbits, blkbits, ivbits); \ + return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ + flags, kbits, blkbits, ivbits); \ } \ static OSSL_FUNC_cipher_newctx_fn alg##_##kbits##_##lcmode##_newctx; \ static void * alg##_##kbits##_##lcmode##_newctx(void *provctx) \ { \ PROV_##UCALG##_CTX *ctx; \ - if (!ossl_prov_is_running()) \ + if (!ossl_prov_is_running()) \ return NULL; \ ctx = OPENSSL_zalloc(sizeof(*ctx)); \ if (ctx != NULL) { \ - cipher_generic_initkey(ctx, kbits, blkbits, ivbits, \ + ossl_cipher_generic_initkey(ctx, kbits, blkbits, ivbits, \ EVP_CIPH_##UCMODE##_MODE, flags, \ ossl_prov_cipher_hw_##alg##_##lcmode(kbits), \ NULL); \ @@ -221,15 +221,15 @@ const OSSL_DISPATCH ossl_##alg##kbits##lcmode##_functions[] = { \ (void (*)(void)) alg##_##kbits##_##lcmode##_newctx }, \ { OSSL_FUNC_CIPHER_FREECTX, (void (*)(void)) alg##_freectx }, \ { OSSL_FUNC_CIPHER_DUPCTX, (void (*)(void)) alg##_dupctx }, \ - { OSSL_FUNC_CIPHER_ENCRYPT_INIT, (void (*)(void))cipher_generic_einit }, \ - { OSSL_FUNC_CIPHER_DECRYPT_INIT, (void (*)(void))cipher_generic_dinit }, \ - { OSSL_FUNC_CIPHER_UPDATE, (void (*)(void))cipher_generic_##typ##_update },\ - { OSSL_FUNC_CIPHER_FINAL, (void (*)(void))cipher_generic_##typ##_final }, \ - { OSSL_FUNC_CIPHER_CIPHER, (void (*)(void))cipher_generic_cipher }, \ + { OSSL_FUNC_CIPHER_ENCRYPT_INIT, (void (*)(void))ossl_cipher_generic_einit }, \ + { OSSL_FUNC_CIPHER_DECRYPT_INIT, (void (*)(void))ossl_cipher_generic_dinit }, \ + { OSSL_FUNC_CIPHER_UPDATE, (void (*)(void))ossl_cipher_generic_##typ##_update },\ + { OSSL_FUNC_CIPHER_FINAL, (void (*)(void))ossl_cipher_generic_##typ##_final }, \ + { OSSL_FUNC_CIPHER_CIPHER, (void (*)(void))ossl_cipher_generic_cipher }, \ { OSSL_FUNC_CIPHER_GET_PARAMS, \ (void (*)(void)) alg##_##kbits##_##lcmode##_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))rc2_get_ctx_params }, \ { OSSL_FUNC_CIPHER_GETTABLE_CTX_PARAMS, \ diff --git a/providers/implementations/ciphers/cipher_rc4.c b/providers/implementations/ciphers/cipher_rc4.c index d92d036ab5..91644fca59 100644 --- a/providers/implementations/ciphers/cipher_rc4.c +++ b/providers/implementations/ciphers/cipher_rc4.c @@ -29,7 +29,7 @@ static void rc4_freectx(void *vctx) { PROV_RC4_CTX *ctx = (PROV_RC4_CTX *)vctx; - cipher_generic_reset_ctx((PROV_CIPHER_CTX *)vctx); + ossl_cipher_generic_reset_ctx((PROV_CIPHER_CTX *)vctx); OPENSSL_clear_free(ctx, sizeof(*ctx)); } @@ -55,19 +55,19 @@ static void *rc4_dupctx(void *ctx) static OSSL_FUNC_cipher_get_params_fn alg##_##kbits##_get_params; \ static int alg##_##kbits##_get_params(OSSL_PARAM params[]) \ { \ - return cipher_generic_get_params(params, 0, flags, \ + return ossl_cipher_generic_get_params(params, 0, flags, \ kbits, blkbits, ivbits); \ } \ static OSSL_FUNC_cipher_newctx_fn alg##_##kbits##_newctx; \ static void * alg##_##kbits##_newctx(void *provctx) \ { \ PROV_##UCALG##_CTX *ctx; \ - if (!ossl_prov_is_running()) \ + if (!ossl_prov_is_running()) \ return NULL; \ ctx = OPENSSL_zalloc(sizeof(*ctx)); \ if (ctx != NULL) { \ - cipher_generic_initkey(ctx, kbits, blkbits, ivbits, 0, flags, \ - ossl_prov_cipher_hw_##alg(kbits), NULL); \ + ossl_cipher_generic_initkey(ctx, kbits, blkbits, ivbits, 0, flags, \ + ossl_prov_cipher_hw_##alg(kbits), NULL); \ } \ return ctx; \ } \ @@ -76,23 +76,23 @@ const OSSL_DISPATCH ossl_##alg##kbits##_functions[] = { \ (void (*)(void)) alg##_##kbits##_newctx }, \ { OSSL_FUNC_CIPHER_FREECTX, (void (*)(void)) alg##_freectx }, \ { OSSL_FUNC_CIPHER_DUPCTX, (void (*)(void)) alg##_dupctx }, \ - { OSSL_FUNC_CIPHER_ENCRYPT_INIT, (void (*)(void))cipher_generic_einit }, \ - { OSSL_FUNC_CIPHER_DECRYPT_INIT, (void (*)(void))cipher_generic_dinit }, \ - { OSSL_FUNC_CIPHER_UPDATE, (void (*)(void))cipher_generic_##typ##_update },\ - { OSSL_FUNC_CIPHER_FINAL, (void (*)(void))cipher_generic_##typ##_final }, \ - { OSSL_FUNC_CIPHER_CIPHER, (void (*)(void))cipher_generic_cipher }, \ + { OSSL_FUNC_CIPHER_ENCRYPT_INIT, (void (*)(void))ossl_cipher_generic_einit }, \ + { OSSL_FUNC_CIPHER_DECRYPT_INIT, (void (*)(void))ossl_cipher_generic_dinit }, \ + { OSSL_FUNC_CIPHER_UPDATE, (void (*)(void))ossl_cipher_generic_##typ##_update },\ + { OSSL_FUNC_CIPHER_FINAL, (void (*)(void))ossl_cipher_generic_##typ##_final }, \ + { OSSL_FUNC_CIPHER_CIPHER, (void (*)(void))ossl_cipher_generic_cipher }, \ { OSSL_FUNC_CIPHER_GET_PARAMS, \ (void (*)(void)) alg##_##kbits##_get_params }, \ { OSSL_FUNC_CIPHER_GET_CTX_PARAMS, \ - (void (*)(void))cipher_generic_get_ctx_params }, \ + (void (*)(void))ossl_cipher_generic_get_ctx_params }, \ { OSSL_FUNC_CIPHER_SET_CTX_PARAMS, \ - (void (*)(void))cipher_var_keylen_set_ctx_params }, \ + (void (*)(void))ossl_cipher_var_keylen_set_ctx_params }, \ { OSSL_FUNC_CIPHER_GETTABLE_PARAMS, \ - (void (*)(void))cipher_generic_gettable_params }, \ + (void (*)(void))ossl_cipher_generic_gettable_params }, \ { OSSL_FUNC_CIPHER_GETTABLE_CTX_PARAMS, \ - (void (*)(void))cipher_generic_gettable_ctx_params }, \ + (void (*)(void))ossl_cipher_generic_gettable_ctx_params }, \ { OSSL_FUNC_CIPHER_SETTABLE_CTX_PARAMS, \ - (void (*)(void))cipher_var_keylen_settable_ctx_params }, \ + (void (*)(void))ossl_cipher_var_keylen_settable_ctx_params }, \ { 0, NULL } \ }; diff --git a/providers/implementations/ciphers/cipher_rc4_hmac_md5.c b/providers/implementations/ciphers/cipher_rc4_hmac_md5.c index 964597beba..69d47b03fe 100644 --- a/providers/implementations/ciphers/cipher_rc4_hmac_md5.c +++ b/providers/implementations/ciphers/cipher_rc4_hmac_md5.c @@ -38,12 +38,12 @@ static OSSL_FUNC_cipher_gettable_ctx_params_fn rc4_hmac_md5_gettable_ctx_params; static OSSL_FUNC_cipher_set_ctx_params_fn rc4_hmac_md5_set_ctx_params; static OSSL_FUNC_cipher_settable_ctx_params_fn rc4_hmac_md5_settable_ctx_params; static OSSL_FUNC_cipher_get_params_fn rc4_hmac_md5_get_params; -#define rc4_hmac_md5_gettable_params cipher_generic_gettable_params -#define rc4_hmac_md5_einit cipher_generic_einit -#define rc4_hmac_md5_dinit cipher_generic_dinit -#define rc4_hmac_md5_update cipher_generic_stream_update -#define rc4_hmac_md5_final cipher_generic_stream_final -#define rc4_hmac_md5_cipher cipher_generic_cipher +#define rc4_hmac_md5_gettable_params ossl_cipher_generic_gettable_params +#define rc4_hmac_md5_einit ossl_cipher_generic_einit +#define rc4_hmac_md5_dinit ossl_cipher_generic_dinit +#define rc4_hmac_md5_update ossl_cipher_generic_stream_update +#define rc4_hmac_md5_final ossl_cipher_generic_stream_final +#define rc4_hmac_md5_cipher ossl_cipher_generic_cipher static void *rc4_hmac_md5_newctx(void *provctx) { @@ -54,12 +54,13 @@ static void *rc4_hmac_md5_newctx(void *provctx) ctx = OPENSSL_zalloc(sizeof(*ctx)); if (ctx != NULL) - cipher_generic_initkey(ctx, RC4_HMAC_MD5_KEY_BITS, - RC4_HMAC_MD5_BLOCK_BITS, - RC4_HMAC_MD5_IV_BITS, - RC4_HMAC_MD5_MODE, RC4_HMAC_MD5_FLAGS, - ossl_prov_cipher_hw_rc4_hmac_md5(RC4_HMAC_MD5_KEY_BITS), - NULL); + ossl_cipher_generic_initkey(ctx, RC4_HMAC_MD5_KEY_BITS, + RC4_HMAC_MD5_BLOCK_BITS, + RC4_HMAC_MD5_IV_BITS, + RC4_HMAC_MD5_MODE, RC4_HMAC_MD5_FLAGS, + ossl_prov_cipher_hw_rc4_hmac_md5( + RC4_HMAC_MD5_KEY_BITS + ), NULL); return ctx; } @@ -67,7 +68,7 @@ static void rc4_hmac_md5_freectx(void *vctx) { PROV_RC4_HMAC_MD5_CTX *ctx = (PROV_RC4_HMAC_MD5_CTX *)vctx; - cipher_generic_reset_ctx((PROV_CIPHER_CTX *)vctx); + ossl_cipher_generic_reset_ctx((PROV_CIPHER_CTX *)vctx); OPENSSL_clear_free(ctx, sizeof(*ctx)); } @@ -173,7 +174,7 @@ static int rc4_hmac_md5_set_ctx_params(void *vctx, const OSSL_PARAM params[]) static int rc4_hmac_md5_get_params(OSSL_PARAM params[]) { - return cipher_generic_get_params(params, RC4_HMAC_MD5_MODE, + return ossl_cipher_generic_get_params(params, RC4_HMAC_MD5_MODE, RC4_HMAC_MD5_FLAGS, RC4_HMAC_MD5_KEY_BITS, RC4_HMAC_MD5_BLOCK_BITS, diff --git a/providers/implementations/ciphers/cipher_rc5.c b/providers/implementations/ciphers/cipher_rc5.c index dba0a3aaae..80de5f4bdd 100644 --- a/providers/implementations/ciphers/cipher_rc5.c +++ b/providers/implementations/ciphers/cipher_rc5.c @@ -29,7 +29,7 @@ static void rc5_freectx(void *vctx) { PROV_RC5_CTX *ctx = (PROV_RC5_CTX *)vctx; - cipher_generic_reset_ctx((PROV_CIPHER_CTX *)vctx); + ossl_cipher_generic_reset_ctx((PROV_CIPHER_CTX *)vctx); OPENSSL_clear_free(ctx, sizeof(*ctx)); } @@ -56,7 +56,7 @@ static int rc5_set_ctx_params(void *vctx, const OSSL_PARAM params[]) PROV_RC5_CTX *ctx = (PROV_RC5_CTX *)vctx; const OSSL_PARAM *p; - if (!cipher_var_keylen_set_ctx_params(vctx, params)) + if (!ossl_cipher_var_keylen_set_ctx_params(vctx, params)) return 0; p = OSSL_PARAM_locate_const(params, OSSL_CIPHER_PARAM_ROUNDS); @@ -93,7 +93,7 @@ static int rc5_get_ctx_params(void *vctx, OSSL_PARAM params[]) PROV_RC5_CTX *ctx = (PROV_RC5_CTX *)vctx; OSSL_PARAM *p; - if (!cipher_generic_get_ctx_params(vctx, params)) + if (!ossl_cipher_generic_get_ctx_params(vctx, params)) return 0; p = OSSL_PARAM_locate(params, OSSL_CIPHER_PARAM_ROUNDS); if (p != NULL && !OSSL_PARAM_set_uint(p, ctx->rounds)) { @@ -108,20 +108,20 @@ static int rc5_get_ctx_params(void *vctx, OSSL_PARAM params[]) static OSSL_FUNC_cipher_get_params_fn alg##_##kbits##_##lcmode##_get_params; \ static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ { \ - return cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, flags, \ - kbits, blkbits, ivbits); \ + return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ + flags, kbits, blkbits, ivbits); \ } \ static OSSL_FUNC_cipher_newctx_fn alg##_##kbits##_##lcmode##_newctx; \ static void * alg##_##kbits##_##lcmode##_newctx(void *provctx) \ { \ PROV_##UCALG##_CTX *ctx; \ - if (!ossl_prov_is_running()) \ + if (!ossl_prov_is_running()) \ return NULL; \ ctx = OPENSSL_zalloc(sizeof(*ctx)); \ if (ctx != NULL) { \ - cipher_generic_initkey(ctx, kbits, blkbits, ivbits, \ - EVP_CIPH_##UCMODE##_MODE, flags, \ - ossl_prov_cipher_hw_##alg##_##lcmode(kbits), \ + ossl_cipher_generic_initkey(ctx, kbits, blkbits, ivbits, \ + EVP_CIPH_##UCMODE##_MODE, flags, \ + ossl_prov_cipher_hw_##alg##_##lcmode(kbits),\ NULL); \ ctx->rounds = RC5_12_ROUNDS; \ } \ @@ -132,15 +132,15 @@ const OSSL_DISPATCH ossl_##alg##kbits##lcmode##_functions[] = { \ (void (*)(void)) alg##_##kbits##_##lcmode##_newctx }, \ { OSSL_FUNC_CIPHER_FREECTX, (void (*)(void)) alg##_freectx }, \ { OSSL_FUNC_CIPHER_DUPCTX, (void (*)(void)) alg##_dupctx }, \ - { OSSL_FUNC_CIPHER_ENCRYPT_INIT, (void (*)(void))cipher_generic_einit }, \ - { OSSL_FUNC_CIPHER_DECRYPT_INIT, (void (*)(void))cipher_generic_dinit }, \ - { OSSL_FUNC_CIPHER_UPDATE, (void (*)(void))cipher_generic_##typ##_update },\ - { OSSL_FUNC_CIPHER_FINAL, (void (*)(void))cipher_generic_##typ##_final }, \ - { OSSL_FUNC_CIPHER_CIPHER, (void (*)(void))cipher_generic_cipher }, \ + { OSSL_FUNC_CIPHER_ENCRYPT_INIT, (void (*)(void))ossl_cipher_generic_einit },\ + { OSSL_FUNC_CIPHER_DECRYPT_INIT, (void (*)(void))ossl_cipher_generic_dinit },\ + { OSSL_FUNC_CIPHER_UPDATE, (void (*)(void))ossl_cipher_generic_##typ##_update },\ + { OSSL_FUNC_CIPHER_FINAL, (void (*)(void))ossl_cipher_generic_##typ##_final }, \ + { OSSL_FUNC_CIPHER_CIPHER, (void (*)(void))ossl_cipher_generic_cipher }, \ { OSSL_FUNC_CIPHER_GET_PARAMS, \ (void (*)(void)) alg##_##kbits##_##lcmode##_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))rc5_get_ctx_params }, \ { OSSL_FUNC_CIPHER_GETTABLE_CTX_PARAMS, \ diff --git a/providers/implementations/ciphers/cipher_seed.c b/providers/implementations/ciphers/cipher_seed.c index c91e776f31..bae6a8e530 100644 --- a/providers/implementations/ciphers/cipher_seed.c +++ b/providers/implementations/ciphers/cipher_seed.c @@ -26,7 +26,7 @@ static void seed_freectx(void *vctx) { PROV_SEED_CTX *ctx = (PROV_SEED_CTX *)vctx; - cipher_generic_reset_ctx((PROV_CIPHER_CTX *)vctx); + ossl_cipher_generic_reset_ctx((PROV_CIPHER_CTX *)vctx); OPENSSL_clear_free(ctx, sizeof(*ctx)); } diff --git a/providers/implementations/ciphers/cipher_sm4.c b/providers/implementations/ciphers/cipher_sm4.c index 011d36ab71..6cf2731c6d 100644 --- a/providers/implementations/ciphers/cipher_sm4.c +++ b/providers/implementations/ciphers/cipher_sm4.c @@ -20,7 +20,7 @@ static void sm4_freectx(void *vctx) { PROV_SM4_CTX *ctx = (PROV_SM4_CTX *)vctx; - cipher_generic_reset_ctx((PROV_CIPHER_CTX *)vctx); + ossl_cipher_generic_reset_ctx((PROV_CIPHER_CTX *)vctx); OPENSSL_clear_free(ctx, sizeof(*ctx)); } diff --git a/providers/implementations/ciphers/cipher_sm4_hw.c b/providers/implementations/ciphers/cipher_sm4_hw.c index bc13517186..49cde3421d 100644 --- a/providers/implementations/ciphers/cipher_sm4_hw.c +++ b/providers/implementations/ciphers/cipher_sm4_hw.c @@ -31,7 +31,7 @@ IMPLEMENT_CIPHER_HW_COPYCTX(cipher_hw_sm4_copyctx, PROV_SM4_CTX) # define PROV_CIPHER_HW_sm4_mode(mode) \ static const PROV_CIPHER_HW sm4_##mode = { \ cipher_hw_sm4_initkey, \ - cipher_hw_chunked_##mode, \ + ossl_cipher_hw_chunked_##mode, \ cipher_hw_sm4_copyctx \ }; \ const PROV_CIPHER_HW *ossl_prov_cipher_hw_sm4_##mode(size_t keybits) \ diff --git a/providers/implementations/ciphers/cipher_tdes.h b/providers/implementations/ciphers/cipher_tdes.h index d3500e71ce..081a00fffa 100644 --- a/providers/implementations/ciphers/cipher_tdes.h +++ b/providers/implementations/ciphers/cipher_tdes.h @@ -30,28 +30,28 @@ typedef struct prov_tdes_ctx_st { } PROV_TDES_CTX; -#define IMPLEMENT_tdes_cipher(type, UCTYPE, lcmode, UCMODE, flags, \ +#define IMPLEMENT_tdes_cipher(type, UCTYPE, lcmode, UCMODE, flags, \ kbits, blkbits, ivbits, block) \ -static OSSL_FUNC_cipher_newctx_fn tdes_##type##_##lcmode##_newctx; \ +static OSSL_FUNC_cipher_newctx_fn tdes_##type##_##lcmode##_newctx; \ static void *tdes_##type##_##lcmode##_newctx(void *provctx) \ { \ return tdes_newctx(provctx, EVP_CIPH_##UCMODE##_MODE, kbits, blkbits, \ ivbits, flags, \ ossl_prov_cipher_hw_tdes_##type##_##lcmode()); \ } \ -static OSSL_FUNC_cipher_get_params_fn tdes_##type##_##lcmode##_get_params; \ +static OSSL_FUNC_cipher_get_params_fn tdes_##type##_##lcmode##_get_params; \ static int tdes_##type##_##lcmode##_get_params(OSSL_PARAM params[]) \ { \ - return cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, flags, \ - kbits, blkbits, ivbits); \ + return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ + flags, kbits, blkbits, ivbits); \ } \ const OSSL_DISPATCH ossl_tdes_##type##_##lcmode##_functions[] = { \ { OSSL_FUNC_CIPHER_ENCRYPT_INIT, (void (*)(void))tdes_einit }, \ { OSSL_FUNC_CIPHER_DECRYPT_INIT, (void (*)(void))tdes_dinit }, \ { OSSL_FUNC_CIPHER_UPDATE, \ - (void (*)(void))cipher_generic_##block##_update }, \ - { OSSL_FUNC_CIPHER_FINAL, (void (*)(void))cipher_generic_##block##_final },\ - { OSSL_FUNC_CIPHER_CIPHER, (void (*)(void))cipher_generic_cipher }, \ + (void (*)(void))ossl_cipher_generic_##block##_update }, \ + { OSSL_FUNC_CIPHER_FINAL, (void (*)(void))ossl_cipher_generic_##block##_final },\ + { OSSL_FUNC_CIPHER_CIPHER, (void (*)(void))ossl_cipher_generic_cipher }, \ { OSSL_FUNC_CIPHER_NEWCTX, \ (void (*)(void))tdes_##type##_##lcmode##_newctx }, \ { OSSL_FUNC_CIPHER_DUPCTX, (void (*)(void))tdes_dupctx }, \ @@ -59,14 +59,14 @@ const OSSL_DISPATCH ossl_tdes_##type##_##lcmode##_functions[] = { \ { OSSL_FUNC_CIPHER_GET_PARAMS, \ (void (*)(void))tdes_##type##_##lcmode##_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))tdes_get_ctx_params }, \ { OSSL_FUNC_CIPHER_GETTABLE_CTX_PARAMS, \ (void (*)(void))tdes_gettable_ctx_params }, \ { OSSL_FUNC_CIPHER_SET_CTX_PARAMS, \ - (void (*)(void))cipher_generic_set_ctx_params }, \ + (void (*)(void))ossl_cipher_generic_set_ctx_params }, \ { OSSL_FUNC_CIPHER_SETTABLE_CTX_PARAMS, \ - (void (*)(void))cipher_generic_settable_ctx_params }, \ + (void (*)(void))ossl_cipher_generic_settable_ctx_params }, \ { 0, NULL } \ } @@ -79,24 +79,25 @@ OSSL_FUNC_cipher_decrypt_init_fn tdes_dinit; OSSL_FUNC_cipher_get_ctx_params_fn tdes_get_ctx_params; OSSL_FUNC_cipher_gettable_ctx_params_fn tdes_gettable_ctx_params; -#define PROV_CIPHER_HW_tdes_mode(type, mode) \ +#define PROV_CIPHER_HW_tdes_mode(type, mode) \ static const PROV_CIPHER_HW type##_##mode = { \ - cipher_hw_tdes_##type##_initkey, \ - cipher_hw_tdes_##mode, \ - cipher_hw_tdes_copyctx \ + ossl_cipher_hw_tdes_##type##_initkey, \ + ossl_cipher_hw_tdes_##mode, \ + ossl_cipher_hw_tdes_copyctx \ }; \ const PROV_CIPHER_HW *ossl_prov_cipher_hw_tdes_##type##_##mode(void) \ { \ return &type##_##mode; \ } -int cipher_hw_tdes_ede3_initkey(PROV_CIPHER_CTX *ctx, const unsigned char *key, - size_t keylen); -void cipher_hw_tdes_copyctx(PROV_CIPHER_CTX *dst, const PROV_CIPHER_CTX *src); -int cipher_hw_tdes_cbc(PROV_CIPHER_CTX *ctx, unsigned char *out, - const unsigned char *in, size_t inl); -int cipher_hw_tdes_ecb(PROV_CIPHER_CTX *ctx, unsigned char *out, - const unsigned char *in, size_t len); +int ossl_cipher_hw_tdes_ede3_initkey(PROV_CIPHER_CTX *ctx, + const unsigned char *key, size_t keylen); +void ossl_cipher_hw_tdes_copyctx(PROV_CIPHER_CTX *dst, + const PROV_CIPHER_CTX *src); +int ossl_cipher_hw_tdes_cbc(PROV_CIPHER_CTX *ctx, unsigned char *out, + const unsigned char *in, size_t inl); +int ossl_cipher_hw_tdes_ecb(PROV_CIPHER_CTX *ctx, unsigned char *out, + const unsigned char *in, size_t len); const PROV_CIPHER_HW *ossl_prov_cipher_hw_tdes_ede3_cbc(void); const PROV_CIPHER_HW *ossl_prov_cipher_hw_tdes_ede3_ecb(void); diff --git a/providers/implementations/ciphers/cipher_tdes_common.c b/providers/implementations/ciphers/cipher_tdes_common.c index 1340c6034b..17b8ce40b0 100644 --- a/providers/implementations/ciphers/cipher_tdes_common.c +++ b/providers/implementations/ciphers/cipher_tdes_common.c @@ -30,8 +30,8 @@ void *tdes_newctx(void *provctx, int mode, size_t kbits, size_t blkbits, tctx = OPENSSL_zalloc(sizeof(*tctx)); if (tctx != NULL) - cipher_generic_initkey(tctx, kbits, blkbits, ivbits, mode, flags, hw, - provctx); + ossl_cipher_generic_initkey(tctx, kbits, blkbits, ivbits, mode, flags, + hw, provctx); return tctx; } @@ -57,7 +57,7 @@ void tdes_freectx(void *vctx) { PROV_TDES_CTX *ctx = (PROV_TDES_CTX *)vctx; - cipher_generic_reset_ctx((PROV_CIPHER_CTX *)vctx); + ossl_cipher_generic_reset_ctx((PROV_CIPHER_CTX *)vctx); OPENSSL_clear_free(ctx, sizeof(*ctx)); } @@ -74,7 +74,7 @@ static int tdes_init(void *vctx, const unsigned char *key, size_t keylen, ctx->enc = enc; if (iv != NULL) { - if (!cipher_generic_initiv(ctx, iv, ivlen)) + if (!ossl_cipher_generic_initiv(ctx, iv, ivlen)) return 0; } @@ -127,7 +127,7 @@ int tdes_get_ctx_params(void *vctx, OSSL_PARAM params[]) PROV_CIPHER_CTX *ctx = (PROV_CIPHER_CTX *)vctx; OSSL_PARAM *p; - if (!cipher_generic_get_ctx_params(vctx, params)) + if (!ossl_cipher_generic_get_ctx_params(vctx, params)) return 0; p = OSSL_PARAM_locate(params, OSSL_CIPHER_PARAM_RANDOM_KEY); diff --git a/providers/implementations/ciphers/cipher_tdes_default_hw.c b/providers/implementations/ciphers/cipher_tdes_default_hw.c index 4bb99bd327..b7c7ea11f7 100644 --- a/providers/implementations/ciphers/cipher_tdes_default_hw.c +++ b/providers/implementations/ciphers/cipher_tdes_default_hw.c @@ -19,8 +19,9 @@ #define ks2 tks.ks[1] #define ks3 tks.ks[2] -static int cipher_hw_tdes_ede2_initkey(PROV_CIPHER_CTX *ctx, - const unsigned char *key, size_t keylen) +static int ossl_cipher_hw_tdes_ede2_initkey(PROV_CIPHER_CTX *ctx, + const unsigned char *key, + size_t keylen) { PROV_TDES_CTX *tctx = (PROV_TDES_CTX *)ctx; DES_cblock *deskey = (DES_cblock *)key; @@ -44,8 +45,8 @@ static int cipher_hw_tdes_ede2_initkey(PROV_CIPHER_CTX *ctx, return 1; } -static int cipher_hw_tdes_ofb(PROV_CIPHER_CTX *ctx, unsigned char *out, - const unsigned char *in, size_t inl) +static int ossl_cipher_hw_tdes_ofb(PROV_CIPHER_CTX *ctx, unsigned char *out, + const unsigned char *in, size_t inl) { PROV_TDES_CTX *tctx = (PROV_TDES_CTX *)ctx; int num = ctx->num; @@ -65,8 +66,8 @@ static int cipher_hw_tdes_ofb(PROV_CIPHER_CTX *ctx, unsigned char *out, return 1; } -static int cipher_hw_tdes_cfb(PROV_CIPHER_CTX *ctx, unsigned char *out, - const unsigned char *in, size_t inl) +static int ossl_cipher_hw_tdes_cfb(PROV_CIPHER_CTX *ctx, unsigned char *out, + const unsigned char *in, size_t inl) { PROV_TDES_CTX *tctx = (PROV_TDES_CTX *)ctx; int num = ctx->num; @@ -93,8 +94,8 @@ static int cipher_hw_tdes_cfb(PROV_CIPHER_CTX *ctx, unsigned char *out, * Although we have a CFB-r implementation for 3-DES, it doesn't pack the * right way, so wrap it here */ -static int cipher_hw_tdes_cfb1(PROV_CIPHER_CTX *ctx, unsigned char *out, - const unsigned char *in, size_t inl) +static int ossl_cipher_hw_tdes_cfb1(PROV_CIPHER_CTX *ctx, unsigned char *out, + const unsigned char *in, size_t inl) { PROV_TDES_CTX *tctx = (PROV_TDES_CTX *)ctx; size_t n; @@ -114,8 +115,8 @@ static int cipher_hw_tdes_cfb1(PROV_CIPHER_CTX *ctx, unsigned char *out, return 1; } -static int cipher_hw_tdes_cfb8(PROV_CIPHER_CTX *ctx, unsigned char *out, - const unsigned char *in, size_t inl) +static int ossl_cipher_hw_tdes_cfb8(PROV_CIPHER_CTX *ctx, unsigned char *out, + const unsigned char *in, size_t inl) { PROV_TDES_CTX *tctx = (PROV_TDES_CTX *)ctx; diff --git a/providers/implementations/ciphers/cipher_tdes_hw.c b/providers/implementations/ciphers/cipher_tdes_hw.c index 82f232a602..4382969f44 100644 --- a/providers/implementations/ciphers/cipher_tdes_hw.c +++ b/providers/implementations/ciphers/cipher_tdes_hw.c @@ -20,8 +20,8 @@ #define ks2 tks.ks[1] #define ks3 tks.ks[2] -int cipher_hw_tdes_ede3_initkey(PROV_CIPHER_CTX *ctx, const unsigned char *key, - size_t keylen) +int ossl_cipher_hw_tdes_ede3_initkey(PROV_CIPHER_CTX *ctx, + const unsigned char *key, size_t keylen) { PROV_TDES_CTX *tctx = (PROV_TDES_CTX *)ctx; DES_cblock *deskey = (DES_cblock *)key; @@ -45,7 +45,8 @@ int cipher_hw_tdes_ede3_initkey(PROV_CIPHER_CTX *ctx, const unsigned char *key, return 1; } -void cipher_hw_tdes_copyctx(PROV_CIPHER_CTX *dst, const PROV_CIPHER_CTX *src) +void ossl_cipher_hw_tdes_copyctx(PROV_CIPHER_CTX *dst, + const PROV_CIPHER_CTX *src) { PROV_TDES_CTX *sctx = (PROV_TDES_CTX *)src; PROV_TDES_CTX *dctx = (PROV_TDES_CTX *)dst; @@ -54,8 +55,8 @@ void cipher_hw_tdes_copyctx(PROV_CIPHER_CTX *dst, const PROV_CIPHER_CTX *src) dst->ks = &dctx->tks.ks; } -int cipher_hw_tdes_cbc(PROV_CIPHER_CTX *ctx, unsigned char *out, - const unsigned char *in, size_t inl) +int ossl_cipher_hw_tdes_cbc(PROV_CIPHER_CTX *ctx, unsigned char *out, + const unsigned char *in, size_t inl) { PROV_TDES_CTX *tctx = (PROV_TDES_CTX *)ctx; @@ -77,8 +78,8 @@ int cipher_hw_tdes_cbc(PROV_CIPHER_CTX *ctx, unsigned char *out, return 1; } -int cipher_hw_tdes_ecb(PROV_CIPHER_CTX *ctx, unsigned char *out, - const unsigned char *in, size_t len) +int ossl_cipher_hw_tdes_ecb(PROV_CIPHER_CTX *ctx, unsigned char *out, + const unsigned char *in, size_t len) { size_t i; PROV_TDES_CTX *tctx = (PROV_TDES_CTX *)ctx; diff --git a/providers/implementations/ciphers/cipher_tdes_wrap.c b/providers/implementations/ciphers/cipher_tdes_wrap.c index 2c8450586a..6d908a3ed5 100644 --- a/providers/implementations/ciphers/cipher_tdes_wrap.c +++ b/providers/implementations/ciphers/cipher_tdes_wrap.c @@ -180,8 +180,8 @@ static void *tdes_wrap_newctx(void *provctx) \ static OSSL_FUNC_cipher_get_params_fn tdes_wrap_get_params; \ static int tdes_wrap_get_params(OSSL_PARAM params[]) \ { \ - return cipher_generic_get_params(params, EVP_CIPH_WRAP_MODE, flags, \ - kbits, blkbits, ivbits); \ + return ossl_cipher_generic_get_params(params, EVP_CIPH_WRAP_MODE, flags, \ + kbits, blkbits, ivbits); \ } \ const OSSL_DISPATCH ossl_tdes_wrap_cbc_functions[] = \ { \ @@ -191,17 +191,17 @@ const OSSL_DISPATCH ossl_tdes_wrap_cbc_functions[] = \ { OSSL_FUNC_CIPHER_NEWCTX, (void (*)(void))tdes_wrap_newctx }, \ { OSSL_FUNC_CIPHER_FREECTX, (void (*)(void))tdes_freectx }, \ { OSSL_FUNC_CIPHER_UPDATE, (void (*)(void))tdes_wrap_update }, \ - { OSSL_FUNC_CIPHER_FINAL, (void (*)(void))cipher_generic_stream_final }, \ + { OSSL_FUNC_CIPHER_FINAL, (void (*)(void))ossl_cipher_generic_stream_final },\ { OSSL_FUNC_CIPHER_GET_PARAMS, (void (*)(void))tdes_wrap_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))tdes_get_ctx_params }, \ { OSSL_FUNC_CIPHER_GETTABLE_CTX_PARAMS, \ (void (*)(void))tdes_gettable_ctx_params }, \ { OSSL_FUNC_CIPHER_SET_CTX_PARAMS, \ - (void (*)(void))cipher_generic_set_ctx_params }, \ + (void (*)(void))ossl_cipher_generic_set_ctx_params }, \ { OSSL_FUNC_CIPHER_SETTABLE_CTX_PARAMS, \ - (void (*)(void))cipher_generic_settable_ctx_params }, \ + (void (*)(void))ossl_cipher_generic_settable_ctx_params }, \ { 0, NULL } \ } diff --git a/providers/implementations/ciphers/cipher_tdes_wrap_hw.c b/providers/implementations/ciphers/cipher_tdes_wrap_hw.c index 477089ff86..3c8c833320 100644 --- a/providers/implementations/ciphers/cipher_tdes_wrap_hw.c +++ b/providers/implementations/ciphers/cipher_tdes_wrap_hw.c @@ -15,6 +15,6 @@ #include "cipher_tdes_default.h" -#define cipher_hw_tdes_wrap_initkey cipher_hw_tdes_ede3_initkey +#define ossl_cipher_hw_tdes_wrap_initkey ossl_cipher_hw_tdes_ede3_initkey PROV_CIPHER_HW_tdes_mode(wrap, cbc) diff --git a/providers/implementations/ciphers/ciphercommon.c b/providers/implementations/ciphers/ciphercommon.c index 08693080bd..f191074605 100644 --- a/providers/implementations/ciphers/ciphercommon.c +++ b/providers/implementations/ciphers/ciphercommon.c @@ -30,14 +30,14 @@ 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 *provctx) +const OSSL_PARAM *ossl_cipher_generic_gettable_params(void *provctx) { return cipher_known_gettable_params; } -int cipher_generic_get_params(OSSL_PARAM params[], unsigned int md, - unsigned long flags, - size_t kbits, size_t blkbits, size_t ivbits) +int ossl_cipher_generic_get_params(OSSL_PARAM params[], unsigned int md, + unsigned long flags, + size_t kbits, size_t blkbits, size_t ivbits) { OSSL_PARAM *p; @@ -69,24 +69,24 @@ int cipher_generic_get_params(OSSL_PARAM params[], unsigned int md, return 1; } -CIPHER_DEFAULT_GETTABLE_CTX_PARAMS_START(cipher_generic) -CIPHER_DEFAULT_GETTABLE_CTX_PARAMS_END(cipher_generic) +CIPHER_DEFAULT_GETTABLE_CTX_PARAMS_START(ossl_cipher_generic) +CIPHER_DEFAULT_GETTABLE_CTX_PARAMS_END(ossl_cipher_generic) -CIPHER_DEFAULT_SETTABLE_CTX_PARAMS_START(cipher_generic) +CIPHER_DEFAULT_SETTABLE_CTX_PARAMS_START(ossl_cipher_generic) OSSL_PARAM_uint(OSSL_CIPHER_PARAM_TLS_VERSION, NULL), OSSL_PARAM_size_t(OSSL_CIPHER_PARAM_TLS_MAC_SIZE, NULL), -CIPHER_DEFAULT_SETTABLE_CTX_PARAMS_END(cipher_generic) +CIPHER_DEFAULT_SETTABLE_CTX_PARAMS_END(ossl_cipher_generic) /* * Variable key length cipher functions for OSSL_PARAM settables */ -int cipher_var_keylen_set_ctx_params(void *vctx, const OSSL_PARAM params[]) +int ossl_cipher_var_keylen_set_ctx_params(void *vctx, const OSSL_PARAM params[]) { PROV_CIPHER_CTX *ctx = (PROV_CIPHER_CTX *)vctx; const OSSL_PARAM *p; - if (!cipher_generic_set_ctx_params(vctx, params)) + if (!ossl_cipher_generic_set_ctx_params(vctx, params)) return 0; p = OSSL_PARAM_locate_const(params, OSSL_CIPHER_PARAM_KEYLEN); if (p != NULL) { @@ -101,9 +101,9 @@ int cipher_var_keylen_set_ctx_params(void *vctx, const OSSL_PARAM params[]) return 1; } -CIPHER_DEFAULT_SETTABLE_CTX_PARAMS_START(cipher_var_keylen) +CIPHER_DEFAULT_SETTABLE_CTX_PARAMS_START(ossl_cipher_var_keylen) OSSL_PARAM_size_t(OSSL_CIPHER_PARAM_KEYLEN, NULL), -CIPHER_DEFAULT_SETTABLE_CTX_PARAMS_END(cipher_var_keylen) +CIPHER_DEFAULT_SETTABLE_CTX_PARAMS_END(ossl_cipher_var_keylen) /*- * AEAD cipher functions for OSSL_PARAM gettables and settables @@ -119,7 +119,9 @@ 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(ossl_unused void *provctx) +const OSSL_PARAM *ossl_cipher_aead_gettable_ctx_params( + ossl_unused void *provctx + ) { return cipher_aead_known_gettable_ctx_params; } @@ -132,12 +134,14 @@ 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(ossl_unused void *provctx) +const OSSL_PARAM *ossl_cipher_aead_settable_ctx_params( + ossl_unused void *provctx + ) { return cipher_aead_known_settable_ctx_params; } -void cipher_generic_reset_ctx(PROV_CIPHER_CTX *ctx) +void ossl_cipher_generic_reset_ctx(PROV_CIPHER_CTX *ctx) { if (ctx != NULL && ctx->alloced) { OPENSSL_free(ctx->tlsmac); @@ -160,7 +164,7 @@ static int cipher_generic_init_internal(PROV_CIPHER_CTX *ctx, return 0; if (iv != NULL && ctx->mode != EVP_CIPH_ECB_MODE) { - if (!cipher_generic_initiv(ctx, iv, ivlen)) + if (!ossl_cipher_generic_initiv(ctx, iv, ivlen)) return 0; } if (key != NULL) { @@ -177,15 +181,17 @@ static int cipher_generic_init_internal(PROV_CIPHER_CTX *ctx, return 1; } -int cipher_generic_einit(void *vctx, const unsigned char *key, size_t keylen, - const unsigned char *iv, size_t ivlen) +int ossl_cipher_generic_einit(void *vctx, const unsigned char *key, + size_t keylen, const unsigned char *iv, + size_t ivlen) { return cipher_generic_init_internal((PROV_CIPHER_CTX *)vctx, key, keylen, iv, ivlen, 1); } -int cipher_generic_dinit(void *vctx, const unsigned char *key, size_t keylen, - const unsigned char *iv, size_t ivlen) +int ossl_cipher_generic_dinit(void *vctx, const unsigned char *key, + size_t keylen, const unsigned char *iv, + size_t ivlen) { return cipher_generic_init_internal((PROV_CIPHER_CTX *)vctx, key, keylen, iv, ivlen, 0); @@ -194,9 +200,9 @@ int cipher_generic_dinit(void *vctx, const unsigned char *key, size_t keylen, /* Max padding including padding length byte */ #define MAX_PADDING 256 -int cipher_generic_block_update(void *vctx, unsigned char *out, size_t *outl, - size_t outsize, const unsigned char *in, - size_t inl) +int ossl_cipher_generic_block_update(void *vctx, unsigned char *out, + size_t *outl, size_t outsize, + const unsigned char *in, size_t inl) { size_t outlint = 0; PROV_CIPHER_CTX *ctx = (PROV_CIPHER_CTX *)vctx; @@ -332,8 +338,8 @@ int cipher_generic_block_update(void *vctx, unsigned char *out, size_t *outl, return inl == 0; } -int cipher_generic_block_final(void *vctx, unsigned char *out, size_t *outl, - size_t outsize) +int ossl_cipher_generic_block_final(void *vctx, unsigned char *out, + size_t *outl, size_t outsize) { PROV_CIPHER_CTX *ctx = (PROV_CIPHER_CTX *)vctx; size_t blksz = ctx->blocksize; @@ -401,9 +407,9 @@ int cipher_generic_block_final(void *vctx, unsigned char *out, size_t *outl, return 1; } -int cipher_generic_stream_update(void *vctx, unsigned char *out, size_t *outl, - size_t outsize, const unsigned char *in, - size_t inl) +int ossl_cipher_generic_stream_update(void *vctx, unsigned char *out, + size_t *outl, size_t outsize, + const unsigned char *in, size_t inl) { PROV_CIPHER_CTX *ctx = (PROV_CIPHER_CTX *)vctx; @@ -437,8 +443,8 @@ int cipher_generic_stream_update(void *vctx, unsigned char *out, size_t *outl, return 1; } -int cipher_generic_stream_final(void *vctx, unsigned char *out, size_t *outl, - size_t outsize) +int ossl_cipher_generic_stream_final(void *vctx, unsigned char *out, + size_t *outl, size_t outsize) { if (!ossl_prov_is_running()) return 0; @@ -447,9 +453,9 @@ int cipher_generic_stream_final(void *vctx, unsigned char *out, size_t *outl, return 1; } -int cipher_generic_cipher(void *vctx, - unsigned char *out, size_t *outl, size_t outsize, - const unsigned char *in, size_t inl) +int ossl_cipher_generic_cipher(void *vctx, unsigned char *out, size_t *outl, + size_t outsize, const unsigned char *in, + size_t inl) { PROV_CIPHER_CTX *ctx = (PROV_CIPHER_CTX *)vctx; @@ -470,7 +476,7 @@ int cipher_generic_cipher(void *vctx, return 1; } -int cipher_generic_get_ctx_params(void *vctx, OSSL_PARAM params[]) +int ossl_cipher_generic_get_ctx_params(void *vctx, OSSL_PARAM params[]) { PROV_CIPHER_CTX *ctx = (PROV_CIPHER_CTX *)vctx; OSSL_PARAM *p; @@ -518,7 +524,7 @@ int cipher_generic_get_ctx_params(void *vctx, OSSL_PARAM params[]) return 1; } -int cipher_generic_set_ctx_params(void *vctx, const OSSL_PARAM params[]) +int ossl_cipher_generic_set_ctx_params(void *vctx, const OSSL_PARAM params[]) { PROV_CIPHER_CTX *ctx = (PROV_CIPHER_CTX *)vctx; const OSSL_PARAM *p; @@ -560,8 +566,8 @@ int cipher_generic_set_ctx_params(void *vctx, const OSSL_PARAM params[]) return 1; } -int cipher_generic_initiv(PROV_CIPHER_CTX *ctx, const unsigned char *iv, - size_t ivlen) +int ossl_cipher_generic_initiv(PROV_CIPHER_CTX *ctx, const unsigned char *iv, + size_t ivlen) { if (ivlen != ctx->ivlen || ivlen > sizeof(ctx->iv)) { @@ -574,9 +580,10 @@ int cipher_generic_initiv(PROV_CIPHER_CTX *ctx, const unsigned char *iv, return 1; } -void cipher_generic_initkey(void *vctx, size_t kbits, size_t blkbits, - size_t ivbits, unsigned int mode, uint64_t flags, - const PROV_CIPHER_HW *hw, void *provctx) +void ossl_cipher_generic_initkey(void *vctx, size_t kbits, size_t blkbits, + size_t ivbits, unsigned int mode, + uint64_t flags, const PROV_CIPHER_HW *hw, + void *provctx) { PROV_CIPHER_CTX *ctx = (PROV_CIPHER_CTX *)vctx; diff --git a/providers/implementations/ciphers/ciphercommon_hw.c b/providers/implementations/ciphers/ciphercommon_hw.c index 31062f1bc6..d52c570d7f 100644 --- a/providers/implementations/ciphers/ciphercommon_hw.c +++ b/providers/implementations/ciphers/ciphercommon_hw.c @@ -13,7 +13,7 @@ * The generic cipher functions for cipher modes cbc, ecb, ofb, cfb and ctr. * Used if there is no special hardware implementations. */ -int cipher_hw_generic_cbc(PROV_CIPHER_CTX *dat, unsigned char *out, +int ossl_cipher_hw_generic_cbc(PROV_CIPHER_CTX *dat, unsigned char *out, const unsigned char *in, size_t len) { if (dat->stream.cbc) @@ -26,7 +26,7 @@ int cipher_hw_generic_cbc(PROV_CIPHER_CTX *dat, unsigned char *out, return 1; } -int cipher_hw_generic_ecb(PROV_CIPHER_CTX *dat, unsigned char *out, +int ossl_cipher_hw_generic_ecb(PROV_CIPHER_CTX *dat, unsigned char *out, const unsigned char *in, size_t len) { size_t i, bl = dat->blocksize; @@ -45,7 +45,7 @@ int cipher_hw_generic_ecb(PROV_CIPHER_CTX *dat, unsigned char *out, return 1; } -int cipher_hw_generic_ofb128(PROV_CIPHER_CTX *dat, unsigned char *out, +int ossl_cipher_hw_generic_ofb128(PROV_CIPHER_CTX *dat, unsigned char *out, const unsigned char *in, size_t len) { int num = dat->num; @@ -56,8 +56,8 @@ int cipher_hw_generic_ofb128(PROV_CIPHER_CTX *dat, unsigned char *out, return 1; } -int cipher_hw_generic_cfb128(PROV_CIPHER_CTX *dat, unsigned char *out, - const unsigned char *in, size_t len) +int ossl_cipher_hw_generic_cfb128(PROV_CIPHER_CTX *dat, unsigned char *out, + const unsigned char *in, size_t len) { int num = dat->num; @@ -68,7 +68,7 @@ int cipher_hw_generic_cfb128(PROV_CIPHER_CTX *dat, unsigned char *out, return 1; } -int cipher_hw_generic_cfb8(PROV_CIPHER_CTX *dat, unsigned char *out, +int ossl_cipher_hw_generic_cfb8(PROV_CIPHER_CTX *dat, unsigned char *out, const unsigned char *in, size_t len) { int num = dat->num; @@ -80,7 +80,7 @@ int cipher_hw_generic_cfb8(PROV_CIPHER_CTX *dat, unsigned char *out, return 1; } -int cipher_hw_generic_cfb1(PROV_CIPHER_CTX *dat, unsigned char *out, +int ossl_cipher_hw_generic_cfb1(PROV_CIPHER_CTX *dat, unsigned char *out, const unsigned char *in, size_t len) { int num = dat->num; @@ -108,7 +108,7 @@ int cipher_hw_generic_cfb1(PROV_CIPHER_CTX *dat, unsigned char *out, return 1; } -int cipher_hw_generic_ctr(PROV_CIPHER_CTX *dat, unsigned char *out, +int ossl_cipher_hw_generic_ctr(PROV_CIPHER_CTX *dat, unsigned char *out, const unsigned char *in, size_t len) { unsigned int num = dat->num; @@ -129,21 +129,21 @@ int cipher_hw_generic_ctr(PROV_CIPHER_CTX *dat, unsigned char *out, * Used if there is no special hardware implementations. */ -int cipher_hw_chunked_cbc(PROV_CIPHER_CTX *ctx, unsigned char *out, +int ossl_cipher_hw_chunked_cbc(PROV_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl) { while (inl >= MAXCHUNK) { - cipher_hw_generic_cbc(ctx, out, in, MAXCHUNK); + ossl_cipher_hw_generic_cbc(ctx, out, in, MAXCHUNK); inl -= MAXCHUNK; in += MAXCHUNK; out += MAXCHUNK; } if (inl > 0) - cipher_hw_generic_cbc(ctx, out, in, inl); + ossl_cipher_hw_generic_cbc(ctx, out, in, inl); return 1; } -int cipher_hw_chunked_cfb8(PROV_CIPHER_CTX *ctx, unsigned char *out, +int ossl_cipher_hw_chunked_cfb8(PROV_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl) { size_t chunk = MAXCHUNK; @@ -151,7 +151,7 @@ int cipher_hw_chunked_cfb8(PROV_CIPHER_CTX *ctx, unsigned char *out, if (inl < chunk) chunk = inl; while (inl > 0 && inl >= chunk) { - cipher_hw_generic_cfb8(ctx, out, in, inl); + ossl_cipher_hw_generic_cfb8(ctx, out, in, inl); inl -= chunk; in += chunk; out += chunk; @@ -161,7 +161,7 @@ int cipher_hw_chunked_cfb8(PROV_CIPHER_CTX *ctx, unsigned char *out, return 1; } -int cipher_hw_chunked_cfb128(PROV_CIPHER_CTX *ctx, unsigned char *out, +int ossl_cipher_hw_chunked_cfb128(PROV_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl) { size_t chunk = MAXCHUNK; @@ -169,7 +169,7 @@ int cipher_hw_chunked_cfb128(PROV_CIPHER_CTX *ctx, unsigned char *out, if (inl < chunk) chunk = inl; while (inl > 0 && inl >= chunk) { - cipher_hw_generic_cfb128(ctx, out, in, inl); + ossl_cipher_hw_generic_cfb128(ctx, out, in, inl); inl -= chunk; in += chunk; out += chunk; @@ -179,16 +179,16 @@ int cipher_hw_chunked_cfb128(PROV_CIPHER_CTX *ctx, unsigned char *out, return 1; } -int cipher_hw_chunked_ofb128(PROV_CIPHER_CTX *ctx, unsigned char *out, +int ossl_cipher_hw_chunked_ofb128(PROV_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl) { while (inl >= MAXCHUNK) { - cipher_hw_generic_ofb128(ctx, out, in, MAXCHUNK); + ossl_cipher_hw_generic_ofb128(ctx, out, in, MAXCHUNK); inl -= MAXCHUNK; in += MAXCHUNK; out += MAXCHUNK; } if (inl > 0) - cipher_hw_generic_ofb128(ctx, out, in, inl); + ossl_cipher_hw_generic_ofb128(ctx, out, in, inl); return 1; } diff --git a/providers/implementations/include/prov/ciphercommon.h b/providers/implementations/include/prov/ciphercommon.h index 137836d7ab..82dae0ba59 100644 --- a/providers/implementations/include/prov/ciphercommon.h +++ b/providers/implementations/include/prov/ciphercommon.h @@ -90,28 +90,28 @@ struct prov_cipher_hw_st { void (*copyctx)(PROV_CIPHER_CTX *dst, const PROV_CIPHER_CTX *src); }; -void cipher_generic_reset_ctx(PROV_CIPHER_CTX *ctx); -OSSL_FUNC_cipher_encrypt_init_fn cipher_generic_einit; -OSSL_FUNC_cipher_decrypt_init_fn cipher_generic_dinit; -OSSL_FUNC_cipher_update_fn cipher_generic_block_update; -OSSL_FUNC_cipher_final_fn cipher_generic_block_final; -OSSL_FUNC_cipher_update_fn cipher_generic_stream_update; -OSSL_FUNC_cipher_final_fn cipher_generic_stream_final; -OSSL_FUNC_cipher_cipher_fn cipher_generic_cipher; -OSSL_FUNC_cipher_get_ctx_params_fn cipher_generic_get_ctx_params; -OSSL_FUNC_cipher_set_ctx_params_fn cipher_generic_set_ctx_params; -OSSL_FUNC_cipher_gettable_params_fn cipher_generic_gettable_params; -OSSL_FUNC_cipher_gettable_ctx_params_fn cipher_generic_gettable_ctx_params; -OSSL_FUNC_cipher_settable_ctx_params_fn cipher_generic_settable_ctx_params; -OSSL_FUNC_cipher_set_ctx_params_fn cipher_var_keylen_set_ctx_params; -OSSL_FUNC_cipher_settable_ctx_params_fn cipher_var_keylen_settable_ctx_params; -OSSL_FUNC_cipher_gettable_ctx_params_fn cipher_aead_gettable_ctx_params; -OSSL_FUNC_cipher_settable_ctx_params_fn cipher_aead_settable_ctx_params; - -int cipher_generic_get_params(OSSL_PARAM params[], unsigned int md, +void ossl_cipher_generic_reset_ctx(PROV_CIPHER_CTX *ctx); +OSSL_FUNC_cipher_encrypt_init_fn ossl_cipher_generic_einit; +OSSL_FUNC_cipher_decrypt_init_fn ossl_cipher_generic_dinit; +OSSL_FUNC_cipher_update_fn ossl_cipher_generic_block_update; +OSSL_FUNC_cipher_final_fn ossl_cipher_generic_block_final; +OSSL_FUNC_cipher_update_fn ossl_cipher_generic_stream_update; +OSSL_FUNC_cipher_final_fn ossl_cipher_generic_stream_final; +OSSL_FUNC_cipher_cipher_fn ossl_cipher_generic_cipher; +OSSL_FUNC_cipher_get_ctx_params_fn ossl_cipher_generic_get_ctx_params; +OSSL_FUNC_cipher_set_ctx_params_fn ossl_cipher_generic_set_ctx_params; +OSSL_FUNC_cipher_gettable_params_fn ossl_cipher_generic_gettable_params; +OSSL_FUNC_cipher_gettable_ctx_params_fn ossl_cipher_generic_gettable_ctx_params; +OSSL_FUNC_cipher_settable_ctx_params_fn ossl_cipher_generic_settable_ctx_params; +OSSL_FUNC_cipher_set_ctx_params_fn ossl_cipher_var_keylen_set_ctx_params; +OSSL_FUNC_cipher_settable_ctx_params_fn ossl_cipher_var_keylen_settable_ctx_params; +OSSL_FUNC_cipher_gettable_ctx_params_fn ossl_cipher_aead_gettable_ctx_params; +OSSL_FUNC_cipher_settable_ctx_params_fn ossl_cipher_aead_settable_ctx_params; + +int ossl_cipher_generic_get_params(OSSL_PARAM params[], unsigned int md, unsigned long flags, size_t kbits, size_t blkbits, size_t ivbits); -void cipher_generic_initkey(void *vctx, size_t kbits, size_t blkbits, +void ossl_cipher_generic_initkey(void *vctx, size_t kbits, size_t blkbits, size_t ivbits, unsigned int mode, uint64_t flags, const PROV_CIPHER_HW *hw, void *provctx); @@ -122,23 +122,23 @@ const OSSL_DISPATCH ossl_##alg##kbits##lcmode##_functions[] = { \ (void (*)(void)) alg##_##kbits##_##lcmode##_newctx }, \ { OSSL_FUNC_CIPHER_FREECTX, (void (*)(void)) alg##_freectx }, \ { OSSL_FUNC_CIPHER_DUPCTX, (void (*)(void)) alg##_dupctx }, \ - { OSSL_FUNC_CIPHER_ENCRYPT_INIT, (void (*)(void))cipher_generic_einit }, \ - { OSSL_FUNC_CIPHER_DECRYPT_INIT, (void (*)(void))cipher_generic_dinit }, \ - { OSSL_FUNC_CIPHER_UPDATE, (void (*)(void))cipher_generic_##typ##_update },\ - { OSSL_FUNC_CIPHER_FINAL, (void (*)(void))cipher_generic_##typ##_final }, \ - { OSSL_FUNC_CIPHER_CIPHER, (void (*)(void))cipher_generic_cipher }, \ + { OSSL_FUNC_CIPHER_ENCRYPT_INIT, (void (*)(void))ossl_cipher_generic_einit }, \ + { OSSL_FUNC_CIPHER_DECRYPT_INIT, (void (*)(void))ossl_cipher_generic_dinit }, \ + { OSSL_FUNC_CIPHER_UPDATE, (void (*)(void))ossl_cipher_generic_##typ##_update },\ + { OSSL_FUNC_CIPHER_FINAL, (void (*)(void))ossl_cipher_generic_##typ##_final }, \ + { OSSL_FUNC_CIPHER_CIPHER, (void (*)(void))ossl_cipher_generic_cipher }, \ { OSSL_FUNC_CIPHER_GET_PARAMS, \ (void (*)(void)) alg##_##kbits##_##lcmode##_get_params }, \ { OSSL_FUNC_CIPHER_GET_CTX_PARAMS, \ - (void (*)(void))cipher_generic_get_ctx_params }, \ + (void (*)(void))ossl_cipher_generic_get_ctx_params }, \ { OSSL_FUNC_CIPHER_SET_CTX_PARAMS, \ - (void (*)(void))cipher_generic_set_ctx_params }, \ + (void (*)(void))ossl_cipher_generic_set_ctx_params }, \ { OSSL_FUNC_CIPHER_GETTABLE_PARAMS, \ - (void (*)(void))cipher_generic_gettable_params }, \ + (void (*)(void))ossl_cipher_generic_gettable_params }, \ { OSSL_FUNC_CIPHER_GETTABLE_CTX_PARAMS, \ - (void (*)(void))cipher_generic_gettable_ctx_params }, \ + (void (*)(void))ossl_cipher_generic_gettable_ctx_params }, \ { OSSL_FUNC_CIPHER_SETTABLE_CTX_PARAMS, \ - (void (*)(void))cipher_generic_settable_ctx_params }, \ + (void (*)(void))ossl_cipher_generic_settable_ctx_params }, \ { 0, NULL } \ }; @@ -149,45 +149,45 @@ const OSSL_DISPATCH ossl_##alg##kbits##lcmode##_functions[] = { \ (void (*)(void)) alg##_##kbits##_##lcmode##_newctx }, \ { OSSL_FUNC_CIPHER_FREECTX, (void (*)(void)) alg##_freectx }, \ { OSSL_FUNC_CIPHER_DUPCTX, (void (*)(void)) alg##_dupctx }, \ - { OSSL_FUNC_CIPHER_ENCRYPT_INIT, (void (*)(void))cipher_generic_einit }, \ - { OSSL_FUNC_CIPHER_DECRYPT_INIT, (void (*)(void))cipher_generic_dinit }, \ - { OSSL_FUNC_CIPHER_UPDATE, (void (*)(void))cipher_generic_##typ##_update },\ - { OSSL_FUNC_CIPHER_FINAL, (void (*)(void))cipher_generic_##typ##_final }, \ - { OSSL_FUNC_CIPHER_CIPHER, (void (*)(void))cipher_generic_cipher }, \ + { OSSL_FUNC_CIPHER_ENCRYPT_INIT, (void (*)(void))ossl_cipher_generic_einit },\ + { OSSL_FUNC_CIPHER_DECRYPT_INIT, (void (*)(void))ossl_cipher_generic_dinit },\ + { OSSL_FUNC_CIPHER_UPDATE, (void (*)(void))ossl_cipher_generic_##typ##_update },\ + { OSSL_FUNC_CIPHER_FINAL, (void (*)(void))ossl_cipher_generic_##typ##_final }, \ + { OSSL_FUNC_CIPHER_CIPHER, (void (*)(void))ossl_cipher_generic_cipher }, \ { OSSL_FUNC_CIPHER_GET_PARAMS, \ (void (*)(void)) alg##_##kbits##_##lcmode##_get_params }, \ { OSSL_FUNC_CIPHER_GET_CTX_PARAMS, \ - (void (*)(void))cipher_generic_get_ctx_params }, \ + (void (*)(void))ossl_cipher_generic_get_ctx_params }, \ { OSSL_FUNC_CIPHER_SET_CTX_PARAMS, \ - (void (*)(void))cipher_var_keylen_set_ctx_params }, \ + (void (*)(void))ossl_cipher_var_keylen_set_ctx_params }, \ { OSSL_FUNC_CIPHER_GETTABLE_PARAMS, \ - (void (*)(void))cipher_generic_gettable_params }, \ + (void (*)(void))ossl_cipher_generic_gettable_params }, \ { OSSL_FUNC_CIPHER_GETTABLE_CTX_PARAMS, \ - (void (*)(void))cipher_generic_gettable_ctx_params }, \ + (void (*)(void))ossl_cipher_generic_gettable_ctx_params }, \ { OSSL_FUNC_CIPHER_SETTABLE_CTX_PARAMS, \ - (void (*)(void))cipher_var_keylen_settable_ctx_params }, \ + (void (*)(void))ossl_cipher_var_keylen_settable_ctx_params }, \ { 0, NULL } \ }; #define IMPLEMENT_generic_cipher_genfn(alg, UCALG, lcmode, UCMODE, flags, \ kbits, blkbits, ivbits, typ) \ -static OSSL_FUNC_cipher_get_params_fn alg##_##kbits##_##lcmode##_get_params; \ +static OSSL_FUNC_cipher_get_params_fn alg##_##kbits##_##lcmode##_get_params; \ static int alg##_##kbits##_##lcmode##_get_params(OSSL_PARAM params[]) \ { \ - return cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, flags, \ - kbits, blkbits, ivbits); \ + return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ + flags, kbits, blkbits, ivbits); \ } \ -static OSSL_FUNC_cipher_newctx_fn alg##_##kbits##_##lcmode##_newctx; \ +static OSSL_FUNC_cipher_newctx_fn alg##_##kbits##_##lcmode##_newctx; \ static void * alg##_##kbits##_##lcmode##_newctx(void *provctx) \ { \ PROV_##UCALG##_CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx))\ : NULL; \ if (ctx != NULL) { \ - cipher_generic_initkey(ctx, kbits, blkbits, ivbits, \ - EVP_CIPH_##UCMODE##_MODE, flags, \ - ossl_prov_cipher_hw_##alg##_##lcmode(kbits), \ - provctx); \ + ossl_cipher_generic_initkey(ctx, kbits, blkbits, ivbits, \ + EVP_CIPH_##UCMODE##_MODE, flags, \ + ossl_prov_cipher_hw_##alg##_##lcmode(kbits),\ + provctx); \ } \ return ctx; \ } \ @@ -206,20 +206,20 @@ IMPLEMENT_generic_cipher_genfn(alg, UCALG, lcmode, UCMODE, flags, kbits, \ IMPLEMENT_var_keylen_cipher_func(alg, UCALG, lcmode, UCMODE, flags, kbits, \ blkbits, ivbits, typ) -PROV_CIPHER_HW_FN cipher_hw_generic_cbc; -PROV_CIPHER_HW_FN cipher_hw_generic_ecb; -PROV_CIPHER_HW_FN cipher_hw_generic_ofb128; -PROV_CIPHER_HW_FN cipher_hw_generic_cfb128; -PROV_CIPHER_HW_FN cipher_hw_generic_cfb8; -PROV_CIPHER_HW_FN cipher_hw_generic_cfb1; -PROV_CIPHER_HW_FN cipher_hw_generic_ctr; -PROV_CIPHER_HW_FN cipher_hw_chunked_cbc; -PROV_CIPHER_HW_FN cipher_hw_chunked_cfb8; -PROV_CIPHER_HW_FN cipher_hw_chunked_cfb128; -PROV_CIPHER_HW_FN cipher_hw_chunked_ofb128; -#define cipher_hw_chunked_ecb cipher_hw_generic_ecb -#define cipher_hw_chunked_ctr cipher_hw_generic_ctr -#define cipher_hw_chunked_cfb1 cipher_hw_generic_cfb1 +PROV_CIPHER_HW_FN ossl_cipher_hw_generic_cbc; +PROV_CIPHER_HW_FN ossl_cipher_hw_generic_ecb; +PROV_CIPHER_HW_FN ossl_cipher_hw_generic_ofb128; +PROV_CIPHER_HW_FN ossl_cipher_hw_generic_cfb128; +PROV_CIPHER_HW_FN ossl_cipher_hw_generic_cfb8; +PROV_CIPHER_HW_FN ossl_cipher_hw_generic_cfb1; +PROV_CIPHER_HW_FN ossl_cipher_hw_generic_ctr; +PROV_CIPHER_HW_FN ossl_cipher_hw_chunked_cbc; +PROV_CIPHER_HW_FN ossl_cipher_hw_chunked_cfb8; +PROV_CIPHER_HW_FN ossl_cipher_hw_chunked_cfb128; +PROV_CIPHER_HW_FN ossl_cipher_hw_chunked_ofb128; +#define ossl_cipher_hw_chunked_ecb ossl_cipher_hw_generic_ecb +#define ossl_cipher_hw_chunked_ctr ossl_cipher_hw_generic_ctr +#define ossl_cipher_hw_chunked_cfb1 ossl_cipher_hw_generic_cfb1 #define IMPLEMENT_CIPHER_HW_OFB(MODE, NAME, CTX_NAME, KEY_NAME, FUNC_PREFIX) \ static int cipher_hw_##NAME##_##MODE##_cipher(PROV_CIPHER_CTX *ctx, \ @@ -338,8 +338,8 @@ const OSSL_PARAM * name##_settable_ctx_params(ossl_unused void *provctx) \ return name##_known_settable_ctx_params; \ } -int cipher_generic_initiv(PROV_CIPHER_CTX *ctx, const unsigned char *iv, - size_t ivlen); +int ossl_cipher_generic_initiv(PROV_CIPHER_CTX *ctx, const unsigned char *iv, + size_t ivlen); size_t fillblock(unsigned char *buf, size_t *buflen, size_t blocksize, const unsigned char **in, size_t *inlen); diff --git a/providers/implementations/include/prov/ciphercommon_aead.h b/providers/implementations/include/prov/ciphercommon_aead.h index 5c82efccae..47175f7247 100644 --- a/providers/implementations/include/prov/ciphercommon_aead.h +++ b/providers/implementations/include/prov/ciphercommon_aead.h @@ -20,7 +20,7 @@ static OSSL_FUNC_cipher_get_params_fn alg##_##kbits##_##lc##_get_params; \ static int alg##_##kbits##_##lc##_get_params(OSSL_PARAM params[]) \ { \ - return cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ + return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ flags, kbits, blkbits, ivbits); \ } \ static OSSL_FUNC_cipher_newctx_fn alg##kbits##lc##_newctx; \ @@ -43,10 +43,10 @@ const OSSL_DISPATCH ossl_##alg##kbits##lc##_functions[] = { \ { OSSL_FUNC_CIPHER_SET_CTX_PARAMS, \ (void (*)(void)) lc##_set_ctx_params }, \ { OSSL_FUNC_CIPHER_GETTABLE_PARAMS, \ - (void (*)(void))cipher_generic_gettable_params }, \ + (void (*)(void))ossl_cipher_generic_gettable_params }, \ { OSSL_FUNC_CIPHER_GETTABLE_CTX_PARAMS, \ - (void (*)(void))cipher_aead_gettable_ctx_params }, \ + (void (*)(void))ossl_cipher_aead_gettable_ctx_params }, \ { OSSL_FUNC_CIPHER_SETTABLE_CTX_PARAMS, \ - (void (*)(void))cipher_aead_settable_ctx_params }, \ + (void (*)(void))ossl_cipher_aead_settable_ctx_params }, \ { 0, NULL } \ } |