#include <rte_memcpy.h>
#include <rte_pause.h>
#include <rte_bus_vdev.h>
+#include <rte_ether.h>
#include <rte_crypto.h>
#include <rte_cryptodev.h>
#ifdef RTE_LIBRTE_SECURITY
#include "test_cryptodev_security_pdcp_test_vectors.h"
#include "test_cryptodev_security_pdcp_test_func.h"
+#include "test_cryptodev_security_docsis_test_vectors.h"
#endif
#define VDEV_ARGS_SIZE 100
struct rte_crypto_sym_xform cipher_xform;
struct rte_crypto_sym_xform auth_xform;
struct rte_crypto_sym_xform aead_xform;
+#ifdef RTE_LIBRTE_SECURITY
+ struct rte_security_docsis_xform docsis_xform;
+#endif
union {
struct rte_cryptodev_sym_session *sess;
}
static int
-ut_setup(void)
+dev_configure_and_start(uint64_t ff_disable)
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
/* Reconfigure device to default parameters */
ts_params->conf.socket_id = SOCKET_ID_ANY;
- ts_params->conf.ff_disable = RTE_CRYPTODEV_FF_SECURITY;
+ ts_params->conf.ff_disable = ff_disable;
ts_params->qp_conf.nb_descriptors = MAX_NUM_OPS_INFLIGHT;
ts_params->qp_conf.mp_session = ts_params->session_mpool;
ts_params->qp_conf.mp_session_private = ts_params->session_priv_mpool;
return TEST_SUCCESS;
}
+static int
+ut_setup(void)
+{
+ /* Configure and start the device with security feature disabled */
+ return dev_configure_and_start(RTE_CRYPTODEV_FF_SECURITY);
+}
+
+static int
+ut_setup_security(void)
+{
+ /* Configure and start the device with no features disabled */
+ return dev_configure_and_start(0);
+}
+
static void
ut_teardown(void)
{
}
#ifdef RTE_LIBRTE_SECURITY
+static int
+security_proto_supported(enum rte_security_session_action_type action,
+ enum rte_security_session_protocol proto)
+{
+ struct crypto_testsuite_params *ts_params = &testsuite_params;
+
+ const struct rte_security_capability *capabilities;
+ const struct rte_security_capability *capability;
+ uint16_t i = 0;
+
+ struct rte_security_ctx *ctx = (struct rte_security_ctx *)
+ rte_cryptodev_get_sec_ctx(
+ ts_params->valid_devs[0]);
+
+
+ capabilities = rte_security_capabilities_get(ctx);
+
+ if (capabilities == NULL)
+ return -ENOTSUP;
+
+ while ((capability = &capabilities[i++])->action !=
+ RTE_SECURITY_ACTION_TYPE_NONE) {
+ if (capability->action == action &&
+ capability->protocol == proto)
+ return 0;
+ }
+
+ return -ENOTSUP;
+}
+
/* Basic algorithm run function for async inplace mode.
* Creates a session from input parameters and runs one operation
* on input_vec. Checks the output of the crypto operation against
/* Verify the capabilities */
struct rte_security_capability_idx sec_cap_idx;
- sec_cap_idx.action = RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL;
+ sec_cap_idx.action = ut_params->type;
sec_cap_idx.protocol = RTE_SECURITY_PROTOCOL_PDCP;
sec_cap_idx.pdcp.domain = pdcp_test_params[i].domain;
if (rte_security_capability_get(ctx, &sec_cap_idx) == NULL)
rte_pktmbuf_append(ut_params->obuf, output_vec_len);
}
- /* Set crypto type as IPSEC */
- ut_params->type = RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL;
-
/* Setup Cipher Parameters */
ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
ut_params->cipher_xform.cipher.algo = pdcp_test_params[i].cipher_alg;
ut_params->cipher_xform.cipher.key.data = pdcp_test_crypto_key[i];
ut_params->cipher_xform.cipher.key.length =
pdcp_test_params[i].cipher_key_len;
- ut_params->cipher_xform.cipher.iv.length = 0;
+ ut_params->cipher_xform.cipher.iv.length =
+ pdcp_test_packet_direction[i] ? 4 : 0;
+ ut_params->cipher_xform.cipher.iv.offset = IV_OFFSET;
/* Setup HMAC Parameters if ICV header is required */
if (pdcp_test_params[i].auth_alg != 0) {
}
struct rte_security_session_conf sess_conf = {
- .action_type = RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL,
+ .action_type = ut_params->type,
.protocol = RTE_SECURITY_PROTOCOL_PDCP,
{.pdcp = {
.bearer = pdcp_test_bearer[i],
.domain = pdcp_test_params[i].domain,
.pkt_dir = pdcp_test_packet_direction[i],
.sn_size = pdcp_test_data_sn_size[i],
- .hfn = pdcp_test_hfn[i],
+ .hfn = pdcp_test_packet_direction[i] ?
+ 0 : pdcp_test_hfn[i],
+ /**
+ * hfn can be set as pdcp_test_hfn[i]
+ * if hfn_ovrd is not set. Here, PDCP
+ * packet direction is just used to
+ * run half of the cases with session
+ * HFN and other half with per packet
+ * HFN.
+ */
.hfn_threshold = pdcp_test_hfn_threshold[i],
+ .hfn_ovrd = pdcp_test_packet_direction[i] ? 1 : 0,
} },
.crypto_xform = &ut_params->cipher_xform
};
goto on_err;
}
+ uint32_t *per_pkt_hfn = rte_crypto_op_ctod_offset(ut_params->op,
+ uint32_t *, IV_OFFSET);
+ *per_pkt_hfn = pdcp_test_packet_direction[i] ? pdcp_test_hfn[i] : 0;
+
rte_security_attach_session(ut_params->op, ut_params->sec_session);
/* set crypto operation source mbuf */
/* Verify the capabilities */
struct rte_security_capability_idx sec_cap_idx;
- sec_cap_idx.action = RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL;
+ sec_cap_idx.action = ut_params->type;
sec_cap_idx.protocol = RTE_SECURITY_PROTOCOL_PDCP;
sec_cap_idx.pdcp.domain = pdcp_test_params[i].domain;
if (rte_security_capability_get(ctx, &sec_cap_idx) == NULL)
ut_params->obuf->nb_segs = segs;
}
- ut_params->type = RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL;
-
/* Setup Cipher Parameters */
ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
ut_params->cipher_xform.cipher.algo = pdcp_test_params[i].cipher_alg;
}
struct rte_security_session_conf sess_conf = {
- .action_type = RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL,
+ .action_type = ut_params->type,
.protocol = RTE_SECURITY_PROTOCOL_PDCP,
{.pdcp = {
.bearer = pdcp_test_bearer[i],
.sn_size = pdcp_test_data_sn_size[i],
.hfn = pdcp_test_hfn[i],
.hfn_threshold = pdcp_test_hfn_threshold[i],
+ .hfn_ovrd = 0,
} },
.crypto_xform = &ut_params->cipher_xform
};
test_PDCP_PROTO_all(void)
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
+ struct crypto_unittest_params *ut_params = &unittest_params;
struct rte_cryptodev_info dev_info;
int status;
if (!(feat_flags & RTE_CRYPTODEV_FF_SECURITY))
return -ENOTSUP;
+ /* Set action type */
+ ut_params->type = gbl_action_type == RTE_SECURITY_ACTION_TYPE_NONE ?
+ RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL :
+ gbl_action_type;
+
+ if (security_proto_supported(ut_params->type,
+ RTE_SECURITY_PROTOCOL_PDCP) < 0)
+ return -ENOTSUP;
+
status = test_PDCP_PROTO_cplane_encap_all();
status += test_PDCP_PROTO_cplane_decap_all();
status += test_PDCP_PROTO_uplane_encap_all();
else
return TEST_SUCCESS;
}
+
+static int
+test_docsis_proto_uplink(int i, struct docsis_test_data *d_td)
+{
+ struct crypto_testsuite_params *ts_params = &testsuite_params;
+ struct crypto_unittest_params *ut_params = &unittest_params;
+ uint8_t *plaintext, *ciphertext;
+ uint8_t *iv_ptr;
+ int32_t cipher_len, crc_len;
+ uint32_t crc_data_len;
+ int ret = TEST_SUCCESS;
+
+ struct rte_security_ctx *ctx = (struct rte_security_ctx *)
+ rte_cryptodev_get_sec_ctx(
+ ts_params->valid_devs[0]);
+
+ /* Verify the capabilities */
+ struct rte_security_capability_idx sec_cap_idx;
+ const struct rte_security_capability *sec_cap;
+ const struct rte_cryptodev_capabilities *crypto_cap;
+ const struct rte_cryptodev_symmetric_capability *sym_cap;
+ int j = 0;
+
+ sec_cap_idx.action = ut_params->type;
+ sec_cap_idx.protocol = RTE_SECURITY_PROTOCOL_DOCSIS;
+ sec_cap_idx.docsis.direction = RTE_SECURITY_DOCSIS_UPLINK;
+
+ sec_cap = rte_security_capability_get(ctx, &sec_cap_idx);
+ if (sec_cap == NULL)
+ return -ENOTSUP;
+
+ while ((crypto_cap = &sec_cap->crypto_capabilities[j++])->op !=
+ RTE_CRYPTO_OP_TYPE_UNDEFINED) {
+ if (crypto_cap->op == RTE_CRYPTO_OP_TYPE_SYMMETRIC &&
+ crypto_cap->sym.xform_type ==
+ RTE_CRYPTO_SYM_XFORM_CIPHER &&
+ crypto_cap->sym.cipher.algo ==
+ RTE_CRYPTO_CIPHER_AES_DOCSISBPI) {
+ sym_cap = &crypto_cap->sym;
+ if (rte_cryptodev_sym_capability_check_cipher(sym_cap,
+ d_td->key.len,
+ d_td->iv.len) == 0)
+ break;
+ }
+ }
+
+ if (crypto_cap->op == RTE_CRYPTO_OP_TYPE_UNDEFINED)
+ return -ENOTSUP;
+
+ /* Setup source mbuf payload */
+ ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
+ memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0,
+ rte_pktmbuf_tailroom(ut_params->ibuf));
+
+ ciphertext = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf,
+ d_td->ciphertext.len);
+
+ memcpy(ciphertext, d_td->ciphertext.data, d_td->ciphertext.len);
+
+ /* Setup cipher session parameters */
+ ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
+ ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_CIPHER_AES_DOCSISBPI;
+ ut_params->cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_DECRYPT;
+ ut_params->cipher_xform.cipher.key.data = d_td->key.data;
+ ut_params->cipher_xform.cipher.key.length = d_td->key.len;
+ ut_params->cipher_xform.cipher.iv.length = d_td->iv.len;
+ ut_params->cipher_xform.cipher.iv.offset = IV_OFFSET;
+ ut_params->cipher_xform.next = NULL;
+
+ /* Setup DOCSIS session parameters */
+ ut_params->docsis_xform.direction = RTE_SECURITY_DOCSIS_UPLINK;
+
+ struct rte_security_session_conf sess_conf = {
+ .action_type = ut_params->type,
+ .protocol = RTE_SECURITY_PROTOCOL_DOCSIS,
+ .docsis = ut_params->docsis_xform,
+ .crypto_xform = &ut_params->cipher_xform,
+ };
+
+ /* Create security session */
+ ut_params->sec_session = rte_security_session_create(ctx, &sess_conf,
+ ts_params->session_priv_mpool);
+
+ if (!ut_params->sec_session) {
+ printf("TestCase %s(%d) line %d: %s\n",
+ __func__, i, __LINE__, "failed to allocate session");
+ ret = TEST_FAILED;
+ goto on_err;
+ }
+
+ /* Generate crypto op data structure */
+ ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool,
+ RTE_CRYPTO_OP_TYPE_SYMMETRIC);
+ if (!ut_params->op) {
+ printf("TestCase %s(%d) line %d: %s\n",
+ __func__, i, __LINE__,
+ "failed to allocate symmetric crypto operation");
+ ret = TEST_FAILED;
+ goto on_err;
+ }
+
+ /* Setup CRC operation parameters */
+ crc_len = d_td->ciphertext.no_crc == false ?
+ (d_td->ciphertext.len -
+ d_td->ciphertext.crc_offset -
+ RTE_ETHER_CRC_LEN) :
+ 0;
+ crc_len = crc_len > 0 ? crc_len : 0;
+ crc_data_len = crc_len == 0 ? 0 : RTE_ETHER_CRC_LEN;
+ ut_params->op->sym->auth.data.length = crc_len;
+ ut_params->op->sym->auth.data.offset = d_td->ciphertext.crc_offset;
+
+ /* Setup cipher operation parameters */
+ cipher_len = d_td->ciphertext.no_cipher == false ?
+ (d_td->ciphertext.len -
+ d_td->ciphertext.cipher_offset) :
+ 0;
+ cipher_len = cipher_len > 0 ? cipher_len : 0;
+ ut_params->op->sym->cipher.data.length = cipher_len;
+ ut_params->op->sym->cipher.data.offset = d_td->ciphertext.cipher_offset;
+
+ /* Setup cipher IV */
+ iv_ptr = (uint8_t *)ut_params->op + IV_OFFSET;
+ rte_memcpy(iv_ptr, d_td->iv.data, d_td->iv.len);
+
+ /* Attach session to operation */
+ rte_security_attach_session(ut_params->op, ut_params->sec_session);
+
+ /* Set crypto operation mbufs */
+ ut_params->op->sym->m_src = ut_params->ibuf;
+ ut_params->op->sym->m_dst = NULL;
+
+ /* Process crypto operation */
+ if (process_crypto_request(ts_params->valid_devs[0], ut_params->op) ==
+ NULL) {
+ printf("TestCase %s(%d) line %d: %s\n",
+ __func__, i, __LINE__,
+ "failed to process security crypto op");
+ ret = TEST_FAILED;
+ goto on_err;
+ }
+
+ if (ut_params->op->status != RTE_CRYPTO_OP_STATUS_SUCCESS) {
+ printf("TestCase %s(%d) line %d: %s\n",
+ __func__, i, __LINE__, "crypto op processing failed");
+ ret = TEST_FAILED;
+ goto on_err;
+ }
+
+ /* Validate plaintext */
+ plaintext = ciphertext;
+
+ if (memcmp(plaintext, d_td->plaintext.data,
+ d_td->plaintext.len - crc_data_len)) {
+ printf("TestCase %s(%d) line %d: %s\n",
+ __func__, i, __LINE__, "plaintext not as expected\n");
+ rte_hexdump(stdout, "expected", d_td->plaintext.data,
+ d_td->plaintext.len);
+ rte_hexdump(stdout, "actual", plaintext, d_td->plaintext.len);
+ ret = TEST_FAILED;
+ goto on_err;
+ }
+
+on_err:
+ rte_crypto_op_free(ut_params->op);
+ ut_params->op = NULL;
+
+ if (ut_params->sec_session)
+ rte_security_session_destroy(ctx, ut_params->sec_session);
+ ut_params->sec_session = NULL;
+
+ rte_pktmbuf_free(ut_params->ibuf);
+ ut_params->ibuf = NULL;
+
+ return ret;
+}
+
+static int
+test_docsis_proto_downlink(int i, struct docsis_test_data *d_td)
+{
+ struct crypto_testsuite_params *ts_params = &testsuite_params;
+ struct crypto_unittest_params *ut_params = &unittest_params;
+ uint8_t *plaintext, *ciphertext;
+ uint8_t *iv_ptr;
+ int32_t cipher_len, crc_len;
+ int ret = TEST_SUCCESS;
+
+ struct rte_security_ctx *ctx = (struct rte_security_ctx *)
+ rte_cryptodev_get_sec_ctx(
+ ts_params->valid_devs[0]);
+
+ /* Verify the capabilities */
+ struct rte_security_capability_idx sec_cap_idx;
+ const struct rte_security_capability *sec_cap;
+ const struct rte_cryptodev_capabilities *crypto_cap;
+ const struct rte_cryptodev_symmetric_capability *sym_cap;
+ int j = 0;
+
+ sec_cap_idx.action = ut_params->type;
+ sec_cap_idx.protocol = RTE_SECURITY_PROTOCOL_DOCSIS;
+ sec_cap_idx.docsis.direction = RTE_SECURITY_DOCSIS_DOWNLINK;
+
+ sec_cap = rte_security_capability_get(ctx, &sec_cap_idx);
+ if (sec_cap == NULL)
+ return -ENOTSUP;
+
+ while ((crypto_cap = &sec_cap->crypto_capabilities[j++])->op !=
+ RTE_CRYPTO_OP_TYPE_UNDEFINED) {
+ if (crypto_cap->op == RTE_CRYPTO_OP_TYPE_SYMMETRIC &&
+ crypto_cap->sym.xform_type ==
+ RTE_CRYPTO_SYM_XFORM_CIPHER &&
+ crypto_cap->sym.cipher.algo ==
+ RTE_CRYPTO_CIPHER_AES_DOCSISBPI) {
+ sym_cap = &crypto_cap->sym;
+ if (rte_cryptodev_sym_capability_check_cipher(sym_cap,
+ d_td->key.len,
+ d_td->iv.len) == 0)
+ break;
+ }
+ }
+
+ if (crypto_cap->op == RTE_CRYPTO_OP_TYPE_UNDEFINED)
+ return -ENOTSUP;
+
+ /* Setup source mbuf payload */
+ ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
+ memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0,
+ rte_pktmbuf_tailroom(ut_params->ibuf));
+
+ plaintext = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf,
+ d_td->plaintext.len);
+
+ memcpy(plaintext, d_td->plaintext.data, d_td->plaintext.len);
+
+ /* Setup cipher session parameters */
+ ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
+ ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_CIPHER_AES_DOCSISBPI;
+ ut_params->cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
+ ut_params->cipher_xform.cipher.key.data = d_td->key.data;
+ ut_params->cipher_xform.cipher.key.length = d_td->key.len;
+ ut_params->cipher_xform.cipher.iv.length = d_td->iv.len;
+ ut_params->cipher_xform.cipher.iv.offset = IV_OFFSET;
+ ut_params->cipher_xform.next = NULL;
+
+ /* Setup DOCSIS session parameters */
+ ut_params->docsis_xform.direction = RTE_SECURITY_DOCSIS_DOWNLINK;
+
+ struct rte_security_session_conf sess_conf = {
+ .action_type = ut_params->type,
+ .protocol = RTE_SECURITY_PROTOCOL_DOCSIS,
+ .docsis = ut_params->docsis_xform,
+ .crypto_xform = &ut_params->cipher_xform,
+ };
+
+ /* Create security session */
+ ut_params->sec_session = rte_security_session_create(ctx, &sess_conf,
+ ts_params->session_priv_mpool);
+
+ if (!ut_params->sec_session) {
+ printf("TestCase %s(%d) line %d: %s\n",
+ __func__, i, __LINE__, "failed to allocate session");
+ ret = TEST_FAILED;
+ goto on_err;
+ }
+
+ /* Generate crypto op data structure */
+ ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool,
+ RTE_CRYPTO_OP_TYPE_SYMMETRIC);
+ if (!ut_params->op) {
+ printf("TestCase %s(%d) line %d: %s\n",
+ __func__, i, __LINE__,
+ "failed to allocate security crypto operation");
+ ret = TEST_FAILED;
+ goto on_err;
+ }
+
+ /* Setup CRC operation parameters */
+ crc_len = d_td->plaintext.no_crc == false ?
+ (d_td->plaintext.len -
+ d_td->plaintext.crc_offset -
+ RTE_ETHER_CRC_LEN) :
+ 0;
+ crc_len = crc_len > 0 ? crc_len : 0;
+ ut_params->op->sym->auth.data.length = crc_len;
+ ut_params->op->sym->auth.data.offset = d_td->plaintext.crc_offset;
+
+ /* Setup cipher operation parameters */
+ cipher_len = d_td->plaintext.no_cipher == false ?
+ (d_td->plaintext.len -
+ d_td->plaintext.cipher_offset) :
+ 0;
+ cipher_len = cipher_len > 0 ? cipher_len : 0;
+ ut_params->op->sym->cipher.data.length = cipher_len;
+ ut_params->op->sym->cipher.data.offset = d_td->plaintext.cipher_offset;
+
+ /* Setup cipher IV */
+ iv_ptr = (uint8_t *)ut_params->op + IV_OFFSET;
+ rte_memcpy(iv_ptr, d_td->iv.data, d_td->iv.len);
+
+ /* Attach session to operation */
+ rte_security_attach_session(ut_params->op, ut_params->sec_session);
+
+ /* Set crypto operation mbufs */
+ ut_params->op->sym->m_src = ut_params->ibuf;
+ ut_params->op->sym->m_dst = NULL;
+
+ /* Process crypto operation */
+ if (process_crypto_request(ts_params->valid_devs[0], ut_params->op) ==
+ NULL) {
+ printf("TestCase %s(%d) line %d: %s\n",
+ __func__, i, __LINE__,
+ "failed to process security crypto op");
+ ret = TEST_FAILED;
+ goto on_err;
+ }
+
+ if (ut_params->op->status != RTE_CRYPTO_OP_STATUS_SUCCESS) {
+ printf("TestCase %s(%d) line %d: %s\n",
+ __func__, i, __LINE__, "crypto op processing failed");
+ ret = TEST_FAILED;
+ goto on_err;
+ }
+
+ /* Validate ciphertext */
+ ciphertext = plaintext;
+
+ if (memcmp(ciphertext, d_td->ciphertext.data, d_td->ciphertext.len)) {
+ printf("TestCase %s(%d) line %d: %s\n",
+ __func__, i, __LINE__, "ciphertext not as expected\n");
+ rte_hexdump(stdout, "expected", d_td->ciphertext.data,
+ d_td->ciphertext.len);
+ rte_hexdump(stdout, "actual", ciphertext, d_td->ciphertext.len);
+ ret = TEST_FAILED;
+ goto on_err;
+ }
+
+on_err:
+ rte_crypto_op_free(ut_params->op);
+ ut_params->op = NULL;
+
+ if (ut_params->sec_session)
+ rte_security_session_destroy(ctx, ut_params->sec_session);
+ ut_params->sec_session = NULL;
+
+ rte_pktmbuf_free(ut_params->ibuf);
+ ut_params->ibuf = NULL;
+
+ return ret;
+}
+
+#define TEST_DOCSIS_COUNT(func) do { \
+ int ret = func; \
+ if (ret == TEST_SUCCESS) { \
+ printf("\t%2d)", n++); \
+ printf("+++++ PASSED:" #func"\n"); \
+ p++; \
+ } else if (ret == -ENOTSUP) { \
+ printf("\t%2d)", n++); \
+ printf("~~~~~ UNSUPP:" #func"\n"); \
+ u++; \
+ } else { \
+ printf("\t%2d)", n++); \
+ printf("----- FAILED:" #func"\n"); \
+ f++; \
+ } \
+} while (0)
+
+static int
+test_DOCSIS_PROTO_uplink_all(void)
+{
+ int p = 0, u = 0, f = 0, n = 0;
+
+ TEST_DOCSIS_COUNT(test_docsis_proto_uplink(1, &docsis_test_case_1));
+ TEST_DOCSIS_COUNT(test_docsis_proto_uplink(2, &docsis_test_case_2));
+ TEST_DOCSIS_COUNT(test_docsis_proto_uplink(3, &docsis_test_case_3));
+ TEST_DOCSIS_COUNT(test_docsis_proto_uplink(4, &docsis_test_case_4));
+ TEST_DOCSIS_COUNT(test_docsis_proto_uplink(5, &docsis_test_case_5));
+ TEST_DOCSIS_COUNT(test_docsis_proto_uplink(6, &docsis_test_case_6));
+ TEST_DOCSIS_COUNT(test_docsis_proto_uplink(7, &docsis_test_case_7));
+ TEST_DOCSIS_COUNT(test_docsis_proto_uplink(8, &docsis_test_case_8));
+ TEST_DOCSIS_COUNT(test_docsis_proto_uplink(9, &docsis_test_case_9));
+ TEST_DOCSIS_COUNT(test_docsis_proto_uplink(10, &docsis_test_case_10));
+ TEST_DOCSIS_COUNT(test_docsis_proto_uplink(11, &docsis_test_case_11));
+ TEST_DOCSIS_COUNT(test_docsis_proto_uplink(12, &docsis_test_case_12));
+ TEST_DOCSIS_COUNT(test_docsis_proto_uplink(13, &docsis_test_case_13));
+ TEST_DOCSIS_COUNT(test_docsis_proto_uplink(14, &docsis_test_case_14));
+ TEST_DOCSIS_COUNT(test_docsis_proto_uplink(15, &docsis_test_case_15));
+ TEST_DOCSIS_COUNT(test_docsis_proto_uplink(16, &docsis_test_case_16));
+ TEST_DOCSIS_COUNT(test_docsis_proto_uplink(17, &docsis_test_case_17));
+ TEST_DOCSIS_COUNT(test_docsis_proto_uplink(18, &docsis_test_case_18));
+ TEST_DOCSIS_COUNT(test_docsis_proto_uplink(19, &docsis_test_case_19));
+ TEST_DOCSIS_COUNT(test_docsis_proto_uplink(20, &docsis_test_case_20));
+ TEST_DOCSIS_COUNT(test_docsis_proto_uplink(21, &docsis_test_case_21));
+ TEST_DOCSIS_COUNT(test_docsis_proto_uplink(22, &docsis_test_case_22));
+ TEST_DOCSIS_COUNT(test_docsis_proto_uplink(23, &docsis_test_case_23));
+ TEST_DOCSIS_COUNT(test_docsis_proto_uplink(24, &docsis_test_case_24));
+ TEST_DOCSIS_COUNT(test_docsis_proto_uplink(25, &docsis_test_case_25));
+ TEST_DOCSIS_COUNT(test_docsis_proto_uplink(26, &docsis_test_case_26));
+
+ if (f)
+ printf("## %s: %d passed out of %d (%d unsupported)\n",
+ __func__, p, n, u);
+
+ return f;
+};
+
+static int
+test_DOCSIS_PROTO_downlink_all(void)
+{
+ int p = 0, u = 0, f = 0, n = 0;
+
+ TEST_DOCSIS_COUNT(test_docsis_proto_downlink(1, &docsis_test_case_1));
+ TEST_DOCSIS_COUNT(test_docsis_proto_downlink(2, &docsis_test_case_2));
+ TEST_DOCSIS_COUNT(test_docsis_proto_downlink(3, &docsis_test_case_3));
+ TEST_DOCSIS_COUNT(test_docsis_proto_downlink(4, &docsis_test_case_4));
+ TEST_DOCSIS_COUNT(test_docsis_proto_downlink(5, &docsis_test_case_5));
+ TEST_DOCSIS_COUNT(test_docsis_proto_downlink(6, &docsis_test_case_6));
+ TEST_DOCSIS_COUNT(test_docsis_proto_downlink(7, &docsis_test_case_7));
+ TEST_DOCSIS_COUNT(test_docsis_proto_downlink(8, &docsis_test_case_8));
+ TEST_DOCSIS_COUNT(test_docsis_proto_downlink(9, &docsis_test_case_9));
+ TEST_DOCSIS_COUNT(test_docsis_proto_downlink(10, &docsis_test_case_10));
+ TEST_DOCSIS_COUNT(test_docsis_proto_downlink(11, &docsis_test_case_11));
+ TEST_DOCSIS_COUNT(test_docsis_proto_downlink(12, &docsis_test_case_12));
+ TEST_DOCSIS_COUNT(test_docsis_proto_downlink(13, &docsis_test_case_13));
+ TEST_DOCSIS_COUNT(test_docsis_proto_downlink(14, &docsis_test_case_14));
+ TEST_DOCSIS_COUNT(test_docsis_proto_downlink(15, &docsis_test_case_15));
+ TEST_DOCSIS_COUNT(test_docsis_proto_downlink(16, &docsis_test_case_16));
+ TEST_DOCSIS_COUNT(test_docsis_proto_downlink(17, &docsis_test_case_17));
+ TEST_DOCSIS_COUNT(test_docsis_proto_downlink(18, &docsis_test_case_18));
+ TEST_DOCSIS_COUNT(test_docsis_proto_downlink(19, &docsis_test_case_19));
+ TEST_DOCSIS_COUNT(test_docsis_proto_downlink(20, &docsis_test_case_20));
+ TEST_DOCSIS_COUNT(test_docsis_proto_downlink(21, &docsis_test_case_21));
+ TEST_DOCSIS_COUNT(test_docsis_proto_downlink(22, &docsis_test_case_22));
+ TEST_DOCSIS_COUNT(test_docsis_proto_downlink(23, &docsis_test_case_23));
+ TEST_DOCSIS_COUNT(test_docsis_proto_downlink(24, &docsis_test_case_24));
+ TEST_DOCSIS_COUNT(test_docsis_proto_downlink(25, &docsis_test_case_25));
+ TEST_DOCSIS_COUNT(test_docsis_proto_downlink(26, &docsis_test_case_26));
+
+ if (f)
+ printf("## %s: %d passed out of %d (%d unsupported)\n",
+ __func__, p, n, u);
+
+ return f;
+};
+
+static int
+test_DOCSIS_PROTO_all(void)
+{
+ struct crypto_testsuite_params *ts_params = &testsuite_params;
+ struct crypto_unittest_params *ut_params = &unittest_params;
+ struct rte_cryptodev_info dev_info;
+ int status;
+
+ rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info);
+ uint64_t feat_flags = dev_info.feature_flags;
+
+ if (!(feat_flags & RTE_CRYPTODEV_FF_SECURITY))
+ return -ENOTSUP;
+
+ /* Set action type */
+ ut_params->type = gbl_action_type == RTE_SECURITY_ACTION_TYPE_NONE ?
+ RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL :
+ gbl_action_type;
+
+ if (security_proto_supported(ut_params->type,
+ RTE_SECURITY_PROTOCOL_DOCSIS) < 0)
+ return -ENOTSUP;
+
+ status = test_DOCSIS_PROTO_uplink_all();
+ status += test_DOCSIS_PROTO_downlink_all();
+
+ if (status)
+ return TEST_FAILED;
+ else
+ return TEST_SUCCESS;
+}
#endif
static int
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_cipher_only_operation(void)
+test_null_invalid_operation(void)
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
+ int ret;
- /* Verify the capabilities */
- struct rte_cryptodev_sym_capability_idx cap_idx;
- cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
- cap_idx.algo.cipher = RTE_CRYPTO_CIPHER_NULL;
- if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
- &cap_idx) == NULL)
+ /* This test is for NULL PMD only */
+ if (gbl_driver_id != rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_NULL_PMD)))
return -ENOTSUP;
- /* 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);
-
/* Setup Cipher Parameters */
ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
ut_params->cipher_xform.next = NULL;
- ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_CIPHER_NULL;
+ ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_CIPHER_AES_CBC;
ut_params->cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
ut_params->sess = rte_cryptodev_sym_session_create(
ts_params->session_mpool);
/* Create Crypto session*/
- rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
- ut_params->sess,
- &ut_params->cipher_xform,
- ts_params->session_priv_mpool);
- TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
-
- /* Generate Crypto op data structure */
- ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool,
- RTE_CRYPTO_OP_TYPE_SYMMETRIC);
- TEST_ASSERT_NOT_NULL(ut_params->op,
- "Failed to allocate symmetric crypto operation struct");
-
- /* Set crypto operation data parameters */
- rte_crypto_op_attach_sym_session(ut_params->op, ut_params->sess);
-
- struct rte_crypto_sym_op *sym_op = ut_params->op->sym;
-
- /* set crypto operation source mbuf */
- sym_op->m_src = ut_params->ibuf;
-
- sym_op->cipher.data.offset = 0;
- sym_op->cipher.data.length = QUOTE_512_BYTES;
-
- /* Process crypto operation */
- ut_params->op = process_crypto_request(ts_params->valid_devs[0],
- ut_params->op);
- TEST_ASSERT_NOT_NULL(ut_params->op, "no crypto operation returned");
-
- TEST_ASSERT_EQUAL(ut_params->op->status, RTE_CRYPTO_OP_STATUS_SUCCESS,
- "crypto operation processing failed");
-
- /* Validate obuf */
- TEST_ASSERT_BUFFERS_ARE_EQUAL(
- rte_pktmbuf_mtod(ut_params->op->sym->m_src, uint8_t *),
- catch_22_quote,
- QUOTE_512_BYTES,
- "Ciphertext data not as expected");
-
- 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;
-
- /* Verify the capabilities */
- struct rte_cryptodev_sym_capability_idx cap_idx;
- cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH;
- cap_idx.algo.auth = RTE_CRYPTO_AUTH_NULL;
- if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
- &cap_idx) == NULL)
- return -ENOTSUP;
-
- /* 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);
+ ret = rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
+ ut_params->sess, &ut_params->cipher_xform,
+ ts_params->session_priv_mpool);
+ TEST_ASSERT(ret < 0,
+ "Session creation succeeded unexpectedly");
- /* 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;
- ut_params->auth_xform.auth.algo = RTE_CRYPTO_AUTH_NULL;
+ ut_params->auth_xform.auth.algo = RTE_CRYPTO_AUTH_SHA1_HMAC;
ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
ut_params->sess = rte_cryptodev_sym_session_create(
ts_params->session_mpool);
/* Create Crypto session*/
- rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
+ ret = rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
ut_params->sess, &ut_params->auth_xform,
ts_params->session_priv_mpool);
- TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
-
- /* Generate Crypto op data structure */
- ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool,
- RTE_CRYPTO_OP_TYPE_SYMMETRIC);
- TEST_ASSERT_NOT_NULL(ut_params->op,
- "Failed to allocate symmetric crypto operation struct");
-
- /* Set crypto operation data parameters */
- rte_crypto_op_attach_sym_session(ut_params->op, ut_params->sess);
-
- struct rte_crypto_sym_op *sym_op = ut_params->op->sym;
-
- sym_op->m_src = ut_params->ibuf;
-
- 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],
- ut_params->op);
- TEST_ASSERT_NOT_NULL(ut_params->op, "no crypto operation returned");
-
- 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");
+ TEST_ASSERT(ret < 0,
+ "Session creation succeeded unexpectedly");
return TEST_SUCCESS;
}
+#define NULL_BURST_LENGTH (32)
+
static int
-test_null_cipher_auth_operation(void)
+test_null_burst_operation(void)
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
- uint8_t *digest;
- /* Verify the capabilities */
- struct rte_cryptodev_sym_capability_idx cap_idx;
- cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH;
- cap_idx.algo.auth = RTE_CRYPTO_AUTH_NULL;
- if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
- &cap_idx) == NULL)
- return -ENOTSUP;
- cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
- cap_idx.algo.cipher = RTE_CRYPTO_CIPHER_NULL;
- if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
- &cap_idx) == NULL)
- return -ENOTSUP;
+ unsigned i, burst_len = NULL_BURST_LENGTH;
- /* 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);
+ struct rte_crypto_op *burst[NULL_BURST_LENGTH] = { NULL };
+ struct rte_crypto_op *burst_dequeued[NULL_BURST_LENGTH] = { NULL };
- /* 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));
+ /* This test is for NULL PMD only */
+ if (gbl_driver_id != rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_NULL_PMD)))
+ return -ENOTSUP;
/* Setup Cipher Parameters */
ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
ts_params->session_priv_mpool);
TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
- /* Generate Crypto op data structure */
- ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool,
- RTE_CRYPTO_OP_TYPE_SYMMETRIC);
- TEST_ASSERT_NOT_NULL(ut_params->op,
- "Failed to allocate symmetric crypto operation struct");
+ TEST_ASSERT_EQUAL(rte_crypto_op_bulk_alloc(ts_params->op_mpool,
+ RTE_CRYPTO_OP_TYPE_SYMMETRIC, burst, burst_len),
+ burst_len, "failed to generate burst of crypto ops");
- /* Set crypto operation data parameters */
- rte_crypto_op_attach_sym_session(ut_params->op, ut_params->sess);
+ /* Generate an operation for each mbuf in burst */
+ for (i = 0; i < burst_len; i++) {
+ struct rte_mbuf *m = rte_pktmbuf_alloc(ts_params->mbuf_pool);
- struct rte_crypto_sym_op *sym_op = ut_params->op->sym;
+ TEST_ASSERT_NOT_NULL(m, "Failed to allocate mbuf");
- sym_op->m_src = ut_params->ibuf;
+ unsigned *data = (unsigned *)rte_pktmbuf_append(m,
+ sizeof(unsigned));
+ *data = i;
- sym_op->cipher.data.offset = 0;
- sym_op->cipher.data.length = QUOTE_512_BYTES;
+ rte_crypto_op_attach_sym_session(burst[i], ut_params->sess);
- 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);
+ burst[i]->sym->m_src = m;
+ }
/* Process crypto operation */
- ut_params->op = process_crypto_request(ts_params->valid_devs[0],
- ut_params->op);
- TEST_ASSERT_NOT_NULL(ut_params->op, "no crypto operation returned");
+ TEST_ASSERT_EQUAL(rte_cryptodev_enqueue_burst(ts_params->valid_devs[0],
+ 0, burst, burst_len),
+ burst_len,
+ "Error enqueuing burst");
- TEST_ASSERT_EQUAL(ut_params->op->status, RTE_CRYPTO_OP_STATUS_SUCCESS,
- "crypto operation processing failed");
+ TEST_ASSERT_EQUAL(rte_cryptodev_dequeue_burst(ts_params->valid_devs[0],
+ 0, burst_dequeued, burst_len),
+ burst_len,
+ "Error dequeuing burst");
- /* Validate obuf */
- TEST_ASSERT_BUFFERS_ARE_EQUAL(
- rte_pktmbuf_mtod(ut_params->op->sym->m_src, uint8_t *),
- 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");
+
+ for (i = 0; i < burst_len; i++) {
+ TEST_ASSERT_EQUAL(
+ *rte_pktmbuf_mtod(burst[i]->sym->m_src, uint32_t *),
+ *rte_pktmbuf_mtod(burst_dequeued[i]->sym->m_src,
+ uint32_t *),
+ "data not as expected");
+
+ rte_pktmbuf_free(burst[i]->sym->m_src);
+ rte_crypto_op_free(burst[i]);
+ }
return TEST_SUCCESS;
}
+static void
+generate_gmac_large_plaintext(uint8_t *data)
+{
+ uint16_t i;
+
+ for (i = 32; i < GMAC_LARGE_PLAINTEXT_LENGTH; i += 32)
+ memcpy(&data[i], &data[0], 32);
+}
+
static int
-test_null_auth_cipher_operation(void)
+create_gmac_operation(enum rte_crypto_auth_operation op,
+ const struct gmac_test_data *tdata)
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
- uint8_t *digest;
-
- /* Verify the capabilities */
- struct rte_cryptodev_sym_capability_idx cap_idx;
- cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH;
- cap_idx.algo.auth = RTE_CRYPTO_AUTH_NULL;
- if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
- &cap_idx) == NULL)
- return -ENOTSUP;
- cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
- cap_idx.algo.cipher = RTE_CRYPTO_CIPHER_NULL;
- if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
- &cap_idx) == NULL)
- return -ENOTSUP;
-
- /* 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;
-
- ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_CIPHER_NULL;
- ut_params->cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
-
- /* Setup HMAC Parameters */
- ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
- ut_params->auth_xform.next = &ut_params->cipher_xform;
-
- ut_params->auth_xform.auth.algo = RTE_CRYPTO_AUTH_NULL;
- ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
-
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
+ struct rte_crypto_sym_op *sym_op;
- /* Create Crypto session*/
- rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
- ut_params->sess, &ut_params->cipher_xform,
- ts_params->session_priv_mpool);
- TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
+ uint32_t plaintext_pad_len = RTE_ALIGN_CEIL(tdata->plaintext.len, 16);
/* Generate Crypto op data structure */
ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool,
TEST_ASSERT_NOT_NULL(ut_params->op,
"Failed to allocate symmetric crypto operation struct");
- /* Set crypto operation data parameters */
- rte_crypto_op_attach_sym_session(ut_params->op, ut_params->sess);
+ sym_op = ut_params->op->sym;
- struct rte_crypto_sym_op *sym_op = ut_params->op->sym;
+ sym_op->auth.digest.data = (uint8_t *)rte_pktmbuf_append(
+ ut_params->ibuf, tdata->gmac_tag.len);
+ TEST_ASSERT_NOT_NULL(sym_op->auth.digest.data,
+ "no room to append digest");
- sym_op->m_src = ut_params->ibuf;
+ sym_op->auth.digest.phys_addr = rte_pktmbuf_iova_offset(
+ ut_params->ibuf, plaintext_pad_len);
- sym_op->cipher.data.offset = 0;
- sym_op->cipher.data.length = QUOTE_512_BYTES;
-
- 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],
- ut_params->op);
- TEST_ASSERT_NOT_NULL(ut_params->op, "no crypto operation returned");
-
- TEST_ASSERT_EQUAL(ut_params->op->status, RTE_CRYPTO_OP_STATUS_SUCCESS,
- "crypto operation processing failed");
-
- /* Validate obuf */
- TEST_ASSERT_BUFFERS_ARE_EQUAL(
- rte_pktmbuf_mtod(ut_params->op->sym->m_src, uint8_t *),
- 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;
-}
-
-
-static int
-test_null_invalid_operation(void)
-{
- struct crypto_testsuite_params *ts_params = &testsuite_params;
- struct crypto_unittest_params *ut_params = &unittest_params;
- int ret;
-
- /* This test is for NULL PMD only */
- if (gbl_driver_id != rte_cryptodev_driver_id_get(
- RTE_STR(CRYPTODEV_NAME_NULL_PMD)))
- return -ENOTSUP;
-
- /* Setup Cipher Parameters */
- ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
- ut_params->cipher_xform.next = NULL;
-
- ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_CIPHER_AES_CBC;
- ut_params->cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
-
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
-
- /* Create Crypto session*/
- ret = rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
- ut_params->sess, &ut_params->cipher_xform,
- ts_params->session_priv_mpool);
- TEST_ASSERT(ret < 0,
- "Session creation succeeded unexpectedly");
-
-
- /* Setup HMAC Parameters */
- ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
- ut_params->auth_xform.next = NULL;
-
- ut_params->auth_xform.auth.algo = RTE_CRYPTO_AUTH_SHA1_HMAC;
- ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
-
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
-
- /* Create Crypto session*/
- ret = rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
- ut_params->sess, &ut_params->auth_xform,
- ts_params->session_priv_mpool);
- TEST_ASSERT(ret < 0,
- "Session creation succeeded unexpectedly");
-
- return TEST_SUCCESS;
-}
-
-
-#define NULL_BURST_LENGTH (32)
-
-static int
-test_null_burst_operation(void)
-{
- struct crypto_testsuite_params *ts_params = &testsuite_params;
- struct crypto_unittest_params *ut_params = &unittest_params;
-
- unsigned i, burst_len = NULL_BURST_LENGTH;
-
- struct rte_crypto_op *burst[NULL_BURST_LENGTH] = { NULL };
- struct rte_crypto_op *burst_dequeued[NULL_BURST_LENGTH] = { NULL };
-
- /* This test is for NULL PMD only */
- if (gbl_driver_id != rte_cryptodev_driver_id_get(
- RTE_STR(CRYPTODEV_NAME_NULL_PMD)))
- return -ENOTSUP;
-
- /* Setup Cipher Parameters */
- ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
- ut_params->cipher_xform.next = &ut_params->auth_xform;
-
- ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_CIPHER_NULL;
- ut_params->cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
-
- /* Setup HMAC Parameters */
- ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
- ut_params->auth_xform.next = NULL;
-
- ut_params->auth_xform.auth.algo = RTE_CRYPTO_AUTH_NULL;
- ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
-
- ut_params->sess = rte_cryptodev_sym_session_create(
- ts_params->session_mpool);
-
- /* Create Crypto session*/
- rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
- ut_params->sess, &ut_params->cipher_xform,
- ts_params->session_priv_mpool);
- TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
-
- TEST_ASSERT_EQUAL(rte_crypto_op_bulk_alloc(ts_params->op_mpool,
- RTE_CRYPTO_OP_TYPE_SYMMETRIC, burst, burst_len),
- burst_len, "failed to generate burst of crypto ops");
-
- /* Generate an operation for each mbuf in burst */
- for (i = 0; i < burst_len; i++) {
- struct rte_mbuf *m = rte_pktmbuf_alloc(ts_params->mbuf_pool);
-
- TEST_ASSERT_NOT_NULL(m, "Failed to allocate mbuf");
-
- unsigned *data = (unsigned *)rte_pktmbuf_append(m,
- sizeof(unsigned));
- *data = i;
-
- rte_crypto_op_attach_sym_session(burst[i], ut_params->sess);
-
- burst[i]->sym->m_src = m;
- }
-
- /* Process crypto operation */
- TEST_ASSERT_EQUAL(rte_cryptodev_enqueue_burst(ts_params->valid_devs[0],
- 0, burst, burst_len),
- burst_len,
- "Error enqueuing burst");
-
- TEST_ASSERT_EQUAL(rte_cryptodev_dequeue_burst(ts_params->valid_devs[0],
- 0, burst_dequeued, burst_len),
- burst_len,
- "Error dequeuing burst");
-
-
- for (i = 0; i < burst_len; i++) {
- TEST_ASSERT_EQUAL(
- *rte_pktmbuf_mtod(burst[i]->sym->m_src, uint32_t *),
- *rte_pktmbuf_mtod(burst_dequeued[i]->sym->m_src,
- uint32_t *),
- "data not as expected");
-
- rte_pktmbuf_free(burst[i]->sym->m_src);
- rte_crypto_op_free(burst[i]);
- }
-
- return TEST_SUCCESS;
-}
-
-static void
-generate_gmac_large_plaintext(uint8_t *data)
-{
- uint16_t i;
-
- for (i = 32; i < GMAC_LARGE_PLAINTEXT_LENGTH; i += 32)
- memcpy(&data[i], &data[0], 32);
-}
-
-static int
-create_gmac_operation(enum rte_crypto_auth_operation op,
- const struct gmac_test_data *tdata)
-{
- struct crypto_testsuite_params *ts_params = &testsuite_params;
- struct crypto_unittest_params *ut_params = &unittest_params;
- struct rte_crypto_sym_op *sym_op;
-
- uint32_t plaintext_pad_len = RTE_ALIGN_CEIL(tdata->plaintext.len, 16);
-
- /* Generate Crypto op data structure */
- ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool,
- RTE_CRYPTO_OP_TYPE_SYMMETRIC);
- TEST_ASSERT_NOT_NULL(ut_params->op,
- "Failed to allocate symmetric crypto operation struct");
-
- sym_op = ut_params->op->sym;
-
- sym_op->auth.digest.data = (uint8_t *)rte_pktmbuf_append(
- ut_params->ibuf, tdata->gmac_tag.len);
- TEST_ASSERT_NOT_NULL(sym_op->auth.digest.data,
- "no room to append digest");
-
- 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);
- debug_hexdump(stdout, "digest:",
- sym_op->auth.digest.data,
- tdata->gmac_tag.len);
- }
+ if (op == RTE_CRYPTO_AUTH_OP_VERIFY) {
+ rte_memcpy(sym_op->auth.digest.data, tdata->gmac_tag.data,
+ tdata->gmac_tag.len);
+ debug_hexdump(stdout, "digest:",
+ sym_op->auth.digest.data,
+ tdata->gmac_tag.len);
+ }
uint8_t *iv_ptr = rte_crypto_op_ctod_offset(ut_params->op,
uint8_t *, IV_OFFSET);
static const struct test_crypto_vector
aes128cbc_hmac_sha1_aad_test_vector = {
.crypto_algo = RTE_CRYPTO_CIPHER_AES_CBC,
- .cipher_offset = 12,
+ .cipher_offset = 8,
.cipher_len = 496,
.cipher_key = {
.data = {
},
.digest = {
.data = {
- 0x1F, 0x6A, 0xD2, 0x8B, 0x4B, 0xB3, 0xC0, 0x9E,
- 0x86, 0x9B, 0x3A, 0xF2, 0x00, 0x5B, 0x4F, 0x08,
- 0x62, 0x8D, 0x62, 0x65
+ 0x6D, 0xF3, 0x50, 0x79, 0x7A, 0x2A, 0xAC, 0x7F,
+ 0xA6, 0xF0, 0xC6, 0x38, 0x1F, 0xA4, 0xDD, 0x9B,
+ 0x62, 0x0F, 0xFB, 0x10
},
.len = 20
}
&aes128cbc_hmac_sha1_aad_test_vector);
}
+static int
+test_chacha20_poly1305_encrypt_test_case_rfc8439(void)
+{
+ return test_authenticated_encryption(&chacha20_poly1305_case_rfc8439);
+}
+
+static int
+test_chacha20_poly1305_decrypt_test_case_rfc8439(void)
+{
+ return test_authenticated_decryption(&chacha20_poly1305_case_rfc8439);
+}
+
#ifdef RTE_LIBRTE_PMD_CRYPTO_SCHEDULER
/* global AESNI slave IDs for the scheduler test */
TEST_CASE_ST(ut_setup, ut_teardown,
test_AES_GCM_auth_encryption_test_case_256_5),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GCM_auth_encryption_test_case_256_6),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GCM_auth_encryption_test_case_256_7),
-
- /** AES GCM Authenticated Decryption 256 bits key */
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GCM_auth_decryption_test_case_256_1),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GCM_auth_decryption_test_case_256_2),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GCM_auth_decryption_test_case_256_3),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GCM_auth_decryption_test_case_256_4),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GCM_auth_decryption_test_case_256_5),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GCM_auth_decryption_test_case_256_6),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GCM_auth_decryption_test_case_256_7),
-
- /** AES GCM Authenticated Encryption big aad size */
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GCM_auth_encryption_test_case_aad_1),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GCM_auth_encryption_test_case_aad_2),
-
- /** AES GCM Authenticated Decryption big aad size */
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GCM_auth_decryption_test_case_aad_1),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GCM_auth_decryption_test_case_aad_2),
-
- /** Out of place tests */
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GCM_authenticated_encryption_oop_test_case_1),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GCM_authenticated_decryption_oop_test_case_1),
-
- /** Session-less tests */
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GCM_authenticated_encryption_sessionless_test_case_1),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GCM_authenticated_decryption_sessionless_test_case_1),
-
- /** AES GMAC Authentication */
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GMAC_authentication_test_case_1),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GMAC_authentication_verify_test_case_1),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GMAC_authentication_test_case_2),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GMAC_authentication_verify_test_case_2),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GMAC_authentication_test_case_3),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GMAC_authentication_verify_test_case_3),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GMAC_authentication_test_case_4),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GMAC_authentication_verify_test_case_4),
-
- /** SNOW 3G encrypt only (UEA2) */
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_encryption_test_case_1),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_encryption_test_case_2),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_encryption_test_case_3),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_encryption_test_case_4),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_encryption_test_case_5),
-
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_encryption_test_case_1_oop),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_encryption_test_case_1_oop_sgl),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_encryption_test_case_1_offset_oop),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_decryption_test_case_1_oop),
-
- /** SNOW 3G generate auth, then encrypt (UEA2) */
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_auth_cipher_test_case_1),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_auth_cipher_test_case_2),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_auth_cipher_test_case_2_oop),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_auth_cipher_part_digest_enc),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_auth_cipher_part_digest_enc_oop),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_auth_cipher_test_case_3_sgl),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_auth_cipher_test_case_3_oop_sgl),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_auth_cipher_part_digest_enc_sgl),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_auth_cipher_part_digest_enc_oop_sgl),
-
- /** SNOW 3G decrypt (UEA2), then verify auth */
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_auth_cipher_verify_test_case_1),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_auth_cipher_verify_test_case_2),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_auth_cipher_verify_test_case_2_oop),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_auth_cipher_verify_part_digest_enc),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_auth_cipher_verify_part_digest_enc_oop),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_auth_cipher_verify_test_case_3_sgl),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_auth_cipher_verify_test_case_3_oop_sgl),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_auth_cipher_verify_part_digest_enc_sgl),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_auth_cipher_verify_part_digest_enc_oop_sgl),
-
- /** SNOW 3G decrypt only (UEA2) */
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_decryption_test_case_1),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_decryption_test_case_2),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_decryption_test_case_3),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_decryption_test_case_4),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_decryption_test_case_5),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_decryption_with_digest_test_case_1),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_hash_generate_test_case_1),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_hash_generate_test_case_2),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_hash_generate_test_case_3),
- /* Tests with buffers which length is not byte-aligned */
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_hash_generate_test_case_4),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_hash_generate_test_case_5),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_hash_generate_test_case_6),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_hash_verify_test_case_1),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_hash_verify_test_case_2),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_hash_verify_test_case_3),
- /* Tests with buffers which length is not byte-aligned */
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_hash_verify_test_case_4),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_hash_verify_test_case_5),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_hash_verify_test_case_6),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_cipher_auth_test_case_1),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_auth_cipher_with_digest_test_case_1),
-
- /** ZUC encrypt only (EEA3) */
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_zuc_encryption_test_case_1),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_zuc_encryption_test_case_2),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_zuc_encryption_test_case_3),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_zuc_encryption_test_case_4),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_zuc_encryption_test_case_5),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_zuc_encryption_test_case_6_sgl),
-
- /** ZUC authenticate (EIA3) */
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_zuc_hash_generate_test_case_1),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_zuc_hash_generate_test_case_2),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_zuc_hash_generate_test_case_3),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_zuc_hash_generate_test_case_4),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_zuc_hash_generate_test_case_5),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_zuc_hash_generate_test_case_6),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_zuc_hash_generate_test_case_7),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_zuc_hash_generate_test_case_8),
-
- /** ZUC alg-chain (EEA3/EIA3) */
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_zuc_cipher_auth_test_case_1),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_zuc_cipher_auth_test_case_2),
-
- /** ZUC generate auth, then encrypt (EEA3) */
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_zuc_auth_cipher_test_case_1),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_zuc_auth_cipher_test_case_1_oop),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_zuc_auth_cipher_test_case_1_sgl),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_zuc_auth_cipher_test_case_1_oop_sgl),
-
- /** ZUC decrypt (EEA3), then verify auth */
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_zuc_auth_cipher_verify_test_case_1),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_zuc_auth_cipher_verify_test_case_1_oop),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_zuc_auth_cipher_verify_test_case_1_sgl),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_zuc_auth_cipher_verify_test_case_1_oop_sgl),
-
- /** HMAC_MD5 Authentication */
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_MD5_HMAC_generate_case_1),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_MD5_HMAC_verify_case_1),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_MD5_HMAC_generate_case_2),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_MD5_HMAC_verify_case_2),
-
- /** KASUMI hash only (UIA1) */
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_hash_generate_test_case_1),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_hash_generate_test_case_2),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_hash_generate_test_case_3),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_hash_generate_test_case_4),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_hash_generate_test_case_5),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_hash_generate_test_case_6),
-
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_hash_verify_test_case_1),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_hash_verify_test_case_2),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_hash_verify_test_case_3),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_hash_verify_test_case_4),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_hash_verify_test_case_5),
-
- /** KASUMI encrypt only (UEA1) */
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_encryption_test_case_1),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_encryption_test_case_1_sgl),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_encryption_test_case_1_oop),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_encryption_test_case_1_oop_sgl),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_encryption_test_case_2),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_encryption_test_case_3),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_encryption_test_case_4),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_encryption_test_case_5),
-
- /** KASUMI decrypt only (UEA1) */
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_decryption_test_case_1),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_decryption_test_case_2),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_decryption_test_case_3),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_decryption_test_case_4),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_decryption_test_case_5),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_decryption_test_case_1_oop),
-
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_cipher_auth_test_case_1),
-
- /** KASUMI generate auth, then encrypt (F8) */
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_auth_cipher_test_case_1),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_auth_cipher_test_case_2),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_auth_cipher_test_case_2_oop),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_auth_cipher_test_case_2_sgl),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_auth_cipher_test_case_2_oop_sgl),
-
- /** KASUMI decrypt (F8), then verify auth */
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_auth_cipher_verify_test_case_1),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_auth_cipher_verify_test_case_2),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_auth_cipher_verify_test_case_2_oop),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_auth_cipher_verify_test_case_2_sgl),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_auth_cipher_verify_test_case_2_oop_sgl),
-
- /** ESN Testcase */
- TEST_CASE_ST(ut_setup, ut_teardown,
- auth_encrypt_AES128CBC_HMAC_SHA1_esn_check),
- TEST_CASE_ST(ut_setup, ut_teardown,
- auth_decrypt_AES128CBC_HMAC_SHA1_esn_check),
-
- /** Negative tests */
- TEST_CASE_ST(ut_setup, ut_teardown,
- authentication_verify_HMAC_SHA1_fail_data_corrupt),
- TEST_CASE_ST(ut_setup, ut_teardown,
- authentication_verify_HMAC_SHA1_fail_tag_corrupt),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GCM_auth_encryption_fail_iv_corrupt),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GCM_auth_encryption_fail_in_data_corrupt),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GCM_auth_encryption_fail_out_data_corrupt),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GCM_auth_encryption_fail_aad_len_corrupt),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GCM_auth_encryption_fail_aad_corrupt),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GCM_auth_encryption_fail_tag_corrupt),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GCM_auth_decryption_fail_iv_corrupt),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GCM_auth_decryption_fail_in_data_corrupt),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GCM_auth_decryption_fail_out_data_corrupt),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GCM_auth_decryption_fail_aad_len_corrupt),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GCM_auth_decryption_fail_aad_corrupt),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GCM_auth_decryption_fail_tag_corrupt),
- TEST_CASE_ST(ut_setup, ut_teardown,
- authentication_verify_AES128_GMAC_fail_data_corrupt),
- TEST_CASE_ST(ut_setup, ut_teardown,
- authentication_verify_AES128_GMAC_fail_tag_corrupt),
- TEST_CASE_ST(ut_setup, ut_teardown,
- auth_decryption_AES128CBC_HMAC_SHA1_fail_data_corrupt),
- TEST_CASE_ST(ut_setup, ut_teardown,
- auth_decryption_AES128CBC_HMAC_SHA1_fail_tag_corrupt),
-
- /** Mixed CIPHER + HASH algorithms */
- /** AUTH AES CMAC + CIPHER AES CTR */
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_aes_cmac_aes_ctr_digest_enc_test_case_1),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_aes_cmac_aes_ctr_digest_enc_test_case_1_oop),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_aes_cmac_aes_ctr_digest_enc_test_case_1_sgl),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_aes_cmac_aes_ctr_digest_enc_test_case_1_oop_sgl),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_verify_aes_cmac_aes_ctr_digest_enc_test_case_1),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_verify_aes_cmac_aes_ctr_digest_enc_test_case_1_oop),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_verify_aes_cmac_aes_ctr_digest_enc_test_case_1_sgl),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_verify_aes_cmac_aes_ctr_digest_enc_test_case_1_oop_sgl),
-
- /** AUTH ZUC + CIPHER SNOW3G */
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_auth_zuc_cipher_snow_test_case_1),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_verify_auth_zuc_cipher_snow_test_case_1),
- /** AUTH AES CMAC + CIPHER SNOW3G */
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_auth_aes_cmac_cipher_snow_test_case_1),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_verify_auth_aes_cmac_cipher_snow_test_case_1),
- /** AUTH ZUC + CIPHER AES CTR */
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_auth_zuc_cipher_aes_ctr_test_case_1),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_verify_auth_zuc_cipher_aes_ctr_test_case_1),
- /** AUTH SNOW3G + CIPHER AES CTR */
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_auth_snow_cipher_aes_ctr_test_case_1),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_verify_auth_snow_cipher_aes_ctr_test_case_1),
- /** AUTH SNOW3G + CIPHER ZUC */
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_auth_snow_cipher_zuc_test_case_1),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_verify_auth_snow_cipher_zuc_test_case_1),
- /** AUTH AES CMAC + CIPHER ZUC */
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_auth_aes_cmac_cipher_zuc_test_case_1),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_verify_auth_aes_cmac_cipher_zuc_test_case_1),
-
- /** AUTH NULL + CIPHER SNOW3G */
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_auth_null_cipher_snow_test_case_1),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_verify_auth_null_cipher_snow_test_case_1),
- /** AUTH NULL + CIPHER ZUC */
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_auth_null_cipher_zuc_test_case_1),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_verify_auth_null_cipher_zuc_test_case_1),
- /** AUTH SNOW3G + CIPHER NULL */
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_auth_snow_cipher_null_test_case_1),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_verify_auth_snow_cipher_null_test_case_1),
- /** AUTH ZUC + CIPHER NULL */
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_auth_zuc_cipher_null_test_case_1),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_verify_auth_zuc_cipher_null_test_case_1),
- /** AUTH NULL + CIPHER AES CTR */
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_auth_null_cipher_aes_ctr_test_case_1),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_verify_auth_null_cipher_aes_ctr_test_case_1),
- /** AUTH AES CMAC + CIPHER NULL */
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_auth_aes_cmac_cipher_null_test_case_1),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_verify_auth_aes_cmac_cipher_null_test_case_1),
-
-#ifdef RTE_LIBRTE_SECURITY
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_PDCP_PROTO_all),
-#endif
- TEST_CASES_END() /**< NULL terminate unit test array */
- }
-};
-
-static struct unit_test_suite cryptodev_virtio_testsuite = {
- .suite_name = "Crypto VIRTIO Unit Test Suite",
- .setup = testsuite_setup,
- .teardown = testsuite_teardown,
- .unit_test_cases = {
- TEST_CASE_ST(ut_setup, ut_teardown, test_AES_cipheronly_all),
-
- TEST_CASES_END() /**< NULL terminate unit test array */
- }
-};
-
-static struct unit_test_suite cryptodev_caam_jr_testsuite = {
- .suite_name = "Crypto CAAM JR Unit Test Suite",
- .setup = testsuite_setup,
- .teardown = testsuite_teardown,
- .unit_test_cases = {
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_device_configure_invalid_dev_id),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_multi_session),
-
- TEST_CASE_ST(ut_setup, ut_teardown, test_AES_chain_all),
- TEST_CASE_ST(ut_setup, ut_teardown, test_3DES_chain_all),
- TEST_CASE_ST(ut_setup, ut_teardown, test_AES_cipheronly_all),
- TEST_CASE_ST(ut_setup, ut_teardown, test_3DES_cipheronly_all),
- TEST_CASE_ST(ut_setup, ut_teardown, test_authonly_all),
-
- TEST_CASES_END() /**< NULL terminate unit test array */
- }
-};
-
-static struct unit_test_suite cryptodev_armv8_testsuite = {
- .suite_name = "Crypto Device ARMv8 Unit Test Suite",
- .setup = testsuite_setup,
- .teardown = testsuite_teardown,
- .unit_test_cases = {
- TEST_CASE_ST(ut_setup, ut_teardown, test_AES_chain_all),
-
- /** Negative tests */
- TEST_CASE_ST(ut_setup, ut_teardown,
- auth_decryption_AES128CBC_HMAC_SHA1_fail_data_corrupt),
- TEST_CASE_ST(ut_setup, ut_teardown,
- auth_decryption_AES128CBC_HMAC_SHA1_fail_tag_corrupt),
-
- TEST_CASES_END() /**< NULL terminate unit test array */
- }
-};
-
-static struct unit_test_suite cryptodev_mrvl_testsuite = {
- .suite_name = "Crypto Device Marvell Component Test Suite",
- .setup = testsuite_setup,
- .teardown = testsuite_teardown,
- .unit_test_cases = {
- TEST_CASE_ST(ut_setup, ut_teardown, test_multi_session),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_multi_session_random_usage),
- TEST_CASE_ST(ut_setup, ut_teardown, test_AES_chain_all),
- TEST_CASE_ST(ut_setup, ut_teardown, test_AES_cipheronly_all),
- TEST_CASE_ST(ut_setup, ut_teardown, test_authonly_all),
- TEST_CASE_ST(ut_setup, ut_teardown, test_3DES_chain_all),
- TEST_CASE_ST(ut_setup, ut_teardown, test_3DES_cipheronly_all),
-
- /** Negative tests */
- TEST_CASE_ST(ut_setup, ut_teardown,
- authentication_verify_HMAC_SHA1_fail_data_corrupt),
- TEST_CASE_ST(ut_setup, ut_teardown,
- authentication_verify_HMAC_SHA1_fail_tag_corrupt),
- TEST_CASE_ST(ut_setup, ut_teardown,
- auth_decryption_AES128CBC_HMAC_SHA1_fail_data_corrupt),
- TEST_CASE_ST(ut_setup, ut_teardown,
- auth_decryption_AES128CBC_HMAC_SHA1_fail_tag_corrupt),
-
- TEST_CASES_END() /**< NULL terminate unit test array */
- }
-};
-
-static struct unit_test_suite cryptodev_ccp_testsuite = {
- .suite_name = "Crypto Device CCP Unit Test Suite",
- .setup = testsuite_setup,
- .teardown = testsuite_teardown,
- .unit_test_cases = {
- TEST_CASE_ST(ut_setup, ut_teardown, test_multi_session),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_multi_session_random_usage),
- TEST_CASE_ST(ut_setup, ut_teardown, test_AES_chain_all),
- TEST_CASE_ST(ut_setup, ut_teardown, test_AES_cipheronly_all),
- TEST_CASE_ST(ut_setup, ut_teardown, test_3DES_chain_all),
- TEST_CASE_ST(ut_setup, ut_teardown, test_3DES_cipheronly_all),
- TEST_CASE_ST(ut_setup, ut_teardown, test_authonly_all),
-
- /** Negative tests */
- TEST_CASE_ST(ut_setup, ut_teardown,
- authentication_verify_HMAC_SHA1_fail_data_corrupt),
- TEST_CASE_ST(ut_setup, ut_teardown,
- authentication_verify_HMAC_SHA1_fail_tag_corrupt),
- TEST_CASE_ST(ut_setup, ut_teardown,
- auth_decryption_AES128CBC_HMAC_SHA1_fail_data_corrupt),
- TEST_CASE_ST(ut_setup, ut_teardown,
- auth_decryption_AES128CBC_HMAC_SHA1_fail_tag_corrupt),
-
- TEST_CASES_END() /**< NULL terminate unit test array */
- }
-};
-
-static struct unit_test_suite cryptodev_octeontx_testsuite = {
- .suite_name = "Crypto Device OCTEONTX Unit Test Suite",
- .setup = testsuite_setup,
- .teardown = testsuite_teardown,
- .unit_test_cases = {
- TEST_CASE_ST(ut_setup, ut_teardown, test_AES_chain_all),
- TEST_CASE_ST(ut_setup, ut_teardown, test_AES_cipheronly_all),
- TEST_CASE_ST(ut_setup, ut_teardown, test_3DES_chain_all),
- TEST_CASE_ST(ut_setup, ut_teardown, test_3DES_cipheronly_all),
- TEST_CASE_ST(ut_setup, ut_teardown, test_authonly_all),
+ test_AES_GCM_auth_encryption_test_case_256_6),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_auth_encryption_test_case_256_7),
- /** AES GCM Authenticated Encryption */
+ /** AES GCM Authenticated Decryption 256 bits key */
TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GCM_authenticated_encryption_test_case_1),
+ test_AES_GCM_auth_decryption_test_case_256_1),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GCM_authenticated_encryption_test_case_2),
+ test_AES_GCM_auth_decryption_test_case_256_2),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GCM_authenticated_encryption_test_case_3),
+ test_AES_GCM_auth_decryption_test_case_256_3),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GCM_authenticated_encryption_test_case_4),
+ test_AES_GCM_auth_decryption_test_case_256_4),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GCM_authenticated_encryption_test_case_5),
+ test_AES_GCM_auth_decryption_test_case_256_5),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GCM_authenticated_encryption_test_case_6),
+ test_AES_GCM_auth_decryption_test_case_256_6),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GCM_authenticated_encryption_test_case_7),
+ test_AES_GCM_auth_decryption_test_case_256_7),
- /** AES GCM Authenticated Decryption */
+ /** AES GCM Authenticated Encryption big aad size */
TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GCM_authenticated_decryption_test_case_1),
+ test_AES_GCM_auth_encryption_test_case_aad_1),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GCM_authenticated_decryption_test_case_2),
+ test_AES_GCM_auth_encryption_test_case_aad_2),
+
+ /** AES GCM Authenticated Decryption big aad size */
TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GCM_authenticated_decryption_test_case_3),
+ test_AES_GCM_auth_decryption_test_case_aad_1),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GCM_authenticated_decryption_test_case_4),
+ test_AES_GCM_auth_decryption_test_case_aad_2),
+
+ /** Out of place tests */
TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GCM_authenticated_decryption_test_case_5),
+ test_AES_GCM_authenticated_encryption_oop_test_case_1),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GCM_authenticated_decryption_test_case_6),
+ test_AES_GCM_authenticated_decryption_oop_test_case_1),
+
+ /** Session-less tests */
TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GCM_authenticated_decryption_test_case_7),
+ test_AES_GCM_authenticated_encryption_sessionless_test_case_1),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GCM_authenticated_decryption_sessionless_test_case_1),
+
/** AES GMAC Authentication */
TEST_CASE_ST(ut_setup, ut_teardown,
test_AES_GMAC_authentication_test_case_1),
test_AES_GMAC_authentication_test_case_3),
TEST_CASE_ST(ut_setup, ut_teardown,
test_AES_GMAC_authentication_verify_test_case_3),
-
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GMAC_authentication_test_case_4),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_AES_GMAC_authentication_verify_test_case_4),
+ /** Chacha20-Poly1305 */
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_chacha20_poly1305_encrypt_test_case_rfc8439),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_chacha20_poly1305_decrypt_test_case_rfc8439),
/** SNOW 3G encrypt only (UEA2) */
TEST_CASE_ST(ut_setup, ut_teardown,
test_snow3g_encryption_test_case_1),
TEST_CASE_ST(ut_setup, ut_teardown,
test_snow3g_encryption_test_case_1_oop),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_snow3g_encryption_test_case_1_oop_sgl),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_snow3g_encryption_test_case_1_offset_oop),
TEST_CASE_ST(ut_setup, ut_teardown,
test_snow3g_decryption_test_case_1_oop),
+
+ /** SNOW 3G generate auth, then encrypt (UEA2) */
TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_encryption_test_case_1_oop_sgl),
+ test_snow3g_auth_cipher_test_case_1),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_snow3g_auth_cipher_test_case_2),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_snow3g_auth_cipher_test_case_2_oop),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_snow3g_auth_cipher_part_digest_enc),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_snow3g_auth_cipher_part_digest_enc_oop),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_snow3g_auth_cipher_test_case_3_sgl),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_snow3g_auth_cipher_test_case_3_oop_sgl),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_snow3g_auth_cipher_part_digest_enc_sgl),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_snow3g_auth_cipher_part_digest_enc_oop_sgl),
+
+ /** SNOW 3G decrypt (UEA2), then verify auth */
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_snow3g_auth_cipher_verify_test_case_1),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_snow3g_auth_cipher_verify_test_case_2),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_snow3g_auth_cipher_verify_test_case_2_oop),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_snow3g_auth_cipher_verify_part_digest_enc),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_snow3g_auth_cipher_verify_part_digest_enc_oop),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_snow3g_auth_cipher_verify_test_case_3_sgl),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_snow3g_auth_cipher_verify_test_case_3_oop_sgl),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_snow3g_auth_cipher_verify_part_digest_enc_sgl),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_snow3g_auth_cipher_verify_part_digest_enc_oop_sgl),
/** SNOW 3G decrypt only (UEA2) */
TEST_CASE_ST(ut_setup, ut_teardown,
test_snow3g_decryption_test_case_4),
TEST_CASE_ST(ut_setup, ut_teardown,
test_snow3g_decryption_test_case_5),
-
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_snow3g_decryption_with_digest_test_case_1),
TEST_CASE_ST(ut_setup, ut_teardown,
test_snow3g_hash_generate_test_case_1),
TEST_CASE_ST(ut_setup, ut_teardown,
test_snow3g_hash_generate_test_case_2),
TEST_CASE_ST(ut_setup, ut_teardown,
test_snow3g_hash_generate_test_case_3),
+ /* Tests with buffers which length is not byte-aligned */
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_snow3g_hash_generate_test_case_4),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_snow3g_hash_generate_test_case_5),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_snow3g_hash_generate_test_case_6),
TEST_CASE_ST(ut_setup, ut_teardown,
test_snow3g_hash_verify_test_case_1),
TEST_CASE_ST(ut_setup, ut_teardown,
test_snow3g_hash_verify_test_case_2),
TEST_CASE_ST(ut_setup, ut_teardown,
test_snow3g_hash_verify_test_case_3),
+ /* Tests with buffers which length is not byte-aligned */
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_snow3g_hash_verify_test_case_4),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_snow3g_hash_verify_test_case_5),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_snow3g_hash_verify_test_case_6),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_snow3g_cipher_auth_test_case_1),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_snow3g_auth_cipher_with_digest_test_case_1),
/** ZUC encrypt only (EEA3) */
TEST_CASE_ST(ut_setup, ut_teardown,
test_zuc_encryption_test_case_4),
TEST_CASE_ST(ut_setup, ut_teardown,
test_zuc_encryption_test_case_5),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_zuc_encryption_test_case_6_sgl),
+
+ /** ZUC authenticate (EIA3) */
TEST_CASE_ST(ut_setup, ut_teardown,
test_zuc_hash_generate_test_case_1),
TEST_CASE_ST(ut_setup, ut_teardown,
TEST_CASE_ST(ut_setup, ut_teardown,
test_zuc_hash_generate_test_case_5),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_zuc_encryption_test_case_6_sgl),
-
- /** KASUMI encrypt only (UEA1) */
+ test_zuc_hash_generate_test_case_6),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_encryption_test_case_1),
+ test_zuc_hash_generate_test_case_7),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_encryption_test_case_2),
+ test_zuc_hash_generate_test_case_8),
+
+ /** ZUC alg-chain (EEA3/EIA3) */
TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_encryption_test_case_3),
+ test_zuc_cipher_auth_test_case_1),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_encryption_test_case_4),
+ test_zuc_cipher_auth_test_case_2),
+
+ /** ZUC generate auth, then encrypt (EEA3) */
TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_encryption_test_case_5),
+ test_zuc_auth_cipher_test_case_1),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_encryption_test_case_1_sgl),
+ test_zuc_auth_cipher_test_case_1_oop),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_encryption_test_case_1_oop_sgl),
- /** KASUMI decrypt only (UEA1) */
+ test_zuc_auth_cipher_test_case_1_sgl),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_decryption_test_case_1),
+ test_zuc_auth_cipher_test_case_1_oop_sgl),
+
+ /** ZUC decrypt (EEA3), then verify auth */
TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_decryption_test_case_2),
+ test_zuc_auth_cipher_verify_test_case_1),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_decryption_test_case_3),
+ test_zuc_auth_cipher_verify_test_case_1_oop),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_decryption_test_case_4),
+ test_zuc_auth_cipher_verify_test_case_1_sgl),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_decryption_test_case_5),
+ test_zuc_auth_cipher_verify_test_case_1_oop_sgl),
+ /** HMAC_MD5 Authentication */
TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_encryption_test_case_1_oop),
+ test_MD5_HMAC_generate_case_1),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_decryption_test_case_1_oop),
+ test_MD5_HMAC_verify_case_1),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_MD5_HMAC_generate_case_2),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_MD5_HMAC_verify_case_2),
/** KASUMI hash only (UIA1) */
TEST_CASE_ST(ut_setup, ut_teardown,
test_kasumi_hash_generate_test_case_5),
TEST_CASE_ST(ut_setup, ut_teardown,
test_kasumi_hash_generate_test_case_6),
+
TEST_CASE_ST(ut_setup, ut_teardown,
test_kasumi_hash_verify_test_case_1),
TEST_CASE_ST(ut_setup, ut_teardown,
TEST_CASE_ST(ut_setup, ut_teardown,
test_kasumi_hash_verify_test_case_5),
- /** NULL tests */
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_null_cipher_only_operation),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_null_auth_only_operation),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_null_cipher_auth_operation),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_null_auth_cipher_operation),
-
- /** Negative tests */
+ /** KASUMI encrypt only (UEA1) */
TEST_CASE_ST(ut_setup, ut_teardown,
- authentication_verify_HMAC_SHA1_fail_data_corrupt),
+ test_kasumi_encryption_test_case_1),
TEST_CASE_ST(ut_setup, ut_teardown,
- authentication_verify_HMAC_SHA1_fail_tag_corrupt),
+ test_kasumi_encryption_test_case_1_sgl),
TEST_CASE_ST(ut_setup, ut_teardown,
- authentication_verify_AES128_GMAC_fail_data_corrupt),
+ test_kasumi_encryption_test_case_1_oop),
TEST_CASE_ST(ut_setup, ut_teardown,
- authentication_verify_AES128_GMAC_fail_tag_corrupt),
+ test_kasumi_encryption_test_case_1_oop_sgl),
TEST_CASE_ST(ut_setup, ut_teardown,
- auth_decryption_AES128CBC_HMAC_SHA1_fail_data_corrupt),
+ test_kasumi_encryption_test_case_2),
TEST_CASE_ST(ut_setup, ut_teardown,
- auth_decryption_AES128CBC_HMAC_SHA1_fail_tag_corrupt),
- TEST_CASES_END() /**< NULL terminate unit test array */
- }
-};
-
-static struct unit_test_suite cryptodev_nitrox_testsuite = {
- .suite_name = "Crypto NITROX Unit Test Suite",
- .setup = testsuite_setup,
- .teardown = testsuite_teardown,
- .unit_test_cases = {
+ test_kasumi_encryption_test_case_3),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_device_configure_invalid_dev_id),
+ test_kasumi_encryption_test_case_4),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_device_configure_invalid_queue_pair_ids),
- TEST_CASE_ST(ut_setup, ut_teardown, test_AES_chain_all),
- TEST_CASE_ST(ut_setup, ut_teardown, test_3DES_chain_all),
-
- TEST_CASES_END() /**< NULL terminate unit test array */
- }
-};
-
-static struct unit_test_suite cryptodev_octeontx2_testsuite = {
- .suite_name = "Crypto Device OCTEON TX2 Unit Test Suite",
- .setup = testsuite_setup,
- .teardown = testsuite_teardown,
- .unit_test_cases = {
- TEST_CASE_ST(ut_setup, ut_teardown, test_AES_chain_all),
- TEST_CASE_ST(ut_setup, ut_teardown, test_AES_cipheronly_all),
- TEST_CASE_ST(ut_setup, ut_teardown, test_3DES_chain_all),
- TEST_CASE_ST(ut_setup, ut_teardown, test_3DES_cipheronly_all),
- TEST_CASE_ST(ut_setup, ut_teardown, test_authonly_all),
+ test_kasumi_encryption_test_case_5),
- /** AES GCM Authenticated Encryption */
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GCM_authenticated_encryption_test_case_1),
+ /** KASUMI decrypt only (UEA1) */
TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GCM_authenticated_encryption_test_case_2),
+ test_kasumi_decryption_test_case_1),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GCM_authenticated_encryption_test_case_3),
+ test_kasumi_decryption_test_case_2),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GCM_authenticated_encryption_test_case_4),
+ test_kasumi_decryption_test_case_3),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GCM_authenticated_encryption_test_case_5),
+ test_kasumi_decryption_test_case_4),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GCM_authenticated_encryption_test_case_6),
+ test_kasumi_decryption_test_case_5),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GCM_authenticated_encryption_test_case_7),
+ test_kasumi_decryption_test_case_1_oop),
- /** AES GCM Authenticated Decryption */
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GCM_authenticated_decryption_test_case_1),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GCM_authenticated_decryption_test_case_2),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GCM_authenticated_decryption_test_case_3),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GCM_authenticated_decryption_test_case_4),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GCM_authenticated_decryption_test_case_5),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GCM_authenticated_decryption_test_case_6),
+ test_kasumi_cipher_auth_test_case_1),
+
+ /** KASUMI generate auth, then encrypt (F8) */
TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GCM_authenticated_decryption_test_case_7),
- /** AES GMAC Authentication */
+ test_kasumi_auth_cipher_test_case_1),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GMAC_authentication_test_case_1),
+ test_kasumi_auth_cipher_test_case_2),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GMAC_authentication_verify_test_case_1),
+ test_kasumi_auth_cipher_test_case_2_oop),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GMAC_authentication_test_case_2),
+ test_kasumi_auth_cipher_test_case_2_sgl),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GMAC_authentication_verify_test_case_2),
+ test_kasumi_auth_cipher_test_case_2_oop_sgl),
+
+ /** KASUMI decrypt (F8), then verify auth */
TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GMAC_authentication_test_case_3),
+ test_kasumi_auth_cipher_verify_test_case_1),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_AES_GMAC_authentication_verify_test_case_3),
-
- /** SNOW 3G encrypt only (UEA2) */
+ test_kasumi_auth_cipher_verify_test_case_2),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_encryption_test_case_1),
+ test_kasumi_auth_cipher_verify_test_case_2_oop),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_encryption_test_case_2),
+ test_kasumi_auth_cipher_verify_test_case_2_sgl),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_encryption_test_case_3),
+ test_kasumi_auth_cipher_verify_test_case_2_oop_sgl),
+
+ /** ESN Testcase */
TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_encryption_test_case_4),
+ auth_encrypt_AES128CBC_HMAC_SHA1_esn_check),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_encryption_test_case_5),
+ auth_decrypt_AES128CBC_HMAC_SHA1_esn_check),
+ /** Negative tests */
TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_encryption_test_case_1_oop),
+ authentication_verify_HMAC_SHA1_fail_data_corrupt),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_decryption_test_case_1_oop),
+ authentication_verify_HMAC_SHA1_fail_tag_corrupt),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_encryption_test_case_1_oop_sgl),
-
- /** SNOW 3G decrypt only (UEA2) */
+ test_AES_GCM_auth_encryption_fail_iv_corrupt),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_decryption_test_case_1),
+ test_AES_GCM_auth_encryption_fail_in_data_corrupt),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_decryption_test_case_2),
+ test_AES_GCM_auth_encryption_fail_out_data_corrupt),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_decryption_test_case_3),
+ test_AES_GCM_auth_encryption_fail_aad_len_corrupt),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_decryption_test_case_4),
+ test_AES_GCM_auth_encryption_fail_aad_corrupt),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_decryption_test_case_5),
-
+ test_AES_GCM_auth_encryption_fail_tag_corrupt),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_hash_generate_test_case_1),
+ test_AES_GCM_auth_decryption_fail_iv_corrupt),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_hash_generate_test_case_2),
+ test_AES_GCM_auth_decryption_fail_in_data_corrupt),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_hash_generate_test_case_3),
+ test_AES_GCM_auth_decryption_fail_out_data_corrupt),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_hash_verify_test_case_1),
+ test_AES_GCM_auth_decryption_fail_aad_len_corrupt),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_hash_verify_test_case_2),
+ test_AES_GCM_auth_decryption_fail_aad_corrupt),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_snow3g_hash_verify_test_case_3),
-
- /** ZUC encrypt only (EEA3) */
+ test_AES_GCM_auth_decryption_fail_tag_corrupt),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_zuc_encryption_test_case_1),
+ authentication_verify_AES128_GMAC_fail_data_corrupt),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_zuc_encryption_test_case_2),
+ authentication_verify_AES128_GMAC_fail_tag_corrupt),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_zuc_encryption_test_case_3),
+ auth_decryption_AES128CBC_HMAC_SHA1_fail_data_corrupt),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_zuc_encryption_test_case_4),
+ auth_decryption_AES128CBC_HMAC_SHA1_fail_tag_corrupt),
+
+ /** Mixed CIPHER + HASH algorithms */
+ /** AUTH AES CMAC + CIPHER AES CTR */
TEST_CASE_ST(ut_setup, ut_teardown,
- test_zuc_encryption_test_case_5),
+ test_aes_cmac_aes_ctr_digest_enc_test_case_1),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_zuc_hash_generate_test_case_1),
+ test_aes_cmac_aes_ctr_digest_enc_test_case_1_oop),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_zuc_hash_generate_test_case_2),
+ test_aes_cmac_aes_ctr_digest_enc_test_case_1_sgl),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_zuc_hash_generate_test_case_3),
+ test_aes_cmac_aes_ctr_digest_enc_test_case_1_oop_sgl),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_zuc_hash_generate_test_case_4),
+ test_verify_aes_cmac_aes_ctr_digest_enc_test_case_1),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_zuc_hash_generate_test_case_5),
+ test_verify_aes_cmac_aes_ctr_digest_enc_test_case_1_oop),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_zuc_encryption_test_case_6_sgl),
+ test_verify_aes_cmac_aes_ctr_digest_enc_test_case_1_sgl),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_verify_aes_cmac_aes_ctr_digest_enc_test_case_1_oop_sgl),
- /** KASUMI encrypt only (UEA1) */
+ /** AUTH ZUC + CIPHER SNOW3G */
TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_encryption_test_case_1),
+ test_auth_zuc_cipher_snow_test_case_1),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_encryption_test_case_2),
+ test_verify_auth_zuc_cipher_snow_test_case_1),
+ /** AUTH AES CMAC + CIPHER SNOW3G */
TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_encryption_test_case_3),
+ test_auth_aes_cmac_cipher_snow_test_case_1),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_encryption_test_case_4),
+ test_verify_auth_aes_cmac_cipher_snow_test_case_1),
+ /** AUTH ZUC + CIPHER AES CTR */
TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_encryption_test_case_5),
+ test_auth_zuc_cipher_aes_ctr_test_case_1),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_encryption_test_case_1_sgl),
+ test_verify_auth_zuc_cipher_aes_ctr_test_case_1),
+ /** AUTH SNOW3G + CIPHER AES CTR */
TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_encryption_test_case_1_oop_sgl),
- /** KASUMI decrypt only (UEA1) */
+ test_auth_snow_cipher_aes_ctr_test_case_1),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_decryption_test_case_1),
+ test_verify_auth_snow_cipher_aes_ctr_test_case_1),
+ /** AUTH SNOW3G + CIPHER ZUC */
TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_decryption_test_case_2),
+ test_auth_snow_cipher_zuc_test_case_1),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_decryption_test_case_3),
+ test_verify_auth_snow_cipher_zuc_test_case_1),
+ /** AUTH AES CMAC + CIPHER ZUC */
TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_decryption_test_case_4),
+ test_auth_aes_cmac_cipher_zuc_test_case_1),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_decryption_test_case_5),
+ test_verify_auth_aes_cmac_cipher_zuc_test_case_1),
+ /** AUTH NULL + CIPHER SNOW3G */
TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_encryption_test_case_1_oop),
- TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_decryption_test_case_1_oop),
-
- /** KASUMI hash only (UIA1) */
+ test_auth_null_cipher_snow_test_case_1),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_hash_generate_test_case_1),
+ test_verify_auth_null_cipher_snow_test_case_1),
+ /** AUTH NULL + CIPHER ZUC */
TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_hash_generate_test_case_2),
+ test_auth_null_cipher_zuc_test_case_1),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_hash_generate_test_case_3),
+ test_verify_auth_null_cipher_zuc_test_case_1),
+ /** AUTH SNOW3G + CIPHER NULL */
TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_hash_generate_test_case_4),
+ test_auth_snow_cipher_null_test_case_1),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_hash_generate_test_case_5),
+ test_verify_auth_snow_cipher_null_test_case_1),
+ /** AUTH ZUC + CIPHER NULL */
TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_hash_generate_test_case_6),
+ test_auth_zuc_cipher_null_test_case_1),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_hash_verify_test_case_1),
+ test_verify_auth_zuc_cipher_null_test_case_1),
+ /** AUTH NULL + CIPHER AES CTR */
TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_hash_verify_test_case_2),
+ test_auth_null_cipher_aes_ctr_test_case_1),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_hash_verify_test_case_3),
+ test_verify_auth_null_cipher_aes_ctr_test_case_1),
+ /** AUTH AES CMAC + CIPHER NULL */
TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_hash_verify_test_case_4),
+ test_auth_aes_cmac_cipher_null_test_case_1),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_kasumi_hash_verify_test_case_5),
+ test_verify_auth_aes_cmac_cipher_null_test_case_1),
+
+#ifdef RTE_LIBRTE_SECURITY
+ TEST_CASE_ST(ut_setup_security, ut_teardown,
+ test_PDCP_PROTO_all),
+ TEST_CASE_ST(ut_setup_security, ut_teardown,
+ test_DOCSIS_PROTO_all),
+#endif
+ TEST_CASES_END() /**< NULL terminate unit test array */
+ }
+};
+
+static struct unit_test_suite cryptodev_virtio_testsuite = {
+ .suite_name = "Crypto VIRTIO Unit Test Suite",
+ .setup = testsuite_setup,
+ .teardown = testsuite_teardown,
+ .unit_test_cases = {
+ TEST_CASE_ST(ut_setup, ut_teardown, test_AES_cipheronly_all),
+
+ TEST_CASES_END() /**< NULL terminate unit test array */
+ }
+};
- /** NULL tests */
+static struct unit_test_suite cryptodev_caam_jr_testsuite = {
+ .suite_name = "Crypto CAAM JR Unit Test Suite",
+ .setup = testsuite_setup,
+ .teardown = testsuite_teardown,
+ .unit_test_cases = {
TEST_CASE_ST(ut_setup, ut_teardown,
- test_null_cipher_only_operation),
+ test_device_configure_invalid_dev_id),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_multi_session),
+
+ TEST_CASE_ST(ut_setup, ut_teardown, test_AES_chain_all),
+ TEST_CASE_ST(ut_setup, ut_teardown, test_3DES_chain_all),
+ TEST_CASE_ST(ut_setup, ut_teardown, test_AES_cipheronly_all),
+ TEST_CASE_ST(ut_setup, ut_teardown, test_3DES_cipheronly_all),
+ TEST_CASE_ST(ut_setup, ut_teardown, test_authonly_all),
+
+ TEST_CASES_END() /**< NULL terminate unit test array */
+ }
+};
+
+static struct unit_test_suite cryptodev_armv8_testsuite = {
+ .suite_name = "Crypto Device ARMv8 Unit Test Suite",
+ .setup = testsuite_setup,
+ .teardown = testsuite_teardown,
+ .unit_test_cases = {
+ TEST_CASE_ST(ut_setup, ut_teardown, test_AES_chain_all),
+
+ /** Negative tests */
TEST_CASE_ST(ut_setup, ut_teardown,
- test_null_auth_only_operation),
+ auth_decryption_AES128CBC_HMAC_SHA1_fail_data_corrupt),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_null_cipher_auth_operation),
+ auth_decryption_AES128CBC_HMAC_SHA1_fail_tag_corrupt),
+
+ TEST_CASES_END() /**< NULL terminate unit test array */
+ }
+};
+
+static struct unit_test_suite cryptodev_mrvl_testsuite = {
+ .suite_name = "Crypto Device Marvell Component Test Suite",
+ .setup = testsuite_setup,
+ .teardown = testsuite_teardown,
+ .unit_test_cases = {
+ TEST_CASE_ST(ut_setup, ut_teardown, test_multi_session),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_null_auth_cipher_operation),
+ test_multi_session_random_usage),
+ TEST_CASE_ST(ut_setup, ut_teardown, test_AES_chain_all),
+ TEST_CASE_ST(ut_setup, ut_teardown, test_AES_cipheronly_all),
+ TEST_CASE_ST(ut_setup, ut_teardown, test_authonly_all),
+ TEST_CASE_ST(ut_setup, ut_teardown, test_3DES_chain_all),
+ TEST_CASE_ST(ut_setup, ut_teardown, test_3DES_cipheronly_all),
/** Negative tests */
TEST_CASE_ST(ut_setup, ut_teardown,
TEST_CASE_ST(ut_setup, ut_teardown,
authentication_verify_HMAC_SHA1_fail_tag_corrupt),
TEST_CASE_ST(ut_setup, ut_teardown,
- authentication_verify_AES128_GMAC_fail_data_corrupt),
+ auth_decryption_AES128CBC_HMAC_SHA1_fail_data_corrupt),
TEST_CASE_ST(ut_setup, ut_teardown,
- authentication_verify_AES128_GMAC_fail_tag_corrupt),
+ auth_decryption_AES128CBC_HMAC_SHA1_fail_tag_corrupt),
+
+ TEST_CASES_END() /**< NULL terminate unit test array */
+ }
+};
+
+static struct unit_test_suite cryptodev_ccp_testsuite = {
+ .suite_name = "Crypto Device CCP Unit Test Suite",
+ .setup = testsuite_setup,
+ .teardown = testsuite_teardown,
+ .unit_test_cases = {
+ TEST_CASE_ST(ut_setup, ut_teardown, test_multi_session),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_multi_session_random_usage),
+ TEST_CASE_ST(ut_setup, ut_teardown, test_AES_chain_all),
+ TEST_CASE_ST(ut_setup, ut_teardown, test_AES_cipheronly_all),
+ TEST_CASE_ST(ut_setup, ut_teardown, test_3DES_chain_all),
+ TEST_CASE_ST(ut_setup, ut_teardown, test_3DES_cipheronly_all),
+ TEST_CASE_ST(ut_setup, ut_teardown, test_authonly_all),
+
+ /** Negative tests */
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ authentication_verify_HMAC_SHA1_fail_data_corrupt),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ authentication_verify_HMAC_SHA1_fail_tag_corrupt),
TEST_CASE_ST(ut_setup, ut_teardown,
auth_decryption_AES128CBC_HMAC_SHA1_fail_data_corrupt),
TEST_CASE_ST(ut_setup, ut_teardown,
auth_decryption_AES128CBC_HMAC_SHA1_fail_tag_corrupt),
+
+ TEST_CASES_END() /**< NULL terminate unit test array */
+ }
+};
+
+static struct unit_test_suite cryptodev_nitrox_testsuite = {
+ .suite_name = "Crypto NITROX Unit Test Suite",
+ .setup = testsuite_setup,
+ .teardown = testsuite_teardown,
+ .unit_test_cases = {
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_device_configure_invalid_dev_id),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_device_configure_invalid_queue_pair_ids),
+ TEST_CASE_ST(ut_setup, ut_teardown, test_AES_chain_all),
+ TEST_CASE_ST(ut_setup, ut_teardown, test_3DES_chain_all),
+
TEST_CASES_END() /**< NULL terminate unit test array */
}
};
"testsuite.\n");
return TEST_FAILED;
}
- return unit_test_suite_runner(&cryptodev_octeontx_testsuite);
+ return unit_test_suite_runner(&cryptodev_testsuite);
}
static int
"testsuite.\n");
return TEST_FAILED;
}
- return unit_test_suite_runner(&cryptodev_octeontx2_testsuite);
+ return unit_test_suite_runner(&cryptodev_testsuite);
}
static int