Add missing eliptic curves capabilities. Small fixes on ECDH implementation.
Signed-off-by: Radu Nicolau <radu.nico...@intel.com> --- drivers/crypto/qat/dev/qat_asym_pmd_gen1.c | 13 +++++++++++++ drivers/crypto/qat/qat_asym.c | 9 +++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/qat/dev/qat_asym_pmd_gen1.c b/drivers/crypto/qat/dev/qat_asym_pmd_gen1.c index 67b1892c32..20001bd1cc 100644 --- a/drivers/crypto/qat/dev/qat_asym_pmd_gen1.c +++ b/drivers/crypto/qat/dev/qat_asym_pmd_gen1.c @@ -38,6 +38,19 @@ static struct rte_cryptodev_capabilities qat_asym_crypto_caps_gen1[] = { (1 << RTE_CRYPTO_ASYM_OP_ENCRYPT) | (1 << RTE_CRYPTO_ASYM_OP_DECRYPT)), 64, 512, 64), + QAT_ASYM_CAP(ECDH, + ((1 << RTE_CRYPTO_ASYM_KE_PUB_KEY_GENERATE) | + (1 << RTE_CRYPTO_ASYM_KE_SHARED_SECRET_COMPUTE) | + (1 << RTE_CRYPTO_ASYM_KE_PUB_KEY_VERIFY)), + 64, 512, 64), + QAT_ASYM_CAP(ECDSA, + ((1 << RTE_CRYPTO_ASYM_OP_SIGN) | + (1 << RTE_CRYPTO_ASYM_OP_VERIFY)), + 64, 512, 64), + QAT_ASYM_CAP(ECPM, + ((1 << RTE_CRYPTO_ASYM_OP_SIGN) | + (1 << RTE_CRYPTO_ASYM_OP_VERIFY)), + 64, 512, 64), RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST() }; diff --git a/drivers/crypto/qat/qat_asym.c b/drivers/crypto/qat/qat_asym.c index d8a1406819..bd22fc0a6f 100644 --- a/drivers/crypto/qat/qat_asym.c +++ b/drivers/crypto/qat/qat_asym.c @@ -801,11 +801,14 @@ ecdh_set_input(struct icp_qat_fw_pke_request *qat_req, SET_PKE_LN(asym_op->ecdh.priv_key, qat_func_alignsize, 0); SET_PKE_LN_EC(curve[curve_id], x, 1); SET_PKE_LN_EC(curve[curve_id], y, 2); - } else { + } else if (asym_op->ecdh.ke_type == RTE_CRYPTO_ASYM_KE_SHARED_SECRET_COMPUTE) { SET_PKE_LN(asym_op->ecdh.priv_key, qat_func_alignsize, 0); SET_PKE_LN(asym_op->ecdh.pub_key.x, qat_func_alignsize, 1); SET_PKE_LN(asym_op->ecdh.pub_key.y, qat_func_alignsize, 2); + } else { + return -EINVAL; } + SET_PKE_LN_EC(curve[curve_id], a, 3); SET_PKE_LN_EC(curve[curve_id], b, 4); SET_PKE_LN_EC(curve[curve_id], p, 5); @@ -894,11 +897,13 @@ ecdh_collect(struct rte_crypto_asym_op *asym_op, asym_op->ecdh.pub_key.y.length = alg_bytesize; x = asym_op->ecdh.pub_key.x.data; y = asym_op->ecdh.pub_key.y.data; - } else { + } else if (asym_op->ecdh.ke_type == RTE_CRYPTO_ASYM_KE_SHARED_SECRET_COMPUTE) { asym_op->ecdh.shared_secret.x.length = alg_bytesize; asym_op->ecdh.shared_secret.y.length = alg_bytesize; x = asym_op->ecdh.shared_secret.x.data; y = asym_op->ecdh.shared_secret.y.data; + } else { + return -EINVAL; } rte_memcpy(x, &cookie->output_array[0][ltrim], alg_bytesize); -- 2.50.1