adding rsa priv key feature flag
v2 cover adding rsa priv key feature flag
Some PMDs can only support RSA private key operations using CRT (quintuple) or exponent key only. Thus it is required to add feature flag (ff) in PMD to reflect which key type is supported to perform sign and decrypt ops.
Thus add feature flags RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_EXP and RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_QT which would mean support to perform a private key op using CRT keys (quintuple) or exponent or both.
App should query PMD feature flag to check if specific key type is supported and call operation with relevant key type.
Ayuj Verma (3):
lib/cryptodev: add rsa priv key feature flag crypto/openssl: set rsa private op feature flag test/crypto: check for rsa key type feature flag
drivers/crypto/openssl/rte_openssl_pmd.c | 4 +++- lib/librte_cryptodev/rte_cryptodev.c | 4 ++++ lib/librte_cryptodev/rte_cryptodev.h | 4 ++++ test/test/test_cryptodev_asym.c | 26 ++++++++++++++++++++++++ 4 files changed, 37 insertions(+), 1 deletion(-)
Signature · 1 line
2.20.0
PATCH v2 1/3 lib/cryptodev: add rsa priv key feature flag
Add feature flag to reflect RSA private key operation support using quintuple (crt) or exponent type key. if PMD support both, then it should set both.
App should query cryptodev feature flag to check if Sign and Decryt with CRT keys or exponent is supported, thus call operation with relevant key type.
--- lib/librte_cryptodev/rte_cryptodev.c | 4 ++++ lib/librte_cryptodev/rte_cryptodev.h | 4 ++++ 2 files changed, 8 insertions(+)
lib/librte_cryptodev/rte_cryptodev.c +4 -0
@@ -486,6 +486,10 @@ rte_cryptodev_get_feature_name(uint64_t flag)return "CPU_ARM_CE" ;case RTE_CRYPTODEV_FF_SECURITY :return "SECURITY_PROTOCOL" ; +case RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_EXP : +return "RSA_PRIV_OP_KEY_EXP" ; +case RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_QT : +return "RSA_PRIV_OP_KEY_QT" ;default :return NULL ; }
lib/librte_cryptodev/rte_cryptodev.h +4 -0
@@ -438,6 +438,10 @@ rte_cryptodev_asym_get_xform_enum(enum rte_crypto_asym_xform_type *xform_enum,/**< Utilises ARM CPU Cryptographic Extensions */ #define RTE_CRYPTODEV_FF_SECURITY (1ULL << 16)/**< Support Security Protocol Processing */ +#define RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_EXP (1ULL << 17) +/**< Support RSA Private Key OP with exponent */ +#define RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_QT (1ULL << 18) +/**< Support RSA Private Key OP with CRT (quintuple) Keys */ /**
Signature · 1 line
2.20.0
PATCH v2 2/3 crypto/openssl: set rsa private op feature flag
In reply to Ayuj Vermaopenssl PMD support RSA private key operation using both qt and exp key type.
Set both feature flag in PMD capability
--- drivers/crypto/openssl/rte_openssl_pmd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/crypto/openssl/rte_openssl_pmd.c +3 -1
@@ -2119,7 +2119,9 @@ cryptodev_openssl_create(const char *name,RTE_CRYPTODEV_FF_CPU_AESNI |RTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT |RTE_CRYPTODEV_FF_OOP_LB_IN_LB_OUT | -RTE_CRYPTODEV_FF_ASYMMETRIC_CRYPTO ; +RTE_CRYPTODEV_FF_ASYMMETRIC_CRYPTO | +RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_EXP | +RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_QT ;/* Set vector instructions mode supported */ internals = dev->data->dev_private;
Signature · 1 line
2.20.0
PATCH v2 3/3 test/crypto: check for rsa key type feature flag
In reply to Ayuj VermaCheck for RSA private key type feature flag in
private key operations
--- test/test/test_cryptodev_asym.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
test/test/test_cryptodev_asym.c +26 -0
@@ -49,6 +49,7 @@ test_rsa_sign_verify(void)struct rte_mempool *op_mpool = ts_params->op_mpool;struct rte_mempool *sess_mpool = ts_params->session_mpool;uint8_t dev_id = ts_params->valid_devs[0 ]; +struct rte_cryptodev_info dev_info;struct rte_crypto_asym_op *asym_op =NULL ;struct rte_crypto_op *op =NULL , *result_op =NULL ;struct rte_cryptodev_asym_session *sess =NULL ;
@@ -56,6 +57,18 @@ test_rsa_sign_verify(void)uint8_t output_buf[TEST_DATA_SIZE ] = {0 };uint8_t input_buf[TEST_DATA_SIZE ] = {0 }; +/* test case supports op with exponent keyonly, +* so check for it in feature_flags +*/ +rte_cryptodev_info_get (dev_id, &dev_info); +if (!(dev_info.feature_flags & +RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_EXP )) { +RTE_LOG (INFO ,USER1 , +"Device doesn't support sign op with " +"exponent key type. Test Skipped\n" ); +return TEST_SKIPPED ; + } + sess =rte_cryptodev_asym_session_create (sess_mpool);if (!sess) {
@@ -183,12 +196,25 @@ test_rsa_enc_dec(void)struct rte_mempool *op_mpool = ts_params->op_mpool;struct rte_mempool *sess_mpool = ts_params->session_mpool;uint8_t dev_id = ts_params->valid_devs[0 ]; +struct rte_cryptodev_info dev_info;struct rte_crypto_asym_op *asym_op =NULL ;struct rte_crypto_op *op =NULL , *result_op =NULL ;struct rte_cryptodev_asym_session *sess =NULL ;int status =TEST_SUCCESS ;uint8_t input_buf[TEST_DATA_SIZE ] = {0 }; +/* test case supports op with exponent keyonly, +* so check for it in feature_flags +*/ +rte_cryptodev_info_get (dev_id, &dev_info); +if (!(dev_info.feature_flags & +RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_EXP )) { +RTE_LOG (INFO ,USER1 , +"Device doesn't support sign op with " +"exponent key type. Test Skipped\n" ); +return TEST_SKIPPED ; + } + sess =rte_cryptodev_asym_session_create (sess_mpool);if (!sess) {
Signature · 1 line
2.20.0
Hi Akhil,
Did you get a chance to look into these.
Thanks and regards
Ayuj Verma
________________________________
From: Ayuj Verma
Sent: 27 February 2019 19:03:31
To: [email protected]
Cc: [email protected]; [email protected]; Shally Verma; Sunila Sahu; Kanaka Durga Kotamarthy; Arvind Desai; [email protected]; Ayuj Verma
Subject: [PATCH v2 0/3] adding rsa priv key feature flag
Some PMDs can only support RSA private key operations using CRT (quintuple) or exponent key only. Thus it is required to add feature flag (ff) in PMD to reflect which key type is supported to perform sign and decrypt ops.
Thus add feature flags RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_EXP and RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_QT which would mean support to perform a private key op using CRT keys (quintuple) or exponent or both.
App should query PMD feature flag to check if specific key type is supported and call operation with relevant key type.
Ayuj Verma (3):
lib/cryptodev: add rsa priv key feature flag crypto/openssl: set rsa private op feature flag test/crypto: check for rsa key type feature flag
drivers/crypto/openssl/rte_openssl_pmd.c | 4 +++- lib/librte_cryptodev/rte_cryptodev.c | 4 ++++ lib/librte_cryptodev/rte_cryptodev.h | 4 ++++ test/test/test_cryptodev_asym.c | 26 ++++++++++++++++++++++++ 4 files changed, 37 insertions(+), 1 deletion(-)
--
2.20.0
Hi Akhil, Fiona, Arek,
Gentle reminder.
Did you get a chance to look into these.
Thanks and regards
Ayuj Verma
________________________________
From: dev <[email protected]> on behalf of Ayuj Verma <[email protected]>
Sent: 05 March 2019 14:41:18
To: [email protected]
Cc: [email protected]; [email protected]; Shally Verma; Sunila Sahu; Kanaka Durga Kotamarthy; Arvind Desai; [email protected]
Subject: [EXT] Re: [dpdk-dev] [PATCH v2 0/3] adding rsa priv key feature flag
External Email
----------------------------------------------------------------------
Hi Akhil,
Did you get a chance to look into these.
Thanks and regards
Ayuj Verma
________________________________
From: Ayuj Verma
Sent: 27 February 2019 19:03:31
To: [email protected]
Cc: [email protected]; [email protected]; Shally Verma; Sunila Sahu; Kanaka Durga Kotamarthy; Arvind Desai; [email protected]; Ayuj Verma
Subject: [PATCH v2 0/3] adding rsa priv key feature flag
Some PMDs can only support RSA private key operations using CRT (quintuple) or exponent key only. Thus it is required to add feature flag (ff) in PMD to reflect which key type is supported to perform sign and decrypt ops.
Thus add feature flags RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_EXP and RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_QT which would mean support to perform a private key op using CRT keys (quintuple) or exponent or both.
App should query PMD feature flag to check if specific key type is supported and call operation with relevant key type.
Ayuj Verma (3):
lib/cryptodev: add rsa priv key feature flag crypto/openssl: set rsa private op feature flag test/crypto: check for rsa key type feature flag
drivers/crypto/openssl/rte_openssl_pmd.c | 4 +++- lib/librte_cryptodev/rte_cryptodev.c | 4 ++++ lib/librte_cryptodev/rte_cryptodev.h | 4 ++++ test/test/test_cryptodev_asym.c | 26 ++++++++++++++++++++++++ 4 files changed, 37 insertions(+), 1 deletion(-)
--
2.20.0
Hi Ayuj,
Sorry for delayed answer.
For me it is perfectly fine, I will ack it.
Thanks,
Arek
From: Ayuj Verma [mailto:[email protected]]
Sent: Wednesday, March 13, 2019 8:30 AM
To: [email protected]
Cc: Kusztal, ArkadiuszX <[email protected]>; Trahe, Fiona <[email protected]>; Shally Verma <[email protected]>; Sunila Sahu <[email protected]>; Kanaka Durga Kotamarthy <[email protected]>; Arvind Desai <[email protected]>; [email protected]
Subject: Re: [PATCH v2 0/3] adding rsa priv key feature flag
Hi Akhil, Fiona, Arek,
Gentle reminder.
Did you get a chance to look into these.
Thanks and regards
Ayuj Verma
________________________________
From: dev <[email protected]<mailto:[email protected]>> on behalf of Ayuj Verma <[email protected]<mailto:[email protected]>>
Sent: 05 March 2019 14:41:18
To: [email protected]<mailto:[email protected]>
Cc: [email protected]<mailto:[email protected]>; [email protected]<mailto:[email protected]>; Shally Verma; Sunila Sahu; Kanaka Durga Kotamarthy; Arvind Desai; [email protected]<mailto:[email protected]>
Subject: [EXT] Re: [dpdk-dev] [PATCH v2 0/3] adding rsa priv key feature flag
External Email
----------------------------------------------------------------------
Hi Akhil,
Did you get a chance to look into these.
Thanks and regards
Ayuj Verma
________________________________
From: Ayuj Verma
Sent: 27 February 2019 19:03:31
To: [email protected]<mailto:[email protected]>
Cc: [email protected]<mailto:[email protected]>; [email protected]<mailto:[email protected]>; Shally Verma; Sunila Sahu; Kanaka Durga Kotamarthy; Arvind Desai; [email protected]<mailto:[email protected]>; Ayuj Verma
Subject: [PATCH v2 0/3] adding rsa priv key feature flag
Some PMDs can only support RSA private key operations using CRT (quintuple) or exponent key only. Thus it is required to add feature flag (ff) in PMD to reflect which key type is supported to perform sign and decrypt ops.
Thus add feature flags RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_EXP and RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_QT which would mean support to perform a private key op using CRT keys (quintuple) or exponent or both.
App should query PMD feature flag to check if specific key type is supported and call operation with relevant key type.
Ayuj Verma (3):
lib/cryptodev: add rsa priv key feature flag crypto/openssl: set rsa private op feature flag test/crypto: check for rsa key type feature flag
drivers/crypto/openssl/rte_openssl_pmd.c | 4 +++- lib/librte_cryptodev/rte_cryptodev.c | 4 ++++ lib/librte_cryptodev/rte_cryptodev.h | 4 ++++ test/test/test_cryptodev_asym.c | 26 ++++++++++++++++++++++++ 4 files changed, 37 insertions(+), 1 deletion(-)
--
2.20.0
V2 will be needed as test directory apparently changed its location. Iam acking anyway.
Quoted 27 lines
-----Original Message-----
From: Ayuj Verma [mailto:[email protected]]
Sent: Wednesday, February 27, 2019 2:34 PM
To: [email protected]
Cc: Kusztal, ArkadiuszX <[email protected]>; Trahe, Fiona <[email protected]>; Shally Verma <[email protected]>; Sunila Sahu <[email protected]>; Kanaka Durga Kotamarthy <[email protected]>; Arvind Desai <[email protected]>; [email protected]; Ayuj Verma <[email protected]>
Subject: [PATCH v2 0/3] adding rsa priv key feature flagSome PMDs can only support RSA private key operations using CRT (quintuple) or exponent key only. Thus it is required to add feature flag (ff) in PMD to reflect which key type is supported to perform sign and decrypt ops.
Thus add feature flags
RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_EXP
andRTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_QTwhich would mean support to perform a private key op using CRT keys (quintuple) or exponent or both.App should query PMD feature flag to check if specific key type is supported and call operation with relevant key type.
Ayuj Verma (3):
lib/cryptodev: add rsa priv key feature flagcrypto/openssl: set rsa private op feature flag test/crypto: check for rsa key type feature flag
Quoted 8 lines
drivers/crypto/openssl/rte_openssl_pmd.c | 4 +++- lib/librte_cryptodev/rte_cryptodev.c | 4 ++++ lib/librte_cryptodev/rte_cryptodev.h | 4 ++++ test/test/test_cryptodev_asym.c | 26 ++++++++++++++++++++++++ 4 files changed, 37 insertions(+), 1 deletion(-)--
2.20.0
Re: [PATCH v2 1/3] lib/cryptodev: add rsa priv key feature flag
In reply to Ayuj VermaHi Ayuj,
Quoted 37 lines · Ayuj Verma
Add feature flag to reflect RSA private key operation support using quintuple (crt) or exponent type key. if PMD support both, then it should set both.
App should query cryptodev feature flag to check if Sign and Decryt with CRT keys or exponent is supported, thus call operation with relevant key type.
Signed-off-by Ayuj Verma <[email protected]>Signed-off-by Shally Verma <[email protected]>--- lib/librte_cryptodev/rte_cryptodev.c | 4 ++++ lib/librte_cryptodev/rte_cryptodev.h | 4 ++++ 2 files changed, 8 insertions(+)lib/librte_cryptodev/rte_cryptodev.c +4
-0@@ -486,6 +486,10 @@ rte_cryptodev_get_feature_name(uint64_t flag)return "CPU_ARM_CE" ;case RTE_CRYPTODEV_FF_SECURITY :return "SECURITY_PROTOCOL" ; +case RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_EXP : +return "RSA_PRIV_OP_KEY_EXP" ; +case RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_QT : +return "RSA_PRIV_OP_KEY_QT" ;default :return NULL ; }lib/librte_cryptodev/rte_cryptodev.h +0
-0
lib/librte_cryptodev/rte_cryptodev.h rte_cryptodev_asym_get_xform_enum(enum rte_crypto_asym_xform_type *xform_enum, · line 444
Quoted 7 lines
lib/librte_cryptodev/rte_cryptodev.h +4
-0@@ -438,6 +438,10 @@ rte_cryptodev_asym_get_xform_enum(enum rte_crypto_asym_xform_type *xform_enum,/**< Utilises ARM CPU Cryptographic Extensions */ #define RTE_CRYPTODEV_FF_SECURITY (1ULL << 16)/**< Support Security Protocol Processing */ +#define RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_EXP (1ULL << 17) +/**< Support RSA Private Key OP with exponent */ +#define RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_QT (1ULL << 18) +/**< Support RSA Private Key OP with CRT (quintuple) Keys */
I believe these feature flags should be explained a bit in the documentation(doc/guides/cryptodevs/)
Quoted 3 lines
lib/librte_cryptodev/rte_cryptodev.h +0
-0/**
Re: [PATCH v2 3/3] test/crypto: check for rsa key type feature flag
In reply to Ayuj VermaHi Ayuj,
Quoted 8 lines · Ayuj Verma
Check for RSA private key type feature flag in
private key operationsSigned-off-by Ayuj Verma <[email protected]>Signed-off-by Shally Verma <[email protected]>--- test/test/test_cryptodev_asym.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
Please rebase this patch.
Quoted 58 lines
test/test/test_cryptodev_asym.c +26
-0@@ -49,6 +49,7 @@ test_rsa_sign_verify(void)struct rte_mempool *op_mpool = ts_params->op_mpool;struct rte_mempool *sess_mpool = ts_params->session_mpool;uint8_t dev_id = ts_params->valid_devs[0 ]; +struct rte_cryptodev_info dev_info;struct rte_crypto_asym_op *asym_op =NULL ;struct rte_crypto_op *op =NULL , *result_op =NULL ;struct rte_cryptodev_asym_session *sess =NULL ;@@ -56,6 +57,18 @@ test_rsa_sign_verify(void)uint8_t output_buf[TEST_DATA_SIZE ] = {0 };uint8_t input_buf[TEST_DATA_SIZE ] = {0 }; +/* test case supports op with exponent keyonly, +* so check for it in feature_flags +*/ +rte_cryptodev_info_get (dev_id, &dev_info); +if (!(dev_info.feature_flags & +RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_EXP )) { +RTE_LOG (INFO ,USER1 , +"Device doesn't support sign op with " +"exponent key type. Test Skipped\n" ); +return TEST_SKIPPED ; + } + sess =rte_cryptodev_asym_session_create (sess_mpool);if (!sess) {@@ -183,12 +196,25 @@ test_rsa_enc_dec(void)struct rte_mempool *op_mpool = ts_params->op_mpool;struct rte_mempool *sess_mpool = ts_params->session_mpool;uint8_t dev_id = ts_params->valid_devs[0 ]; +struct rte_cryptodev_info dev_info;struct rte_crypto_asym_op *asym_op =NULL ;struct rte_crypto_op *op =NULL , *result_op =NULL ;struct rte_cryptodev_asym_session *sess =NULL ;int status =TEST_SUCCESS ;uint8_t input_buf[TEST_DATA_SIZE ] = {0 }; +/* test case supports op with exponent keyonly, +* so check for it in feature_flags +*/ +rte_cryptodev_info_get (dev_id, &dev_info); +if (!(dev_info.feature_flags & +RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_EXP )) { +RTE_LOG (INFO ,USER1 , +"Device doesn't support sign op with " +"exponent key type. Test Skipped\n" ); +return TEST_SKIPPED ; + } + sess =rte_cryptodev_asym_session_create (sess_mpool);if (!sess) {
Re: [PATCH v2 1/3] lib/cryptodev: add rsa priv key feature flag
In reply to Akhil GoyalHi Akhil, Arek,
Sure, I'll rebase the patch and will send v3 along with doc changes.
Thanks and regards
Ayuj Verma
-----Original Message-----
From: Akhil Goyal <[email protected]>
Sent: Sunday, March 17, 2019 11:17 PM
To: Ayuj Verma <[email protected]>
Cc: [email protected]; [email protected]; Shally Verma <[email protected]>; Sunila Sahu <[email protected]>; Kanaka Durga Kotamarthy <[email protected]>; Arvind Desai <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH v2 1/3] lib/cryptodev: add rsa priv key feature flag
Hi Ayuj,
Quoted 37 lines · Ayuj Verma
Add feature flag to reflect RSA private key operation support using quintuple (crt) or exponent type key. if PMD support both, then it should set both.
App should query cryptodev feature flag to check if Sign and Decryt with CRT keys or exponent is supported, thus call operation with relevant key type.
Signed-off-by Ayuj Verma <[email protected]>Signed-off-by Shally Verma <[email protected]>--- lib/librte_cryptodev/rte_cryptodev.c | 4 ++++ lib/librte_cryptodev/rte_cryptodev.h | 4 ++++ 2 files changed, 8 insertions(+)lib/librte_cryptodev/rte_cryptodev.c +4
-0@@ -486,6 +486,10 @@ rte_cryptodev_get_feature_name(uint64_t flag)return "CPU_ARM_CE" ;case RTE_CRYPTODEV_FF_SECURITY :return "SECURITY_PROTOCOL" ; +case RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_EXP : +return "RSA_PRIV_OP_KEY_EXP" ; +case RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_QT : +return "RSA_PRIV_OP_KEY_QT" ;default :return NULL ; }lib/librte_cryptodev/rte_cryptodev.h +0
-0
lib/librte_cryptodev/rte_cryptodev.h rte_cryptodev_asym_get_xform_enum(enum rte_crypto_asym_xform_type *xform_enum, · line 444
Quoted 7 lines
lib/librte_cryptodev/rte_cryptodev.h +4
-0@@ -438,6 +438,10 @@ rte_cryptodev_asym_get_xform_enum(enum rte_crypto_asym_xform_type *xform_enum,/**< Utilises ARM CPU Cryptographic Extensions */ #define RTE_CRYPTODEV_FF_SECURITY (1ULL << 16)/**< Support Security Protocol Processing */ +#define RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_EXP (1ULL << 17) +/**< Support RSA Private Key OP with exponent */ +#define RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_QT (1ULL << 18) +/**< Support RSA Private Key OP with CRT (quintuple) Keys */
I believe these feature flags should be explained a bit in the documentation(doc/guides/cryptodevs/)
Quoted 3 lines
lib/librte_cryptodev/rte_cryptodev.h +0
-0/**