crypto/qat: add gen4 ecdsa and ecpm functions
cover crypto/qat: add gen4 ecdsa and ecpm functions
This commit adds functions for ecdsa and multiplication using named curves. This will speed up calculation of multiplication and signature generation for curves P-256 and P-384.
Depends-on: series-22343 ("crypto/qat: refactor asym algorithm macros and logs")
Depends-on: patch-109417 ("crypto/qat: enable asymmetric crypto on gen4 device")
Arek Kusztal (2):
crypto/qat: add gen4 ecdsa functions
crypto/qat: add gen4 ecpm functions
.../common/qat/qat_adf/icp_qat_fw_mmp_ids.h | 59 ++++++++ drivers/common/qat/qat_adf/qat_pke.h | 40 +++++ drivers/crypto/qat/qat_asym.c | 142 +++++++++++++++++- 3 files changed, 234 insertions(+), 7 deletions(-)
Signature · 1 line
2.30.2
PATCH 1/2 crypto/qat: add gen4 ecdsa functions
This commit adds generation of ecdsa with named
curves. This will speed up calculation of
signature for curves P-256 and P-384.
--- .../common/qat/qat_adf/icp_qat_fw_mmp_ids.h | 17 +++++ drivers/common/qat/qat_adf/qat_pke.h | 20 +++++ drivers/crypto/qat/qat_asym.c | 75 +++++++++++++++++-- 3 files changed, 107 insertions(+), 5 deletions(-)
drivers/common/qat/qat_adf/icp_qat_fw_mmp_ids.h +17 -0
@@ -1524,6 +1524,23 @@ icp_qat_fw_mmp_ecdsa_verify_gfp_521_input::in in @endlink* icp_qat_fw_mmp_kpt_ecdsa_sign_rs_gfp_521_output::s s @endlink */ +#define PKE_ECDSA_SIGN_RS_P256 0x18133566 +/**< Functionality ID for ECC P256 ECDSA Sign RS +* @li 3 input parameters : @link icp_qat_fw_mmp_ecdsa_sign_rs_p256_input_s::k k +* @endlink @link icp_qat_fw_mmp_ecdsa_sign_rs_p256_input_s::e e @endlink @link +* icp_qat_fw_mmp_ecdsa_sign_rs_p256_input_s::d d @endlink +* @li 2 output parameters : @link icp_qat_fw_mmp_ecdsa_sign_rs_p256_output_s::r +* r @endlink @link icp_qat_fw_mmp_ecdsa_sign_rs_p256_output_s::s s @endlink +*/ +#define PKE_ECDSA_SIGN_RS_P384 0x1a1335a6 +/**< Functionality ID for ECC P384 ECDSA Sign RS +* @li 3 input parameters : @link icp_qat_fw_mmp_ecdsa_sign_rs_p384_input_s::k k +* @endlink @link icp_qat_fw_mmp_ecdsa_sign_rs_p384_input_s::e e @endlink @link +* icp_qat_fw_mmp_ecdsa_sign_rs_p384_input_s::d d @endlink +* @li 2 output parameters : @link icp_qat_fw_mmp_ecdsa_sign_rs_p384_output_s::r +* r @endlink @link icp_qat_fw_mmp_ecdsa_sign_rs_p384_output_s::s s @endlink +*/ +#define PKE_LIVENESS 0x00000001/**< Functionality ID for PKE_LIVENESS * @li 0 input parameter(s)
drivers/common/qat/qat_adf/qat_pke.h +20 -0
@@ -266,6 +266,26 @@ get_ecdsa_function(struct rte_crypto_asym_xform *xform)return qat_function; } +static struct qat_asym_function +get_ecdsa_named_function (struct rte_crypto_asym_xform *xform) +{ +struct qat_asym_function qat_function; + +switch (xform->ec.curve_id) { +case RTE_CRYPTO_EC_GROUP_SECP256R1 : + qat_function.func_id =PKE_ECDSA_SIGN_RS_P256 ; + qat_function.bytesize =32 ; +break ; +case RTE_CRYPTO_EC_GROUP_SECP384R1 : + qat_function.func_id =PKE_ECDSA_SIGN_RS_P384 ; + qat_function.bytesize =48 ; +break ; +default : + qat_function.func_id =0 ; + } +return qat_function; +} +static struct qat_asym_function get_ecpm_function (struct rte_crypto_asym_xform *xform) {
drivers/crypto/qat/qat_asym.c +70 -5
111 lines not on this page · raw message
Signature · 1 line
2.30.2
RE: [PATCH 1/2] crypto/qat: add gen4 ecdsa functions
Quoted 8 lines
-----Original Message-----
From: Kusztal, ArkadiuszX <[email protected]>
Sent: Friday, April 8, 2022 8:58 AM
To: [email protected]
Cc: [email protected]; Zhang, Roy Fan <[email protected]>; Kusztal, ArkadiuszX <[email protected]>
Subject: [PATCH 1/2]crypto/qat: add gen4 ecdsa functions
Quoted 6 lines
This commit adds generation of ecdsa with named curves. This will speed up calculation of signature for curves P-256 and P-384.
Signed-off-by Arek Kusztal <[email protected]>---
PATCH 2/2 crypto/qat: add gen4 ecpm functions
In reply to Arek KusztalThis commit adds functions to use ecpm named
curves. This will speed up calculation
of multiplication for curves P-256 and P-384.
--- .../common/qat/qat_adf/icp_qat_fw_mmp_ids.h | 42 ++++++++++++ drivers/common/qat/qat_adf/qat_pke.h | 20 ++++++ drivers/crypto/qat/qat_asym.c | 67 ++++++++++++++++++- 3 files changed, 127 insertions(+), 2 deletions(-)
drivers/common/qat/qat_adf/icp_qat_fw_mmp_ids.h +42 -0
@@ -1524,6 +1524,48 @@ icp_qat_fw_mmp_ecdsa_verify_gfp_521_input::in in @endlink* icp_qat_fw_mmp_kpt_ecdsa_sign_rs_gfp_521_output::s s @endlink */ +#define PKE_EC_GENERATOR_MULTIPLICATION_P256 0x12073556 +/**< Functionality ID for ECC P256 Generator Point Multiplication [k]G(x) +* @li 1 input parameters : @link +* icp_qat_fw_mmp_ec_p256_generator_multiplication_input_s::k k @endlink +* @li 2 output parameters : @link +* icp_qat_fw_mmp_ec_p256_generator_multiplication_output_s::xr xr @endlink +* @link icp_qat_fw_mmp_ec_p256_generator_multiplication_output_s::yr yr +* @endlink +*/ + +#define PKE_EC_GENERATOR_MULTIPLICATION_P384 0x0b073596 +/**< Functionality ID for ECC P384 Generator Point Multiplication [k]G(x) +* @li 1 input parameters : @link +* icp_qat_fw_mmp_ec_p384_generator_multiplication_input_s::k k @endlink +* @li 2 output parameters : @link +* icp_qat_fw_mmp_ec_p384_generator_multiplication_output_s::xr xr @endlink +* @link icp_qat_fw_mmp_ec_p384_generator_multiplication_output_s::yr yr +* @endlink +*/ + +#define PKE_EC_POINT_MULTIPLICATION_P256 0x0a083546 +/**< Functionality ID for ECC P256 Variable Point Multiplication [k]P(x) +* @li 3 input parameters : @link +* icp_qat_fw_mmp_ec_p256_point_multiplication_input_s::xp xp @endlink @link +* icp_qat_fw_mmp_ec_p256_point_multiplication_input_s::yp yp @endlink @link +* icp_qat_fw_mmp_ec_p256_point_multiplication_input_s::k k @endlink +* @li 2 output parameters : @link +* icp_qat_fw_mmp_ec_p256_point_multiplication_output_s::xr xr @endlink @link +* icp_qat_fw_mmp_ec_p256_point_multiplication_output_s::yr yr @endlink +*/ + +#define PKE_EC_POINT_MULTIPLICATION_P384 0x0b083586 +/**< Functionality ID for ECC P384 Variable Point Multiplication [k]P(x) +* @li 3 input parameters : @link +* icp_qat_fw_mmp_ec_p384_point_multiplication_input_s::xp xp @endlink @link +* icp_qat_fw_mmp_ec_p384_point_multiplication_input_s::yp yp @endlink @link +* icp_qat_fw_mmp_ec_p384_point_multiplication_input_s::k k @endlink +* @li 2 output parameters : @link +* icp_qat_fw_mmp_ec_p384_point_multiplication_output_s::xr xr @endlink @link +* icp_qat_fw_mmp_ec_p384_point_multiplication_output_s::yr yr @endlink +*/ +#define PKE_ECDSA_SIGN_RS_P256 0x18133566/**< Functionality ID for ECC P256 ECDSA Sign RS * @li 3 input parameters : @link icp_qat_fw_mmp_ecdsa_sign_rs_p256_input_s::k k
drivers/common/qat/qat_adf/qat_pke.h +20 -0
@@ -310,4 +310,24 @@ get_ecpm_function(struct rte_crypto_asym_xform *xform) return qat_function; } +static struct qat_asym_function +get_ecpm_named_function (struct rte_crypto_asym_xform *xform) +{ +struct qat_asym_function qat_function; + +switch (xform->ec.curve_id) { +case RTE_CRYPTO_EC_GROUP_SECP256R1 : + qat_function.func_id =PKE_EC_POINT_MULTIPLICATION_P256 ; + qat_function.bytesize =32 ; +break ; +case RTE_CRYPTO_EC_GROUP_SECP384R1 : + qat_function.func_id =PKE_EC_POINT_MULTIPLICATION_P384 ; + qat_function.bytesize =48 ; +break ; +default : + qat_function.func_id =0 ; + } +return qat_function; +} +#endif
drivers/crypto/qat/qat_asym.c +65 -2
85 lines not on this page · raw message
Signature · 1 line
2.30.2
RE: [PATCH 2/2] crypto/qat: add gen4 ecpm functions
Quoted 8 lines
-----Original Message-----
From: Kusztal, ArkadiuszX <[email protected]>
Sent: Friday, April 8, 2022 8:58 AM
To: [email protected]
Cc: [email protected]; Zhang, Roy Fan <[email protected]>; Kusztal, ArkadiuszX <[email protected]>
Subject: [PATCH 2/2]crypto/qat: add gen4 ecpm functions
Quoted 6 lines
This commit adds functions to use ecpm named curves. This will speed up calculation
of multiplication for curves P-256 and P-384.Signed-off-by Arek Kusztal <[email protected]>---