Extend the OpenSSL PMD RSA asymmetric capability to use rsa_capa and report supported padding schemes, primary hash algorithms, and MGF1 hash algorithms.
For OpenSSL 3.0 and later, advertise OAEP padding along with SHA-1, SHA-2, and SHA-3 digests for both primary hash and MGF1. For older OpenSSL versions, advertise only NONE and PKCS#1 v1.5 padding modes supported by the PMD. Signed-off-by: Sucharitha Sarananaga <[email protected]> --- drivers/crypto/openssl/rte_openssl_pmd_ops.c | 32 ++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/openssl/rte_openssl_pmd_ops.c b/drivers/crypto/openssl/rte_openssl_pmd_ops.c index d927cc5228..33134573e5 100644 --- a/drivers/crypto/openssl/rte_openssl_pmd_ops.c +++ b/drivers/crypto/openssl/rte_openssl_pmd_ops.c @@ -731,14 +731,42 @@ static const struct rte_cryptodev_capabilities openssl_pmd_capabilities[] = { (1 << RTE_CRYPTO_ASYM_OP_VERIFY) | (1 << RTE_CRYPTO_ASYM_OP_ENCRYPT) | (1 << RTE_CRYPTO_ASYM_OP_DECRYPT)), - { + .rsa_capa = { .modlen = { /* min length is based on openssl rsa keygen */ .min = 30, /* value 0 symbolizes no limit on max length */ .max = 0, .increment = 1 - }, } + }, +#if (OPENSSL_VERSION_NUMBER >= 0x30000000L) + .pad_types = ((1 << RTE_CRYPTO_RSA_PADDING_NONE) | + (1 << RTE_CRYPTO_RSA_PADDING_PKCS1_5) | + (1 << RTE_CRYPTO_RSA_PADDING_OAEP)), + .mgf1_hash_algos = (RTE_BIT64(RTE_CRYPTO_AUTH_SHA1) | + RTE_BIT64(RTE_CRYPTO_AUTH_SHA224) | + RTE_BIT64(RTE_CRYPTO_AUTH_SHA256) | + RTE_BIT64(RTE_CRYPTO_AUTH_SHA384) | + RTE_BIT64(RTE_CRYPTO_AUTH_SHA512) | + RTE_BIT64(RTE_CRYPTO_AUTH_SHA3_224) | + RTE_BIT64(RTE_CRYPTO_AUTH_SHA3_256) | + RTE_BIT64(RTE_CRYPTO_AUTH_SHA3_384) | + RTE_BIT64(RTE_CRYPTO_AUTH_SHA3_512)), + }, + .hash_algos = (RTE_BIT64(RTE_CRYPTO_AUTH_SHA1) | + RTE_BIT64(RTE_CRYPTO_AUTH_SHA224) | + RTE_BIT64(RTE_CRYPTO_AUTH_SHA256) | + RTE_BIT64(RTE_CRYPTO_AUTH_SHA384) | + RTE_BIT64(RTE_CRYPTO_AUTH_SHA512) | + RTE_BIT64(RTE_CRYPTO_AUTH_SHA3_224) | + RTE_BIT64(RTE_CRYPTO_AUTH_SHA3_256) | + RTE_BIT64(RTE_CRYPTO_AUTH_SHA3_384) | + RTE_BIT64(RTE_CRYPTO_AUTH_SHA3_512)), +#else + .pad_types = ((1 << RTE_CRYPTO_RSA_PADDING_NONE) | + (1 << RTE_CRYPTO_RSA_PADDING_PKCS1_5)), + }, +#endif } }, } -- 2.54.0

