Skip to content

Commit 561a5c2

Browse files
ThePassionatexiaoxiang781216
authored andcommitted
drivers/vhost: add asymmetric support to vhost-crypto
Handle the AKCIPHER service on the crypto backend: RSA encrypt/decrypt/sign/verify, ECDSA sign/verify/genkey and ECDH key generation and shared-secret derivation, replayed as crypto_kinvoke() calls against the locally registered key backends. RSA keys arrive DER-encoded and are parsed once per session into the cryptodev parameter slots; ECDSA and ECDH keys and signatures are raw field elements sized by the curve table. Sessions now carry either the symmetric descriptor chain or the asymmetric key material, decided once at CREATE_SESSION, and the RSA DER scratch buffer is sized by the new CONFIG_DRIVERS_VHOST_CRYPTO_RSA_KEYBUF_SIZE. Signed-off-by: makejian <makejian@xiaomi.com>
1 parent c1842f2 commit 561a5c2

2 files changed

Lines changed: 747 additions & 31 deletions

File tree

‎drivers/vhost/Kconfig‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,19 @@ config DRIVERS_VHOST_CRYPTO
115115
each data-queue request into a crypto_invoke()/crypto_kinvoke()
116116
call against the locally registered backends.
117117

118+
if DRIVERS_VHOST_CRYPTO
119+
120+
config DRIVERS_VHOST_CRYPTO_RSA_KEYBUF_SIZE
121+
int "RSA key buffer size for vhost crypto"
122+
default 1536
123+
---help---
124+
Size of the RSA key DER buffer used for ASN1 key encoding.
125+
This buffer holds DER-encoded key parameters. Recommended values:
126+
80 - KeyID mode (4B per parameter + ASN1 overhead, 16-byte aligned)
127+
1536 - Raw RSA-2048 CRT key (n+e+d+p+q+dp+dq+qp in plaintext)
128+
129+
endif # DRIVERS_VHOST_CRYPTO
130+
118131
config DRIVERS_VHOST_NET
119132
bool "Virtual Host Network Device Support"
120133
default n

0 commit comments

Comments
 (0)