Skip to contentSkip to conversation

adding rsa priv key feature flag

PATCH Applied Ayuj Verma 2 participants 10 messages Mar 28, 2019 – Apr 3, 2019 Crypto API

lore
Share & tools
lore

Ayuj Verma

author
#0 lore raw

v3 cover adding rsa priv key feature flag

Some PMDs can support RSA private key operations using CRT (quintuple) or exponent key only. Thus add a feature flag RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_EXP and RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_QT in PMD to reflect which key type is supported to perform rsa private key op.

App should query PMD feature flag to check if specific key type is supported and call operation with relevant key type.

Changes in v3:
- Rebase changes on top of latest unit test application
- add feature flag description in documentation

Changes in v2:
- RSA key type feature flags exponenet and quintuple, in place of making them part of xform capabilities.

Ayuj Verma (4):
lib/cryptodev: add rsa priv key feature flag crypto/openssl: set rsa private op feature flag app/test: check for key type ff in asym unit test
doc: add rsa key type to feature list

 app/test/test_cryptodev_asym.c             | 26 ++++++++++++++++++++++++++
 doc/guides/cryptodevs/features/openssl.ini |  2 ++
 doc/guides/cryptodevs/overview.rst         |  6 ++++++
 drivers/crypto/openssl/rte_openssl_pmd.c   |  4 +++-
 lib/librte_cryptodev/rte_cryptodev.c       |  4 ++++
 lib/librte_cryptodev/rte_cryptodev.h       |  4 ++++
 6 files changed, 45 insertions(+), 1 deletion(-)
Signature · 1 line
1.8.3.1
author
#1 lore raw

PATCH v3 1/4 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
index 871d7dd..cdc586a 100644
@@ -486,6 +486,10 @@ struct rte_cryptodev_sym_session_pool_private_data {
 		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
index a0bbcf9..298b352 100644
@@ -438,6 +438,10 @@ struct rte_cryptodev_asym_capability_idx {
 /**< 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
1.8.3.1
author
#2 lore raw

PATCH v3 2/4 crypto/openssl: set rsa private op feature flag

In reply to Ayuj Verma

openssl PMD support RSA private key operation using both qt and exp key type.
Set rsa key type feature flag

---
 drivers/crypto/openssl/rte_openssl_pmd.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/crypto/openssl/rte_openssl_pmd.c +3 -1
index 93cd73e..6504959 100644
@@ -2125,7 +2125,9 @@ static void HMAC_CTX_free(HMAC_CTX *ctx)
 			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
1.8.3.1
author
#3 lore raw

PATCH v3 3/4 app/test: check for key type ff in asym unit test

In reply to Ayuj Verma
---
 app/test/test_cryptodev_asym.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
app/test/test_cryptodev_asym.c +26 -0
index a779e8f..539eda1 100644
@@ -49,6 +49,7 @@ struct crypto_unittest_params {
 	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 @@ struct crypto_unittest_params {
 	uint8_t output_buf[TEST_DATA_SIZE] = {0};
 	uint8_t input_buf[TEST_DATA_SIZE] = {0};
 
+	/* test case supports op with exponent key only,
+	 * Check in PMD feature flag for RSA exponent key type support.
+	 */
+	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 @@ struct crypto_unittest_params {
 	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 key only,
+	 * Check in PMD feature flag for RSA exponent key type support.
+	 */
+	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
1.8.3.1
author
#4 lore raw

PATCH v3 4/4 doc: add rsa key type to feature list

In reply to Ayuj Verma

Add ff description in overview.rst and update
feature support in Openssl PMD feature list

---
 doc/guides/cryptodevs/features/openssl.ini | 2 ++
 doc/guides/cryptodevs/overview.rst         | 6 ++++++
 2 files changed, 8 insertions(+)
doc/guides/cryptodevs/features/openssl.ini +2 -0
index b9c0bdc..6ddca39 100644
@@ -9,6 +9,8 @@ Sym operation chaining = Y
 OOP SGL In LB  Out     = Y
 OOP LB  In LB  Out     = Y
 Asymmetric crypto      = Y
+RSA PRIV OP KEY EXP    = Y
+RSA PRIV OP KEY QT     = Y
 
 ;
 ; Supported crypto algorithms of the 'openssl' crypto driver.
doc/guides/cryptodevs/overview.rst +6 -0
index 607e758..d7b7141 100644
@@ -37,6 +37,12 @@ Supported Feature Flags
      which means that Out-of-place operation is supported,
      with linear input and output buffers.
 
+   - "RSA PRIV OP KEY EXP" feature flag means PMD support RSA private key
+     operation (Sign and Decrypt) using exponent key type only.
+
+   - "RSA PRIV OP KEY QT" feature flag means PMD support RSA private key
+     operation (Sign and Decrypt) using quintuple (crt) type key only.
+
 
 Supported Cipher Algorithms
 ---------------------------
Signature · 1 line
1.8.3.1
#5 lore raw
In reply to Ayuj Verma
Quoted 23 lines · Ayuj Verma

Some PMDs can support RSA private key operations using CRT (quintuple) or exponent key only. Thus add a feature flag RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_EXP and RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_QT in PMD to reflect which key type is supported to perform rsa private key op.

App should query PMD feature flag to check if specific key type is supported and call operation with relevant key type.

Changes in v3:
- Rebase changes on top of latest unit test application
- add feature flag description in documentation

Changes in v2:
- RSA key type feature flags exponenet and quintuple, in place of making them part of xform capabilities.

Ayuj Verma (4):
lib/cryptodev: add rsa priv key feature flag crypto/openssl: set rsa private op feature flag app/test: check for key type ff in asym unit test
doc: add rsa key type to feature list

Quoted 8 lines
  app/test/test_cryptodev_asym.c             | 26 ++++++++++++++++++++++++++
  doc/guides/cryptodevs/features/openssl.ini |  2 ++
  doc/guides/cryptodevs/overview.rst         |  6 ++++++
  drivers/crypto/openssl/rte_openssl_pmd.c   |  4 +++-
  lib/librte_cryptodev/rte_cryptodev.c       |  4 ++++
  lib/librte_cryptodev/rte_cryptodev.h       |  4 ++++
  6 files changed, 45 insertions(+), 1 deletion(-)

Series- Acked-by: Akhil Goyal <[email protected]>

doc patch should be merged in previous patches.
Will do it while merging.

Thanks.

Applied
#6 lore raw
In reply to Ayuj Verma
Quoted 23 lines · Ayuj Verma

Some PMDs can support RSA private key operations using CRT (quintuple) or exponent key only. Thus add a feature flag RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_EXP and RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_QT in PMD to reflect which key type is supported to perform rsa private key op.

App should query PMD feature flag to check if specific key type is supported and call operation with relevant key type.

Changes in v3:
- Rebase changes on top of latest unit test application
- add feature flag description in documentation

Changes in v2:
- RSA key type feature flags exponenet and quintuple, in place of making them part of xform capabilities.

Ayuj Verma (4):
lib/cryptodev: add rsa priv key feature flag crypto/openssl: set rsa private op feature flag app/test: check for key type ff in asym unit test
doc: add rsa key type to feature list

Quoted 8 lines
  app/test/test_cryptodev_asym.c             | 26 ++++++++++++++++++++++++++
  doc/guides/cryptodevs/features/openssl.ini |  2 ++
  doc/guides/cryptodevs/overview.rst         |  6 ++++++
  drivers/crypto/openssl/rte_openssl_pmd.c   |  4 +++-
  lib/librte_cryptodev/rte_cryptodev.c       |  4 ++++
  lib/librte_cryptodev/rte_cryptodev.h       |  4 ++++
  6 files changed, 45 insertions(+), 1 deletion(-)

Applied to dpdk-next-crypto

4th patch squashed to 1st and 2nd.
Also added description for 3rd patch. Please add relevant information in the description in future.

Thanks.

author Applied
#7 lore raw

Hi Akhil,

Thanks.

Please add relevant information in the description in future.

Sure will keep this in mind.

Thanks and regards

Ayuj Verma

________________________________
From: Akhil Goyal <[email protected]>
Sent: 29 March 2019 20:47:33
To: Ayuj Verma
Cc: [email protected]; Shally Verma; Sunila Sahu; Kanaka Durga Kotamarthy; Arvind Desai; [email protected]
Subject: Re: [dpdk-dev] [PATCH v3 0/4] adding rsa priv key feature flag

Quoted 23 lines · Ayuj Verma

Some PMDs can support RSA private key operations using CRT (quintuple) or exponent key only. Thus add a feature flag RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_EXP and RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_QT in PMD to reflect which key type is supported to perform rsa private key op.

App should query PMD feature flag to check if specific key type is supported and call operation with relevant key type.

Changes in v3:
- Rebase changes on top of latest unit test application
- add feature flag description in documentation

Changes in v2:
- RSA key type feature flags exponenet and quintuple, in place of making them part of xform capabilities.

Ayuj Verma (4):
lib/cryptodev: add rsa priv key feature flag crypto/openssl: set rsa private op feature flag app/test: check for key type ff in asym unit test
doc: add rsa key type to feature list

Quoted 8 lines
  app/test/test_cryptodev_asym.c             | 26 ++++++++++++++++++++++++++
  doc/guides/cryptodevs/features/openssl.ini |  2 ++
  doc/guides/cryptodevs/overview.rst         |  6 ++++++
  drivers/crypto/openssl/rte_openssl_pmd.c   |  4 +++-
  lib/librte_cryptodev/rte_cryptodev.c       |  4 ++++
  lib/librte_cryptodev/rte_cryptodev.h       |  4 ++++
  6 files changed, 45 insertions(+), 1 deletion(-)

Applied to dpdk-next-crypto

4th patch squashed to 1st and 2nd.
Also added description for 3rd patch. Please add relevant information in the description in future.

Thanks.

#8 lore raw
In reply to Akhil Goyal
Quoted 33 lines · Akhil Goyal
Quoted 23 lines · Ayuj Verma

Some PMDs can support RSA private key operations using CRT (quintuple) or exponent key only. Thus add a feature flag RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_EXP and RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_QT in PMD to reflect which key type is supported to perform rsa private key op.

App should query PMD feature flag to check if specific key type is supported and call operation with relevant key type.

Changes in v3:
- Rebase changes on top of latest unit test application
- add feature flag description in documentation

Changes in v2:
- RSA key type feature flags exponenet and quintuple, in place of making them part of xform capabilities.

Ayuj Verma (4):
lib/cryptodev: add rsa priv key feature flag crypto/openssl: set rsa private op feature flag app/test: check for key type ff in asym unit test
doc: add rsa key type to feature list

Quoted 8 lines
   app/test/test_cryptodev_asym.c             | 26 ++++++++++++++++++++++++++
   doc/guides/cryptodevs/features/openssl.ini |  2 ++
   doc/guides/cryptodevs/overview.rst         |  6 ++++++
   drivers/crypto/openssl/rte_openssl_pmd.c   |  4 +++-
   lib/librte_cryptodev/rte_cryptodev.c       |  4 ++++
   lib/librte_cryptodev/rte_cryptodev.h       |  4 ++++
   6 files changed, 45 insertions(+), 1 deletion(-)
Quoted 7 lines

Applied to dpdk-next-crypto

4th patch squashed to 1st and 2nd.
Also added description for 3rd patch. Please add relevant information in the description in future.

Thanks.

Following errors were observed in compiling documentation

Warning generate_overview_table(): Unknown feature 'RSA PRIV OP KEY EXP' in 'openssl.ini'

Warning generate_overview_table(): Unknown feature 'RSA PRIV OP KEY QT' in 'openssl.ini'

I corrected these byadding the two features in features/default.ini. -Akhil

author
#9 lore raw

Hi Akhil,

Thanks.

Regards

Ayuj Verma

________________________________
From: Akhil Goyal <[email protected]>
Sent: 03 April 2019 14:17:11
To: Ayuj Verma
Cc: [email protected]; Shally Verma; Sunila Sahu; Kanaka Durga Kotamarthy; Arvind Desai; [email protected]
Subject: Re: [dpdk-dev] [PATCH v3 0/4] adding rsa priv key feature flag

Quoted 33 lines · Akhil Goyal
Quoted 23 lines · Ayuj Verma

Some PMDs can support RSA private key operations using CRT (quintuple) or exponent key only. Thus add a feature flag RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_EXP and RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_QT in PMD to reflect which key type is supported to perform rsa private key op.

App should query PMD feature flag to check if specific key type is supported and call operation with relevant key type.

Changes in v3:
- Rebase changes on top of latest unit test application
- add feature flag description in documentation

Changes in v2:
- RSA key type feature flags exponenet and quintuple, in place of making them part of xform capabilities.

Ayuj Verma (4):
lib/cryptodev: add rsa priv key feature flag crypto/openssl: set rsa private op feature flag app/test: check for key type ff in asym unit test
doc: add rsa key type to feature list

Quoted 8 lines
   app/test/test_cryptodev_asym.c             | 26 ++++++++++++++++++++++++++
   doc/guides/cryptodevs/features/openssl.ini |  2 ++
   doc/guides/cryptodevs/overview.rst         |  6 ++++++
   drivers/crypto/openssl/rte_openssl_pmd.c   |  4 +++-
   lib/librte_cryptodev/rte_cryptodev.c       |  4 ++++
   lib/librte_cryptodev/rte_cryptodev.h       |  4 ++++
   6 files changed, 45 insertions(+), 1 deletion(-)
Quoted 7 lines

Applied to dpdk-next-crypto

4th patch squashed to 1st and 2nd.
Also added description for 3rd patch. Please add relevant information in the description in future.

Thanks.

Following errors were observed in compiling documentation

Warning generate_overview_table(): Unknown feature 'RSA PRIV OP KEY EXP' in 'openssl.ini'

Warning generate_overview_table(): Unknown feature 'RSA PRIV OP KEY QT' in 'openssl.ini'

I corrected these byadding the two features in features/default.ini. -Akhil