}
};
+static const uint8_t
+cipher_aescbc_offset_16[] = {
+ 0x57, 0x68, 0x61, 0x74, 0x20, 0x61, 0x20, 0x6C,
+ 0x6F, 0x75, 0x73, 0x79, 0x20, 0x65, 0x61, 0x72,
+ 0x68, 0x2A, 0x6A, 0x82, 0xE0, 0x73, 0xC7, 0x51,
+ 0x81, 0xF4, 0x47, 0x27, 0x1A, 0xEF, 0x76, 0x15,
+ 0x1C, 0xE1, 0x38, 0x5F, 0xE1, 0x81, 0x77, 0xC7,
+ 0x8B, 0xF0, 0x69, 0xC3, 0x3C, 0x45, 0x1C, 0x0A,
+ 0xA3, 0x93, 0xBF, 0x60, 0x57, 0x88, 0xD2, 0xFF,
+ 0xE1, 0x8F, 0xC0, 0x64, 0x2C, 0x42, 0xC5, 0x22,
+ 0xE3, 0x5F, 0x71, 0x1F, 0xF7, 0x62, 0xA2, 0x7E,
+ 0x0D, 0x42, 0xD9, 0xE7, 0xF3, 0x10, 0xB0, 0xEE,
+};
+
+/** AES-128-CBC SHA1 OOP test vector for swapping src/dst */
+static const struct blockcipher_test_data aes_test_data_14 = {
+ .crypto_algo = RTE_CRYPTO_CIPHER_AES_CBC,
+ .cipher_key = {
+ .data = {
+ 0xE4, 0x23, 0x33, 0x8A, 0x35, 0x64, 0x61, 0xE2,
+ 0x49, 0x03, 0xDD, 0xC6, 0xB8, 0xCA, 0x55, 0x7A
+ },
+ .len = 16
+ },
+ .iv = {
+ .data = {
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F
+ },
+ .len = 16
+ },
+ .plaintext = {
+ .data = plaintext_aes_common,
+ .len = 80
+ },
+ .cipher_offset = 16,
+ .auth_offset = 0,
+ .ciphertext = {
+ .data = cipher_aescbc_offset_16,
+ .len = 80
+ },
+ .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC,
+ .auth_key = {
+ .data = {
+ 0xF8, 0x2A, 0xC7, 0x54, 0xDB, 0x96, 0x18, 0xAA,
+ 0xC3, 0xA1, 0x53, 0xF6, 0x1F, 0x17, 0x60, 0xBD,
+ 0xDE, 0xF4, 0xDE, 0xAD
+ },
+ .len = 20
+ },
+ .digest = {
+ .data = {
+ 0xCC, 0x15, 0x83, 0xF7, 0x23, 0x87, 0x96, 0xA7,
+ 0x29, 0x34, 0x32, 0xE4, 0x4C, 0x06, 0xE8, 0xEB,
+ 0x70, 0x72, 0x4B, 0xAD
+ },
+ .len = 20,
+ .truncated_len = 12
+ }
+};
+
static const struct blockcipher_test_case aes_chain_test_cases[] = {
{
+ .test_descr = "AES-128-CBC HMAC-SHA1 Decryption Digest "
+ "Verify OOP Offset",
+ .test_data = &aes_test_data_14,
+ .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY_DEC,
+ .feature_mask = BLOCKCIPHER_TEST_FEATURE_OOP,
+ .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB |
+ BLOCKCIPHER_TEST_TARGET_PMD_QAT
+ },
+ {
.test_descr = "AES-128-CTR HMAC-SHA1 Encryption Digest",
.test_data = &aes_test_data_1,
.op_mask = BLOCKCIPHER_TEST_OP_ENC_AUTH_GEN,
BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC |
BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC |
BLOCKCIPHER_TEST_TARGET_PMD_CAAM_JR |
+ BLOCKCIPHER_TEST_TARGET_PMD_MB |
BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
},
+ {
+ .test_descr = "AES-128-CBC HMAC-SHA1 Encryption Digest "
+ "OOP Offset",
+ .test_data = &aes_test_data_14,
+ .op_mask = BLOCKCIPHER_TEST_OP_ENC_AUTH_GEN,
+ .feature_mask = BLOCKCIPHER_TEST_FEATURE_OOP,
+ .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB |
+ BLOCKCIPHER_TEST_TARGET_PMD_QAT
+ },
{
.test_descr = "AES-128-CBC HMAC-SHA1 Decryption Digest "
"Verify OOP",
BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC |
BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC |
BLOCKCIPHER_TEST_TARGET_PMD_CAAM_JR |
- BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX
+ BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX |
+ BLOCKCIPHER_TEST_TARGET_PMD_MB
},
{
.test_descr = "AES-128-CBC HMAC-SHA224 Encryption Digest",
BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC |
BLOCKCIPHER_TEST_TARGET_PMD_CAAM_JR |
BLOCKCIPHER_TEST_TARGET_PMD_CCP |
- BLOCKCIPHER_TEST_TARGET_PMD_VIRTIO
+ BLOCKCIPHER_TEST_TARGET_PMD_VIRTIO |
+ BLOCKCIPHER_TEST_TARGET_PMD_MB
},
{
.test_descr = "AES-256-CBC OOP Decryption",
BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC |
BLOCKCIPHER_TEST_TARGET_PMD_CAAM_JR |
BLOCKCIPHER_TEST_TARGET_PMD_CCP |
- BLOCKCIPHER_TEST_TARGET_PMD_VIRTIO
+ BLOCKCIPHER_TEST_TARGET_PMD_VIRTIO |
+ BLOCKCIPHER_TEST_TARGET_PMD_MB
},
{
.test_descr = "AES-128-CTR Encryption",
.test_data = &aes_test_data_docsis_1,
.op_mask = BLOCKCIPHER_TEST_OP_ENCRYPT,
.feature_mask = BLOCKCIPHER_TEST_FEATURE_OOP,
- .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_QAT
+ .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_QAT |
+ BLOCKCIPHER_TEST_TARGET_PMD_MB
},
{
.test_descr = "AES-DOCSIS-BPI OOP Runt Block Encryption",
.test_data = &aes_test_data_docsis_2,
.op_mask = BLOCKCIPHER_TEST_OP_ENCRYPT,
.feature_mask = BLOCKCIPHER_TEST_FEATURE_OOP,
- .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_QAT
+ .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_QAT |
+ BLOCKCIPHER_TEST_TARGET_PMD_MB
},
+
{
.test_descr = "AES-DOCSIS-BPI OOP Uneven Block Encryption",
.test_data = &aes_test_data_docsis_3,
.op_mask = BLOCKCIPHER_TEST_OP_ENCRYPT,
.feature_mask = BLOCKCIPHER_TEST_FEATURE_OOP,
- .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_QAT
+ .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_QAT |
+ BLOCKCIPHER_TEST_TARGET_PMD_MB
},
{
.test_descr = "AES-DOCSIS-BPI OOP Full Block Decryption",
.test_data = &aes_test_data_docsis_1,
.op_mask = BLOCKCIPHER_TEST_OP_DECRYPT,
.feature_mask = BLOCKCIPHER_TEST_FEATURE_OOP,
- .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_QAT
+ .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_QAT |
+ BLOCKCIPHER_TEST_TARGET_PMD_MB
},
{
.test_descr = "AES-DOCSIS-BPI OOP Runt Block Decryption",
.test_data = &aes_test_data_docsis_2,
.op_mask = BLOCKCIPHER_TEST_OP_DECRYPT,
.feature_mask = BLOCKCIPHER_TEST_FEATURE_OOP,
- .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_QAT
+ .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_QAT |
+ BLOCKCIPHER_TEST_TARGET_PMD_MB
},
{
.test_descr = "AES-DOCSIS-BPI OOP Uneven Block Decryption",
.test_data = &aes_test_data_docsis_3,
.op_mask = BLOCKCIPHER_TEST_OP_DECRYPT,
.feature_mask = BLOCKCIPHER_TEST_FEATURE_OOP,
- .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_QAT
- }
+ .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_QAT |
+ BLOCKCIPHER_TEST_TARGET_PMD_MB
+ },
};
#endif /* TEST_CRYPTODEV_AES_TEST_VECTORS_H_ */
RTE_STR(CRYPTODEV_NAME_OCTEONTX_SYM_PMD));
int nb_segs = 1;
+ uint32_t nb_iterates = 0;
rte_cryptodev_info_get(dev_id, &dev_info);
sym_op = op->sym;
+iterate:
+ if (nb_iterates) {
+ struct rte_mbuf *tmp_buf = ibuf;
+
+ ibuf = obuf;
+ obuf = tmp_buf;
+
+ rte_pktmbuf_reset(ibuf);
+ rte_pktmbuf_reset(obuf);
+
+ rte_pktmbuf_append(ibuf, tdata->ciphertext.len);
+
+ /* only encryption requires plaintext.data input,
+ * decryption/(digest gen)/(digest verify) use ciphertext.data
+ * to be computed
+ */
+ if (t->op_mask & BLOCKCIPHER_TEST_OP_ENCRYPT)
+ pktmbuf_write(ibuf, 0, tdata->plaintext.len,
+ tdata->plaintext.data);
+ else
+ pktmbuf_write(ibuf, 0, tdata->ciphertext.len,
+ tdata->ciphertext.data);
+
+ buf_p = rte_pktmbuf_append(ibuf, digest_len);
+ if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_VERIFY)
+ rte_memcpy(buf_p, tdata->digest.data, digest_len);
+ else
+ memset(buf_p, 0, digest_len);
+
+ memset(obuf->buf_addr, dst_pattern, obuf->buf_len);
+
+ buf_p = rte_pktmbuf_append(obuf, buf_len);
+ if (!buf_p) {
+ snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
+ "FAILED: %s", __LINE__,
+ "No room to append mbuf");
+ status = TEST_FAILED;
+ goto error_exit;
+ }
+ memset(buf_p, 0, buf_len);
+ }
+
sym_op->m_src = ibuf;
if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_OOP) {
cipher_xform->cipher.iv.offset = IV_OFFSET;
cipher_xform->cipher.iv.length = tdata->iv.len;
- sym_op->cipher.data.offset = 0;
- sym_op->cipher.data.length = tdata->ciphertext.len;
+ sym_op->cipher.data.offset = tdata->cipher_offset;
+ sym_op->cipher.data.length = tdata->ciphertext.len -
+ tdata->cipher_offset;
rte_memcpy(rte_crypto_op_ctod_offset(op, uint8_t *, IV_OFFSET),
tdata->iv.data,
tdata->iv.len);
digest_offset);
}
- sym_op->auth.data.offset = 0;
- sym_op->auth.data.length = tdata->ciphertext.len;
+ sym_op->auth.data.offset = tdata->auth_offset;
+ sym_op->auth.data.length = tdata->ciphertext.len -
+ tdata->auth_offset;
}
- /* create session for sessioned op */
- if (!(t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS)) {
+ /**
+ * Create session for sessioned op. For mbuf iteration test,
+ * skip the session creation for the second iteration.
+ */
+ if (!(t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS) &&
+ nb_iterates == 0) {
sess = rte_cryptodev_sym_session_create(sess_mpool);
rte_cryptodev_sym_session_init(dev_id, sess, init_xform,
uint32_t compare_len;
if (t->op_mask & BLOCKCIPHER_TEST_OP_ENCRYPT) {
- compare_ref = tdata->ciphertext.data;
- compare_len = tdata->ciphertext.len;
+ compare_ref = tdata->ciphertext.data +
+ tdata->cipher_offset;
+ compare_len = tdata->ciphertext.len -
+ tdata->cipher_offset;
} else {
- compare_ref = tdata->plaintext.data;
- compare_len = tdata->plaintext.len;
+ compare_ref = tdata->plaintext.data +
+ tdata->cipher_offset;
+ compare_len = tdata->plaintext.len -
+ tdata->cipher_offset;
}
- if (memcmp(rte_pktmbuf_read(iobuf, 0, compare_len,
- buffer), compare_ref, compare_len)) {
+ if (memcmp(rte_pktmbuf_read(iobuf, tdata->cipher_offset,
+ compare_len, buffer), compare_ref,
+ compare_len)) {
snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
"FAILED: %s", __LINE__,
"Crypto data not as expected");
goto error_exit;
}
}
+
+ if (!nb_iterates) {
+ nb_iterates++;
+ goto iterate;
+ }
} else {
/* In-place operation */
struct rte_mbuf *mbuf;
.op_mask = BLOCKCIPHER_TEST_OP_ENCRYPT,
.feature_mask = BLOCKCIPHER_TEST_FEATURE_OOP,
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
- BLOCKCIPHER_TEST_TARGET_PMD_QAT
+ BLOCKCIPHER_TEST_TARGET_PMD_QAT |
+ BLOCKCIPHER_TEST_TARGET_PMD_MB
},
{
.test_descr = "DES-DOCSIS-BPI OOP Runt Block Encryption",
.op_mask = BLOCKCIPHER_TEST_OP_ENCRYPT,
.feature_mask = BLOCKCIPHER_TEST_FEATURE_OOP,
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
- BLOCKCIPHER_TEST_TARGET_PMD_QAT
+ BLOCKCIPHER_TEST_TARGET_PMD_QAT |
+ BLOCKCIPHER_TEST_TARGET_PMD_MB
},
{
.test_descr = "DES-DOCSIS-BPI OOP Uneven Encryption",
.op_mask = BLOCKCIPHER_TEST_OP_ENCRYPT,
.feature_mask = BLOCKCIPHER_TEST_FEATURE_OOP,
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
- BLOCKCIPHER_TEST_TARGET_PMD_QAT
+ BLOCKCIPHER_TEST_TARGET_PMD_QAT |
+ BLOCKCIPHER_TEST_TARGET_PMD_MB
},
{
.test_descr = "DES-DOCSIS-BPI OOP Full Block Decryption",
.op_mask = BLOCKCIPHER_TEST_OP_DECRYPT,
.feature_mask = BLOCKCIPHER_TEST_FEATURE_OOP,
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
- BLOCKCIPHER_TEST_TARGET_PMD_QAT
+ BLOCKCIPHER_TEST_TARGET_PMD_QAT |
+ BLOCKCIPHER_TEST_TARGET_PMD_MB
},
{
.test_descr = "DES-DOCSIS-BPI OOP Runt Block Decryption",
.op_mask = BLOCKCIPHER_TEST_OP_DECRYPT,
.feature_mask = BLOCKCIPHER_TEST_FEATURE_OOP,
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
- BLOCKCIPHER_TEST_TARGET_PMD_QAT
+ BLOCKCIPHER_TEST_TARGET_PMD_QAT |
+ BLOCKCIPHER_TEST_TARGET_PMD_MB
},
{
.test_descr = "DES-DOCSIS-BPI OOP Uneven Decryption",
.op_mask = BLOCKCIPHER_TEST_OP_DECRYPT,
.feature_mask = BLOCKCIPHER_TEST_FEATURE_OOP,
.pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
- BLOCKCIPHER_TEST_TARGET_PMD_QAT
+ BLOCKCIPHER_TEST_TARGET_PMD_QAT |
+ BLOCKCIPHER_TEST_TARGET_PMD_MB
}
};
BLOCKCIPHER_TEST_TARGET_PMD_QAT |
BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC |
BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC |
- BLOCKCIPHER_TEST_TARGET_PMD_CAAM_JR
+ BLOCKCIPHER_TEST_TARGET_PMD_CAAM_JR |
+ BLOCKCIPHER_TEST_TARGET_PMD_MB
},
{
.test_descr = "3DES-128-CBC HMAC-SHA1 Decryption Digest"
BLOCKCIPHER_TEST_TARGET_PMD_QAT |
BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC |
BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC |
- BLOCKCIPHER_TEST_TARGET_PMD_CAAM_JR
+ BLOCKCIPHER_TEST_TARGET_PMD_CAAM_JR |
+ BLOCKCIPHER_TEST_TARGET_PMD_MB
},
{
.test_descr = "3DES-128-CBC HMAC-SHA1 Encryption Digest"