Skip to content

Commit

Permalink
QAT_HW AES-CCM Provider support.
Browse files Browse the repository at this point in the history
AES-128-CCM, AES-192-CCM & AES256-CCM provider support

Signed-off-by: Premkumar Shanmugam <premkumarx.shanmugam@intel.com>
  • Loading branch information
Premkumarx authored and Yogaraj-Alamenda committed Mar 26, 2024
1 parent a8dd7d1 commit a95d1a0
Show file tree
Hide file tree
Showing 24 changed files with 1,470 additions and 68 deletions.
4 changes: 3 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ if QAT_PROVIDER
qat_prov_sm4_gcm.c \
qat_prov_sm4_ccm.c \
qat_prov_sm4_cbc.c \
qat_prov_sm3.c
qat_prov_sm3.c \
qat_prov_aes_ccm.c


if QAT_FIPS
QAT_FIPS_SRC = qat_fips.c \
Expand Down
1 change: 1 addition & 0 deletions docs/qat_common.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ and the default if not specified will use engine interface.
| SM4-CCM (BabaSSL only) | QAT_SW |
| SM4-CBC | QAT_HW & QAT_SW |
| SM3 | QAT_HW & QAT_SW |
| AES-CCM | QAT_HW |

This support is added as an experimental feature and tested with
OpenSSL Speed and testapp only and not tested with any application.
Expand Down
4 changes: 4 additions & 0 deletions e_qat.c
Original file line number Diff line number Diff line change
Expand Up @@ -1372,6 +1372,10 @@ int bind_qat(ENGINE *e, const char *id)
qat_sw_sm3_offload = 1;
INFO("QAT_SW SM3 for Provider Enabled\n");
# endif
# ifdef ENABLE_QAT_HW_CCM
qat_hw_aes_ccm_offload = 1;
INFO("QAT_HW AES-CCM for Provider Enabled\n");
# endif
#endif

#ifndef QAT_BORINGSSL
Expand Down
1 change: 1 addition & 0 deletions e_qat.h
Original file line number Diff line number Diff line change
Expand Up @@ -927,6 +927,7 @@ int qat_sw_cpu_support(void);
# endif

# ifdef QAT_OPENSSL_PROVIDER
typedef _Atomic int CRYPTO_REF_COUNT;
static __inline__ int CRYPTO_UP_REF(int *val, int *ret, ossl_unused void *lock)
{
*ret = __atomic_fetch_add(val, 1, __ATOMIC_RELAXED) + 1;
Expand Down
4 changes: 4 additions & 0 deletions qat_evp.c
Original file line number Diff line number Diff line change
Expand Up @@ -938,15 +938,19 @@ const EVP_CIPHER *qat_create_ccm_cipher_meth(int nid, int keylen)
#endif
res &= EVP_CIPHER_meth_set_iv_length(c, AES_CCM_IV_LEN);
res &= EVP_CIPHER_meth_set_flags(c, QAT_CCM_FLAGS);
#ifndef QAT_OPENSSL_PROVIDER
res &= EVP_CIPHER_meth_set_init(c, qat_aes_ccm_init);
res &= EVP_CIPHER_meth_set_do_cipher(c, qat_aes_ccm_cipher);
res &= EVP_CIPHER_meth_set_cleanup(c, qat_aes_ccm_cleanup);
#endif
res &= EVP_CIPHER_meth_set_impl_ctx_size(c, sizeof(qat_ccm_ctx));
res &= EVP_CIPHER_meth_set_set_asn1_params(c, EVP_CIPH_FLAG_DEFAULT_ASN1 ?
NULL : EVP_CIPHER_set_asn1_iv);
res &= EVP_CIPHER_meth_set_get_asn1_params(c, EVP_CIPH_FLAG_DEFAULT_ASN1 ?
NULL : EVP_CIPHER_get_asn1_iv);
#ifndef QAT_OPENSSL_PROVIDER
res &= EVP_CIPHER_meth_set_ctrl(c, qat_aes_ccm_ctrl);
#endif
if (0 == res) {
WARN("Failed to set cipher methods for nid %d\n", nid);
EVP_CIPHER_meth_free(c);
Expand Down

0 comments on commit a95d1a0

Please sign in to comment.