提交 7d6766cb 编写于 作者: P Pauli

prov: prefix provider internal functions with ossl_

Also convert the names to lower case.
Reviewed-by: NRichard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/13014)
上级 1be63951
......@@ -116,8 +116,8 @@ static const OSSL_ALGORITHM *base_query(void *provctx, int operation_id,
static void base_teardown(void *provctx)
{
BIO_meth_free(PROV_CTX_get0_core_bio_method(provctx));
PROV_CTX_free(provctx);
BIO_meth_free(ossl_prov_ctx_get0_core_bio_method(provctx));
ossl_prov_ctx_free(provctx);
}
/* Functions we provide to the core */
......@@ -169,15 +169,16 @@ int ossl_base_provider_init(const OSSL_CORE_HANDLE *handle,
* This only works for built-in providers. Most providers should
* create their own library context.
*/
if ((*provctx = PROV_CTX_new()) == NULL
if ((*provctx = ossl_prov_ctx_new()) == NULL
|| (corebiometh = bio_prov_init_bio_method()) == NULL) {
PROV_CTX_free(*provctx);
ossl_prov_ctx_free(*provctx);
*provctx = NULL;
return 0;
}
PROV_CTX_set0_library_context(*provctx, (OPENSSL_CTX *)c_get_libctx(handle));
PROV_CTX_set0_handle(*provctx, handle);
PROV_CTX_set0_core_bio_method(*provctx, corebiometh);
ossl_prov_ctx_set0_library_context(*provctx,
(OPENSSL_CTX *)c_get_libctx(handle));
ossl_prov_ctx_set0_handle(*provctx, handle);
ossl_prov_ctx_set0_core_bio_method(*provctx, corebiometh);
*out = base_dispatch_table;
......
......@@ -213,7 +213,7 @@ BIO_METHOD *bio_prov_init_bio_method(void)
BIO *bio_new_from_core_bio(PROV_CTX *provctx, OSSL_CORE_BIO *corebio)
{
BIO *outbio;
BIO_METHOD *corebiometh = PROV_CTX_get0_core_bio_method(provctx);
BIO_METHOD *corebiometh = ossl_prov_ctx_get0_core_bio_method(provctx);
if (corebiometh == NULL)
return NULL;
......
......@@ -26,15 +26,15 @@ typedef struct prov_ctx_st {
* fetching functions.
*/
# define PROV_LIBRARY_CONTEXT_OF(provctx) \
PROV_CTX_get0_library_context((provctx))
ossl_prov_ctx_get0_library_context((provctx))
PROV_CTX *PROV_CTX_new(void);
void PROV_CTX_free(PROV_CTX *ctx);
void PROV_CTX_set0_library_context(PROV_CTX *ctx, OPENSSL_CTX *libctx);
void PROV_CTX_set0_handle(PROV_CTX *ctx, const OSSL_CORE_HANDLE *handle);
void PROV_CTX_set0_core_bio_method(PROV_CTX *ctx, BIO_METHOD *corebiometh);
OPENSSL_CTX *PROV_CTX_get0_library_context(PROV_CTX *ctx);
const OSSL_CORE_HANDLE *PROV_CTX_get0_handle(PROV_CTX *ctx);
BIO_METHOD *PROV_CTX_get0_core_bio_method(PROV_CTX *ctx);
PROV_CTX *ossl_prov_ctx_new(void);
void ossl_prov_ctx_free(PROV_CTX *ctx);
void ossl_prov_ctx_set0_library_context(PROV_CTX *ctx, OPENSSL_CTX *libctx);
void ossl_prov_ctx_set0_handle(PROV_CTX *ctx, const OSSL_CORE_HANDLE *handle);
void ossl_prov_ctx_set0_core_bio_method(PROV_CTX *ctx, BIO_METHOD *corebiometh);
OPENSSL_CTX *ossl_prov_ctx_get0_library_context(PROV_CTX *ctx);
const OSSL_CORE_HANDLE *ossl_prov_ctx_get0_handle(PROV_CTX *ctx);
BIO_METHOD *ossl_prov_ctx_get0_core_bio_method(PROV_CTX *ctx);
#endif
......@@ -11,49 +11,49 @@
#include "prov/provider_ctx.h"
#include "prov/bio.h"
PROV_CTX *PROV_CTX_new(void)
PROV_CTX *ossl_prov_ctx_new(void)
{
return OPENSSL_zalloc(sizeof(PROV_CTX));
}
void PROV_CTX_free(PROV_CTX *ctx)
void ossl_prov_ctx_free(PROV_CTX *ctx)
{
OPENSSL_free(ctx);
}
void PROV_CTX_set0_library_context(PROV_CTX *ctx, OPENSSL_CTX *libctx)
void ossl_prov_ctx_set0_library_context(PROV_CTX *ctx, OPENSSL_CTX *libctx)
{
if (ctx != NULL)
ctx->libctx = libctx;
}
void PROV_CTX_set0_handle(PROV_CTX *ctx, const OSSL_CORE_HANDLE *handle)
void ossl_prov_ctx_set0_handle(PROV_CTX *ctx, const OSSL_CORE_HANDLE *handle)
{
if (ctx != NULL)
ctx->handle = handle;
}
void PROV_CTX_set0_core_bio_method(PROV_CTX *ctx, BIO_METHOD *corebiometh)
void ossl_prov_ctx_set0_core_bio_method(PROV_CTX *ctx, BIO_METHOD *corebiometh)
{
if (ctx != NULL)
ctx->corebiometh = corebiometh;
}
OPENSSL_CTX *PROV_CTX_get0_library_context(PROV_CTX *ctx)
OPENSSL_CTX *ossl_prov_ctx_get0_library_context(PROV_CTX *ctx)
{
if (ctx == NULL)
return NULL;
return ctx->libctx;
}
const OSSL_CORE_HANDLE *PROV_CTX_get0_handle(PROV_CTX *ctx)
const OSSL_CORE_HANDLE *ossl_prov_ctx_get0_handle(PROV_CTX *ctx)
{
if (ctx == NULL)
return NULL;
return ctx->handle;
}
BIO_METHOD *PROV_CTX_get0_core_bio_method(PROV_CTX *ctx)
BIO_METHOD *ossl_prov_ctx_get0_core_bio_method(PROV_CTX *ctx)
{
if (ctx == NULL)
return NULL;
......
......@@ -502,8 +502,8 @@ static const OSSL_ALGORITHM *deflt_query(void *provctx, int operation_id,
static void deflt_teardown(void *provctx)
{
BIO_meth_free(PROV_CTX_get0_core_bio_method(provctx));
PROV_CTX_free(provctx);
BIO_meth_free(ossl_prov_ctx_get0_core_bio_method(provctx));
ossl_prov_ctx_free(provctx);
}
/* Functions we provide to the core */
......@@ -556,15 +556,16 @@ int ossl_default_provider_init(const OSSL_CORE_HANDLE *handle,
* This only works for built-in providers. Most providers should
* create their own library context.
*/
if ((*provctx = PROV_CTX_new()) == NULL
if ((*provctx = ossl_prov_ctx_new()) == NULL
|| (corebiometh = bio_prov_init_bio_method()) == NULL) {
PROV_CTX_free(*provctx);
ossl_prov_ctx_free(*provctx);
*provctx = NULL;
return 0;
}
PROV_CTX_set0_library_context(*provctx, (OPENSSL_CTX *)c_get_libctx(handle));
PROV_CTX_set0_handle(*provctx, handle);
PROV_CTX_set0_core_bio_method(*provctx, corebiometh);
ossl_prov_ctx_set0_library_context(*provctx,
(OPENSSL_CTX *)c_get_libctx(handle));
ossl_prov_ctx_set0_handle(*provctx, handle);
ossl_prov_ctx_set0_core_bio_method(*provctx, corebiometh);
*out = deflt_dispatch_table;
......
......@@ -519,7 +519,8 @@ static const OSSL_ALGORITHM *fips_query(void *provctx, int operation_id,
case OSSL_OP_DIGEST:
return fips_digests;
case OSSL_OP_CIPHER:
ossl_prov_cache_exported_algorithms(fips_ciphers, exported_fips_ciphers);
ossl_prov_cache_exported_algorithms(fips_ciphers,
exported_fips_ciphers);
return exported_fips_ciphers;
case OSSL_OP_MAC:
return fips_macs;
......@@ -544,7 +545,7 @@ static const OSSL_ALGORITHM *fips_query(void *provctx, int operation_id,
static void fips_teardown(void *provctx)
{
OPENSSL_CTX_free(PROV_LIBRARY_CONTEXT_OF(provctx));
PROV_CTX_free(provctx);
ossl_prov_ctx_free(provctx);
}
static void fips_intern_teardown(void *provctx)
......@@ -553,7 +554,7 @@ static void fips_intern_teardown(void *provctx)
* We know that the library context is the same as for the outer provider,
* so no need to destroy it here.
*/
PROV_CTX_free(provctx);
ossl_prov_ctx_free(provctx);
}
/* Functions we provide to the core */
......@@ -690,7 +691,7 @@ int OSSL_provider_init(const OSSL_CORE_HANDLE *handle,
fips_security_checks = 0;
/* Create a context. */
if ((*provctx = PROV_CTX_new()) == NULL
if ((*provctx = ossl_prov_ctx_new()) == NULL
|| (libctx = OPENSSL_CTX_new()) == NULL) {
/*
* We free libctx separately here and only here because it hasn't
......@@ -700,8 +701,8 @@ int OSSL_provider_init(const OSSL_CORE_HANDLE *handle,
OPENSSL_CTX_free(libctx);
goto err;
}
PROV_CTX_set0_library_context(*provctx, libctx);
PROV_CTX_set0_handle(*provctx, handle);
ossl_prov_ctx_set0_library_context(*provctx, libctx);
ossl_prov_ctx_set0_handle(*provctx, handle);
if ((fgbl = openssl_ctx_get_data(libctx, OPENSSL_CTX_FIPS_PROV_INDEX,
&fips_prov_ossl_ctx_method)) == NULL)
......@@ -754,7 +755,7 @@ int fips_intern_provider_init(const OSSL_CORE_HANDLE *handle,
if (c_internal_get_libctx == NULL)
return 0;
if ((*provctx = PROV_CTX_new()) == NULL)
if ((*provctx = ossl_prov_ctx_new()) == NULL)
return 0;
/*
......@@ -762,9 +763,10 @@ int fips_intern_provider_init(const OSSL_CORE_HANDLE *handle,
* internal provider. This is not something that most providers would be
* able to do.
*/
PROV_CTX_set0_library_context(*provctx,
(OPENSSL_CTX *)c_internal_get_libctx(handle));
PROV_CTX_set0_handle(*provctx, handle);
ossl_prov_ctx_set0_library_context(
*provctx, (OPENSSL_CTX *)c_internal_get_libctx(handle)
);
ossl_prov_ctx_set0_handle(*provctx, handle);
*out = intern_dispatch_table;
return 1;
......
......@@ -315,7 +315,10 @@ static int self_test_drbg(const ST_KAT_DRBG *t, OSSL_SELF_TEST *st,
if (!EVP_RAND_set_ctx_params(test, drbg_params))
goto err;
/* This calls PROV_DRBG_reseed() internally when prediction_resistance = 1 */
/*
* This calls ossl_prov_drbg_reseed() internally when
* prediction_resistance = 1
*/
if (!EVP_RAND_generate(drbg, out, t->expectedlen, strength,
prediction_resistance,
t->entropyaddin2, t->entropyaddin2len))
......@@ -329,7 +332,8 @@ static int self_test_drbg(const ST_KAT_DRBG *t, OSSL_SELF_TEST *st,
if (!EVP_RAND_uninstantiate(drbg))
goto err;
/*
* Check that the DRBG data has been zeroized after PROV_DRBG_uninstantiate.
* Check that the DRBG data has been zeroized after
* ossl_prov_drbg_uninstantiate.
*/
if (!EVP_RAND_verify_zeroization(drbg))
goto err;
......
......@@ -51,12 +51,12 @@ typedef struct prov_aes_ctx_st {
} PROV_AES_CTX;
#define PROV_CIPHER_HW_aes_ofb PROV_CIPHER_HW_aes_ofb128
#define PROV_CIPHER_HW_aes_cfb PROV_CIPHER_HW_aes_cfb128
const PROV_CIPHER_HW *PROV_CIPHER_HW_aes_ecb(size_t keybits);
const PROV_CIPHER_HW *PROV_CIPHER_HW_aes_cbc(size_t keybits);
const PROV_CIPHER_HW *PROV_CIPHER_HW_aes_ofb128(size_t keybits);
const PROV_CIPHER_HW *PROV_CIPHER_HW_aes_cfb128(size_t keybits);
const PROV_CIPHER_HW *PROV_CIPHER_HW_aes_cfb1(size_t keybits);
const PROV_CIPHER_HW *PROV_CIPHER_HW_aes_cfb8(size_t keybits);
const PROV_CIPHER_HW *PROV_CIPHER_HW_aes_ctr(size_t keybits);
#define ossl_prov_cipher_hw_aes_ofb ossl_prov_cipher_hw_aes_ofb128
#define ossl_prov_cipher_hw_aes_cfb ossl_prov_cipher_hw_aes_cfb128
const PROV_CIPHER_HW *ossl_prov_cipher_hw_aes_ecb(size_t keybits);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_aes_cbc(size_t keybits);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_aes_ofb128(size_t keybits);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_aes_cfb128(size_t keybits);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_aes_cfb1(size_t keybits);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_aes_cfb8(size_t keybits);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_aes_ctr(size_t keybits);
......@@ -308,7 +308,7 @@ static void *aes_cbc_hmac_sha1_newctx(void *provctx, size_t kbits,
ctx = OPENSSL_zalloc(sizeof(*ctx));
if (ctx != NULL)
base_init(provctx, &ctx->base_ctx,
PROV_CIPHER_HW_aes_cbc_hmac_sha1(), kbits, blkbits,
ossl_prov_cipher_hw_aes_cbc_hmac_sha1(), kbits, blkbits,
ivbits, flags);
return ctx;
}
......@@ -335,7 +335,7 @@ static void *aes_cbc_hmac_sha256_newctx(void *provctx, size_t kbits,
ctx = OPENSSL_zalloc(sizeof(*ctx));
if (ctx != NULL)
base_init(provctx, &ctx->base_ctx,
PROV_CIPHER_HW_aes_cbc_hmac_sha256(), kbits, blkbits,
ossl_prov_cipher_hw_aes_cbc_hmac_sha256(), kbits, blkbits,
ivbits, flags);
return ctx;
}
......
......@@ -26,8 +26,8 @@ typedef struct prov_cipher_hw_aes_hmac_sha_ctx_st {
# endif /* OPENSSL_NO_MULTIBLOCK) */
} PROV_CIPHER_HW_AES_HMAC_SHA;
const PROV_CIPHER_HW_AES_HMAC_SHA *PROV_CIPHER_HW_aes_cbc_hmac_sha1(void);
const PROV_CIPHER_HW_AES_HMAC_SHA *PROV_CIPHER_HW_aes_cbc_hmac_sha256(void);
const PROV_CIPHER_HW_AES_HMAC_SHA *ossl_prov_cipher_hw_aes_cbc_hmac_sha1(void);
const PROV_CIPHER_HW_AES_HMAC_SHA *ossl_prov_cipher_hw_aes_cbc_hmac_sha256(void);
#ifdef AES_CBC_HMAC_SHA_CAPABLE
# include <openssl/aes.h>
......
......@@ -22,7 +22,7 @@ int cipher_capable_aes_cbc_hmac_sha1(void)
return 0;
}
const PROV_CIPHER_HW_AES_HMAC_SHA *PROV_CIPHER_HW_aes_cbc_hmac_sha1(void)
const PROV_CIPHER_HW_AES_HMAC_SHA *ossl_prov_cipher_hw_aes_cbc_hmac_sha1(void)
{
return NULL;
}
......@@ -788,7 +788,7 @@ static const PROV_CIPHER_HW_AES_HMAC_SHA cipher_hw_aes_hmac_sha1 = {
# endif
};
const PROV_CIPHER_HW_AES_HMAC_SHA *PROV_CIPHER_HW_aes_cbc_hmac_sha1(void)
const PROV_CIPHER_HW_AES_HMAC_SHA *ossl_prov_cipher_hw_aes_cbc_hmac_sha1(void)
{
return &cipher_hw_aes_hmac_sha1;
}
......
......@@ -22,7 +22,7 @@ int cipher_capable_aes_cbc_hmac_sha256(void)
return 0;
}
const PROV_CIPHER_HW_AES_HMAC_SHA *PROV_CIPHER_HW_aes_cbc_hmac_sha256(void)
const PROV_CIPHER_HW_AES_HMAC_SHA *ossl_prov_cipher_hw_aes_cbc_hmac_sha256(void)
{
return NULL;
}
......@@ -837,7 +837,7 @@ static const PROV_CIPHER_HW_AES_HMAC_SHA cipher_hw_aes_hmac_sha256 = {
# endif
};
const PROV_CIPHER_HW_AES_HMAC_SHA *PROV_CIPHER_HW_aes_cbc_hmac_sha256(void)
const PROV_CIPHER_HW_AES_HMAC_SHA *ossl_prov_cipher_hw_aes_cbc_hmac_sha256(void)
{
return &cipher_hw_aes_hmac_sha256;
}
......
......@@ -29,7 +29,7 @@ static void *aes_ccm_newctx(void *provctx, size_t keybits)
ctx = OPENSSL_zalloc(sizeof(*ctx));
if (ctx != NULL)
ccm_initctx(&ctx->base, keybits, PROV_AES_HW_ccm(keybits));
ccm_initctx(&ctx->base, keybits, ossl_prov_aes_hw_ccm(keybits));
return ctx;
}
......
......@@ -45,4 +45,4 @@ typedef struct prov_aes_ccm_ctx_st {
} ccm;
} PROV_AES_CCM_CTX;
const PROV_CCM_HW *PROV_AES_HW_ccm(size_t keylen);
const PROV_CCM_HW *ossl_prov_aes_hw_ccm(size_t keylen);
......@@ -62,7 +62,7 @@ static const PROV_CCM_HW aes_ccm = {
#elif defined(SPARC_AES_CAPABLE)
# include "cipher_aes_ccm_hw_t4.inc"
#else
const PROV_CCM_HW *PROV_AES_HW_ccm(size_t keybits)
const PROV_CCM_HW *ossl_prov_aes_hw_ccm(size_t keybits)
{
return &aes_ccm;
}
......
......@@ -32,7 +32,7 @@ static const PROV_CCM_HW aesni_ccm = {
ccm_generic_gettag
};
const PROV_CCM_HW *PROV_AES_HW_ccm(size_t keybits)
const PROV_CCM_HW *ossl_prov_aes_hw_ccm(size_t keybits)
{
return AESNI_CAPABLE ? &aesni_ccm : &aes_ccm;
}
......@@ -258,7 +258,7 @@ static const PROV_CCM_HW s390x_aes_ccm = {
s390x_aes_ccm_gettag
};
const PROV_CCM_HW *PROV_AES_HW_ccm(size_t keybits)
const PROV_CCM_HW *ossl_prov_aes_hw_ccm(size_t keybits)
{
if ((keybits == 128 && S390X_aes_128_ccm_CAPABLE)
|| (keybits == 192 && S390X_aes_192_ccm_CAPABLE)
......
......@@ -30,7 +30,7 @@ static const PROV_CCM_HW t4_aes_ccm = {
ccm_generic_gettag
};
const PROV_CCM_HW *PROV_AES_HW_ccm(size_t keybits)
const PROV_CCM_HW *ossl_prov_aes_hw_ccm(size_t keybits)
{
return SPARC_AES_CAPABLE ? &t4_aes_ccm : &aes_ccm;
}
......@@ -32,7 +32,7 @@ static void *aes_gcm_newctx(void *provctx, size_t keybits)
ctx = OPENSSL_zalloc(sizeof(*ctx));
if (ctx != NULL)
gcm_initctx(provctx, &ctx->base, keybits, PROV_AES_HW_gcm(keybits),
gcm_initctx(provctx, &ctx->base, keybits, ossl_prov_aes_hw_gcm(keybits),
AES_GCM_IV_MIN_SIZE);
return ctx;
}
......
......@@ -41,4 +41,4 @@ typedef struct prov_aes_gcm_ctx_st {
} plat;
} PROV_AES_GCM_CTX;
const PROV_GCM_HW *PROV_AES_HW_gcm(size_t keybits);
const PROV_GCM_HW *ossl_prov_aes_hw_gcm(size_t keybits);
......@@ -142,7 +142,7 @@ static const PROV_GCM_HW aes_gcm = {
#elif defined(AES_PMULL_CAPABLE) && defined(AES_GCM_ASM)
# include "cipher_aes_gcm_hw_armv8.inc"
#else
const PROV_GCM_HW *PROV_AES_HW_gcm(size_t keybits)
const PROV_GCM_HW *ossl_prov_aes_hw_gcm(size_t keybits)
{
return &aes_gcm;
}
......
......@@ -31,7 +31,7 @@ static const PROV_GCM_HW aesni_gcm = {
gcm_one_shot
};
const PROV_GCM_HW *PROV_AES_HW_gcm(size_t keybits)
const PROV_GCM_HW *ossl_prov_aes_hw_gcm(size_t keybits)
{
return AESNI_CAPABLE ? &aesni_gcm : &aes_gcm;
}
......
......@@ -77,7 +77,7 @@ static const PROV_GCM_HW armv8_aes_gcm = {
gcm_one_shot
};
const PROV_GCM_HW *PROV_AES_HW_gcm(size_t keybits)
const PROV_GCM_HW *ossl_prov_aes_hw_gcm(size_t keybits)
{
return AES_PMULL_CAPABLE ? &armv8_aes_gcm : &aes_gcm;
}
......@@ -290,7 +290,7 @@ static const PROV_GCM_HW s390x_aes_gcm = {
s390x_aes_gcm_one_shot
};
const PROV_GCM_HW *PROV_AES_HW_gcm(size_t keybits)
const PROV_GCM_HW *ossl_prov_aes_hw_gcm(size_t keybits)
{
if ((keybits == 128 && S390X_aes_128_gcm_CAPABLE)
|| (keybits == 192 && S390X_aes_192_gcm_CAPABLE)
......
......@@ -46,7 +46,7 @@ static const PROV_GCM_HW t4_aes_gcm = {
gcm_cipher_final,
gcm_one_shot
};
const PROV_GCM_HW *PROV_AES_HW_gcm(size_t keybits)
const PROV_GCM_HW *ossl_prov_aes_hw_gcm(size_t keybits)
{
return SPARC_AES_CAPABLE ? &t4_aes_gcm : &aes_gcm;
}
......@@ -130,7 +130,7 @@ static const PROV_CIPHER_HW aes_##mode = { \
cipher_hw_aes_copyctx \
}; \
PROV_CIPHER_HW_declare(mode) \
const PROV_CIPHER_HW *PROV_CIPHER_HW_aes_##mode(size_t keybits) \
const PROV_CIPHER_HW *ossl_prov_cipher_hw_aes_##mode(size_t keybits) \
{ \
PROV_CIPHER_HW_select(mode) \
return &aes_##mode; \
......
......@@ -308,7 +308,7 @@ 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,
PROV_CIPHER_HW_aes_ocb(kbits), NULL);
ossl_prov_cipher_hw_aes_ocb(kbits), NULL);
ctx->taglen = OCB_DEFAULT_TAG_LEN;
}
return ctx;
......
......@@ -36,4 +36,4 @@ typedef struct prov_aes_ocb_ctx_st {
unsigned char aad_buf[OCB_MAX_AAD_LEN]; /* Store partial AAD blocks */
} PROV_AES_OCB_CTX;
const PROV_CIPHER_HW *PROV_CIPHER_HW_aes_ocb(size_t keybits);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_aes_ocb(size_t keybits);
......@@ -113,7 +113,7 @@ static const PROV_CIPHER_HW aes_generic_ocb = {
NULL
};
PROV_CIPHER_HW_declare()
const PROV_CIPHER_HW *PROV_CIPHER_HW_aes_ocb(size_t keybits)
const PROV_CIPHER_HW *ossl_prov_cipher_hw_aes_ocb(size_t keybits)
{
PROV_CIPHER_HW_select()
return &aes_generic_ocb;
......
......@@ -39,7 +39,7 @@ static void *aes_siv_newctx(void *provctx, size_t keybits, unsigned int mode,
ctx->mode = mode;
ctx->flags = flags;
ctx->keylen = keybits / 8;
ctx->hw = PROV_CIPHER_HW_aes_siv(keybits);
ctx->hw = ossl_prov_cipher_hw_aes_siv(keybits);
ctx->libctx = PROV_LIBRARY_CONTEXT_OF(provctx);
}
return ctx;
......
......@@ -34,4 +34,4 @@ typedef struct prov_siv_ctx_st {
OPENSSL_CTX *libctx;
} PROV_AES_SIV_CTX;
const PROV_CIPHER_HW_AES_SIV *PROV_CIPHER_HW_aes_siv(size_t keybits);
const PROV_CIPHER_HW_AES_SIV *ossl_prov_cipher_hw_aes_siv(size_t keybits);
......@@ -130,7 +130,7 @@ static const PROV_CIPHER_HW_AES_SIV aes_siv_hw =
aes_siv_dupctx,
};
const PROV_CIPHER_HW_AES_SIV *PROV_CIPHER_HW_aes_siv(size_t keybits)
const PROV_CIPHER_HW_AES_SIV *ossl_prov_cipher_hw_aes_siv(size_t keybits)
{
return &aes_siv_hw;
}
......@@ -116,7 +116,7 @@ static void *aes_xts_newctx(void *provctx, unsigned int mode, uint64_t flags,
if (ctx != NULL) {
cipher_generic_initkey(&ctx->base, kbits, blkbits, ivbits, mode, flags,
PROV_CIPHER_HW_aes_xts(kbits), NULL);
ossl_prov_cipher_hw_aes_xts(kbits), NULL);
}
return ctx;
}
......
......@@ -32,4 +32,4 @@ typedef struct prov_aes_xts_ctx_st {
OSSL_xts_stream_fn stream;
} PROV_AES_XTS_CTX;
const PROV_CIPHER_HW *PROV_CIPHER_HW_aes_xts(size_t keybits);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_aes_xts(size_t keybits);
......@@ -169,7 +169,7 @@ static const PROV_CIPHER_HW aes_generic_xts = {
cipher_hw_aes_xts_copyctx
};
PROV_CIPHER_HW_declare_xts()
const PROV_CIPHER_HW *PROV_CIPHER_HW_aes_xts(size_t keybits)
const PROV_CIPHER_HW *ossl_prov_cipher_hw_aes_xts(size_t keybits)
{
PROV_CIPHER_HW_select_xts()
return &aes_generic_xts;
......
......@@ -19,12 +19,12 @@ typedef struct prov_aria_ctx_st {
} PROV_ARIA_CTX;
# define PROV_CIPHER_HW_aria_ofb PROV_CIPHER_HW_aria_ofb128
# define PROV_CIPHER_HW_aria_cfb PROV_CIPHER_HW_aria_cfb128
const PROV_CIPHER_HW *PROV_CIPHER_HW_aria_ecb(size_t keybits);
const PROV_CIPHER_HW *PROV_CIPHER_HW_aria_cbc(size_t keybits);
const PROV_CIPHER_HW *PROV_CIPHER_HW_aria_ofb128(size_t keybits);
const PROV_CIPHER_HW *PROV_CIPHER_HW_aria_cfb128(size_t keybits);
const PROV_CIPHER_HW *PROV_CIPHER_HW_aria_cfb1(size_t keybits);
const PROV_CIPHER_HW *PROV_CIPHER_HW_aria_cfb8(size_t keybits);
const PROV_CIPHER_HW *PROV_CIPHER_HW_aria_ctr(size_t keybits);
#define ossl_prov_cipher_hw_aria_ofb ossl_prov_cipher_hw_aria_ofb128
#define ossl_prov_cipher_hw_aria_cfb ossl_prov_cipher_hw_aria_cfb128
const PROV_CIPHER_HW *ossl_prov_cipher_hw_aria_ecb(size_t keybits);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_aria_cbc(size_t keybits);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_aria_ofb128(size_t keybits);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_aria_cfb128(size_t keybits);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_aria_cfb1(size_t keybits);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_aria_cfb8(size_t keybits);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_aria_ctr(size_t keybits);
......@@ -24,7 +24,7 @@ static void *aria_ccm_newctx(void *provctx, size_t keybits)
ctx = OPENSSL_zalloc(sizeof(*ctx));
if (ctx != NULL)
ccm_initctx(&ctx->base, keybits, PROV_ARIA_HW_ccm(keybits));
ccm_initctx(&ctx->base, keybits, ossl_prov_aria_hw_ccm(keybits));
return ctx;
}
......
......@@ -19,4 +19,4 @@ typedef struct prov_aria_ccm_ctx_st {
} ks; /* ARIA key schedule to use */
} PROV_ARIA_CCM_CTX;
const PROV_CCM_HW *PROV_ARIA_HW_ccm(size_t keylen);
const PROV_CCM_HW *ossl_prov_aria_hw_ccm(size_t keylen);
......@@ -34,7 +34,7 @@ static const PROV_CCM_HW ccm_aria = {
ccm_generic_auth_decrypt,
ccm_generic_gettag
};
const PROV_CCM_HW *PROV_ARIA_HW_ccm(size_t keybits)
const PROV_CCM_HW *ossl_prov_aria_hw_ccm(size_t keybits)
{
return &ccm_aria;
}
......@@ -24,8 +24,8 @@ static void *aria_gcm_newctx(void *provctx, size_t keybits)
ctx = OPENSSL_zalloc(sizeof(*ctx));
if (ctx != NULL)
gcm_initctx(provctx, &ctx->base, keybits, PROV_ARIA_HW_gcm(keybits),
ARIA_GCM_IV_MIN_SIZE);
gcm_initctx(provctx, &ctx->base, keybits,
ossl_prov_aria_hw_gcm(keybits), ARIA_GCM_IV_MIN_SIZE);
return ctx;
}
......
......@@ -19,4 +19,4 @@ typedef struct prov_aria_gcm_ctx_st {
} ks;
} PROV_ARIA_GCM_CTX;
const PROV_GCM_HW *PROV_ARIA_HW_gcm(size_t keybits);
const PROV_GCM_HW *ossl_prov_aria_hw_gcm(size_t keybits);
......@@ -31,7 +31,7 @@ static const PROV_GCM_HW aria_gcm = {
gcm_cipher_final,
gcm_one_shot
};
const PROV_GCM_HW *PROV_ARIA_HW_gcm(size_t keybits)
const PROV_GCM_HW *ossl_prov_aria_hw_gcm(size_t keybits)
{
return &aria_gcm;
}
......@@ -37,7 +37,7 @@ static const PROV_CIPHER_HW aria_##mode = { \
cipher_hw_chunked_##mode, \
cipher_hw_aria_copyctx \
}; \
const PROV_CIPHER_HW *PROV_CIPHER_HW_aria_##mode(size_t keybits) \
const PROV_CIPHER_HW *ossl_prov_cipher_hw_aria_##mode(size_t keybits) \
{ \
return &aria_##mode; \
}
......
......@@ -18,7 +18,7 @@ typedef struct prov_blowfish_ctx_st {
} ks;
} PROV_BLOWFISH_CTX;
const PROV_CIPHER_HW *PROV_CIPHER_HW_blowfish_cbc(size_t keybits);
const PROV_CIPHER_HW *PROV_CIPHER_HW_blowfish_ecb(size_t keybits);
const PROV_CIPHER_HW *PROV_CIPHER_HW_blowfish_ofb64(size_t keybits);
const PROV_CIPHER_HW *PROV_CIPHER_HW_blowfish_cfb64(size_t keybits);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_blowfish_cbc(size_t keybits);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_blowfish_ecb(size_t keybits);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_blowfish_ofb64(size_t keybits);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_blowfish_cfb64(size_t keybits);
......@@ -31,7 +31,7 @@ static const PROV_CIPHER_HW bf_##mode = { \
cipher_hw_blowfish_initkey, \
cipher_hw_blowfish_##mode##_cipher \
}; \
const PROV_CIPHER_HW *PROV_CIPHER_HW_blowfish_##mode(size_t keybits) \
const PROV_CIPHER_HW *ossl_prov_cipher_hw_blowfish_##mode(size_t keybits) \
{ \
return &bf_##mode; \
}
......
......@@ -19,12 +19,12 @@ typedef struct prov_camellia_ctx_st {
} ks;
} PROV_CAMELLIA_CTX;
#define PROV_CIPHER_HW_camellia_ofb PROV_CIPHER_HW_camellia_ofb128
#define PROV_CIPHER_HW_camellia_cfb PROV_CIPHER_HW_camellia_cfb128
const PROV_CIPHER_HW *PROV_CIPHER_HW_camellia_ecb(size_t keybits);
const PROV_CIPHER_HW *PROV_CIPHER_HW_camellia_cbc(size_t keybits);
const PROV_CIPHER_HW *PROV_CIPHER_HW_camellia_ofb128(size_t keybits);
const PROV_CIPHER_HW *PROV_CIPHER_HW_camellia_cfb128(size_t keybits);
const PROV_CIPHER_HW *PROV_CIPHER_HW_camellia_cfb1(size_t keybits);
const PROV_CIPHER_HW *PROV_CIPHER_HW_camellia_cfb8(size_t keybits);
const PROV_CIPHER_HW *PROV_CIPHER_HW_camellia_ctr(size_t keybits);
#define ossl_prov_cipher_hw_camellia_ofb ossl_prov_cipher_hw_camellia_ofb128
#define ossl_prov_cipher_hw_camellia_cfb ossl_prov_cipher_hw_camellia_cfb128
const PROV_CIPHER_HW *ossl_prov_cipher_hw_camellia_ecb(size_t keybits);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_camellia_cbc(size_t keybits);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_camellia_ofb128(size_t keybits);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_camellia_cfb128(size_t keybits);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_camellia_cfb1(size_t keybits);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_camellia_cfb8(size_t keybits);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_camellia_ctr(size_t keybits);
......@@ -58,7 +58,7 @@ static const PROV_CIPHER_HW camellia_##mode = { \
cipher_hw_camellia_copyctx \
}; \
PROV_CIPHER_HW_declare(mode) \
const PROV_CIPHER_HW *PROV_CIPHER_HW_camellia_##mode(size_t keybits) \
const PROV_CIPHER_HW *ossl_prov_cipher_hw_camellia_##mode(size_t keybits) \
{ \
PROV_CIPHER_HW_select(mode) \
return &camellia_##mode; \
......
......@@ -18,7 +18,7 @@ typedef struct prov_cast_ctx_st {
} ks;
} PROV_CAST_CTX;
const PROV_CIPHER_HW *PROV_CIPHER_HW_cast5_cbc(size_t keybits);
const PROV_CIPHER_HW *PROV_CIPHER_HW_cast5_ecb(size_t keybits);
const PROV_CIPHER_HW *PROV_CIPHER_HW_cast5_ofb64(size_t keybits);
const PROV_CIPHER_HW *PROV_CIPHER_HW_cast5_cfb64(size_t keybits);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_cast5_cbc(size_t keybits);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_cast5_ecb(size_t keybits);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_cast5_ofb64(size_t keybits);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_cast5_cfb64(size_t keybits);
......@@ -31,7 +31,7 @@ static const PROV_CIPHER_HW cast5_##mode = { \
cipher_hw_cast5_initkey, \
cipher_hw_cast5_##mode##_cipher \
}; \
const PROV_CIPHER_HW *PROV_CIPHER_HW_cast5_##mode(size_t keybits) \
const PROV_CIPHER_HW *ossl_prov_cipher_hw_cast5_##mode(size_t keybits) \
{ \
return &cast5_##mode; \
}
......
......@@ -38,7 +38,7 @@ void chacha20_initctx(PROV_CHACHA20_CTX *ctx)
CHACHA20_BLKLEN * 8,
CHACHA20_IVLEN * 8,
0, CHACHA20_FLAGS,
PROV_CIPHER_HW_chacha20(CHACHA20_KEYLEN * 8),
ossl_prov_cipher_hw_chacha20(CHACHA20_KEYLEN * 8),
NULL);
}
......
......@@ -27,7 +27,7 @@ typedef struct prov_cipher_hw_chacha20_st {
} PROV_CIPHER_HW_CHACHA20;
const PROV_CIPHER_HW *PROV_CIPHER_HW_chacha20(size_t keybits);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_chacha20(size_t keybits);
OSSL_FUNC_cipher_encrypt_init_fn chacha20_einit;
OSSL_FUNC_cipher_decrypt_init_fn chacha20_dinit;
......
......@@ -114,7 +114,7 @@ static const PROV_CIPHER_HW_CHACHA20 chacha20_hw = {
chacha20_initiv
};
const PROV_CIPHER_HW *PROV_CIPHER_HW_chacha20(size_t keybits)
const PROV_CIPHER_HW *ossl_prov_cipher_hw_chacha20(size_t keybits)
{
return (PROV_CIPHER_HW *)&chacha20_hw;
}
......
......@@ -56,9 +56,9 @@ static void *chacha20_poly1305_newctx(void *provctx)
CHACHA20_POLY1305_IVLEN * 8,
CHACHA20_POLY1305_MODE,
CHACHA20_POLY1305_FLAGS,
PROV_CIPHER_HW_chacha20_poly1305(
ossl_prov_cipher_hw_chacha20_poly1305(
CHACHA20_POLY1305_KEYLEN * 8),
NULL);
NULL);
ctx->nonce_len = CHACHA20_POLY1305_IVLEN;
ctx->tls_payload_length = NO_TLS_PAYLOAD_LENGTH;
chacha20_initctx(&ctx->chacha);
......
......@@ -40,4 +40,4 @@ typedef struct prov_cipher_hw_chacha_aead_st {
size_t flen);
} PROV_CIPHER_HW_CHACHA20_POLY1305;
const PROV_CIPHER_HW *PROV_CIPHER_HW_chacha20_poly1305(size_t keybits);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_chacha20_poly1305(size_t keybits);
......@@ -399,7 +399,7 @@ static const PROV_CIPHER_HW_CHACHA20_POLY1305 chacha20poly1305_hw =
chacha_poly1305_tls_iv_set_fixed
};
const PROV_CIPHER_HW *PROV_CIPHER_HW_chacha20_poly1305(size_t keybits)
const PROV_CIPHER_HW *ossl_prov_cipher_hw_chacha20_poly1305(size_t keybits)
{
return (PROV_CIPHER_HW *)&chacha20poly1305_hw;
}
......@@ -73,7 +73,8 @@ static const PROV_CIPHER_HW desx_cbc =
cipher_hw_desx_cbc,
cipher_hw_desx_copyctx
};
const PROV_CIPHER_HW *PROV_CIPHER_HW_tdes_desx_cbc(void)
const PROV_CIPHER_HW *ossl_prov_cipher_hw_tdes_desx_cbc(void)
{
return &desx_cbc;
}
......@@ -18,7 +18,7 @@ typedef struct prov_idea_ctx_st {
} ks;
} PROV_IDEA_CTX;
const PROV_CIPHER_HW *PROV_CIPHER_HW_idea_cbc(size_t keybits);
const PROV_CIPHER_HW *PROV_CIPHER_HW_idea_ecb(size_t keybits);
const PROV_CIPHER_HW *PROV_CIPHER_HW_idea_ofb64(size_t keybits);
const PROV_CIPHER_HW *PROV_CIPHER_HW_idea_cfb64(size_t keybits);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_idea_cbc(size_t keybits);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_idea_ecb(size_t keybits);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_idea_ofb64(size_t keybits);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_idea_cfb64(size_t keybits);
......@@ -43,7 +43,7 @@ static const PROV_CIPHER_HW idea_##mode = { \
cipher_hw_idea_initkey, \
cipher_hw_idea_##mode##_cipher \
}; \
const PROV_CIPHER_HW *PROV_CIPHER_HW_idea_##mode(size_t keybits) \
const PROV_CIPHER_HW *ossl_prov_cipher_hw_idea_##mode(size_t keybits) \
{ \
return &idea_##mode; \
}
......
......@@ -210,7 +210,8 @@ static void * alg##_##kbits##_##lcmode##_newctx(void *provctx) \
if (ctx != NULL) { \
cipher_generic_initkey(ctx, kbits, blkbits, ivbits, \
EVP_CIPH_##UCMODE##_MODE, flags, \
PROV_CIPHER_HW_##alg##_##lcmode(kbits), NULL); \
ossl_prov_cipher_hw_##alg##_##lcmode(kbits), \
NULL); \
ctx->key_bits = kbits; \
} \
return ctx; \
......
......@@ -19,10 +19,10 @@ typedef struct prov_rc2_ctx_st {
size_t key_bits;
} PROV_RC2_CTX;
#define PROV_CIPHER_HW_rc2_ofb128 PROV_CIPHER_HW_rc2_ofb64
#define PROV_CIPHER_HW_rc2_cfb128 PROV_CIPHER_HW_rc2_cfb64
#define ossl_prov_cipher_hw_rc2_ofb128 ossl_prov_cipher_hw_rc2_ofb64
#define ossl_prov_cipher_hw_rc2_cfb128 ossl_prov_cipher_hw_rc2_cfb64
const PROV_CIPHER_HW *PROV_CIPHER_HW_rc2_cbc(size_t keybits);
const PROV_CIPHER_HW *PROV_CIPHER_HW_rc2_ecb(size_t keybits);
const PROV_CIPHER_HW *PROV_CIPHER_HW_rc2_ofb64(size_t keybits);
const PROV_CIPHER_HW *PROV_CIPHER_HW_rc2_cfb64(size_t keybits);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_rc2_cbc(size_t keybits);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_rc2_ecb(size_t keybits);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_rc2_ofb64(size_t keybits);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_rc2_cfb64(size_t keybits);
......@@ -32,7 +32,7 @@ static const PROV_CIPHER_HW rc2_##mode = { \
cipher_hw_rc2_initkey, \
cipher_hw_rc2_##mode##_cipher \
}; \
const PROV_CIPHER_HW *PROV_CIPHER_HW_rc2_##mode(size_t keybits) \
const PROV_CIPHER_HW *ossl_prov_cipher_hw_rc2_##mode(size_t keybits) \
{ \
return &rc2_##mode; \
}
......
......@@ -67,7 +67,7 @@ static void * alg##_##kbits##_newctx(void *provctx) \
ctx = OPENSSL_zalloc(sizeof(*ctx)); \
if (ctx != NULL) { \
cipher_generic_initkey(ctx, kbits, blkbits, ivbits, 0, flags, \
PROV_CIPHER_HW_##alg(kbits), NULL); \
ossl_prov_cipher_hw_##alg(kbits), NULL); \
} \
return ctx; \
} \
......
......@@ -18,4 +18,4 @@ typedef struct prov_rc4_ctx_st {
} ks;
} PROV_RC4_CTX;
const PROV_CIPHER_HW *PROV_CIPHER_HW_rc4(size_t keybits);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_rc4(size_t keybits);
......@@ -58,7 +58,7 @@ static void *rc4_hmac_md5_newctx(void *provctx)
RC4_HMAC_MD5_BLOCK_BITS,
RC4_HMAC_MD5_IV_BITS,
RC4_HMAC_MD5_MODE, RC4_HMAC_MD5_FLAGS,
PROV_CIPHER_HW_rc4_hmac_md5(RC4_HMAC_MD5_KEY_BITS),
ossl_prov_cipher_hw_rc4_hmac_md5(RC4_HMAC_MD5_KEY_BITS),
NULL);
return ctx;
}
......
......@@ -30,4 +30,4 @@ typedef struct prov_cipher_hw_rc4_hmac_md5_st {
} PROV_CIPHER_HW_RC4_HMAC_MD5;
const PROV_CIPHER_HW *PROV_CIPHER_HW_rc4_hmac_md5(size_t keybits);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_rc4_hmac_md5(size_t keybits);
......@@ -225,7 +225,8 @@ static const PROV_CIPHER_HW_RC4_HMAC_MD5 rc4_hmac_md5_hw = {
cipher_hw_rc4_hmac_md5_tls_init,
cipher_hw_rc4_hmac_md5_init_mackey
};
const PROV_CIPHER_HW *PROV_CIPHER_HW_rc4_hmac_md5(size_t keybits)
const PROV_CIPHER_HW *ossl_prov_cipher_hw_rc4_hmac_md5(size_t keybits)
{
return (PROV_CIPHER_HW *)&rc4_hmac_md5_hw;
}
......@@ -37,7 +37,7 @@ static const PROV_CIPHER_HW rc4_hw = {
cipher_hw_rc4_initkey,
cipher_hw_rc4_cipher
};
const PROV_CIPHER_HW *PROV_CIPHER_HW_rc4(size_t keybits)
const PROV_CIPHER_HW *ossl_prov_cipher_hw_rc4(size_t keybits)
{
return &rc4_hw;
}
......
......@@ -121,7 +121,8 @@ static void * alg##_##kbits##_##lcmode##_newctx(void *provctx) \
if (ctx != NULL) { \
cipher_generic_initkey(ctx, kbits, blkbits, ivbits, \
EVP_CIPH_##UCMODE##_MODE, flags, \
PROV_CIPHER_HW_##alg##_##lcmode(kbits), NULL); \
ossl_prov_cipher_hw_##alg##_##lcmode(kbits), \
NULL); \
ctx->rounds = RC5_12_ROUNDS; \
} \
return ctx; \
......
......@@ -19,7 +19,7 @@ typedef struct prov_blowfish_ctx_st {
unsigned int rounds; /* number of rounds */
} PROV_RC5_CTX;
const PROV_CIPHER_HW *PROV_CIPHER_HW_rc5_cbc(size_t keybits);
const PROV_CIPHER_HW *PROV_CIPHER_HW_rc5_ecb(size_t keybits);
const PROV_CIPHER_HW *PROV_CIPHER_HW_rc5_ofb64(size_t keybits);
const PROV_CIPHER_HW *PROV_CIPHER_HW_rc5_cfb64(size_t keybits);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_rc5_cbc(size_t keybits);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_rc5_ecb(size_t keybits);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_rc5_ofb64(size_t keybits);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_rc5_cfb64(size_t keybits);
......@@ -30,7 +30,7 @@ static const PROV_CIPHER_HW rc5_##mode = { \
cipher_hw_rc5_initkey, \
cipher_hw_rc5_##mode##_cipher \
}; \
const PROV_CIPHER_HW *PROV_CIPHER_HW_rc5_##mode(size_t keybits) \
const PROV_CIPHER_HW *ossl_prov_cipher_hw_rc5_##mode(size_t keybits) \
{ \
return &rc5_##mode; \
}
......
......@@ -18,7 +18,7 @@ typedef struct prov_seed_ctx_st {
} ks;
} PROV_SEED_CTX;
const PROV_CIPHER_HW *PROV_CIPHER_HW_seed_cbc(size_t keybits);
const PROV_CIPHER_HW *PROV_CIPHER_HW_seed_ecb(size_t keybits);
const PROV_CIPHER_HW *PROV_CIPHER_HW_seed_ofb128(size_t keybits);
const PROV_CIPHER_HW *PROV_CIPHER_HW_seed_cfb128(size_t keybits);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_seed_cbc(size_t keybits);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_seed_ecb(size_t keybits);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_seed_ofb128(size_t keybits);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_seed_cfb128(size_t keybits);
......@@ -31,7 +31,7 @@ static const PROV_CIPHER_HW seed_##mode = { \
cipher_hw_seed_initkey, \
cipher_hw_seed_##mode##_cipher \
}; \
const PROV_CIPHER_HW *PROV_CIPHER_HW_seed_##mode(size_t keybits) \
const PROV_CIPHER_HW *ossl_prov_cipher_hw_seed_##mode(size_t keybits) \
{ \
return &seed_##mode; \
}
......
......@@ -18,8 +18,8 @@ typedef struct prov_cast_ctx_st {
} ks;
} PROV_SM4_CTX;
const PROV_CIPHER_HW *PROV_CIPHER_HW_sm4_cbc(size_t keybits);
const PROV_CIPHER_HW *PROV_CIPHER_HW_sm4_ecb(size_t keybits);
const PROV_CIPHER_HW *PROV_CIPHER_HW_sm4_ctr(size_t keybits);
const PROV_CIPHER_HW *PROV_CIPHER_HW_sm4_ofb128(size_t keybits);
const PROV_CIPHER_HW *PROV_CIPHER_HW_sm4_cfb128(size_t keybits);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_sm4_cbc(size_t keybits);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_sm4_ecb(size_t keybits);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_sm4_ctr(size_t keybits);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_sm4_ofb128(size_t keybits);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_sm4_cfb128(size_t keybits);
......@@ -34,7 +34,7 @@ static const PROV_CIPHER_HW sm4_##mode = { \
cipher_hw_chunked_##mode, \
cipher_hw_sm4_copyctx \
}; \
const PROV_CIPHER_HW *PROV_CIPHER_HW_sm4_##mode(size_t keybits) \
const PROV_CIPHER_HW *ossl_prov_cipher_hw_sm4_##mode(size_t keybits) \
{ \
return &sm4_##mode; \
}
......
......@@ -36,7 +36,8 @@ 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, PROV_CIPHER_HW_tdes_##type##_##lcmode());\
ivbits, flags, \
ossl_prov_cipher_hw_tdes_##type##_##lcmode()); \
} \
static OSSL_FUNC_cipher_get_params_fn tdes_##type##_##lcmode##_get_params; \
static int tdes_##type##_##lcmode##_get_params(OSSL_PARAM params[]) \
......@@ -84,7 +85,7 @@ static const PROV_CIPHER_HW type##_##mode = { \
cipher_hw_tdes_##mode, \
cipher_hw_tdes_copyctx \
}; \
const PROV_CIPHER_HW *PROV_CIPHER_HW_tdes_##type##_##mode(void) \
const PROV_CIPHER_HW *ossl_prov_cipher_hw_tdes_##type##_##mode(void) \
{ \
return &type##_##mode; \
}
......@@ -97,5 +98,5 @@ int cipher_hw_tdes_cbc(PROV_CIPHER_CTX *ctx, unsigned char *out,
int cipher_hw_tdes_ecb(PROV_CIPHER_CTX *ctx, unsigned char *out,
const unsigned char *in, size_t len);
const PROV_CIPHER_HW *PROV_CIPHER_HW_tdes_ede3_cbc(void);
const PROV_CIPHER_HW *PROV_CIPHER_HW_tdes_ede3_ecb(void);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_tdes_ede3_cbc(void);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_tdes_ede3_ecb(void);
......@@ -10,16 +10,16 @@
#include "prov/ciphercommon.h"
#include "cipher_tdes.h"
const PROV_CIPHER_HW *PROV_CIPHER_HW_tdes_ede3_ofb(void);
const PROV_CIPHER_HW *PROV_CIPHER_HW_tdes_ede3_cfb(void);
const PROV_CIPHER_HW *PROV_CIPHER_HW_tdes_ede3_cfb1(void);
const PROV_CIPHER_HW *PROV_CIPHER_HW_tdes_ede3_cfb8(void);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_tdes_ede3_ofb(void);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_tdes_ede3_cfb(void);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_tdes_ede3_cfb1(void);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_tdes_ede3_cfb8(void);
const PROV_CIPHER_HW *PROV_CIPHER_HW_tdes_ede2_cbc(void);
const PROV_CIPHER_HW *PROV_CIPHER_HW_tdes_ede2_ecb(void);
const PROV_CIPHER_HW *PROV_CIPHER_HW_tdes_ede2_ofb(void);
const PROV_CIPHER_HW *PROV_CIPHER_HW_tdes_ede2_cfb(void);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_tdes_ede2_cbc(void);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_tdes_ede2_ecb(void);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_tdes_ede2_ofb(void);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_tdes_ede2_cfb(void);
const PROV_CIPHER_HW *PROV_CIPHER_HW_tdes_desx_cbc(void);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_tdes_desx_cbc(void);
const PROV_CIPHER_HW *PROV_CIPHER_HW_tdes_wrap_cbc(void);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_tdes_wrap_cbc(void);
......@@ -175,7 +175,7 @@ static OSSL_FUNC_cipher_newctx_fn tdes_wrap_newctx; \
static void *tdes_wrap_newctx(void *provctx) \
{ \
return tdes_newctx(provctx, EVP_CIPH_WRAP_MODE, kbits, blkbits, ivbits, \
flags, PROV_CIPHER_HW_tdes_wrap_cbc()); \
flags, ossl_prov_cipher_hw_tdes_wrap_cbc()); \
} \
static OSSL_FUNC_cipher_get_params_fn tdes_wrap_get_params; \
static int tdes_wrap_get_params(OSSL_PARAM params[]) \
......
......@@ -778,7 +778,7 @@ static const OSSL_PARAM *key2any_settable_ctx_params(ossl_unused void *provctx)
static int key2any_set_ctx_params(void *vctx, const OSSL_PARAM params[])
{
struct key2any_ctx_st *ctx = vctx;
OPENSSL_CTX *libctx = PROV_CTX_get0_library_context(ctx->provctx);
OPENSSL_CTX *libctx = ossl_prov_ctx_get0_library_context(ctx->provctx);
const OSSL_PARAM *cipherp =
OSSL_PARAM_locate_const(params, OSSL_ENCODER_PARAM_CIPHER);
const OSSL_PARAM *propsp =
......
......@@ -186,7 +186,7 @@ static void * alg##_##kbits##_##lcmode##_newctx(void *provctx) \
if (ctx != NULL) { \
cipher_generic_initkey(ctx, kbits, blkbits, ivbits, \
EVP_CIPH_##UCMODE##_MODE, flags, \
PROV_CIPHER_HW_##alg##_##lcmode(kbits), \
ossl_prov_cipher_hw_##alg##_##lcmode(kbits), \
provctx); \
} \
return ctx; \
......
......@@ -136,7 +136,7 @@ static unsigned int get_parent_reseed_count(PROV_DRBG *drbg)
* Implements the get_entropy() callback
*
* If the DRBG has a parent, then the required amount of entropy input
* is fetched using the parent's PROV_DRBG_generate().
* is fetched using the parent's ossl_prov_drbg_generate().
*
* Otherwise, the entropy is polled from the system entropy sources
* using prov_pool_acquire_entropy().
......@@ -390,9 +390,9 @@ static void prov_drbg_clear_nonce(PROV_DRBG *drbg, unsigned char *nonce,
*
* Returns 1 on success, 0 on failure.
*/
int PROV_DRBG_instantiate(PROV_DRBG *drbg, unsigned int strength,
int prediction_resistance,
const unsigned char *pers, size_t perslen)
int ossl_prov_drbg_instantiate(PROV_DRBG *drbg, unsigned int strength,
int prediction_resistance,
const unsigned char *pers, size_t perslen)
{
unsigned char *nonce = NULL, *entropy = NULL;
size_t noncelen = 0, entropylen = 0;
......@@ -520,7 +520,7 @@ int PROV_DRBG_instantiate(PROV_DRBG *drbg, unsigned int strength,
*
* Returns 1 on success, 0 on failure.
*/
int PROV_DRBG_uninstantiate(PROV_DRBG *drbg)
int ossl_prov_drbg_uninstantiate(PROV_DRBG *drbg)
{
drbg->state = EVP_RAND_STATE_UNINITIALISED;
return 1;
......@@ -533,9 +533,9 @@ int PROV_DRBG_uninstantiate(PROV_DRBG *drbg)
*
* Returns 1 on success, 0 on failure.
*/
int PROV_DRBG_reseed(PROV_DRBG *drbg, int prediction_resistance,
const unsigned char *ent, size_t ent_len,
const unsigned char *adin, size_t adinlen)
int ossl_prov_drbg_reseed(PROV_DRBG *drbg, int prediction_resistance,
const unsigned char *ent, size_t ent_len,
const unsigned char *adin, size_t adinlen)
{
unsigned char *entropy = NULL;
size_t entropylen = 0;
......@@ -647,9 +647,9 @@ int PROV_DRBG_reseed(PROV_DRBG *drbg, int prediction_resistance,
* Returns 1 on success, 0 on failure.
*
*/
int PROV_DRBG_generate(PROV_DRBG *drbg, unsigned char *out, size_t outlen,
unsigned int strength, int prediction_resistance,
const unsigned char *adin, size_t adinlen)
int ossl_prov_drbg_generate(PROV_DRBG *drbg, unsigned char *out, size_t outlen,
unsigned int strength, int prediction_resistance,
const unsigned char *adin, size_t adinlen)
{
int fork_id;
int reseed_required = 0;
......@@ -706,8 +706,8 @@ int PROV_DRBG_generate(PROV_DRBG *drbg, unsigned char *out, size_t outlen,
reseed_required = 1;
if (reseed_required || prediction_resistance) {
if (!PROV_DRBG_reseed(drbg, prediction_resistance, NULL, 0,
adin, adinlen)) {
if (!ossl_prov_drbg_reseed(drbg, prediction_resistance, NULL, 0,
adin, adinlen)) {
PROVerr(0, PROV_R_RESEED_ERROR);
return 0;
}
......@@ -760,7 +760,7 @@ static int rand_drbg_restart(PROV_DRBG *drbg)
/* repair uninitialized state */
if (drbg->state == EVP_RAND_STATE_UNINITIALISED)
/* reinstantiate drbg */
PROV_DRBG_instantiate(drbg, drbg->strength, 0, NULL, 0);
ossl_prov_drbg_instantiate(drbg, drbg->strength, 0, NULL, 0);
rand_pool_free(drbg->seed_pool);
drbg->seed_pool = NULL;
......
......@@ -330,8 +330,8 @@ static int drbg_ctr_instantiate_wrapper(void *vdrbg, unsigned int strength,
{
PROV_DRBG *drbg = (PROV_DRBG *)vdrbg;
return PROV_DRBG_instantiate(drbg, strength, prediction_resistance,
pstr, pstr_len);
return ossl_prov_drbg_instantiate(drbg, strength, prediction_resistance,
pstr, pstr_len);
}
static int drbg_ctr_reseed(PROV_DRBG *drbg,
......@@ -355,8 +355,8 @@ static int drbg_ctr_reseed_wrapper(void *vdrbg, int prediction_resistance,
{
PROV_DRBG *drbg = (PROV_DRBG *)vdrbg;
return PROV_DRBG_reseed(drbg, prediction_resistance, ent, ent_len,
adin, adin_len);
return ossl_prov_drbg_reseed(drbg, prediction_resistance, ent, ent_len,
adin, adin_len);
}
static void ctr96_inc(unsigned char *counter)
......@@ -452,8 +452,8 @@ static int drbg_ctr_generate_wrapper
{
PROV_DRBG *drbg = (PROV_DRBG *)vdrbg;
return PROV_DRBG_generate(drbg, out, outlen, strength,
prediction_resistance, adin, adin_len);
return ossl_prov_drbg_generate(drbg, out, outlen, strength,
prediction_resistance, adin, adin_len);
}
static int drbg_ctr_uninstantiate(PROV_DRBG *drbg)
......@@ -465,7 +465,7 @@ static int drbg_ctr_uninstantiate(PROV_DRBG *drbg)
OPENSSL_cleanse(ctr->bltmp, sizeof(ctr->bltmp));
OPENSSL_cleanse(ctr->KX, sizeof(ctr->KX));
ctr->bltmp_pos = 0;
return PROV_DRBG_uninstantiate(drbg);
return ossl_prov_drbg_uninstantiate(drbg);
}
static int drbg_ctr_uninstantiate_wrapper(void *vdrbg)
......
......@@ -270,8 +270,8 @@ static int drbg_hash_instantiate_wrapper(void *vdrbg, unsigned int strength,
{
PROV_DRBG *drbg = (PROV_DRBG *)vdrbg;
return PROV_DRBG_instantiate(drbg, strength, prediction_resistance,
pstr, pstr_len);
return ossl_prov_drbg_instantiate(drbg, strength, prediction_resistance,
pstr, pstr_len);
}
/*
......@@ -304,8 +304,8 @@ static int drbg_hash_reseed_wrapper(void *vdrbg, int prediction_resistance,
{
PROV_DRBG *drbg = (PROV_DRBG *)vdrbg;
return PROV_DRBG_reseed(drbg, prediction_resistance, ent, ent_len,
adin, adin_len);
return ossl_prov_drbg_reseed(drbg, prediction_resistance, ent, ent_len,
adin, adin_len);
}
/*
......@@ -352,8 +352,8 @@ static int drbg_hash_generate_wrapper
{
PROV_DRBG *drbg = (PROV_DRBG *)vdrbg;
return PROV_DRBG_generate(drbg, out, outlen, strength,
prediction_resistance, adin, adin_len);
return ossl_prov_drbg_generate(drbg, out, outlen, strength,
prediction_resistance, adin, adin_len);
}
static int drbg_hash_uninstantiate(PROV_DRBG *drbg)
......@@ -363,7 +363,7 @@ static int drbg_hash_uninstantiate(PROV_DRBG *drbg)
OPENSSL_cleanse(hash->V, sizeof(hash->V));
OPENSSL_cleanse(hash->C, sizeof(hash->C));
OPENSSL_cleanse(hash->vtmp, sizeof(hash->vtmp));
return PROV_DRBG_uninstantiate(drbg);
return ossl_prov_drbg_uninstantiate(drbg);
}
static int drbg_hash_uninstantiate_wrapper(void *vdrbg)
......
......@@ -154,8 +154,8 @@ static int drbg_hmac_instantiate_wrapper(void *vdrbg, unsigned int strength,
{
PROV_DRBG *drbg = (PROV_DRBG *)vdrbg;
return PROV_DRBG_instantiate(drbg, strength, prediction_resistance,
pstr, pstr_len);
return ossl_prov_drbg_instantiate(drbg, strength, prediction_resistance,
pstr, pstr_len);
}
/*
......@@ -182,8 +182,8 @@ static int drbg_hmac_reseed_wrapper(void *vdrbg, int prediction_resistance,
{
PROV_DRBG *drbg = (PROV_DRBG *)vdrbg;
return PROV_DRBG_reseed(drbg, prediction_resistance, ent, ent_len,
adin, adin_len);
return ossl_prov_drbg_reseed(drbg, prediction_resistance, ent, ent_len,
adin, adin_len);
}
/*
......@@ -251,8 +251,8 @@ static int drbg_hmac_generate_wrapper
{
PROV_DRBG *drbg = (PROV_DRBG *)vdrbg;
return PROV_DRBG_generate(drbg, out, outlen, strength,
prediction_resistance, adin, adin_len);
return ossl_prov_drbg_generate(drbg, out, outlen, strength,
prediction_resistance, adin, adin_len);
}
static int drbg_hmac_uninstantiate(PROV_DRBG *drbg)
......@@ -261,7 +261,7 @@ static int drbg_hmac_uninstantiate(PROV_DRBG *drbg)
OPENSSL_cleanse(hmac->K, sizeof(hmac->K));
OPENSSL_cleanse(hmac->V, sizeof(hmac->V));
return PROV_DRBG_uninstantiate(drbg);
return ossl_prov_drbg_uninstantiate(drbg);
}
static int drbg_hmac_uninstantiate_wrapper(void *vdrbg)
......
......@@ -205,19 +205,19 @@ PROV_DRBG *prov_rand_drbg_new
const unsigned char *adin, size_t adin_len));
void prov_rand_drbg_free(PROV_DRBG *drbg);
int PROV_DRBG_instantiate(PROV_DRBG *drbg, unsigned int strength,
int prediction_resistance,
const unsigned char *pers, size_t perslen);
int ossl_prov_drbg_instantiate(PROV_DRBG *drbg, unsigned int strength,
int prediction_resistance,
const unsigned char *pers, size_t perslen);
int PROV_DRBG_uninstantiate(PROV_DRBG *drbg);
int ossl_prov_drbg_uninstantiate(PROV_DRBG *drbg);
int PROV_DRBG_reseed(PROV_DRBG *drbg, int prediction_resistance,
const unsigned char *ent, size_t ent_len,
const unsigned char *adin, size_t adinlen);
int ossl_prov_drbg_reseed(PROV_DRBG *drbg, int prediction_resistance,
const unsigned char *ent, size_t ent_len,
const unsigned char *adin, size_t adinlen);
int PROV_DRBG_generate(PROV_DRBG *drbg, unsigned char *out, size_t outlen,
unsigned int strength, int prediction_resistance,
const unsigned char *adin, size_t adinlen);
int ossl_prov_drbg_generate(PROV_DRBG *drbg, unsigned char *out, size_t outlen,
unsigned int strength, int prediction_resistance,
const unsigned char *adin, size_t adinlen);
/* Verify that an array of numeric values is all zero */
#define PROV_DRBG_VERYIFY_ZEROIZATION(v) \
......
......@@ -94,8 +94,8 @@ static int test_rng_instantiate_wrapper(void *vdrbg, unsigned int strength,
if (pstr != NULL && pstr_len >= drbg->max_perslen)
return 0;
return PROV_DRBG_instantiate(drbg, strength, prediction_resistance,
pstr, pstr_len);
return ossl_prov_drbg_instantiate(drbg, strength, prediction_resistance,
pstr, pstr_len);
}
static int test_rng_uninstantiate(PROV_DRBG *drbg)
......@@ -103,7 +103,7 @@ static int test_rng_uninstantiate(PROV_DRBG *drbg)
PROV_TEST_RNG *t = (PROV_TEST_RNG *)drbg->data;
t->entropy_pos = 0;
return PROV_DRBG_uninstantiate(drbg);
return ossl_prov_drbg_uninstantiate(drbg);
}
static int test_rng_uninstantiate_wrapper(void *vdrbg)
......
......@@ -530,7 +530,7 @@ void file_load_cleanup(void *construct_data)
static int file_setup_decoders(struct file_ctx_st *ctx)
{
EVP_PKEY *dummy; /* for OSSL_DECODER_CTX_new_by_EVP_PKEY() */
OPENSSL_CTX *libctx = PROV_CTX_get0_library_context(ctx->provctx);
OPENSSL_CTX *libctx = ossl_prov_ctx_get0_library_context(ctx->provctx);
OSSL_DECODER *to_obj = NULL; /* Last resort decoder */
OSSL_DECODER_INSTANCE *to_obj_inst = NULL;
OSSL_DECODER_CLEANUP *old_cleanup = NULL;
......
......@@ -162,7 +162,7 @@ static const OSSL_ALGORITHM *legacy_query(void *provctx, int operation_id,
static void legacy_teardown(void *provctx)
{
OPENSSL_CTX_free(PROV_LIBRARY_CONTEXT_OF(provctx));
PROV_CTX_free(provctx);
ossl_prov_ctx_free(provctx);
}
/* Functions we provide to the core */
......@@ -202,15 +202,15 @@ int OSSL_provider_init(const OSSL_CORE_HANDLE *handle,
if (c_get_libctx == NULL)
return 0;
if ((*provctx = PROV_CTX_new()) == NULL
if ((*provctx = ossl_prov_ctx_new()) == NULL
|| (libctx = OPENSSL_CTX_new()) == NULL) {
OPENSSL_CTX_free(libctx);
legacy_teardown(*provctx);
*provctx = NULL;
return 0;
}
PROV_CTX_set0_library_context(*provctx, libctx);
PROV_CTX_set0_handle(*provctx, handle);
ossl_prov_ctx_set0_library_context(*provctx, libctx);
ossl_prov_ctx_set0_handle(*provctx, handle);
*out = legacy_dispatch_table;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册