From ddae057dfe2497a0cbb1e273d9b66484503a39fe Mon Sep 17 00:00:00 2001 From: Yogaraj Alamenda Date: Thu, 28 Oct 2021 13:21:41 +0100 Subject: [PATCH] Update Readme and Bug fixes. - Regenerate err files. - Refactor QAT_HW & QAT_SW GCM registration. - Update Readme and version to v0.6.10 Signed-off-by: Yogaraj Alamenda --- configure.ac | 2 +- docs/software_requirements.md | 12 +-- e_qat.c | 54 +++++----- e_qat.h | 2 + e_qat.txt | 188 ++++++++++++++++++---------------- e_qat_err.c | 12 ++- e_qat_err.h | 15 ++- qat_evp.c | 136 +++++++++++++++++++----- qat_evp.h | 11 +- qat_hw_gcm.c | 74 ++----------- qat_hw_gcm.h | 11 +- qat_hw_rsa.c | 1 + qat_prov.txt | 181 ++++++++++++++++---------------- qat_prov_err.c | 10 ++ qat_prov_err.h | 180 ++++++++++++++++---------------- qat_sw_gcm.c | 81 --------------- qat_sw_gcm.h | 18 +++- qat_sw_rsa.c | 1 + qatengine-sw.spec | 5 +- qatengine.spec | 8 +- 20 files changed, 509 insertions(+), 493 deletions(-) diff --git a/configure.ac b/configure.ac index 12a57c01..ddd4d373 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ([2.68]) -AC_INIT([qatengine], [0.6.9], []) +AC_INIT([qatengine], [0.6.10], []) AC_CONFIG_SRCDIR([config.h.in]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_AUX_DIR([.]) diff --git a/docs/software_requirements.md b/docs/software_requirements.md index 10e8e9c9..436c8e34 100644 --- a/docs/software_requirements.md +++ b/docs/software_requirements.md @@ -6,11 +6,11 @@ that supports OpenSSL\* 1.1.1 or OpenSSL\* 1.1.0 and Intel® QuickAssist Technology Driver for Linux or Intel® QuickAssist Technology Driver for FreeBSD. This release was validated on the following: -* Operating system: CentOS\* 7.4 64-bit version & FreeBSD\* 11.3 64-bit version +* Operating system: CentOS\* 7.4 64-bit version & FreeBSD\* 11.4 64-bit version * Kernel: GNU\*/Linux\* 3.10.0-693 -* Intel® Communications Chipset C62X Series Software for Linux\*, version **4.14** -* Intel® Communications Chipset C62X Series Software for FreeBSD\*, version **3.10** -* OpenSSL\* 1.1.1l +* Intel® Communications Chipset C62X Series Software for Linux\*, version **4.15** +* Intel® Communications Chipset C62X Series Software for FreeBSD\*, version **3.11** +* OpenSSL\* 1.1.1l & 3.0 ## qat_sw Requirements Successful operation of the Intel® QAT Software acceleration requires a @@ -29,9 +29,9 @@ This release was validated on the following: * Operating system: Ubuntu 20.04.2 LTS * Kernel: 5.4.0-62-generic * Intel® Crypto Multi-buffer library from the [ipp-crypto][1] release - version **IPP Crypto 2021.3** + version **IPP Crypto 2021.4** * Intel® Multi-Buffer crypto for IPsec Library release version **v1.0** -* OpenSSL\* 1.1.1l +* OpenSSL\* 1.1.1l & 3.0 [1]:https://github.com/intel/ipp-crypto [2]:https://github.com/intel/ipp-crypto/tree/develop/sources/ippcp/crypto_mb diff --git a/e_qat.c b/e_qat.c index 5d8e8950..79d2cd97 100644 --- a/e_qat.c +++ b/e_qat.c @@ -154,13 +154,13 @@ const char *engine_qat_id = STR(QAT_ENGINE_ID); #if defined(QAT_HW) && defined(QAT_SW) const char *engine_qat_name = - "Reference implementation of QAT crypto engine(qat_hw & qat_sw) v0.6.9"; + "Reference implementation of QAT crypto engine(qat_hw & qat_sw) v0.6.10"; #elif QAT_HW const char *engine_qat_name = - "Reference implementation of QAT crypto engine(qat_hw) v0.6.9"; + "Reference implementation of QAT crypto engine(qat_hw) v0.6.10"; #else const char *engine_qat_name = - "Reference implementation of QAT crypto engine(qat_sw) v0.6.9"; + "Reference implementation of QAT crypto engine(qat_sw) v0.6.10"; #endif unsigned int engine_inited = 0; @@ -172,10 +172,12 @@ int qat_hw_ecdh_offload = 0; int qat_hw_ecdsa_offload = 0; int qat_hw_prf_offload = 0; int qat_hw_hkdf_offload = 0; +int qat_hw_gcm_offload = 0; int qat_sw_rsa_offload = 0; int qat_sw_ecx_offload = 0; int qat_sw_ecdh_offload = 0; int qat_sw_ecdsa_offload = 0; +int qat_sw_gcm_offload = 0; int qat_keep_polling = 1; int multibuff_keep_polling = 1; int enable_external_polling = 0; @@ -380,6 +382,10 @@ static int qat_engine_destroy(ENGINE *e) # endif #endif + qat_hw_ecx_offload = 0; + qat_hw_prf_offload = 0; + qat_hw_hkdf_offload = 0; + qat_sw_ecx_offload = 0; QAT_DEBUG_LOG_CLOSE(); ERR_unload_QAT_strings(); return 1; @@ -510,17 +516,6 @@ int qat_engine_finish_int(ENGINE *e, int reset_globals) enable_heuristic_polling = 0; qat_hw_offload = 0; qat_sw_offload = 0; - qat_hw_rsa_offload = 0; - qat_hw_ecx_offload = 0; - qat_hw_ecdh_offload = 0; - qat_hw_ecdsa_offload = 0; - qat_hw_prf_offload = 0; - qat_hw_hkdf_offload = 0; - qat_sw_rsa_offload = 0; - qat_sw_ecx_offload = 0; - qat_sw_ecdh_offload = 0; - qat_sw_ecdsa_offload = 0; - } qat_pthread_mutex_unlock(); CRYPTO_CLOSE_QAT_LOG(); @@ -907,10 +902,6 @@ static int bind_qat(ENGINE *e, const char *id) #ifdef QAT_HW DEBUG("Registering QAT HW supported algorithms\n"); - /* Create static structures for ciphers now - * as this function will be called by a single thread. */ - qat_create_ciphers(); - # ifdef ENABLE_QAT_HW_RSA if (!ENGINE_set_RSA(e, qat_get_RSA_methods())) { WARN("ENGINE_set_RSA QAT HW failed\n"); @@ -960,18 +951,6 @@ static int bind_qat(ENGINE *e, const char *id) } } # endif - -#endif - -#ifdef QAT_SW_IPSEC - if (hw_support()) { -# ifdef ENABLE_QAT_SW_GCM - if (!vaesgcm_init_ipsec_mb_mgr()) { - WARN("IPSec Multi-Buffer Manager Initialization failed\n"); - goto end; - } -# endif - } #endif #if defined(QAT_HW) || defined(QAT_SW) @@ -988,6 +967,21 @@ static int bind_qat(ENGINE *e, const char *id) # endif #endif +#ifdef QAT_SW_IPSEC + if (hw_support()) { +# ifdef ENABLE_QAT_SW_GCM + if (!vaesgcm_init_ipsec_mb_mgr()) { + WARN("IPSec Multi-Buffer Manager Initialization failed\n"); + goto end; + } +# endif + } +#endif + + /* Create static structures for ciphers now + * as this function will be called by a single thread. */ + qat_create_ciphers(); + #if defined(QAT_HW) || defined(QAT_SW_IPSEC) if (!ENGINE_set_ciphers(e, qat_ciphers)) { WARN("ENGINE_set_ciphers failed\n"); diff --git a/e_qat.h b/e_qat.h index 8c55d207..0ffa859c 100644 --- a/e_qat.h +++ b/e_qat.h @@ -311,10 +311,12 @@ extern int qat_hw_ecdh_offload; extern int qat_hw_ecdsa_offload; extern int qat_hw_prf_offload; extern int qat_hw_hkdf_offload; +extern int qat_hw_gcm_offload; extern int qat_sw_rsa_offload; extern int qat_sw_ecx_offload; extern int qat_sw_ecdh_offload; extern int qat_sw_ecdsa_offload; +extern int qat_sw_gcm_offload; extern int qat_keep_polling; extern int multibuff_keep_polling; extern int enable_external_polling; diff --git a/e_qat.txt b/e_qat.txt index 739f69e1..32cc5916 100644 --- a/e_qat.txt +++ b/e_qat.txt @@ -106,10 +106,9 @@ QAT_F_QAT_X448_PMETH:196:qat_x448_pmeth QAT_F_VAESGCM_CIPHERS_CTRL:197:vaesgcm_ciphers_ctrl QAT_F_VAESGCM_CIPHERS_DO_CIPHER:198:vaesgcm_ciphers_do_cipher QAT_F_VAESGCM_CIPHERS_INIT:199:vaesgcm_ciphers_init -QAT_F_VAESGCM_CREATE_CIPHER_METH:200:vaesgcm_create_cipher_meth -QAT_F_VAESGCM_INIT_GCM:201:vaesgcm_init_gcm -QAT_F_VAESGCM_INIT_IPSEC_MB_MGR:202:vaesgcm_init_ipsec_mb_mgr -QAT_F_VAESGCM_INIT_KEY:203:vaesgcm_init_key +QAT_F_VAESGCM_INIT_GCM:200:vaesgcm_init_gcm +QAT_F_VAESGCM_INIT_IPSEC_MB_MGR:201:vaesgcm_init_ipsec_mb_mgr +QAT_F_VAESGCM_INIT_KEY:202:vaesgcm_init_key #Reason codes QAT_R_AAD_INVALID_PTR:100:aad invalid ptr @@ -262,98 +261,105 @@ QAT_R_PADDING_UNKNOWN:245:padding unknown QAT_R_POLLING_THREAD_CREATE_FAILURE:246:polling thread create failure QAT_R_POLLING_THREAD_SIGMASK_FAILURE:247:polling thread sigmask failure QAT_R_POLL_INSTANCE_FAILURE:248:poll instance failure -QAT_R_PPV_MALLOC_FAILURE:249:ppv malloc failure -QAT_R_PPV_PDATA_MALLOC_FAILURE:250:ppv pdata malloc failure -QAT_R_PRESULTR_MALLOC_FAILURE:251:presultr malloc failure -QAT_R_PRESULTR_PDATA_MALLOC_FAILURE:252:presultr pdata malloc failure -QAT_R_PRESULTS_MALLOC_FAILURE:253:presults malloc failure -QAT_R_PRESULTS_PDATA_MALLOC_FAILURE:254:presults pdata malloc failure -QAT_R_PRESULTX_MALLOC_FAILURE:255:presultx malloc failure -QAT_R_PRESULTX_PDATA_MALLOC_FAILURE:256:presultx pdata malloc failure -QAT_R_PRESULTY_LENGTH_CHECK_FAILURE:257:presulty length check failure -QAT_R_PRESULTY_MALLOC_FAILURE:258:presulty malloc failure -QAT_R_PRESULTY_PDATA_MALLOC_FAILURE:259:presulty pdata malloc failure -QAT_R_PRIV_KEY_DUPLICATE_FAILURE:260:priv key duplicate failure -QAT_R_PRIV_KEY_MALLOC_FAILURE:261:priv key malloc failure -QAT_R_PRIV_KEY_M_XG_YG_A_B_P_CONVERT_TO_FB_FAILURE:262:\ +QAT_R_POPDATA_A_PDATA_MALLOC_FAILURE:249:popdata a pdata malloc failure +QAT_R_POPDATA_MALLOC_FAILURE:250:popdata malloc failure +QAT_R_POPDATA_PCURVE_MALLOC_FAILURE:251:popdata pcurve malloc failure +QAT_R_PPV_MALLOC_FAILURE:252:ppv malloc failure +QAT_R_PPV_PDATA_MALLOC_FAILURE:253:ppv pdata malloc failure +QAT_R_PRESULTR_MALLOC_FAILURE:254:presultr malloc failure +QAT_R_PRESULTR_PDATA_MALLOC_FAILURE:255:presultr pdata malloc failure +QAT_R_PRESULTS_MALLOC_FAILURE:256:presults malloc failure +QAT_R_PRESULTS_PDATA_MALLOC_FAILURE:257:presults pdata malloc failure +QAT_R_PRESULTX_MALLOC_FAILURE:258:presultx malloc failure +QAT_R_PRESULTX_PDATA_MALLOC_FAILURE:259:presultx pdata malloc failure +QAT_R_PRESULTY_LENGTH_CHECK_FAILURE:260:presulty length check failure +QAT_R_PRESULTY_MALLOC_FAILURE:261:presulty malloc failure +QAT_R_PRESULTY_PDATA_MALLOC_FAILURE:262:presulty pdata malloc failure +QAT_R_PRIV_KEY_DUPLICATE_FAILURE:263:priv key duplicate failure +QAT_R_PRIV_KEY_MALLOC_FAILURE:264:priv key malloc failure +QAT_R_PRIV_KEY_M_XG_YG_A_B_P_CONVERT_TO_FB_FAILURE:265:\ priv key m xg yg a b p convert to fb failure -QAT_R_PRIV_KEY_NULL:263:priv key null -QAT_R_PRIV_KEY_RAND_GENERATE_FAILURE:264:priv key rand generate failure -QAT_R_PRIV_KEY_XG_YG_A_B_P_CONVERT_TO_FB_FAILURE:265:\ +QAT_R_PRIV_KEY_NULL:266:priv key null +QAT_R_PRIV_KEY_RAND_GENERATE_FAILURE:267:priv key rand generate failure +QAT_R_PRIV_KEY_XG_YG_A_B_P_CONVERT_TO_FB_FAILURE:268:\ priv key xg yg a b p convert to fb failure -QAT_R_PTHREAD_CREATE_FAILURE:266:pthread create failure -QAT_R_PTHREAD_GETAFFINITY_FAILURE:267:pthread getaffinity failure -QAT_R_PTHREAD_JOIN_FAILURE:268:pthread join failure -QAT_R_PTHREAD_KILL_FAILURE:269:pthread kill failure -QAT_R_PTHREAD_SETAFFINITY_FAILURE:270:pthread setaffinity failure -QAT_R_PUB_KEY_DUPLICATE_FAILURE:271:pub key duplicate failure -QAT_R_PUB_KEY_MALLOC_FAILURE:272:pub key malloc failure -QAT_R_PUB_KEY_NULL:273:pub key null -QAT_R_P_A_B_XG_YG_MALLOC_FAILURE:274:p a b xg yg malloc failure -QAT_R_P_A_B_XG_YG_M_K_R_ORDER_MALLOC_FAILURE:275:\ +QAT_R_PRIV_KEY_XP_YP_A_B_P_CONVERT_TO_FB_FAILURE:269:\ + priv key xp yp a b p convert to fb failure +QAT_R_PTHREAD_CREATE_FAILURE:270:pthread create failure +QAT_R_PTHREAD_GETAFFINITY_FAILURE:271:pthread getaffinity failure +QAT_R_PTHREAD_JOIN_FAILURE:272:pthread join failure +QAT_R_PTHREAD_KILL_FAILURE:273:pthread kill failure +QAT_R_PTHREAD_SETAFFINITY_FAILURE:274:pthread setaffinity failure +QAT_R_PUB_KEY_DUPLICATE_FAILURE:275:pub key duplicate failure +QAT_R_PUB_KEY_MALLOC_FAILURE:276:pub key malloc failure +QAT_R_PUB_KEY_NULL:277:pub key null +QAT_R_P_A_B_XG_YG_MALLOC_FAILURE:278:p a b xg yg malloc failure +QAT_R_P_A_B_XG_YG_M_K_R_ORDER_MALLOC_FAILURE:279:\ p a b xg yg m k r order malloc failure -QAT_R_P_A_B_XG_YG_XP_YP_M_ORDER_FAILURE:276:p a b xg yg xp yp m order failure -QAT_R_P_G_PRIV_KEY_CONVERT_TO_FB_FAILURE:277:p g priv key convert to fb failure -QAT_R_P_PUB_PRIV_KEY_CONVERT_TO_FB_FAILURE:278:\ +QAT_R_P_A_B_XG_YG_XP_YP_M_ORDER_FAILURE:280:p a b xg yg xp yp m order failure +QAT_R_P_A_B_XP_YP_FAILURE:281:p a b xp yp failure +QAT_R_P_A_B_XP_YP_MALLOC_FAILURE:282:p a b xp yp malloc failure +QAT_R_P_G_PRIV_KEY_CONVERT_TO_FB_FAILURE:283:p g priv key convert to fb failure +QAT_R_P_PUB_PRIV_KEY_CONVERT_TO_FB_FAILURE:284:\ p pub priv key convert to fb failure -QAT_R_P_Q_DMP_DMQ_CONVERT_TO_FB_FAILURE:279:p q dmp dmq convert to fb failure -QAT_R_P_Q_DMP_DMQ_IQMP_NULL:280:p q dmp dmq iqmp null -QAT_R_P_Q_G_NULL:281:p q g null -QAT_R_P_Q_G_X_K_CONVERT_TO_FB_FAILURE:282:p q g x k convert to fb failure -QAT_R_P_Q_G_Y_Z_R_S_CONVERT_TO_FB_FAILURE:283:\ +QAT_R_P_Q_DMP_DMQ_CONVERT_TO_FB_FAILURE:285:p q dmp dmq convert to fb failure +QAT_R_P_Q_DMP_DMQ_IQMP_NULL:286:p q dmp dmq iqmp null +QAT_R_P_Q_G_NULL:287:p q g null +QAT_R_P_Q_G_X_K_CONVERT_TO_FB_FAILURE:288:p q g x k convert to fb failure +QAT_R_P_Q_G_Y_Z_R_S_CONVERT_TO_FB_FAILURE:289:\ p q g y z r s convert to fb failure -QAT_R_QAT_ALLOC_DH_METH_FAILURE:284:qat alloc dh meth failure -QAT_R_QAT_CREATE_ENGINE_FAILURE:285:qat create engine failure -QAT_R_QAT_ECDSA_DO_SIGN_FAIL:286:qat ecdsa do sign fail -QAT_R_QAT_FREE_EC_METHOD_FAILURE:287:qat free ec method failure -QAT_R_QAT_GET_EC_METHOD_MALLOC_FAILURE:288:qat get ec method malloc failure -QAT_R_QAT_SET_DH_METH_FAILURE:289:qat set dh meth failure -QAT_R_QCTX_CTX_NULL:290:qctx ctx null -QAT_R_QCTX_NULL:291:qctx null -QAT_R_RAND_BYTES_FAILURE:292:rand bytes failure -QAT_R_RAND_FAILURE:293:rand failure -QAT_R_RAND_GENERATE_FAILURE:294:rand generate failure -QAT_R_RESULT_PDATA_ALLOC_FAIL:295:result pdata alloc fail -QAT_R_RETRIEVE_EC_POINT_FAILURE:296:retrieve ec point failure -QAT_R_RETRIEVE_ORDER_FAILURE:297:retrieve order failure -QAT_R_RSA_FROM_TO_NULL:298:rsa from to null -QAT_R_RSA_OUTPUT_BUF_PDATA_MALLOC_FAILURE:299:\ +QAT_R_QAT_ALLOC_DH_METH_FAILURE:290:qat alloc dh meth failure +QAT_R_QAT_CREATE_ENGINE_FAILURE:291:qat create engine failure +QAT_R_QAT_ECDSA_DO_SIGN_FAIL:292:qat ecdsa do sign fail +QAT_R_QAT_FREE_EC_METHOD_FAILURE:293:qat free ec method failure +QAT_R_QAT_GET_EC_METHOD_MALLOC_FAILURE:294:qat get ec method malloc failure +QAT_R_QAT_SET_DH_METH_FAILURE:295:qat set dh meth failure +QAT_R_QCTX_CTX_NULL:296:qctx ctx null +QAT_R_QCTX_NULL:297:qctx null +QAT_R_RAND_BYTES_FAILURE:298:rand bytes failure +QAT_R_RAND_FAILURE:299:rand failure +QAT_R_RAND_GENERATE_FAILURE:300:rand generate failure +QAT_R_RESULT_PDATA_ALLOC_FAIL:301:result pdata alloc fail +QAT_R_RETRIEVE_EC_POINT_FAILURE:302:retrieve ec point failure +QAT_R_RETRIEVE_ORDER_FAILURE:303:retrieve order failure +QAT_R_RSA_FROM_TO_NULL:304:rsa from to null +QAT_R_RSA_OUTPUT_BUF_PDATA_MALLOC_FAILURE:305:\ rsa output buf pdata malloc failure -QAT_R_R_Q_COMPARE_FAILURE:300:r q compare failure -QAT_R_SECRET_KEY_MALLOC_FAILURE:301:secret key malloc failure -QAT_R_SECRET_KEY_PDATA_MALLOC_FAILURE:302:secret key pdata malloc failure -QAT_R_SETUP_ASYNC_EVENT_FAILURE:303:setup async event failure -QAT_R_SET_ADDRESS_TRANSLATION_FAILURE:304:set address translation failure -QAT_R_SET_FILE_DESCRIPTOR_NONBLOCKING_FAILURE:305:\ +QAT_R_R_Q_COMPARE_FAILURE:306:r q compare failure +QAT_R_SECRET_KEY_MALLOC_FAILURE:307:secret key malloc failure +QAT_R_SECRET_KEY_PDATA_MALLOC_FAILURE:308:secret key pdata malloc failure +QAT_R_SETUP_ASYNC_EVENT_FAILURE:309:setup async event failure +QAT_R_SET_ADDRESS_TRANSLATION_FAILURE:310:set address translation failure +QAT_R_SET_FILE_DESCRIPTOR_NONBLOCKING_FAILURE:311:\ set file descriptor nonblocking failure -QAT_R_SET_INSTANCE_FAILURE:306:set instance failure -QAT_R_SET_MULTIBUFF_RSA_METH_FAILURE:307:set multibuff rsa meth failure -QAT_R_SET_NOTIFICATION_CALLBACK_FAILURE:308:set notification callback failure -QAT_R_SET_POLLING_THREAD_AFFINITY_FAILURE:309:\ +QAT_R_SET_INSTANCE_FAILURE:312:set instance failure +QAT_R_SET_MULTIBUFF_RSA_METH_FAILURE:313:set multibuff rsa meth failure +QAT_R_SET_NOTIFICATION_CALLBACK_FAILURE:314:set notification callback failure +QAT_R_SET_POLLING_THREAD_AFFINITY_FAILURE:315:\ set polling thread affinity failure -QAT_R_SET_PRIV_KEY_FAILURE:310:set priv key failure -QAT_R_SET_QAT_DSA_METH_FAILURE:311:set qat dsa meth failure -QAT_R_SET_QAT_RSA_METH_FAILURE:312:set qat rsa meth failure -QAT_R_SET_TAG_INVALID_OP:313:set tag invalid op -QAT_R_SHA3_CTX_NULL:314:sha3 ctx null -QAT_R_SIG_GET_R_S_FAILURE:315:sig get r s failure -QAT_R_SIG_MALLOC_FAILURE:316:sig malloc failure -QAT_R_SSD_MALLOC_FAILURE:317:ssd malloc failure -QAT_R_SSD_NULL:318:ssd null -QAT_R_START_INSTANCE_FAILURE:319:start instance failure -QAT_R_STOP_INSTANCE_FAILURE:320:stop instance failure -QAT_R_SW_GET_COMPUTE_KEY_PFUNC_NULL:321:sw get compute key pfunc null -QAT_R_SW_GET_KEYGEN_PFUNC_NULL:322:sw get keygen pfunc null -QAT_R_SW_GET_SIGN_PFUNC_NULL:323:sw get sign pfunc null -QAT_R_SW_GET_SIGN_SETUP_PFUNC_NULL:324:sw get sign setup pfunc null -QAT_R_SW_GET_SIGN_SIG_PFUNC_NULL:325:sw get sign sig pfunc null -QAT_R_SW_GET_VERIFY_SIG_PFUNC_NULL:326:sw get verify sig pfunc null -QAT_R_SW_METHOD_NULL:327:sw method null -QAT_R_S_NULL:328:s null -QAT_R_S_Q_COMPARE_FAILURE:329:s q compare failure -QAT_R_UNKNOWN_PADDING:330:unknown padding -QAT_R_UNKNOWN_PADDING_TYPE:331:unknown padding type -QAT_R_WAKE_PAUSE_JOB_FAILURE:332:wake pause job failure -QAT_R_X_Y_TX_TY_BN_MALLOC_FAILURE:333:x y tx ty bn malloc failure -QAT_R_X_Y_Z_MALLOC_FAILURE:334:x y z malloc failure -QAT_R_Z_ALLOCATE_FAILURE:335:z allocate failure +QAT_R_SET_PRIV_KEY_FAILURE:316:set priv key failure +QAT_R_SET_QAT_DSA_METH_FAILURE:317:set qat dsa meth failure +QAT_R_SET_QAT_RSA_METH_FAILURE:318:set qat rsa meth failure +QAT_R_SET_TAG_INVALID_OP:319:set tag invalid op +QAT_R_SHA3_CTX_NULL:320:sha3 ctx null +QAT_R_SIG_GET_R_S_FAILURE:321:sig get r s failure +QAT_R_SIG_MALLOC_FAILURE:322:sig malloc failure +QAT_R_SSD_MALLOC_FAILURE:323:ssd malloc failure +QAT_R_SSD_NULL:324:ssd null +QAT_R_START_INSTANCE_FAILURE:325:start instance failure +QAT_R_STOP_INSTANCE_FAILURE:326:stop instance failure +QAT_R_SW_GET_COMPUTE_KEY_PFUNC_NULL:327:sw get compute key pfunc null +QAT_R_SW_GET_KEYGEN_PFUNC_NULL:328:sw get keygen pfunc null +QAT_R_SW_GET_SIGN_PFUNC_NULL:329:sw get sign pfunc null +QAT_R_SW_GET_SIGN_SETUP_PFUNC_NULL:330:sw get sign setup pfunc null +QAT_R_SW_GET_SIGN_SIG_PFUNC_NULL:331:sw get sign sig pfunc null +QAT_R_SW_GET_VERIFY_SIG_PFUNC_NULL:332:sw get verify sig pfunc null +QAT_R_SW_METHOD_NULL:333:sw method null +QAT_R_S_NULL:334:s null +QAT_R_S_Q_COMPARE_FAILURE:335:s q compare failure +QAT_R_UNKNOWN_PADDING:336:unknown padding +QAT_R_UNKNOWN_PADDING_TYPE:337:unknown padding type +QAT_R_WAKE_PAUSE_JOB_FAILURE:338:wake pause job failure +QAT_R_X_Y_TX_TY_BN_MALLOC_FAILURE:339:x y tx ty bn malloc failure +QAT_R_X_Y_Z_MALLOC_FAILURE:340:x y z malloc failure +QAT_R_Z_ALLOCATE_FAILURE:341:z allocate failure diff --git a/e_qat_err.c b/e_qat_err.c index e45ddd2b..0fe3afb7 100644 --- a/e_qat_err.c +++ b/e_qat_err.c @@ -138,8 +138,6 @@ static ERR_STRING_DATA QAT_str_functs[] = { {ERR_PACK(0, QAT_F_VAESGCM_CIPHERS_DO_CIPHER, 0), "vaesgcm_ciphers_do_cipher"}, {ERR_PACK(0, QAT_F_VAESGCM_CIPHERS_INIT, 0), "vaesgcm_ciphers_init"}, - {ERR_PACK(0, QAT_F_VAESGCM_CREATE_CIPHER_METH, 0), - "vaesgcm_create_cipher_meth"}, {ERR_PACK(0, QAT_F_VAESGCM_INIT_GCM, 0), "vaesgcm_init_gcm"}, {ERR_PACK(0, QAT_F_VAESGCM_INIT_IPSEC_MB_MGR, 0), "vaesgcm_init_ipsec_mb_mgr"}, @@ -348,6 +346,11 @@ static ERR_STRING_DATA QAT_str_reasons[] = { {ERR_PACK(0, 0, QAT_R_POLLING_THREAD_SIGMASK_FAILURE), "polling thread sigmask failure"}, {ERR_PACK(0, 0, QAT_R_POLL_INSTANCE_FAILURE), "poll instance failure"}, + {ERR_PACK(0, 0, QAT_R_POPDATA_A_PDATA_MALLOC_FAILURE), + "popdata a pdata malloc failure"}, + {ERR_PACK(0, 0, QAT_R_POPDATA_MALLOC_FAILURE), "popdata malloc failure"}, + {ERR_PACK(0, 0, QAT_R_POPDATA_PCURVE_MALLOC_FAILURE), + "popdata pcurve malloc failure"}, {ERR_PACK(0, 0, QAT_R_PPV_MALLOC_FAILURE), "ppv malloc failure"}, {ERR_PACK(0, 0, QAT_R_PPV_PDATA_MALLOC_FAILURE), "ppv pdata malloc failure"}, @@ -375,6 +378,8 @@ static ERR_STRING_DATA QAT_str_reasons[] = { "priv key rand generate failure"}, {ERR_PACK(0, 0, QAT_R_PRIV_KEY_XG_YG_A_B_P_CONVERT_TO_FB_FAILURE), "priv key xg yg a b p convert to fb failure"}, + {ERR_PACK(0, 0, QAT_R_PRIV_KEY_XP_YP_A_B_P_CONVERT_TO_FB_FAILURE), + "priv key xp yp a b p convert to fb failure"}, {ERR_PACK(0, 0, QAT_R_PTHREAD_CREATE_FAILURE), "pthread create failure"}, {ERR_PACK(0, 0, QAT_R_PTHREAD_GETAFFINITY_FAILURE), "pthread getaffinity failure"}, @@ -392,6 +397,9 @@ static ERR_STRING_DATA QAT_str_reasons[] = { "p a b xg yg m k r order malloc failure"}, {ERR_PACK(0, 0, QAT_R_P_A_B_XG_YG_XP_YP_M_ORDER_FAILURE), "p a b xg yg xp yp m order failure"}, + {ERR_PACK(0, 0, QAT_R_P_A_B_XP_YP_FAILURE), "p a b xp yp failure"}, + {ERR_PACK(0, 0, QAT_R_P_A_B_XP_YP_MALLOC_FAILURE), + "p a b xp yp malloc failure"}, {ERR_PACK(0, 0, QAT_R_P_G_PRIV_KEY_CONVERT_TO_FB_FAILURE), "p g priv key convert to fb failure"}, {ERR_PACK(0, 0, QAT_R_P_PUB_PRIV_KEY_CONVERT_TO_FB_FAILURE), diff --git a/e_qat_err.h b/e_qat_err.h index 6cb6b463..c1a65181 100644 --- a/e_qat_err.h +++ b/e_qat_err.h @@ -129,10 +129,9 @@ void ERR_QAT_error(int function, int reason, char *file, int line); # define QAT_F_VAESGCM_CIPHERS_CTRL 197 # define QAT_F_VAESGCM_CIPHERS_DO_CIPHER 198 # define QAT_F_VAESGCM_CIPHERS_INIT 199 -# define QAT_F_VAESGCM_CREATE_CIPHER_METH 200 -# define QAT_F_VAESGCM_INIT_GCM 201 -# define QAT_F_VAESGCM_INIT_IPSEC_MB_MGR 202 -# define QAT_F_VAESGCM_INIT_KEY 203 +# define QAT_F_VAESGCM_INIT_GCM 200 +# define QAT_F_VAESGCM_INIT_IPSEC_MB_MGR 201 +# define QAT_F_VAESGCM_INIT_KEY 202 /* * QAT reason codes. @@ -316,10 +315,10 @@ void ERR_QAT_error(int function, int reason, char *file, int line); # define QAT_R_PUB_KEY_MALLOC_FAILURE 276 # define QAT_R_PUB_KEY_NULL 277 # define QAT_R_P_A_B_XG_YG_MALLOC_FAILURE 278 -# define QAT_R_P_A_B_XP_YP_MALLOC_FAILURE 279 -# define QAT_R_P_A_B_XG_YG_M_K_R_ORDER_MALLOC_FAILURE 280 -# define QAT_R_P_A_B_XG_YG_XP_YP_M_ORDER_FAILURE 281 -# define QAT_R_P_A_B_XP_YP_FAILURE 282 +# define QAT_R_P_A_B_XG_YG_M_K_R_ORDER_MALLOC_FAILURE 279 +# define QAT_R_P_A_B_XG_YG_XP_YP_M_ORDER_FAILURE 280 +# define QAT_R_P_A_B_XP_YP_FAILURE 281 +# define QAT_R_P_A_B_XP_YP_MALLOC_FAILURE 282 # define QAT_R_P_G_PRIV_KEY_CONVERT_TO_FB_FAILURE 283 # define QAT_R_P_PUB_PRIV_KEY_CONVERT_TO_FB_FAILURE 284 # define QAT_R_P_Q_DMP_DMQ_CONVERT_TO_FB_FAILURE 285 diff --git a/qat_evp.c b/qat_evp.c index aa2f3729..43c38bca 100644 --- a/qat_evp.c +++ b/qat_evp.c @@ -94,18 +94,16 @@ static chained_info info[] = { {NID_aes_256_cbc_hmac_sha1, NULL, AES_KEY_SIZE_256}, {NID_aes_256_cbc_hmac_sha256, NULL, AES_KEY_SIZE_256}, # endif -# ifdef ENABLE_QAT_HW_GCM - {NID_aes_128_gcm, NULL, AES_KEY_SIZE_128}, - {NID_aes_256_gcm, NULL, AES_KEY_SIZE_256}, -# endif # ifdef ENABLE_QAT_HW_CHACHAPOLY {NID_chacha20_poly1305, NULL, CHACHA_KEY_SIZE}, # endif #endif -#ifdef ENABLE_QAT_SW_GCM +#if defined(QAT_HW) || defined(QAT_SW_IPSEC) +# if defined(ENABLE_QAT_HW_GCM) || defined(ENABLE_QAT_SW_GCM) {NID_aes_128_gcm, NULL, AES_KEY_SIZE_128}, {NID_aes_192_gcm, NULL, AES_KEY_SIZE_192}, {NID_aes_256_gcm, NULL, AES_KEY_SIZE_256}, +# endif #endif }; @@ -120,20 +118,18 @@ int qat_cipher_nids[] = { NID_aes_256_cbc_hmac_sha1, NID_aes_256_cbc_hmac_sha256, # endif -# ifdef ENABLE_QAT_HW_GCM - NID_aes_128_gcm, - NID_aes_256_gcm, -# endif # if OPENSSL_VERSION_NUMBER > 0x10101000L # ifdef ENABLE_QAT_HW_CHACHAPOLY NID_chacha20_poly1305, # endif # endif #endif -#ifdef ENABLE_QAT_SW_GCM +#if defined(QAT_HW) || defined(QAT_SW_IPSEC) +# if defined(ENABLE_QAT_HW_GCM) || defined(ENABLE_QAT_SW_GCM) NID_aes_128_gcm, NID_aes_192_gcm, NID_aes_256_gcm, +# endif #endif }; @@ -451,6 +447,99 @@ int qat_pkey_methods(ENGINE *e, EVP_PKEY_METHOD **pmeth, return 0; } +static inline const EVP_CIPHER *qat_gcm_cipher_sw_impl(int nid) +{ + switch (nid) { + case NID_aes_128_gcm: + return EVP_aes_128_gcm(); + case NID_aes_192_gcm: + return EVP_aes_192_gcm(); + case NID_aes_256_gcm: + return EVP_aes_256_gcm(); + default: + WARN("Invalid nid %d\n", nid); + return NULL; + } +} + +/****************************************************************************** + * function: + * qat_create_gcm_cipher_meth(int nid, int keylen) + * + * @param nid [IN] - Cipher NID to be created + * @param keylen [IN] - Key length of cipher [128|192|256] + * @retval - EVP_CIPHER * to created cipher + * @retval - NULL if failure + * + * description: + * Create a new EVP_CIPHER based on requested nid for qat_hw or qat_sw + ******************************************************************************/ +const EVP_CIPHER *qat_create_gcm_cipher_meth(int nid, int keylen) +{ + EVP_CIPHER *c = NULL; + int res = 1; + +#ifdef ENABLE_QAT_SW_GCM + if (qat_sw_ipsec) { + if ((c = EVP_CIPHER_meth_new(nid, AES_GCM_BLOCK_SIZE, keylen)) == NULL) { + WARN("Failed to allocate cipher methods for nid %d\n", nid); + return NULL; + } + + res &= EVP_CIPHER_meth_set_iv_length(c, GCM_IV_DATA_LEN); + res &= EVP_CIPHER_meth_set_flags(c, VAESGCM_FLAG); + res &= EVP_CIPHER_meth_set_init(c, vaesgcm_ciphers_init); + res &= EVP_CIPHER_meth_set_do_cipher(c, vaesgcm_ciphers_do_cipher); + res &= EVP_CIPHER_meth_set_cleanup(c, vaesgcm_ciphers_cleanup); + res &= EVP_CIPHER_meth_set_impl_ctx_size(c, sizeof(vaesgcm_ctx)); + res &= EVP_CIPHER_meth_set_set_asn1_params(c, NULL); + res &= EVP_CIPHER_meth_set_get_asn1_params(c, NULL); + res &= EVP_CIPHER_meth_set_ctrl(c, vaesgcm_ciphers_ctrl); + qat_sw_gcm_offload = 1; + DEBUG("QAT SW AES_GCM registration\n"); + } +#endif + +#ifdef ENABLE_QAT_HW_GCM + if (!qat_sw_gcm_offload && qat_hw_offload) { + if (nid == NID_aes_192_gcm) + return qat_gcm_cipher_sw_impl(nid); + + if ((c = EVP_CIPHER_meth_new(nid, AES_GCM_BLOCK_SIZE, keylen)) == NULL) { + WARN("Failed to allocate cipher methods for nid %d\n", nid); + return NULL; + } + + res &= EVP_CIPHER_meth_set_iv_length(c, AES_GCM_IV_LEN); + res &= EVP_CIPHER_meth_set_flags(c, QAT_GCM_FLAGS); + res &= EVP_CIPHER_meth_set_init(c, qat_aes_gcm_init); + res &= EVP_CIPHER_meth_set_do_cipher(c, qat_aes_gcm_cipher); + res &= EVP_CIPHER_meth_set_cleanup(c, qat_aes_gcm_cleanup); + res &= EVP_CIPHER_meth_set_impl_ctx_size(c, sizeof(qat_gcm_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); + res &= EVP_CIPHER_meth_set_ctrl(c, qat_aes_gcm_ctrl); + qat_hw_gcm_offload = 1; + DEBUG("QAT HW AES_GCM registration\n"); + } +#endif + + if (0 == res) { + WARN("Failed to set cipher methods for nid %d\n", nid); + EVP_CIPHER_meth_free(c); + c = NULL; + } + + if (!qat_sw_gcm_offload && !qat_hw_gcm_offload) { + DEBUG("OpenSSL SW AES_GCM registration\n"); + return qat_gcm_cipher_sw_impl(nid); + } + + return c; +} + void qat_create_ciphers(void) { int i; @@ -458,22 +547,14 @@ void qat_create_ciphers(void) for (i = 0; i < num_cc; i++) { if (info[i].cipher == NULL) { switch (info[i].nid) { +# if defined(ENABLE_QAT_HW_GCM) || defined(ENABLE_QAT_SW_GCM) case NID_aes_128_gcm: case NID_aes_192_gcm: case NID_aes_256_gcm: -#ifdef ENABLE_QAT_SW_GCM - if(qat_sw_ipsec) - info[i].cipher = (EVP_CIPHER *) - vaesgcm_create_cipher_meth(info[i].nid, info[i].keylen); -#endif -#ifdef ENABLE_QAT_HW_GCM - if (qat_hw_offload) { - if (info[i].nid != NID_aes_192_gcm) - info[i].cipher = (EVP_CIPHER *) - qat_create_gcm_cipher_meth(info[i].nid, info[i].keylen); - } -#endif + info[i].cipher = (EVP_CIPHER *) + qat_create_gcm_cipher_meth(info[i].nid, info[i].keylen); break; +#endif #ifdef QAT_HW # if OPENSSL_VERSION_NUMBER > 0x10101000L @@ -515,10 +596,11 @@ void qat_free_ciphers(void) case NID_aes_192_gcm: case NID_aes_256_gcm: #ifdef ENABLE_QAT_SW_GCM - EVP_CIPHER_meth_free(info[i].cipher); + if (qat_sw_gcm_offload) + EVP_CIPHER_meth_free(info[i].cipher); #endif #ifdef ENABLE_QAT_HW_GCM - if (info[i].nid != NID_aes_192_gcm) + if (qat_hw_gcm_offload && info[i].nid != NID_aes_192_gcm) EVP_CIPHER_meth_free(info[i].cipher); #endif break; @@ -539,6 +621,8 @@ void qat_free_ciphers(void) info[i].cipher = NULL; } } + qat_hw_gcm_offload = 0; + qat_sw_gcm_offload = 0; } /****************************************************************************** @@ -702,6 +786,10 @@ void qat_free_EC_methods(void) if (NULL != qat_ec_method) { EC_KEY_METHOD_free(qat_ec_method); qat_ec_method = NULL; + qat_hw_ecdh_offload = 0; + qat_hw_ecdsa_offload = 0; + qat_sw_ecdh_offload = 0; + qat_sw_ecdsa_offload = 0; } } diff --git a/qat_evp.h b/qat_evp.h index ea62356e..08dfcb0f 100644 --- a/qat_evp.h +++ b/qat_evp.h @@ -49,11 +49,12 @@ # include # include -# define AES_KEY_SIZE_128 16 -# define AES_KEY_SIZE_192 24 -# define AES_KEY_SIZE_256 32 +# define AES_KEY_SIZE_128 16 +# define AES_KEY_SIZE_192 24 +# define AES_KEY_SIZE_256 32 +# define AES_GCM_BLOCK_SIZE 1 -# define CHACHA_KEY_SIZE 32 +# define CHACHA_KEY_SIZE 32 typedef int (*PFUNC_COMP_KEY)(unsigned char **, size_t *, @@ -119,10 +120,12 @@ EVP_PKEY_METHOD *qat_hkdf_pmeth(void); EVP_PKEY_METHOD *qat_x25519_pmeth(void); EVP_PKEY_METHOD *qat_x448_pmeth(void); + void qat_create_ciphers(void); void qat_free_ciphers(void); int qat_ciphers(ENGINE *e, const EVP_CIPHER **cipher, const int **nids, int nid); +const EVP_CIPHER *qat_create_gcm_cipher_meth(int nid, int keylen); # ifndef ENABLE_QAT_HW_SMALL_PKT_OFFLOAD # define CRYPTO_SMALL_PACKET_OFFLOAD_THRESHOLD_DEFAULT 2048 int qat_pkt_threshold_table_set_threshold(const char *cn , int threshold); diff --git a/qat_hw_gcm.c b/qat_hw_gcm.c index bec2a30e..443204fc 100644 --- a/qat_hw_gcm.c +++ b/qat_hw_gcm.c @@ -64,6 +64,7 @@ #include "cpa.h" #include "cpa_types.h" #include "cpa_cy_sym.h" +#include "qat_evp.h" #include "qat_hw_gcm.h" #include "qat_hw_ciphers.h" @@ -81,67 +82,6 @@ # endif #endif -#ifdef ENABLE_QAT_HW_GCM -static int qat_aes_gcm_init(EVP_CIPHER_CTX *ctx, - const unsigned char *inkey, - const unsigned char *iv, int enc); -static int qat_aes_gcm_cleanup(EVP_CIPHER_CTX *ctx); -static int qat_aes_gcm_cipher(EVP_CIPHER_CTX *ctx, - unsigned char *out, - const unsigned char *in, size_t len); -static int qat_aes_gcm_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, - void *ptr); -#endif - -static inline const EVP_CIPHER *qat_gcm_cipher_sw_impl(int nid) -{ - switch (nid) { - case NID_aes_128_gcm: - return EVP_aes_128_gcm(); - case NID_aes_256_gcm: - return EVP_aes_256_gcm(); - default: - WARN("Invalid nid %d\n", nid); - return NULL; - } -} - -const EVP_CIPHER *qat_create_gcm_cipher_meth(int nid, int keylen) -{ -#ifdef ENABLE_QAT_HW_GCM - EVP_CIPHER *c = NULL; - int res = 1; - - if ((c = EVP_CIPHER_meth_new(nid, AES_GCM_BLOCK_SIZE, keylen)) == NULL) { - WARN("Failed to allocate cipher methods for nid %d\n", nid); - return NULL; - } - - res &= EVP_CIPHER_meth_set_iv_length(c, AES_GCM_IV_LEN); - res &= EVP_CIPHER_meth_set_flags(c, QAT_GCM_FLAGS); - res &= EVP_CIPHER_meth_set_init(c, qat_aes_gcm_init); - res &= EVP_CIPHER_meth_set_do_cipher(c, qat_aes_gcm_cipher); - res &= EVP_CIPHER_meth_set_cleanup(c, qat_aes_gcm_cleanup); - res &= EVP_CIPHER_meth_set_impl_ctx_size(c, sizeof(qat_gcm_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); - res &= EVP_CIPHER_meth_set_ctrl(c, qat_aes_gcm_ctrl); - - if (0 == res) { - WARN("Failed to set cipher methods for nid %d\n", nid); - EVP_CIPHER_meth_free(c); - c = NULL; - } - - DEBUG("QAT HW AES_GCM registration succeeded\n"); - return c; -#else - return qat_gcm_cipher_sw_impl(nid); -#endif -} - #ifdef ENABLE_QAT_HW_GCM /****************************************************************************** * function: @@ -278,10 +218,10 @@ static int qat_session_data_init(EVP_CIPHER_CTX *ctx, * EVP context. * ******************************************************************************/ -static int qat_aes_gcm_init(EVP_CIPHER_CTX *ctx, - const unsigned char *inkey, - const unsigned char *iv, - int enc) +int qat_aes_gcm_init(EVP_CIPHER_CTX *ctx, + const unsigned char *inkey, + const unsigned char *iv, + int enc) { qat_gcm_ctx* qctx = NULL; @@ -426,7 +366,7 @@ static inline void qat_aes_gcm_inc_ctr(unsigned char* ifc) * in the authentication calculation and to identify record payload size. * ******************************************************************************/ -static int qat_aes_gcm_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr) +int qat_aes_gcm_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr) { qat_gcm_ctx *qctx = NULL; unsigned int plen = 0; @@ -718,7 +658,7 @@ static int qat_aes_gcm_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr) * cryptographic transform. * ******************************************************************************/ -static int qat_aes_gcm_cleanup(EVP_CIPHER_CTX *ctx) +int qat_aes_gcm_cleanup(EVP_CIPHER_CTX *ctx) { qat_gcm_ctx* qctx = NULL; CpaStatus sts = 0; diff --git a/qat_hw_gcm.h b/qat_hw_gcm.h index dd196478..4b6ac0d6 100644 --- a/qat_hw_gcm.h +++ b/qat_hw_gcm.h @@ -53,7 +53,6 @@ # include "cpa_cy_sym.h" # include "cpa_cy_drbg.h" -# define AES_GCM_BLOCK_SIZE 1 # define AES_GCM_IV_LEN 12 # define QAT_GCM_GET_CTX(ctx) (EVP_CIPHER_CTX_get_cipher_data(ctx)) @@ -152,6 +151,14 @@ typedef struct qat_aes_gcm_ctx_t int key_set; } qat_gcm_ctx; -const EVP_CIPHER *qat_create_gcm_cipher_meth(int nid, int keylen); +int qat_aes_gcm_init(EVP_CIPHER_CTX *ctx, + const unsigned char *inkey, + const unsigned char *iv, int enc); +int qat_aes_gcm_cleanup(EVP_CIPHER_CTX *ctx); +int qat_aes_gcm_cipher(EVP_CIPHER_CTX *ctx, + unsigned char *out, + const unsigned char *in, size_t len); +int qat_aes_gcm_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, + void *ptr); #endif /* QAT_HW_GCM_H */ diff --git a/qat_hw_rsa.c b/qat_hw_rsa.c index 40c72fe1..efb82d9f 100644 --- a/qat_hw_rsa.c +++ b/qat_hw_rsa.c @@ -162,6 +162,7 @@ void qat_free_RSA_methods(void) if (qat_rsa_method != NULL) { RSA_meth_free(qat_rsa_method); qat_rsa_method = NULL; + qat_hw_rsa_offload = 0; } #endif } diff --git a/qat_prov.txt b/qat_prov.txt index c501e61c..93510deb 100644 --- a/qat_prov.txt +++ b/qat_prov.txt @@ -156,98 +156,105 @@ QAT_R_PADDING_UNKNOWN:245:padding unknown QAT_R_POLLING_THREAD_CREATE_FAILURE:246:polling thread create failure QAT_R_POLLING_THREAD_SIGMASK_FAILURE:247:polling thread sigmask failure QAT_R_POLL_INSTANCE_FAILURE:248:poll instance failure -QAT_R_PPV_MALLOC_FAILURE:249:ppv malloc failure -QAT_R_PPV_PDATA_MALLOC_FAILURE:250:ppv pdata malloc failure -QAT_R_PRESULTR_MALLOC_FAILURE:251:presultr malloc failure -QAT_R_PRESULTR_PDATA_MALLOC_FAILURE:252:presultr pdata malloc failure -QAT_R_PRESULTS_MALLOC_FAILURE:253:presults malloc failure -QAT_R_PRESULTS_PDATA_MALLOC_FAILURE:254:presults pdata malloc failure -QAT_R_PRESULTX_MALLOC_FAILURE:255:presultx malloc failure -QAT_R_PRESULTX_PDATA_MALLOC_FAILURE:256:presultx pdata malloc failure -QAT_R_PRESULTY_LENGTH_CHECK_FAILURE:257:presulty length check failure -QAT_R_PRESULTY_MALLOC_FAILURE:258:presulty malloc failure -QAT_R_PRESULTY_PDATA_MALLOC_FAILURE:259:presulty pdata malloc failure -QAT_R_PRIV_KEY_DUPLICATE_FAILURE:260:priv key duplicate failure -QAT_R_PRIV_KEY_MALLOC_FAILURE:261:priv key malloc failure -QAT_R_PRIV_KEY_M_XG_YG_A_B_P_CONVERT_TO_FB_FAILURE:262:\ +QAT_R_POPDATA_A_PDATA_MALLOC_FAILURE:249:popdata a pdata malloc failure +QAT_R_POPDATA_MALLOC_FAILURE:250:popdata malloc failure +QAT_R_POPDATA_PCURVE_MALLOC_FAILURE:251:popdata pcurve malloc failure +QAT_R_PPV_MALLOC_FAILURE:252:ppv malloc failure +QAT_R_PPV_PDATA_MALLOC_FAILURE:253:ppv pdata malloc failure +QAT_R_PRESULTR_MALLOC_FAILURE:254:presultr malloc failure +QAT_R_PRESULTR_PDATA_MALLOC_FAILURE:255:presultr pdata malloc failure +QAT_R_PRESULTS_MALLOC_FAILURE:256:presults malloc failure +QAT_R_PRESULTS_PDATA_MALLOC_FAILURE:257:presults pdata malloc failure +QAT_R_PRESULTX_MALLOC_FAILURE:258:presultx malloc failure +QAT_R_PRESULTX_PDATA_MALLOC_FAILURE:259:presultx pdata malloc failure +QAT_R_PRESULTY_LENGTH_CHECK_FAILURE:260:presulty length check failure +QAT_R_PRESULTY_MALLOC_FAILURE:261:presulty malloc failure +QAT_R_PRESULTY_PDATA_MALLOC_FAILURE:262:presulty pdata malloc failure +QAT_R_PRIV_KEY_DUPLICATE_FAILURE:263:priv key duplicate failure +QAT_R_PRIV_KEY_MALLOC_FAILURE:264:priv key malloc failure +QAT_R_PRIV_KEY_M_XG_YG_A_B_P_CONVERT_TO_FB_FAILURE:265:\ priv key m xg yg a b p convert to fb failure -QAT_R_PRIV_KEY_NULL:263:priv key null -QAT_R_PRIV_KEY_RAND_GENERATE_FAILURE:264:priv key rand generate failure -QAT_R_PRIV_KEY_XG_YG_A_B_P_CONVERT_TO_FB_FAILURE:265:\ +QAT_R_PRIV_KEY_NULL:266:priv key null +QAT_R_PRIV_KEY_RAND_GENERATE_FAILURE:267:priv key rand generate failure +QAT_R_PRIV_KEY_XG_YG_A_B_P_CONVERT_TO_FB_FAILURE:268:\ priv key xg yg a b p convert to fb failure -QAT_R_PTHREAD_CREATE_FAILURE:266:pthread create failure -QAT_R_PTHREAD_GETAFFINITY_FAILURE:267:pthread getaffinity failure -QAT_R_PTHREAD_JOIN_FAILURE:268:pthread join failure -QAT_R_PTHREAD_KILL_FAILURE:269:pthread kill failure -QAT_R_PTHREAD_SETAFFINITY_FAILURE:270:pthread setaffinity failure -QAT_R_PUB_KEY_DUPLICATE_FAILURE:271:pub key duplicate failure -QAT_R_PUB_KEY_MALLOC_FAILURE:272:pub key malloc failure -QAT_R_PUB_KEY_NULL:273:pub key null -QAT_R_P_A_B_XG_YG_MALLOC_FAILURE:274:p a b xg yg malloc failure -QAT_R_P_A_B_XG_YG_M_K_R_ORDER_MALLOC_FAILURE:275:\ +QAT_R_PRIV_KEY_XP_YP_A_B_P_CONVERT_TO_FB_FAILURE:269:\ + priv key xp yp a b p convert to fb failure +QAT_R_PTHREAD_CREATE_FAILURE:270:pthread create failure +QAT_R_PTHREAD_GETAFFINITY_FAILURE:271:pthread getaffinity failure +QAT_R_PTHREAD_JOIN_FAILURE:272:pthread join failure +QAT_R_PTHREAD_KILL_FAILURE:273:pthread kill failure +QAT_R_PTHREAD_SETAFFINITY_FAILURE:274:pthread setaffinity failure +QAT_R_PUB_KEY_DUPLICATE_FAILURE:275:pub key duplicate failure +QAT_R_PUB_KEY_MALLOC_FAILURE:276:pub key malloc failure +QAT_R_PUB_KEY_NULL:277:pub key null +QAT_R_P_A_B_XG_YG_MALLOC_FAILURE:278:p a b xg yg malloc failure +QAT_R_P_A_B_XG_YG_M_K_R_ORDER_MALLOC_FAILURE:279:\ p a b xg yg m k r order malloc failure -QAT_R_P_A_B_XG_YG_XP_YP_M_ORDER_FAILURE:276:p a b xg yg xp yp m order failure -QAT_R_P_G_PRIV_KEY_CONVERT_TO_FB_FAILURE:277:p g priv key convert to fb failure -QAT_R_P_PUB_PRIV_KEY_CONVERT_TO_FB_FAILURE:278:\ +QAT_R_P_A_B_XG_YG_XP_YP_M_ORDER_FAILURE:280:p a b xg yg xp yp m order failure +QAT_R_P_A_B_XP_YP_FAILURE:281:p a b xp yp failure +QAT_R_P_A_B_XP_YP_MALLOC_FAILURE:282:p a b xp yp malloc failure +QAT_R_P_G_PRIV_KEY_CONVERT_TO_FB_FAILURE:283:p g priv key convert to fb failure +QAT_R_P_PUB_PRIV_KEY_CONVERT_TO_FB_FAILURE:284:\ p pub priv key convert to fb failure -QAT_R_P_Q_DMP_DMQ_CONVERT_TO_FB_FAILURE:279:p q dmp dmq convert to fb failure -QAT_R_P_Q_DMP_DMQ_IQMP_NULL:280:p q dmp dmq iqmp null -QAT_R_P_Q_G_NULL:281:p q g null -QAT_R_P_Q_G_X_K_CONVERT_TO_FB_FAILURE:282:p q g x k convert to fb failure -QAT_R_P_Q_G_Y_Z_R_S_CONVERT_TO_FB_FAILURE:283:\ +QAT_R_P_Q_DMP_DMQ_CONVERT_TO_FB_FAILURE:285:p q dmp dmq convert to fb failure +QAT_R_P_Q_DMP_DMQ_IQMP_NULL:286:p q dmp dmq iqmp null +QAT_R_P_Q_G_NULL:287:p q g null +QAT_R_P_Q_G_X_K_CONVERT_TO_FB_FAILURE:288:p q g x k convert to fb failure +QAT_R_P_Q_G_Y_Z_R_S_CONVERT_TO_FB_FAILURE:289:\ p q g y z r s convert to fb failure -QAT_R_QAT_ALLOC_DH_METH_FAILURE:284:qat alloc dh meth failure -QAT_R_QAT_CREATE_ENGINE_FAILURE:285:qat create engine failure -QAT_R_QAT_ECDSA_DO_SIGN_FAIL:286:qat ecdsa do sign fail -QAT_R_QAT_FREE_EC_METHOD_FAILURE:287:qat free ec method failure -QAT_R_QAT_GET_EC_METHOD_MALLOC_FAILURE:288:qat get ec method malloc failure -QAT_R_QAT_SET_DH_METH_FAILURE:289:qat set dh meth failure -QAT_R_QCTX_CTX_NULL:290:qctx ctx null -QAT_R_QCTX_NULL:291:qctx null -QAT_R_RAND_BYTES_FAILURE:292:rand bytes failure -QAT_R_RAND_FAILURE:293:rand failure -QAT_R_RAND_GENERATE_FAILURE:294:rand generate failure -QAT_R_RESULT_PDATA_ALLOC_FAIL:295:result pdata alloc fail -QAT_R_RETRIEVE_EC_POINT_FAILURE:296:retrieve ec point failure -QAT_R_RETRIEVE_ORDER_FAILURE:297:retrieve order failure -QAT_R_RSA_FROM_TO_NULL:298:rsa from to null -QAT_R_RSA_OUTPUT_BUF_PDATA_MALLOC_FAILURE:299:\ +QAT_R_QAT_ALLOC_DH_METH_FAILURE:290:qat alloc dh meth failure +QAT_R_QAT_CREATE_ENGINE_FAILURE:291:qat create engine failure +QAT_R_QAT_ECDSA_DO_SIGN_FAIL:292:qat ecdsa do sign fail +QAT_R_QAT_FREE_EC_METHOD_FAILURE:293:qat free ec method failure +QAT_R_QAT_GET_EC_METHOD_MALLOC_FAILURE:294:qat get ec method malloc failure +QAT_R_QAT_SET_DH_METH_FAILURE:295:qat set dh meth failure +QAT_R_QCTX_CTX_NULL:296:qctx ctx null +QAT_R_QCTX_NULL:297:qctx null +QAT_R_RAND_BYTES_FAILURE:298:rand bytes failure +QAT_R_RAND_FAILURE:299:rand failure +QAT_R_RAND_GENERATE_FAILURE:300:rand generate failure +QAT_R_RESULT_PDATA_ALLOC_FAIL:301:result pdata alloc fail +QAT_R_RETRIEVE_EC_POINT_FAILURE:302:retrieve ec point failure +QAT_R_RETRIEVE_ORDER_FAILURE:303:retrieve order failure +QAT_R_RSA_FROM_TO_NULL:304:rsa from to null +QAT_R_RSA_OUTPUT_BUF_PDATA_MALLOC_FAILURE:305:\ rsa output buf pdata malloc failure -QAT_R_R_Q_COMPARE_FAILURE:300:r q compare failure -QAT_R_SECRET_KEY_MALLOC_FAILURE:301:secret key malloc failure -QAT_R_SECRET_KEY_PDATA_MALLOC_FAILURE:302:secret key pdata malloc failure -QAT_R_SETUP_ASYNC_EVENT_FAILURE:303:setup async event failure -QAT_R_SET_ADDRESS_TRANSLATION_FAILURE:304:set address translation failure -QAT_R_SET_FILE_DESCRIPTOR_NONBLOCKING_FAILURE:305:\ +QAT_R_R_Q_COMPARE_FAILURE:306:r q compare failure +QAT_R_SECRET_KEY_MALLOC_FAILURE:307:secret key malloc failure +QAT_R_SECRET_KEY_PDATA_MALLOC_FAILURE:308:secret key pdata malloc failure +QAT_R_SETUP_ASYNC_EVENT_FAILURE:309:setup async event failure +QAT_R_SET_ADDRESS_TRANSLATION_FAILURE:310:set address translation failure +QAT_R_SET_FILE_DESCRIPTOR_NONBLOCKING_FAILURE:311:\ set file descriptor nonblocking failure -QAT_R_SET_INSTANCE_FAILURE:306:set instance failure -QAT_R_SET_MULTIBUFF_RSA_METH_FAILURE:307:set multibuff rsa meth failure -QAT_R_SET_NOTIFICATION_CALLBACK_FAILURE:308:set notification callback failure -QAT_R_SET_POLLING_THREAD_AFFINITY_FAILURE:309:\ +QAT_R_SET_INSTANCE_FAILURE:312:set instance failure +QAT_R_SET_MULTIBUFF_RSA_METH_FAILURE:313:set multibuff rsa meth failure +QAT_R_SET_NOTIFICATION_CALLBACK_FAILURE:314:set notification callback failure +QAT_R_SET_POLLING_THREAD_AFFINITY_FAILURE:315:\ set polling thread affinity failure -QAT_R_SET_PRIV_KEY_FAILURE:310:set priv key failure -QAT_R_SET_QAT_DSA_METH_FAILURE:311:set qat dsa meth failure -QAT_R_SET_QAT_RSA_METH_FAILURE:312:set qat rsa meth failure -QAT_R_SET_TAG_INVALID_OP:313:set tag invalid op -QAT_R_SHA3_CTX_NULL:314:sha3 ctx null -QAT_R_SIG_GET_R_S_FAILURE:315:sig get r s failure -QAT_R_SIG_MALLOC_FAILURE:316:sig malloc failure -QAT_R_SSD_MALLOC_FAILURE:317:ssd malloc failure -QAT_R_SSD_NULL:318:ssd null -QAT_R_START_INSTANCE_FAILURE:319:start instance failure -QAT_R_STOP_INSTANCE_FAILURE:320:stop instance failure -QAT_R_SW_GET_COMPUTE_KEY_PFUNC_NULL:321:sw get compute key pfunc null -QAT_R_SW_GET_KEYGEN_PFUNC_NULL:322:sw get keygen pfunc null -QAT_R_SW_GET_SIGN_PFUNC_NULL:323:sw get sign pfunc null -QAT_R_SW_GET_SIGN_SETUP_PFUNC_NULL:324:sw get sign setup pfunc null -QAT_R_SW_GET_SIGN_SIG_PFUNC_NULL:325:sw get sign sig pfunc null -QAT_R_SW_GET_VERIFY_SIG_PFUNC_NULL:326:sw get verify sig pfunc null -QAT_R_SW_METHOD_NULL:327:sw method null -QAT_R_S_NULL:328:s null -QAT_R_S_Q_COMPARE_FAILURE:329:s q compare failure -QAT_R_UNKNOWN_PADDING:330:unknown padding -QAT_R_UNKNOWN_PADDING_TYPE:331:unknown padding type -QAT_R_WAKE_PAUSE_JOB_FAILURE:332:wake pause job failure -QAT_R_X_Y_TX_TY_BN_MALLOC_FAILURE:333:x y tx ty bn malloc failure -QAT_R_X_Y_Z_MALLOC_FAILURE:334:x y z malloc failure -QAT_R_Z_ALLOCATE_FAILURE:335:z allocate failure +QAT_R_SET_PRIV_KEY_FAILURE:316:set priv key failure +QAT_R_SET_QAT_DSA_METH_FAILURE:317:set qat dsa meth failure +QAT_R_SET_QAT_RSA_METH_FAILURE:318:set qat rsa meth failure +QAT_R_SET_TAG_INVALID_OP:319:set tag invalid op +QAT_R_SHA3_CTX_NULL:320:sha3 ctx null +QAT_R_SIG_GET_R_S_FAILURE:321:sig get r s failure +QAT_R_SIG_MALLOC_FAILURE:322:sig malloc failure +QAT_R_SSD_MALLOC_FAILURE:323:ssd malloc failure +QAT_R_SSD_NULL:324:ssd null +QAT_R_START_INSTANCE_FAILURE:325:start instance failure +QAT_R_STOP_INSTANCE_FAILURE:326:stop instance failure +QAT_R_SW_GET_COMPUTE_KEY_PFUNC_NULL:327:sw get compute key pfunc null +QAT_R_SW_GET_KEYGEN_PFUNC_NULL:328:sw get keygen pfunc null +QAT_R_SW_GET_SIGN_PFUNC_NULL:329:sw get sign pfunc null +QAT_R_SW_GET_SIGN_SETUP_PFUNC_NULL:330:sw get sign setup pfunc null +QAT_R_SW_GET_SIGN_SIG_PFUNC_NULL:331:sw get sign sig pfunc null +QAT_R_SW_GET_VERIFY_SIG_PFUNC_NULL:332:sw get verify sig pfunc null +QAT_R_SW_METHOD_NULL:333:sw method null +QAT_R_S_NULL:334:s null +QAT_R_S_Q_COMPARE_FAILURE:335:s q compare failure +QAT_R_UNKNOWN_PADDING:336:unknown padding +QAT_R_UNKNOWN_PADDING_TYPE:337:unknown padding type +QAT_R_WAKE_PAUSE_JOB_FAILURE:338:wake pause job failure +QAT_R_X_Y_TX_TY_BN_MALLOC_FAILURE:339:x y tx ty bn malloc failure +QAT_R_X_Y_Z_MALLOC_FAILURE:340:x y z malloc failure +QAT_R_Z_ALLOCATE_FAILURE:341:z allocate failure diff --git a/qat_prov_err.c b/qat_prov_err.c index 1eb3c715..5cede11d 100644 --- a/qat_prov_err.c +++ b/qat_prov_err.c @@ -214,6 +214,11 @@ static ERR_STRING_DATA QAT_str_reasons[] = { {ERR_PACK(0, 0, QAT_R_POLLING_THREAD_SIGMASK_FAILURE), "polling thread sigmask failure"}, {ERR_PACK(0, 0, QAT_R_POLL_INSTANCE_FAILURE), "poll instance failure"}, + {ERR_PACK(0, 0, QAT_R_POPDATA_A_PDATA_MALLOC_FAILURE), + "popdata a pdata malloc failure"}, + {ERR_PACK(0, 0, QAT_R_POPDATA_MALLOC_FAILURE), "popdata malloc failure"}, + {ERR_PACK(0, 0, QAT_R_POPDATA_PCURVE_MALLOC_FAILURE), + "popdata pcurve malloc failure"}, {ERR_PACK(0, 0, QAT_R_PPV_MALLOC_FAILURE), "ppv malloc failure"}, {ERR_PACK(0, 0, QAT_R_PPV_PDATA_MALLOC_FAILURE), "ppv pdata malloc failure"}, @@ -241,6 +246,8 @@ static ERR_STRING_DATA QAT_str_reasons[] = { "priv key rand generate failure"}, {ERR_PACK(0, 0, QAT_R_PRIV_KEY_XG_YG_A_B_P_CONVERT_TO_FB_FAILURE), "priv key xg yg a b p convert to fb failure"}, + {ERR_PACK(0, 0, QAT_R_PRIV_KEY_XP_YP_A_B_P_CONVERT_TO_FB_FAILURE), + "priv key xp yp a b p convert to fb failure"}, {ERR_PACK(0, 0, QAT_R_PTHREAD_CREATE_FAILURE), "pthread create failure"}, {ERR_PACK(0, 0, QAT_R_PTHREAD_GETAFFINITY_FAILURE), "pthread getaffinity failure"}, @@ -258,6 +265,9 @@ static ERR_STRING_DATA QAT_str_reasons[] = { "p a b xg yg m k r order malloc failure"}, {ERR_PACK(0, 0, QAT_R_P_A_B_XG_YG_XP_YP_M_ORDER_FAILURE), "p a b xg yg xp yp m order failure"}, + {ERR_PACK(0, 0, QAT_R_P_A_B_XP_YP_FAILURE), "p a b xp yp failure"}, + {ERR_PACK(0, 0, QAT_R_P_A_B_XP_YP_MALLOC_FAILURE), + "p a b xp yp malloc failure"}, {ERR_PACK(0, 0, QAT_R_P_G_PRIV_KEY_CONVERT_TO_FB_FAILURE), "p g priv key convert to fb failure"}, {ERR_PACK(0, 0, QAT_R_P_PUB_PRIV_KEY_CONVERT_TO_FB_FAILURE), diff --git a/qat_prov_err.h b/qat_prov_err.h index 156262d3..fd46ac05 100644 --- a/qat_prov_err.h +++ b/qat_prov_err.h @@ -181,92 +181,98 @@ void ERR_QAT_error(int function, int reason, const char *file, int line); # define QAT_R_POLLING_THREAD_CREATE_FAILURE 246 # define QAT_R_POLLING_THREAD_SIGMASK_FAILURE 247 # define QAT_R_POLL_INSTANCE_FAILURE 248 -# define QAT_R_PPV_MALLOC_FAILURE 249 -# define QAT_R_PPV_PDATA_MALLOC_FAILURE 250 -# define QAT_R_PRESULTR_MALLOC_FAILURE 251 -# define QAT_R_PRESULTR_PDATA_MALLOC_FAILURE 252 -# define QAT_R_PRESULTS_MALLOC_FAILURE 253 -# define QAT_R_PRESULTS_PDATA_MALLOC_FAILURE 254 -# define QAT_R_PRESULTX_MALLOC_FAILURE 255 -# define QAT_R_PRESULTX_PDATA_MALLOC_FAILURE 256 -# define QAT_R_PRESULTY_LENGTH_CHECK_FAILURE 257 -# define QAT_R_PRESULTY_MALLOC_FAILURE 258 -# define QAT_R_PRESULTY_PDATA_MALLOC_FAILURE 259 -# define QAT_R_PRIV_KEY_DUPLICATE_FAILURE 260 -# define QAT_R_PRIV_KEY_MALLOC_FAILURE 261 -# define QAT_R_PRIV_KEY_M_XG_YG_A_B_P_CONVERT_TO_FB_FAILURE 262 -# define QAT_R_PRIV_KEY_NULL 263 -# define QAT_R_PRIV_KEY_RAND_GENERATE_FAILURE 264 -# define QAT_R_PRIV_KEY_XG_YG_A_B_P_CONVERT_TO_FB_FAILURE 265 -# define QAT_R_PTHREAD_CREATE_FAILURE 266 -# define QAT_R_PTHREAD_GETAFFINITY_FAILURE 267 -# define QAT_R_PTHREAD_JOIN_FAILURE 268 -# define QAT_R_PTHREAD_KILL_FAILURE 269 -# define QAT_R_PTHREAD_SETAFFINITY_FAILURE 270 -# define QAT_R_PUB_KEY_DUPLICATE_FAILURE 271 -# define QAT_R_PUB_KEY_MALLOC_FAILURE 272 -# define QAT_R_PUB_KEY_NULL 273 -# define QAT_R_P_A_B_XG_YG_MALLOC_FAILURE 274 -# define QAT_R_P_A_B_XG_YG_M_K_R_ORDER_MALLOC_FAILURE 275 -# define QAT_R_P_A_B_XG_YG_XP_YP_M_ORDER_FAILURE 276 -# define QAT_R_P_G_PRIV_KEY_CONVERT_TO_FB_FAILURE 277 -# define QAT_R_P_PUB_PRIV_KEY_CONVERT_TO_FB_FAILURE 278 -# define QAT_R_P_Q_DMP_DMQ_CONVERT_TO_FB_FAILURE 279 -# define QAT_R_P_Q_DMP_DMQ_IQMP_NULL 280 -# define QAT_R_P_Q_G_NULL 281 -# define QAT_R_P_Q_G_X_K_CONVERT_TO_FB_FAILURE 282 -# define QAT_R_P_Q_G_Y_Z_R_S_CONVERT_TO_FB_FAILURE 283 -# define QAT_R_QAT_ALLOC_DH_METH_FAILURE 284 -# define QAT_R_QAT_CREATE_ENGINE_FAILURE 285 -# define QAT_R_QAT_ECDSA_DO_SIGN_FAIL 286 -# define QAT_R_QAT_FREE_EC_METHOD_FAILURE 287 -# define QAT_R_QAT_GET_EC_METHOD_MALLOC_FAILURE 288 -# define QAT_R_QAT_SET_DH_METH_FAILURE 289 -# define QAT_R_QCTX_CTX_NULL 290 -# define QAT_R_QCTX_NULL 291 -# define QAT_R_RAND_BYTES_FAILURE 292 -# define QAT_R_RAND_FAILURE 293 -# define QAT_R_RAND_GENERATE_FAILURE 294 -# define QAT_R_RESULT_PDATA_ALLOC_FAIL 295 -# define QAT_R_RETRIEVE_EC_POINT_FAILURE 296 -# define QAT_R_RETRIEVE_ORDER_FAILURE 297 -# define QAT_R_RSA_FROM_TO_NULL 298 -# define QAT_R_RSA_OUTPUT_BUF_PDATA_MALLOC_FAILURE 299 -# define QAT_R_R_Q_COMPARE_FAILURE 300 -# define QAT_R_SECRET_KEY_MALLOC_FAILURE 301 -# define QAT_R_SECRET_KEY_PDATA_MALLOC_FAILURE 302 -# define QAT_R_SETUP_ASYNC_EVENT_FAILURE 303 -# define QAT_R_SET_ADDRESS_TRANSLATION_FAILURE 304 -# define QAT_R_SET_FILE_DESCRIPTOR_NONBLOCKING_FAILURE 305 -# define QAT_R_SET_INSTANCE_FAILURE 306 -# define QAT_R_SET_MULTIBUFF_RSA_METH_FAILURE 307 -# define QAT_R_SET_NOTIFICATION_CALLBACK_FAILURE 308 -# define QAT_R_SET_POLLING_THREAD_AFFINITY_FAILURE 309 -# define QAT_R_SET_PRIV_KEY_FAILURE 310 -# define QAT_R_SET_QAT_DSA_METH_FAILURE 311 -# define QAT_R_SET_QAT_RSA_METH_FAILURE 312 -# define QAT_R_SET_TAG_INVALID_OP 313 -# define QAT_R_SHA3_CTX_NULL 314 -# define QAT_R_SIG_GET_R_S_FAILURE 315 -# define QAT_R_SIG_MALLOC_FAILURE 316 -# define QAT_R_SSD_MALLOC_FAILURE 317 -# define QAT_R_SSD_NULL 318 -# define QAT_R_START_INSTANCE_FAILURE 319 -# define QAT_R_STOP_INSTANCE_FAILURE 320 -# define QAT_R_SW_GET_COMPUTE_KEY_PFUNC_NULL 321 -# define QAT_R_SW_GET_KEYGEN_PFUNC_NULL 322 -# define QAT_R_SW_GET_SIGN_PFUNC_NULL 323 -# define QAT_R_SW_GET_SIGN_SETUP_PFUNC_NULL 324 -# define QAT_R_SW_GET_SIGN_SIG_PFUNC_NULL 325 -# define QAT_R_SW_GET_VERIFY_SIG_PFUNC_NULL 326 -# define QAT_R_SW_METHOD_NULL 327 -# define QAT_R_S_NULL 328 -# define QAT_R_S_Q_COMPARE_FAILURE 329 -# define QAT_R_UNKNOWN_PADDING 330 -# define QAT_R_UNKNOWN_PADDING_TYPE 331 -# define QAT_R_WAKE_PAUSE_JOB_FAILURE 332 -# define QAT_R_X_Y_TX_TY_BN_MALLOC_FAILURE 333 -# define QAT_R_X_Y_Z_MALLOC_FAILURE 334 -# define QAT_R_Z_ALLOCATE_FAILURE 335 +# define QAT_R_POPDATA_A_PDATA_MALLOC_FAILURE 249 +# define QAT_R_POPDATA_MALLOC_FAILURE 250 +# define QAT_R_POPDATA_PCURVE_MALLOC_FAILURE 251 +# define QAT_R_PPV_MALLOC_FAILURE 252 +# define QAT_R_PPV_PDATA_MALLOC_FAILURE 253 +# define QAT_R_PRESULTR_MALLOC_FAILURE 254 +# define QAT_R_PRESULTR_PDATA_MALLOC_FAILURE 255 +# define QAT_R_PRESULTS_MALLOC_FAILURE 256 +# define QAT_R_PRESULTS_PDATA_MALLOC_FAILURE 257 +# define QAT_R_PRESULTX_MALLOC_FAILURE 258 +# define QAT_R_PRESULTX_PDATA_MALLOC_FAILURE 259 +# define QAT_R_PRESULTY_LENGTH_CHECK_FAILURE 260 +# define QAT_R_PRESULTY_MALLOC_FAILURE 261 +# define QAT_R_PRESULTY_PDATA_MALLOC_FAILURE 262 +# define QAT_R_PRIV_KEY_DUPLICATE_FAILURE 263 +# define QAT_R_PRIV_KEY_MALLOC_FAILURE 264 +# define QAT_R_PRIV_KEY_M_XG_YG_A_B_P_CONVERT_TO_FB_FAILURE 265 +# define QAT_R_PRIV_KEY_NULL 266 +# define QAT_R_PRIV_KEY_RAND_GENERATE_FAILURE 267 +# define QAT_R_PRIV_KEY_XG_YG_A_B_P_CONVERT_TO_FB_FAILURE 268 +# define QAT_R_PRIV_KEY_XP_YP_A_B_P_CONVERT_TO_FB_FAILURE 269 +# define QAT_R_PTHREAD_CREATE_FAILURE 270 +# define QAT_R_PTHREAD_GETAFFINITY_FAILURE 271 +# define QAT_R_PTHREAD_JOIN_FAILURE 272 +# define QAT_R_PTHREAD_KILL_FAILURE 273 +# define QAT_R_PTHREAD_SETAFFINITY_FAILURE 274 +# define QAT_R_PUB_KEY_DUPLICATE_FAILURE 275 +# define QAT_R_PUB_KEY_MALLOC_FAILURE 276 +# define QAT_R_PUB_KEY_NULL 277 +# define QAT_R_P_A_B_XG_YG_MALLOC_FAILURE 278 +# define QAT_R_P_A_B_XG_YG_M_K_R_ORDER_MALLOC_FAILURE 279 +# define QAT_R_P_A_B_XG_YG_XP_YP_M_ORDER_FAILURE 280 +# define QAT_R_P_A_B_XP_YP_FAILURE 281 +# define QAT_R_P_A_B_XP_YP_MALLOC_FAILURE 282 +# define QAT_R_P_G_PRIV_KEY_CONVERT_TO_FB_FAILURE 283 +# define QAT_R_P_PUB_PRIV_KEY_CONVERT_TO_FB_FAILURE 284 +# define QAT_R_P_Q_DMP_DMQ_CONVERT_TO_FB_FAILURE 285 +# define QAT_R_P_Q_DMP_DMQ_IQMP_NULL 286 +# define QAT_R_P_Q_G_NULL 287 +# define QAT_R_P_Q_G_X_K_CONVERT_TO_FB_FAILURE 288 +# define QAT_R_P_Q_G_Y_Z_R_S_CONVERT_TO_FB_FAILURE 289 +# define QAT_R_QAT_ALLOC_DH_METH_FAILURE 290 +# define QAT_R_QAT_CREATE_ENGINE_FAILURE 291 +# define QAT_R_QAT_ECDSA_DO_SIGN_FAIL 292 +# define QAT_R_QAT_FREE_EC_METHOD_FAILURE 293 +# define QAT_R_QAT_GET_EC_METHOD_MALLOC_FAILURE 294 +# define QAT_R_QAT_SET_DH_METH_FAILURE 295 +# define QAT_R_QCTX_CTX_NULL 296 +# define QAT_R_QCTX_NULL 297 +# define QAT_R_RAND_BYTES_FAILURE 298 +# define QAT_R_RAND_FAILURE 299 +# define QAT_R_RAND_GENERATE_FAILURE 300 +# define QAT_R_RESULT_PDATA_ALLOC_FAIL 301 +# define QAT_R_RETRIEVE_EC_POINT_FAILURE 302 +# define QAT_R_RETRIEVE_ORDER_FAILURE 303 +# define QAT_R_RSA_FROM_TO_NULL 304 +# define QAT_R_RSA_OUTPUT_BUF_PDATA_MALLOC_FAILURE 305 +# define QAT_R_R_Q_COMPARE_FAILURE 306 +# define QAT_R_SECRET_KEY_MALLOC_FAILURE 307 +# define QAT_R_SECRET_KEY_PDATA_MALLOC_FAILURE 308 +# define QAT_R_SETUP_ASYNC_EVENT_FAILURE 309 +# define QAT_R_SET_ADDRESS_TRANSLATION_FAILURE 310 +# define QAT_R_SET_FILE_DESCRIPTOR_NONBLOCKING_FAILURE 311 +# define QAT_R_SET_INSTANCE_FAILURE 312 +# define QAT_R_SET_MULTIBUFF_RSA_METH_FAILURE 313 +# define QAT_R_SET_NOTIFICATION_CALLBACK_FAILURE 314 +# define QAT_R_SET_POLLING_THREAD_AFFINITY_FAILURE 315 +# define QAT_R_SET_PRIV_KEY_FAILURE 316 +# define QAT_R_SET_QAT_DSA_METH_FAILURE 317 +# define QAT_R_SET_QAT_RSA_METH_FAILURE 318 +# define QAT_R_SET_TAG_INVALID_OP 319 +# define QAT_R_SHA3_CTX_NULL 320 +# define QAT_R_SIG_GET_R_S_FAILURE 321 +# define QAT_R_SIG_MALLOC_FAILURE 322 +# define QAT_R_SSD_MALLOC_FAILURE 323 +# define QAT_R_SSD_NULL 324 +# define QAT_R_START_INSTANCE_FAILURE 325 +# define QAT_R_STOP_INSTANCE_FAILURE 326 +# define QAT_R_SW_GET_COMPUTE_KEY_PFUNC_NULL 327 +# define QAT_R_SW_GET_KEYGEN_PFUNC_NULL 328 +# define QAT_R_SW_GET_SIGN_PFUNC_NULL 329 +# define QAT_R_SW_GET_SIGN_SETUP_PFUNC_NULL 330 +# define QAT_R_SW_GET_SIGN_SIG_PFUNC_NULL 331 +# define QAT_R_SW_GET_VERIFY_SIG_PFUNC_NULL 332 +# define QAT_R_SW_METHOD_NULL 333 +# define QAT_R_S_NULL 334 +# define QAT_R_S_Q_COMPARE_FAILURE 335 +# define QAT_R_UNKNOWN_PADDING 336 +# define QAT_R_UNKNOWN_PADDING_TYPE 337 +# define QAT_R_WAKE_PAUSE_JOB_FAILURE 338 +# define QAT_R_X_Y_TX_TY_BN_MALLOC_FAILURE 339 +# define QAT_R_X_Y_Z_MALLOC_FAILURE 340 +# define QAT_R_Z_ALLOCATE_FAILURE 341 #endif diff --git a/qat_sw_gcm.c b/qat_sw_gcm.c index e015a25b..b4ba7325 100644 --- a/qat_sw_gcm.c +++ b/qat_sw_gcm.c @@ -96,24 +96,6 @@ #ifdef ENABLE_QAT_SW_GCM IMB_MGR *ipsec_mgr = NULL; -static int vaesgcm_ciphers_init(EVP_CIPHER_CTX* ctx, - const unsigned char* inkey, - const unsigned char* iv, - int enc); -static int vaesgcm_ciphers_cleanup(EVP_CIPHER_CTX* ctx); -static int vaesgcm_ciphers_do_cipher(EVP_CIPHER_CTX* ctx, - unsigned char* out, - const unsigned char* in, - size_t len); -static int vaesgcm_ciphers_ctrl(EVP_CIPHER_CTX* ctx, int type, int arg, void* ptr); - -int aes_gcm_tls_cipher(EVP_CIPHER_CTX* evp_ctx, - unsigned char* out, - const unsigned char* in, - size_t len, - vaesgcm_ctx* qctx, - int enc); - int vaesgcm_init_key(EVP_CIPHER_CTX* ctx, const unsigned char* inkey); int vaesgcm_init_gcm(EVP_CIPHER_CTX* ctx); @@ -129,69 +111,6 @@ static int qat_check_gcm_nid(int nid) #endif -static inline const EVP_CIPHER *qat_gcm_cipher_sw_impl(int nid) -{ - switch (nid) { - case NID_aes_128_gcm: - return EVP_aes_128_gcm(); - case NID_aes_192_gcm: - return EVP_aes_192_gcm(); - case NID_aes_256_gcm: - return EVP_aes_256_gcm(); - default: - WARN("Invalid nid %d\n", nid); - return NULL; - } -} - -/****************************************************************************** - * function: - * vaesgcm_create_cipher_meth(int nid, int keylen) - * - * @param nid [IN] - Cipher NID to be created - * @param keylen [IN] - Key length of cipher [128|192|256] - * @retval - EVP_CIPHER * to created cipher - * @retval - NULL if failure - * - * description: - * create a new EVP_CIPHER based on requested nid - ******************************************************************************/ -const EVP_CIPHER *vaesgcm_create_cipher_meth(int nid, int keylen) -{ -#ifdef ENABLE_QAT_SW_GCM - EVP_CIPHER* c = NULL; - int res = 1; - - if ((c = EVP_CIPHER_meth_new(nid, AES_GCM_BLOCK_SIZE, keylen)) == NULL) { - WARN("Failed to allocate cipher methods for specified nid %d\n", nid); - QATerr(QAT_F_VAESGCM_CREATE_CIPHER_METH, ERR_R_INTERNAL_ERROR); - return NULL; - } - - res &= EVP_CIPHER_meth_set_iv_length(c, GCM_IV_DATA_LEN); - res &= EVP_CIPHER_meth_set_flags(c, VAESGCM_FLAG); - res &= EVP_CIPHER_meth_set_init(c, vaesgcm_ciphers_init); - res &= EVP_CIPHER_meth_set_do_cipher(c, vaesgcm_ciphers_do_cipher); - res &= EVP_CIPHER_meth_set_cleanup(c, vaesgcm_ciphers_cleanup); - res &= EVP_CIPHER_meth_set_impl_ctx_size(c, sizeof(vaesgcm_ctx)); - res &= EVP_CIPHER_meth_set_set_asn1_params(c, NULL); - res &= EVP_CIPHER_meth_set_get_asn1_params(c, NULL); - res &= EVP_CIPHER_meth_set_ctrl(c, vaesgcm_ciphers_ctrl); - - if (res == 0) { - WARN("Failed to set cipher methods for nid %d\n", nid); - QATerr(QAT_F_VAESGCM_CREATE_CIPHER_METH, ERR_R_INTERNAL_ERROR); - EVP_CIPHER_meth_free(c); - c = NULL; - } - - DEBUG("QAT SW AES_GCM registration succeeded\n"); - return c; -#else - return qat_gcm_cipher_sw_impl(nid); -#endif -} - #ifdef ENABLE_QAT_SW_GCM /****************************************************************************** * function: diff --git a/qat_sw_gcm.h b/qat_sw_gcm.h index e974df9c..6a6a4c50 100644 --- a/qat_sw_gcm.h +++ b/qat_sw_gcm.h @@ -89,7 +89,23 @@ typedef struct vaesgcm_ctx_t { __attribute__((aligned(64))) vaesgcm_ctx; # pragma pack(pop) -const EVP_CIPHER *vaesgcm_create_cipher_meth(int nid, int keylen); +int vaesgcm_ciphers_init(EVP_CIPHER_CTX* ctx, + const unsigned char* inkey, + const unsigned char* iv, + int enc); +int vaesgcm_ciphers_cleanup(EVP_CIPHER_CTX* ctx); +int vaesgcm_ciphers_do_cipher(EVP_CIPHER_CTX* ctx, + unsigned char* out, + const unsigned char* in, + size_t len); +int vaesgcm_ciphers_ctrl(EVP_CIPHER_CTX* ctx, int type, int arg, void* ptr); + +int aes_gcm_tls_cipher(EVP_CIPHER_CTX* evp_ctx, + unsigned char* out, + const unsigned char* in, + size_t len, + vaesgcm_ctx* qctx, + int enc); int vaesgcm_init_ipsec_mb_mgr(void); void vaesgcm_free_ipsec_mb_mgr(void); diff --git a/qat_sw_rsa.c b/qat_sw_rsa.c index 151d0e29..c7f2bcd9 100644 --- a/qat_sw_rsa.c +++ b/qat_sw_rsa.c @@ -132,6 +132,7 @@ void multibuff_free_RSA_methods(void) if (multibuff_rsa_method != NULL) { RSA_meth_free(multibuff_rsa_method); multibuff_rsa_method = NULL; + qat_sw_rsa_offload = 0; } #endif } diff --git a/qatengine-sw.spec b/qatengine-sw.spec index 9760aa89..d98eaa57 100644 --- a/qatengine-sw.spec +++ b/qatengine-sw.spec @@ -4,7 +4,7 @@ %global enginesdir %(pkg-config --variable=enginesdir libcrypto) Name: qatengine-sw -Version: 0.6.9 +Version: 0.6.10 Release: 1%{?dist} Summary: Intel QuickAssist Technology (QAT) OpenSSL Engine # Most of the source code is BSD, with the following exceptions: @@ -49,6 +49,9 @@ autoreconf -ivf %exclude %{enginesdir}/qatengine.la %changelog +* Thu Oct 28 2021 Yogaraj Alamenda - 0.6.10-1 +- Update to qatengine v0.6.10 + * Mon Oct 18 2021 Yogaraj Alamenda - 0.6.9-1 - Update to qatengine v0.6.9 diff --git a/qatengine.spec b/qatengine.spec index 6046fca8..8b35f308 100644 --- a/qatengine.spec +++ b/qatengine.spec @@ -4,7 +4,7 @@ %global enginesdir %(pkg-config --variable=enginesdir libcrypto) Name: qatengine -Version: 0.6.9 +Version: 0.6.10 Release: 1%{?dist} Summary: Intel QuickAssist Technology (QAT) OpenSSL Engine # Most of the source code is BSD, with the following exceptions: @@ -46,6 +46,9 @@ autoreconf -ivf %exclude %{enginesdir}/qatengine.la %changelog +* Thu Oct 28 2021 Yogaraj Alamenda - 0.6.10-1 +- Update to qatengine v0.6.10 + * Mon Oct 18 2021 Yogaraj Alamenda - 0.6.9-1 - Update to qatengine v0.6.9 @@ -58,6 +61,9 @@ autoreconf -ivf * Fri Jul 30 2021 Yogaraj Alamenda - 0.6.7-1 - Update to qatengine v0.6.7 +* Fri Jul 23 2021 Fedora Release Engineering - 0.6.6-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + * Thu May 20 2021 Yogaraj Alamenda - 0.6.6-1 - Update to qatengine v0.6.6