2019-08-26 15:05:08 +08:00
|
|
|
/*
|
2022-05-03 18:52:38 +08:00
|
|
|
* Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.
|
2019-08-26 15:05:08 +08:00
|
|
|
*
|
|
|
|
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
|
|
|
* this file except in compliance with the License. You can obtain a copy
|
|
|
|
* in the file LICENSE in the source distribution or at
|
|
|
|
* https://www.openssl.org/source/license.html
|
|
|
|
*/
|
|
|
|
|
2022-02-10 02:30:25 +08:00
|
|
|
#ifndef OSSL_PROV_CIPHERCOMMON_AEAD_H
|
|
|
|
# define OSSL_PROV_CIPHERCOMMON_AEAD_H
|
|
|
|
# pragma once
|
2019-09-05 09:23:57 +08:00
|
|
|
|
2022-02-10 02:30:25 +08:00
|
|
|
# define UNINITIALISED_SIZET ((size_t)-1)
|
2019-08-26 15:05:08 +08:00
|
|
|
|
2022-02-10 02:30:25 +08:00
|
|
|
# define AEAD_FLAGS (PROV_CIPHER_FLAG_AEAD | PROV_CIPHER_FLAG_CUSTOM_IV)
|
|
|
|
|
|
|
|
# define IMPLEMENT_aead_cipher(alg, lc, UCMODE, flags, kbits, blkbits, ivbits) \
|
2020-12-17 14:39:57 +08:00
|
|
|
static OSSL_FUNC_cipher_get_params_fn alg##_##kbits##_##lc##_get_params; \
|
2019-08-26 15:05:08 +08:00
|
|
|
static int alg##_##kbits##_##lc##_get_params(OSSL_PARAM params[]) \
|
|
|
|
{ \
|
2020-12-17 14:39:57 +08:00
|
|
|
return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \
|
Fix external symbols in the provider cipher implementations.
Partial fix for #12964
This add ossl_ names for the following symbols.
chacha20_dinit, chacha20_einit, chacha20_initctx,
ccm_cipher, ccm_dinit, ccm_einit, ccm_generic_auth_decrypt, ccm_generic_auth_encrypt,
ccm_generic_gettag, ccm_generic_setaad, ccm_generic_setiv, ccm_get_ctx_params,
ccm_initctx, ccm_set_ctx_params, ccm_stream_final, ccm_stream_update
gcm_aad_update, gcm_cipher, gcm_cipher_final, gcm_cipher_update
gcm_dinit, gcm_einit, gcm_get_ctx_params, gcm_initctx, gcm_one_shot
gcm_set_ctx_params, gcm_setiv, gcm_stream_final, gcm_stream_update
tdes_dinit, tdes_dupctx, tdes_einit, tdes_freectx
tdes_get_ctx_params, tdes_gettable_ctx_params, tdes_newctx
PROV_CIPHER_HW_des_*,
padblock, unpadblock, tlsunpadblock, fillblock, trailingdata
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14209)
2021-02-17 15:54:29 +08:00
|
|
|
flags, kbits, blkbits, ivbits); \
|
2019-08-26 15:05:08 +08:00
|
|
|
} \
|
2020-12-17 14:39:57 +08:00
|
|
|
static OSSL_FUNC_cipher_newctx_fn alg##kbits##lc##_newctx; \
|
2019-08-26 15:05:08 +08:00
|
|
|
static void * alg##kbits##lc##_newctx(void *provctx) \
|
|
|
|
{ \
|
|
|
|
return alg##_##lc##_newctx(provctx, kbits); \
|
|
|
|
} \
|
2020-09-28 10:28:29 +08:00
|
|
|
const OSSL_DISPATCH ossl_##alg##kbits##lc##_functions[] = { \
|
2019-08-26 15:05:08 +08:00
|
|
|
{ OSSL_FUNC_CIPHER_NEWCTX, (void (*)(void))alg##kbits##lc##_newctx }, \
|
|
|
|
{ OSSL_FUNC_CIPHER_FREECTX, (void (*)(void))alg##_##lc##_freectx }, \
|
Fix external symbols in the provider cipher implementations.
Partial fix for #12964
This add ossl_ names for the following symbols.
chacha20_dinit, chacha20_einit, chacha20_initctx,
ccm_cipher, ccm_dinit, ccm_einit, ccm_generic_auth_decrypt, ccm_generic_auth_encrypt,
ccm_generic_gettag, ccm_generic_setaad, ccm_generic_setiv, ccm_get_ctx_params,
ccm_initctx, ccm_set_ctx_params, ccm_stream_final, ccm_stream_update
gcm_aad_update, gcm_cipher, gcm_cipher_final, gcm_cipher_update
gcm_dinit, gcm_einit, gcm_get_ctx_params, gcm_initctx, gcm_one_shot
gcm_set_ctx_params, gcm_setiv, gcm_stream_final, gcm_stream_update
tdes_dinit, tdes_dupctx, tdes_einit, tdes_freectx
tdes_get_ctx_params, tdes_gettable_ctx_params, tdes_newctx
PROV_CIPHER_HW_des_*,
padblock, unpadblock, tlsunpadblock, fillblock, trailingdata
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14209)
2021-02-17 15:54:29 +08:00
|
|
|
{ OSSL_FUNC_CIPHER_ENCRYPT_INIT, (void (*)(void))ossl_##lc##_einit }, \
|
|
|
|
{ OSSL_FUNC_CIPHER_DECRYPT_INIT, (void (*)(void))ossl_##lc##_dinit }, \
|
|
|
|
{ OSSL_FUNC_CIPHER_UPDATE, (void (*)(void))ossl_##lc##_stream_update }, \
|
|
|
|
{ OSSL_FUNC_CIPHER_FINAL, (void (*)(void))ossl_##lc##_stream_final }, \
|
|
|
|
{ OSSL_FUNC_CIPHER_CIPHER, (void (*)(void))ossl_##lc##_cipher }, \
|
2019-08-26 15:05:08 +08:00
|
|
|
{ OSSL_FUNC_CIPHER_GET_PARAMS, \
|
|
|
|
(void (*)(void)) alg##_##kbits##_##lc##_get_params }, \
|
|
|
|
{ OSSL_FUNC_CIPHER_GET_CTX_PARAMS, \
|
Fix external symbols in the provider cipher implementations.
Partial fix for #12964
This add ossl_ names for the following symbols.
chacha20_dinit, chacha20_einit, chacha20_initctx,
ccm_cipher, ccm_dinit, ccm_einit, ccm_generic_auth_decrypt, ccm_generic_auth_encrypt,
ccm_generic_gettag, ccm_generic_setaad, ccm_generic_setiv, ccm_get_ctx_params,
ccm_initctx, ccm_set_ctx_params, ccm_stream_final, ccm_stream_update
gcm_aad_update, gcm_cipher, gcm_cipher_final, gcm_cipher_update
gcm_dinit, gcm_einit, gcm_get_ctx_params, gcm_initctx, gcm_one_shot
gcm_set_ctx_params, gcm_setiv, gcm_stream_final, gcm_stream_update
tdes_dinit, tdes_dupctx, tdes_einit, tdes_freectx
tdes_get_ctx_params, tdes_gettable_ctx_params, tdes_newctx
PROV_CIPHER_HW_des_*,
padblock, unpadblock, tlsunpadblock, fillblock, trailingdata
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14209)
2021-02-17 15:54:29 +08:00
|
|
|
(void (*)(void)) ossl_##lc##_get_ctx_params }, \
|
2019-08-26 15:05:08 +08:00
|
|
|
{ OSSL_FUNC_CIPHER_SET_CTX_PARAMS, \
|
Fix external symbols in the provider cipher implementations.
Partial fix for #12964
This add ossl_ names for the following symbols.
chacha20_dinit, chacha20_einit, chacha20_initctx,
ccm_cipher, ccm_dinit, ccm_einit, ccm_generic_auth_decrypt, ccm_generic_auth_encrypt,
ccm_generic_gettag, ccm_generic_setaad, ccm_generic_setiv, ccm_get_ctx_params,
ccm_initctx, ccm_set_ctx_params, ccm_stream_final, ccm_stream_update
gcm_aad_update, gcm_cipher, gcm_cipher_final, gcm_cipher_update
gcm_dinit, gcm_einit, gcm_get_ctx_params, gcm_initctx, gcm_one_shot
gcm_set_ctx_params, gcm_setiv, gcm_stream_final, gcm_stream_update
tdes_dinit, tdes_dupctx, tdes_einit, tdes_freectx
tdes_get_ctx_params, tdes_gettable_ctx_params, tdes_newctx
PROV_CIPHER_HW_des_*,
padblock, unpadblock, tlsunpadblock, fillblock, trailingdata
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14209)
2021-02-17 15:54:29 +08:00
|
|
|
(void (*)(void)) ossl_##lc##_set_ctx_params }, \
|
2019-08-26 15:05:08 +08:00
|
|
|
{ OSSL_FUNC_CIPHER_GETTABLE_PARAMS, \
|
2020-12-17 14:39:57 +08:00
|
|
|
(void (*)(void))ossl_cipher_generic_gettable_params }, \
|
2019-08-26 15:05:08 +08:00
|
|
|
{ OSSL_FUNC_CIPHER_GETTABLE_CTX_PARAMS, \
|
2020-12-17 14:39:57 +08:00
|
|
|
(void (*)(void))ossl_cipher_aead_gettable_ctx_params }, \
|
2019-08-26 15:05:08 +08:00
|
|
|
{ OSSL_FUNC_CIPHER_SETTABLE_CTX_PARAMS, \
|
2020-12-17 14:39:57 +08:00
|
|
|
(void (*)(void))ossl_cipher_aead_settable_ctx_params }, \
|
2019-08-26 15:05:08 +08:00
|
|
|
{ 0, NULL } \
|
|
|
|
}
|
2022-02-10 02:30:25 +08:00
|
|
|
|
|
|
|
#endif
|