Skip to content

Commit

Permalink
Add provider support for SM4-CCM.
Browse files Browse the repository at this point in the history
Signed-off-by: Premkumar Shanmugam <[email protected]>
  • Loading branch information
Premkumarx authored and Yogaraj-Alamenda committed Sep 17, 2023
1 parent 58b78e9 commit fe247d8
Show file tree
Hide file tree
Showing 20 changed files with 2,213 additions and 1,141 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_chachapoly.c \
qat_prov_sign_sm2.c \
qat_prov_hkdf_packet.c \
qat_prov_sm4_gcm.c
qat_prov_sm4_gcm.c \
qat_prov_sm4_ccm.c

if QAT_FIPS
QAT_FIPS_SRC = qat_fips.c \
qat_self_test_kats.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 @@ -152,6 +152,7 @@ and the default if not specified will use engine interface.
| SHA3-512 | QAT_HW |
| ChachaPoly | QAT_HW |
| SM4-GCM (BabaSSL only) | QAT_SW |
| SM4-CCM (BabaSSL only) | QAT_SW |

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 @@ -1289,6 +1289,10 @@ int bind_qat(ENGINE *e, const char *id)
if (qat_sw_sm4_gcm_offload)
INFO("QAT_SW SM4-GCM for Provider Enabled\n");
# endif
# ifdef ENABLE_QAT_SW_SM4_CCM
if (qat_sw_sm4_ccm_offload)
INFO("QAT_SW SM4-CCM for Provider Enabled\n");
# endif
#endif

#ifndef QAT_BORINGSSL
Expand Down
418 changes: 210 additions & 208 deletions e_qat.txt

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions e_qat_err.c
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ static ERR_STRING_DATA QAT_str_reasons[] = {
{ERR_PACK(0, 0, QAT_R_INVALID_ATTACHED_TAG), "invalid attached tag"},
{ERR_PACK(0, 0, QAT_R_INVALID_CTRL_TYPE), "invalid ctrl type"},
{ERR_PACK(0, 0, QAT_R_INVALID_CURVE), "invalid curve"},
{ERR_PACK(0, 0, QAT_R_INVALID_DATA), "invalid data"},
{ERR_PACK(0, 0, QAT_R_INVALID_HASH_DATA), "invalid hash data"},
{ERR_PACK(0, 0, QAT_R_INVALID_INPUT), "invalid input"},
{ERR_PACK(0, 0, QAT_R_INVALID_INPUT_LENGTH), "invalid input length"},
Expand Down Expand Up @@ -610,6 +611,7 @@ static ERR_STRING_DATA QAT_str_reasons[] = {
{ERR_PACK(0, 0, QAT_R_S_NULL), "s null"},
{ERR_PACK(0, 0, QAT_R_S_Q_COMPARE_FAILURE), "s q compare failure"},
{ERR_PACK(0, 0, QAT_R_TAG_NOTSET), "tag notset"},
{ERR_PACK(0, 0, QAT_R_TAG_NOT_NEEDED), "tag not needed"},
{ERR_PACK(0, 0, QAT_R_UNKNOWN_PADDING), "unknown padding"},
{ERR_PACK(0, 0, QAT_R_UNKNOWN_PADDING_TYPE), "unknown padding type"},
{ERR_PACK(0, 0, QAT_R_WAKE_PAUSE_JOB_FAILURE), "wake pause job failure"},
Expand Down
418 changes: 210 additions & 208 deletions e_qat_err.h

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions qat_bssl_err.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ static ERR_STRING_DATA QAT_str_reasons[] = {
{ERR_PACK(0, 0, QAT_R_CAPABILITY_FAILURE), "capability failure"},
{ERR_PACK(0, 0, QAT_R_CHACHAPOLY_CTX_NULL), "chachapoly ctx null"},
{ERR_PACK(0, 0, QAT_R_CIPHER_DATA_NULL), "cipher data null"},
{ERR_PACK(0, 0, QAT_R_CIPHER_OPERATION_FAILED), "cipher operation failed"},
{ERR_PACK(0, 0, QAT_R_CLOSE_READFD_FAILURE), "close readfd failure"},
{ERR_PACK(0, 0, QAT_R_COMPUTE_FAILURE), "compute failure"},
{ERR_PACK(0, 0, QAT_R_COMPUTE_H_MULTIPLY_Q_FAILURE),
Expand Down Expand Up @@ -285,6 +286,8 @@ static ERR_STRING_DATA QAT_str_reasons[] = {
{ERR_PACK(0, 0, QAT_R_EPOLL_CTL_FAILURE), "epoll ctl failure"},
{ERR_PACK(0, 0, QAT_R_EVENTS_MALLOC_FAILURE), "events malloc failure"},
{ERR_PACK(0, 0, QAT_R_EVP_LIB), "evp lib"},
{ERR_PACK(0, 0, QAT_R_FAILED_TO_GET_PARAMETER), "failed to get parameter"},
{ERR_PACK(0, 0, QAT_R_FAILED_TO_SET_PARAMETER), "failed to set parameter"},
{ERR_PACK(0, 0, QAT_R_FALLBACK_INIT_FAILURE), "fallback init failure"},
{ERR_PACK(0, 0, QAT_R_FALLBACK_POINTER_NULL), "fallback pointer null"},
{ERR_PACK(0, 0, QAT_R_FIELD_SIZE_INVALID), "field size invalid"},
Expand Down Expand Up @@ -324,14 +327,17 @@ static ERR_STRING_DATA QAT_str_reasons[] = {
"instance handle malloc failure"},
{ERR_PACK(0, 0, QAT_R_INSTANCE_UNAVAILABLE), "instance unavailable"},
{ERR_PACK(0, 0, QAT_R_INTERNAL_ERROR), "internal error"},
{ERR_PACK(0, 0, QAT_R_INVALID_AAD), "invalid aad"},
{ERR_PACK(0, 0, QAT_R_INVALID_ATTACHED_TAG), "invalid attached tag"},
{ERR_PACK(0, 0, QAT_R_INVALID_CTRL_TYPE), "invalid ctrl type"},
{ERR_PACK(0, 0, QAT_R_INVALID_CURVE), "invalid curve"},
{ERR_PACK(0, 0, QAT_R_INVALID_DATA), "invalid data"},
{ERR_PACK(0, 0, QAT_R_INVALID_HASH_DATA), "invalid hash data"},
{ERR_PACK(0, 0, QAT_R_INVALID_INPUT), "invalid input"},
{ERR_PACK(0, 0, QAT_R_INVALID_INPUT_LENGTH), "invalid input length"},
{ERR_PACK(0, 0, QAT_R_INVALID_INPUT_PARAMETER), "invalid input parameter"},
{ERR_PACK(0, 0, QAT_R_INVALID_IVLEN), "invalid ivlen"},
{ERR_PACK(0, 0, QAT_R_INVALID_IV_LENGTH), "invalid iv length"},
{ERR_PACK(0, 0, QAT_R_INVALID_L), "invalid l"},
{ERR_PACK(0, 0, QAT_R_INVALID_LEN), "invalid len"},
{ERR_PACK(0, 0, QAT_R_INVALID_PEER_KEY), "invalid peer key"},
Expand All @@ -340,6 +346,7 @@ static ERR_STRING_DATA QAT_str_reasons[] = {
{ERR_PACK(0, 0, QAT_R_INVALID_PTR_IV), "invalid ptr iv"},
{ERR_PACK(0, 0, QAT_R_INVALID_PUB_KEY), "invalid pub key"},
{ERR_PACK(0, 0, QAT_R_INVALID_QCTX_MEMORY), "invalid qctx memory"},
{ERR_PACK(0, 0, QAT_R_INVALID_TAG), "invalid tag"},
{ERR_PACK(0, 0, QAT_R_INVALID_TAG_LEN), "invalid tag len"},
{ERR_PACK(0, 0, QAT_R_INVALID_TYPE), "invalid type"},
{ERR_PACK(0, 0, QAT_R_IN_KINV_CONVERT_TO_FB_FAILURE),
Expand Down Expand Up @@ -413,6 +420,7 @@ static ERR_STRING_DATA QAT_str_reasons[] = {
"out1 pdata malloc failure"},
{ERR_PACK(0, 0, QAT_R_OUT2_PDATA_MALLOC_FAILURE),
"out2 pdata malloc failure"},
{ERR_PACK(0, 0, QAT_R_OUTPUT_BUFFER_TOO_SMALL), "output buffer too small"},
{ERR_PACK(0, 0, QAT_R_OUTPUT_BUF_MALLOC_FAILURE),
"output buf malloc failure"},
{ERR_PACK(0, 0, QAT_R_OUTPUT_BUF_PDATA_MALLOC_FAILURE),
Expand Down Expand Up @@ -603,6 +611,7 @@ static ERR_STRING_DATA QAT_str_reasons[] = {
{ERR_PACK(0, 0, QAT_R_S_NULL), "s null"},
{ERR_PACK(0, 0, QAT_R_S_Q_COMPARE_FAILURE), "s q compare failure"},
{ERR_PACK(0, 0, QAT_R_TAG_NOTSET), "tag notset"},
{ERR_PACK(0, 0, QAT_R_TAG_NOT_NEEDED), "tag not needed"},
{ERR_PACK(0, 0, QAT_R_UNKNOWN_PADDING), "unknown padding"},
{ERR_PACK(0, 0, QAT_R_UNKNOWN_PADDING_TYPE), "unknown padding type"},
{ERR_PACK(0, 0, QAT_R_WAKE_PAUSE_JOB_FAILURE), "wake pause job failure"},
Expand Down
Loading

0 comments on commit fe247d8

Please sign in to comment.