Skip to contentSkip to conversation

doc: announce cryptodev changes to offload RSA in VirtIO

PATCH In review Gowrishankar Muthukrishnan 5 participants 11 messages Jul 22, 2024 – Aug 18, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 doc: announce cryptodev changes to offload RSA in VirtIO

Announce cryptodev changes to offload RSA asymmetric operation in VirtIO PMD.

--
RFC:
https://patches.dpdk.org/project/dpdk/patch/[email protected]/
https://patches.dpdk.org/project/dpdk/patch/[email protected]/

---
 doc/guides/rel_notes/deprecation.rst | 11 +++++++++++
 1 file changed, 11 insertions(+)
doc/guides/rel_notes/deprecation.rst +11 -0
index 6948641ff6..26fec84aba 100644
@@ -147,3 +147,14 @@ Deprecation Notices
   will be deprecated and subsequently removed in DPDK 24.11 release.
   Before this, the new port library API (functions rte_swx_port_*)
   will gradually transition from experimental to stable status.
+
+* cryptodev: The struct rte_crypto_rsa_padding will be moved from
+  rte_crypto_rsa_op_param struct to rte_crypto_rsa_xform struct,
+  breaking ABI. The new location is recommended to comply with
+  virtio-crypto specification. Applications and drivers using
+  this struct will be updated.
+
+* cryptodev: The rte_crypto_rsa_xform struct member to hold private key
+  in either exponent or quintuple format is changed from union to struct
+  data type. This change is to support ASN.1 syntax (RFC 3447 Appendix A.1.2).
+  This change will not break existing applications.
Signature · 1 line
2.21.0
Acked-by on v1 1/1
#2 lore raw
In reply to Gowrishankar Muthukrishnan
Quoted 9 lines

Announce cryptodev changes to offload RSA asymmetric operation in VirtIO PMD.

--
RFC:
https://patches.dpdk.org/project/dpdk/patch/[email protected]/
https://patches.dpdk.org/project/dpdk/patch/[email protected]/
---

Quoted 25 lines
 doc/guides/rel_notes/deprecation.rst | 11 +++++++++++
 1 file changed, 11 insertions(+)
doc/guides/rel_notes/deprecation.rst +11 -1
index 6948641ff6..26fec84aba 100644
@@ -147,3 +147,14 @@ Deprecation Notices
   will be deprecated and subsequently removed in DPDK 24.11 release.
   Before this, the new port library API (functions rte_swx_port_*)
   will gradually transition from experimental to stable status.
+
+* cryptodev: The struct rte_crypto_rsa_padding will be moved from
+  rte_crypto_rsa_op_param struct to rte_crypto_rsa_xform struct,
+  breaking ABI. The new location is recommended to comply with
+  virtio-crypto specification. Applications and drivers using
+  this struct will be updated.
+
+* cryptodev: The rte_crypto_rsa_xform struct member to hold private key
+  in either exponent or quintuple format is changed from union to struct
+  data type. This change is to support ASN.1 syntax (RFC 3447 Appendix A.1.2).
+  This change will not break existing applications.
--

2.21.0

#3 lore raw
In reply to Gowrishankar Muthukrishnan

Hi Gowrishankar,

Quoted 40 lines

-----Original Message-----
From: Gowrishankar Muthukrishnan <[email protected]>
Sent: Monday, July 22, 2024 4:56 PM
To: [email protected]; Anoob Joseph <[email protected]>; Richardson, Bruce <[email protected]>; [email protected]; [email protected]; [email protected]; Kusztal, ArkadiuszX <[email protected]>; Ji, Kai <[email protected]>; [email protected]; Marchand, David <[email protected]>; [email protected]; De Lara Guarch, Pablo <[email protected]>; Trahe, Fiona <[email protected]>; Doherty, Declan <[email protected]>; [email protected]; [email protected]; Gujjar, Abhinandan S <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Daly, Lee <[email protected]>
Cc: Gowrishankar Muthukrishnan <[email protected]>
Subject: [PATCH] doc: announce cryptodev changes to offload RSA in VirtIO

Announce cryptodev changes to offload RSA asymmetric operation in VirtIO PMD.

--
RFC:
https://patches.dpdk.org/project/dpdk/patch/20230928095300.1353-2-
[email protected]/
https://patches.dpdk.org/project/dpdk/patch/20230928095300.1353-3-
[email protected]/

---
 doc/guides/rel_notes/deprecation.rst | 11 +++++++++++
 1 file changed, 11 insertions(+)
doc/guides/rel_notes/deprecation.rst +0 -0
index 6948641ff6..26fec84aba 100644

doc/guides/rel_notes/deprecation.rst Deprecation Notices · line 156

Quoted 10 lines
doc/guides/rel_notes/deprecation.rst +7 -0
@@ -147,3 +147,14 @@ Deprecation Notices
   will be deprecated and subsequently removed in DPDK 24.11 release.
   Before this, the new port library API (functions rte_swx_port_*)
   will gradually transition from experimental to stable status.
+
+* cryptodev: The struct rte_crypto_rsa_padding will be moved from
+  rte_crypto_rsa_op_param struct to rte_crypto_rsa_xform struct,
+  breaking ABI. The new location is recommended to comply with
+  virtio-crypto specification. Applications and drivers using
+  this struct will be updated.
+

The problem here, I see is that there is one private key but multiple combinations of padding. Therefore, for every padding variation, we need to copy the same private key anew, duplicating it in memory. The only reason for me to keep a session-like struct in asymmetric crypto was exactly this.

doc/guides/rel_notes/deprecation.rst Deprecation Notices · line 160

Quoted 5 lines
doc/guides/rel_notes/deprecation.rst +5 -0
+* cryptodev: The rte_crypto_rsa_xform struct member to hold private key
+  in either exponent or quintuple format is changed from union to
+struct
+  data type. This change is to support ASN.1 syntax (RFC 3447 Appendix A.1.2).
+  This change will not break existing applications.

This one I agree. RFC 8017 obsoletes RFC 3447.

Quoted 2 lines

--
2.21.0

#4 lore raw

doc/guides/rel_notes/deprecation.rst Deprecation Notices · line 156

Quoted 11 lines
doc/guides/rel_notes/deprecation.rst +6 -0
+* cryptodev: The struct rte_crypto_rsa_padding will be moved from
 
+  rte_crypto_rsa_op_param struct to rte_crypto_rsa_xform struct,
 
+  breaking ABI. The new location is recommended to comply with
 
+  virtio-crypto specification. Applications and drivers using
 
+  this struct will be updated.
 
+

The problem here, I see is that there is one private key but multiple combinations of padding.

Therefore, for every padding variation, we need to copy the same private key anew, duplicating it in memory.

The only reason for me to keep a session-like struct in asymmetric crypto was exactly this.

Each padding scheme in RSA has its own pros and cons (in terms of implementations as well).

When we share the same private key for Sign (and its public key in case of Encryption) between

multiple crypto ops (varying by padding schemes among cops), a vulnerable attack against one scheme

could potentially open door to used private key in the session and hence take advantage

on other crypto operations.

I think, this could be one reason for why VirtIO spec mandates padding info as session parameter.

Hence, more than duplicating in memory, private and public keys are secured and in catastrophe,

only that session could be destroyed.

Thanks,

Gowrishankar

Though padding schemes could be same

Review

Quoted 9 lines
(quoted diff) +5 -0
+* cryptodev: The rte_crypto_rsa_xform struct member to hold private key
 
+  in either exponent or quintuple format is changed from union to
 
+struct
 
+  data type. This change is to support ASN.1 syntax (RFC 3447 Appendix A.1.2).
 
+  This change will not break existing applications.

This one I agree. RFC 8017 obsoletes RFC 3447.

Thanks,

Gowrishankar

Quoted 3 lines

--

2.21.0

#5 lore raw

Hi,
We need to fix padding info in DPDK as per VirtIO specification in order to support RSA in virtio devices. VirtIO-crypto specification and DPDK specification differs in the way padding is handled.
With current DPDK & virtio specification, it is impossible to support RSA in virtio-crypto. If you think DPDK spec should not be modified, we will try to amend the virtIO spec to match DPDK, but since we do not know if the virtIO community would accept, can we merge the deprecation notice?

Thanks,
Gowrishankar

ZjQcmQRYFpfptBannerEnd

Quoted 59 lines
Quoted 14 lines

doc/guides/rel_notes/deprecation.rst Deprecation Notices · line 156

Quoted 11 lines
doc/guides/rel_notes/deprecation.rst +6 -0
+* cryptodev: The struct rte_crypto_rsa_padding will be moved from
 
+  rte_crypto_rsa_op_param struct to rte_crypto_rsa_xform struct,
 
+  breaking ABI. The new location is recommended to comply with
 
+  virtio-crypto specification. Applications and drivers using
 
+  this struct will be updated.
 
+
Quoted 5 lines

The problem here, I see is that there is one private key but multiple combinations of padding.

Therefore, for every padding variation, we need to copy the same private key anew, duplicating it in memory.

The only reason for me to keep a session-like struct in asymmetric crypto was exactly this.

Each padding scheme in RSA has its own pros and cons (in terms of implementations as well).

When we share the same private key for Sign (and its public key in case of Encryption) between

multiple crypto ops (varying by padding schemes among cops), a vulnerable attack against one scheme

could potentially open door to used private key in the session and hence take advantage

on other crypto operations.

I think, this could be one reason for why VirtIO spec mandates padding info as session parameter.

Hence, more than duplicating in memory, private and public keys are secured and in catastrophe,

only that session could be destroyed.

Quoted 11 lines

Review

Quoted 9 lines
(quoted diff) +5 -0
+* cryptodev: The rte_crypto_rsa_xform struct member to hold private key
 
+  in either exponent or quintuple format is changed from union to
 
+struct
 
+  data type. This change is to support ASN.1 syntax (RFC 3447 Appendix A.1.2).
 
+  This change will not break existing applications.

This one I agree. RFC 8017 obsoletes RFC 3447.

Thanks,

Gowrishankar

#6 lore raw

30/07/2024 16:39, Gowrishankar Muthukrishnan:

Quoted 3 lines

Hi,
We need to fix padding info in DPDK as per VirtIO specification in order to support RSA in virtio devices. VirtIO-crypto specification and DPDK specification differs in the way padding is handled.
With current DPDK & virtio specification, it is impossible to support RSA in virtio-crypto. If you think DPDK spec should not be modified, we will try to amend the virtIO spec to match DPDK, but since we do not know if the virtIO community would accept, can we merge the deprecation notice?

There is a long list of Cc but I see no support outside of Marvell.

Quoted 30 lines
Quoted 30 lines
Quoted 11 lines

doc/guides/rel_notes/deprecation.rst Deprecation Notices · line 156

Quoted 6 lines
doc/guides/rel_notes/deprecation.rst +6 -0
+* cryptodev: The struct rte_crypto_rsa_padding will be moved from
+  rte_crypto_rsa_op_param struct to rte_crypto_rsa_xform struct,
+  breaking ABI. The new location is recommended to comply with
+  virtio-crypto specification. Applications and drivers using
+  this struct will be updated.
+

The problem here, I see is that there is one private key but multiple combinations of padding. Therefore, for every padding variation, we need to copy the same private key anew, duplicating it in memory. The only reason for me to keep a session-like struct in asymmetric crypto was exactly this.

Each padding scheme in RSA has its own pros and cons (in terms of implementations as well). When we share the same private key for Sign (and its public key in case of Encryption) between multiple crypto ops (varying by padding schemes among cops), a vulnerable attack against one scheme could potentially open door to used private key in the session and hence take advantage on other crypto operations.

I think, this could be one reason for why VirtIO spec mandates padding info as session parameter. Hence, more than duplicating in memory, private and public keys are secured and in catastrophe, only that session could be destroyed.

Quoted 7 lines

doc/guides/rel_notes/deprecation.rst Deprecation Notices · line 160

Quoted 5 lines
doc/guides/rel_notes/deprecation.rst +5 -0
+* cryptodev: The rte_crypto_rsa_xform struct member to hold private key
+  in either exponent or quintuple format is changed from union to
+struct
+  data type. This change is to support ASN.1 syntax (RFC 3447 Appendix A.1.2).
+  This change will not break existing applications.

This one I agree. RFC 8017 obsoletes RFC 3447.

#7 lore raw

I'm not sure why we don't have a consensus on an idea proposed as RFC in September 2023.

Because there is not enough involvement outside of the Marvell team, I will keep a vague announce for the first item:

cryptodev: Some changes may happen to manage RSA padding for virtio-crypto.

The second item is applied verbatim, thanks.

31/07/2024 14:51, Thomas Monjalon:

Quoted 39 lines

30/07/2024 16:39, Gowrishankar Muthukrishnan:

Quoted 3 lines

Hi,
We need to fix padding info in DPDK as per VirtIO specification in order to support RSA in virtio devices. VirtIO-crypto specification and DPDK specification differs in the way padding is handled.
With current DPDK & virtio specification, it is impossible to support RSA in virtio-crypto. If you think DPDK spec should not be modified, we will try to amend the virtIO spec to match DPDK, but since we do not know if the virtIO community would accept, can we merge the deprecation notice?

There is a long list of Cc but I see no support outside of Marvell.

Quoted 30 lines
Quoted 30 lines
Quoted 11 lines

doc/guides/rel_notes/deprecation.rst Deprecation Notices · line 156

Quoted 6 lines
doc/guides/rel_notes/deprecation.rst +6 -0
+* cryptodev: The struct rte_crypto_rsa_padding will be moved from
+  rte_crypto_rsa_op_param struct to rte_crypto_rsa_xform struct,
+  breaking ABI. The new location is recommended to comply with
+  virtio-crypto specification. Applications and drivers using
+  this struct will be updated.
+

The problem here, I see is that there is one private key but multiple combinations of padding. Therefore, for every padding variation, we need to copy the same private key anew, duplicating it in memory. The only reason for me to keep a session-like struct in asymmetric crypto was exactly this.

Each padding scheme in RSA has its own pros and cons (in terms of implementations as well). When we share the same private key for Sign (and its public key in case of Encryption) between multiple crypto ops (varying by padding schemes among cops), a vulnerable attack against one scheme could potentially open door to used private key in the session and hence take advantage on other crypto operations.

I think, this could be one reason for why VirtIO spec mandates padding info as session parameter. Hence, more than duplicating in memory, private and public keys are secured and in catastrophe, only that session could be destroyed.

Quoted 7 lines

doc/guides/rel_notes/deprecation.rst Deprecation Notices · line 160

Quoted 5 lines
doc/guides/rel_notes/deprecation.rst +5 -0
+* cryptodev: The rte_crypto_rsa_xform struct member to hold private key
+  in either exponent or quintuple format is changed from union to
+struct
+  data type. This change is to support ASN.1 syntax (RFC 3447 Appendix A.1.2).
+  This change will not break existing applications.

This one I agree. RFC 8017 obsoletes RFC 3447.

#8 lore raw
Quoted 68 lines

-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Wednesday, July 31, 2024 4:27 PM
To: Gowrishankar Muthukrishnan <[email protected]>
Cc: [email protected]; Kusztal, ArkadiuszX <[email protected]>; [email protected]; Anoob Joseph <[email protected]>; Richardson, Bruce <[email protected]>; [email protected]; Jerin Jacob <[email protected]>; [email protected]; Ji, Kai <[email protected]>; [email protected]; Marchand, David <[email protected]>; [email protected]; De Lara Guarch, Pablo <[email protected]>; Trahe, Fiona <[email protected]>; Doherty, Declan <[email protected]>; [email protected]; [email protected]; Gujjar, Abhinandan S <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Daly, Lee <[email protected]>
Subject: Re: [PATCH] doc: announce cryptodev changes to offload RSA in VirtIO

I'm not sure why we don't have a consensus on an idea proposed as RFC in September 2023.

Because there is not enough involvement outside of the Marvell team, I will keep a vague announce for the first item:

cryptodev: Some changes may happen to manage RSA padding for virtio-crypto.

The second item is applied verbatim, thanks.

31/07/2024 14:51, Thomas Monjalon:

Quoted 3 lines

30/07/2024 16:39, Gowrishankar Muthukrishnan:

Quoted 2 lines

Hi,
We need to fix padding info in DPDK as per VirtIO specification in order to

support RSA in virtio devices. VirtIO-crypto specification and DPDK specification differs in the way padding is handled.

Quoted 1 line
Quoted 1 line

With current DPDK & virtio specification, it is impossible to support RSA in

virtio-crypto. If you think DPDK spec should not be modified, we will try to amend the virtIO spec to match DPDK, but since we do not know if the virtIO community would accept, can we merge the deprecation notice?

Quoted 16 lines

There is a long list of Cc but I see no support outside of Marvell.

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

doc/guides/rel_notes/deprecation.rst Deprecation Notices · line 156

Quoted 8 lines
doc/guides/rel_notes/deprecation.rst +8 -0
+* cryptodev: The struct rte_crypto_rsa_padding will be moved
+from
+  rte_crypto_rsa_op_param struct to rte_crypto_rsa_xform
+struct,
+  breaking ABI. The new location is recommended to comply with
+  virtio-crypto specification. Applications and drivers using
+  this struct will be updated.
+

The problem here, I see is that there is one private key but multiple

combinations of padding.

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

Therefore, for every padding variation, we need to copy the same private

key anew, duplicating it in memory.

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

The only reason for me to keep a session-like struct in asymmetric crypto

was exactly this.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Each padding scheme in RSA has its own pros and cons (in terms of

implementations as well).

Quoted 10 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

When we share the same private key for Sign (and its public key in case of Encryption) between multiple crypto ops (varying by padding schemes among cops), a vulnerable attack against one scheme could potentially open door to used private key in the session and

hence take advantage on other crypto operations.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

I think, this could be one reason for why VirtIO spec mandates padding info

as session parameter.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Hence, more than duplicating in memory, private and public keys are secured and in catastrophe, only that session could be destroyed.

Hi Gowrishankar,

Sorry for the delayed response.

I do not have any particular security issues in mind here, and if PMD need to copy keys internally, for alignment or padding purposes, redundancy problems can be overcome. My concern was, that it is the more natural way of handling the API; we have one key, multiple padding schemes, so we reflect this logic in the API.

Both options are widely used; libcrypto, for example is setting padding within session, other languages like Go, Rust are setting it as an argument to the method of the key struct.

If this is that problematic with VirtIO compatibility, I say this change is okay.

Quoted 13 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

Review

Quoted 7 lines
(quoted diff) +5 -0
+* cryptodev: The rte_crypto_rsa_xform struct member to hold
+private key
+  in either exponent or quintuple format is changed from union
+to struct
+  data type. This change is to support ASN.1 syntax (RFC 3447 Appendix

A.1.2).

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

+ This change will not break existing applications.

This one I agree. RFC 8017 obsoletes RFC 3447.

#9 lore raw

Hi Arek,

Quoted 6 lines

I do not have any particular security issues in mind here, and if PMD need to copy keys internally, for alignment or padding purposes, redundancy problems can be overcome. My concern was, that it is the more natural way of handling the API; we have one key, multiple padding schemes, so we reflect this logic in the API.

Quoted 6 lines

Both options are widely used; libcrypto, for example is setting padding within session, other languages like Go, Rust are setting it as an argument to the method of the key struct.

If this is that problematic with VirtIO compatibility, I say this change is okay.

Thank you for your input. I understand your concern. We ensure the impact Is nominal and make changes if needed.

Thanks,

#10 lore raw
In reply to Kusztal, ArkadiuszX

Hi ArkadiuszX,

doc/guides/rel_notes/deprecation.rst Deprecation Notices · line 156

Quoted 13 lines
doc/guides/rel_notes/deprecation.rst +7 -0
+
 
+* cryptodev: The struct rte_crypto_rsa_padding will be moved from
 
+  rte_crypto_rsa_op_param struct to rte_crypto_rsa_xform struct,
 
+  breaking ABI. The new location is recommended to comply with
 
+  virtio-crypto specification. Applications and drivers using
 
+  this struct will be updated.
 
+

The problem here, I see is that there is one private key but multiple combinations of padding.

Therefore, for every padding variation, we need to copy the same private key anew, duplicating it in memory.

The only reason for me to keep a session-like struct in asymmetric crypto was exactly this.

Each padding scheme in RSA has its own pros and cons (in terms of implementations as well).

When we share the same private key for Sign (and its public key in case of Encryption) between

multiple crypto ops (varying by padding schemes among cops), a vulnerable attack against one scheme

could potentially open door to used private key in the session and hence take advantage

on other crypto operations.

I think, this could be one reason for why VirtIO spec mandates padding info as session parameter.

Hence, more than duplicating in memory, private and public keys are secured and in catastrophe,

only that session could be destroyed.

Please share your thoughts.

Review

Quoted 9 lines
(quoted diff) +5 -0
+* cryptodev: The rte_crypto_rsa_xform struct member to hold private key
 
+  in either exponent or quintuple format is changed from union to
 
+struct
 
+  data type. This change is to support ASN.1 syntax (RFC 3447 Appendix A.1.2).
 
+  This change will not break existing applications.

This one I agree. RFC 8017 obsoletes RFC 3447.

Thanks,

Gowrishankar

Quoted 3 lines

--

2.21.0