Skip to contentSkip to conversation

virtio-crypto: add RSA private key types

PATCH Michael S. Tsirkin 2 participants 2 messages May 25, 2023 – Nov 23, 2023 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 20 lines · Gowrishankar Muthukrishnan

With reference to RFC 3447 Section 3.2, private key exists in any of the two forms, namely:
- exponent
- quintuple

Following this, Appendix A.1.2 recommends private key represented including both of the above representations. Hence, for a RSA op, it is required to choose one of these types, hence proposing two private key types.

---
 device-types/crypto/description.tex | 12 ++++++++++++
 1 file changed, 12 insertions(+)
device-types/crypto/description.tex +0 -0
index 5705e26..02dcdd0 100644

device-types/crypto/description.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Crypto Device / Devic · line 756

Quoted 8 lines
device-types/crypto/description.tex +5 -0
@@ -749,6 +749,11 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Crypto Device / Devic
 #define VIRTIO_CRYPTO_RSA_SHA512    8
 #define VIRTIO_CRYPTO_RSA_SHA224    9
     le32 hash_algo;
+
+#define VIRTIO_CRYPTO_RSA_PRIVATE_KEY_UNKNOWN 0
+#define VIRTIO_CRYPTO_RSA_PRIVATE_KEY_EXP     1
+#define VIRTIO_CRYPTO_RSA_PRIVATE_KEY_QT      2
+    le8 private_key_type;

add padding to keep things aligned, or just use 32 bit

Quoted 7 lines
device-types/crypto/description.tex +0 -0
 };
 \end{lstlisting}
 
@@ -764,6 +769,13 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Crypto Device / Devic
 It only affects the padding algorithm and is ignored during encryption and decryption.
 \end{itemize*}
 

device-types/crypto/description.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Crypto Device / Devic · line 781

Quoted 10 lines
device-types/crypto/description.tex +7 -0
+\field{private_key_type} specifies the type of private key used by RSA sessions.
+\begin{itemize*}
+\item If VIRTIO_CRYPTO_RSA_PRIVATE_KEY_EXP is specified, privateExponent is used.
+\item If VIRTIO_CRYPTO_RSA_PRIVATE_KEY_QT is specified, prime1, prime2,
+exponent1, exponent2 and coefficient values are used (see \hyperref[intro:rfc3447]{PKCS\#1}).
+\end{itemize*}
+
 The ECC algorithms such as the ECDSA algorithm, cannot use custom curves, only the
 following known curves can be used (see \hyperref[intro:NIST]{NIST-recommended curves}).
 

I think we will need a feature bit to negotiate the change in virtio_crypto_rsa_session_para format.

Signature · 18 lines
MST


This publicly archived list offers a means to provide input to the
OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and
to minimize spam in the list archive, subscription is required
before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/
#2 lore raw
Quoted 10 lines · Michael S. Tsirkin
Quoted 9 lines · Gowrishankar Muthukrishnan

With reference to RFC 3447 Section 3.2, private key exists in any of the two forms, namely:
- exponent
- quintuple

Following this, Appendix A.1.2 recommends private key represented including both of the above representations. Hence, for a RSA op, it is required to choose one of these types, hence proposing two private key types.

Do we really need to differentiate between these two formats?
- RSA Private keys in these two formats can be stored in the same
RSAPrivateKey structure recommends at Appendix A.1.2 at the same time (exponet using n and d, and quintuple using p q...).
- There is no requirement in the RFC document to distinguish whether
the private key stored in RSAPrivateKey is in a certain format or both.
- AFAIK, the implementation interfaces of nettle, gnutls, and openssl
will not distinguish between these two formats, and will write the keys in both formats into rsaprivatekey when exporting the key.

Quoted 7 lines
Quoted 7 lines
---
  device-types/crypto/description.tex | 12 ++++++++++++
  1 file changed, 12 insertions(+)
device-types/crypto/description.tex +0 -0
Signature · 20 lines
Best regards,
he lei
[email protected]


This publicly archived list offers a means to provide input to the
OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and
to minimize spam in the list archive, subscription is required
before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/