bdev/crypto: Rename AES_CBC_IV_LENGTH to IV_LENGTH

Since IV length is the same for all pmd crypto drivers,
AES_CBC_IV_LENGTH is renamed to IV_LENGTH.

Signed-off-by: Yuriy Umanets <yumanets@nvidia.com>
Change-Id: If8769db119eb599a17c267e8950f18f5a0ea995b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11875
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
This commit is contained in:
Yuriy Umanets 2022-03-10 11:47:14 +02:00 committed by Tomasz Zawadzki
parent 884bcfcf15
commit 15a5bd8264
2 changed files with 6 additions and 6 deletions

View File

@ -136,7 +136,7 @@ uint8_t g_number_of_claimed_volumes = 0;
#define CRYPTO_QP_DESCRIPTORS 2048
/* Specific to AES_CBC. */
#define AES_CBC_IV_LENGTH 16
#define IV_LENGTH 16
#define AES_CBC_KEY_LENGTH 16
#define AES_XTS_KEY_LENGTH 16 /* XTS uses 2 keys, each of this size. */
#define AESNI_MB_NUM_QP 64
@ -144,7 +144,7 @@ uint8_t g_number_of_claimed_volumes = 0;
/* Common for suported devices. */
#define IV_OFFSET (sizeof(struct rte_crypto_op) + \
sizeof(struct rte_crypto_sym_op))
#define QUEUED_OP_OFFSET (IV_OFFSET + AES_CBC_IV_LENGTH)
#define QUEUED_OP_OFFSET (IV_OFFSET + IV_LENGTH)
static void _complete_internal_io(struct spdk_bdev_io *bdev_io, bool success, void *cb_arg);
static void _complete_internal_read(struct spdk_bdev_io *bdev_io, bool success, void *cb_arg);
@ -510,7 +510,7 @@ vbdev_crypto_init_crypto_drivers(void)
RTE_CRYPTO_OP_TYPE_SYMMETRIC,
NUM_MBUFS,
POOL_CACHE_SIZE,
AES_CBC_IV_LENGTH + QUEUED_OP_LENGTH,
IV_LENGTH + QUEUED_OP_LENGTH,
rte_socket_id());
if (g_crypto_op_mp == NULL) {
@ -966,7 +966,7 @@ _crypto_operation(struct spdk_bdev_io *bdev_io, enum rte_crypto_cipher_operation
/* Set the IV - we use the LBA of the crypto_op */
iv_ptr = rte_crypto_op_ctod_offset(crypto_ops[crypto_index], uint8_t *,
IV_OFFSET);
memset(iv_ptr, 0, AES_CBC_IV_LENGTH);
memset(iv_ptr, 0, IV_LENGTH);
op_block_offset = bdev_io->u.bdev.offset_blocks + crypto_index;
rte_memcpy(iv_ptr, &op_block_offset, sizeof(uint64_t));
@ -2023,7 +2023,7 @@ vbdev_crypto_claim(const char *bdev_name)
vbdev->cipher_xform.cipher.algo = RTE_CRYPTO_CIPHER_AES_XTS;
vbdev->cipher_xform.cipher.key.length = AES_XTS_KEY_LENGTH * 2;
}
vbdev->cipher_xform.cipher.iv.length = AES_CBC_IV_LENGTH;
vbdev->cipher_xform.cipher.iv.length = IV_LENGTH;
vbdev->cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
rc = rte_cryptodev_sym_session_init(device->cdev_id, vbdev->session_encrypt,

View File

@ -422,7 +422,7 @@ test_setup(void)
for (i = 0; i < MAX_TEST_BLOCKS; i++) {
rc = posix_memalign((void **)&g_test_crypto_ops[i], 64,
sizeof(struct rte_crypto_op) + sizeof(struct rte_crypto_sym_op) +
AES_CBC_IV_LENGTH + QUEUED_OP_LENGTH);
IV_LENGTH + QUEUED_OP_LENGTH);
if (rc != 0) {
assert(false);
}