[v2] crypto/openssl: support AES-XTS operations
Checks
Commit Message
Extend openssl crypto PMD to support AES XTS operations.
Signed-off-by: Shaokai Zhang <felix.zhang@jaguarmicro.com>
Reviewed-by: Joey Xing <joey.xing@jaguarmicro.com>
---
doc/guides/cryptodevs/features/openssl.ini | 2 ++
doc/guides/cryptodevs/openssl.rst | 1 +
drivers/crypto/openssl/openssl_pmd_private.h | 2 +-
drivers/crypto/openssl/rte_openssl_pmd.c | 13 +++++++++++++
drivers/crypto/openssl/rte_openssl_pmd_ops.c | 20 ++++++++++++++++++++
5 files changed, 37 insertions(+), 1 deletion(-)
@@ -24,6 +24,8 @@ AES CBC (256) = Y
AES CTR (128) = Y
AES CTR (192) = Y
AES CTR (256) = Y
+AES XTS (128) = Y
+AES XTS (256) = Y
3DES CBC = Y
3DES CTR = Y
DES DOCSIS BPI = Y
@@ -22,6 +22,7 @@ Supported cipher algorithms:
* ``RTE_CRYPTO_CIPHER_3DES_CBC``
* ``RTE_CRYPTO_CIPHER_AES_CBC``
* ``RTE_CRYPTO_CIPHER_AES_CTR``
+* ``RTE_CRYPTO_CIPHER_AES_XTS``
* ``RTE_CRYPTO_CIPHER_3DES_CTR``
* ``RTE_CRYPTO_CIPHER_DES_DOCSISBPI``
@@ -118,7 +118,7 @@ struct __rte_cache_aligned openssl_session {
/**< cipher algorithm */
struct {
- uint8_t data[32];
+ uint8_t data[64];
/**< key data */
size_t length;
/**< key length in bytes */
@@ -211,6 +211,18 @@ get_cipher_algo(enum rte_crypto_cipher_algorithm sess_algo, size_t keylen,
res = -EINVAL;
}
break;
+ case RTE_CRYPTO_CIPHER_AES_XTS:
+ switch (keylen) {
+ case 32:
+ *algo = EVP_aes_128_xts();
+ break;
+ case 64:
+ *algo = EVP_aes_256_xts();
+ break;
+ default:
+ res = -EINVAL;
+ }
+ break;
case RTE_CRYPTO_CIPHER_AES_CTR:
switch (keylen) {
case 16:
@@ -493,6 +505,7 @@ openssl_set_session_cipher_parameters(struct openssl_session *sess,
case RTE_CRYPTO_CIPHER_3DES_CBC:
case RTE_CRYPTO_CIPHER_AES_CBC:
case RTE_CRYPTO_CIPHER_AES_CTR:
+ case RTE_CRYPTO_CIPHER_AES_XTS:
sess->cipher.mode = OPENSSL_CIPHER_LIB;
sess->cipher.algo = xform->cipher.algo;
sess->cipher.ctx = EVP_CIPHER_CTX_new();
@@ -269,6 +269,26 @@ static const struct rte_cryptodev_capabilities openssl_pmd_capabilities[] = {
}, }
}, }
},
+ { /* AES XTS */
+ .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+ {.sym = {
+ .xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,
+ {.cipher = {
+ .algo = RTE_CRYPTO_CIPHER_AES_XTS,
+ .block_size = 16,
+ .key_size = {
+ .min = 32,
+ .max = 64,
+ .increment = 32
+ },
+ .iv_size = {
+ .min = 16,
+ .max = 16,
+ .increment = 0
+ }
+ }, }
+ }, }
+ },
{ /* AES CBC */
.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
{.sym = {