-/*-
- * BSD LICENSE
- *
- * Copyright(c) 2015-2017 Intel Corporation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Intel Corporation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2015-2017 Intel Corporation
*/
+#include <time.h>
+
#include <rte_common.h>
#include <rte_hexdump.h>
#include <rte_mbuf.h>
#include <rte_malloc.h>
#include <rte_memcpy.h>
#include <rte_pause.h>
+#include <rte_bus_vdev.h>
#include <rte_crypto.h>
#include <rte_cryptodev.h>
/* Set crypto operation authentication parameters */
sym_op->auth.digest.data = ut_params->digest;
- sym_op->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset(
+ sym_op->auth.digest.phys_addr = rte_pktmbuf_iova_offset(
ut_params->ibuf, QUOTE_512_BYTES);
sym_op->auth.data.offset = 0;
sym_op->m_src = ut_params->ibuf;
sym_op->auth.digest.data = ut_params->digest;
- sym_op->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset(
+ sym_op->auth.digest.phys_addr = rte_pktmbuf_iova_offset(
ut_params->ibuf, QUOTE_512_BYTES);
sym_op->auth.data.offset = 0;
memcpy(hash_key, key, key_len);
- TEST_HEXDUMP(stdout, "key:", key, key_len);
+ debug_hexdump(stdout, "key:", key, key_len);
/* Setup Authentication Parameters */
ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
ut_params->cipher_xform.cipher.iv.offset = IV_OFFSET;
ut_params->cipher_xform.cipher.iv.length = iv_len;
- TEST_HEXDUMP(stdout, "key:", key, key_len);
+ debug_hexdump(stdout, "key:", key, key_len);
/* Create Crypto session */
ut_params->sess = rte_cryptodev_sym_session_create(
ut_params->cipher_xform.cipher.iv.offset = IV_OFFSET;
ut_params->cipher_xform.cipher.iv.length = cipher_iv_len;
- TEST_HEXDUMP(stdout, "key:", key, key_len);
+ debug_hexdump(stdout, "key:", key, key_len);
/* Create Crypto session*/
ut_params->sess = rte_cryptodev_sym_session_create(
ut_params->cipher_xform.cipher.iv.length = cipher_iv_len;
- TEST_HEXDUMP(stdout, "key:", key, key_len);
+ debug_hexdump(stdout, "key:", key, key_len);
/* Create Crypto session*/
ut_params->sess = rte_cryptodev_sym_session_create(
ut_params->cipher_xform.cipher.iv.offset = IV_OFFSET;
ut_params->cipher_xform.cipher.iv.length = cipher_iv_len;
- TEST_HEXDUMP(stdout, "key:", key, key_len);
+ debug_hexdump(stdout, "key:", key, key_len);
/* Create Crypto session*/
ut_params->sess = rte_cryptodev_sym_session_create(
TEST_ASSERT_NOT_NULL(sym_op->auth.digest.data,
"no room to append auth tag");
ut_params->digest = sym_op->auth.digest.data;
- sym_op->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset(
+ sym_op->auth.digest.phys_addr = rte_pktmbuf_iova_offset(
ut_params->ibuf, data_pad_len);
if (op == RTE_CRYPTO_AUTH_OP_GENERATE)
memset(sym_op->auth.digest.data, 0, auth_tag_len);
else
rte_memcpy(sym_op->auth.digest.data, auth_tag, auth_tag_len);
- TEST_HEXDUMP(stdout, "digest:",
+ debug_hexdump(stdout, "digest:",
sym_op->auth.digest.data,
auth_tag_len);
TEST_ASSERT_NOT_NULL(sym_op->auth.digest.data,
"no room to append auth tag");
ut_params->digest = sym_op->auth.digest.data;
- sym_op->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset(
+ sym_op->auth.digest.phys_addr = rte_pktmbuf_iova_offset(
ut_params->ibuf, data_pad_len);
if (op == RTE_CRYPTO_AUTH_OP_GENERATE)
memset(sym_op->auth.digest.data, 0, auth_tag_len);
else
rte_memcpy(sym_op->auth.digest.data, auth_tag, auth_tag_len);
- TEST_HEXDUMP(stdout, "digest:",
+ debug_hexdump(stdout, "digest:",
sym_op->auth.digest.data,
auth_tag_len);
TEST_ASSERT_NOT_NULL(sym_op->auth.digest.data,
"no room to append auth tag");
ut_params->digest = sym_op->auth.digest.data;
- sym_op->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset(
+ sym_op->auth.digest.phys_addr = rte_pktmbuf_iova_offset(
ut_params->ibuf, data_pad_len);
if (op == RTE_CRYPTO_AUTH_OP_GENERATE)
memset(sym_op->auth.digest.data, 0, auth_tag_len);
else
rte_memcpy(sym_op->auth.digest.data, auth_tag, auth_tag_len);
- TEST_HEXDUMP(stdout, "digest:",
+ debug_hexdump(stdout, "digest:",
sym_op->auth.digest.data,
auth_tag_len);
TEST_ASSERT_NOT_NULL(sym_op->auth.digest.data,
"no room to append auth tag");
- sym_op->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset(
+ sym_op->auth.digest.phys_addr = rte_pktmbuf_iova_offset(
ut_params->ibuf, data_pad_len);
memset(sym_op->auth.digest.data, 0, auth_tag_len);
- TEST_HEXDUMP(stdout, "digest:",
+ debug_hexdump(stdout, "digest:",
sym_op->auth.digest.data,
auth_tag_len);
plaintext_pad_len);
memcpy(plaintext, tdata->plaintext.data, plaintext_len);
- TEST_HEXDUMP(stdout, "plaintext:", plaintext, plaintext_len);
+ debug_hexdump(stdout, "plaintext:", plaintext, plaintext_len);
/* Create KASUMI operation */
retval = create_wireless_algo_cipher_operation(tdata->cipher_iv.data,
else
ciphertext = plaintext + (tdata->validCipherOffsetInBits.len >> 3);
- TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, plaintext_len);
+ debug_hexdump(stdout, "ciphertext:", ciphertext, plaintext_len);
const uint8_t *reference_ciphertext = tdata->ciphertext.data +
(tdata->validCipherOffsetInBits.len >> 3);
plaintext_len, buffer);
/* Validate obuf */
- TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, plaintext_len);
+ debug_hexdump(stdout, "ciphertext:", ciphertext, plaintext_len);
const uint8_t *reference_ciphertext = tdata->ciphertext.data +
(tdata->validCipherOffsetInBits.len >> 3);
rte_pktmbuf_append(ut_params->obuf, plaintext_pad_len);
memcpy(plaintext, tdata->plaintext.data, plaintext_len);
- TEST_HEXDUMP(stdout, "plaintext:", plaintext, plaintext_len);
+ debug_hexdump(stdout, "plaintext:", plaintext, plaintext_len);
/* Create KASUMI operation */
retval = create_wireless_algo_cipher_operation_oop(tdata->cipher_iv.data,
else
ciphertext = plaintext + (tdata->validCipherOffsetInBits.len >> 3);
- TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, plaintext_len);
+ debug_hexdump(stdout, "ciphertext:", ciphertext, plaintext_len);
const uint8_t *reference_ciphertext = tdata->ciphertext.data +
(tdata->validCipherOffsetInBits.len >> 3);
rte_pktmbuf_append(ut_params->obuf, ciphertext_pad_len);
memcpy(ciphertext, tdata->ciphertext.data, ciphertext_len);
- TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, ciphertext_len);
+ debug_hexdump(stdout, "ciphertext:", ciphertext, ciphertext_len);
/* Create KASUMI operation */
retval = create_wireless_algo_cipher_operation_oop(tdata->cipher_iv.data,
else
plaintext = ciphertext + (tdata->validCipherOffsetInBits.len >> 3);
- TEST_HEXDUMP(stdout, "plaintext:", plaintext, ciphertext_len);
+ debug_hexdump(stdout, "plaintext:", plaintext, ciphertext_len);
const uint8_t *reference_plaintext = tdata->plaintext.data +
(tdata->validCipherOffsetInBits.len >> 3);
ciphertext_pad_len);
memcpy(ciphertext, tdata->ciphertext.data, ciphertext_len);
- TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, ciphertext_len);
+ debug_hexdump(stdout, "ciphertext:", ciphertext, ciphertext_len);
/* Create KASUMI operation */
retval = create_wireless_algo_cipher_operation(tdata->cipher_iv.data,
else
plaintext = ciphertext + (tdata->validCipherOffsetInBits.len >> 3);
- TEST_HEXDUMP(stdout, "plaintext:", plaintext, ciphertext_len);
+ debug_hexdump(stdout, "plaintext:", plaintext, ciphertext_len);
const uint8_t *reference_plaintext = tdata->plaintext.data +
(tdata->validCipherOffsetInBits.len >> 3);
plaintext_pad_len);
memcpy(plaintext, tdata->plaintext.data, plaintext_len);
- TEST_HEXDUMP(stdout, "plaintext:", plaintext, plaintext_len);
+ debug_hexdump(stdout, "plaintext:", plaintext, plaintext_len);
/* Create SNOW 3G operation */
retval = create_wireless_algo_cipher_operation(tdata->cipher_iv.data,
else
ciphertext = plaintext;
- TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, plaintext_len);
+ debug_hexdump(stdout, "ciphertext:", ciphertext, plaintext_len);
/* Validate obuf */
TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT(
rte_pktmbuf_append(ut_params->obuf, plaintext_pad_len);
memcpy(plaintext, tdata->plaintext.data, plaintext_len);
- TEST_HEXDUMP(stdout, "plaintext:", plaintext, plaintext_len);
+ debug_hexdump(stdout, "plaintext:", plaintext, plaintext_len);
/* Create SNOW 3G operation */
retval = create_wireless_algo_cipher_operation_oop(tdata->cipher_iv.data,
else
ciphertext = plaintext;
- TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, plaintext_len);
+ debug_hexdump(stdout, "ciphertext:", ciphertext, plaintext_len);
/* Validate obuf */
TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT(
ciphertext = rte_pktmbuf_read(ut_params->ibuf, 0,
plaintext_len, buffer);
- TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, plaintext_len);
+ debug_hexdump(stdout, "ciphertext:", ciphertext, plaintext_len);
/* Validate obuf */
TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT(
ciphertext_pad_len);
memcpy(ciphertext, tdata->ciphertext.data, ciphertext_len);
- TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, ciphertext_len);
+ debug_hexdump(stdout, "ciphertext:", ciphertext, ciphertext_len);
/* Create SNOW 3G operation */
retval = create_wireless_algo_cipher_operation(tdata->cipher_iv.data,
else
plaintext = ciphertext;
- TEST_HEXDUMP(stdout, "plaintext:", plaintext, ciphertext_len);
+ debug_hexdump(stdout, "plaintext:", plaintext, ciphertext_len);
/* Validate obuf */
TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT(plaintext,
rte_pktmbuf_append(ut_params->obuf, ciphertext_pad_len);
memcpy(ciphertext, tdata->ciphertext.data, ciphertext_len);
- TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, ciphertext_len);
+ debug_hexdump(stdout, "ciphertext:", ciphertext, ciphertext_len);
/* Create SNOW 3G operation */
retval = create_wireless_algo_cipher_operation_oop(tdata->cipher_iv.data,
else
plaintext = ciphertext;
- TEST_HEXDUMP(stdout, "plaintext:", plaintext, ciphertext_len);
+ debug_hexdump(stdout, "plaintext:", plaintext, ciphertext_len);
/* Validate obuf */
TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT(plaintext,
plaintext_pad_len);
memcpy(plaintext, tdata->plaintext.data, plaintext_len);
- TEST_HEXDUMP(stdout, "plaintext:", plaintext, plaintext_len);
+ debug_hexdump(stdout, "plaintext:", plaintext, plaintext_len);
/* Create ZUC operation */
retval = create_zuc_cipher_hash_generate_operation(tdata);
else
ciphertext = plaintext;
- TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, plaintext_len);
+ debug_hexdump(stdout, "ciphertext:", ciphertext, plaintext_len);
/* Validate obuf */
TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT(
ciphertext,
plaintext_pad_len);
memcpy(plaintext, tdata->plaintext.data, plaintext_len);
- TEST_HEXDUMP(stdout, "plaintext:", plaintext, plaintext_len);
+ debug_hexdump(stdout, "plaintext:", plaintext, plaintext_len);
/* Create SNOW 3G operation */
retval = create_wireless_algo_cipher_hash_operation(tdata->digest.data,
else
ciphertext = plaintext;
- TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, plaintext_len);
+ debug_hexdump(stdout, "ciphertext:", ciphertext, plaintext_len);
/* Validate obuf */
TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT(
ciphertext,
plaintext_pad_len);
memcpy(plaintext, tdata->plaintext.data, plaintext_len);
- TEST_HEXDUMP(stdout, "plaintext:", plaintext, plaintext_len);
+ debug_hexdump(stdout, "plaintext:", plaintext, plaintext_len);
/* Create SNOW 3G operation */
retval = create_wireless_algo_auth_cipher_operation(
ut_params->digest = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *)
+ plaintext_pad_len;
- TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, plaintext_len);
+ debug_hexdump(stdout, "ciphertext:", ciphertext, plaintext_len);
/* Validate obuf */
TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT(
plaintext_pad_len);
memcpy(plaintext, tdata->plaintext.data, plaintext_len);
- TEST_HEXDUMP(stdout, "plaintext:", plaintext, plaintext_len);
+ debug_hexdump(stdout, "plaintext:", plaintext, plaintext_len);
/* Create KASUMI operation */
retval = create_wireless_algo_auth_cipher_operation(tdata->digest.len,
plaintext_pad_len);
memcpy(plaintext, tdata->plaintext.data, plaintext_len);
- TEST_HEXDUMP(stdout, "plaintext:", plaintext, plaintext_len);
+ debug_hexdump(stdout, "plaintext:", plaintext, plaintext_len);
/* Create KASUMI operation */
retval = create_wireless_algo_cipher_hash_operation(tdata->digest.data,
plaintext_pad_len);
memcpy(plaintext, tdata->plaintext.data, plaintext_len);
- TEST_HEXDUMP(stdout, "plaintext:", plaintext, plaintext_len);
+ debug_hexdump(stdout, "plaintext:", plaintext, plaintext_len);
/* Create ZUC operation */
retval = create_wireless_algo_cipher_operation(tdata->cipher_iv.data,
else
ciphertext = plaintext;
- TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, plaintext_len);
+ debug_hexdump(stdout, "ciphertext:", ciphertext, plaintext_len);
/* Validate obuf */
TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT(
0, plaintext_len, ciphertext_buffer);
/* Validate obuf */
- TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, plaintext_len);
+ debug_hexdump(stdout, "ciphertext:", ciphertext, plaintext_len);
/* Validate obuf */
TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT(
ut_params->aead_xform.aead.digest_length = auth_len;
ut_params->aead_xform.aead.aad_length = aad_len;
- TEST_HEXDUMP(stdout, "key:", key, key_len);
+ debug_hexdump(stdout, "key:", key, key_len);
/* Create Crypto session*/
ut_params->sess = rte_cryptodev_sym_session_create(
sym_op->xform->aead.digest_length = auth_len;
sym_op->xform->aead.aad_length = aad_len;
- TEST_HEXDUMP(stdout, "key:", key, key_len);
+ debug_hexdump(stdout, "key:", key, key_len);
return 0;
}
"no room to append aad");
sym_op->aead.aad.phys_addr =
- rte_pktmbuf_mtophys(ut_params->ibuf);
+ rte_pktmbuf_iova(ut_params->ibuf);
/* Copy AAD 18 bytes after the AAD pointer, according to the API */
memcpy(sym_op->aead.aad.data + 18, tdata->aad.data, tdata->aad.len);
- TEST_HEXDUMP(stdout, "aad:", sym_op->aead.aad.data,
+ debug_hexdump(stdout, "aad:", sym_op->aead.aad.data,
tdata->aad.len);
/* Append IV at the end of the crypto operation*/
/* Copy IV 1 byte after the IV pointer, according to the API */
rte_memcpy(iv_ptr + 1, tdata->iv.data, tdata->iv.len);
- TEST_HEXDUMP(stdout, "iv:", iv_ptr,
+ debug_hexdump(stdout, "iv:", iv_ptr,
tdata->iv.len);
} else {
aad_pad_len = RTE_ALIGN_CEIL(tdata->aad.len, 16);
"no room to append aad");
sym_op->aead.aad.phys_addr =
- rte_pktmbuf_mtophys(ut_params->ibuf);
+ rte_pktmbuf_iova(ut_params->ibuf);
memcpy(sym_op->aead.aad.data, tdata->aad.data, tdata->aad.len);
- TEST_HEXDUMP(stdout, "aad:", sym_op->aead.aad.data,
+ debug_hexdump(stdout, "aad:", sym_op->aead.aad.data,
tdata->aad.len);
/* Append IV at the end of the crypto operation*/
uint8_t *, IV_OFFSET);
rte_memcpy(iv_ptr, tdata->iv.data, tdata->iv.len);
- TEST_HEXDUMP(stdout, "iv:", iv_ptr,
+ debug_hexdump(stdout, "iv:", iv_ptr,
tdata->iv.len);
}
TEST_ASSERT_NOT_NULL(plaintext, "no room to append plaintext");
memcpy(plaintext, tdata->plaintext.data, tdata->plaintext.len);
- TEST_HEXDUMP(stdout, "plaintext:", plaintext,
+ debug_hexdump(stdout, "plaintext:", plaintext,
tdata->plaintext.len);
if (ut_params->obuf) {
memcpy(ciphertext, tdata->ciphertext.data,
tdata->ciphertext.len);
- TEST_HEXDUMP(stdout, "ciphertext:", ciphertext,
+ debug_hexdump(stdout, "ciphertext:", ciphertext,
tdata->ciphertext.len);
if (ut_params->obuf) {
TEST_ASSERT_NOT_NULL(sym_op->aead.digest.data,
"no room to append digest");
memset(sym_op->aead.digest.data, 0, tdata->auth_tag.len);
- sym_op->aead.digest.phys_addr = rte_pktmbuf_mtophys_offset(
+ sym_op->aead.digest.phys_addr = rte_pktmbuf_iova_offset(
ut_params->obuf ? ut_params->obuf :
ut_params->ibuf,
plaintext_pad_len +
ut_params->ibuf, tdata->auth_tag.len);
TEST_ASSERT_NOT_NULL(sym_op->aead.digest.data,
"no room to append digest");
- sym_op->aead.digest.phys_addr = rte_pktmbuf_mtophys_offset(
+ sym_op->aead.digest.phys_addr = rte_pktmbuf_iova_offset(
ut_params->ibuf,
plaintext_pad_len + aad_pad_len);
rte_memcpy(sym_op->aead.digest.data, tdata->auth_tag.data,
tdata->auth_tag.len);
- TEST_HEXDUMP(stdout, "digest:",
+ debug_hexdump(stdout, "digest:",
sym_op->aead.digest.data,
tdata->auth_tag.len);
}
auth_tag = ciphertext + plaintext_pad_len;
}
- TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len);
- TEST_HEXDUMP(stdout, "auth tag:", auth_tag, tdata->auth_tag.len);
+ debug_hexdump(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len);
+ debug_hexdump(stdout, "auth tag:", auth_tag, tdata->auth_tag.len);
/* Validate obuf */
TEST_ASSERT_BUFFERS_ARE_EQUAL(
uint8_t *,
ut_params->op->sym->cipher.data.offset);
- TEST_HEXDUMP(stdout, "plaintext:", plaintext, tdata->ciphertext.len);
+ debug_hexdump(stdout, "plaintext:", plaintext, tdata->ciphertext.len);
/* Validate obuf */
TEST_ASSERT_BUFFERS_ARE_EQUAL(
ut_params->op->sym->cipher.data.offset);
auth_tag = ciphertext + plaintext_pad_len;
- TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len);
- TEST_HEXDUMP(stdout, "auth tag:", auth_tag, tdata->auth_tag.len);
+ debug_hexdump(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len);
+ debug_hexdump(stdout, "auth tag:", auth_tag, tdata->auth_tag.len);
/* Validate obuf */
TEST_ASSERT_BUFFERS_ARE_EQUAL(
plaintext = rte_pktmbuf_mtod_offset(ut_params->obuf, uint8_t *,
ut_params->op->sym->cipher.data.offset);
- TEST_HEXDUMP(stdout, "plaintext:", plaintext, tdata->ciphertext.len);
+ debug_hexdump(stdout, "plaintext:", plaintext, tdata->ciphertext.len);
/* Validate obuf */
TEST_ASSERT_BUFFERS_ARE_EQUAL(
ut_params->op->sym->cipher.data.offset);
auth_tag = ciphertext + plaintext_pad_len;
- TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len);
- TEST_HEXDUMP(stdout, "auth tag:", auth_tag, tdata->auth_tag.len);
+ debug_hexdump(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len);
+ debug_hexdump(stdout, "auth tag:", auth_tag, tdata->auth_tag.len);
/* Validate obuf */
TEST_ASSERT_BUFFERS_ARE_EQUAL(
plaintext = rte_pktmbuf_mtod_offset(ut_params->ibuf, uint8_t *,
ut_params->op->sym->cipher.data.offset);
- TEST_HEXDUMP(stdout, "plaintext:", plaintext, tdata->ciphertext.len);
+ debug_hexdump(stdout, "plaintext:", plaintext, tdata->ciphertext.len);
/* Validate obuf */
TEST_ASSERT_BUFFERS_ARE_EQUAL(
ut_params->ibuf, MD5_DIGEST_LEN);
TEST_ASSERT_NOT_NULL(sym_op->auth.digest.data,
"no room to append digest");
- sym_op->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset(
+ sym_op->auth.digest.phys_addr = rte_pktmbuf_iova_offset(
ut_params->ibuf, plaintext_pad_len);
if (ut_params->auth_xform.auth.op == RTE_CRYPTO_AUTH_OP_VERIFY) {
return TEST_SUCCESS;
}
-
+uint8_t orig_data[] = {0xab, 0xab, 0xab, 0xab,
+ 0xab, 0xab, 0xab, 0xab,
+ 0xab, 0xab, 0xab, 0xab,
+ 0xab, 0xab, 0xab, 0xab};
static int
test_null_auth_only_operation(void)
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
+ uint8_t *digest;
/* Generate test mbuf data and space for digest */
ut_params->ibuf = setup_test_string(ts_params->mbuf_pool,
catch_22_quote, QUOTE_512_BYTES, 0);
+ /* create a pointer for digest, but don't expect anything to be written
+ * here in a NULL auth algo so no mbuf append done.
+ */
+ digest = rte_pktmbuf_mtod_offset(ut_params->ibuf, uint8_t *,
+ QUOTE_512_BYTES);
+ /* prefill the memory pointed to by digest */
+ memcpy(digest, orig_data, sizeof(orig_data));
+
/* Setup HMAC Parameters */
ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
ut_params->auth_xform.next = NULL;
sym_op->auth.data.offset = 0;
sym_op->auth.data.length = QUOTE_512_BYTES;
+ sym_op->auth.digest.data = digest;
+ sym_op->auth.digest.phys_addr = rte_pktmbuf_iova_offset(ut_params->ibuf,
+ QUOTE_512_BYTES);
/* Process crypto operation */
ut_params->op = process_crypto_request(ts_params->valid_devs[0],
TEST_ASSERT_EQUAL(ut_params->op->status, RTE_CRYPTO_OP_STATUS_SUCCESS,
"crypto operation processing failed");
+ /* Make sure memory pointed to by digest hasn't been overwritten */
+ TEST_ASSERT_BUFFERS_ARE_EQUAL(
+ orig_data,
+ digest,
+ sizeof(orig_data),
+ "Memory at digest ptr overwritten unexpectedly");
return TEST_SUCCESS;
}
+
static int
test_null_cipher_auth_operation(void)
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
+ uint8_t *digest;
/* Generate test mbuf data and space for digest */
ut_params->ibuf = setup_test_string(ts_params->mbuf_pool,
catch_22_quote, QUOTE_512_BYTES, 0);
+ /* create a pointer for digest, but don't expect anything to be written
+ * here in a NULL auth algo so no mbuf append done.
+ */
+ digest = rte_pktmbuf_mtod_offset(ut_params->ibuf, uint8_t *,
+ QUOTE_512_BYTES);
+ /* prefill the memory pointed to by digest */
+ memcpy(digest, orig_data, sizeof(orig_data));
+
/* Setup Cipher Parameters */
ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
ut_params->cipher_xform.next = &ut_params->auth_xform;
sym_op->auth.data.offset = 0;
sym_op->auth.data.length = QUOTE_512_BYTES;
+ sym_op->auth.digest.data = digest;
+ sym_op->auth.digest.phys_addr = rte_pktmbuf_iova_offset(ut_params->ibuf,
+ QUOTE_512_BYTES);
/* Process crypto operation */
ut_params->op = process_crypto_request(ts_params->valid_devs[0],
catch_22_quote,
QUOTE_512_BYTES,
"Ciphertext data not as expected");
+ /* Make sure memory pointed to by digest hasn't been overwritten */
+ TEST_ASSERT_BUFFERS_ARE_EQUAL(
+ orig_data,
+ digest,
+ sizeof(orig_data),
+ "Memory at digest ptr overwritten unexpectedly");
return TEST_SUCCESS;
}
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
+ uint8_t *digest;
- /* Generate test mbuf data and space for digest */
+ /* Generate test mbuf data */
ut_params->ibuf = setup_test_string(ts_params->mbuf_pool,
catch_22_quote, QUOTE_512_BYTES, 0);
+ /* create a pointer for digest, but don't expect anything to be written
+ * here in a NULL auth algo so no mbuf append done.
+ */
+ digest = rte_pktmbuf_mtod_offset(ut_params->ibuf, uint8_t *,
+ QUOTE_512_BYTES);
+ /* prefill the memory pointed to by digest */
+ memcpy(digest, orig_data, sizeof(orig_data));
+
/* Setup Cipher Parameters */
ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
ut_params->cipher_xform.next = NULL;
sym_op->auth.data.offset = 0;
sym_op->auth.data.length = QUOTE_512_BYTES;
+ sym_op->auth.digest.data = digest;
+ sym_op->auth.digest.phys_addr = rte_pktmbuf_iova_offset(ut_params->ibuf,
+ QUOTE_512_BYTES);
/* Process crypto operation */
ut_params->op = process_crypto_request(ts_params->valid_devs[0],
catch_22_quote,
QUOTE_512_BYTES,
"Ciphertext data not as expected");
+ /* Make sure memory pointed to by digest hasn't been overwritten */
+ TEST_ASSERT_BUFFERS_ARE_EQUAL(
+ orig_data,
+ digest,
+ sizeof(orig_data),
+ "Memory at digest ptr overwritten unexpectedly");
return TEST_SUCCESS;
}
TEST_ASSERT_NOT_NULL(sym_op->auth.digest.data,
"no room to append digest");
- sym_op->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset(
+ sym_op->auth.digest.phys_addr = rte_pktmbuf_iova_offset(
ut_params->ibuf, plaintext_pad_len);
if (op == RTE_CRYPTO_AUTH_OP_VERIFY) {
rte_memcpy(sym_op->auth.digest.data, tdata->gmac_tag.data,
tdata->gmac_tag.len);
- TEST_HEXDUMP(stdout, "digest:",
+ debug_hexdump(stdout, "digest:",
sym_op->auth.digest.data,
tdata->gmac_tag.len);
}
rte_memcpy(iv_ptr, tdata->iv.data, tdata->iv.len);
- TEST_HEXDUMP(stdout, "iv:", iv_ptr, tdata->iv.len);
+ debug_hexdump(stdout, "iv:", iv_ptr, tdata->iv.len);
sym_op->cipher.data.length = 0;
sym_op->cipher.data.offset = 0;
TEST_ASSERT_NOT_NULL(plaintext, "no room to append plaintext");
memcpy(plaintext, tdata->plaintext.data, tdata->plaintext.len);
- TEST_HEXDUMP(stdout, "plaintext:", plaintext,
+ debug_hexdump(stdout, "plaintext:", plaintext,
tdata->plaintext.len);
retval = create_gmac_operation(RTE_CRYPTO_AUTH_OP_GENERATE,
auth_tag = plaintext + plaintext_pad_len;
}
- TEST_HEXDUMP(stdout, "auth tag:", auth_tag, tdata->gmac_tag.len);
+ debug_hexdump(stdout, "auth tag:", auth_tag, tdata->gmac_tag.len);
TEST_ASSERT_BUFFERS_ARE_EQUAL(
auth_tag,
TEST_ASSERT_NOT_NULL(plaintext, "no room to append plaintext");
memcpy(plaintext, tdata->plaintext.data, tdata->plaintext.len);
- TEST_HEXDUMP(stdout, "plaintext:", plaintext,
+ debug_hexdump(stdout, "plaintext:", plaintext,
tdata->plaintext.len);
retval = create_gmac_operation(RTE_CRYPTO_AUTH_OP_VERIFY,
TEST_ASSERT_NOT_NULL(sym_op->auth.digest.data,
"no room to append auth tag");
- sym_op->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset(
+ sym_op->auth.digest.phys_addr = rte_pktmbuf_iova_offset(
ut_params->ibuf, reference->plaintext.len);
if (auth_generate)
reference->digest.data,
reference->digest.len);
- TEST_HEXDUMP(stdout, "digest:",
+ debug_hexdump(stdout, "digest:",
sym_op->auth.digest.data,
reference->digest.len);
TEST_ASSERT_NOT_NULL(sym_op->auth.digest.data,
"no room to append auth tag");
- sym_op->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset(
+ sym_op->auth.digest.phys_addr = rte_pktmbuf_iova_offset(
ut_params->ibuf, reference->ciphertext.len);
if (auth_generate)
reference->digest.data,
reference->digest.len);
- TEST_HEXDUMP(stdout, "digest:",
+ debug_hexdump(stdout, "digest:",
sym_op->auth.digest.data,
reference->digest.len);
TEST_ASSERT_NOT_NULL(sym_op->auth.digest.data,
"no room to append auth tag");
- sym_op->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset(
+ sym_op->auth.digest.phys_addr = rte_pktmbuf_iova_offset(
ut_params->ibuf, reference->ciphertext.len);
if (auth_generate)
reference->digest.data,
reference->digest.len);
- TEST_HEXDUMP(stdout, "digest:",
+ debug_hexdump(stdout, "digest:",
sym_op->auth.digest.data,
reference->digest.len);
TEST_ASSERT_NOT_NULL(plaintext, "no room to append plaintext");
memcpy(plaintext, reference->plaintext.data, reference->plaintext.len);
- TEST_HEXDUMP(stdout, "plaintext:", plaintext, reference->plaintext.len);
+ debug_hexdump(stdout, "plaintext:", plaintext,
+ reference->plaintext.len);
/* Create operation */
retval = create_auth_verify_operation(ts_params, ut_params, reference);
TEST_ASSERT_NOT_NULL(plaintext, "no room to append plaintext");
memcpy(plaintext, reference->plaintext.data, reference->plaintext.len);
- TEST_HEXDUMP(stdout, "plaintext:", plaintext, reference->plaintext.len);
+ debug_hexdump(stdout, "plaintext:", plaintext,
+ reference->plaintext.len);
/* Create operation */
retval = create_auth_verify_GMAC_operation(ts_params,
if (op == RTE_CRYPTO_AEAD_OP_DECRYPT) {
rte_memcpy(sym_op->aead.digest.data, tdata->auth_tag.data,
auth_tag_len);
- TEST_HEXDUMP(stdout, "digest:",
+ debug_hexdump(stdout, "digest:",
sym_op->aead.digest.data,
auth_tag_len);
}
ut_params->ibuf, aad_len);
TEST_ASSERT_NOT_NULL(sym_op->aead.aad.data,
"no room to prepend aad");
- sym_op->aead.aad.phys_addr = rte_pktmbuf_mtophys(
+ sym_op->aead.aad.phys_addr = rte_pktmbuf_iova(
ut_params->ibuf);
memset(sym_op->aead.aad.data, 0, aad_len);
/* Copy AAD 18 bytes after the AAD pointer, according to the API */
rte_memcpy(sym_op->aead.aad.data, tdata->aad.data, aad_len);
- TEST_HEXDUMP(stdout, "iv:", iv_ptr, iv_len);
- TEST_HEXDUMP(stdout, "aad:",
+ debug_hexdump(stdout, "iv:", iv_ptr, iv_len);
+ debug_hexdump(stdout, "aad:",
sym_op->aead.aad.data, aad_len);
} else {
uint8_t *iv_ptr = rte_crypto_op_ctod_offset(ut_params->op,
ut_params->ibuf, aad_len);
TEST_ASSERT_NOT_NULL(sym_op->aead.aad.data,
"no room to prepend aad");
- sym_op->aead.aad.phys_addr = rte_pktmbuf_mtophys(
+ sym_op->aead.aad.phys_addr = rte_pktmbuf_iova(
ut_params->ibuf);
memset(sym_op->aead.aad.data, 0, aad_len);
rte_memcpy(sym_op->aead.aad.data, tdata->aad.data, aad_len);
- TEST_HEXDUMP(stdout, "iv:", iv_ptr, iv_len);
- TEST_HEXDUMP(stdout, "aad:",
+ debug_hexdump(stdout, "iv:", iv_ptr, iv_len);
+ debug_hexdump(stdout, "aad:",
sym_op->aead.aad.data, aad_len);
}
digest_mem = rte_pktmbuf_append(ut_params->obuf,
tdata->auth_tag.len);
- digest_phys = rte_pktmbuf_mtophys_offset(
+ digest_phys = rte_pktmbuf_iova_offset(
ut_params->obuf,
tdata->plaintext.len + prepend_len);
}
* Place digest at the end of the last buffer
*/
if (!digest_phys)
- digest_phys = rte_pktmbuf_mtophys(buf) + to_trn;
+ digest_phys = rte_pktmbuf_iova(buf) + to_trn;
if (oop && buf_last_oop)
- digest_phys = rte_pktmbuf_mtophys(buf_last_oop) + to_trn;
+ digest_phys = rte_pktmbuf_iova(buf_last_oop) + to_trn;
if (!digest_mem && !oop) {
digest_mem = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf,
+ tdata->auth_tag.len);
- digest_phys = rte_pktmbuf_mtophys_offset(ut_params->ibuf,
+ digest_phys = rte_pktmbuf_iova_offset(ut_params->ibuf,
tdata->plaintext.len);
}
test_DES_cipheronly_mb_all),
TEST_CASE_ST(ut_setup, ut_teardown,
test_DES_docsis_mb_all),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_CCM_authenticated_encryption_test_case_128_1),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_CCM_authenticated_decryption_test_case_128_1),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_CCM_authenticated_encryption_test_case_128_2),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_CCM_authenticated_decryption_test_case_128_2),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_CCM_authenticated_encryption_test_case_128_3),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_CCM_authenticated_decryption_test_case_128_3),
TEST_CASES_END() /**< NULL terminate unit test array */
}
TEST_CASE_ST(ut_setup, ut_teardown,
test_AES_GCM_authenticated_decryption_oop_test_case_1),
+ /** Scatter-Gather */
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_encrypt_SGL_in_place_1500B),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_encrypt_SGL_out_of_place_400B_400B),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_encrypt_SGL_out_of_place_400B_1seg),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_encrypt_SGL_out_of_place_1500B_2000B),
+
TEST_CASES_END() /**< NULL terminate unit test array */
}
};
TEST_CASE_ST(ut_setup, ut_teardown,
test_AES_GCM_authenticated_decryption_oop_test_case_1),
+ /** Scatter-Gather */
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_encrypt_SGL_in_place_1500B),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_encrypt_SGL_out_of_place_400B_400B),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_encrypt_SGL_out_of_place_400B_1seg),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_encrypt_SGL_out_of_place_1500B_2000B),
+
TEST_CASES_END() /**< NULL terminate unit test array */
}
};
RTE_LOG(ERR, USER1, "QAT PMD must be loaded. Check if "
"CONFIG_RTE_LIBRTE_PMD_QAT is enabled "
"in config file to run this testsuite.\n");
- return TEST_FAILED;
+ return TEST_SKIPPED;
}
return unit_test_suite_runner(&cryptodev_qat_testsuite);
RTE_LOG(ERR, USER1, "AESNI MB PMD must be loaded. Check if "
"CONFIG_RTE_LIBRTE_PMD_AESNI_MB is enabled "
"in config file to run this testsuite.\n");
- return TEST_FAILED;
+ return TEST_SKIPPED;
}
return unit_test_suite_runner(&cryptodev_aesni_mb_testsuite);
RTE_LOG(ERR, USER1, "OPENSSL PMD must be loaded. Check if "
"CONFIG_RTE_LIBRTE_PMD_OPENSSL is enabled "
"in config file to run this testsuite.\n");
- return TEST_FAILED;
+ return TEST_SKIPPED;
}
return unit_test_suite_runner(&cryptodev_openssl_testsuite);
RTE_LOG(ERR, USER1, "AESNI GCM PMD must be loaded. Check if "
"CONFIG_RTE_LIBRTE_PMD_AESNI_GCM is enabled "
"in config file to run this testsuite.\n");
- return TEST_FAILED;
+ return TEST_SKIPPED;
}
return unit_test_suite_runner(&cryptodev_aesni_gcm_testsuite);
RTE_LOG(ERR, USER1, "NULL PMD must be loaded. Check if "
"CONFIG_RTE_LIBRTE_PMD_NULL is enabled "
"in config file to run this testsuite.\n");
- return TEST_FAILED;
+ return TEST_SKIPPED;
}
return unit_test_suite_runner(&cryptodev_null_testsuite);
RTE_LOG(ERR, USER1, "SNOW3G PMD must be loaded. Check if "
"CONFIG_RTE_LIBRTE_PMD_SNOW3G is enabled "
"in config file to run this testsuite.\n");
- return TEST_FAILED;
+ return TEST_SKIPPED;
}
return unit_test_suite_runner(&cryptodev_sw_snow3g_testsuite);
RTE_LOG(ERR, USER1, "ZUC PMD must be loaded. Check if "
"CONFIG_RTE_LIBRTE_PMD_KASUMI is enabled "
"in config file to run this testsuite.\n");
- return TEST_FAILED;
+ return TEST_SKIPPED;
}
return unit_test_suite_runner(&cryptodev_sw_kasumi_testsuite);
RTE_LOG(ERR, USER1, "ZUC PMD must be loaded. Check if "
"CONFIG_RTE_LIBRTE_PMD_ZUC is enabled "
"in config file to run this testsuite.\n");
- return TEST_FAILED;
+ return TEST_SKIPPED;
}
return unit_test_suite_runner(&cryptodev_sw_zuc_testsuite);
RTE_LOG(ERR, USER1, "ARMV8 PMD must be loaded. Check if "
"CONFIG_RTE_LIBRTE_PMD_ARMV8 is enabled "
"in config file to run this testsuite.\n");
- return TEST_FAILED;
+ return TEST_SKIPPED;
}
return unit_test_suite_runner(&cryptodev_armv8_testsuite);
RTE_LOG(ERR, USER1, "MRVL PMD must be loaded. Check if "
"CONFIG_RTE_LIBRTE_PMD_MRVL_CRYPTO is enabled "
"in config file to run this testsuite.\n");
- return TEST_FAILED;
+ return TEST_SKIPPED;
}
return unit_test_suite_runner(&cryptodev_mrvl_testsuite);
RTE_LOG(ERR, USER1, "SCHEDULER PMD must be loaded. Check if "
"CONFIG_RTE_LIBRTE_PMD_SCHEDULER is enabled "
"in config file to run this testsuite.\n");
- return TEST_FAILED;
+ return TEST_SKIPPED;
}
if (rte_cryptodev_driver_id_get(
RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)) == -1) {
RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_AESNI_MB must be"
" enabled in config file to run this testsuite.\n");
- return TEST_FAILED;
+ return TEST_SKIPPED;
}
return unit_test_suite_runner(&cryptodev_scheduler_testsuite);
}
RTE_LOG(ERR, USER1, "DPAA2 SEC PMD must be loaded. Check if "
"CONFIG_RTE_LIBRTE_PMD_DPAA2_SEC is enabled "
"in config file to run this testsuite.\n");
- return TEST_FAILED;
+ return TEST_SKIPPED;
}
return unit_test_suite_runner(&cryptodev_dpaa2_sec_testsuite);
RTE_LOG(ERR, USER1, "DPAA SEC PMD must be loaded. Check if "
"CONFIG_RTE_LIBRTE_PMD_DPAA_SEC is enabled "
"in config file to run this testsuite.\n");
- return TEST_FAILED;
+ return TEST_SKIPPED;
}
return unit_test_suite_runner(&cryptodev_dpaa_sec_testsuite);