intel / QAT_Engine

Intel QuickAssist Technology( QAT) OpenSSL Engine (an OpenSSL Plug-In Engine) which provides cryptographic acceleration for both hardware and optimized software using Intel QuickAssist Technology enabled Intel platforms. https://developer.intel.com/quickassist
BSD 3-Clause "New" or "Revised" License
410 stars 128 forks source link

qat_prf_pmeth #240

Open ShaiZradware opened 1 year ago

ShaiZradware commented 1 year ago

Is there a way to use qat_prf_pmeth in openssl3.0 (engine 0.6.17), I see this in the code:

ifndef QAT_OPENSSL_3

 if (!ENGINE_set_pkey_meths(e, qat_pkey_methods)) {
      WARN("ENGINE_set_pkey_meths failed\n");
      goto end;
 }

endif

I tried to use EVP_PKEY_meth_add0(qat_prf_pmeth) but this is not working.

Thanks Shai

Yogaraj-Alamenda commented 1 year ago

Currently it is disabled in engine due to the issue mentioned in https://github.com/openssl/openssl/issues/19047

We are working on a fix to resolve. will keep you posted. Should be available in next release.

Yogaraj-Alamenda commented 1 year ago

The Isssue is fixed in v1.2.0 release with the commit 48d98e4a6054c2296e5d188199ccb1a44706752a. Please check and let us know

vitalyk-radware commented 1 year ago

I executed s_server but i do not see in the logs any indication that PRF has been offloaded... I also tried using debugger to detect calls to "ctrl" or "derive" functions of qat_hw_prf but have not seen it called. can you please advise how to check it?

Thanks!

root@ulp-ng:~# /disk/opt/openssl31/bin/openssl engine qatengine -v
[WARN][106536.820713] PID [5170] Thread [7ffff7ff1700][e_qat.c:1044:bind_qat()] QAT Warnings enabled.
[DEBUG][106536.820979] PID [5170] Thread [7ffff7ff1700][e_qat.c:1045:bind_qat()] QAT Debug enabled.
[WARN][106536.821063] PID [5170] Thread [7ffff7ff1700][e_qat.c:1046:bind_qat()] qatengine - Reference implementation of QAT crypto engine(qat_hw) v1.2.0
[DEBUG][106536.821751] PID [5170] Thread [7ffff7ff1700][e_qat.c:1063:bind_qat()] QAT HW device available
[DEBUG][106536.821933] PID [5170] Thread [7ffff7ff1700][qat_evp.c:1449:qat_get_RSA_methods()] QAT HW RSA Registration succeeded
[DEBUG][106536.822000] PID [5170] Thread [7ffff7ff1700][qat_evp.c:1265:qat_get_EC_methods()] QAT HW ECDSA Registration succeeded
[DEBUG][106536.822045] PID [5170] Thread [7ffff7ff1700][qat_evp.c:1346:qat_get_EC_methods()] QAT HW ECDH Registration succeeded
[DEBUG][106536.822249] PID [5170] Thread [7ffff7ff1700][qat_hw_ciphers.c:279:qat_create_cipher_meth()] QAT HW AES_CBC_128_HMAC_SHA registration succeeded
[DEBUG][106536.822314] PID [5170] Thread [7ffff7ff1700][qat_hw_ciphers.c:279:qat_create_cipher_meth()] QAT HW AES_CBC_256_HMAC_SHA registration succeeded
(qatengine) Reference implementation of QAT crypto engine(qat_hw) v1.2.0
     ENABLE_EXTERNAL_POLLING, POLL, SET_INSTANCE_FOR_THREAD,
     GET_NUM_OP_RETRIES, SET_MAX_RETRY_COUNT, SET_INTERNAL_POLL_INTERVAL,
     GET_EXTERNAL_POLLING_FD, ENABLE_EVENT_DRIVEN_POLLING_MODE,
     GET_NUM_CRYPTO_INSTANCES, DISABLE_EVENT_DRIVEN_POLLING_MODE,
     SET_EPOLL_TIMEOUT, SET_CRYPTO_SMALL_PACKET_OFFLOAD_THRESHOLD,
     ENABLE_INLINE_POLLING, ENABLE_HEURISTIC_POLLING,
     GET_NUM_REQUESTS_IN_FLIGHT, INIT_ENGINE, SET_CONFIGURATION_SECTION_NAME,
     ENABLE_SW_FALLBACK, HEARTBEAT_POLL, DISABLE_QAT_OFFLOAD, HW_ALGO_BITMAP
[DEBUG][106536.823606] PID [5170] Thread [7ffff7ff1700][qat_hw_prf.c:123:qat_prf_pmeth()] **QAT HW PRF Registration succeeded**
[DEBUG][106536.823677] PID [5170] Thread [7ffff7ff1700][qat_evp.c:543:qat_x25519_pmeth()] QAT HW X25519 registration succeeded
[DEBUG][106536.823785] PID [5170] Thread [7ffff7ff1700][qat_evp.c:618:qat_x448_pmeth()] QAT HW ECDH X448 Registration succeeded
[DEBUG][106536.823855] PID [5170] Thread [7ffff7ff1700][e_qat.c:473:qat_engine_destroy()] ---- Destroying Engine...

root@ulp-ng:~#
root@ulp-ng:~# /disk/opt/openssl31/bin/openssl version  -a
**OpenSSL 3.1.0** 14 Mar 2023 (Library: OpenSSL 3.1.0 14 Mar 2023)
built on: Fri May 19 19:02:49 2023 UTC
platform: linux-x86_64
options:  bn(64,64)
compiler: gcc -fPIC -m64 -Wa,--noexecstack -Wall -O3 -DOPENSSL_USE_NODELETE -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_BUILDING_OPENSSL -DNDEBUG
OPENSSLDIR: "/disk/opt/openssl31/"
ENGINESDIR: "/disk/opt/openssl31//lib64/engines-3"
MODULESDIR: "/disk/opt/openssl31//lib64/ossl-modules"
Seeding source: os-specific
CPUINFO: OPENSSL_ia32cap=0x4ff8e3bfefebffff:0x2294e283
 openssl s_server -key /disk/ec.key.pem.dec -cert /disk/ec.cert.pem -engine qatengine
[WARN][106126.035106] PID [5163] Thread [7ffff7ff1700][e_qat.c:1044:bind_qat()] QAT Warnings enabled.
[DEBUG][106126.035266] PID [5163] Thread [7ffff7ff1700][e_qat.c:1045:bind_qat()] QAT Debug enabled.
[WARN][106126.035339] PID [5163] Thread [7ffff7ff1700][e_qat.c:1046:bind_qat()] qatengine - Reference implementation of QAT crypto engine(qat_hw) v1.2.0
[DEBUG][106126.036033] PID [5163] Thread [7ffff7ff1700][e_qat.c:1063:bind_qat()] QAT HW device available
[DEBUG][106126.036103] PID [5163] Thread [7ffff7ff1700][qat_evp.c:1449:qat_get_RSA_methods()] QAT HW RSA Registration succeeded
[DEBUG][106126.036168] PID [5163] Thread [7ffff7ff1700][qat_evp.c:1265:qat_get_EC_methods()] QAT HW ECDSA Registration succeeded
[DEBUG][106126.036309] PID [5163] Thread [7ffff7ff1700][qat_evp.c:1346:qat_get_EC_methods()] QAT HW ECDH Registration succeeded
[DEBUG][106126.036387] PID [5163] Thread [7ffff7ff1700][qat_hw_ciphers.c:279:qat_create_cipher_meth()] QAT HW AES_CBC_128_HMAC_SHA registration succeeded
[DEBUG][106126.036450] PID [5163] Thread [7ffff7ff1700][qat_hw_ciphers.c:279:qat_create_cipher_meth()] QAT HW AES_CBC_256_HMAC_SHA registration succeeded
[DEBUG][106126.036553] PID [5163] Thread [7ffff7ff1700][e_qat.c:583:qat_engine_init()] QAT Engine initialization:
[DEBUG][106126.036673] PID [5163] Thread [7ffff7ff1700][qat_hw_init.c:590:qat_hw_init()] QAT_HW initialization:
[DEBUG][106126.036812] PID [5163] Thread [7ffff7ff1700][qat_hw_init.c:591:qat_hw_init()] - External polling: OFF
[DEBUG][106126.036879] PID [5163] Thread [7ffff7ff1700][qat_hw_init.c:592:qat_hw_init()] - Heuristic polling: OFF
[DEBUG][106126.036922] PID [5163] Thread [7ffff7ff1700][qat_hw_init.c:593:qat_hw_init()] - SW Fallback: OFF
[DEBUG][106126.036983] PID [5163] Thread [7ffff7ff1700][qat_hw_init.c:594:qat_hw_init()] - Inline polling: OFF
[DEBUG][106126.037045] PID [5163] Thread [7ffff7ff1700][qat_hw_init.c:595:qat_hw_init()] - Internal poll interval: 10000ns
[DEBUG][106126.037110] PID [5163] Thread [7ffff7ff1700][qat_hw_init.c:596:qat_hw_init()] - Epoll timeout: 1000ms
[DEBUG][106126.037245] PID [5163] Thread [7ffff7ff1700][qat_hw_init.c:597:qat_hw_init()] - Event driven polling mode: OFF
[DEBUG][106126.037313] PID [5163] Thread [7ffff7ff1700][qat_hw_init.c:598:qat_hw_init()] - Instance for thread: OFF
[DEBUG][106126.037354] PID [5163] Thread [7ffff7ff1700][qat_hw_init.c:599:qat_hw_init()] - Max retry count: 5
[DEBUG][106126.092453] PID [5163] Thread [7ffff7ff1700][qat_hw_init.c:638:qat_hw_init()] Found 1 Cy instances
[DEBUG][106126.092625] PID [5163] Thread [7ffff7ff1700][qat_hw_init.c:753:qat_hw_init()] Started Instance No: 0 Located on Device: 0
Asymmetric instances sequence: 0
Symmetric instances sequence: 0
[DEBUG][106126.098225] PID [5163] Thread [7ffff5fc2700][qat_hw_polling.c:148:qat_timer_poll_func()] timer_poll_func started
Engine "qatengine" set.
Using default temp DH parameters
ACCEPT
[DEBUG][106126.103819] PID [5163] Thread [7ffff5fc2700][qat_hw_polling.c:160:qat_timer_poll_func()] qat_timer_poll_func_thread = 0x7ffff5fc2700

[DEBUG][106146.814514] PID [5163] Thread [7ffff7ff1700][qat_evp.c:543:qat_x25519_pmeth()] QAT HW X25519 registration succeeded
[DEBUG][106146.814635] PID [5163] Thread [7ffff7ff1700][qat_hw_ecx.c:208:qat_pkey_ecx_keygen()] QAT HW ECX Started
[DEBUG][106146.814699] PID [5163] Thread [7ffff7ff1700][qat_hw_ecx.c:241:qat_pkey_ecx_keygen()] EVP_PKEY_X25519
[DEBUG][106146.814802] PID [5163] Thread [7ffff7ff1700][qat_hw_init.c:326:get_next_inst_num()] inst type: ASYM, inst_num = 0
=========================
EC ECX Point Multiply Request: 0x7ffff5fd3c00
instance_handle = 0x6ec1a0
qat_pkey_ecx_keygen: k.pData: Length 32, Address 0x7ffff5fd4000
90 71 70 78 cb b9 6c 1d - 33 0d fe 0c 5e 63 5f c3
3e ca 13 8c a2 6b a0 12 - ca 51 ae f2 99 73 f2 be
qat_pkey_ecx_keygen: x.pData: Length 0, Address (nil)
opData: curveType = 1
opData: generator = 1
pXk->dataLenInBytes = 32 pXk->pData = 0x7ffff5fd4400
=========================

[DEBUG][106146.816576] PID [5163] Thread [7ffff7ff1700][qat_hw_ecx.c:392:qat_pkey_ecx_keygen()] Calling cpaCyEcMontEdwdsPointMultiply.
[DEBUG][106146.816948] PID [5163] Thread [7ffff5fc2700][qat_hw_callback.c:199:qat_crypto_callbackFn()] status 0 verifyResult 1
=========================
EC Point Multiply Output: pResultX 0x740e90
bEcStatus = 1
qat_pkey_ecx_keygen: pResultX->pData: Length 32, Address 0x7ffff5fd4400
4f 0d 96 59 23 96 f3 75 - df a8 a7 57 90 ba 55 c6
02 c5 16 ab ec fb c0 2e - 0b e1 fc 7b df 65 97 39
=========================
[DEBUG][106146.818172] PID [5163] Thread [7ffff7ff1700][qat_hw_ec.c:1201:qat_ecdsa_do_sign()] QAT HW ECDSA Started
[DEBUG][106146.818300] PID [5163] Thread [7ffff7ff1700][qat_hw_init.c:326:get_next_inst_num()] inst type: ASYM, inst_num = 0
=========================
ECDSA Sign Request: 0x756d00
instance_handle = 0x6ec1a0
qat_ecdsa_do_sign: xg.pData: Length 32, Address 0x7ffff5fd4400
6b 17 d1 f2 e1 2c 42 47 - f8 bc e6 e5 63 a4 40 f2
77 03 7d 81 2d eb 33 a0 - f4 a1 39 45 d8 98 c2 96
qat_ecdsa_do_sign: yg.pData: Length 32, Address 0x7ffff5fd4800
4f e3 42 e2 fe 1a 7f 9b - 8e e7 eb 4a 7c 0f 9e 16
2b ce 33 57 6b 31 5e ce - cb b6 40 68 37 bf 51 f5
qat_ecdsa_do_sign: n.pData: Length 32, Address 0x7ffff5fd5c00
ff ff ff ff 00 00 00 00 - ff ff ff ff ff ff ff ff
bc e6 fa ad a7 17 9e 84 - f3 b9 ca c2 fc 63 25 51
qat_ecdsa_do_sign: q.pData: Length 32, Address 0x7ffff5fd5400
ff ff ff ff 00 00 00 01 - 00 00 00 00 00 00 00 00
00 00 00 00 ff ff ff ff - ff ff ff ff ff ff ff ff
qat_ecdsa_do_sign: a.pData: Length 32, Address 0x7ffff5fd4c00
ff ff ff ff 00 00 00 01 - 00 00 00 00 00 00 00 00
00 00 00 00 ff ff ff ff - ff ff ff ff ff ff ff fc
qat_ecdsa_do_sign: b.pData: Length 32, Address 0x7ffff5fd5000
5a c6 35 d8 aa 3a 93 e7 - b3 eb bd 55 76 98 86 bc
65 1d 06 b0 cc 53 b0 f6 - 3b ce 3c 3e 27 d2 60 4b
qat_ecdsa_do_sign: k.pData: Length 32, Address 0x7ffff5fd5800
6c b8 f7 47 ef 0e 35 59 - 3c 82 9d aa d0 59 f7 4b
b8 b2 e8 41 85 ae 8b fe - 09 52 57 ca 79 84 d1 14
qat_ecdsa_do_sign: m.pData: Length 32, Address 0x7ffff5fd4000
79 db d4 06 75 29 f8 15 - ba 1d bd 89 f2 2d 68 a3
d8 d0 8b 64 39 9c 6b d0 - 12 25 d6 9f 2e f4 ce c0
qat_ecdsa_do_sign: d.pData: Length 32, Address 0x7ffff5fd3c00
6e 60 30 5b dd 90 0d 6e - 98 1a 5b a7 46 92 e7 68
c1 8a 90 a3 0e af d7 0b - fc 20 92 cc e3 71 7d b6
opData: fieldType = 1
pResultR->dataLenInBytes = 256 pResultR->pData = 0x7ffff5fd6000
pResultS->dataLenInBytes = 256 pResultS->pData = 0x7ffff5fd6400
=========================
[DEBUG][106146.824409] PID [5163] Thread [7ffff5fc2700][qat_hw_callback.c:199:qat_crypto_callbackFn()] status 0 verifyResult 1
=========================
ECDSA Sign Output: pResultR 0x7571d0, pResultS 0x7571f0
bEcdsaSignStatus = 0
qat_ecdsa_do_sign: pResultR->pData: Length 256, Address 0x7ffff5fd6000
00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
fa c2 a1 f5 df 28 78 b9 - f9 1b 8c 1e 58 58 0a 39
88 d7 43 e4 aa c2 7c 5d - 86 c2 27 ad ed a7 3b 1f
qat_ecdsa_do_sign: pResultS->pData: Length 256, Address 0x7ffff5fd6400
00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
2c 0f 61 30 08 2b cd bd - 6a 24 5b 0b cd 8f 34 23
e8 5b d6 7a 0d 57 ba 24 - 22 44 7f ad e6 29 2d 63
=========================
[DEBUG][106146.833864] PID [5163] Thread [7ffff7ff1700][qat_hw_ec.c:1761:qat_ecdsa_do_sign()] - Finished
[DEBUG][106146.842397] PID [5163] Thread [7ffff7ff1700][qat_hw_ecx.c:1320:qat_pkey_ecx_ctrl()] Started
[DEBUG][106146.842495] PID [5163] Thread [7ffff7ff1700][qat_hw_ecx.c:1320:qat_pkey_ecx_ctrl()] Started
[DEBUG][106146.842555] PID [5163] Thread [7ffff7ff1700][qat_hw_ecx.c:683:qat_pkey_ecx_derive25519()] QAT HW ECX Started
[DEBUG][106146.842631] PID [5163] Thread [7ffff7ff1700][qat_hw_ecx.c:683:qat_pkey_ecx_derive25519()] QAT HW ECX Started
[DEBUG][106146.842704] PID [5163] Thread [7ffff7ff1700][qat_hw_init.c:326:get_next_inst_num()] inst type: ASYM, inst_num = 0
=========================
EC ECX Point Multiply Request: 0x7ffff5fd3c00
instance_handle = 0x6ec1a0
qat_pkey_ecx_derive25519: k.pData: Length 32, Address 0x7ffff5fd4000
90 71 70 78 cb b9 6c 1d - 33 0d fe 0c 5e 63 5f c3
3e ca 13 8c a2 6b a0 12 - ca 51 ae f2 99 73 f2 be
qat_pkey_ecx_derive25519: x.pData: Length 32, Address 0x7ffff5fd4400
17 23 5f c7 bc d4 86 b9 - 8c d6 05 d5 c7 45 90 e2
53 b6 c2 d4 3a 8c f9 ae - 44 23 9e f8 2f 75 35 06
opData: curveType = 1
opData: generator = 0
pXk->dataLenInBytes = 32 pXk->pData = 0x7ffff5fd4800
=========================

[DEBUG][106146.843867] PID [5163] Thread [7ffff7ff1700][qat_hw_ecx.c:811:qat_pkey_ecx_derive25519()] Calling cpaCyEcMontEdwdsPointMultiply.
[DEBUG][106146.844352] PID [5163] Thread [7ffff5fc2700][qat_hw_callback.c:199:qat_crypto_callbackFn()] status 0 verifyResult 1
=========================
EC Point Multiply Output: pResultX 0x756dc0
bEcStatus = 1
qat_pkey_ecx_derive25519: pResultX->pData: Length 32, Address 0x7ffff5fd4800
00 e3 0d d2 41 34 59 34 - 28 aa 41 37 91 88 18 d6
31 14 0e e1 47 41 59 72 - 62 f6 4d d5 53 1f 90 cc
=========================
ShaiZradware commented 1 year ago

The code (engine 1.2) pushed somewhere?

From: vitalyk-radware @.> Sent: Monday, June 26, 2023 1:26 AM To: intel/QAT_Engine @.> Cc: Shai Zrihen @.>; Author @.> Subject: Re: [intel/QAT_Engine] qat_prf_pmeth (Issue #240)

CAUTION: EXTERNAL EMAIL.

I executed s_server but i do not see in the logs any indication that PRF has been offloaded... I also tried using debugger to detect calls to "ctrl" or "derive" functions of qat_hw_prf but have not seen it called. can you please advise how to check it?

Thanks!

openssl s_server -key /disk/ec.key.pem.dec -cert /disk/ec.cert.pem -engine qatengine

[WARN][106126.035106] PID [5163] Thread [7ffff7ff1700][e_qat.c:1044:bind_qat()] QAT Warnings enabled.

[DEBUG][106126.035266] PID [5163] Thread [7ffff7ff1700][e_qat.c:1045:bind_qat()] QAT Debug enabled.

[WARN][106126.035339] PID [5163] Thread [7ffff7ff1700][e_qat.c:1046:bind_qat()] qatengine - Reference implementation of QAT crypto engine(qat_hw) v1.2.0

[DEBUG][106126.036033] PID [5163] Thread [7ffff7ff1700][e_qat.c:1063:bind_qat()] QAT HW device available

[DEBUG][106126.036103] PID [5163] Thread [7ffff7ff1700][qat_evp.c:1449:qat_get_RSA_methods()] QAT HW RSA Registration succeeded

[DEBUG][106126.036168] PID [5163] Thread [7ffff7ff1700][qat_evp.c:1265:qat_get_EC_methods()] QAT HW ECDSA Registration succeeded

[DEBUG][106126.036309] PID [5163] Thread [7ffff7ff1700][qat_evp.c:1346:qat_get_EC_methods()] QAT HW ECDH Registration succeeded

[DEBUG][106126.036387] PID [5163] Thread [7ffff7ff1700][qat_hw_ciphers.c:279:qat_create_cipher_meth()] QAT HW AES_CBC_128_HMAC_SHA registration succeeded

[DEBUG][106126.036450] PID [5163] Thread [7ffff7ff1700][qat_hw_ciphers.c:279:qat_create_cipher_meth()] QAT HW AES_CBC_256_HMAC_SHA registration succeeded

[DEBUG][106126.036553] PID [5163] Thread [7ffff7ff1700][e_qat.c:583:qat_engine_init()] QAT Engine initialization:

[DEBUG][106126.036673] PID [5163] Thread [7ffff7ff1700][qat_hw_init.c:590:qat_hw_init()] QAT_HW initialization:

[DEBUG][106126.036812] PID [5163] Thread [7ffff7ff1700][qat_hw_init.c:591:qat_hw_init()] - External polling: OFF

[DEBUG][106126.036879] PID [5163] Thread [7ffff7ff1700][qat_hw_init.c:592:qat_hw_init()] - Heuristic polling: OFF

[DEBUG][106126.036922] PID [5163] Thread [7ffff7ff1700][qat_hw_init.c:593:qat_hw_init()] - SW Fallback: OFF

[DEBUG][106126.036983] PID [5163] Thread [7ffff7ff1700][qat_hw_init.c:594:qat_hw_init()] - Inline polling: OFF

[DEBUG][106126.037045] PID [5163] Thread [7ffff7ff1700][qat_hw_init.c:595:qat_hw_init()] - Internal poll interval: 10000ns

[DEBUG][106126.037110] PID [5163] Thread [7ffff7ff1700][qat_hw_init.c:596:qat_hw_init()] - Epoll timeout: 1000ms

[DEBUG][106126.037245] PID [5163] Thread [7ffff7ff1700][qat_hw_init.c:597:qat_hw_init()] - Event driven polling mode: OFF

[DEBUG][106126.037313] PID [5163] Thread [7ffff7ff1700][qat_hw_init.c:598:qat_hw_init()] - Instance for thread: OFF

[DEBUG][106126.037354] PID [5163] Thread [7ffff7ff1700][qat_hw_init.c:599:qat_hw_init()] - Max retry count: 5

[DEBUG][106126.092453] PID [5163] Thread [7ffff7ff1700][qat_hw_init.c:638:qat_hw_init()] Found 1 Cy instances

[DEBUG][106126.092625] PID [5163] Thread [7ffff7ff1700][qat_hw_init.c:753:qat_hw_init()] Started Instance No: 0 Located on Device: 0

Asymmetric instances sequence: 0

Symmetric instances sequence: 0

[DEBUG][106126.098225] PID [5163] Thread [7ffff5fc2700][qat_hw_polling.c:148:qat_timer_poll_func()] timer_poll_func started

Engine "qatengine" set.

Using default temp DH parameters

ACCEPT

[DEBUG][106126.103819] PID [5163] Thread [7ffff5fc2700][qat_hw_polling.c:160:qat_timer_poll_func()] qat_timer_poll_func_thread = 0x7ffff5fc2700

[DEBUG][106146.814514] PID [5163] Thread [7ffff7ff1700][qat_evp.c:543:qat_x25519_pmeth()] QAT HW X25519 registration succeeded

[DEBUG][106146.814635] PID [5163] Thread [7ffff7ff1700][qat_hw_ecx.c:208:qat_pkey_ecx_keygen()] QAT HW ECX Started

[DEBUG][106146.814699] PID [5163] Thread [7ffff7ff1700][qat_hw_ecx.c:241:qat_pkey_ecx_keygen()] EVP_PKEY_X25519

[DEBUG][106146.814802] PID [5163] Thread [7ffff7ff1700][qat_hw_init.c:326:get_next_inst_num()] inst type: ASYM, inst_num = 0

=========================

EC ECX Point Multiply Request: 0x7ffff5fd3c00

instance_handle = 0x6ec1a0

qat_pkey_ecx_keygen: k.pData: Length 32, Address 0x7ffff5fd4000

90 71 70 78 cb b9 6c 1d - 33 0d fe 0c 5e 63 5f c3

3e ca 13 8c a2 6b a0 12 - ca 51 ae f2 99 73 f2 be

qat_pkey_ecx_keygen: x.pData: Length 0, Address (nil)

opData: curveType = 1

opData: generator = 1

pXk->dataLenInBytes = 32 pXk->pData = 0x7ffff5fd4400

=========================

[DEBUG][106146.816576] PID [5163] Thread [7ffff7ff1700][qat_hw_ecx.c:392:qat_pkey_ecx_keygen()] Calling cpaCyEcMontEdwdsPointMultiply.

[DEBUG][106146.816948] PID [5163] Thread [7ffff5fc2700][qat_hw_callback.c:199:qat_crypto_callbackFn()] status 0 verifyResult 1

=========================

EC Point Multiply Output: pResultX 0x740e90

bEcStatus = 1

qat_pkey_ecx_keygen: pResultX->pData: Length 32, Address 0x7ffff5fd4400

4f 0d 96 59 23 96 f3 75 - df a8 a7 57 90 ba 55 c6

02 c5 16 ab ec fb c0 2e - 0b e1 fc 7b df 65 97 39

=========================

[DEBUG][106146.818172] PID [5163] Thread [7ffff7ff1700][qat_hw_ec.c:1201:qat_ecdsa_do_sign()] QAT HW ECDSA Started

[DEBUG][106146.818300] PID [5163] Thread [7ffff7ff1700][qat_hw_init.c:326:get_next_inst_num()] inst type: ASYM, inst_num = 0

=========================

ECDSA Sign Request: 0x756d00

instance_handle = 0x6ec1a0

qat_ecdsa_do_sign: xg.pData: Length 32, Address 0x7ffff5fd4400

6b 17 d1 f2 e1 2c 42 47 - f8 bc e6 e5 63 a4 40 f2

77 03 7d 81 2d eb 33 a0 - f4 a1 39 45 d8 98 c2 96

qat_ecdsa_do_sign: yg.pData: Length 32, Address 0x7ffff5fd4800

4f e3 42 e2 fe 1a 7f 9b - 8e e7 eb 4a 7c 0f 9e 16

2b ce 33 57 6b 31 5e ce - cb b6 40 68 37 bf 51 f5

qat_ecdsa_do_sign: n.pData: Length 32, Address 0x7ffff5fd5c00

ff ff ff ff 00 00 00 00 - ff ff ff ff ff ff ff ff

bc e6 fa ad a7 17 9e 84 - f3 b9 ca c2 fc 63 25 51

qat_ecdsa_do_sign: q.pData: Length 32, Address 0x7ffff5fd5400

ff ff ff ff 00 00 00 01 - 00 00 00 00 00 00 00 00

00 00 00 00 ff ff ff ff - ff ff ff ff ff ff ff ff

qat_ecdsa_do_sign: a.pData: Length 32, Address 0x7ffff5fd4c00

ff ff ff ff 00 00 00 01 - 00 00 00 00 00 00 00 00

00 00 00 00 ff ff ff ff - ff ff ff ff ff ff ff fc

qat_ecdsa_do_sign: b.pData: Length 32, Address 0x7ffff5fd5000

5a c6 35 d8 aa 3a 93 e7 - b3 eb bd 55 76 98 86 bc

65 1d 06 b0 cc 53 b0 f6 - 3b ce 3c 3e 27 d2 60 4b

qat_ecdsa_do_sign: k.pData: Length 32, Address 0x7ffff5fd5800

6c b8 f7 47 ef 0e 35 59 - 3c 82 9d aa d0 59 f7 4b

b8 b2 e8 41 85 ae 8b fe - 09 52 57 ca 79 84 d1 14

qat_ecdsa_do_sign: m.pData: Length 32, Address 0x7ffff5fd4000

79 db d4 06 75 29 f8 15 - ba 1d bd 89 f2 2d 68 a3

d8 d0 8b 64 39 9c 6b d0 - 12 25 d6 9f 2e f4 ce c0

qat_ecdsa_do_sign: d.pData: Length 32, Address 0x7ffff5fd3c00

6e 60 30 5b dd 90 0d 6e - 98 1a 5b a7 46 92 e7 68

c1 8a 90 a3 0e af d7 0b - fc 20 92 cc e3 71 7d b6

opData: fieldType = 1

pResultR->dataLenInBytes = 256 pResultR->pData = 0x7ffff5fd6000

pResultS->dataLenInBytes = 256 pResultS->pData = 0x7ffff5fd6400

=========================

[DEBUG][106146.824409] PID [5163] Thread [7ffff5fc2700][qat_hw_callback.c:199:qat_crypto_callbackFn()] status 0 verifyResult 1

=========================

ECDSA Sign Output: pResultR 0x7571d0, pResultS 0x7571f0

bEcdsaSignStatus = 0

qat_ecdsa_do_sign: pResultR->pData: Length 256, Address 0x7ffff5fd6000

00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00

00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00

00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00

00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00

00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00

00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00

00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00

00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00

00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00

00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00

00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00

00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00

00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00

00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00

fa c2 a1 f5 df 28 78 b9 - f9 1b 8c 1e 58 58 0a 39

88 d7 43 e4 aa c2 7c 5d - 86 c2 27 ad ed a7 3b 1f

qat_ecdsa_do_sign: pResultS->pData: Length 256, Address 0x7ffff5fd6400

00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00

00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00

00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00

00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00

00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00

00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00

00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00

00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00

00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00

00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00

00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00

00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00

00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00

00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00

2c 0f 61 30 08 2b cd bd - 6a 24 5b 0b cd 8f 34 23

e8 5b d6 7a 0d 57 ba 24 - 22 44 7f ad e6 29 2d 63

=========================

[DEBUG][106146.833864] PID [5163] Thread [7ffff7ff1700][qat_hw_ec.c:1761:qat_ecdsa_do_sign()] - Finished

[DEBUG][106146.842397] PID [5163] Thread [7ffff7ff1700][qat_hw_ecx.c:1320:qat_pkey_ecx_ctrl()] Started

[DEBUG][106146.842495] PID [5163] Thread [7ffff7ff1700][qat_hw_ecx.c:1320:qat_pkey_ecx_ctrl()] Started

[DEBUG][106146.842555] PID [5163] Thread [7ffff7ff1700][qat_hw_ecx.c:683:qat_pkey_ecx_derive25519()] QAT HW ECX Started

[DEBUG][106146.842631] PID [5163] Thread [7ffff7ff1700][qat_hw_ecx.c:683:qat_pkey_ecx_derive25519()] QAT HW ECX Started

[DEBUG][106146.842704] PID [5163] Thread [7ffff7ff1700][qat_hw_init.c:326:get_next_inst_num()] inst type: ASYM, inst_num = 0

=========================

EC ECX Point Multiply Request: 0x7ffff5fd3c00

instance_handle = 0x6ec1a0

qat_pkey_ecx_derive25519: k.pData: Length 32, Address 0x7ffff5fd4000

90 71 70 78 cb b9 6c 1d - 33 0d fe 0c 5e 63 5f c3

3e ca 13 8c a2 6b a0 12 - ca 51 ae f2 99 73 f2 be

qat_pkey_ecx_derive25519: x.pData: Length 32, Address 0x7ffff5fd4400

17 23 5f c7 bc d4 86 b9 - 8c d6 05 d5 c7 45 90 e2

53 b6 c2 d4 3a 8c f9 ae - 44 23 9e f8 2f 75 35 06

opData: curveType = 1

opData: generator = 0

pXk->dataLenInBytes = 32 pXk->pData = 0x7ffff5fd4800

=========================

[DEBUG][106146.843867] PID [5163] Thread [7ffff7ff1700][qat_hw_ecx.c:811:qat_pkey_ecx_derive25519()] Calling cpaCyEcMontEdwdsPointMultiply.

[DEBUG][106146.844352] PID [5163] Thread [7ffff5fc2700][qat_hw_callback.c:199:qat_crypto_callbackFn()] status 0 verifyResult 1

=========================

EC Point Multiply Output: pResultX 0x756dc0

bEcStatus = 1

qat_pkey_ecx_derive25519: pResultX->pData: Length 32, Address 0x7ffff5fd4800

00 e3 0d d2 41 34 59 34 - 28 aa 41 37 91 88 18 d6

31 14 0e e1 47 41 59 72 - 62 f6 4d d5 53 1f 90 cc

=========================

— Reply to this email directly, view it on GitHubhttps://github.com/intel/QAT_Engine/issues/240#issuecomment-1606288080, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A66VCMO3N5GSI67HMF24DYDXNC3F5ANCNFSM6AAAAAAWSPENQY. You are receiving this because you authored the thread.Message ID: @.***>

Yogaraj-Alamenda commented 1 year ago

Are you sure you are using TLS1.2 ? Beacuse in TLS1.3 it will use HKDF instead of PRF

vitalyk-radware commented 1 year ago

Yes, I am sure. Here is the command and its output:

openssl s_client -tls1_2

CONNECTED(00000004) depth=0 CN = vk-ec verify error:num=18:self-signed certificate verify return:1 depth=0 CN = vk-ec verify return:1

Certificate chain 0 s:CN = vk-ec i:CN = vk-ec a:PKEY: id-ecPublicKey, 256 (bit); sigalg: ecdsa-with-SHA256 v:NotBefore: Mar 28 02:12:25 2023 GMT; NotAfter: Mar 27 02:12:25 2024 GMT

Server certificate -----BEGIN CERTIFICATE----- MIIBwjCCAWigAwIBAgIEZCJNCDAKBggqhkjOPQQDAjAQMQ4wDAYDVQQDDAV2ay1l YzAeFw0yMzAzMjgwMjEyMjVaFw0yNDAzMjcwMjEyMjVaMBAxDjAMBgNVBAMMBXZr LWVjMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAErzJ3Jj125z3Q+nWINyRJt+Ah e/uk6qdA26sc56oMvMOY1nQ2Qy3KNR+llz42+HuxoUtBHwn48TSjjGC6xtiA2aOB rzCBrDAPBgNVHRMBAf8EBTADAQH/MBEGCWCGSAGG+EIBAQQEAwICRDAzBglghkgB hvhCAQ0EJhYkQWx0ZW9uL1JhZHdhcmUgR2VuZXJhdGVkIENlcnRpZmljYXRlMB0G A1UdDgQWBBSpAtj+G/Mncv/vpc4W4PD3nBKMdTAlBgNVHSMEHjAcoRSkEjAQMQ4w DAYDVQQDDAV2ay1lY4IEZCJNCDALBgNVHQ8EBAMCAuwwCgYIKoZIzj0EAwIDSAAw RQIgDb4l/qsF9aylIshpRO6kEVvCTFQK4Bu6wzhGMTvFCUACIQCmPuRXVc6SgP+r B7Orr9W4FEuac6f+sdJOHvIfaK+r5g== -----END CERTIFICATE----- subject=CN = vk-ec issuer=CN = vk-ec

No client certificate CA names sent Peer signing digest: SHA256 Peer signature type: ECDSA Server Temp Key: X25519, 253 bits

SSL handshake has read 910 bytes and written 299 bytes Verification error: self-signed certificate

New, TLSv1.2, Cipher is ECDHE-ECDSA-AES256-GCM-SHA384 Server public key is 256 bit Secure Renegotiation IS supported Compression: NONE Expansion: NONE No ALPN negotiated SSL-Session: Protocol : TLSv1.2 Cipher : ECDHE-ECDSA-AES256-GCM-SHA384 Session-ID: F5CD3FAA0FE14D40B3C4DE4B9C764418B4E3E41A21D4E740E7871D918D1ED4AC Session-ID-ctx: Master-Key: 669AB9EB485E75611F4EAE467180CC35CF038723D29978F271D6A4B52C51536B774D1C9B2A67A2871714E2ABAB3E9A60 PSK identity: None PSK identity hint: None SRP username: None TLS session ticket lifetime hint: 7200 (seconds) TLS session ticket: 0000 - fa 1e 31 78 ac b9 d8 93-12 73 05 68 32 c1 a5 e2 ..1x.....s.h2... 0010 - 19 91 fc 6d 0d 33 68 4a-55 e0 5c 4b 1d 66 5a 39 ...m.3hJU.\K.fZ9 0020 - 8d 8e e5 00 72 ab a9 dc-d1 c1 66 81 d9 d1 1d ea ....r.....f..... 0030 - d5 c1 49 d5 59 88 d6 60-f9 30 bf 39 7d ce 27 17 ..I.Y..`.0.9}.'. 0040 - 97 fa f8 43 ed c9 ed d0-49 62 02 a3 2e ba 07 fb ...C....Ib...... 0050 - 0f b5 5b 22 94 9e 0a 93-db 81 ef f9 d3 84 0d 3d ..["...........= 0060 - 92 53 2a 9b a7 a7 3a 3f-19 b4 59 ef 31 b5 f1 a2 .S*...:?..Y.1... 0070 - b8 89 70 47 8a ba 64 76-2f 34 27 49 5c de a9 c4 ..pG..dv/4'I... 0080 - a6 0b 6e 95 57 a8 a7 67-59 2d dc 91 99 6a 26 68 ..n.W..gY-...j&h 0090 - ee a7 bb 86 78 49 c3 ac-f0 20 07 8c 13 88 43 40 ....xI... ....C@ 00a0 - bd 9f 86 99 83 67 e9 9b-63 54 eb 3a 46 7f c8 7b .....g..cT.:F..{

Start Time: 1687767661
Timeout   : 7200 (sec)
Verify return code: 18 (self-signed certificate)
Extended master secret: yes

0017FFF7FF7F0000:error:0A000126:SSL routines:(unknown function):unexpected eof while reading:ssl/record/rec_layer_s3.c:321:

From: Yogaraj Alamenda @.> Sent: Monday, June 26, 2023 9:40 AM To: intel/QAT_Engine @.> Cc: Vitaly Kroivets @.>; Comment @.> Subject: Re: [intel/QAT_Engine] qat_prf_pmeth (Issue #240)

CAUTION: EXTERNAL EMAIL.

Are you sure you are using TLS1.2 ? Beacuse in TLS1.3 it will use HKDF instead of PRF

— Reply to this email directly, view it on GitHubhttps://github.com/intel/QAT_Engine/issues/240#issuecomment-1606751513, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A6ECPGIWUTFQJALFVLERL23XNEVDPANCNFSM6AAAAAAWSPENQY. You are receiving this because you commented.Message ID: @.**@.>>

Yogaraj-Alamenda commented 1 year ago

Yes there seems to be some issue with prf offloading as it is not getting offloaded with OpenSSL3.0 engine using s_server or NGinx. Let me check on this and fix it in the upcoming release. Whereas individual offload via testapp works fine.

vitalyk-radware commented 1 year ago

We would like to ask about this issue. Is there an estimation when it will be addressed? thank you!

Yogaraj-Alamenda commented 1 year ago

@vitalyk-radware The issue fix is blocked by OpenSSL issue mentioned in https://github.com/openssl/openssl/discussions/21627. We dont have an estimation as of now.