Skip to content

Commit

Permalink
Add QAT_HW Chacha-Poly support.
Browse files Browse the repository at this point in the history
Signed-off-by: Yogaraj Alamenda <yogarajx.alamenda@intel.com>
  • Loading branch information
Hemachander authored and Yogaraj-Alamenda committed Sep 17, 2021
1 parent e2c12bf commit 3b33867
Show file tree
Hide file tree
Showing 16 changed files with 3,026 additions and 1,134 deletions.
12 changes: 7 additions & 5 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,13 @@ if QAT_HW
qat_hw_dsa.c \
qat_hw_ec.c \
qat_hw_prf.c \
qat_hw_gcm.c \
qat_hw_sha3.c
qat_hw_gcm.c

if !QAT_OPENSSL_110
QAT_HW_111_SRC = qat_hw_hkdf.c \
qat_hw_ecx.c
QAT_HW_111_SRC = qat_hw_hkdf.c \
qat_hw_ecx.c \
qat_hw_sha3.c \
qat_hw_chachapoly.c
endif
endif

Expand Down Expand Up @@ -85,14 +86,15 @@ AM_CFLAGS = $(cflags) $(cflags_cc_opt) $(cflags_qat_debug_file) \
$(cflags_qat_ecdh) $(cflags_qat_gcm) $(enable_qat_hw_dh) \
$(enable_qat_hw_dsa) $(enable_qat_hw_ciphers) \
$(enable_qat_hw_prf) $(enable_qat_hw_hkdf) \
$(enable_qat_hw_sha3) $(enable_qat_hw_chachapoly) \
$(enable_qat_hw_small_pkt_offload) \
$(enable_qat_hw_lenstra_protection) \
$(enable_qat_hw_lenstra_verify_hw) \
$(enable_qat_sw_heuristic_timeout) \
$(enable_qat_auto_engine_init_on_fork) \
$(enable_qat_debug) $(enable_qat_warnings) \
$(enable_qat_mem_debug) $(enable_qat_mem_warnings) \
$(enable_qat_cycle_counts) $(enable_qat_hw_sha3)
$(enable_qat_cycle_counts)


qatengine_la_LDFLAGS = -module -no-undefined -avoid-version \
Expand Down
16 changes: 15 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ AC_ARG_ENABLE(qat_hw_sha3,
[Disable qat_hw SHA3 offload]))
AC_SUBST(enable_qat_hw_sha3)

AC_ARG_ENABLE(qat_hw_chachapoly,
AS_HELP_STRING([--disable-qat_hw_chachapoly],
[Disable qat_hw CHACHA-POLY acceleration]))
AC_SUBST(enable_qat_hw_chachapoly)

AC_ARG_ENABLE(qat_sw_gcm,
AS_HELP_STRING([--disable-qat_sw_gcm],
[Disable qat_sw AES-GCM acceleration]))
Expand Down Expand Up @@ -454,7 +459,7 @@ else if test "x$enable_qat_sw_ecdh" != "xno" -a "x$cflags_qat_sw" != "x"
then
AC_SUBST([cflags_qat_ecdh], ["-DENABLE_QAT_SW_ECDH"])
AC_MSG_NOTICE([Accelerating ECDH P256 &P384 to Software (Multi-buffer)])
else if test "x$enable_qat_hw_ecx" != "xno" -a "x$cflags_qat_hw" != "x"
else if test "x$enable_qat_hw_ecdh" != "xno" -a "x$cflags_qat_hw" != "x"
then
AC_SUBST([cflags_qat_ecdh], ["-DENABLE_QAT_HW_ECDH"])
AC_MSG_NOTICE([Accelerating ECDH to Hardware])
Expand Down Expand Up @@ -579,6 +584,15 @@ else
AC_MSG_NOTICE([Not Accelerating SHA3 to Hardware])
fi

if test "x$enable_qat_hw_chachapoly" != "xno" -a "x$cflags_qat_hw" != "x"
then
enable_qat_hw_chachapoly="-DENABLE_QAT_HW_CHACHAPOLY"
AC_MSG_NOTICE([Accelerating CHACHA-POLY to Hardware])
else
enable_qat_hw_chachapoly="-DDISABLE_QAT_HW_CHACHAPOLY"
AC_MSG_NOTICE([Not Accelerating CHACHA-POLY to Hardware])
fi

if test "x$enable_qat_hw_small_pkt_offload" = "xyes" -a "x$cflags_qat_hw" != "x"
then
enable_qat_hw_small_pkt_offload="-DENABLE_QAT_HW_SMALL_PKT_OFFLOAD"
Expand Down
576 changes: 294 additions & 282 deletions e_qat.txt

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions e_qat_err.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,24 @@ static ERR_STRING_DATA QAT_str_functs[] = {
{ERR_PACK(0, QAT_F_QAT_AES_GCM_SESSION_INIT, 0),
"qat_aes_gcm_session_init"},
{ERR_PACK(0, QAT_F_QAT_AES_GCM_TLS_CIPHER, 0), "qat_aes_gcm_tls_cipher"},
{ERR_PACK(0, QAT_F_QAT_CHACHA20_POLY1305_CLEANUP, 0),
"qat_chacha20_poly1305_cleanup"},
{ERR_PACK(0, QAT_F_QAT_CHACHA20_POLY1305_CTRL, 0),
"qat_chacha20_poly1305_ctrl"},
{ERR_PACK(0, QAT_F_QAT_CHACHA20_POLY1305_DO_CIPHER, 0),
"qat_chacha20_poly1305_do_cipher"},
{ERR_PACK(0, QAT_F_QAT_CHACHA20_POLY1305_INIT, 0),
"qat_chacha20_poly1305_init"},
{ERR_PACK(0, QAT_F_QAT_CHACHA20_POLY1305_INIT_KEY_IV, 0),
"qat_chacha20_poly1305_init_key_iv"},
{ERR_PACK(0, QAT_F_QAT_CHACHA20_POLY1305_MAC_KEYGEN, 0),
"qat_chacha20_poly1305_mac_keygen"},
{ERR_PACK(0, QAT_F_QAT_CHACHA20_POLY1305_TLS_CIPHER, 0),
"qat_chacha20_poly1305_tls_cipher"},
{ERR_PACK(0, QAT_F_QAT_CHACHAPOLY_SESSION_DATA_INIT, 0),
"qat_chachapoly_session_data_init"},
{ERR_PACK(0, QAT_F_QAT_CHACHAPOLY_SETUP_OP_PARAMS, 0),
"qat_chachapoly_setup_op_params"},
{ERR_PACK(0, QAT_F_QAT_CRYPTO_CALLBACKFN, 0), "qat_crypto_callbackFn"},
{ERR_PACK(0, QAT_F_QAT_DH_COMPUTE_KEY, 0), "qat_dh_compute_key"},
{ERR_PACK(0, QAT_F_QAT_DH_GENERATE_KEY, 0), "qat_dh_generate_key"},
Expand Down Expand Up @@ -151,6 +169,7 @@ static ERR_STRING_DATA QAT_str_reasons[] = {
"alloc qat x448 meth failure"},
{ERR_PACK(0, 0, QAT_R_ALLOC_TAG_FAILURE), "alloc tag failure"},
{ERR_PACK(0, 0, QAT_R_BUF_CONV_FAIL), "buf conv fail"},
{ERR_PACK(0, 0, QAT_R_CHACHAPOLY_CTX_NULL), "chachapoly ctx null"},
{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 @@ -241,8 +260,10 @@ static ERR_STRING_DATA QAT_str_reasons[] = {
{ERR_PACK(0, 0, QAT_R_INSTANCE_HANDLE_MALLOC_FAILURE),
"instance handle malloc failure"},
{ERR_PACK(0, 0, QAT_R_INSTANCE_UNAVAILABLE), "instance unavailable"},
{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_HASH_DATA), "invalid hash data"},
{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_LEN), "invalid len"},
Expand Down

0 comments on commit 3b33867

Please sign in to comment.