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
400 stars 127 forks source link

offloading of __ecp_nistz256_mul_montq #247

Open vitalyk-radware opened 1 year ago

vitalyk-radware commented 1 year ago

we perform a test with s_server (openssl v 3.1.0) that uses engine 0.6.17 . we connect to it using cipher ECDHE-ECDSA-AES256-GCM-SHA384 . we observe that the operation __ecp_nistz256_mul_montq uses a lot of CPU time, and the question is : should not it be offloaded to hardware?

below is a backtrace of the call . I guess that this function is called by EC_POINT_get_affine_coordinates() (from qat_ecdsa_do_sign) .

Can you please comment on this ? thank you!

#0  0x00007ffff768cae0 in ecp_nistz256_mul_mont ()
   from /disk/opt/openssl31/lib64/libcrypto.so.3
#1  0x00007ffff768e9e8 in ecp_nistz256_get_affine.part ()
   from /disk/opt/openssl31/lib64/libcrypto.so.3
#2  0x00007ffff6ad9d70 in qat_ecdsa_do_sign (
    dgst=0x7fffffffe0d0 "'\376\261\254b\177\365\205H]\276\264\262\277;e\236\071\023\235\266?\361!\375O!\030\352a\004\223\260ku", dgst_len=32, in_kinv=0x0, in_r=in_r@entry=0x0, 
    eckey=eckey@entry=0x7084e0) at qat_hw_ec.c:1187
#3  0x00007ffff6adaa0e in qat_ecdsa_sign (type=<optimized out>, dgst=<optimized out>, 
    dlen=<optimized out>, sig=0xfffffffe <error: Cannot access memory at address 0xfffffffe>, 
    siglen=0x7fffffffe0c0, kinv=<optimized out>, r=0x0, eckey=0x7084e0) at qat_hw_ec.c:1014
#4  0x00007ffff780ac8f in ecdsa_digest_sign_final ()
   from /disk/opt/openssl31/lib64/libcrypto.so.3
#5  0x00007ffff76d8e3d in EVP_DigestSignFinal () from /disk/opt/openssl31/lib64/libcrypto.so.3
#6  0x00007ffff7bad746 in tls_construct_server_key_exchange ()
   from /disk/opt/openssl31/lib64/libssl.so.3
#7  0x00007ffff7b9cc13 in state_machine () from /disk/opt/openssl31/lib64/libssl.so.3
#8  0x00007ffff7b6c8f4 in SSL_do_handshake () from /disk/opt/openssl31/lib64/libssl.so.3
Yogaraj-Alamenda commented 1 year ago

@vitalyk-radware Co-ordinates conversion offload to Hardware is not supported hence it is done using OpenSSL,