aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMatias Elo <matias.elo@nokia.com>2023-08-08 11:02:27 +0300
committerGitHub <noreply@github.com>2023-08-08 11:02:27 +0300
commitde97121a2e3afa072f7c51a0570f4b3bed0236c2 (patch)
tree1f34d2767951f54d11f0b9c8d48b0db04490d2c1 /test
parent2b359fc1759726826cf4e2afddbd0b7e39fab4c7 (diff)
parent1200684b94bf18ae98ba63fb49e9cda546b4832a (diff)
Merge ODP v1.41.1.0v1.41.1.0_DPDK_22.11
Merge ODP linux-generic v1.41.1.0 into linux-dpdk.
Diffstat (limited to 'test')
-rw-r--r--test/common/odp_cunit_common.c11
-rw-r--r--test/common/odp_cunit_common.h1
-rw-r--r--test/performance/.gitignore1
-rw-r--r--test/performance/Makefile.am2
-rw-r--r--test/performance/odp_bench_timer.c871
-rw-r--r--test/performance/odp_dma_perf.c2021
-rwxr-xr-xtest/performance/odp_dma_perf_run.sh65
-rw-r--r--test/performance/odp_ipsec.c2
-rw-r--r--test/performance/odp_ipsecfwd.c88
-rw-r--r--test/performance/odp_l2fwd.c18
-rw-r--r--test/performance/odp_sched_pktio.c4
-rw-r--r--test/performance/odp_timer_perf.c10
-rw-r--r--test/validation/api/Makefile.am1
-rw-r--r--test/validation/api/atomic/atomic.c14
-rw-r--r--test/validation/api/barrier/barrier.c14
-rw-r--r--test/validation/api/buffer/buffer.c13
-rw-r--r--test/validation/api/classification/odp_classification_tests.c2
-rw-r--r--test/validation/api/comp/comp.c30
-rw-r--r--test/validation/api/crypto/Makefile.am8
-rw-r--r--test/validation/api/crypto/crypto_op_test.c571
-rw-r--r--test/validation/api/crypto/crypto_op_test.h41
-rw-r--r--test/validation/api/crypto/odp_crypto_test_inp.c1247
-rw-r--r--test/validation/api/crypto/test_vector_defs.h3167
-rw-r--r--test/validation/api/crypto/test_vectors.h3046
-rw-r--r--test/validation/api/crypto/util.c310
-rw-r--r--test/validation/api/crypto/util.h50
-rw-r--r--test/validation/api/dma/dma.c273
-rw-r--r--test/validation/api/init/.gitignore1
-rw-r--r--test/validation/api/init/Makefile.am4
-rw-r--r--test/validation/api/init/init_main.c24
-rw-r--r--test/validation/api/ipsec/ipsec.c56
-rw-r--r--test/validation/api/lock/lock.c78
-rw-r--r--test/validation/api/packet/packet.c42
-rw-r--r--test/validation/api/pktio/parser.c39
-rw-r--r--test/validation/api/pktio/pktio.c188
-rw-r--r--test/validation/api/pool/pool.c97
-rw-r--r--test/validation/api/queue/queue.c13
-rw-r--r--test/validation/api/scheduler/scheduler.c42
-rw-r--r--test/validation/api/scheduler/scheduler_no_predef_groups.c4
-rw-r--r--test/validation/api/stash/stash.c4
-rw-r--r--test/validation/api/thread/thread.c14
-rw-r--r--test/validation/api/time/time.c263
-rw-r--r--test/validation/api/timer/timer.c268
43 files changed, 7678 insertions, 5340 deletions
diff --git a/test/common/odp_cunit_common.c b/test/common/odp_cunit_common.c
index 0f3b45b18..60746164c 100644
--- a/test/common/odp_cunit_common.c
+++ b/test/common/odp_cunit_common.c
@@ -32,7 +32,7 @@
#endif
/* Globals */
-static int allow_skip_result;
+static int running_in_ci;
static odph_thread_t thread_tbl[ODP_THREAD_COUNT_MAX];
static int threads_running;
static odp_instance_t instance;
@@ -720,7 +720,7 @@ int odp_cunit_parse_options(int argc, char *argv[])
control_thread = true;
if (env && !strcmp(env, "true")) {
- allow_skip_result = 1;
+ running_in_ci = 1;
ODPH_DBG("\nWARNING: test result can be used for code coverage only.\n"
"CI=true env variable is set!\n");
}
@@ -730,7 +730,12 @@ int odp_cunit_parse_options(int argc, char *argv[])
int odp_cunit_ret(int val)
{
- return allow_skip_result ? 0 : val;
+ return running_in_ci ? 0 : val;
+}
+
+int odp_cunit_ci(void)
+{
+ return running_in_ci;
}
int odp_cunit_ci_skip(const char *test_name)
diff --git a/test/common/odp_cunit_common.h b/test/common/odp_cunit_common.h
index 242747f0c..77822ee60 100644
--- a/test/common/odp_cunit_common.h
+++ b/test/common/odp_cunit_common.h
@@ -104,6 +104,7 @@ void odp_cunit_register_global_init(int (*func_init_ptr)(odp_instance_t *inst));
void odp_cunit_register_global_term(int (*func_term_ptr)(odp_instance_t inst));
int odp_cunit_ret(int val);
+int odp_cunit_ci(void);
int odp_cunit_print_inactive(void);
int odp_cunit_set_inactive(void);
diff --git a/test/performance/.gitignore b/test/performance/.gitignore
index b86699c91..087a163d8 100644
--- a/test/performance/.gitignore
+++ b/test/performance/.gitignore
@@ -5,6 +5,7 @@ odp_atomic_perf
odp_bench_buffer
odp_bench_misc
odp_bench_packet
+odp_bench_timer
odp_cpu_bench
odp_crc
odp_crypto
diff --git a/test/performance/Makefile.am b/test/performance/Makefile.am
index 9dc83fd22..67d57590a 100644
--- a/test/performance/Makefile.am
+++ b/test/performance/Makefile.am
@@ -6,6 +6,7 @@ EXECUTABLES = odp_atomic_perf \
odp_bench_buffer \
odp_bench_misc \
odp_bench_packet \
+ odp_bench_timer \
odp_crc \
odp_lock_perf \
odp_mem_perf \
@@ -60,6 +61,7 @@ odp_atomic_perf_SOURCES = odp_atomic_perf.c
odp_bench_buffer_SOURCES = odp_bench_buffer.c
odp_bench_misc_SOURCES = odp_bench_misc.c
odp_bench_packet_SOURCES = odp_bench_packet.c
+odp_bench_timer_SOURCES = odp_bench_timer.c
odp_cpu_bench_SOURCES = odp_cpu_bench.c
odp_crc_SOURCES = odp_crc.c
odp_crypto_SOURCES = odp_crypto.c
diff --git a/test/performance/odp_bench_timer.c b/test/performance/odp_bench_timer.c
new file mode 100644
index 000000000..918d19e5d
--- /dev/null
+++ b/test/performance/odp_bench_timer.c
@@ -0,0 +1,871 @@
+/* Copyright (c) 2023, Nokia
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE /* Needed for sigaction */
+#endif
+
+#include <odp_api.h>
+#include <odp/helper/odph_api.h>
+
+#include <getopt.h>
+#include <inttypes.h>
+#include <signal.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+/* Number of API function calls per test case */
+#define REPEAT_COUNT 1000
+
+/* Default number of rounds per test case */
+#define ROUNDS 1000u
+
+/** User area size in bytes */
+#define UAREA_SIZE 8
+
+/** Timer duration in nsec */
+#define TIMER_NSEC 50000000
+
+#define BENCH_INFO(run, max, name) \
+ {#run, run, max, name}
+
+/* Run benchmark, returns >0 on success */
+typedef int (*bench_run_fn_t)(void);
+
+/* Benchmark data */
+typedef struct {
+ /* Default test name */
+ const char *name;
+
+ /* Test function to run */
+ bench_run_fn_t run;
+
+ /* Test specific limit for rounds (tuning for slow implementation) */
+ uint32_t max_rounds;
+
+ /* Override default test name */
+ const char *desc;
+
+} bench_info_t;
+
+typedef struct {
+ /* Command line options */
+ struct {
+ /* Clock source to be used */
+ int clk_src;
+
+ /* Measure time vs CPU cycles */
+ int time;
+
+ /* Benchmark index to run indefinitely */
+ int bench_idx;
+
+ /* Rounds per test case */
+ uint32_t rounds;
+
+ } opt;
+
+ odp_timer_pool_t timer_pool;
+ odp_timer_t timer;
+ odp_queue_t queue;
+ odp_pool_t pool;
+ odp_timeout_t timeout;
+ odp_event_t event;
+ uint64_t timer_nsec;
+ uint64_t tick;
+ uint64_t nsec;
+ double tick_hz;
+ int plain_queue;
+
+ /* Benchmark functions */
+ bench_info_t *bench;
+
+ /* Number of benchmark functions */
+ int num_bench;
+
+ /* Break worker loop if set to 1 */
+ odp_atomic_u32_t exit_thread;
+
+ /* Test case input / output data */
+ uint64_t a1[REPEAT_COUNT];
+ odp_event_t ev[REPEAT_COUNT];
+ odp_timeout_t tmo[REPEAT_COUNT];
+ odp_timer_t tim[REPEAT_COUNT];
+
+ /* Dummy result */
+ uint64_t dummy;
+
+ /* Benchmark run failed */
+ int bench_failed;
+
+ /* CPU mask as string */
+ char cpumask_str[ODP_CPUMASK_STR_SIZE];
+
+} gbl_args_t;
+
+static gbl_args_t *gbl_args;
+
+static void sig_handler(int signo ODP_UNUSED)
+{
+ if (gbl_args == NULL)
+ return;
+ odp_atomic_store_u32(&gbl_args->exit_thread, 1);
+}
+
+static int setup_sig_handler(void)
+{
+ struct sigaction action;
+
+ memset(&action, 0, sizeof(action));
+ action.sa_handler = sig_handler;
+
+ /* No additional signals blocked. By default, the signal which triggered
+ * the handler is blocked. */
+ if (sigemptyset(&action.sa_mask))
+ return -1;
+
+ if (sigaction(SIGINT, &action, NULL))
+ return -1;
+
+ return 0;
+}
+
+/* Run given benchmark indefinitely */
+static void run_indef(gbl_args_t *args, int idx)
+{
+ const char *desc;
+ const bench_info_t *bench = &args->bench[idx];
+
+ desc = bench->desc != NULL ? bench->desc : bench->name;
+
+ printf("Running odp_%s test indefinitely\n", desc);
+
+ while (!odp_atomic_load_u32(&gbl_args->exit_thread)) {
+ int ret;
+
+ ret = bench->run();
+
+ if (!ret)
+ ODPH_ABORT("Benchmark %s failed\n", desc);
+ }
+}
+
+static int run_benchmarks(void *arg)
+{
+ int i, j;
+ uint64_t c1, c2;
+ odp_time_t t1, t2;
+ gbl_args_t *args = arg;
+ const int meas_time = args->opt.time;
+
+ printf("\nAverage %s per function call\n", meas_time ? "time (nsec)" : "CPU cycles");
+ printf("-------------------------------------------------\n");
+
+ /* Run each test twice. Results from the first warm-up round are ignored. */
+ for (i = 0; i < 2; i++) {
+ uint64_t total = 0;
+ uint32_t round = 1;
+
+ for (j = 0; j < gbl_args->num_bench; round++) {
+ int ret;
+ const char *desc;
+ const bench_info_t *bench = &args->bench[j];
+ uint32_t max_rounds = args->opt.rounds;
+
+ if (bench->max_rounds && max_rounds > bench->max_rounds)
+ max_rounds = bench->max_rounds;
+
+ /* Run selected test indefinitely */
+ if (args->opt.bench_idx) {
+ if ((j + 1) != args->opt.bench_idx) {
+ j++;
+ continue;
+ }
+
+ run_indef(args, j);
+ return 0;
+ }
+
+ desc = bench->desc != NULL ? bench->desc : bench->name;
+
+ if (meas_time)
+ t1 = odp_time_local();
+ else
+ c1 = odp_cpu_cycles();
+
+ ret = bench->run();
+
+ if (meas_time)
+ t2 = odp_time_local();
+ else
+ c2 = odp_cpu_cycles();
+
+ if (!ret) {
+ ODPH_ERR("Benchmark odp_%s failed\n", desc);
+ args->bench_failed = -1;
+ return -1;
+ }
+
+ if (meas_time)
+ total += odp_time_diff_ns(t2, t1);
+ else
+ total += odp_cpu_cycles_diff(c2, c1);
+
+ for (i = 0; i < REPEAT_COUNT; i++)
+ args->dummy += args->a1[i];
+
+ if (round >= max_rounds) {
+ double result;
+
+ /* Each benchmark runs internally REPEAT_COUNT times. */
+ result = ((double)total) / (max_rounds * REPEAT_COUNT);
+
+ /* No print from warm-up round */
+ if (i > 0)
+ printf("[%02d] odp_%-26s: %12.2f\n", j + 1, desc, result);
+
+ j++;
+ total = 0;
+ round = 1;
+ }
+ }
+ }
+
+ /* Print dummy result to prevent compiler to optimize it away*/
+ printf("\n(dummy result: 0x%" PRIx64 ")\n\n", args->dummy);
+
+ return 0;
+}
+
+static int timer_current_tick(void)
+{
+ int i;
+ odp_timer_pool_t timer_pool = gbl_args->timer_pool;
+ uint64_t *a1 = gbl_args->a1;
+
+ for (i = 0; i < REPEAT_COUNT; i++)
+ a1[i] = odp_timer_current_tick(timer_pool);
+
+ return i;
+}
+
+static int timer_tick_to_ns(void)
+{
+ int i;
+ odp_timer_pool_t timer_pool = gbl_args->timer_pool;
+ uint64_t *a1 = gbl_args->a1;
+ uint64_t tick = gbl_args->tick;
+
+ for (i = 0; i < REPEAT_COUNT; i++)
+ a1[i] = odp_timer_tick_to_ns(timer_pool, tick);
+
+ return i;
+}
+
+static int timer_ns_to_tick(void)
+{
+ int i;
+ odp_timer_pool_t timer_pool = gbl_args->timer_pool;
+ uint64_t *a1 = gbl_args->a1;
+ uint64_t nsec = gbl_args->nsec;
+
+ for (i = 0; i < REPEAT_COUNT; i++)
+ a1[i] = odp_timer_ns_to_tick(timer_pool, nsec);
+
+ return i;
+}
+
+static int timeout_to_event(void)
+{
+ int i;
+ odp_event_t *ev = gbl_args->ev;
+ odp_timeout_t timeout = gbl_args->timeout;
+
+ for (i = 0; i < REPEAT_COUNT; i++)
+ ev[i] = odp_timeout_to_event(timeout);
+
+ gbl_args->dummy += odp_event_to_u64(ev[0]);
+
+ return i;
+}
+
+static int timeout_from_event(void)
+{
+ int i;
+ odp_event_t ev = gbl_args->event;
+ odp_timeout_t *tmo = gbl_args->tmo;
+
+ for (i = 0; i < REPEAT_COUNT; i++)
+ tmo[i] = odp_timeout_from_event(ev);
+
+ gbl_args->dummy += odp_timeout_to_u64(tmo[0]);
+
+ return i;
+}
+
+static int timeout_fresh(void)
+{
+ int i;
+ odp_timeout_t timeout = gbl_args->timeout;
+ uint64_t *a1 = gbl_args->a1;
+
+ for (i = 0; i < REPEAT_COUNT; i++)
+ a1[i] = odp_timeout_fresh(timeout);
+
+ return i;
+}
+
+static int timeout_timer(void)
+{
+ int i;
+ odp_timeout_t timeout = gbl_args->timeout;
+ odp_timer_t *tim = gbl_args->tim;
+
+ for (i = 0; i < REPEAT_COUNT; i++)
+ tim[i] = odp_timeout_timer(timeout);
+
+ gbl_args->dummy += odp_timer_to_u64(tim[0]);
+
+ return i;
+}
+
+static int timeout_tick(void)
+{
+ int i;
+ odp_timeout_t timeout = gbl_args->timeout;
+ uint64_t *a1 = gbl_args->a1;
+
+ for (i = 0; i < REPEAT_COUNT; i++)
+ a1[i] = odp_timeout_tick(timeout);
+
+ return i;
+}
+
+static int timeout_user_ptr(void)
+{
+ int i;
+ odp_timeout_t timeout = gbl_args->timeout;
+ uint64_t *a1 = gbl_args->a1;
+
+ for (i = 0; i < REPEAT_COUNT; i++)
+ a1[i] = (uintptr_t)odp_timeout_user_ptr(timeout);
+
+ return i;
+}
+
+static int timeout_user_area(void)
+{
+ int i;
+ odp_timeout_t timeout = gbl_args->timeout;
+ uint64_t *a1 = gbl_args->a1;
+
+ for (i = 0; i < REPEAT_COUNT; i++)
+ a1[i] = (uintptr_t)odp_timeout_user_area(timeout);
+
+ return i;
+}
+
+static int timeout_to_u64(void)
+{
+ int i;
+ odp_timeout_t timeout = gbl_args->timeout;
+ uint64_t *a1 = gbl_args->a1;
+
+ for (i = 0; i < REPEAT_COUNT; i++)
+ a1[i] = odp_timeout_to_u64(timeout);
+
+ return i;
+}
+
+static int timer_to_u64(void)
+{
+ int i;
+ odp_timer_t timer = gbl_args->timer;
+ uint64_t *a1 = gbl_args->a1;
+
+ for (i = 0; i < REPEAT_COUNT; i++)
+ a1[i] = odp_timer_to_u64(timer);
+
+ return i;
+}
+
+static int timer_pool_to_u64(void)
+{
+ int i;
+ odp_timer_pool_t tp = gbl_args->timer_pool;
+ uint64_t *a1 = gbl_args->a1;
+
+ for (i = 0; i < REPEAT_COUNT; i++)
+ a1[i] = odp_timer_pool_to_u64(tp);
+
+ return i;
+}
+
+bench_info_t test_suite[] = {
+ BENCH_INFO(timer_current_tick, 0, NULL),
+ BENCH_INFO(timer_tick_to_ns, 0, NULL),
+ BENCH_INFO(timer_ns_to_tick, 0, NULL),
+ BENCH_INFO(timeout_to_event, 0, NULL),
+ BENCH_INFO(timeout_from_event, 0, NULL),
+ BENCH_INFO(timeout_fresh, 0, NULL),
+ BENCH_INFO(timeout_timer, 0, NULL),
+ BENCH_INFO(timeout_tick, 0, NULL),
+ BENCH_INFO(timeout_user_ptr, 0, NULL),
+ BENCH_INFO(timeout_user_area, 0, NULL),
+ BENCH_INFO(timeout_to_u64, 0, NULL),
+ BENCH_INFO(timer_to_u64, 0, NULL),
+ BENCH_INFO(timer_pool_to_u64, 0, NULL),
+};
+
+/* Print usage information */
+static void usage(void)
+{
+ printf("\n"
+ "ODP timer API micro benchmarks\n"
+ "\n"
+ "Options:\n"
+ " -s, --clk_src Clock source select (default 0):\n"
+ " 0: ODP_CLOCK_DEFAULT\n"
+ " 1: ODP_CLOCK_SRC_1, ...\n"
+ " -t, --time <opt> Time measurement. 0: measure CPU cycles (default), 1: measure time\n"
+ " -i, --index <idx> Benchmark index to run indefinitely.\n"
+ " -r, --rounds <num> Run each test case 'num' times (default %u).\n"
+ " -h, --help Display help and exit.\n\n"
+ "\n", ROUNDS);
+}
+
+/* Parse command line arguments */
+static int parse_args(int argc, char *argv[])
+{
+ int opt;
+ int long_index;
+ static const struct option longopts[] = {
+ {"clk_src", required_argument, NULL, 's'},
+ {"time", required_argument, NULL, 't'},
+ {"index", required_argument, NULL, 'i'},
+ {"rounds", required_argument, NULL, 'r'},
+ {"help", no_argument, NULL, 'h'},
+ {NULL, 0, NULL, 0}
+ };
+
+ static const char *shortopts = "s:t:i:r:h";
+
+ gbl_args->opt.clk_src = ODP_CLOCK_DEFAULT;
+ gbl_args->opt.time = 0; /* Measure CPU cycles */
+ gbl_args->opt.bench_idx = 0; /* Run all benchmarks */
+ gbl_args->opt.rounds = ROUNDS;
+
+ while (1) {
+ opt = getopt_long(argc, argv, shortopts, longopts, &long_index);
+
+ if (opt == -1)
+ break; /* No more options */
+
+ switch (opt) {
+ case 's':
+ gbl_args->opt.clk_src = atoi(optarg);
+ break;
+ case 't':
+ gbl_args->opt.time = atoi(optarg);
+ break;
+ case 'i':
+ gbl_args->opt.bench_idx = atoi(optarg);
+ break;
+ case 'r':
+ gbl_args->opt.rounds = atoi(optarg);
+ break;
+ case 'h':
+ usage();
+ return 1;
+ default:
+ ODPH_ERR("Bad option. Use -h for help.\n");
+ return -1;
+ }
+ }
+
+ if (gbl_args->opt.rounds < 1) {
+ ODPH_ERR("Invalid test cycle repeat count: %u\n", gbl_args->opt.rounds);
+ return -1;
+ }
+
+ if (gbl_args->opt.bench_idx < 0 || gbl_args->opt.bench_idx > gbl_args->num_bench) {
+ ODPH_ERR("Bad bench index %i\n", gbl_args->opt.bench_idx);
+ return -1;
+ }
+
+ optind = 1; /* Reset 'extern optind' from the getopt lib */
+
+ return 0;
+}
+
+/* Print system and application info */
+static void print_info(void)
+{
+ odp_sys_info_print();
+
+ printf("\n"
+ "odp_bench_timer options\n"
+ "-----------------------\n");
+
+ printf("CPU mask: %s\n", gbl_args->cpumask_str);
+ printf("Clock source: %i\n", gbl_args->opt.clk_src);
+ printf("Measurement unit: %s\n", gbl_args->opt.time ? "nsec" : "CPU cycles");
+ printf("Test rounds: %u\n", gbl_args->opt.rounds);
+ printf("Timer duration: %" PRIu64 " nsec\n", gbl_args->timer_nsec);
+ printf("Timer tick freq: %.2f Hz\n", gbl_args->tick_hz);
+ printf("\n");
+}
+
+static int create_timer(void)
+{
+ odp_pool_capability_t pool_capa;
+ odp_timer_capability_t timer_capa;
+ odp_timer_clk_src_t clk_src;
+ odp_timer_pool_param_t tp_param;
+ odp_timer_pool_t tp;
+ odp_pool_t pool;
+ odp_pool_param_t pool_param;
+ odp_timeout_t tmo;
+ odp_queue_param_t queue_param;
+ odp_queue_t queue;
+ odp_timer_t timer;
+ uint64_t t1, t2, diff, tick1, tick2;
+
+ if (odp_pool_capability(&pool_capa)) {
+ ODPH_ERR("Pool capa failed\n");
+ return -1;
+ }
+
+ clk_src = gbl_args->opt.clk_src;
+ if (odp_timer_capability(clk_src, &timer_capa)) {
+ ODPH_ERR("Timer capa failed\n");
+ return -1;
+ }
+
+ odp_timer_pool_param_init(&tp_param);
+ tp_param.clk_src = clk_src;
+ tp_param.res_ns = timer_capa.max_res.res_ns;
+ tp_param.min_tmo = timer_capa.max_res.min_tmo;
+ tp_param.max_tmo = timer_capa.max_res.max_tmo;
+ tp_param.num_timers = 10;
+
+ tp = odp_timer_pool_create("bench_timer", &tp_param);
+
+ if (tp == ODP_TIMER_POOL_INVALID) {
+ ODPH_ERR("Timer pool create failed\n");
+ return -1;
+ }
+
+ gbl_args->timer_pool = tp;
+
+ odp_timer_pool_start();
+
+ gbl_args->timer_nsec = TIMER_NSEC;
+ if (TIMER_NSEC < tp_param.min_tmo)
+ gbl_args->timer_nsec = tp_param.min_tmo;
+ else if (TIMER_NSEC > tp_param.max_tmo)
+ gbl_args->timer_nsec = tp_param.max_tmo;
+
+ odp_pool_param_init(&pool_param);
+ pool_param.type = ODP_POOL_TIMEOUT;
+ pool_param.tmo.num = 10;
+ pool_param.tmo.uarea_size = UAREA_SIZE;
+ if (UAREA_SIZE > pool_capa.tmo.max_uarea_size)
+ pool_param.tmo.uarea_size = pool_capa.tmo.max_uarea_size;
+
+ pool = odp_pool_create("bench_timer", &pool_param);
+
+ if (pool == ODP_POOL_INVALID) {
+ ODPH_ERR("Timeout pool create failed\n");
+ return -1;
+ }
+
+ gbl_args->pool = pool;
+
+ tmo = odp_timeout_alloc(pool);
+
+ if (tmo == ODP_TIMEOUT_INVALID) {
+ ODPH_ERR("Timeout alloc failed\n");
+ return -1;
+ }
+
+ gbl_args->timeout = tmo;
+ gbl_args->tick = odp_timer_current_tick(tp);
+ gbl_args->nsec = odp_timer_tick_to_ns(tp, gbl_args->tick);
+
+ /* Measure timer tick frequency for test information */
+ t1 = odp_time_global_strict_ns();
+ tick1 = odp_timer_current_tick(tp);
+
+ odp_time_wait_ns(200 * ODP_TIME_MSEC_IN_NS);
+
+ tick2 = odp_timer_current_tick(tp);
+ t2 = odp_time_global_strict_ns();
+ diff = t2 - t1;
+
+ if (diff)
+ gbl_args->tick_hz = (tick2 - tick1) / ((double)diff / ODP_TIME_SEC_IN_NS);
+
+ odp_queue_param_init(&queue_param);
+ queue_param.type = ODP_QUEUE_TYPE_SCHED;
+ queue_param.sched.prio = odp_schedule_default_prio();
+ queue_param.sched.sync = ODP_SCHED_SYNC_ATOMIC;
+ queue_param.sched.group = ODP_SCHED_GROUP_ALL;
+
+ if (timer_capa.queue_type_sched == 0) {
+ queue_param.type = ODP_QUEUE_TYPE_PLAIN;
+ gbl_args->plain_queue = 1;
+ }
+
+ queue = odp_queue_create("bench_timer", &queue_param);
+ if (queue == ODP_QUEUE_INVALID) {
+ ODPH_ERR("Queue create failed\n");
+ return -1;
+ }
+
+ gbl_args->queue = queue;
+
+ timer = odp_timer_alloc(tp, queue, (void *)(uintptr_t)0xdeadbeef);
+ if (timer == ODP_TIMER_INVALID) {
+ ODPH_ERR("Timer alloc failed\n");
+ return -1;
+ }
+
+ gbl_args->timer = timer;
+
+ return 0;
+}
+
+static int wait_timer(void)
+{
+ odp_timer_start_t start_param;
+ odp_timer_t timer = gbl_args->timer;
+ odp_timer_pool_t tp = gbl_args->timer_pool;
+ uint64_t wait_nsec = 2 * gbl_args->timer_nsec;
+ uint64_t sched_wait = odp_schedule_wait_time(wait_nsec);
+ odp_event_t ev;
+ uint64_t start;
+
+ start_param.tick_type = ODP_TIMER_TICK_REL;
+ start_param.tick = odp_timer_ns_to_tick(tp, gbl_args->timer_nsec);
+ start_param.tmo_ev = odp_timeout_to_event(gbl_args->timeout);
+
+ if (odp_timer_start(timer, &start_param) != ODP_TIMER_SUCCESS) {
+ ODPH_ERR("Timer start failed\n");
+ return -1;
+ }
+
+ gbl_args->timeout = ODP_TIMEOUT_INVALID;
+ gbl_args->event = ODP_EVENT_INVALID;
+
+ /* Wait for timeout */
+ if (gbl_args->plain_queue) {
+ start = odp_time_global_ns();
+ while (1) {
+ ev = odp_queue_deq(gbl_args->queue);
+
+ if (ev != ODP_EVENT_INVALID)
+ break;
+
+ if ((odp_time_global_ns() - start) > wait_nsec) {
+ ODPH_ERR("Timeout event missing\n");
+ return -1;
+ }
+ }
+
+ gbl_args->event = ev;
+ } else {
+ ev = odp_schedule(NULL, sched_wait);
+
+ if (ev == ODP_EVENT_INVALID) {
+ ODPH_ERR("Timeout event missing\n");
+ return -1;
+ }
+
+ gbl_args->event = ev;
+
+ /* Free schedule context */
+ if (odp_schedule(NULL, ODP_SCHED_NO_WAIT) != ODP_EVENT_INVALID) {
+ ODPH_ERR("Extra timeout event\n");
+ return -1;
+ }
+ }
+
+ if (odp_event_type(gbl_args->event) != ODP_EVENT_TIMEOUT) {
+ ODPH_ERR("Bad event type\n");
+ return -1;
+ }
+
+ gbl_args->timeout = odp_timeout_from_event(gbl_args->event);
+
+ return 0;
+}
+
+int main(int argc, char *argv[])
+{
+ odph_helper_options_t helper_options;
+ odph_thread_t worker_thread;
+ odph_thread_common_param_t thr_common;
+ odph_thread_param_t thr_param;
+ int cpu, i;
+ odp_shm_t shm;
+ odp_cpumask_t cpumask, default_mask;
+ odp_instance_t instance;
+ odp_init_t init_param;
+ int ret = 0;
+
+ /* Let helper collect its own arguments (e.g. --odph_proc) */
+ argc = odph_parse_options(argc, argv);
+ if (odph_options(&helper_options)) {
+ ODPH_ERR("Reading ODP helper options failed\n");
+ exit(EXIT_FAILURE);
+ }
+
+ odp_init_param_init(&init_param);
+ init_param.mem_model = helper_options.mem_model;
+
+ /* Init ODP before calling anything else */
+ if (odp_init_global(&instance, &init_param, NULL)) {
+ ODPH_ERR("Global init failed\n");
+ exit(EXIT_FAILURE);
+ }
+
+ /* Init this thread */
+ if (odp_init_local(instance, ODP_THREAD_CONTROL)) {
+ ODPH_ERR("Local init failed\n");
+ exit(EXIT_FAILURE);
+ }
+
+ if (setup_sig_handler()) {
+ ODPH_ERR("Signal handler setup failed\n");
+ exit(EXIT_FAILURE);
+ }
+
+ odp_schedule_config(NULL);
+
+ /* Reserve memory for args from shared mem */
+ shm = odp_shm_reserve("shm_args", sizeof(gbl_args_t), ODP_CACHE_LINE_SIZE, 0);
+ if (shm == ODP_SHM_INVALID) {
+ ODPH_ERR("Shared mem reserve failed\n");
+ exit(EXIT_FAILURE);
+ }
+
+ gbl_args = odp_shm_addr(shm);
+ if (gbl_args == NULL) {
+ ODPH_ERR("Shared mem alloc failed\n");
+ exit(EXIT_FAILURE);
+ }
+
+ memset(gbl_args, 0, sizeof(gbl_args_t));
+ odp_atomic_init_u32(&gbl_args->exit_thread, 0);
+ gbl_args->timer_pool = ODP_TIMER_POOL_INVALID;
+ gbl_args->timer = ODP_TIMER_INVALID;
+ gbl_args->queue = ODP_QUEUE_INVALID;
+ gbl_args->pool = ODP_POOL_INVALID;
+ gbl_args->timeout = ODP_TIMEOUT_INVALID;
+
+ gbl_args->bench = test_suite;
+ gbl_args->num_bench = sizeof(test_suite) / sizeof(test_suite[0]);
+
+ for (i = 0; i < REPEAT_COUNT; i++) {
+ gbl_args->a1[i] = i;
+ gbl_args->ev[i] = ODP_EVENT_INVALID;
+ gbl_args->tmo[i] = ODP_TIMEOUT_INVALID;
+ gbl_args->tim[i] = ODP_TIMER_INVALID;
+ }
+
+ /* Parse and store the application arguments */
+ ret = parse_args(argc, argv);
+ if (ret)
+ goto exit;
+
+ /* Get default worker cpumask */
+ if (odp_cpumask_default_worker(&default_mask, 1) != 1) {
+ ODPH_ERR("Unable to allocate worker thread\n");
+ ret = -1;
+ goto exit;
+ }
+
+ (void)odp_cpumask_to_str(&default_mask, gbl_args->cpumask_str,
+ sizeof(gbl_args->cpumask_str));
+
+ /* Create timer and other resources */
+ ret = create_timer();
+ if (ret)
+ goto exit;
+
+ print_info();
+
+ /* Start one timer and wait for the timeout event. Timer expiration fills in
+ * timeout event metadata. */
+ ret = wait_timer();
+ if (ret)
+ goto exit;
+
+ memset(&worker_thread, 0, sizeof(odph_thread_t));
+
+ /* Create worker thread */
+ cpu = odp_cpumask_first(&default_mask);
+
+ odp_cpumask_zero(&cpumask);
+ odp_cpumask_set(&cpumask, cpu);
+
+ odph_thread_common_param_init(&thr_common);
+ thr_common.instance = instance;
+ thr_common.cpumask = &cpumask;
+ thr_common.share_param = 1;
+
+ odph_thread_param_init(&thr_param);
+ thr_param.start = run_benchmarks;
+ thr_param.arg = gbl_args;
+ thr_param.thr_type = ODP_THREAD_WORKER;
+
+ odph_thread_create(&worker_thread, &thr_common, &thr_param, 1);
+
+ odph_thread_join(&worker_thread, 1);
+
+ ret = gbl_args->bench_failed;
+
+exit:
+ if (gbl_args->timeout != ODP_TIMEOUT_INVALID)
+ odp_timeout_free(gbl_args->timeout);
+
+ if (gbl_args->pool != ODP_POOL_INVALID)
+ odp_pool_destroy(gbl_args->pool);
+
+ if (gbl_args->timer != ODP_TIMER_INVALID)
+ odp_timer_free(gbl_args->timer);
+
+ if (gbl_args->timer_pool != ODP_TIMER_POOL_INVALID)
+ odp_timer_pool_destroy(gbl_args->timer_pool);
+
+ if (gbl_args->queue != ODP_QUEUE_INVALID) {
+ if (odp_queue_destroy(gbl_args->queue)) {
+ ODPH_ERR("Queue destroy failed\n");
+ exit(EXIT_FAILURE);
+ }
+ }
+
+ if (odp_shm_free(shm)) {
+ ODPH_ERR("Shared mem free failed\n");
+ exit(EXIT_FAILURE);
+ }
+
+ if (odp_term_local()) {
+ ODPH_ERR("Local term failed\n");
+ exit(EXIT_FAILURE);
+ }
+
+ if (odp_term_global(instance)) {
+ ODPH_ERR("Global term failed\n");
+ exit(EXIT_FAILURE);
+ }
+
+ if (ret < 0)
+ return EXIT_FAILURE;
+
+ return EXIT_SUCCESS;
+}
diff --git a/test/performance/odp_dma_perf.c b/test/performance/odp_dma_perf.c
index 62899f913..be23f27ca 100644
--- a/test/performance/odp_dma_perf.c
+++ b/test/performance/odp_dma_perf.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2021-2022, Nokia
+/* Copyright (c) 2021-2023, Nokia
*
* All rights reserved.
*
@@ -9,266 +9,515 @@
#define _GNU_SOURCE
#endif
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
#include <inttypes.h>
+#include <stdlib.h>
+#include <signal.h>
+#include <stdint.h>
+#include <unistd.h>
#include <odp_api.h>
#include <odp/helper/odph_api.h>
#define EXIT_NOT_SUP 2
-
-#define DEFAULT_SEG_SIZE 1024U
-#define ROUNDS 1000000
-#define DEFAULT_WAIT_NS ODP_TIME_SEC_IN_NS
-#define COMPL_DELIMITER ","
-/* For now, a static maximum amount of input segments */
-#define MAX_NUM_IN_SEGS 64
-#define SHM_SRC "odp_dma_perf_shm_src"
-#define SHM_DST "odp_dma_perf_shm_dst"
-
-#define TRS_TYPE_SYNC 0
-#define TRS_TYPE_ASYNC 1
-
-#define GRN_ALL 0
-#define GRN_IND 1
-
-#define TYPE_PKT 0
-#define TYPE_MEM 1
-
-#define COMPL_MODE_POLL 0
-#define COMPL_MODE_EVENT 1
+#define PROG_NAME "odp_dma_perf"
+
+enum {
+ SYNC = 0U,
+ ASYNC
+};
+
+enum {
+ PACKET = 0U,
+ MEMORY
+};
+
+enum {
+ POLL = 0U,
+ EVENT
+};
+
+enum {
+ SINGLE = 0U,
+ MANY
+};
+
+#define DEF_TRS_TYPE SYNC
+#define DEF_SEG_CNT 1U
+#define DEF_LEN 1024U
+#define DEF_SEG_TYPE PACKET
+#define DEF_MODE POLL
+#define DEF_INFLIGHT 1U
+#define DEF_TIME 10U
+#define DEF_WORKERS 1U
+#define DEF_POLICY SINGLE
+
+#define MAX_SEGS 1024U
+#define MAX_WORKERS 24
+
+#define MIN(a, b) (((a) < (b)) ? (a) : (b))
+#define MAX(a, b) (((a) < (b)) ? (b) : (a))
#define GIGAS 1000000000
#define MEGAS 1000000
#define KILOS 1000
-#define RETRIES 1000U
-
-typedef struct test_config_t {
- int trs_type;
- int trs_grn;
- int num_in_seg;
- uint32_t seg_size;
- int seg_type;
- int num_rounds;
- int dma_rounds;
- uint64_t wait_ns;
-
- struct {
- int num_modes;
- uint32_t compl_mask;
- int modes[MAX_NUM_IN_SEGS];
- } compl_modes;
-
+typedef enum {
+ PRS_OK,
+ PRS_NOK,
+ PRS_TERM,
+ PRS_NOT_SUP
+} parse_result_t;
+
+typedef struct {
+ uint64_t completed;
+ uint64_t start_errs;
+ uint64_t poll_errs;
+ uint64_t scheduler_timeouts;
+ uint64_t transfer_errs;
+ uint64_t tot_tm;
+ uint64_t trs_tm;
+ uint64_t max_trs_tm;
+ uint64_t min_trs_tm;
+ uint64_t start_cc;
+ uint64_t max_start_cc;
+ uint64_t min_start_cc;
+ uint64_t wait_cc;
+ uint64_t max_wait_cc;
+ uint64_t min_wait_cc;
+ uint64_t trs_cc;
+ uint64_t max_trs_cc;
+ uint64_t min_trs_cc;
+ uint64_t start_cnt;
+ uint64_t wait_cnt;
+ uint64_t trs_poll_cnt;
+ uint64_t trs_cnt;
+} stats_t;
+
+typedef struct {
+ odp_dma_transfer_param_t trs_param;
+ odp_dma_compl_param_t compl_param;
+ odp_ticketlock_t lock;
+ uint64_t trs_start_tm;
+ uint64_t trs_start_cc;
+ uint64_t trs_poll_cnt;
+ odp_bool_t is_running;
+} trs_info_t;
+
+typedef struct ODP_ALIGNED_CACHE {
struct {
+ trs_info_t infos[MAX_SEGS];
+ odp_dma_seg_t src_seg[MAX_SEGS];
+ odp_dma_seg_t dst_seg[MAX_SEGS];
+ odp_dma_t handle;
odp_pool_t pool;
odp_queue_t compl_q;
- odp_dma_t handle;
- odp_dma_seg_t dst_seg;
- odp_dma_seg_t src_seg[MAX_NUM_IN_SEGS];
- } dma_config;
-
- union {
- struct {
- odp_shm_t shm_src;
- odp_shm_t shm_dst;
- void *src;
- void *dst;
- };
-
- struct {
- odp_pool_t pool;
- odp_packet_t pkts[MAX_NUM_IN_SEGS + 1];
- };
- } seg_config;
+ uint32_t num_in_segs;
+ uint32_t num_out_segs;
+ uint32_t src_seg_len;
+ uint32_t dst_seg_len;
+ uint32_t num_inflight;
+ uint8_t trs_type;
+ uint8_t compl_mode;
+ } dma;
struct {
- int (*setup_fn)(struct test_config_t *config);
- void (*trs_base_fn)(struct test_config_t *config,
- odp_dma_transfer_param_t *trs_params, uint32_t *trs_lengths);
- void (*trs_dyn_fn)(struct test_config_t *config, uint32_t offset, uint32_t len);
- int (*verify_fn)(const struct test_config_t *config);
- void (*free_fn)(struct test_config_t *config);
- int (*run_fn)(struct test_config_t *config);
- } test_case_api;
-} test_config_t;
-
-typedef struct compl_wait_entry_t {
- int type;
- odp_dma_transfer_id_t id;
-} compl_wait_entry_t;
-
-static const int compl_mode_map[] = { ODP_DMA_COMPL_POLL, ODP_DMA_COMPL_EVENT };
-
-static void set_option_defaults(test_config_t *config)
+ odp_packet_t src_pkt[MAX_SEGS];
+ odp_packet_t dst_pkt[MAX_SEGS];
+ odp_pool_t src_pool;
+ odp_pool_t dst_pool;
+ odp_shm_t src_shm;
+ odp_shm_t dst_shm;
+ void *src;
+ void *dst;
+ } seg;
+
+ odp_schedule_group_t grp;
+} sd_t;
+
+typedef struct prog_config_s prog_config_t;
+
+typedef struct ODP_ALIGNED_CACHE {
+ stats_t stats;
+ prog_config_t *prog_config;
+ sd_t *sd;
+} thread_config_t;
+
+typedef struct {
+ /* Configure DMA session specific resources. */
+ odp_bool_t (*session_cfg_fn)(sd_t *sd);
+ /* Setup transfer elements (memory/packet segments). */
+ odp_bool_t (*setup_fn)(sd_t *sd);
+ /* Configure DMA transfers (segment addresses etc.). */
+ void (*trs_fn)(sd_t *sd);
+ /* Configure transfer completion resources (transfer IDs, events etc.). */
+ odp_bool_t (*compl_fn)(sd_t *sd);
+ /* Initiate required initial transfers. */
+ odp_bool_t (*bootstrap_fn)(sd_t *sd);
+ /* Wait and handle finished transfer. */
+ void (*wait_fn)(sd_t *sd, stats_t *stats);
+ /* Handle all unfinished transfers after main test has been stopped. */
+ void (*drain_fn)(void);
+ /* Free any resources that might have been allocated during setup phase. */
+ void (*free_fn)(const sd_t *sd);
+} test_api_t;
+
+typedef struct prog_config_s {
+ odph_thread_t threads[MAX_WORKERS];
+ thread_config_t thread_config[MAX_WORKERS];
+ sd_t sds[MAX_WORKERS];
+ test_api_t api;
+ odp_atomic_u32_t is_running;
+ odp_instance_t odp_instance;
+ odp_barrier_t init_barrier;
+ odp_barrier_t term_barrier;
+ odp_dma_compl_mode_t compl_mode_mask;
+ odp_pool_t src_pool;
+ odp_pool_t dst_pool;
+ uint32_t num_in_segs;
+ uint32_t num_out_segs;
+ uint32_t src_seg_len;
+ uint32_t dst_seg_len;
+ uint32_t num_inflight;
+ uint32_t time_sec;
+ uint32_t num_sessions;
+ int num_workers;
+ uint8_t trs_type;
+ uint8_t seg_type;
+ uint8_t compl_mode;
+ uint8_t policy;
+} prog_config_t;
+
+static prog_config_t *prog_conf;
+
+static const int mode_map[] = { ODP_DMA_COMPL_POLL, ODP_DMA_COMPL_EVENT };
+
+static void terminate(int signal ODP_UNUSED)
{
- memset(config, 0, sizeof(*config));
- config->num_in_seg = 1;
- config->seg_size = DEFAULT_SEG_SIZE;
- config->num_rounds = ROUNDS;
- config->wait_ns = DEFAULT_WAIT_NS;
- config->compl_modes.compl_mask = ODP_DMA_COMPL_SYNC;
+ odp_atomic_store_u32(&prog_conf->is_running, 0U);
}
-static void parse_completion_modes(test_config_t *config, const char *optarg)
+static void init_config(prog_config_t *config)
{
- char *tmp_str = strdup(optarg);
- char *tmp;
- int mode;
- uint32_t i = 0U;
-
- config->compl_modes.num_modes = 0;
-
- if (tmp_str == NULL)
- return;
+ sd_t *sd;
+ trs_info_t *info;
+ stats_t *stats;
- tmp = strtok(tmp_str, COMPL_DELIMITER);
+ memset(config, 0, sizeof(*config));
+ config->compl_mode_mask |= ODP_DMA_COMPL_SYNC;
+ config->src_pool = ODP_POOL_INVALID;
+ config->dst_pool = ODP_POOL_INVALID;
+ config->num_in_segs = DEF_SEG_CNT;
+ config->num_out_segs = DEF_SEG_CNT;
+ config->src_seg_len = DEF_LEN;
+ config->num_inflight = DEF_INFLIGHT;
+ config->time_sec = DEF_TIME;
+ config->num_workers = DEF_WORKERS;
+ config->trs_type = DEF_TRS_TYPE;
+ config->seg_type = DEF_SEG_TYPE;
+ config->compl_mode = DEF_MODE;
+ config->policy = DEF_POLICY;
+
+ for (uint32_t i = 0U; i < MAX_WORKERS; ++i) {
+ sd = &config->sds[i];
+ stats = &config->thread_config[i].stats;
+ memset(sd, 0, sizeof(*sd));
+
+ for (uint32_t i = 0U; i < MAX_SEGS; ++i) {
+ info = &sd->dma.infos[i];
+ info->compl_param.transfer_id = ODP_DMA_TRANSFER_ID_INVALID;
+ info->compl_param.event = ODP_EVENT_INVALID;
+ info->compl_param.queue = ODP_QUEUE_INVALID;
+ odp_ticketlock_init(&info->lock);
+ sd->seg.src_pkt[i] = ODP_PACKET_INVALID;
+ sd->seg.dst_pkt[i] = ODP_PACKET_INVALID;
+ }
- while (tmp) {
- mode = atoi(tmp);
- config->compl_modes.modes[i] = mode;
- config->compl_modes.compl_mask |= compl_mode_map[mode];
- ++i;
- ++config->compl_modes.num_modes;
- tmp = strtok(NULL, COMPL_DELIMITER);
+ sd->dma.handle = ODP_DMA_INVALID;
+ sd->dma.pool = ODP_POOL_INVALID;
+ sd->dma.compl_q = ODP_QUEUE_INVALID;
+ sd->seg.src_shm = ODP_SHM_INVALID;
+ sd->seg.dst_shm = ODP_SHM_INVALID;
+ sd->grp = ODP_SCHED_GROUP_INVALID;
+ stats->min_trs_tm = UINT64_MAX;
+ stats->min_start_cc = UINT64_MAX;
+ stats->min_wait_cc = UINT64_MAX;
+ stats->min_trs_cc = UINT64_MAX;
}
-
- free(tmp_str);
}
static void print_usage(void)
{
printf("\n"
- "DMA performance test. Transfers a set of source segments to a single destination\n"
- "segment.\n"
+ "DMA performance test. Load DMA subsystem from several workers.\n"
"\n"
"Examples:\n"
- " odp_dma_perf\n"
- " odp_dma_perf -t 0 -g 1 -i 2\n"
- " odp_dma_perf -t 1 -g 1 -i 4 -m 0,0,0,0\n"
- " odp_dma_perf -t 1 -g 1 -i 7 -m 0,0,0,0,0,0,1 -T 1 -r 1000 -s 2048\n"
+ " " PROG_NAME "\n"
+ " " PROG_NAME " -s 10240\n"
+ " " PROG_NAME " -t 0 -i 1 -o 1 -s 51200 -S 1 -f 64 -T 10\n"
+ " " PROG_NAME " -t 1 -i 10 -o 10 -s 4096 -S 0 -m 1 -f 10 -c 4 -p 1\n"
"\n"
- "Usage: odp_dma_perf [options]\n"
+ "Usage: " PROG_NAME " [options]\n"
"\n"
- " -t, --trs_type Transfer type for test data. Synchronous by default.\n"
+ " -t, --trs_type Transfer type for test data. %u by default.\n"
" Types:\n"
" 0: synchronous\n"
" 1: asynchronous\n"
- " -g, --trs_grn Transfer granularity for source segments. All\n"
- " segments are sent in one transfer by default.\n"
- " Options:\n"
- " 0: all segments in a single transfer\n"
- " 1: individual transfers for segments\n"
- " -i, --num_in_seg Number of input segments to transfer. 1 by\n"
- " default. Maximum supported amount is %d.\n"
- " -s, --in_seg_size Segment size for all input segments in bytes. 1024\n"
- " bytes by default. Maximum allowed destination\n"
- " segment size may limit this choice.\n"
- " -T, --in_seg_type Input segment data type. Packet by default.\n"
+ " -i, --num_in_seg Number of input segments to transfer. 0 means the\n"
+ " maximum count supported by the implementation. %u by\n"
+ " default.\n"
+ " -o, --num_out_seg Number of output segments to transfer to. 0 means\n"
+ " the maximum count supported by the implementation.\n"
+ " %u by default.\n"
+ " -s, --in_seg_len Input segment length in bytes. 0 length means\n"
+ " maximum segment length supported by implementation.\n"
+ " The actual maximum might be limited by what type of\n"
+ " data is transferred (packet/memory).\n"
+ " %u by default.\n"
+ " -S, --in_seg_type Input segment data type. %u by default.\n"
" Types:\n"
" 0: packet\n"
" 1: memory\n"
- " -m, --compl_modes Completion mode(s) for transfers delimited by a\n"
- " comma. Only applicable in asynchronous mode.\n"
+ " -m, --compl_mode Completion mode for transfers. %u by default.\n"
" Modes:\n"
" 0: poll\n"
" 1: event\n"
- " -r, --num_rounds Number of times to run the test scenario. %d by\n"
+ " -f, --max_in_flight Max transfers in-flight per session. 0 means the\n"
+ " maximum supported by tester/implementation. %u by\n"
+ " default.\n"
+ " -T, --time_sec Time in seconds to run. 0 means infinite. %u by\n"
" default.\n"
- " -w, --wait_nsec Number of nanoseconds to wait for completion events.\n"
- " 1 second (1000000000) by default.\n"
+ " -c, --worker_count Amount of workers. %u by default.\n"
+ " -p, --policy DMA session policy. %u by default.\n"
+ " Policies:\n"
+ " 0: One session shared by workers\n"
+ " 1: One session per worker\n"
" -h, --help This help.\n"
- "\n",
- MAX_NUM_IN_SEGS, ROUNDS);
+ "\n", DEF_TRS_TYPE, DEF_SEG_CNT, DEF_SEG_CNT, DEF_LEN, DEF_SEG_TYPE, DEF_MODE,
+ DEF_INFLIGHT, DEF_TIME, DEF_WORKERS, DEF_POLICY);
}
-static int check_completion_modes(test_config_t *config)
+static parse_result_t check_options(prog_config_t *config)
{
- if (config->trs_type == TRS_TYPE_SYNC)
- return 0;
+ int max_workers;
+ odp_dma_capability_t dma_capa;
+ uint32_t num_sessions, max_seg_len, max_trs, max_in, max_out, max_segs;
+ odp_schedule_capability_t sched_capa;
+ odp_pool_capability_t pool_capa;
+ odp_shm_capability_t shm_capa;
+ uint64_t shm_size = 0U;
+
+ if (config->trs_type != SYNC && config->trs_type != ASYNC) {
+ ODPH_ERR("Invalid transfer type: %u\n", config->trs_type);
+ return PRS_NOK;
+ }
+
+ if (config->seg_type != PACKET && config->seg_type != MEMORY) {
+ ODPH_ERR("Invalid segment type: %u\n", config->seg_type);
+ return PRS_NOK;
+ }
+
+ max_workers = MIN(odp_thread_count_max() - 1, MAX_WORKERS);
- if (config->compl_modes.num_modes > MAX_NUM_IN_SEGS)
- return -1;
+ if (config->num_workers <= 0 || config->num_workers > max_workers) {
+ ODPH_ERR("Invalid thread count: %d (min: 1, max: %d)\n", config->num_workers,
+ max_workers);
+ return PRS_NOK;
+ }
- if (config->trs_grn == GRN_IND &&
- config->num_in_seg != config->compl_modes.num_modes)
- return -1;
+ if (config->policy != SINGLE && config->policy != MANY) {
+ ODPH_ERR("Invalid DMA session policy: %u\n", config->policy);
+ return PRS_NOK;
+ }
- if (config->trs_grn == GRN_ALL &&
- config->compl_modes.num_modes != 1)
- return -1;
+ if (odp_dma_capability(&dma_capa) < 0) {
+ ODPH_ERR("Error querying DMA capabilities\n");
+ return PRS_NOK;
+ }
- for (int i = 0; i < config->compl_modes.num_modes; ++i) {
- if (config->compl_modes.modes[i] != COMPL_MODE_POLL &&
- config->compl_modes.modes[i] != COMPL_MODE_EVENT)
- return -1;
+ num_sessions = config->policy == SINGLE ? 1 : config->num_workers;
- config->compl_modes.modes[i] = compl_mode_map[config->compl_modes.modes[i]];
+ if (num_sessions > dma_capa.max_sessions) {
+ ODPH_ERR("Not enough DMA sessions supported: %u (max: %u)\n", num_sessions,
+ dma_capa.max_sessions);
+ return PRS_NOT_SUP;
}
- return 0;
-}
+ config->num_sessions = num_sessions;
-static int check_options(test_config_t *config)
-{
- if (config->trs_type != TRS_TYPE_SYNC &&
- config->trs_type != TRS_TYPE_ASYNC) {
- ODPH_ERR("Invalid transfer type: %d.\n", config->trs_type);
- return -1;
+ if (config->num_in_segs == 0U)
+ config->num_in_segs = dma_capa.max_src_segs;
+
+ if (config->num_out_segs == 0U)
+ config->num_out_segs = dma_capa.max_dst_segs;
+
+ if (config->num_in_segs > dma_capa.max_src_segs ||
+ config->num_out_segs > dma_capa.max_dst_segs ||
+ config->num_in_segs + config->num_out_segs > dma_capa.max_segs) {
+ ODPH_ERR("Unsupported segment count configuration, in: %u, out: %u (max in: %u, "
+ "max out: %u, max tot: %u)\n", config->num_in_segs, config->num_out_segs,
+ dma_capa.max_src_segs, dma_capa.max_dst_segs, dma_capa.max_segs);
+ return PRS_NOT_SUP;
}
- if (config->trs_grn != GRN_ALL && config->trs_grn != GRN_IND) {
- ODPH_ERR("Invalid granularity: %d.\n", config->trs_grn);
- return -1;
+ if (config->src_seg_len == 0U)
+ config->src_seg_len = dma_capa.max_seg_len;
+
+ config->dst_seg_len = config->src_seg_len * config->num_in_segs /
+ config->num_out_segs + config->src_seg_len *
+ config->num_in_segs % config->num_out_segs;
+
+ max_seg_len = MAX(config->src_seg_len, config->dst_seg_len);
+
+ if (max_seg_len > dma_capa.max_seg_len) {
+ ODPH_ERR("Unsupported total DMA segment length: %u (max: %u)\n", max_seg_len,
+ dma_capa.max_seg_len);
+ return PRS_NOT_SUP;
}
- config->dma_rounds = config->trs_grn == GRN_IND ? config->num_in_seg : 1;
+ if (config->trs_type == ASYNC) {
+ if (config->compl_mode != POLL && config->compl_mode != EVENT) {
+ ODPH_ERR("Invalid completion mode: %u\n", config->compl_mode);
+ return PRS_NOK;
+ }
+
+ if (config->compl_mode == POLL && (dma_capa.compl_mode_mask & ODP_DMA_COMPL_POLL)
+ == 0U) {
+ ODPH_ERR("Unsupported DMA completion mode, poll\n");
+ return PRS_NOT_SUP;
+ }
+
+ if (config->compl_mode == EVENT) {
+ if (config->num_sessions > dma_capa.pool.max_pools) {
+ ODPH_ERR("Unsupported amount of completion pools: %u (max: %u)\n",
+ config->num_sessions, dma_capa.pool.max_pools);
+ return PRS_NOT_SUP;
+ }
+
+ if ((dma_capa.compl_mode_mask & ODP_DMA_COMPL_EVENT) == 0U) {
+ ODPH_ERR("Unsupported DMA completion mode, event\n");
+ return PRS_NOT_SUP;
+ }
+
+ if (dma_capa.queue_type_sched == 0) {
+ ODPH_ERR("Unsupported DMA queueing type, scheduled\n");
+ return PRS_NOT_SUP;
+ }
+
+ if (config->num_inflight > dma_capa.pool.max_num) {
+ ODPH_ERR("Unsupported amount of completion events: %u (max: %u)\n",
+ config->num_inflight, dma_capa.pool.max_num);
+ return PRS_NOT_SUP;
+ }
+
+ if (odp_schedule_capability(&sched_capa) < 0) {
+ ODPH_ERR("Error querying scheduler capabilities\n");
+ return PRS_NOK;
+ }
+
+ if (config->num_sessions > sched_capa.max_groups - 3U) {
+ ODPH_ERR("Unsupported amount of scheduler groups: %u (max: %u)\n",
+ config->num_sessions, sched_capa.max_groups - 3U);
+ return PRS_NOT_SUP;
+ }
+ }
- if (config->num_in_seg < 1 || config->num_in_seg > MAX_NUM_IN_SEGS) {
- ODPH_ERR("Invalid number of input segments: %d.\n", config->num_in_seg);
- return -1;
+ config->compl_mode_mask |= mode_map[config->compl_mode];
}
- if (config->seg_type != TYPE_PKT && config->seg_type != TYPE_MEM) {
- ODPH_ERR("Invalid input segment type: %d.\n", config->seg_type);
- return -1;
+ max_trs = MIN(dma_capa.max_transfers, MAX_SEGS);
+
+ if (config->num_inflight == 0U)
+ config->num_inflight = max_trs;
+
+ if (config->num_inflight > max_trs) {
+ ODPH_ERR("Unsupported amount of in-flight DMA transfers: %u (max: %u)\n",
+ config->num_inflight, max_trs);
+ return PRS_NOT_SUP;
}
- if (check_completion_modes(config)) {
- ODPH_ERR("Invalid completion modes.\n");
- return -1;
+ max_in = config->num_in_segs * config->num_inflight;
+ max_out = config->num_out_segs * config->num_inflight;
+ max_segs = MAX(max_in, max_out);
+
+ if (max_segs > MAX_SEGS) {
+ ODPH_ERR("Unsupported input/output * inflight segment combination: %u (max: %u)\n",
+ max_segs, MAX_SEGS);
+ return PRS_NOT_SUP;
}
- if (config->num_rounds < 1) {
- ODPH_ERR("Invalid number of rounds: %d.\n", config->num_rounds);
- return -1;
+ if (config->seg_type == PACKET) {
+ if (odp_pool_capability(&pool_capa) < 0) {
+ ODPH_ERR("Error querying pool capabilities\n");
+ return PRS_NOK;
+ }
+
+ if (pool_capa.pkt.max_pools < 2U) {
+ ODPH_ERR("Unsupported amount of packet pools: 2 (max: %u)\n",
+ pool_capa.pkt.max_pools);
+ return PRS_NOT_SUP;
+ }
+
+ if (pool_capa.pkt.max_len != 0U && max_seg_len > pool_capa.pkt.max_len) {
+ ODPH_ERR("Unsupported packet size: %u (max: %u)\n", max_seg_len,
+ pool_capa.pkt.max_len);
+ return PRS_NOT_SUP;
+ }
+
+ if (pool_capa.pkt.max_num != 0U &&
+ max_segs * num_sessions > pool_capa.pkt.max_num) {
+ ODPH_ERR("Unsupported amount of packet pool elements: %u (max: %u)\n",
+ max_segs * num_sessions, pool_capa.pkt.max_num);
+ return PRS_NOT_SUP;
+ }
+ } else {
+ /* If SHM implementation capabilities are very puny, program will have already
+ * failed when reserving memory for global program configuration. */
+ if (odp_shm_capability(&shm_capa) < 0) {
+ ODPH_ERR("Error querying SHM capabilities\n");
+ return PRS_NOK;
+ }
+
+ /* One block for program configuration, one for source memory and one for
+ * destination memory. */
+ if (shm_capa.max_blocks < 3U) {
+ ODPH_ERR("Unsupported amount of SHM blocks: 3 (max: %u)\n",
+ shm_capa.max_blocks);
+ return PRS_NOT_SUP;
+ }
+
+ shm_size = (uint64_t)config->dst_seg_len * config->num_out_segs *
+ config->num_inflight;
+
+ if (shm_capa.max_size != 0U && shm_size > shm_capa.max_size) {
+ ODPH_ERR("Unsupported total SHM block size: %" PRIu64 ""
+ " (max: %" PRIu64 ")\n", shm_size, shm_capa.max_size);
+ return PRS_NOT_SUP;
+ }
}
- return 0;
+ return PRS_OK;
}
-static int parse_options(int argc, char **argv, test_config_t *config)
+static parse_result_t parse_options(int argc, char **argv, prog_config_t *config)
{
int opt, long_index;
-
static const struct option longopts[] = {
{ "trs_type", required_argument, NULL, 't' },
- { "trs_grn", required_argument, NULL, 'g' },
{ "num_in_seg", required_argument, NULL, 'i' },
- { "in_seg_size", required_argument, NULL, 's' },
- { "in_seg_type", required_argument, NULL, 'T' },
- { "compl_modes", required_argument, NULL, 'm' },
- { "num_rounds", required_argument, NULL, 'r' },
- { "wait_nsec", required_argument, NULL, 'w' },
+ { "num_out_seg", required_argument, NULL, 'o' },
+ { "in_seg_len", required_argument, NULL, 's' },
+ { "in_seg_type", required_argument, NULL, 'S' },
+ { "compl_mode", required_argument, NULL, 'm' },
+ { "max_in_flight", required_argument, NULL, 'f'},
+ { "time_sec", required_argument, NULL, 'T' },
+ { "worker_count", required_argument, NULL, 'c' },
+ { "policy", required_argument, NULL, 'p' },
{ "help", no_argument, NULL, 'h' },
{ NULL, 0, NULL, 0 }
};
+ static const char *shortopts = "t:i:o:s:S:m:f:T:c:p:h";
- static const char *shortopts = "t:g:i:s:T:m:r:w:h";
-
- set_option_defaults(config);
+ init_config(config);
while (1) {
opt = getopt_long(argc, argv, shortopts, longopts, &long_index);
@@ -280,862 +529,1076 @@ static int parse_options(int argc, char **argv, test_config_t *config)
case 't':
config->trs_type = atoi(optarg);
break;
- case 'g':
- config->trs_grn = atoi(optarg);
- break;
case 'i':
- config->num_in_seg = atoi(optarg);
+ config->num_in_segs = atoi(optarg);
+ break;
+ case 'o':
+ config->num_out_segs = atoi(optarg);
break;
case 's':
- config->seg_size = atoi(optarg);
+ config->src_seg_len = atoi(optarg);
break;
- case 'T':
+ case 'S':
config->seg_type = atoi(optarg);
break;
case 'm':
- parse_completion_modes(config, optarg);
+ config->compl_mode = atoi(optarg);
break;
- case 'r':
- config->num_rounds = atoi(optarg);
+ case 'f':
+ config->num_inflight = atoi(optarg);
break;
- case 'w':
- config->wait_ns = atoll(optarg);
+ case 'T':
+ config->time_sec = atoi(optarg);
+ break;
+ case 'c':
+ config->num_workers = atoi(optarg);
+ break;
+ case 'p':
+ config->policy = atoi(optarg);
break;
case 'h':
+ print_usage();
+ return PRS_TERM;
+ case '?':
default:
print_usage();
- return -1;
+ return PRS_NOK;
}
}
- if (check_options(config))
- return -1;
-
- return 0;
+ return check_options(config);
}
-static int check_shm_capabilities(const test_config_t *config)
+static parse_result_t setup_program(int argc, char **argv, prog_config_t *config)
{
- odp_shm_capability_t capa;
-
- if (odp_shm_capability(&capa)) {
- ODPH_ERR("Error querying SHM capabilities.\n");
- return -1;
+ struct sigaction action = { .sa_handler = terminate };
+
+ if (sigemptyset(&action.sa_mask) == -1 || sigaddset(&action.sa_mask, SIGINT) == -1 ||
+ sigaddset(&action.sa_mask, SIGTERM) == -1 ||
+ sigaddset(&action.sa_mask, SIGHUP) == -1 || sigaction(SIGINT, &action, NULL) == -1 ||
+ sigaction(SIGTERM, &action, NULL) == -1 || sigaction(SIGHUP, &action, NULL) == -1) {
+ ODPH_ERR("Error installing signal handler\n");
+ return PRS_NOK;
}
- if (capa.max_blocks < 2U) {
- ODPH_ERR("Unsupported amount of SHM blocks.\n");
- return -1;
- }
-
- if (capa.max_size != 0U && config->num_in_seg * config->seg_size > capa.max_size) {
- ODPH_ERR("Unsupported total SHM block size.\n");
- return -1;
- }
-
- if (capa.max_align != 0U && capa.max_align < ODP_CACHE_LINE_SIZE) {
- ODPH_ERR("Unsupported SHM block alignment size.\n");
- return -1;
- }
-
- return 0;
+ return parse_options(argc, argv, config);
}
-static int check_dma_capabilities(const test_config_t *config)
+static odp_pool_t get_src_packet_pool(void)
{
- odp_dma_capability_t capa;
- const int is_event = config->compl_modes.compl_mask & ODP_DMA_COMPL_EVENT;
- uint32_t event_compl_count = 0U;
-
- if (odp_dma_capability(&capa)) {
- ODPH_ERR("Error querying DMA capabilities.\n");
- return -1;
- }
-
- if (capa.max_sessions == 0U) {
- ODPH_ERR("DMA not supported.\n");
- return -1;
- }
-
- if (config->trs_type == TRS_TYPE_ASYNC) {
- if ((config->compl_modes.compl_mask & ODP_DMA_COMPL_POLL) &&
- (capa.compl_mode_mask & ODP_DMA_COMPL_POLL) == 0U) {
- ODPH_ERR("Unsupported DMA completion mode, poll.\n");
- return -1;
- }
-
- if (is_event && (capa.compl_mode_mask & ODP_DMA_COMPL_EVENT) == 0U) {
- ODPH_ERR("Unsupported DMA completion mode, event.\n");
- return -1;
- }
-
- if (is_event && capa.queue_type_sched == 0) {
- ODPH_ERR("Unsupported DMA queueing type.\n");
- return -1;
- }
-
- if (config->trs_grn == GRN_IND) {
- if ((uint32_t)config->num_in_seg > capa.max_transfers) {
- ODPH_ERR("Unsupported amount of in-flight DMA transfers.\n");
- return -1;
- }
-
- for (int i = 0; i < config->compl_modes.num_modes; ++i)
- if (config->compl_modes.modes[i] == ODP_DMA_COMPL_EVENT)
- ++event_compl_count;
-
- if (event_compl_count > capa.pool.max_num) {
- ODPH_ERR("Unsupported amount of completion events.\n");
- return -1;
- }
- }
- }
-
- if (config->trs_grn == GRN_ALL) {
- if ((uint32_t)config->num_in_seg > capa.max_src_segs) {
- ODPH_ERR("Unsupported amount of DMA source segments.\n");
- return -1;
- }
-
- if (config->num_in_seg + 1U > capa.max_segs) {
- ODPH_ERR("Unsupported total amount of DMA segments.\n");
- return -1;
- }
- }
-
- if (config->trs_grn == GRN_IND && capa.max_segs < 2U) {
- ODPH_ERR("Unsupported total amount of DMA segments.\n");
- return -1;
- }
+ odp_pool_param_t param;
- if (config->num_in_seg * config->seg_size > capa.max_seg_len) {
- ODPH_ERR("Unsupported total DMA segment size.\n");
- return -1;
- }
+ if (prog_conf->src_pool != ODP_POOL_INVALID)
+ return prog_conf->src_pool;
- return 0;
-}
+ odp_pool_param_init(&param);
+ param.type = ODP_POOL_PACKET;
+ param.pkt.num = prog_conf->num_inflight * prog_conf->num_in_segs * prog_conf->num_sessions;
+ param.pkt.len = prog_conf->src_seg_len;
+ param.pkt.seg_len = prog_conf->src_seg_len;
+ prog_conf->src_pool = odp_pool_create(PROG_NAME "_src_pkts", &param);
-static int check_capabilities(const test_config_t *config)
-{
- return check_shm_capabilities(config) ||
- check_dma_capabilities(config);
+ return prog_conf->src_pool;
}
-static int configure_packets(test_config_t *config)
+static odp_pool_t get_dst_packet_pool(void)
{
odp_pool_param_t param;
- for (int i = 0; i < config->num_in_seg + 1; ++i)
- config->seg_config.pkts[i] = ODP_PACKET_INVALID;
+ if (prog_conf->dst_pool != ODP_POOL_INVALID)
+ return prog_conf->dst_pool;
odp_pool_param_init(&param);
param.type = ODP_POOL_PACKET;
- /* Configured amount of input segments and one output segment */
- param.pkt.num = config->num_in_seg + 1U;
- param.pkt.len = config->num_in_seg * config->seg_size;
- config->seg_config.pool = odp_pool_create("odp_dma_perf_packets", &param);
-
- if (config->seg_config.pool == ODP_POOL_INVALID) {
- ODPH_ERR("Error creating packet pool.\n");
- return -1;
- }
+ param.pkt.num = prog_conf->num_inflight * prog_conf->num_out_segs *
+ prog_conf->num_sessions;
+ param.pkt.len = prog_conf->dst_seg_len;
+ param.pkt.seg_len = prog_conf->dst_seg_len;
+ prog_conf->dst_pool = odp_pool_create(PROG_NAME "_dst_pkts", &param);
- return 0;
+ return prog_conf->dst_pool;
}
-static int allocate_packets(test_config_t *config)
+static odp_bool_t configure_packets(sd_t *sd)
{
- for (int i = 0; i < config->num_in_seg; ++i) {
- config->seg_config.pkts[i] = odp_packet_alloc(config->seg_config.pool,
- config->seg_size);
+ sd->seg.src_pool = get_src_packet_pool();
- if (config->seg_config.pkts[i] == ODP_PACKET_INVALID) {
- ODPH_ERR("Error allocating input test packets.\n");
- return -1;
- }
+ if (sd->seg.src_pool == ODP_POOL_INVALID) {
+ ODPH_ERR("Error creating source packet pool\n");
+ return false;
}
- config->seg_config.pkts[config->num_in_seg] =
- odp_packet_alloc(config->seg_config.pool, config->num_in_seg * config->seg_size);
+ sd->seg.dst_pool = get_dst_packet_pool();
- if (config->seg_config.pkts[config->num_in_seg] == ODP_PACKET_INVALID) {
- ODPH_ERR("Error allocating output test packet.\n");
- return -1;
+ if (sd->seg.dst_pool == ODP_POOL_INVALID) {
+ ODPH_ERR("Error creating destination packet pool\n");
+ return false;
}
- return 0;
+ return true;
}
-static int populate_packets(test_config_t *config)
+static odp_bool_t allocate_packets(sd_t *sd)
{
- for (int i = 0; i < config->num_in_seg; ++i) {
- uint8_t data[odp_packet_len(config->seg_config.pkts[i])];
-
- memset(data, i + 1, sizeof(data));
+ for (uint32_t i = 0U; i < sd->dma.num_inflight * sd->dma.num_in_segs; ++i) {
+ sd->seg.src_pkt[i] = odp_packet_alloc(sd->seg.src_pool, sd->dma.src_seg_len);
- if (odp_packet_copy_from_mem(config->seg_config.pkts[i], 0U, sizeof(data), data))
- return -1;
+ if (sd->seg.src_pkt[i] == ODP_PACKET_INVALID) {
+ ODPH_ERR("Error allocating source segment packets\n");
+ return false;
+ }
}
- return 0;
-}
+ for (uint32_t i = 0U; i < sd->dma.num_inflight * sd->dma.num_out_segs; ++i) {
+ sd->seg.dst_pkt[i] = odp_packet_alloc(sd->seg.dst_pool, sd->dma.dst_seg_len);
-static int setup_packet_segments(test_config_t *config)
-{
- return configure_packets(config) ||
- allocate_packets(config) ||
- populate_packets(config);
-}
-
-static void configure_packet_dma_transfer_base(test_config_t *config,
- odp_dma_transfer_param_t trs_params[],
- uint32_t trs_lengths[])
-{
- memset(trs_lengths, 0, sizeof(*trs_lengths) * config->dma_rounds);
-
- for (int i = 0; i < config->num_in_seg; ++i) {
- config->dma_config.src_seg[i].packet = config->seg_config.pkts[i];
- config->dma_config.src_seg[i].offset = 0U;
- config->dma_config.src_seg[i].len = odp_packet_len(config->seg_config.pkts[i]);
+ if (sd->seg.dst_pkt[i] == ODP_PACKET_INVALID) {
+ ODPH_ERR("Error allocating destination segment packets\n");
+ return false;
+ }
}
- config->dma_config.dst_seg.packet = config->seg_config.pkts[config->num_in_seg];
-
- for (int i = 0; i < config->dma_rounds; ++i) {
- odp_dma_transfer_param_init(&trs_params[i]);
- trs_params[i].src_format = ODP_DMA_FORMAT_PACKET;
- trs_params[i].dst_format = ODP_DMA_FORMAT_PACKET;
- trs_params[i].num_src = config->trs_grn == GRN_IND ? 1 : config->num_in_seg;
- trs_params[i].num_dst = 1U;
- trs_params[i].src_seg = &config->dma_config.src_seg[i];
- trs_params[i].dst_seg = &config->dma_config.dst_seg;
- trs_lengths[i] = config->trs_grn == GRN_IND ?
- config->dma_config.src_seg[i].len :
- config->num_in_seg * config->seg_size;
- }
+ return true;
}
-static inline void configure_packet_dma_transfer_dynamic(test_config_t *config, uint32_t offset,
- uint32_t len)
+static odp_bool_t setup_packet_segments(sd_t *sd)
{
- config->dma_config.dst_seg.offset = offset;
- config->dma_config.dst_seg.len = len;
+ return configure_packets(sd) && allocate_packets(sd);
}
-static int verify_packet_transfer(const test_config_t *config)
+static void configure_packet_dma_transfer(sd_t *sd)
{
- uint32_t len, offset = 0U;
-
- for (int i = 0; i < config->num_in_seg; ++i) {
- len = odp_packet_len(config->seg_config.pkts[i]);
- uint8_t src_data[len];
- uint8_t dst_data[len];
-
- if (odp_packet_copy_to_mem(config->seg_config.pkts[i], 0U, len, src_data) ||
- odp_packet_copy_to_mem(config->seg_config.pkts[config->num_in_seg], offset,
- len, dst_data)) {
- ODPH_ERR("Error verifying DMA transfer.\n");
- return -1;
+ odp_dma_seg_t *start_src_seg, *start_dst_seg, *seg;
+ uint32_t k = 0U, z = 0U, len;
+ odp_packet_t pkt;
+ odp_dma_transfer_param_t *param;
+
+ for (uint32_t i = 0U; i < sd->dma.num_inflight; ++i) {
+ start_src_seg = &sd->dma.src_seg[k];
+ start_dst_seg = &sd->dma.dst_seg[z];
+
+ for (uint32_t j = 0U; j < sd->dma.num_in_segs; ++j, ++k) {
+ pkt = sd->seg.src_pkt[k];
+ seg = &start_src_seg[j];
+ seg->packet = pkt;
+ seg->offset = 0U;
+ seg->len = sd->dma.src_seg_len;
}
- if (memcmp(src_data, dst_data, len)) {
- ODPH_ERR("Error in DMA transfer, source and destination data do not match.\n");
- return -1;
+ len = sd->dma.num_in_segs * sd->dma.src_seg_len;
+
+ for (uint32_t j = 0U; j < sd->dma.num_out_segs; ++j, ++z) {
+ pkt = sd->seg.dst_pkt[z];
+ seg = &start_dst_seg[j];
+ seg->packet = pkt;
+ seg->offset = 0U;
+ seg->len = MIN(len, sd->dma.dst_seg_len);
+ len -= sd->dma.dst_seg_len;
}
- offset += len;
+ param = &sd->dma.infos[i].trs_param;
+ odp_dma_transfer_param_init(param);
+ param->src_format = ODP_DMA_FORMAT_PACKET;
+ param->dst_format = ODP_DMA_FORMAT_PACKET;
+ param->num_src = sd->dma.num_in_segs;
+ param->num_dst = sd->dma.num_out_segs;
+ param->src_seg = start_src_seg;
+ param->dst_seg = start_dst_seg;
}
-
- return 0;
}
-static void free_packets(test_config_t *config)
+static void free_packets(const sd_t *sd)
{
- /* Configured amount of input segments and one output segment */
- for (int i = 0; i < config->num_in_seg + 1; ++i)
- if (config->seg_config.pkts[i] != ODP_PACKET_INVALID)
- odp_packet_free(config->seg_config.pkts[i]);
+ for (uint32_t i = 0U; i < sd->dma.num_inflight * sd->dma.num_in_segs; ++i) {
+ if (sd->seg.src_pkt[i] != ODP_PACKET_INVALID)
+ odp_packet_free(sd->seg.src_pkt[i]);
+ }
- if (config->seg_config.pool != ODP_POOL_INVALID)
- (void)odp_pool_destroy(config->seg_config.pool);
+ for (uint32_t i = 0U; i < sd->dma.num_inflight * sd->dma.num_out_segs; ++i) {
+ if (sd->seg.dst_pkt[i] != ODP_PACKET_INVALID)
+ odp_packet_free(sd->seg.dst_pkt[i]);
+ }
}
-static int allocate_memory(test_config_t *config)
+static odp_bool_t allocate_memory(sd_t *sd)
{
- const uint64_t size = config->num_in_seg * (uint64_t)config->seg_size;
+ const uint64_t num_segs = (uint64_t)sd->dma.num_in_segs * sd->dma.num_inflight;
- config->seg_config.shm_src = ODP_SHM_INVALID;
- config->seg_config.shm_dst = ODP_SHM_INVALID;
- config->seg_config.src = NULL;
- config->seg_config.dst = NULL;
+ sd->seg.src_shm = odp_shm_reserve(PROG_NAME "_src_shm", sd->dma.src_seg_len * num_segs,
+ ODP_CACHE_LINE_SIZE, 0U);
+ sd->seg.dst_shm = odp_shm_reserve(PROG_NAME "_dst_shm", sd->dma.dst_seg_len * num_segs,
+ ODP_CACHE_LINE_SIZE, 0U);
- config->seg_config.shm_src = odp_shm_reserve(SHM_SRC, size, ODP_CACHE_LINE_SIZE, 0);
- config->seg_config.shm_dst = odp_shm_reserve(SHM_DST, size, ODP_CACHE_LINE_SIZE, 0);
-
- if (config->seg_config.shm_src == ODP_SHM_INVALID ||
- config->seg_config.shm_dst == ODP_SHM_INVALID) {
- ODPH_ERR("Error allocating SHM block.\n");
- return -1;
+ if (sd->seg.src_shm == ODP_SHM_INVALID || sd->seg.dst_shm == ODP_SHM_INVALID) {
+ ODPH_ERR("Error allocating SHM block\n");
+ return false;
}
- config->seg_config.src = odp_shm_addr(config->seg_config.shm_src);
- config->seg_config.dst = odp_shm_addr(config->seg_config.shm_dst);
+ sd->seg.src = odp_shm_addr(sd->seg.src_shm);
+ sd->seg.dst = odp_shm_addr(sd->seg.dst_shm);
- if (config->seg_config.src == NULL || config->seg_config.dst == NULL) {
- ODPH_ERR("Error resolving SHM block address.\n");
- return -1;
+ if (sd->seg.src == NULL || sd->seg.dst == NULL) {
+ ODPH_ERR("Error resolving SHM block address\n");
+ return false;
}
- return 0;
+ return true;
}
-static int populate_memory(test_config_t *config)
+static odp_bool_t setup_memory_segments(sd_t *sd)
{
- uint8_t val;
- uint8_t *addr;
-
- for (int i = 0; i < config->num_in_seg; ++i) {
- val = 0U;
- addr = (uint8_t *)config->seg_config.src + i * config->seg_size;
-
- for (uint32_t i = 0U; i < config->seg_size; ++i)
- addr[i] = val++;
- }
-
- return 0;
+ return allocate_memory(sd);
}
-static int setup_memory_segments(test_config_t *config)
+static void configure_address_dma_transfer(sd_t *sd)
{
- return allocate_memory(config) ||
- populate_memory(config);
-}
+ odp_dma_seg_t *start_src_seg, *start_dst_seg, *seg;
+ uint32_t k = 0U, z = 0U, len;
+ odp_dma_transfer_param_t *param;
+
+ for (uint32_t i = 0U; i < sd->dma.num_inflight; ++i) {
+ start_src_seg = &sd->dma.src_seg[k];
+ start_dst_seg = &sd->dma.dst_seg[z];
+
+ for (uint32_t j = 0U; j < sd->dma.num_in_segs; ++j, ++k) {
+ seg = &start_src_seg[j];
+ seg->addr = (uint8_t *)sd->seg.src + k * sd->dma.src_seg_len;
+ seg->len = sd->dma.src_seg_len;
+ }
-static void configure_address_dma_transfer_base(test_config_t *config,
- odp_dma_transfer_param_t trs_params[],
- uint32_t trs_lengths[])
-{
- memset(trs_lengths, 0, sizeof(*trs_lengths) * config->dma_rounds);
+ len = sd->dma.num_in_segs * sd->dma.src_seg_len;
- for (int i = 0; i < config->num_in_seg; ++i) {
- config->dma_config.src_seg[i].addr =
- (uint8_t *)config->seg_config.src + i * config->seg_size;
- config->dma_config.src_seg[i].len = config->seg_size;
- }
+ for (uint32_t j = 0U; j < sd->dma.num_out_segs; ++j, ++z) {
+ seg = &start_dst_seg[j];
+ seg->addr = (uint8_t *)sd->seg.dst + z * sd->dma.dst_seg_len;
+ seg->len = MIN(len, sd->dma.dst_seg_len);
+ len -= sd->dma.dst_seg_len;
+ }
- config->dma_config.dst_seg.addr = config->seg_config.dst;
-
- for (int i = 0; i < config->dma_rounds; ++i) {
- odp_dma_transfer_param_init(&trs_params[i]);
- trs_params[i].src_format = ODP_DMA_FORMAT_ADDR;
- trs_params[i].dst_format = ODP_DMA_FORMAT_ADDR;
- trs_params[i].num_src = config->trs_grn == GRN_IND ? 1 : config->num_in_seg;
- trs_params[i].num_dst = 1U;
- trs_params[i].src_seg = &config->dma_config.src_seg[i];
- trs_params[i].dst_seg = &config->dma_config.dst_seg;
- trs_lengths[i] = config->trs_grn == GRN_IND ?
- config->dma_config.src_seg[i].len :
- config->num_in_seg * config->seg_size;
+ param = &sd->dma.infos[i].trs_param;
+ odp_dma_transfer_param_init(param);
+ param->src_format = ODP_DMA_FORMAT_ADDR;
+ param->dst_format = ODP_DMA_FORMAT_ADDR;
+ param->num_src = sd->dma.num_in_segs;
+ param->num_dst = sd->dma.num_out_segs;
+ param->src_seg = start_src_seg;
+ param->dst_seg = start_dst_seg;
}
}
-static inline void configure_address_dma_transfer_dynamic(test_config_t *config, uint32_t offset,
- uint32_t len)
+static void free_memory(const sd_t *sd)
{
- config->dma_config.dst_seg.addr = (uint8_t *)config->seg_config.dst + offset;
- config->dma_config.dst_seg.len = len;
+ if (sd->seg.src_shm != ODP_SHM_INVALID)
+ (void)odp_shm_free(sd->seg.src_shm);
+
+ if (sd->seg.dst_shm != ODP_SHM_INVALID)
+ (void)odp_shm_free(sd->seg.dst_shm);
}
-static int verify_memory_transfer(const test_config_t *config)
+static void run_transfer(odp_dma_t handle, trs_info_t *info, stats_t *stats)
{
- if (memcmp(config->seg_config.src, config->seg_config.dst,
- config->num_in_seg * config->seg_size)) {
- ODPH_ERR("Error in DMA transfer, source and destination data do not match.\n");
- return -1;
- }
+ uint64_t start_tm, end_tm, start_cc, end_cc, trs_tm, trs_cc, start_cc_diff;
+ odp_dma_result_t res;
+ int ret;
- return 0;
+ start_tm = odp_time_local_strict_ns();
+ start_cc = odp_cpu_cycles();
+ ret = odp_dma_transfer(handle, &info->trs_param, &res);
+ end_cc = odp_cpu_cycles();
+ end_tm = odp_time_local_strict_ns();
+
+ if (odp_unlikely(ret <= 0)) {
+ ++stats->start_errs;
+ } else {
+ trs_tm = end_tm - start_tm;
+ stats->max_trs_tm = MAX(trs_tm, stats->max_trs_tm);
+ stats->min_trs_tm = MIN(trs_tm, stats->min_trs_tm);
+ stats->trs_tm += trs_tm;
+ trs_cc = odp_cpu_cycles_diff(end_cc, start_cc);
+ stats->max_trs_cc = MAX(trs_cc, stats->max_trs_cc);
+ stats->min_trs_cc = MIN(trs_cc, stats->min_trs_cc);
+ stats->trs_cc += trs_cc;
+ ++stats->trs_cnt;
+ start_cc_diff = odp_cpu_cycles_diff(end_cc, start_cc);
+ stats->max_start_cc = MAX(start_cc_diff, stats->max_start_cc);
+ stats->min_start_cc = MIN(start_cc_diff, stats->min_start_cc);
+ stats->start_cc += start_cc_diff;
+ ++stats->start_cnt;
+
+ if (odp_unlikely(!res.success))
+ ++stats->transfer_errs;
+ else
+ ++stats->completed;
+ }
}
-static void free_memory(test_config_t *config)
+static void run_transfers_mt_unsafe(sd_t *sd, stats_t *stats)
{
- if (config->seg_config.shm_src != ODP_SHM_INVALID)
- (void)odp_shm_free(config->seg_config.shm_src);
+ const uint32_t count = sd->dma.num_inflight;
+ odp_dma_t handle = sd->dma.handle;
+ trs_info_t *infos = sd->dma.infos;
- if (config->seg_config.shm_dst != ODP_SHM_INVALID)
- (void)odp_shm_free(config->seg_config.shm_dst);
+ for (uint32_t i = 0U; i < count; ++i)
+ run_transfer(handle, &infos[i], stats);
}
-static void print_humanised_speed(uint64_t speed)
+static void run_transfers_mt_safe(sd_t *sd, stats_t *stats)
{
- if (speed > GIGAS)
- printf("%.2f GB/s\n", (double)speed / GIGAS);
- else if (speed > MEGAS)
- printf("%.2f MB/s\n", (double)speed / MEGAS);
- else if (speed > KILOS)
- printf("%.2f KB/s\n", (double)speed / KILOS);
- else
- printf("%" PRIu64 " B/s\n", speed);
+ const uint32_t count = sd->dma.num_inflight;
+ odp_dma_t handle = sd->dma.handle;
+ trs_info_t *infos = sd->dma.infos, *info;
+
+ for (uint32_t i = 0U; i < count; ++i) {
+ info = &infos[i];
+
+ if (odp_ticketlock_trylock(&info->lock)) {
+ run_transfer(handle, info, stats);
+ odp_ticketlock_unlock(&info->lock);
+ }
+ }
}
-static void print_results(const test_config_t *config, uint64_t time, uint32_t retries)
+static odp_bool_t configure_poll_compl(sd_t *sd)
{
- const int is_sync = config->trs_type == TRS_TYPE_SYNC;
- const uint64_t avg_time = time / config->num_rounds;
- uint64_t avg_speed = 0U;
+ odp_dma_compl_param_t *param;
- printf("\n"
- "=============================================\n\n"
- "DMA transfer test done\n\n"
- " mode: %s\n"
- " granularity: %s\n"
- " input segment count: %d\n"
- " segment size: %u\n"
- " segment type: %s\n",
- is_sync ? "synchronous" : "asynchronous",
- config->trs_grn == GRN_IND ? "individual" : "all",
- config->num_in_seg, config->seg_size,
- config->seg_type == TYPE_PKT ? "packet" : "memory");
-
- if (!is_sync) {
- printf(" completion modes in order: ");
-
- for (int i = 0; i < config->compl_modes.num_modes; ++i)
- printf("%s", config->compl_modes.modes[i] == ODP_DMA_COMPL_POLL ?
- "poll " : "event ");
+ for (uint32_t i = 0U; i < sd->dma.num_inflight; ++i) {
+ param = &sd->dma.infos[i].compl_param;
- printf("\n");
- }
+ odp_dma_compl_param_init(param);
+ param->compl_mode = mode_map[sd->dma.compl_mode];
+ param->transfer_id = odp_dma_transfer_id_alloc(sd->dma.handle);
- if (avg_time > 0U)
- avg_speed = config->num_in_seg * config->seg_size * ODP_TIME_SEC_IN_NS / avg_time;
+ if (param->transfer_id == ODP_DMA_TRANSFER_ID_INVALID) {
+ ODPH_ERR("Error allocating transfer ID\n");
+ return false;
+ }
+ }
- printf(" rounds run: %d\n"
- " average time per transfer: %" PRIu64 " ns\n"
- " average transfer speed: ",
- config->num_rounds, avg_time);
- print_humanised_speed(avg_speed);
- printf(" retries with usec sleep: %u\n", retries);
- printf("\n=============================================\n");
+ return true;
}
-static int run_dma_sync(test_config_t *config)
+static void poll_transfer(odp_dma_t handle, trs_info_t *info, stats_t *stats)
{
- odp_dma_transfer_param_t trs_params[config->dma_rounds];
- uint32_t trs_lengths[config->dma_rounds];
- odp_time_t start, end;
- uint32_t num_rounds = config->num_rounds, offset, retries = 0U;
- int done = 0;
+ uint64_t start_cc, end_cc, trs_tm, trs_cc, wait_cc, start_tm, start_cc_diff;
+ odp_dma_result_t res;
+ int ret;
- config->test_case_api.trs_base_fn(config, trs_params, trs_lengths);
- start = odp_time_local_strict();
+ if (info->is_running) {
+ start_cc = odp_cpu_cycles();
+ ret = odp_dma_transfer_done(handle, info->compl_param.transfer_id, &res);
+ end_cc = odp_cpu_cycles();
- while (num_rounds--) {
- offset = 0U;
+ if (odp_unlikely(ret < 0)) {
+ ++stats->poll_errs;
+ return;
+ }
- for (int i = 0; i < config->dma_rounds; ++i) {
- config->test_case_api.trs_dyn_fn(config, offset, trs_lengths[i]);
+ ++info->trs_poll_cnt;
+ wait_cc = odp_cpu_cycles_diff(end_cc, start_cc);
+ stats->max_wait_cc = MAX(wait_cc, stats->max_wait_cc);
+ stats->min_wait_cc = MIN(wait_cc, stats->min_wait_cc);
+ stats->wait_cc += wait_cc;
+ ++stats->wait_cnt;
+
+ if (ret == 0)
+ return;
+
+ trs_tm = odp_time_global_strict_ns() - info->trs_start_tm;
+ stats->max_trs_tm = MAX(trs_tm, stats->max_trs_tm);
+ stats->min_trs_tm = MIN(trs_tm, stats->min_trs_tm);
+ stats->trs_tm += trs_tm;
+ trs_cc = odp_cpu_cycles_diff(odp_cpu_cycles(), info->trs_start_cc);
+ stats->max_trs_cc = MAX(trs_cc, stats->max_trs_cc);
+ stats->min_trs_cc = MIN(trs_cc, stats->min_trs_cc);
+ stats->trs_cc += trs_cc;
+ stats->trs_poll_cnt += info->trs_poll_cnt;
+ ++stats->trs_cnt;
+
+ if (odp_unlikely(!res.success))
+ ++stats->transfer_errs;
+ else
+ ++stats->completed;
+
+ info->is_running = false;
+ } else {
+ start_tm = odp_time_global_strict_ns();
+ start_cc = odp_cpu_cycles();
+ ret = odp_dma_transfer_start(handle, &info->trs_param, &info->compl_param);
+ end_cc = odp_cpu_cycles();
+
+ if (odp_unlikely(ret <= 0)) {
+ ++stats->start_errs;
+ } else {
+ info->trs_start_tm = start_tm;
+ info->trs_start_cc = start_cc;
+ info->trs_poll_cnt = 0U;
+ start_cc_diff = odp_cpu_cycles_diff(end_cc, start_cc);
+ stats->max_start_cc = MAX(start_cc_diff, stats->max_start_cc);
+ stats->min_start_cc = MIN(start_cc_diff, stats->min_start_cc);
+ stats->start_cc += start_cc_diff;
+ ++stats->start_cnt;
+ info->is_running = true;
+ }
+ }
+}
- while (1) {
- done = odp_dma_transfer(config->dma_config.handle, &trs_params[i],
- NULL);
+static void poll_transfers_mt_unsafe(sd_t *sd, stats_t *stats)
+{
+ const uint32_t count = sd->dma.num_inflight;
+ odp_dma_t handle = sd->dma.handle;
+ trs_info_t *infos = sd->dma.infos;
- if (done > 0)
- break;
+ for (uint32_t i = 0U; i < count; ++i)
+ poll_transfer(handle, &infos[i], stats);
+}
- if (done == 0 && retries++ < RETRIES) {
- odp_time_wait_ns(1000U);
- continue;
- }
+static void poll_transfers_mt_safe(sd_t *sd, stats_t *stats)
+{
+ const uint32_t count = sd->dma.num_inflight;
+ odp_dma_t handle = sd->dma.handle;
+ trs_info_t *infos = sd->dma.infos, *info;
- ODPH_ERR("Error starting a sync DMA transfer.\n");
- return -1;
- }
+ for (uint32_t i = 0U; i < count; ++i) {
+ info = &infos[i];
- offset += trs_lengths[i];
+ if (odp_ticketlock_trylock(&info->lock)) {
+ poll_transfer(handle, info, stats);
+ odp_ticketlock_unlock(&info->lock);
}
}
-
- end = odp_time_local_strict();
- print_results(config, odp_time_diff_ns(end, start), retries);
- return 0;
}
-static int configure_dma_event_completion(test_config_t *config)
+static odp_bool_t configure_event_compl_session(sd_t *sd)
{
- int ret;
+ odp_thrmask_t zero;
odp_dma_pool_param_t pool_param;
odp_queue_param_t queue_param;
- config->dma_config.pool = ODP_POOL_INVALID;
- config->dma_config.compl_q = ODP_QUEUE_INVALID;
-
- ret = odp_schedule_config(NULL);
+ odp_thrmask_zero(&zero);
+ sd->grp = odp_schedule_group_create(PROG_NAME "_scd_grp", &zero);
- if (ret < 0) {
- ODPH_ERR("Error configuring scheduler.\n");
- return -1;
+ if (sd->grp == ODP_SCHED_GROUP_INVALID) {
+ ODPH_ERR("Error creating scheduler group for DMA session\n");
+ return false;
}
odp_dma_pool_param_init(&pool_param);
- pool_param.num = config->num_in_seg;
- config->dma_config.pool = odp_dma_pool_create("odp_dma_perf_events", &pool_param);
+ pool_param.num = sd->dma.num_inflight;
+ sd->dma.pool = odp_dma_pool_create(PROG_NAME "_dma_evs", &pool_param);
- if (config->dma_config.pool == ODP_POOL_INVALID) {
- ODPH_ERR("Error creating DMA event completion pool.\n");
- return -1;
+ if (sd->dma.pool == ODP_POOL_INVALID) {
+ ODPH_ERR("Error creating DMA event completion pool\n");
+ return false;
}
odp_queue_param_init(&queue_param);
queue_param.type = ODP_QUEUE_TYPE_SCHED;
queue_param.sched.sync = ODP_SCHED_SYNC_PARALLEL;
queue_param.sched.prio = odp_schedule_default_prio();
- queue_param.sched.group = ODP_SCHED_GROUP_ALL;
- config->dma_config.compl_q = odp_queue_create("odp_dma_perf_queue", &queue_param);
+ queue_param.sched.group = sd->grp;
+ sd->dma.compl_q = odp_queue_create(PROG_NAME, &queue_param);
- if (config->dma_config.compl_q == ODP_QUEUE_INVALID) {
- ODPH_ERR("Error creating DMA completion queue.\n");
- return -1;
+ if (sd->dma.compl_q == ODP_QUEUE_INVALID) {
+ ODPH_ERR("Error creating DMA completion queue\n");
+ return false;
}
- return 0;
+ return true;
}
-static int configure_dma_completion_params(test_config_t *config,
- odp_dma_compl_param_t compl_params[])
+static odp_bool_t configure_event_compl(sd_t *sd)
{
- odp_dma_compl_t compl_ev;
+ odp_dma_compl_param_t *param;
+ odp_dma_compl_t c_ev;
- for (int i = 0; i < config->dma_rounds; ++i)
- odp_dma_compl_param_init(&compl_params[i]);
+ for (uint32_t i = 0U; i < sd->dma.num_inflight; ++i) {
+ param = &sd->dma.infos[i].compl_param;
- for (int i = 0; i < config->dma_rounds; ++i) {
- if (config->compl_modes.modes[i] == ODP_DMA_COMPL_EVENT) {
- compl_params[i].compl_mode = ODP_DMA_COMPL_EVENT;
- compl_ev = odp_dma_compl_alloc(config->dma_config.pool);
+ odp_dma_compl_param_init(param);
+ param->compl_mode = mode_map[sd->dma.compl_mode];
+ c_ev = odp_dma_compl_alloc(sd->dma.pool);
- if (compl_ev == ODP_DMA_COMPL_INVALID) {
- ODPH_ERR("Error creating DMA completion event.\n");
- return -1;
- }
-
- compl_params[i].event = odp_dma_compl_to_event(compl_ev);
- compl_params[i].queue = config->dma_config.compl_q;
- } else if (config->compl_modes.modes[i] == ODP_DMA_COMPL_POLL) {
- compl_params[i].compl_mode = ODP_DMA_COMPL_POLL;
- compl_params[i].transfer_id =
- odp_dma_transfer_id_alloc(config->dma_config.handle);
-
- if (compl_params[i].transfer_id == ODP_DMA_TRANSFER_ID_INVALID) {
- ODPH_ERR("Error creating DMA transfer ID.\n");
- return -1;
- }
+ if (c_ev == ODP_DMA_COMPL_INVALID) {
+ ODPH_ERR("Error allocating completion event\n");
+ return false;
}
- compl_params[i].user_ptr = NULL;
+ param->event = odp_dma_compl_to_event(c_ev);
+ param->queue = sd->dma.compl_q;
+ param->user_ptr = &sd->dma.infos[i];
}
- return 0;
+ return true;
}
-static void build_wait_list(const test_config_t *config, odp_dma_compl_param_t compl_params[],
- compl_wait_entry_t list[])
+static odp_bool_t start_initial_transfers(sd_t *sd)
{
- int last_ev_idx, has_events = 0;
+ uint64_t start_tm, start_cc;
+ trs_info_t *info;
+ int ret;
- memset(list, 0, sizeof(*list) * config->dma_rounds);
+ for (uint32_t i = 0U; i < sd->dma.num_inflight; ++i) {
+ info = &sd->dma.infos[i];
+ start_tm = odp_time_global_strict_ns();
+ start_cc = odp_cpu_cycles();
+ ret = odp_dma_transfer_start(sd->dma.handle, &info->trs_param, &info->compl_param);
- for (int i = 0, j = 0, k = 0; i < config->dma_rounds; ++i) {
- if (config->compl_modes.modes[i] == ODP_DMA_COMPL_EVENT) {
- compl_wait_entry_t entry = { .type = ODP_DMA_COMPL_EVENT };
+ if (ret <= 0) {
+ ODPH_ERR("Error starting DMA transfer\n");
+ return false;
+ }
- list[j] = entry;
- ++j;
+ info->trs_start_tm = start_tm;
+ info->trs_start_cc = start_cc;
+ }
- for (; k < i; ++k) {
- entry.type = ODP_DMA_COMPL_POLL;
- entry.id = compl_params[k].transfer_id;
- list[j++] = entry;
- }
+ return true;
+}
- ++k;
- last_ev_idx = i;
- has_events = 1;
- }
- }
+static void wait_compl_event(sd_t *sd, stats_t *stats)
+{
+ uint64_t start_cc, end_cc, wait_cc, trs_tm, trs_cc, start_tm, start_cc_diff;
+ odp_event_t ev;
+ odp_dma_result_t res;
+ trs_info_t *info;
+ int ret;
- last_ev_idx = has_events ? last_ev_idx + 1 : 0;
+ start_cc = odp_cpu_cycles();
+ ev = odp_schedule(NULL, odp_schedule_wait_time(ODP_TIME_SEC_IN_NS));
+ end_cc = odp_cpu_cycles();
- for (int i = last_ev_idx; i < config->dma_rounds; ++i) {
- compl_wait_entry_t entry = { .type = ODP_DMA_COMPL_POLL,
- .id = compl_params[i].transfer_id };
- list[i] = entry;
+ if (odp_unlikely(ev == ODP_EVENT_INVALID)) {
+ ++stats->scheduler_timeouts;
+ return;
+ }
+
+ odp_dma_compl_result(odp_dma_compl_from_event(ev), &res);
+ info = res.user_ptr;
+ trs_tm = odp_time_global_strict_ns() - info->trs_start_tm;
+ stats->max_trs_tm = MAX(trs_tm, stats->max_trs_tm);
+ stats->min_trs_tm = MIN(trs_tm, stats->min_trs_tm);
+ stats->trs_tm += trs_tm;
+ trs_cc = odp_cpu_cycles_diff(odp_cpu_cycles(), info->trs_start_cc);
+ stats->max_trs_cc = MAX(trs_cc, stats->max_trs_cc);
+ stats->min_trs_cc = MIN(trs_cc, stats->min_trs_cc);
+ stats->trs_cc += trs_cc;
+ ++stats->trs_cnt;
+ wait_cc = odp_cpu_cycles_diff(end_cc, start_cc);
+ stats->max_wait_cc = MAX(wait_cc, stats->max_wait_cc);
+ stats->min_wait_cc = MIN(wait_cc, stats->min_wait_cc);
+ stats->wait_cc += wait_cc;
+ ++stats->wait_cnt;
+
+ if (odp_unlikely(!res.success))
+ ++stats->transfer_errs;
+ else
+ ++stats->completed;
+
+ start_tm = odp_time_global_strict_ns();
+ start_cc = odp_cpu_cycles();
+ ret = odp_dma_transfer_start(sd->dma.handle, &info->trs_param, &info->compl_param);
+ end_cc = odp_cpu_cycles();
+
+ if (odp_unlikely(ret <= 0)) {
+ ++stats->start_errs;
+ } else {
+ info->trs_start_tm = start_tm;
+ info->trs_start_cc = start_cc;
+ start_cc_diff = odp_cpu_cycles_diff(end_cc, start_cc);
+ stats->max_start_cc = MAX(start_cc_diff, stats->max_start_cc);
+ stats->min_start_cc = MIN(start_cc_diff, stats->min_start_cc);
+ stats->start_cc += start_cc_diff;
+ ++stats->start_cnt;
}
}
-static inline int wait_dma_transfers_ready(test_config_t *config, compl_wait_entry_t list[])
+static void drain_compl_events(void)
{
odp_event_t ev;
- const uint64_t wait_time = odp_schedule_wait_time(config->wait_ns);
- uint64_t start, end;
- int done = 0;
-
- for (int i = 0; i < config->dma_rounds; ++i) {
- if (list[i].type == ODP_DMA_COMPL_EVENT) {
- ev = odp_schedule(NULL, wait_time);
-
- if (ev == ODP_EVENT_INVALID) {
- ODPH_ERR("Error waiting event completion.\n");
- return -1;
- }
- } else {
- start = odp_time_local_ns();
- end = start + ODP_TIME_SEC_IN_NS;
- while (1) {
- done = odp_dma_transfer_done(config->dma_config.handle, list[i].id,
- NULL);
+ while (true) {
+ ev = odp_schedule(NULL, odp_schedule_wait_time(ODP_TIME_SEC_IN_NS));
- if (done > 0)
- break;
+ if (ev == ODP_EVENT_INVALID)
+ break;
+ }
+}
- if (done == 0 && odp_time_local_ns() < end)
- continue;
+static void setup_api(prog_config_t *config)
+{
+ if (config->seg_type == PACKET) {
+ config->api.setup_fn = setup_packet_segments;
+ config->api.trs_fn = configure_packet_dma_transfer;
+ config->api.free_fn = free_packets;
+ } else {
+ config->api.setup_fn = setup_memory_segments;
+ config->api.trs_fn = configure_address_dma_transfer;
+ config->api.free_fn = free_memory;
+ }
- ODPH_ERR("Error waiting poll completion.\n");
- return -1;
- }
+ if (config->trs_type == SYNC) {
+ config->api.compl_fn = NULL;
+ config->api.wait_fn = config->num_workers == 1 || config->policy == MANY ?
+ run_transfers_mt_unsafe : run_transfers_mt_safe;
+ config->api.drain_fn = NULL;
+ } else {
+ if (config->compl_mode == POLL) {
+ config->api.session_cfg_fn = NULL;
+ config->api.compl_fn = configure_poll_compl;
+ config->api.bootstrap_fn = NULL;
+ config->api.wait_fn = config->num_workers == 1 || config->policy == MANY ?
+ poll_transfers_mt_unsafe : poll_transfers_mt_safe;
+ config->api.drain_fn = NULL;
+ } else {
+ config->api.session_cfg_fn = configure_event_compl_session;
+ config->api.compl_fn = configure_event_compl;
+ config->api.bootstrap_fn = start_initial_transfers;
+ config->api.wait_fn = wait_compl_event;
+ config->api.drain_fn = drain_compl_events;
}
}
-
- return 0;
}
-static void free_dma_completion_events(test_config_t *config, odp_dma_compl_param_t compl_params[])
+static odp_bool_t setup_session_descriptors(prog_config_t *config)
{
- for (int i = 0; i < config->dma_rounds; ++i)
- if (config->compl_modes.modes[i] == ODP_DMA_COMPL_EVENT &&
- compl_params[i].event != ODP_EVENT_INVALID)
- odp_dma_compl_free(odp_dma_compl_from_event(compl_params[i].event));
+ sd_t *sd;
+ const odp_dma_param_t dma_params = {
+ .direction = ODP_DMA_MAIN_TO_MAIN,
+ .type = ODP_DMA_TYPE_COPY,
+ .compl_mode_mask = config->compl_mode_mask,
+ .mt_mode = config->num_workers == 1 || config->policy == MANY ?
+ ODP_DMA_MT_SERIAL : ODP_DMA_MT_SAFE,
+ .order = ODP_DMA_ORDER_NONE };
+
+ for (uint32_t i = 0U; i < config->num_sessions; ++i) {
+ char name[ODP_DMA_NAME_LEN];
+
+ sd = &config->sds[i];
+ sd->dma.num_in_segs = config->num_in_segs;
+ sd->dma.num_out_segs = config->num_out_segs;
+ sd->dma.src_seg_len = config->src_seg_len;
+ sd->dma.dst_seg_len = config->dst_seg_len;
+ sd->dma.num_inflight = config->num_inflight;
+ sd->dma.trs_type = config->trs_type;
+ sd->dma.compl_mode = config->compl_mode;
+ snprintf(name, sizeof(name), PROG_NAME "_dma_%u", i);
+ sd->dma.handle = odp_dma_create(name, &dma_params);
+
+ if (sd->dma.handle == ODP_DMA_INVALID) {
+ ODPH_ERR("Error creating DMA session\n");
+ return false;
+ }
+
+ if (config->api.session_cfg_fn != NULL && !config->api.session_cfg_fn(sd))
+ return false;
+ }
+
+ return true;
}
-static void free_dma_transfer_ids(test_config_t *config, odp_dma_compl_param_t compl_params[])
+static odp_bool_t setup_data(prog_config_t *config)
{
- for (int i = 0; i < config->dma_rounds; ++i)
- if (config->compl_modes.modes[i] == ODP_DMA_COMPL_POLL &&
- compl_params[i].transfer_id != ODP_DMA_TRANSFER_ID_INVALID)
- odp_dma_transfer_id_free(config->dma_config.handle,
- compl_params[i].transfer_id);
+ sd_t *sd;
+
+ for (uint32_t i = 0U; i < config->num_sessions; ++i) {
+ sd = &config->sds[i];
+
+ if (!config->api.setup_fn(sd))
+ return false;
+
+ config->api.trs_fn(sd);
+
+ if (config->api.compl_fn != NULL && !config->api.compl_fn(sd))
+ return false;
+ }
+
+ return true;
}
-static int run_dma_async_transfer(test_config_t *config)
+static int transfer(void *args)
{
- odp_dma_transfer_param_t trs_params[config->dma_rounds];
- uint32_t trs_lengths[config->dma_rounds];
- odp_dma_compl_param_t compl_params[config->dma_rounds];
- int ret = 0, started;
- compl_wait_entry_t compl_wait_list[config->dma_rounds];
- odp_time_t start, end;
- uint32_t num_rounds = config->num_rounds, offset, retries = 0U;
-
- config->test_case_api.trs_base_fn(config, trs_params, trs_lengths);
-
- if (configure_dma_completion_params(config, compl_params)) {
- ret = -1;
- goto out_compl_evs;
+ thread_config_t *thr_config = args;
+ prog_config_t *prog_config = thr_config->prog_config;
+ sd_t *sd = thr_config->sd;
+ stats_t *stats = &thr_config->stats;
+ test_api_t *api = &prog_conf->api;
+ odp_thrmask_t mask;
+ uint64_t start_tm, end_tm;
+
+ odp_barrier_wait(&prog_config->init_barrier);
+
+ if (sd->grp != ODP_SCHED_GROUP_INVALID) {
+ odp_thrmask_zero(&mask);
+ odp_thrmask_set(&mask, odp_thread_id());
+
+ if (odp_schedule_group_join(sd->grp, &mask) < 0) {
+ ODPH_ERR("Error joining scheduler group\n");
+ goto out;
+ }
}
- build_wait_list(config, compl_params, compl_wait_list);
- start = odp_time_local_strict();
+ start_tm = odp_time_local_strict_ns();
- while (num_rounds--) {
- offset = 0U;
+ while (odp_atomic_load_u32(&prog_config->is_running))
+ api->wait_fn(sd, stats);
- for (int i = 0; i < config->dma_rounds; ++i) {
- config->test_case_api.trs_dyn_fn(config, offset, trs_lengths[i]);
+ end_tm = odp_time_local_strict_ns();
+ thr_config->stats.tot_tm = end_tm - start_tm;
- while (1) {
- started = odp_dma_transfer_start(config->dma_config.handle,
- &trs_params[i], &compl_params[i]);
+ if (api->drain_fn != NULL)
+ api->drain_fn();
- if (started > 0)
- break;
+out:
+ odp_barrier_wait(&prog_config->term_barrier);
- if (started == 0 && retries++ < RETRIES) {
- odp_time_wait_ns(1000U);
- continue;
- }
+ return 0;
+}
- ODPH_ERR("Error starting an async DMA transfer.\n");
- ret = -1;
- goto out_trs_ids;
- }
+static odp_bool_t setup_workers(prog_config_t *config)
+{
+ odp_cpumask_t cpumask;
+ int num_workers;
+ odph_thread_common_param_t thr_common;
+ odph_thread_param_t thr_params[config->num_workers], *thr_param;
+ thread_config_t *thr_config;
+ sd_t *sd;
+
+ /* Barrier init count for control and worker. */
+ odp_barrier_init(&config->init_barrier, config->num_workers + 1);
+ odp_barrier_init(&config->term_barrier, config->num_workers);
+ num_workers = odp_cpumask_default_worker(&cpumask, config->num_workers);
+ odph_thread_common_param_init(&thr_common);
+ thr_common.instance = config->odp_instance;
+ thr_common.cpumask = &cpumask;
+
+ for (int i = 0; i < config->num_workers; ++i) {
+ thr_param = &thr_params[i];
+ thr_config = &config->thread_config[i];
+ sd = config->policy == SINGLE ? &config->sds[0U] : &config->sds[i];
+
+ odph_thread_param_init(thr_param);
+ thr_param->start = transfer;
+ thr_param->thr_type = ODP_THREAD_WORKER;
+ thr_config->prog_config = config;
+ thr_config->sd = sd;
+ thr_param->arg = thr_config;
+ }
- offset += trs_lengths[i];
- }
+ num_workers = odph_thread_create(config->threads, &thr_common, thr_params, num_workers);
- if (wait_dma_transfers_ready(config, compl_wait_list)) {
- ODPH_ERR("Error finishing an async DMA transfer.\n");
- ret = -1;
- goto out_trs_ids;
- }
+ if (num_workers != config->num_workers) {
+ ODPH_ERR("Error configuring worker threads\n");
+ return false;
}
- end = odp_time_local_strict();
- print_results(config, odp_time_diff_ns(end, start), retries);
+ for (uint32_t i = 0U; i < config->num_sessions; ++i) {
+ if (config->api.bootstrap_fn != NULL && !config->api.bootstrap_fn(&config->sds[i]))
+ return false;
+ }
-out_compl_evs:
- free_dma_completion_events(config, compl_params);
+ odp_barrier_wait(&config->init_barrier);
-out_trs_ids:
- free_dma_transfer_ids(config, compl_params);
- return ret;
+ return true;
}
-static void free_dma_event_completion(test_config_t *config)
+static odp_bool_t setup_test(prog_config_t *config)
{
- if (config->dma_config.compl_q != ODP_QUEUE_INVALID)
- (void)odp_queue_destroy(config->dma_config.compl_q);
+ setup_api(config);
- if (config->dma_config.pool != ODP_POOL_INVALID)
- (void)odp_pool_destroy(config->dma_config.pool);
+ return setup_session_descriptors(config) && setup_data(config) && setup_workers(config);
}
-static int run_dma_async(test_config_t *config)
+static void stop_test(prog_config_t *config)
{
- const int is_event_compl = config->compl_modes.compl_mask & ODP_DMA_COMPL_EVENT;
- int ret = 0;
-
- if (is_event_compl)
- if (configure_dma_event_completion(config)) {
- ret = -1;
- goto out;
- }
+ (void)odph_thread_join(config->threads, config->num_workers);
+}
- if (run_dma_async_transfer(config))
- ret = -1;
+static void teardown_data(const sd_t *sd, void (*free_fn)(const sd_t *sd))
+{
+ const odp_dma_compl_param_t *compl_param;
-out:
- if (is_event_compl)
- free_dma_event_completion(config);
+ for (uint32_t i = 0U; i < MAX_SEGS; ++i) {
+ compl_param = &sd->dma.infos[i].compl_param;
- return ret;
-}
+ if (compl_param->transfer_id != ODP_DMA_TRANSFER_ID_INVALID)
+ odp_dma_transfer_id_free(sd->dma.handle, compl_param->transfer_id);
-static void setup_test_case_api(test_config_t *config)
-{
- switch (config->seg_type) {
- case TYPE_PKT:
- config->test_case_api.setup_fn = setup_packet_segments;
- config->test_case_api.trs_base_fn = configure_packet_dma_transfer_base;
- config->test_case_api.trs_dyn_fn = configure_packet_dma_transfer_dynamic;
- config->test_case_api.verify_fn = verify_packet_transfer;
- config->test_case_api.free_fn = free_packets;
- break;
- case TYPE_MEM:
- config->test_case_api.setup_fn = setup_memory_segments;
- config->test_case_api.trs_base_fn = configure_address_dma_transfer_base;
- config->test_case_api.trs_dyn_fn = configure_address_dma_transfer_dynamic;
- config->test_case_api.verify_fn = verify_memory_transfer;
- config->test_case_api.free_fn = free_memory;
- break;
- default:
- break;
+ if (compl_param->event != ODP_EVENT_INVALID)
+ odp_event_free(compl_param->event);
}
- config->test_case_api.run_fn = config->trs_type == TRS_TYPE_SYNC ?
- run_dma_sync :
- run_dma_async;
+ free_fn(sd);
}
-static int configure_dma_session(test_config_t *config)
+static void teardown_test(prog_config_t *config)
{
- const odp_dma_param_t params = { .direction = ODP_DMA_MAIN_TO_MAIN,
- .type = ODP_DMA_TYPE_COPY,
- .compl_mode_mask = config->compl_modes.compl_mask,
- .mt_mode = ODP_DMA_MT_SERIAL,
- .order = ODP_DMA_ORDER_NONE };
+ sd_t *sd;
+
+ for (uint32_t i = 0U; i < config->num_sessions; ++i) {
+ sd = &config->sds[i];
+ teardown_data(sd, config->api.free_fn);
- config->dma_config.handle = odp_dma_create("odp_dma_perf", &params);
+ if (sd->dma.compl_q != ODP_QUEUE_INVALID)
+ (void)odp_queue_destroy(sd->dma.compl_q);
- if (config->dma_config.handle == ODP_DMA_INVALID) {
- ODPH_ERR("Error creating DMA session.\n");
- return -1;
+ if (sd->dma.pool != ODP_POOL_INVALID)
+ (void)odp_pool_destroy(sd->dma.pool);
+
+ if (sd->grp != ODP_SCHED_GROUP_INVALID)
+ (void)odp_schedule_group_destroy(sd->grp);
+
+ if (sd->dma.handle != ODP_DMA_INVALID)
+ (void)odp_dma_destroy(sd->dma.handle);
}
- return 0;
+ if (config->src_pool != ODP_POOL_INVALID)
+ (void)odp_pool_destroy(config->src_pool);
+
+ if (config->dst_pool != ODP_POOL_INVALID)
+ (void)odp_pool_destroy(config->dst_pool);
}
-static void free_dma_session(test_config_t *config)
+static void print_humanised(uint64_t value, const char *type)
{
- if (config->dma_config.handle != ODP_DMA_INVALID)
- (void)odp_dma_destroy(config->dma_config.handle);
+ if (value > GIGAS)
+ printf("%.2f G%s\n", (double)value / GIGAS, type);
+ else if (value > MEGAS)
+ printf("%.2f M%s\n", (double)value / MEGAS, type);
+ else if (value > KILOS)
+ printf("%.2f K%s\n", (double)value / KILOS, type);
+ else
+ printf("%" PRIu64 " %s\n", value, type);
+}
+
+static void print_stats(const prog_config_t *config)
+{
+ const stats_t *stats;
+ uint64_t data_cnt = config->num_in_segs * config->src_seg_len, tot_completed = 0U,
+ tot_tm = 0U, tot_trs_tm = 0U, tot_trs_cc = 0U, tot_trs_cnt = 0U, tot_min_tm = UINT64_MAX,
+ tot_max_tm = 0U, tot_min_cc = UINT64_MAX, tot_max_cc = 0U, avg_start_cc, avg_wait_cc,
+ avg_tot_tm;
+
+ printf("\n======================\n\n"
+ "DMA performance test done\n\n"
+ " mode: %s\n"
+ " input segment count: %u\n"
+ " output segment count: %u\n"
+ " segment length: %u\n"
+ " segment type: %s\n"
+ " inflight count: %u\n"
+ " session policy: %s\n\n",
+ config->trs_type == SYNC ? "synchronous" : config->compl_mode == POLL ?
+ "asynchronous-poll" : "asynchronous-event", config->num_in_segs,
+ config->num_out_segs, config->src_seg_len,
+ config->seg_type == PACKET ? "packet" : "memory", config->num_inflight,
+ config->policy == SINGLE ? "shared" : "per-worker");
+
+ for (int i = 0; i < config->num_workers; ++i) {
+ stats = &config->thread_config[i].stats;
+ tot_completed += stats->completed;
+ tot_tm += stats->tot_tm;
+ tot_trs_tm += stats->trs_tm;
+ tot_trs_cc += stats->trs_cc;
+ tot_trs_cnt += stats->trs_cnt;
+ tot_min_tm = MIN(tot_min_tm, stats->min_trs_tm);
+ tot_max_tm = MAX(tot_max_tm, stats->max_trs_tm);
+ tot_min_cc = MIN(tot_min_cc, stats->min_trs_cc);
+ tot_max_cc = MAX(tot_max_cc, stats->max_trs_cc);
+
+ printf(" worker %d:\n", i);
+ printf(" successful transfers: %" PRIu64 "\n"
+ " start errors: %" PRIu64 "\n",
+ stats->completed, stats->start_errs);
+
+ if (config->trs_type == ASYNC) {
+ if (config->compl_mode == POLL)
+ printf(" poll errors: %" PRIu64 "\n",
+ stats->poll_errs);
+ else
+ printf(" scheduler timeouts: %" PRIu64 "\n",
+ stats->scheduler_timeouts);
+ }
+
+ printf(" transfer errors: %" PRIu64 "\n"
+ " run time: %" PRIu64 " ns\n",
+ stats->transfer_errs, stats->tot_tm);
+
+ if (config->policy == MANY) {
+ printf(" DMA session:\n"
+ " average time per transfer: %" PRIu64 " "
+ "(min: %" PRIu64 ", max: %" PRIu64 ") ns\n"
+ " average cycles per transfer: %" PRIu64 " "
+ "(min: %" PRIu64 ", max: %" PRIu64 ")\n"
+ " ops: ",
+ stats->trs_cnt > 0U ? stats->trs_tm / stats->trs_cnt : 0U,
+ stats->trs_cnt > 0U ? stats->min_trs_tm : 0U,
+ stats->trs_cnt > 0U ? stats->max_trs_tm : 0U,
+ stats->trs_cnt > 0U ? stats->trs_cc / stats->trs_cnt : 0U,
+ stats->trs_cnt > 0U ? stats->min_trs_cc : 0U,
+ stats->trs_cnt > 0U ? stats->max_trs_cc : 0U);
+ print_humanised(stats->completed / (stats->tot_tm / ODP_TIME_SEC_IN_NS),
+ "OPS");
+ printf(" speed: ");
+ print_humanised(stats->completed * data_cnt /
+ (stats->tot_tm / ODP_TIME_SEC_IN_NS), "B/s");
+ }
+
+ avg_start_cc = stats->start_cnt > 0U ? stats->start_cc / stats->start_cnt : 0U;
+ printf(" average cycles breakdown:\n");
+
+ if (config->trs_type == SYNC) {
+ printf(" odp_dma_transfer(): %" PRIu64 " "
+ "(min: %" PRIu64 ", max: %" PRIu64 ")\n", avg_start_cc,
+ avg_start_cc > 0U ? stats->min_start_cc : 0U,
+ avg_start_cc > 0U ? stats->max_start_cc : 0U);
+ } else {
+ printf(" odp_dma_transfer_start(): %" PRIu64 " "
+ "(min: %" PRIu64 ", max: %" PRIu64 ")\n", avg_start_cc,
+ avg_start_cc > 0U ? stats->min_start_cc : 0U,
+ avg_start_cc > 0U ? stats->max_start_cc : 0U);
+
+ avg_wait_cc = stats->wait_cnt > 0U ? stats->wait_cc / stats->wait_cnt : 0U;
+
+ if (config->compl_mode == POLL) {
+ printf(" odp_dma_transfer_done(): %" PRIu64 ""
+ " (min: %" PRIu64 ", max: %" PRIu64 ", x %" PRIu64 ""
+ " per transfer)\n", avg_wait_cc,
+ avg_wait_cc > 0U ? stats->min_wait_cc : 0U,
+ avg_wait_cc > 0U ? stats->max_wait_cc : 0U,
+ stats->trs_cnt > 0U ?
+ stats->trs_poll_cnt / stats->trs_cnt : 0U);
+ } else {
+ printf(" odp_schedule(): %" PRIu64 " "
+ " (min: %" PRIu64 ", max: %" PRIu64 ")\n", avg_wait_cc,
+ avg_wait_cc > 0U ? stats->min_wait_cc : 0U,
+ avg_wait_cc > 0U ? stats->max_wait_cc : 0U);
+ }
+ }
+
+ printf("\n");
+ }
+
+ avg_tot_tm = tot_tm / config->num_workers / ODP_TIME_SEC_IN_NS;
+ printf(" total:\n"
+ " average time per transfer: %" PRIu64 " (min: %" PRIu64
+ ", max: %" PRIu64 ") ns\n"
+ " average cycles per transfer: %" PRIu64 " (min: %" PRIu64
+ ", max: %" PRIu64 ")\n"
+ " ops: ",
+ tot_trs_cnt > 0U ? tot_trs_tm / tot_trs_cnt : 0U,
+ tot_trs_cnt > 0U ? tot_min_tm : 0U,
+ tot_trs_cnt > 0U ? tot_max_tm : 0U,
+ tot_trs_cnt > 0U ? tot_trs_cc / tot_trs_cnt : 0U,
+ tot_trs_cnt > 0U ? tot_min_cc : 0U,
+ tot_trs_cnt > 0U ? tot_max_cc : 0U);
+ print_humanised(avg_tot_tm > 0U ? tot_completed / avg_tot_tm : 0U, "OPS");
+ printf(" speed: ");
+ print_humanised(avg_tot_tm > 0U ? tot_completed * data_cnt / avg_tot_tm : 0U, "B/s");
+ printf("\n");
+ printf("======================\n");
}
int main(int argc, char **argv)
{
odph_helper_options_t odph_opts;
- test_config_t test_config;
+ odp_init_t init_param;
odp_instance_t odp_instance;
+ odp_shm_t shm_cfg = ODP_SHM_INVALID;
+ parse_result_t parse_res;
int ret = EXIT_SUCCESS;
argc = odph_parse_options(argc, argv);
if (odph_options(&odph_opts)) {
- ODPH_ERR("Error while reading ODP helper options, exiting.\n");
+ ODPH_ERR("Error while reading ODP helper options, exiting\n");
exit(EXIT_FAILURE);
}
- if (parse_options(argc, argv, &test_config))
- exit(EXIT_FAILURE);
+ odp_init_param_init(&init_param);
+ init_param.mem_model = odph_opts.mem_model;
- if (odp_init_global(&odp_instance, NULL, NULL)) {
- ODPH_ERR("ODP global init failed, exiting.\n");
+ if (odp_init_global(&odp_instance, &init_param, NULL)) {
+ ODPH_ERR("ODP global init failed, exiting\n");
exit(EXIT_FAILURE);
}
if (odp_init_local(odp_instance, ODP_THREAD_CONTROL)) {
- ODPH_ERR("ODP local init failed, exiting.\n");
+ ODPH_ERR("ODP local init failed, exiting\n");
exit(EXIT_FAILURE);
}
- if (check_capabilities(&test_config)) {
- ODPH_ERR("Unsupported scenario attempted, exiting.\n");
- ret = EXIT_NOT_SUP;
- goto out_odp;
+ shm_cfg = odp_shm_reserve(PROG_NAME "_cfg", sizeof(prog_config_t), ODP_CACHE_LINE_SIZE,
+ 0U);
+
+ if (shm_cfg == ODP_SHM_INVALID) {
+ ODPH_ERR("Error reserving shared memory\n");
+ ret = EXIT_FAILURE;
+ goto out;
}
- setup_test_case_api(&test_config);
+ prog_conf = odp_shm_addr(shm_cfg);
- if (configure_dma_session(&test_config)) {
+ if (prog_conf == NULL) {
+ ODPH_ERR("Error resolving shared memory address\n");
ret = EXIT_FAILURE;
- goto out_dma;
+ goto out;
}
- if (test_config.test_case_api.setup_fn(&test_config)) {
+ parse_res = setup_program(argc, argv, prog_conf);
+
+ if (parse_res == PRS_NOK) {
ret = EXIT_FAILURE;
- goto out_test_case;
+ goto out;
+ }
+
+ if (parse_res == PRS_TERM) {
+ ret = EXIT_SUCCESS;
+ goto out;
}
- if (test_config.test_case_api.run_fn(&test_config) ||
- test_config.test_case_api.verify_fn(&test_config))
+ if (parse_res == PRS_NOT_SUP) {
+ ret = EXIT_NOT_SUP;
+ goto out;
+ }
+
+ if (odp_schedule_config(NULL) < 0) {
+ ODPH_ERR("Error configuring scheduler\n");
ret = EXIT_FAILURE;
+ goto out;
+ }
-out_test_case:
- test_config.test_case_api.free_fn(&test_config);
+ prog_conf->odp_instance = odp_instance;
+ odp_atomic_init_u32(&prog_conf->is_running, 1U);
-out_dma:
- free_dma_session(&test_config);
+ if (!setup_test(prog_conf)) {
+ ret = EXIT_FAILURE;
+ goto out_test;
+ }
+
+ if (prog_conf->time_sec) {
+ sleep(prog_conf->time_sec);
+ odp_atomic_store_u32(&prog_conf->is_running, 0U);
+ }
+
+ stop_test(prog_conf);
+ print_stats(prog_conf);
+
+out_test:
+ /* Release all resources that have been allocated during 'setup_test()'. */
+ teardown_test(prog_conf);
+
+out:
+ if (shm_cfg != ODP_SHM_INVALID)
+ (void)odp_shm_free(shm_cfg);
-out_odp:
if (odp_term_local()) {
- ODPH_ERR("ODP local terminate failed, exiting.\n");
+ ODPH_ERR("ODP local terminate failed, exiting\n");
exit(EXIT_FAILURE);
}
if (odp_term_global(odp_instance)) {
- ODPH_ERR("ODP global terminate failed, exiting.\n");
+ ODPH_ERR("ODP global terminate failed, exiting\n");
exit(EXIT_FAILURE);
}
diff --git a/test/performance/odp_dma_perf_run.sh b/test/performance/odp_dma_perf_run.sh
index dc314d400..37bc4382f 100755
--- a/test/performance/odp_dma_perf_run.sh
+++ b/test/performance/odp_dma_perf_run.sh
@@ -1,14 +1,16 @@
#!/bin/sh
#
-# Copyright (c) 2022, Nokia
+# Copyright (c) 2022-2023, Nokia
# All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
TEST_DIR="${TEST_DIR:-$(dirname $0)}"
BIN_NAME=odp_dma_perf
-SEG_SIZE=1024
-ROUNDS=1000
+SEGC=0
+SEGS=1024
+INFL=1
+TIME=1
TESTS_RUN=0
check_result()
@@ -23,73 +25,24 @@ check_result()
fi
}
-echo "odp_dma_perf: synchronous transfer 1"
+echo "odp_dma_perf: synchronous transfer"
echo "===================================="
-${TEST_DIR}/${BIN_NAME}${EXEEXT} -t 0 -g 0 -i 6 -s $SEG_SIZE -T 0 -r $ROUNDS
-
-check_result $?
-
-echo "odp_dma_perf: synchronous transfer 2"
-echo "===================================="
-
-${TEST_DIR}/${BIN_NAME}${EXEEXT} -t 0 -g 1 -i 6 -s $SEG_SIZE -T 0 -r $ROUNDS
-
-check_result $?
-
-echo "odp_dma_perf: synchronous transfer 3"
-echo "===================================="
-
-${TEST_DIR}/${BIN_NAME}${EXEEXT} -t 0 -g 0 -i 6 -s $SEG_SIZE -T 1 -r $ROUNDS
-
-check_result $?
-
-echo "odp_dma_perf: synchronous transfer 4"
-echo "===================================="
-
-${TEST_DIR}/${BIN_NAME}${EXEEXT} -t 0 -g 1 -i 6 -s $SEG_SIZE -T 1 -r $ROUNDS
+${TEST_DIR}/${BIN_NAME}${EXEEXT} -t 0 -i $SEGC -o $SEGC -s $SEGS -S 0 -f $INFL -T $TIME
check_result $?
echo "odp_dma_perf: asynchronous transfer 1"
echo "====================================="
-${TEST_DIR}/${BIN_NAME}${EXEEXT} -t 1 -g 0 -i 6 -s $SEG_SIZE -T 0 -m 0 -r $ROUNDS
+${TEST_DIR}/${BIN_NAME}${EXEEXT} -t 1 -i $SEGC -o $SEGC -s $SEGS -S 1 -m 0 -f $INFL -T $TIME
check_result $?
echo "odp_dma_perf: asynchronous transfer 2"
echo "====================================="
-${TEST_DIR}/${BIN_NAME}${EXEEXT} -t 1 -g 1 -i 6 -s $SEG_SIZE -T 0 -m 0,0,0,0,0,0 -r $ROUNDS
-
-check_result $?
-
-echo "odp_dma_perf: asynchronous transfer 3"
-echo "====================================="
-
-${TEST_DIR}/${BIN_NAME}${EXEEXT} -t 1 -g 1 -i 6 -s $SEG_SIZE -T 0 -m 0,0,0,0,0,1 -r $ROUNDS
-
-check_result $?
-
-echo "odp_dma_perf: asynchronous transfer 4"
-echo "====================================="
-
-${TEST_DIR}/${BIN_NAME}${EXEEXT} -t 1 -g 0 -i 6 -s $SEG_SIZE -T 1 -m 0 -r $ROUNDS
-
-check_result $?
-
-echo "odp_dma_perf: asynchronous transfer 5"
-echo "====================================="
-
-${TEST_DIR}/${BIN_NAME}${EXEEXT} -t 1 -g 1 -i 6 -s $SEG_SIZE -T 1 -m 0,0,0,0,0,0 -r $ROUNDS
-
-check_result $?
-
-echo "odp_dma_perf: asynchronous transfer 6"
-echo "====================================="
-
-${TEST_DIR}/${BIN_NAME}${EXEEXT} -t 1 -g 1 -i 6 -s $SEG_SIZE -T 1 -m 0,0,0,0,0,1 -r $ROUNDS
+${TEST_DIR}/${BIN_NAME}${EXEEXT} -t 1 -i $SEGC -o $SEGC -s $SEGS -S 1 -m 1 -f $INFL -T $TIME
check_result $?
diff --git a/test/performance/odp_ipsec.c b/test/performance/odp_ipsec.c
index 50e26b1c9..677e7762f 100644
--- a/test/performance/odp_ipsec.c
+++ b/test/performance/odp_ipsec.c
@@ -930,7 +930,7 @@ run_measure_one_config(ipsec_args_t *cargs,
return -1;
}
- rc = odph_ipsec_alg_check(capa, config->crypto.cipher_alg,
+ rc = odph_ipsec_alg_check(&capa, config->crypto.cipher_alg,
config->crypto.cipher_key.length,
config->crypto.auth_alg,
config->crypto.auth_key.length);
diff --git a/test/performance/odp_ipsecfwd.c b/test/performance/odp_ipsecfwd.c
index a6df747f3..16c745afa 100644
--- a/test/performance/odp_ipsecfwd.c
+++ b/test/performance/odp_ipsecfwd.c
@@ -135,6 +135,7 @@ typedef struct prog_config_s {
fwd_entry_t fwd_entries[MAX_FWDS];
odp_queue_t sa_qs[MAX_SA_QUEUES];
pktio_t pktios[MAX_IFS];
+ odp_atomic_u32_t is_running;
sa_config_t default_cfg;
ops_t ops;
char *conf_file;
@@ -181,7 +182,7 @@ typedef struct {
uint8_t q_idx;
} pkt_ifs_t;
-static exposed_alg_t exposed_algs[] = {
+static const exposed_alg_t exposed_algs[] = {
ALG_ENTRY(ODP_CIPHER_ALG_NULL, CIPHER_TYPE),
ALG_ENTRY(ODP_CIPHER_ALG_DES, CIPHER_TYPE),
ALG_ENTRY(ODP_CIPHER_ALG_3DES_CBC, CIPHER_TYPE),
@@ -208,9 +209,9 @@ static exposed_alg_t exposed_algs[] = {
/* SPIs for in and out directions */
static odp_ipsec_sa_t *spi_to_sa_map[2U][MAX_SPIS];
-static odp_atomic_u32_t is_running;
static const int ipsec_out_mark;
static __thread pkt_ifs_t ifs;
+static prog_config_t *prog_conf;
static void init_config(prog_config_t *config)
{
@@ -226,7 +227,7 @@ static void init_config(prog_config_t *config)
static void terminate(int signal ODP_UNUSED)
{
- odp_atomic_store_u32(&is_running, 0U);
+ odp_atomic_store_u32(&prog_conf->is_running, 0U);
}
static void parse_interfaces(prog_config_t *config, const char *optarg)
@@ -1109,9 +1110,10 @@ static void parse_inbound(config_setting_t *cfg, sa_config_t *config)
config->sa_param.inbound.lookup_mode = val;
if (config_setting_lookup_string(cs, "lookup_dst_addr", &val_str) == CONFIG_TRUE) {
- odph_ipv4_addr_parse(&config->lkp_dst_ip, val_str);
- config->lkp_dst_ip = odp_cpu_to_be_32(config->lkp_dst_ip);
- config->sa_param.inbound.lookup_param.dst_addr = &config->lkp_dst_ip;
+ if (odph_ipv4_addr_parse(&config->lkp_dst_ip, val_str) == 0) {
+ config->lkp_dst_ip = odp_cpu_to_be_32(config->lkp_dst_ip);
+ config->sa_param.inbound.lookup_param.dst_addr = &config->lkp_dst_ip;
+ }
}
if (config_setting_lookup_int(cs, "antireplay_ws", &val) == CONFIG_TRUE)
@@ -1134,15 +1136,17 @@ static void parse_outbound(config_setting_t *cfg, sa_config_t *config)
if (tunnel != NULL) {
if (config_setting_lookup_string(tunnel, "src_addr", &val_str) == CONFIG_TRUE) {
- odph_ipv4_addr_parse(&config->src_ip, val_str);
- config->src_ip = odp_cpu_to_be_32(config->src_ip);
- config->sa_param.outbound.tunnel.ipv4.src_addr = &config->src_ip;
+ if (odph_ipv4_addr_parse(&config->src_ip, val_str) == 0) {
+ config->src_ip = odp_cpu_to_be_32(config->src_ip);
+ config->sa_param.outbound.tunnel.ipv4.src_addr = &config->src_ip;
+ }
}
if (config_setting_lookup_string(tunnel, "dst_addr", &val_str) == CONFIG_TRUE) {
- odph_ipv4_addr_parse(&config->dst_ip, val_str);
- config->dst_ip = odp_cpu_to_be_32(config->dst_ip);
- config->sa_param.outbound.tunnel.ipv4.dst_addr = &config->dst_ip;
+ if (odph_ipv4_addr_parse(&config->dst_ip, val_str) == 0) {
+ config->dst_ip = odp_cpu_to_be_32(config->dst_ip);
+ config->sa_param.outbound.tunnel.ipv4.dst_addr = &config->dst_ip;
+ }
}
if (config_setting_lookup_int(tunnel, "dscp", &val) == CONFIG_TRUE)
@@ -1744,6 +1748,7 @@ static int process_packets(void *args)
int thr_idx = odp_thread_id();
odp_event_t evs[MAX_BURST], ev;
ops_t ops = config->prog_config->ops;
+ odp_atomic_u32_t *is_running = &config->prog_config->is_running;
uint32_t cnt;
odp_event_type_t type;
odp_event_subtype_t subtype;
@@ -1756,7 +1761,7 @@ static int process_packets(void *args)
config->thr_idx = thr_idx;
odp_barrier_wait(&config->prog_config->init_barrier);
- while (odp_atomic_load_u32(&is_running)) {
+ while (odp_atomic_load_u32(is_running)) {
int num_pkts_in = 0, num_pkts_ips = 0;
/* TODO: Add possibility to configure scheduler and ipsec enq/deq burst sizes. */
cnt = ops.rx(config, evs, MAX_BURST);
@@ -1943,12 +1948,24 @@ static void print_stats(const prog_config_t *config)
int main(int argc, char **argv)
{
+ odph_helper_options_t odph_opts;
+ odp_init_t init_param;
odp_instance_t odp_instance;
+ odp_shm_t shm_cfg = ODP_SHM_INVALID;
parse_result_t parse_res;
- prog_config_t config;
int ret = EXIT_SUCCESS;
- if (odp_init_global(&odp_instance, NULL, NULL) < 0) {
+ argc = odph_parse_options(argc, argv);
+
+ if (odph_options(&odph_opts) == -1) {
+ ODPH_ERR("Error while reading ODP helper options, exiting\n");
+ exit(EXIT_FAILURE);
+ }
+
+ odp_init_param_init(&init_param);
+ init_param.mem_model = odph_opts.mem_model;
+
+ if (odp_init_global(&odp_instance, &init_param, NULL) < 0) {
ODPH_ERR("ODP global init failed, exiting\n");
exit(EXIT_FAILURE);
}
@@ -1958,15 +1975,32 @@ int main(int argc, char **argv)
exit(EXIT_FAILURE);
}
- init_config(&config);
+ shm_cfg = odp_shm_reserve(PROG_NAME "_cfg", sizeof(prog_config_t), ODP_CACHE_LINE_SIZE,
+ 0U);
- if (!config.is_dir_rx && odp_schedule_config(NULL) < 0) {
+ if (shm_cfg == ODP_SHM_INVALID) {
+ ODPH_ERR("Error reserving shared memory\n");
+ ret = EXIT_FAILURE;
+ goto out;
+ }
+
+ prog_conf = odp_shm_addr(shm_cfg);
+
+ if (prog_conf == NULL) {
+ ODPH_ERR("Error resolving shared memory address\n");
+ ret = EXIT_FAILURE;
+ goto out;
+ }
+
+ init_config(prog_conf);
+
+ if (!prog_conf->is_dir_rx && odp_schedule_config(NULL) < 0) {
ODPH_ERR("Error configuring scheduler\n");
ret = EXIT_FAILURE;
goto out_test;
}
- parse_res = setup_program(argc, argv, &config);
+ parse_res = setup_program(argc, argv, prog_conf);
if (parse_res == PRS_NOK) {
ret = EXIT_FAILURE;
@@ -1978,22 +2012,26 @@ int main(int argc, char **argv)
goto out_test;
}
- config.odp_instance = odp_instance;
- odp_atomic_init_u32(&is_running, 1U);
+ prog_conf->odp_instance = odp_instance;
+ odp_atomic_init_u32(&prog_conf->is_running, 1U);
- if (!setup_test(&config)) {
+ if (!setup_test(prog_conf)) {
ret = EXIT_FAILURE;
goto out_test;
}
- while (odp_atomic_load_u32(&is_running))
+ while (odp_atomic_load_u32(&prog_conf->is_running))
odp_cpu_pause();
- stop_test(&config);
- print_stats(&config);
+ stop_test(prog_conf);
+ print_stats(prog_conf);
out_test:
- teardown_test(&config);
+ teardown_test(prog_conf);
+
+out:
+ if (shm_cfg != ODP_SHM_INVALID)
+ (void)odp_shm_free(shm_cfg);
if (odp_term_local() < 0) {
ODPH_ERR("ODP local terminate failed, exiting\n");
diff --git a/test/performance/odp_l2fwd.c b/test/performance/odp_l2fwd.c
index ab36a4ebe..27b8d4821 100644
--- a/test/performance/odp_l2fwd.c
+++ b/test/performance/odp_l2fwd.c
@@ -1948,7 +1948,7 @@ static void create_groups(int num, odp_schedule_group_t *group)
}
}
-static int set_vector_pool_params(odp_pool_param_t *params, odp_pool_capability_t pool_capa)
+static int set_vector_pool_params(odp_pool_param_t *params, const odp_pool_capability_t *pool_capa)
{
uint32_t num_vec, vec_size;
@@ -1957,14 +1957,14 @@ static int set_vector_pool_params(odp_pool_param_t *params, odp_pool_capability_
else
vec_size = gbl_args->appl.vec_size;
- ODPH_ASSERT(pool_capa.vector.max_size > 0);
- if (vec_size > pool_capa.vector.max_size) {
+ ODPH_ASSERT(pool_capa->vector.max_size > 0);
+ if (vec_size > pool_capa->vector.max_size) {
if (gbl_args->appl.vec_size == 0) {
- vec_size = pool_capa.vector.max_size;
+ vec_size = pool_capa->vector.max_size;
printf("\nWarning: Vector size reduced to %u\n\n", vec_size);
} else {
ODPH_ERR("Vector size too big %u. Maximum is %u.\n",
- vec_size, pool_capa.vector.max_size);
+ vec_size, pool_capa->vector.max_size);
return -1;
}
}
@@ -1978,13 +1978,13 @@ static int set_vector_pool_params(odp_pool_param_t *params, odp_pool_capability_
num_vec = gbl_args->appl.num_vec;
}
- if (pool_capa.vector.max_num && num_vec > pool_capa.vector.max_num) {
+ if (pool_capa->vector.max_num && num_vec > pool_capa->vector.max_num) {
if (gbl_args->appl.num_vec == 0) {
- num_vec = pool_capa.vector.max_num;
+ num_vec = pool_capa->vector.max_num;
printf("\nWarning: number of vectors reduced to %u\n\n", num_vec);
} else {
ODPH_ERR("Too many vectors (%u) per pool. Maximum is %u.\n",
- num_vec, pool_capa.vector.max_num);
+ num_vec, pool_capa->vector.max_num);
return -1;
}
}
@@ -2197,7 +2197,7 @@ int main(int argc, char *argv[])
}
odp_pool_param_init(&params);
- if (set_vector_pool_params(&params, pool_capa))
+ if (set_vector_pool_params(&params, &pool_capa))
return -1;
gbl_args->vector_num = params.vector.num;
diff --git a/test/performance/odp_sched_pktio.c b/test/performance/odp_sched_pktio.c
index d82dce12f..1333e66e4 100644
--- a/test/performance/odp_sched_pktio.c
+++ b/test/performance/odp_sched_pktio.c
@@ -424,7 +424,7 @@ static int worker_thread_timers(void *arg)
odp_queue_t queue;
pktin_queue_context_t *queue_context;
odp_timer_t timer;
- odp_timer_set_t ret;
+ odp_timer_retval_t ret;
odp_timer_start_t start_param;
worker_arg_t *worker_arg = arg;
test_global_t *test_global = worker_arg->test_global_ptr;
@@ -1326,7 +1326,7 @@ static int start_timers(test_global_t *test_global)
int i, j;
odp_timeout_t timeout;
odp_timer_t timer;
- odp_timer_set_t ret;
+ odp_timer_retval_t ret;
odp_timer_start_t start_param;
uint64_t timeout_tick = test_global->timer.timeout_tick;
int num_pktio = test_global->opt.num_pktio;
diff --git a/test/performance/odp_timer_perf.c b/test/performance/odp_timer_perf.c
index 3df9a875f..a7d98e68f 100644
--- a/test/performance/odp_timer_perf.c
+++ b/test/performance/odp_timer_perf.c
@@ -644,7 +644,7 @@ static void cancel_timers(test_global_t *global, uint32_t worker_idx)
if (timer == ODP_TIMER_INVALID)
continue;
- if (odp_timer_cancel(timer, &ev) == 0)
+ if (odp_timer_cancel(timer, &ev) == ODP_TIMER_SUCCESS)
odp_event_free(ev);
}
}
@@ -753,8 +753,14 @@ static int set_cancel_mode_worker(void *arg)
status = odp_timer_cancel(timer, &ev);
num_cancel++;
- if (status < 0)
+ if (odp_unlikely(status == ODP_TIMER_TOO_NEAR)) {
continue;
+ } else if (odp_unlikely(status != ODP_TIMER_SUCCESS)) {
+ ODPH_ERR("Timer (%u/%u) cancel failed (ret %i)\n", i, j,
+ status);
+ ret = -1;
+ break;
+ }
start_param.tick_type = ODP_TIMER_TICK_ABS;
start_param.tick = tick + j * period_tick;
diff --git a/test/validation/api/Makefile.am b/test/validation/api/Makefile.am
index c08ff3d6e..ade387152 100644
--- a/test/validation/api/Makefile.am
+++ b/test/validation/api/Makefile.am
@@ -54,6 +54,7 @@ TESTS = \
init/init_feature_enabled$(EXEEXT) \
init/init_feature_disabled$(EXEEXT) \
init/init_test_param_init$(EXEEXT) \
+ init/init_test_term_abnormal$(EXEEXT) \
ipsec/ipsec_sync$(EXEEXT) \
ipsec/ipsec_async$(EXEEXT) \
ipsec/ipsec_inline_in$(EXEEXT) \
diff --git a/test/validation/api/atomic/atomic.c b/test/validation/api/atomic/atomic.c
index cbdd219fc..17d9dc82a 100644
--- a/test/validation/api/atomic/atomic.c
+++ b/test/validation/api/atomic/atomic.c
@@ -974,7 +974,7 @@ static int atomic_init(odp_instance_t *inst)
odph_helper_options_t helper_options;
if (odph_options(&helper_options)) {
- fprintf(stderr, "error: odph_options() failed.\n");
+ ODPH_ERR("odph_options() failed\n");
return -1;
}
@@ -982,18 +982,18 @@ static int atomic_init(odp_instance_t *inst)
init_param.mem_model = helper_options.mem_model;
if (0 != odp_init_global(inst, &init_param, NULL)) {
- fprintf(stderr, "error: odp_init_global() failed.\n");
+ ODPH_ERR("odp_init_global() failed\n");
return -1;
}
if (0 != odp_init_local(*inst, ODP_THREAD_CONTROL)) {
- fprintf(stderr, "error: odp_init_local() failed.\n");
+ ODPH_ERR("odp_init_local() failed\n");
return -1;
}
global_shm = odp_shm_reserve(GLOBAL_SHM_NAME,
sizeof(global_shared_mem_t), 64, 0);
if (ODP_SHM_INVALID == global_shm) {
- fprintf(stderr, "Unable reserve memory for global_shm\n");
+ ODPH_ERR("Unable to reserve memory for global_shm\n");
return -1;
}
@@ -1029,17 +1029,17 @@ static int atomic_term(odp_instance_t inst)
shm = odp_shm_lookup(GLOBAL_SHM_NAME);
if (0 != odp_shm_free(shm)) {
- fprintf(stderr, "error: odp_shm_free() failed.\n");
+ ODPH_ERR("odp_shm_free() failed\n");
return -1;
}
if (0 != odp_term_local()) {
- fprintf(stderr, "error: odp_term_local() failed.\n");
+ ODPH_ERR("odp_term_local() failed\n");
return -1;
}
if (0 != odp_term_global(inst)) {
- fprintf(stderr, "error: odp_term_global() failed.\n");
+ ODPH_ERR("odp_term_global() failed\n");
return -1;
}
diff --git a/test/validation/api/barrier/barrier.c b/test/validation/api/barrier/barrier.c
index e0665b7cf..610b5db70 100644
--- a/test/validation/api/barrier/barrier.c
+++ b/test/validation/api/barrier/barrier.c
@@ -305,7 +305,7 @@ static int barrier_init(odp_instance_t *inst)
odph_helper_options_t helper_options;
if (odph_options(&helper_options)) {
- fprintf(stderr, "error: odph_options() failed.\n");
+ ODPH_ERR("odph_options() failed\n");
return -1;
}
@@ -313,18 +313,18 @@ static int barrier_init(odp_instance_t *inst)
init_param.mem_model = helper_options.mem_model;
if (0 != odp_init_global(inst, &init_param, NULL)) {
- fprintf(stderr, "error: odp_init_global() failed.\n");
+ ODPH_ERR("odp_init_global() failed\n");
return -1;
}
if (0 != odp_init_local(*inst, ODP_THREAD_CONTROL)) {
- fprintf(stderr, "error: odp_init_local() failed.\n");
+ ODPH_ERR("odp_init_local() failed\n");
return -1;
}
global_shm = odp_shm_reserve(GLOBAL_SHM_NAME,
sizeof(global_shared_mem_t), 64, 0);
if (ODP_SHM_INVALID == global_shm) {
- fprintf(stderr, "Unable reserve memory for global_shm\n");
+ ODPH_ERR("Unable to reserve memory for global_shm\n");
return -1;
}
@@ -360,17 +360,17 @@ static int barrier_term(odp_instance_t inst)
shm = odp_shm_lookup(GLOBAL_SHM_NAME);
if (0 != odp_shm_free(shm)) {
- fprintf(stderr, "error: odp_shm_free() failed.\n");
+ ODPH_ERR("odp_shm_free() failed\n");
return -1;
}
if (0 != odp_term_local()) {
- fprintf(stderr, "error: odp_term_local() failed.\n");
+ ODPH_ERR("odp_term_local() failed\n");
return -1;
}
if (0 != odp_term_global(inst)) {
- fprintf(stderr, "error: odp_term_global() failed.\n");
+ ODPH_ERR("odp_term_global() failed\n");
return -1;
}
diff --git a/test/validation/api/buffer/buffer.c b/test/validation/api/buffer/buffer.c
index 2d9632342..ef26ea6e0 100644
--- a/test/validation/api/buffer/buffer.c
+++ b/test/validation/api/buffer/buffer.c
@@ -23,7 +23,7 @@ static int buffer_suite_init(void)
uint32_t size, num, align;
if (odp_pool_capability(&pool_capa)) {
- printf("pool capability failed\n");
+ ODPH_ERR("Pool capability failed\n");
return -1;
}
@@ -111,7 +111,7 @@ static void test_pool_alloc_free(const odp_pool_param_t *param)
wrong_align = true;
if (wrong_type || wrong_subtype || wrong_size || wrong_align) {
- printf("Buffer has error\n");
+ ODPH_ERR("Buffer has error\n");
odp_buffer_print(buffer[i]);
break;
}
@@ -200,7 +200,7 @@ static void test_pool_alloc_free_multi(const odp_pool_param_t *param)
wrong_align = true;
if (wrong_type || wrong_subtype || wrong_size || wrong_align) {
- printf("Buffer has error\n");
+ ODPH_ERR("Buffer has error\n");
odp_buffer_print(buffer[i]);
break;
}
@@ -351,7 +351,7 @@ static void test_pool_max_pools(odp_pool_param_t *param)
CU_ASSERT(num_pool == max_pools);
if (num_pool != max_pools)
- printf("Error: created only %u pools\n", num_pool);
+ ODPH_ERR("Created only %u pools\n", num_pool);
for (i = 0; i < num_pool; i++) {
buffer[i] = odp_buffer_alloc(pool[i]);
@@ -536,6 +536,8 @@ static void buffer_test_user_area(void)
CU_ASSERT_FATAL(pool != ODP_POOL_INVALID);
for (i = 0; i < num; i++) {
+ odp_event_t ev;
+
buffer[i] = odp_buffer_alloc(pool);
if (buffer[i] == ODP_BUFFER_INVALID)
@@ -546,6 +548,9 @@ static void buffer_test_user_area(void)
CU_ASSERT_FATAL(addr != NULL);
CU_ASSERT(prev != addr);
+ ev = odp_buffer_to_event(buffer[i]);
+ CU_ASSERT(odp_event_user_area(ev) == addr);
+
prev = addr;
memset(addr, 0, size);
}
diff --git a/test/validation/api/classification/odp_classification_tests.c b/test/validation/api/classification/odp_classification_tests.c
index 002beb2aa..84dfcf562 100644
--- a/test/validation/api/classification/odp_classification_tests.c
+++ b/test/validation/api/classification/odp_classification_tests.c
@@ -70,7 +70,7 @@ static int classification_suite_common_init(odp_bool_t enable_pktv)
ret = odp_pktio_capability(pktio_loop, &pktio_capa);
if (ret) {
- fprintf(stderr, "unable to get pktio capability.\n");
+ ODPH_ERR("Unable to get pktio capability\n");
return -1;
}
diff --git a/test/validation/api/comp/comp.c b/test/validation/api/comp/comp.c
index 88a61da95..cb771c989 100644
--- a/test/validation/api/comp/comp.c
+++ b/test/validation/api/comp/comp.c
@@ -5,6 +5,8 @@
*/
#include <odp_api.h>
+#include <odp/helper/odph_api.h>
+
#include <odp_cunit_common.h>
#include "test_vectors.h"
@@ -68,7 +70,7 @@ static int check_comp_alg_support(odp_comp_alg_t comp,
return ODP_TEST_INACTIVE;
break;
default:
- fprintf(stderr, "Unsupported compression algorithm\n");
+ ODPH_ERR("Unsupported compression algorithm\n");
return ODP_TEST_INACTIVE;
}
@@ -87,7 +89,7 @@ static int check_comp_alg_support(odp_comp_alg_t comp,
return ODP_TEST_INACTIVE;
break;
default:
- fprintf(stderr, "Unsupported hash algorithm\n");
+ ODPH_ERR("Unsupported hash algorithm\n");
return ODP_TEST_INACTIVE;
}
@@ -475,17 +477,17 @@ static int comp_init(odp_instance_t *inst)
odp_pool_capability_t pool_capa;
if (0 != odp_init_global(inst, NULL, NULL)) {
- fprintf(stderr, "error: odp_init_global() failed.\n");
+ ODPH_ERR("odp_init_global() failed\n");
return -1;
}
if (0 != odp_init_local(*inst, ODP_THREAD_CONTROL)) {
- fprintf(stderr, "error: odp_init_local() failed.\n");
+ ODPH_ERR("odp_init_local() failed\n");
return -1;
}
if (odp_pool_capability(&pool_capa) < 0) {
- fprintf(stderr, "error: odp_pool_capability() failed.\n");
+ ODPH_ERR("odp_pool_capability() failed\n");
return -1;
}
@@ -497,20 +499,20 @@ static int comp_init(odp_instance_t *inst)
if (pool_capa.pkt.max_seg_len &&
TEST_PKT_LEN > pool_capa.pkt.max_seg_len) {
- fprintf(stderr, "Warning: small packet segment length\n");
+ ODPH_ERR("Warning: small packet segment length\n");
params.pkt.seg_len = pool_capa.pkt.max_seg_len;
}
pool = odp_pool_create(COMP_PACKET_POOL, &params);
if (ODP_POOL_INVALID == pool) {
- fprintf(stderr, "Packet pool creation failed.\n");
+ ODPH_ERR("Packet pool creation failed\n");
return -1;
}
/* Queue to store compression/decompression events */
out_queue = odp_queue_create(COMP_OUT_QUEUE, NULL);
if (ODP_QUEUE_INVALID == out_queue) {
- fprintf(stderr, "Comp outq creation failed.\n");
+ ODPH_ERR("Comp outq creation failed\n");
return -1;
}
@@ -525,26 +527,26 @@ static int comp_term(odp_instance_t inst)
out_queue = odp_queue_lookup(COMP_OUT_QUEUE);
if (ODP_QUEUE_INVALID != out_queue) {
if (odp_queue_destroy(out_queue))
- fprintf(stderr, "Comp outq destroy failed.\n");
+ ODPH_ERR("Comp outq destroy failed\n");
} else {
- fprintf(stderr, "Comp outq not found.\n");
+ ODPH_ERR("Comp outq not found\n");
}
pool = odp_pool_lookup(COMP_PACKET_POOL);
if (ODP_POOL_INVALID != pool) {
if (odp_pool_destroy(pool))
- fprintf(stderr, "Packet pool destroy failed.\n");
+ ODPH_ERR("Packet pool destroy failed\n");
} else {
- fprintf(stderr, "Packet pool not found.\n");
+ ODPH_ERR("Packet pool not found\n");
}
if (0 != odp_term_local()) {
- fprintf(stderr, "error: odp_term_local() failed.\n");
+ ODPH_ERR("odp_term_local() failed\n");
return -1;
}
if (0 != odp_term_global(inst)) {
- fprintf(stderr, "error: odp_term_global() failed.\n");
+ ODPH_ERR("odp_term_global() failed\n");
return -1;
}
diff --git a/test/validation/api/crypto/Makefile.am b/test/validation/api/crypto/Makefile.am
index e438ec8ca..ead21a336 100644
--- a/test/validation/api/crypto/Makefile.am
+++ b/test/validation/api/crypto/Makefile.am
@@ -3,6 +3,12 @@ include ../Makefile.inc
test_PROGRAMS = crypto_main
crypto_main_SOURCES = \
odp_crypto_test_inp.c \
+ crypto_op_test.c \
+ crypto_op_test.h \
test_vectors.h \
- test_vectors_len.h
+ test_vectors_len.h \
+ test_vector_defs.h \
+ util.h \
+ util.c
+
PRELDADD += $(LIBPACKET_COMMON)
diff --git a/test/validation/api/crypto/crypto_op_test.c b/test/validation/api/crypto/crypto_op_test.c
new file mode 100644
index 000000000..4ad333488
--- /dev/null
+++ b/test/validation/api/crypto/crypto_op_test.c
@@ -0,0 +1,571 @@
+/* Copyright (c) 2014-2018, Linaro Limited
+ * Copyright (c) 2021-2023, Nokia
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <string.h>
+#include <stdlib.h>
+#include <odp_api.h>
+#include <odp_cunit_common.h>
+#include <packet_common.h>
+#include "crypto_op_test.h"
+#include "util.h"
+
+#define MAX_FAILURE_PRINTS 20
+
+#define MAX_IGNORED_RANGES 3
+
+/*
+ * Output packet parts that we ignore since they have undefined values
+ */
+typedef struct ignore_t {
+ uint32_t byte_offset; /* offset to a byte which has bits to be ignored */
+ uint8_t byte_mask; /* mask of ignored bits in the byte */
+ struct {
+ uint32_t offset;
+ uint32_t length;
+ } ranges[MAX_IGNORED_RANGES]; /* byte ranges to be ignored */
+ uint32_t num_ranges;
+} ignore_t;
+
+/* Add room for bytes that are not included in ref->length */
+#define MAX_EXP_DATA_LEN (MAX_DATA_LEN + 200)
+
+/*
+ * Expected packet data
+ */
+typedef struct expected_t {
+ uint8_t data[MAX_EXP_DATA_LEN];
+ uint32_t len;
+ ignore_t ignore;
+} expected_t;
+
+int crypto_op(odp_packet_t pkt_in,
+ odp_packet_t *pkt_out,
+ odp_bool_t *ok,
+ const odp_crypto_packet_op_param_t *op_params,
+ odp_crypto_op_type_t op_type)
+{
+ int rc;
+ odp_event_t event;
+ odp_crypto_packet_result_t result;
+ odp_event_subtype_t subtype;
+ odp_packet_t orig_pkt_out;
+
+ if (op_type == ODP_CRYPTO_OP_TYPE_LEGACY)
+ *pkt_out = pkt_in;
+ else if (op_type == ODP_CRYPTO_OP_TYPE_BASIC)
+ *pkt_out = ODP_PACKET_INVALID;
+ orig_pkt_out = *pkt_out;
+
+ if (suite_context.op_mode == ODP_CRYPTO_SYNC) {
+ rc = odp_crypto_op(&pkt_in, pkt_out, op_params, 1);
+ if (rc <= 0) {
+ CU_FAIL("Failed odp_crypto_packet_op()");
+ goto fail;
+ }
+ } else {
+ odp_packet_t *out_param = pkt_out;
+
+ if (op_type == ODP_CRYPTO_OP_TYPE_BASIC)
+ out_param = NULL;
+
+ rc = odp_crypto_op_enq(&pkt_in, out_param, op_params, 1);
+ if (rc <= 0) {
+ CU_FAIL("Failed odp_crypto_op_enq()");
+ goto fail;
+ }
+
+ /* Get crypto completion event from compl_queue. */
+ CU_ASSERT_FATAL(NULL != suite_context.compl_queue_deq);
+ do {
+ event = suite_context.compl_queue_deq();
+ } while (event == ODP_EVENT_INVALID);
+
+ CU_ASSERT(ODP_EVENT_PACKET == odp_event_type(event));
+ CU_ASSERT(ODP_EVENT_PACKET_CRYPTO == odp_event_subtype(event));
+ CU_ASSERT(ODP_EVENT_PACKET == odp_event_types(event, &subtype));
+ CU_ASSERT(ODP_EVENT_PACKET_CRYPTO == subtype);
+
+ *pkt_out = odp_crypto_packet_from_event(event);
+ }
+
+ if (op_type != ODP_CRYPTO_OP_TYPE_BASIC)
+ CU_ASSERT(*pkt_out == orig_pkt_out);
+ CU_ASSERT(ODP_EVENT_PACKET ==
+ odp_event_type(odp_packet_to_event(*pkt_out)));
+ CU_ASSERT(ODP_EVENT_PACKET_CRYPTO ==
+ odp_event_subtype(odp_packet_to_event(*pkt_out)));
+ CU_ASSERT(ODP_EVENT_PACKET ==
+ odp_event_types(odp_packet_to_event(*pkt_out), &subtype));
+ CU_ASSERT(ODP_EVENT_PACKET_CRYPTO == subtype);
+ CU_ASSERT(odp_packet_subtype(*pkt_out) == ODP_EVENT_PACKET_CRYPTO);
+
+ rc = odp_crypto_result(&result, *pkt_out);
+ if (rc < -1)
+ CU_FAIL("Failed odp_crypto_result()");
+ CU_ASSERT(rc == 0 || rc == -1);
+
+ if (op_type == ODP_CRYPTO_OP_TYPE_OOP &&
+ suite_context.op_mode == ODP_CRYPTO_ASYNC)
+ CU_ASSERT(result.pkt_in == pkt_in);
+
+ *ok = (rc == 0);
+
+#if ODP_DEPRECATED_API
+ CU_ASSERT(*ok == result.ok);
+#endif
+
+ return 0;
+fail:
+ odp_packet_free(pkt_in);
+ if (op_type == ODP_CRYPTO_OP_TYPE_OOP)
+ odp_packet_free(*pkt_out);
+ return -1;
+}
+
+/*
+ * Try to adjust packet so that the first segment holds 'first_seg_len' bytes
+ * of packet data (+ tailroom if first_seg_len is longer than the packet).
+ *
+ * If 'first_seg_len' is zero, do not try to add segments but make headroom
+ * zero.
+ *
+ * Packet data bytes are not preserved.
+ */
+static void adjust_segments(odp_packet_t *pkt, uint32_t first_seg_len)
+{
+ uint32_t shift;
+
+ shift = odp_packet_headroom(*pkt) + first_seg_len;
+
+ if (odp_packet_extend_head(pkt, shift, NULL, NULL) < 0) {
+ CU_FAIL("odp_packet_extend_head() failed\n");
+ return;
+ }
+ if (odp_packet_trunc_tail(pkt, shift, NULL, NULL) < 0) {
+ CU_FAIL("odp_packet_trunc_tail() failed\n");
+ return;
+ }
+ /*
+ * ODP API does not seem to guarantee that we ever have a multi-segment
+ * packet at this point, but we can print a message about it.
+ */
+ if (first_seg_len == 1 &&
+ first_seg_len != odp_packet_seg_len(*pkt))
+ printf("Could not create a segmented packet for testing.\n");
+}
+
+static void write_header_and_trailer(odp_packet_t pkt,
+ uint32_t header_len, uint32_t trailer_len)
+{
+ uint32_t trailer_offset = odp_packet_len(pkt) - trailer_len;
+ uint32_t max_len = header_len > trailer_len ? header_len : trailer_len;
+ uint8_t buffer[max_len];
+ int rc;
+
+ fill_with_pattern(buffer, sizeof(buffer));
+
+ rc = odp_packet_copy_from_mem(pkt, 0, header_len, buffer);
+ CU_ASSERT(rc == 0);
+ rc = odp_packet_copy_from_mem(pkt, trailer_offset, trailer_len, buffer);
+ CU_ASSERT(rc == 0);
+}
+
+static void prepare_crypto_ranges(const crypto_op_test_param_t *param,
+ odp_packet_data_range_t *cipher_range,
+ odp_packet_data_range_t *auth_range)
+{
+ odp_packet_data_range_t zero_range = {.offset = 0, .length = 0};
+ uint32_t c_scale = param->is_bit_mode_cipher ? 8 : 1;
+ uint32_t a_scale = param->is_bit_mode_auth ? 8 : 1;
+
+ *cipher_range = param->cipher_range;
+ *auth_range = param->auth_range;
+ cipher_range->offset += c_scale * param->header_len;
+ auth_range->offset += a_scale * param->header_len;
+
+ if (param->ref->cipher == ODP_CIPHER_ALG_NULL)
+ *cipher_range = zero_range;
+ if (param->ref->auth == ODP_AUTH_ALG_NULL)
+ *auth_range = zero_range;
+}
+
+static int prepare_input_packet(const crypto_op_test_param_t *param,
+ odp_packet_t *pkt_in)
+{
+ crypto_test_reference_t *ref = param->ref;
+ uint32_t reflength = ref_length_in_bytes(ref);
+ odp_packet_t pkt;
+ uint32_t digest_offset = param->digest_offset;
+ uint32_t pkt_len;
+
+ pkt_len = param->header_len + reflength + param->trailer_len;
+ if (param->digest_offset == param->header_len + reflength)
+ pkt_len += ref->digest_length;
+
+ pkt = odp_packet_alloc(suite_context.pool, pkt_len);
+
+ CU_ASSERT(pkt != ODP_PACKET_INVALID);
+ if (pkt == ODP_PACKET_INVALID)
+ return -1;
+
+ if (param->adjust_segmentation)
+ adjust_segments(&pkt, param->first_seg_len);
+
+ write_header_and_trailer(pkt, param->header_len, param->trailer_len);
+
+ if (param->op == ODP_CRYPTO_OP_ENCODE) {
+ odp_packet_copy_from_mem(pkt, param->header_len,
+ reflength, ref->plaintext);
+ } else {
+ odp_packet_copy_from_mem(pkt, param->header_len,
+ reflength, ref->ciphertext);
+ odp_packet_copy_from_mem(pkt, digest_offset,
+ ref->digest_length,
+ ref->digest);
+ if (param->wrong_digest) {
+ uint8_t byte = ~ref->digest[0];
+
+ odp_packet_copy_from_mem(pkt, digest_offset, 1, &byte);
+ }
+ }
+ *pkt_in = pkt;
+ return 0;
+}
+
+static void prepare_oop_output_packet(const crypto_op_test_param_t *param,
+ odp_packet_t *pkt_out,
+ uint32_t pkt_len)
+{
+ uint32_t reflength = ref_length_in_bytes(param->ref);
+ const uint32_t oop_extra_len = 5;
+ uint32_t trl_len;
+ uint32_t hdr_len;
+ uint32_t oop_len;
+
+ oop_len = pkt_len + param->oop_shift + oop_extra_len;
+ *pkt_out = odp_packet_alloc(suite_context.pool, oop_len);
+ CU_ASSERT_FATAL(*pkt_out != ODP_PACKET_INVALID);
+
+ uint8_t buf[oop_len];
+
+ memset(buf, 0x55, sizeof(buf));
+ odp_packet_copy_from_mem(*pkt_out, 0, sizeof(buf), buf);
+
+ hdr_len = param->header_len + param->oop_shift;
+ trl_len = oop_len - hdr_len - reflength;
+
+ write_header_and_trailer(*pkt_out, hdr_len, trl_len);
+
+ /* have different metadata than in the input packet */
+ memset(odp_packet_user_area(*pkt_out), 0xab,
+ odp_packet_user_area_size(*pkt_out));
+}
+
+static int is_packet_data_equal(odp_packet_t pkt_1, odp_packet_t pkt_2)
+{
+ uint32_t len = odp_packet_len(pkt_1);
+ uint8_t buf_1[len];
+ uint8_t buf_2[len];
+
+ if (len != odp_packet_len(pkt_2) ||
+ odp_packet_copy_to_mem(pkt_1, 0, len, buf_1) ||
+ odp_packet_copy_to_mem(pkt_2, 0, len, buf_2))
+ return 0;
+
+ return !memcmp(buf_1, buf_2, len);
+}
+
+static int is_in_range(uint32_t offs, uint32_t range_offs, uint32_t range_len)
+{
+ return offs >= range_offs && offs < range_offs + range_len;
+}
+
+static void add_ignored_range(ignore_t *ign, uint32_t offs, uint32_t len)
+{
+ if (len == 0)
+ return;
+ CU_ASSERT_FATAL(ign->num_ranges < MAX_IGNORED_RANGES);
+ ign->ranges[ign->num_ranges].offset = offs;
+ ign->ranges[ign->num_ranges].length = len;
+ ign->num_ranges++;
+}
+
+static void clear_ignored_data(const ignore_t *ign, uint8_t *data, uint32_t data_len)
+{
+ CU_ASSERT_FATAL(ign->byte_offset < data_len);
+ data[ign->byte_offset] &= ~ign->byte_mask;
+
+ for (uint32_t n = 0; n < ign->num_ranges; n++) {
+ uint32_t offset = ign->ranges[n].offset;
+ uint32_t length = ign->ranges[n].length;
+
+ CU_ASSERT(offset + length <= data_len);
+ memset(data + offset, 0, length);
+ }
+}
+
+static void prepare_ignore_info(const crypto_op_test_param_t *param,
+ uint32_t shift,
+ uint32_t cipher_offset,
+ uint32_t cipher_len,
+ uint32_t auth_offset,
+ uint32_t auth_len,
+ ignore_t *ignore)
+{
+ memset(ignore, 0, sizeof(*ignore));
+
+ /*
+ * Leftover bits in the last byte of the cipher range of bit mode
+ * ciphers have undefined values.
+ */
+ if (param->is_bit_mode_cipher &&
+ param->ref->cipher != ODP_CIPHER_ALG_NULL) {
+ uint8_t leftover_bits = ref_length_in_bits(param->ref) % 8;
+
+ ignore->byte_offset = cipher_offset + cipher_len - 1 + shift;
+ if (leftover_bits > 0)
+ ignore->byte_mask = ~(0xff << (8 - leftover_bits));
+ else
+ ignore->byte_mask = 0;
+ }
+
+ /*
+ * In decode sessions the bytes in the hash location have
+ * undefined values.
+ */
+ if (param->ref->auth != ODP_AUTH_ALG_NULL &&
+ param->op == ODP_CRYPTO_OP_DECODE) {
+ uint32_t offs = param->digest_offset;
+
+ if (param->op_type != ODP_CRYPTO_OP_TYPE_OOP ||
+ is_in_range(offs, cipher_offset, cipher_len) ||
+ is_in_range(offs, auth_offset, auth_len)) {
+ add_ignored_range(ignore,
+ param->digest_offset + shift,
+ param->ref->digest_length);
+ }
+ }
+
+ /* Decrypted bytes are undefined if authentication fails. */
+ if (param->op == ODP_CRYPTO_OP_DECODE &&
+ param->wrong_digest) {
+ add_ignored_range(ignore, cipher_offset + shift, cipher_len);
+ /* In OOP case, auth range may not get copied */
+ if (param->op_type == ODP_CRYPTO_OP_TYPE_OOP)
+ add_ignored_range(ignore, auth_offset + shift, auth_len);
+ }
+}
+
+static void prepare_expected_data(const crypto_op_test_param_t *param,
+ const odp_packet_data_range_t *cipher_range,
+ const odp_packet_data_range_t *auth_range,
+ odp_packet_t pkt_in,
+ odp_packet_t pkt_out,
+ expected_t *ex)
+{
+ uint32_t digest_offset = param->digest_offset;
+ uint32_t cipher_offset = cipher_range->offset;
+ uint32_t cipher_len = cipher_range->length;
+ uint32_t auth_offset = auth_range->offset;
+ uint32_t auth_len = auth_range->length;
+ const int32_t shift = param->op_type == ODP_CRYPTO_OP_TYPE_OOP ? param->oop_shift : 0;
+ const odp_packet_t base_pkt = param->op_type == ODP_CRYPTO_OP_TYPE_OOP ? pkt_out : pkt_in;
+ int rc;
+ uint32_t cipher_offset_in_ref = param->cipher_range.offset;
+
+ if (param->op == ODP_CRYPTO_OP_ENCODE)
+ digest_offset += shift;
+
+ if (param->is_bit_mode_cipher) {
+ cipher_offset_in_ref /= 8;
+ cipher_offset /= 8;
+ cipher_len = (cipher_len + 7) / 8;
+ }
+ if (param->is_bit_mode_auth) {
+ auth_offset /= 8;
+ auth_len = (auth_len + 7) / 8;
+ }
+ if (param->ref->cipher == ODP_CIPHER_ALG_NULL)
+ cipher_len = 0;
+ if (param->ref->auth == ODP_AUTH_ALG_NULL ||
+ param->ref->auth == ODP_AUTH_ALG_AES_GCM ||
+ param->ref->auth == ODP_AUTH_ALG_AES_CCM ||
+ param->ref->auth == ODP_AUTH_ALG_CHACHA20_POLY1305) {
+ /* auth range is ignored with null and AEAD algorithms */
+ auth_len = 0;
+ }
+
+ /* copy all data from base packet */
+ ex->len = odp_packet_len(base_pkt);
+ CU_ASSERT_FATAL(ex->len <= sizeof(ex->data));
+ rc = odp_packet_copy_to_mem(base_pkt, 0, ex->len, ex->data);
+ CU_ASSERT(rc == 0);
+
+ if (param->op_type == ODP_CRYPTO_OP_TYPE_OOP && auth_len > 0) {
+ /* copy auth range from input packet */
+ rc = odp_packet_copy_to_mem(pkt_in, auth_offset, auth_len,
+ ex->data + auth_offset + shift);
+ CU_ASSERT(rc == 0);
+ }
+
+ if (param->op == ODP_CRYPTO_OP_ENCODE) {
+ /* copy hash first */
+ memcpy(ex->data + digest_offset,
+ param->ref->digest,
+ param->ref->digest_length);
+ /*
+ * Copy ciphertext, possibly overwriting hash.
+ * The other order (hash overwriting some cipher
+ * text) does not work in any real use case anyway.
+ */
+ memcpy(ex->data + cipher_offset + shift,
+ param->ref->ciphertext + cipher_offset_in_ref,
+ cipher_len);
+ } else {
+ memcpy(ex->data + cipher_offset + shift,
+ param->ref->plaintext + cipher_offset_in_ref,
+ cipher_len);
+ }
+
+ prepare_ignore_info(param, shift,
+ cipher_offset, cipher_len,
+ auth_offset, auth_len,
+ &ex->ignore);
+}
+
+static void print_data(const char *title, uint8_t *data, uint32_t len)
+{
+ static uint64_t limit;
+
+ if (limit++ > MAX_FAILURE_PRINTS)
+ return;
+
+ printf("%s\n", title);
+ for (uint32_t n = 0; n < len ; n++) {
+ printf(" %02x", data[n]);
+ if ((n + 1) % 16 == 0)
+ printf("\n");
+ }
+ printf("\n");
+}
+
+static void check_output_packet_data(odp_packet_t pkt, expected_t *ex)
+{
+ int rc;
+ uint8_t pkt_data[ex->len];
+
+ CU_ASSERT(odp_packet_len(pkt) == ex->len);
+ rc = odp_packet_copy_to_mem(pkt, 0, ex->len, pkt_data);
+ CU_ASSERT(rc == 0);
+
+ clear_ignored_data(&ex->ignore, pkt_data, sizeof(pkt_data));
+ clear_ignored_data(&ex->ignore, ex->data, sizeof(ex->data));
+
+ if (memcmp(pkt_data, ex->data, ex->len)) {
+ CU_FAIL("packet data does not match expected data");
+ print_data("packet:", pkt_data, ex->len);
+ print_data("expected:", ex->data, ex->len);
+ }
+}
+
+void test_crypto_op(const crypto_op_test_param_t *param)
+{
+ odp_bool_t ok = false;
+ odp_packet_t pkt;
+ odp_packet_t pkt_copy = ODP_PACKET_INVALID;
+ odp_packet_t pkt_out = ODP_PACKET_INVALID;
+ test_packet_md_t md_in, md_out, md_out_orig;
+ expected_t expected;
+ odp_crypto_packet_op_param_t op_params = {
+ .session = param->session,
+ .cipher_iv_ptr = param->ref->cipher_iv,
+ .auth_iv_ptr = param->ref->auth_iv,
+ .hash_result_offset = param->digest_offset,
+ .aad_ptr = param->ref->aad,
+ .dst_offset_shift = param->oop_shift,
+ };
+
+ /*
+ * Test detection of wrong digest value in input packet
+ * only when decoding and using non-null auth algorithm.
+ */
+ if (param->wrong_digest &&
+ (param->ref->auth == ODP_AUTH_ALG_NULL ||
+ param->op == ODP_CRYPTO_OP_ENCODE))
+ return;
+
+ prepare_crypto_ranges(param, &op_params.cipher_range, &op_params.auth_range);
+ if (prepare_input_packet(param, &pkt))
+ return;
+
+ if (param->op_type == ODP_CRYPTO_OP_TYPE_OOP) {
+ prepare_oop_output_packet(param, &pkt_out, odp_packet_len(pkt));
+
+ pkt_copy = odp_packet_copy(pkt, suite_context.pool);
+ CU_ASSERT_FATAL(pkt_copy != ODP_PACKET_INVALID);
+ test_packet_get_md(pkt_out, &md_out_orig);
+ }
+
+ prepare_expected_data(param, &op_params.cipher_range, &op_params.auth_range,
+ pkt, pkt_out, &expected);
+
+ if (param->op_type == ODP_CRYPTO_OP_TYPE_OOP &&
+ param->op == ODP_CRYPTO_OP_ENCODE) {
+ /*
+ * In this type of sessions digest offset is an offset to the output
+ * packet, so apply the shift.
+ */
+ op_params.hash_result_offset += param->oop_shift;
+ }
+
+ test_packet_set_md(pkt);
+ test_packet_get_md(pkt, &md_in);
+
+ if (crypto_op(pkt, &pkt_out, &ok, &op_params, param->op_type))
+ return;
+
+ test_packet_get_md(pkt_out, &md_out);
+
+ if (param->op_type == ODP_CRYPTO_OP_TYPE_OOP) {
+ test_packet_md_t md;
+
+ /* check that input packet has not changed */
+ CU_ASSERT(is_packet_data_equal(pkt, pkt_copy));
+ odp_packet_free(pkt_copy);
+ test_packet_get_md(pkt, &md);
+ CU_ASSERT(test_packet_is_md_equal(&md, &md_in));
+ odp_packet_free(pkt);
+
+ /* check that metadata of output packet has not changed */
+ CU_ASSERT(test_packet_is_md_equal(&md_out, &md_out_orig));
+ } else {
+ CU_ASSERT(test_packet_is_md_equal(&md_out, &md_in));
+ }
+
+ if (param->ref->cipher != ODP_CIPHER_ALG_NULL &&
+ param->ref->auth != ODP_AUTH_ALG_NULL &&
+ param->digest_offset >= op_params.cipher_range.offset &&
+ param->digest_offset < op_params.cipher_range.offset + op_params.cipher_range.length) {
+ /*
+ * Not all implementations support digest offset in cipher
+ * range, so allow crypto op failure without further checks
+ * in this case.
+ */
+ if (!ok)
+ goto out;
+ }
+
+ if (param->wrong_digest) {
+ CU_ASSERT(!ok);
+ } else {
+ CU_ASSERT(ok);
+ }
+
+ check_output_packet_data(pkt_out, &expected);
+out:
+ odp_packet_free(pkt_out);
+}
diff --git a/test/validation/api/crypto/crypto_op_test.h b/test/validation/api/crypto/crypto_op_test.h
new file mode 100644
index 000000000..4b2f66c47
--- /dev/null
+++ b/test/validation/api/crypto/crypto_op_test.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2021-2023, Nokia
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef CRYPTO_OP_TEST_H
+#define CRYPTO_OP_TEST_H
+
+#include <odp_api.h>
+#include <stdint.h>
+#include "test_vectors.h"
+
+typedef struct crypto_op_test_param_t {
+ odp_crypto_session_t session;
+ odp_crypto_op_t op;
+ odp_crypto_op_type_t op_type;
+ int32_t oop_shift;
+ crypto_test_reference_t *ref;
+ odp_packet_data_range_t cipher_range;
+ odp_packet_data_range_t auth_range;
+ uint32_t digest_offset;
+ odp_bool_t is_bit_mode_cipher;
+ odp_bool_t is_bit_mode_auth;
+ odp_bool_t adjust_segmentation;
+ odp_bool_t wrong_digest;
+ uint32_t first_seg_len;
+ uint32_t header_len;
+ uint32_t trailer_len;
+} crypto_op_test_param_t;
+
+void test_crypto_op(const crypto_op_test_param_t *param);
+
+int crypto_op(odp_packet_t pkt_in,
+ odp_packet_t *pkt_out,
+ odp_bool_t *ok,
+ const odp_crypto_packet_op_param_t *op_params,
+ odp_crypto_op_type_t op_type);
+
+#endif
diff --git a/test/validation/api/crypto/odp_crypto_test_inp.c b/test/validation/api/crypto/odp_crypto_test_inp.c
index c6a7767cc..d7e2bd16b 100644
--- a/test/validation/api/crypto/odp_crypto_test_inp.c
+++ b/test/validation/api/crypto/odp_crypto_test_inp.c
@@ -10,8 +10,10 @@
#include <odp_api.h>
#include <odp/helper/odph_api.h>
#include <odp_cunit_common.h>
-#include <packet_common.h>
#include "test_vectors.h"
+#include "test_vector_defs.h"
+#include "crypto_op_test.h"
+#include "util.h"
/*
* If nonzero, run time consuming tests too.
@@ -25,20 +27,6 @@ static int full_test;
#define PKT_POOL_LEN 1200 /* enough for a test packet and some headroom */
#define UAREA_SIZE 8
-#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
-
-struct suite_context_s {
- odp_bool_t packet;
- odp_crypto_op_mode_t op_mode;
- odp_crypto_op_mode_t pref_mode;
- odp_pool_t pool;
- odp_queue_t queue;
- odp_queue_type_t q_type;
- odp_event_t (*compl_queue_deq)(void);
-};
-
-static struct suite_context_s suite_context;
-
static void test_defaults(uint8_t fill)
{
odp_crypto_session_param_t param;
@@ -63,733 +51,14 @@ static void test_default_values(void)
test_defaults(0xff);
}
-static const char *auth_alg_name(odp_auth_alg_t auth)
-{
- switch (auth) {
- case ODP_AUTH_ALG_NULL:
- return "ODP_AUTH_ALG_NULL";
- case ODP_AUTH_ALG_MD5_HMAC:
- return "ODP_AUTH_ALG_MD5_HMAC";
- case ODP_AUTH_ALG_SHA1_HMAC:
- return "ODP_AUTH_ALG_SHA1_HMAC";
- case ODP_AUTH_ALG_SHA224_HMAC:
- return "ODP_AUTH_ALG_SHA224_HMAC";
- case ODP_AUTH_ALG_SHA256_HMAC:
- return "ODP_AUTH_ALG_SHA256_HMAC";
- case ODP_AUTH_ALG_SHA384_HMAC:
- return "ODP_AUTH_ALG_SHA384_HMAC";
- case ODP_AUTH_ALG_SHA512_HMAC:
- return "ODP_AUTH_ALG_SHA512_HMAC";
- case ODP_AUTH_ALG_AES_XCBC_MAC:
- return "ODP_AUTH_ALG_AES_XCBC_MAC";
- case ODP_AUTH_ALG_AES_GCM:
- return "ODP_AUTH_ALG_AES_GCM";
- case ODP_AUTH_ALG_AES_GMAC:
- return "ODP_AUTH_ALG_AES_GMAC";
- case ODP_AUTH_ALG_AES_CCM:
- return "ODP_AUTH_ALG_AES_CCM";
- case ODP_AUTH_ALG_AES_CMAC:
- return "ODP_AUTH_ALG_AES_CMAC";
- case ODP_AUTH_ALG_CHACHA20_POLY1305:
- return "ODP_AUTH_ALG_CHACHA20_POLY1305";
- case ODP_AUTH_ALG_KASUMI_F9:
- return "ODP_AUTH_ALG_KASUMI_F9";
- case ODP_AUTH_ALG_SNOW3G_UIA2:
- return "ODP_AUTH_ALG_SNOW3G_UIA2";
- case ODP_AUTH_ALG_AES_EIA2:
- return "ODP_AUTH_ALG_AES_EIA2";
- case ODP_AUTH_ALG_ZUC_EIA3:
- return "ODP_AUTH_ALG_ZUC_EIA3";
- case ODP_AUTH_ALG_MD5:
- return "ODP_AUTH_ALG_MD5";
- case ODP_AUTH_ALG_SHA1:
- return "ODP_AUTH_ALG_SHA1";
- case ODP_AUTH_ALG_SHA224:
- return "ODP_AUTH_ALG_SHA224";
- case ODP_AUTH_ALG_SHA256:
- return "ODP_AUTH_ALG_SHA256";
- case ODP_AUTH_ALG_SHA384:
- return "ODP_AUTH_ALG_SHA384";
- case ODP_AUTH_ALG_SHA512:
- return "ODP_AUTH_ALG_SHA512";
- default:
- return "Unknown";
- }
-}
-
-static const char *cipher_alg_name(odp_cipher_alg_t cipher)
-{
- switch (cipher) {
- case ODP_CIPHER_ALG_NULL:
- return "ODP_CIPHER_ALG_NULL";
- case ODP_CIPHER_ALG_DES:
- return "ODP_CIPHER_ALG_DES";
- case ODP_CIPHER_ALG_3DES_CBC:
- return "ODP_CIPHER_ALG_3DES_CBC";
- case ODP_CIPHER_ALG_3DES_ECB:
- return "ODP_CIPHER_ALG_3DES_ECB";
- case ODP_CIPHER_ALG_AES_CBC:
- return "ODP_CIPHER_ALG_AES_CBC";
- case ODP_CIPHER_ALG_AES_CTR:
- return "ODP_CIPHER_ALG_AES_CTR";
- case ODP_CIPHER_ALG_AES_ECB:
- return "ODP_CIPHER_ALG_AES_ECB";
- case ODP_CIPHER_ALG_AES_CFB128:
- return "ODP_CIPHER_ALG_AES_CFB128";
- case ODP_CIPHER_ALG_AES_XTS:
- return "ODP_CIPHER_ALG_AES_XTS";
- case ODP_CIPHER_ALG_AES_GCM:
- return "ODP_CIPHER_ALG_AES_GCM";
- case ODP_CIPHER_ALG_AES_CCM:
- return "ODP_CIPHER_ALG_AES_CCM";
- case ODP_CIPHER_ALG_CHACHA20_POLY1305:
- return "ODP_CIPHER_ALG_CHACHA20_POLY1305";
- case ODP_CIPHER_ALG_KASUMI_F8:
- return "ODP_CIPHER_ALG_KASUMI_F8";
- case ODP_CIPHER_ALG_SNOW3G_UEA2:
- return "ODP_CIPHER_ALG_SNOW3G_UEA2";
- case ODP_CIPHER_ALG_AES_EEA2:
- return "ODP_CIPHER_ALG_AES_EEA2";
- case ODP_CIPHER_ALG_ZUC_EEA3:
- return "ODP_CIPHER_ALG_ZUC_EEA3";
- default:
- return "Unknown";
- }
-}
-
-static int alg_packet_op(odp_packet_t pkt_in,
- odp_packet_t *pkt_out,
- odp_bool_t *ok,
- odp_crypto_session_t session,
- odp_crypto_op_type_t op_type,
- int32_t oop_shift,
- uint8_t *cipher_iv_ptr,
- uint8_t *auth_iv_ptr,
- const odp_packet_data_range_t *cipher_range,
- const odp_packet_data_range_t *auth_range,
- uint8_t *aad,
- unsigned int hash_result_offset)
-{
- int rc;
- odp_event_t event;
- odp_crypto_packet_result_t result;
- odp_crypto_packet_op_param_t op_params;
- odp_event_subtype_t subtype;
- odp_packet_t orig_pkt_out;
-
- if (op_type == ODP_CRYPTO_OP_TYPE_LEGACY)
- *pkt_out = pkt_in;
- else if (op_type == ODP_CRYPTO_OP_TYPE_BASIC)
- *pkt_out = ODP_PACKET_INVALID;
- orig_pkt_out = *pkt_out;
-
- /* Prepare input/output params */
- memset(&op_params, 0, sizeof(op_params));
- op_params.session = session;
-
- op_params.cipher_range = *cipher_range;
- op_params.auth_range = *auth_range;
- op_params.dst_offset_shift = oop_shift;
- if (cipher_iv_ptr)
- op_params.cipher_iv_ptr = cipher_iv_ptr;
- if (auth_iv_ptr)
- op_params.auth_iv_ptr = auth_iv_ptr;
-
- op_params.aad_ptr = aad;
-
- op_params.hash_result_offset = hash_result_offset;
-
- if (suite_context.op_mode == ODP_CRYPTO_SYNC) {
- rc = odp_crypto_op(&pkt_in, pkt_out, &op_params, 1);
- if (rc <= 0) {
- CU_FAIL("Failed odp_crypto_packet_op()");
- return rc;
- }
- } else {
- odp_packet_t *out_param = pkt_out;
-
- if (op_type == ODP_CRYPTO_OP_TYPE_BASIC)
- out_param = NULL;
-
- rc = odp_crypto_op_enq(&pkt_in, out_param, &op_params, 1);
- if (rc <= 0) {
- CU_FAIL("Failed odp_crypto_op_enq()");
- return rc;
- }
-
- /* Get crypto completion event from compl_queue. */
- CU_ASSERT_FATAL(NULL != suite_context.compl_queue_deq);
- do {
- event = suite_context.compl_queue_deq();
- } while (event == ODP_EVENT_INVALID);
-
- CU_ASSERT(ODP_EVENT_PACKET == odp_event_type(event));
- CU_ASSERT(ODP_EVENT_PACKET_CRYPTO == odp_event_subtype(event));
- CU_ASSERT(ODP_EVENT_PACKET == odp_event_types(event, &subtype));
- CU_ASSERT(ODP_EVENT_PACKET_CRYPTO == subtype);
-
- *pkt_out = odp_crypto_packet_from_event(event);
- }
-
- if (op_type != ODP_CRYPTO_OP_TYPE_BASIC)
- CU_ASSERT(*pkt_out == orig_pkt_out);
- CU_ASSERT(ODP_EVENT_PACKET ==
- odp_event_type(odp_packet_to_event(*pkt_out)));
- CU_ASSERT(ODP_EVENT_PACKET_CRYPTO ==
- odp_event_subtype(odp_packet_to_event(*pkt_out)));
- CU_ASSERT(ODP_EVENT_PACKET ==
- odp_event_types(odp_packet_to_event(*pkt_out), &subtype));
- CU_ASSERT(ODP_EVENT_PACKET_CRYPTO == subtype);
- CU_ASSERT(odp_packet_subtype(*pkt_out) == ODP_EVENT_PACKET_CRYPTO);
-
- rc = odp_crypto_result(&result, *pkt_out);
- if (rc < -1) {
- CU_FAIL("Failed odp_crypto_packet_result()");
- return rc;
- }
- CU_ASSERT(rc == 0 || rc == -1);
-
- if (op_type == ODP_CRYPTO_OP_TYPE_OOP &&
- suite_context.op_mode == ODP_CRYPTO_ASYNC)
- CU_ASSERT(result.pkt_in == pkt_in);
-
- *ok = (rc == 0);
-
-#if ODP_DEPRECATED_API
- CU_ASSERT(*ok == result.ok);
-#endif
-
- return 0;
-}
-
-static int crypto_op(odp_packet_t pkt_in,
- odp_packet_t *pkt_out,
- odp_bool_t *ok,
- odp_crypto_session_t session,
- odp_crypto_op_type_t op_type,
- int32_t oop_shift,
- uint8_t *cipher_iv,
- uint8_t *auth_iv,
- const odp_packet_data_range_t *cipher_range,
- const odp_packet_data_range_t *auth_range,
- uint8_t *aad,
- unsigned int hash_result_offset)
-{
- int rc;
-
- rc = alg_packet_op(pkt_in, pkt_out, ok, session,
- op_type, oop_shift,
- cipher_iv, auth_iv,
- cipher_range, auth_range,
- aad, hash_result_offset);
-
- if (rc < 0)
- odp_packet_free(pkt_in);
-
- return rc;
-}
-
-/*
- * Try to adjust packet so that the first segment holds 'first_seg_len' bytes
- * of packet data (+ tailroom if first_seg_len is longer than the packet).
- *
- * If 'first_seg_len' is zero, do not try to add segments but make headroom
- * zero.
- *
- * Packet data bytes are not preserved.
- */
-static void adjust_segments(odp_packet_t *pkt, uint32_t first_seg_len)
-{
- uint32_t shift;
-
- shift = odp_packet_headroom(*pkt) + first_seg_len;
-
- if (odp_packet_extend_head(pkt, shift, NULL, NULL) < 0) {
- CU_FAIL("odp_packet_extend_head() failed\n");
- return;
- }
- if (odp_packet_trunc_tail(pkt, shift, NULL, NULL) < 0) {
- CU_FAIL("odp_packet_trunc_tail() failed\n");
- return;
- }
- /*
- * ODP API does not seem to guarantee that we ever have a multi-segment
- * packet at this point, but we can print a message about it.
- */
- if (first_seg_len == 1 &&
- first_seg_len != odp_packet_seg_len(*pkt))
- printf("Could not create a segmented packet for testing.\n");
-}
-
-static void fill_with_pattern(uint8_t *buf, uint32_t len)
-{
- static uint8_t value;
-
- for (uint32_t n = 0; n < len; n++)
- buf[n] = value++;
-}
-
-static void write_header_and_trailer(odp_packet_t pkt,
- uint32_t header_len, uint32_t trailer_len)
-{
- uint32_t trailer_offset = odp_packet_len(pkt) - trailer_len;
- uint32_t max_len = header_len > trailer_len ? header_len : trailer_len;
- uint8_t buffer[max_len];
- int rc;
-
- fill_with_pattern(buffer, sizeof(buffer));
-
- rc = odp_packet_copy_from_mem(pkt, 0, header_len, buffer);
- CU_ASSERT(rc == 0);
- rc = odp_packet_copy_from_mem(pkt, trailer_offset, trailer_len, buffer);
- CU_ASSERT(rc == 0);
-}
-
-typedef struct alg_test_param_t {
- odp_crypto_session_t session;
- odp_crypto_op_t op;
- odp_crypto_op_type_t op_type;
- int32_t oop_shift;
- odp_cipher_alg_t cipher_alg;
- odp_auth_alg_t auth_alg;
- crypto_test_reference_t *ref;
- odp_packet_data_range_t cipher_range;
- odp_packet_data_range_t auth_range;
- uint32_t digest_offset;
- odp_bool_t is_bit_mode_cipher;
- odp_bool_t is_bit_mode_auth;
- odp_bool_t adjust_segmentation;
- odp_bool_t wrong_digest;
- uint32_t first_seg_len;
- uint32_t header_len;
- uint32_t trailer_len;
-} alg_test_param_t;
-
-static void prepare_crypto_ranges(const alg_test_param_t *param,
- odp_packet_data_range_t *cipher_range,
- odp_packet_data_range_t *auth_range)
-{
- odp_packet_data_range_t zero_range = {.offset = 0, .length = 0};
- uint32_t c_scale = param->is_bit_mode_cipher ? 8 : 1;
- uint32_t a_scale = param->is_bit_mode_auth ? 8 : 1;
-
- *cipher_range = param->cipher_range;
- *auth_range = param->auth_range;
- cipher_range->offset += c_scale * param->header_len;
- auth_range->offset += a_scale * param->header_len;
-
- if (param->cipher_alg == ODP_CIPHER_ALG_NULL)
- *cipher_range = zero_range;
- if (param->auth_alg == ODP_AUTH_ALG_NULL)
- *auth_range = zero_range;
-}
-
-static int prepare_input_packet(const alg_test_param_t *param,
- odp_packet_t *pkt_in)
-{
- crypto_test_reference_t *ref = param->ref;
- uint32_t reflength = ref_length_in_bytes(ref);
- odp_packet_t pkt;
- uint32_t digest_offset = param->digest_offset;
- uint32_t pkt_len;
-
- pkt_len = param->header_len + reflength + param->trailer_len;
- if (param->digest_offset == param->header_len + reflength)
- pkt_len += ref->digest_length;
-
- pkt = odp_packet_alloc(suite_context.pool, pkt_len);
-
- CU_ASSERT(pkt != ODP_PACKET_INVALID);
- if (pkt == ODP_PACKET_INVALID)
- return -1;
-
- if (param->adjust_segmentation)
- adjust_segments(&pkt, param->first_seg_len);
-
- write_header_and_trailer(pkt, param->header_len, param->trailer_len);
-
- if (param->op == ODP_CRYPTO_OP_ENCODE) {
- odp_packet_copy_from_mem(pkt, param->header_len,
- reflength, ref->plaintext);
- } else {
- odp_packet_copy_from_mem(pkt, param->header_len,
- reflength, ref->ciphertext);
- odp_packet_copy_from_mem(pkt, digest_offset,
- ref->digest_length,
- ref->digest);
- if (param->wrong_digest) {
- uint8_t byte = ~ref->digest[0];
-
- odp_packet_copy_from_mem(pkt, digest_offset, 1, &byte);
- }
- }
- *pkt_in = pkt;
- return 0;
-}
-
-static void prepare_oop_output_packet(const alg_test_param_t *param,
- odp_packet_t *pkt_out,
- uint32_t pkt_len)
+static void print_alg_test_param(const crypto_op_test_param_t *p)
{
- uint32_t reflength = ref_length_in_bytes(param->ref);
- const uint32_t oop_extra_len = 5;
- uint32_t trl_len;
- uint32_t hdr_len;
- uint32_t oop_len;
-
- oop_len = pkt_len + param->oop_shift + oop_extra_len;
- *pkt_out = odp_packet_alloc(suite_context.pool, oop_len);
- CU_ASSERT_FATAL(*pkt_out != ODP_PACKET_INVALID);
-
- uint8_t buf[oop_len];
-
- memset(buf, 0x55, sizeof(buf));
- odp_packet_copy_from_mem(*pkt_out, 0, sizeof(buf), buf);
-
- hdr_len = param->header_len + param->oop_shift;
- trl_len = oop_len - hdr_len - reflength;
-
- write_header_and_trailer(*pkt_out, hdr_len, trl_len);
-
- /* have different metadata than in the input packet */
- memset(odp_packet_user_area(*pkt_out), 0xab,
- odp_packet_user_area_size(*pkt_out));
-}
-
-static int is_packet_data_equal(odp_packet_t pkt_1, odp_packet_t pkt_2)
-{
- uint32_t len = odp_packet_len(pkt_1);
- uint8_t buf_1[len];
- uint8_t buf_2[len];
-
- if (len != odp_packet_len(pkt_2) ||
- odp_packet_copy_to_mem(pkt_1, 0, len, buf_1) ||
- odp_packet_copy_to_mem(pkt_2, 0, len, buf_2))
- return 0;
-
- return !memcmp(buf_1, buf_2, len);
-}
-
-static int is_in_range(uint32_t offs, uint32_t range_offs, uint32_t range_len)
-{
- return offs >= range_offs && offs < range_offs + range_len;
-}
-
-#define MAX_IGNORED_RANGES 3
-
-/*
- * Output packet parts that we ignore since they have undefined values
- */
-typedef struct ignore_t {
- uint32_t byte_offset; /* offset to a byte which has bits to be ignored */
- uint8_t byte_mask; /* mask of ignored bits in the byte */
- struct {
- uint32_t offset;
- uint32_t length;
- } ranges[MAX_IGNORED_RANGES]; /* byte ranges to be ignored */
- uint32_t num_ranges;
-} ignore_t;
-
-static void add_ignored_range(ignore_t *ign, uint32_t offs, uint32_t len)
-{
- if (len == 0)
- return;
- CU_ASSERT_FATAL(ign->num_ranges < MAX_IGNORED_RANGES);
- ign->ranges[ign->num_ranges].offset = offs;
- ign->ranges[ign->num_ranges].length = len;
- ign->num_ranges++;
-}
-
-static void clear_ignored_data(const ignore_t *ign, uint8_t *data, uint32_t data_len)
-{
- CU_ASSERT_FATAL(ign->byte_offset < data_len);
- data[ign->byte_offset] &= ~ign->byte_mask;
-
- for (uint32_t n = 0; n < ign->num_ranges; n++) {
- uint32_t offset = ign->ranges[n].offset;
- uint32_t length = ign->ranges[n].length;
-
- CU_ASSERT(offset + length <= data_len);
- memset(data + offset, 0, length);
- }
-}
-
-static void prepare_ignore_info(const alg_test_param_t *param,
- uint32_t shift,
- uint32_t cipher_offset,
- uint32_t cipher_len,
- uint32_t auth_offset,
- uint32_t auth_len,
- ignore_t *ignore)
-{
- memset(ignore, 0, sizeof(*ignore));
-
- /*
- * Leftover bits in the last byte of the cipher range of bit mode
- * ciphers have undefined values.
- */
- if (param->is_bit_mode_cipher &&
- param->cipher_alg != ODP_CIPHER_ALG_NULL) {
- uint8_t leftover_bits = ref_length_in_bits(param->ref) % 8;
-
- ignore->byte_offset = cipher_offset + cipher_len - 1 + shift;
- if (leftover_bits > 0)
- ignore->byte_mask = ~(0xff << (8 - leftover_bits));
- else
- ignore->byte_mask = 0;
- }
-
- /*
- * In decode sessions the bytes in the hash location have
- * undefined values.
- */
- if (param->auth_alg != ODP_AUTH_ALG_NULL &&
- param->op == ODP_CRYPTO_OP_DECODE) {
- uint32_t offs = param->digest_offset;
-
- if (param->op_type != ODP_CRYPTO_OP_TYPE_OOP ||
- is_in_range(offs, cipher_offset, cipher_len) ||
- is_in_range(offs, auth_offset, auth_len)) {
- add_ignored_range(ignore,
- param->digest_offset + shift,
- param->ref->digest_length);
- }
- }
-
- /* Decrypted bytes are undefined if authentication fails. */
- if (param->op == ODP_CRYPTO_OP_DECODE &&
- param->wrong_digest) {
- add_ignored_range(ignore, cipher_offset + shift, cipher_len);
- /* In OOP case, auth range may not get copied */
- if (param->op_type == ODP_CRYPTO_OP_TYPE_OOP)
- add_ignored_range(ignore, auth_offset + shift, auth_len);
- }
-}
-
-/* Add room for bytes that are not included in ref->length */
-#define MAX_EXP_DATA_LEN (MAX_DATA_LEN + 200)
-
-/*
- * Expected packet data
- */
-typedef struct expected_t {
- uint8_t data[MAX_EXP_DATA_LEN];
- uint32_t len;
- ignore_t ignore;
-} expected_t;
-
-static void prepare_expected_data(const alg_test_param_t *param,
- const odp_packet_data_range_t *cipher_range,
- const odp_packet_data_range_t *auth_range,
- odp_packet_t pkt_in,
- odp_packet_t pkt_out,
- expected_t *ex)
-{
- uint32_t digest_offset = param->digest_offset;
- uint32_t cipher_offset = cipher_range->offset;
- uint32_t cipher_len = cipher_range->length;
- uint32_t auth_offset = auth_range->offset;
- uint32_t auth_len = auth_range->length;
- const int32_t shift = param->op_type == ODP_CRYPTO_OP_TYPE_OOP ? param->oop_shift : 0;
- const odp_packet_t base_pkt = param->op_type == ODP_CRYPTO_OP_TYPE_OOP ? pkt_out : pkt_in;
- int rc;
- uint32_t cipher_offset_in_ref = param->cipher_range.offset;
-
- if (param->op == ODP_CRYPTO_OP_ENCODE)
- digest_offset += shift;
-
- if (param->is_bit_mode_cipher) {
- cipher_offset_in_ref /= 8;
- cipher_offset /= 8;
- cipher_len = (cipher_len + 7) / 8;
- }
- if (param->is_bit_mode_auth) {
- auth_offset /= 8;
- auth_len = (auth_len + 7) / 8;
- }
- if (param->cipher_alg == ODP_CIPHER_ALG_NULL)
- cipher_len = 0;
- if (param->auth_alg == ODP_AUTH_ALG_NULL ||
- param->auth_alg == ODP_AUTH_ALG_AES_GCM ||
- param->auth_alg == ODP_AUTH_ALG_AES_CCM ||
- param->auth_alg == ODP_AUTH_ALG_CHACHA20_POLY1305) {
- /* auth range is ignored with null and AEAD algorithms */
- auth_len = 0;
- }
-
- /* copy all data from base packet */
- ex->len = odp_packet_len(base_pkt);
- CU_ASSERT_FATAL(ex->len <= sizeof(ex->data));
- rc = odp_packet_copy_to_mem(base_pkt, 0, ex->len, ex->data);
- CU_ASSERT(rc == 0);
-
- if (param->op_type == ODP_CRYPTO_OP_TYPE_OOP && auth_len > 0) {
- /* copy auth range from input packet */
- rc = odp_packet_copy_to_mem(pkt_in, auth_offset, auth_len,
- ex->data + auth_offset + shift);
- CU_ASSERT(rc == 0);
- }
-
- if (param->op == ODP_CRYPTO_OP_ENCODE) {
- /* copy hash first */
- memcpy(ex->data + digest_offset,
- param->ref->digest,
- param->ref->digest_length);
- /*
- * Copy ciphertext, possibly overwriting hash.
- * The other order (hash overwriting some cipher
- * text) does not work in any real use case anyway.
- */
- memcpy(ex->data + cipher_offset + shift,
- param->ref->ciphertext + cipher_offset_in_ref,
- cipher_len);
- } else {
- memcpy(ex->data + cipher_offset + shift,
- param->ref->plaintext + cipher_offset_in_ref,
- cipher_len);
- }
-
- prepare_ignore_info(param, shift,
- cipher_offset, cipher_len,
- auth_offset, auth_len,
- &ex->ignore);
-}
-
-static void print_data(const char *title, uint8_t *data, uint32_t len)
-{
- static uint64_t limit;
-
- if (limit++ > MAX_FAILURE_PRINTS)
- return;
-
- printf("%s\n", title);
- for (uint32_t n = 0; n < len ; n++) {
- printf(" %02x", data[n]);
- if ((n + 1) % 16 == 0)
- printf("\n");
- }
- printf("\n");
-}
-
-static void check_output_packet_data(odp_packet_t pkt, expected_t *ex)
-{
- int rc;
- uint8_t pkt_data[ex->len];
-
- CU_ASSERT(odp_packet_len(pkt) == ex->len);
- rc = odp_packet_copy_to_mem(pkt, 0, ex->len, pkt_data);
- CU_ASSERT(rc == 0);
-
- clear_ignored_data(&ex->ignore, pkt_data, sizeof(pkt_data));
- clear_ignored_data(&ex->ignore, ex->data, sizeof(ex->data));
-
- if (memcmp(pkt_data, ex->data, ex->len)) {
- CU_FAIL("packet data does not match expected data");
- print_data("packet:", pkt_data, ex->len);
- print_data("expected:", ex->data, ex->len);
- }
-}
-
-static void alg_test_execute(const alg_test_param_t *param)
-{
- odp_bool_t ok = false;
- odp_packet_data_range_t cipher_range;
- odp_packet_data_range_t auth_range;
- odp_packet_t pkt;
- odp_packet_t pkt_copy = ODP_PACKET_INVALID;
- odp_packet_t pkt_out = ODP_PACKET_INVALID;
- uint32_t digest_offset = param->digest_offset;
- test_packet_md_t md_in, md_out, md_out_orig;
- expected_t expected;
-
- /*
- * Test detection of wrong digest value in input packet
- * only when decoding and using non-null auth algorithm.
- */
- if (param->wrong_digest &&
- (param->auth_alg == ODP_AUTH_ALG_NULL ||
- param->op == ODP_CRYPTO_OP_ENCODE))
- return;
-
- prepare_crypto_ranges(param, &cipher_range, &auth_range);
- if (prepare_input_packet(param, &pkt))
- return;
-
- if (param->op_type == ODP_CRYPTO_OP_TYPE_OOP) {
- prepare_oop_output_packet(param, &pkt_out, odp_packet_len(pkt));
-
- pkt_copy = odp_packet_copy(pkt, suite_context.pool);
- CU_ASSERT_FATAL(pkt_copy != ODP_PACKET_INVALID);
- test_packet_get_md(pkt_out, &md_out_orig);
- }
-
- prepare_expected_data(param, &cipher_range, &auth_range,
- pkt, pkt_out, &expected);
-
- if (param->op_type == ODP_CRYPTO_OP_TYPE_OOP &&
- param->op == ODP_CRYPTO_OP_ENCODE) {
- /*
- * In this type of sessions digest offset is an offset to the output
- * packet, so apply the shift.
- */
- digest_offset += param->oop_shift;
- }
-
- test_packet_set_md(pkt);
- test_packet_get_md(pkt, &md_in);
-
- if (crypto_op(pkt, &pkt_out, &ok, param->session,
- param->op_type, param->oop_shift,
- param->ref->cipher_iv,
- param->ref->auth_iv,
- &cipher_range, &auth_range,
- param->ref->aad, digest_offset))
- return;
-
- test_packet_get_md(pkt_out, &md_out);
+ const char *cipher_mode = p->is_bit_mode_cipher ? "bit" : "byte";
- if (param->op_type == ODP_CRYPTO_OP_TYPE_OOP) {
- test_packet_md_t md;
- /* check that input packet has not changed */
- CU_ASSERT(is_packet_data_equal(pkt, pkt_copy));
- odp_packet_free(pkt_copy);
- test_packet_get_md(pkt, &md);
- CU_ASSERT(test_packet_is_md_equal(&md, &md_in));
- odp_packet_free(pkt);
- /* check that metadata of output packet has not changed */
- CU_ASSERT(test_packet_is_md_equal(&md_out, &md_out_orig));
- } else {
- CU_ASSERT(test_packet_is_md_equal(&md_out, &md_in));
- }
- if (param->cipher_alg != ODP_CIPHER_ALG_NULL &&
- param->auth_alg != ODP_AUTH_ALG_NULL &&
- param->digest_offset >= cipher_range.offset &&
- param->digest_offset < cipher_range.offset + cipher_range.length) {
- /*
- * Not all implementations support digest offset in cipher
- * range, so allow crypto op failure without further checks
- * in this case.
- */
- if (!ok)
- goto out;
- }
- if (param->wrong_digest) {
- CU_ASSERT(!ok);
- } else {
- CU_ASSERT(ok);
- }
- check_output_packet_data(pkt_out, &expected);
-out:
- odp_packet_free(pkt_out);
-}
-
-static void print_alg_test_param(const alg_test_param_t *p)
-{
- const char *cipher_mode = p->is_bit_mode_cipher ? "bit" : "byte";
const char *auth_mode = p->is_bit_mode_auth ? "bit" : "byte";
switch (p->op_type) {
@@ -805,13 +74,13 @@ static void print_alg_test_param(const alg_test_param_t *p)
}
printf("%s\n", p->op == ODP_CRYPTO_OP_ENCODE ? "encode" : "decode");
- printf("cipher: %s, %s mode\n", cipher_alg_name(p->cipher_alg), cipher_mode);
+ printf("cipher: %s, %s mode\n", cipher_alg_name(p->ref->cipher), cipher_mode);
printf(" key length: %d, iv length: %d\n",
p->ref->cipher_key_length, p->ref->cipher_iv_length);
printf(" range: offset %d, length %d\n",
p->cipher_range.offset, p->cipher_range.length);
- printf("auth: %s, %s mode\n", auth_alg_name(p->auth_alg), auth_mode);
+ printf("auth: %s, %s mode\n", auth_alg_name(p->ref->auth), auth_mode);
printf(" key length: %d, iv length: %d\n",
p->ref->auth_key_length, p->ref->auth_iv_length);
printf(" range: offset %d, length %d; aad length: %d\n",
@@ -828,12 +97,12 @@ static void print_alg_test_param(const alg_test_param_t *p)
printf("oop_shift: %d\n", p->oop_shift);
}
-static void alg_test_execute_and_print(alg_test_param_t *param)
+static void alg_test_execute_and_print(crypto_op_test_param_t *param)
{
static int print_limit = MAX_FAILURE_PRINTS;
unsigned int num = CU_get_number_of_failures();
- alg_test_execute(param);
+ test_crypto_op(param);
if (CU_get_number_of_failures() > num) {
if (print_limit > 0) {
@@ -847,7 +116,7 @@ static void alg_test_execute_and_print(alg_test_param_t *param)
}
}
-static void alg_test_op(alg_test_param_t *param)
+static void alg_test_op(crypto_op_test_param_t *param)
{
int32_t oop_shifts[] = {0, 3, 130, -10};
@@ -883,8 +152,6 @@ typedef enum {
static odp_crypto_session_t session_create(odp_crypto_op_t op,
odp_crypto_op_type_t op_type,
- odp_cipher_alg_t cipher_alg,
- odp_auth_alg_t auth_alg,
alg_order_t order,
crypto_test_reference_t *ref,
hash_test_mode_t hash_mode)
@@ -913,8 +180,8 @@ static odp_crypto_session_t session_create(odp_crypto_op_t op,
ses_params.op_type = op_type;
ses_params.auth_cipher_text = (order == AUTH_CIPHERTEXT);
ses_params.op_mode = suite_context.op_mode;
- ses_params.cipher_alg = cipher_alg;
- ses_params.auth_alg = auth_alg;
+ ses_params.cipher_alg = ref->cipher;
+ ses_params.auth_alg = ref->auth;
ses_params.compl_queue = suite_context.queue;
ses_params.output_pool = suite_context.pool;
ses_params.cipher_key = cipher_key;
@@ -930,8 +197,8 @@ static odp_crypto_session_t session_create(odp_crypto_op_t op,
if (!combo_warning_shown) {
combo_warning_shown = 1;
printf("\n Unsupported algorithm combination: %s, %s\n",
- cipher_alg_name(cipher_alg),
- auth_alg_name(auth_alg));
+ cipher_alg_name(ref->cipher),
+ auth_alg_name(ref->auth));
}
return ODP_CRYPTO_SESSION_INVALID;
}
@@ -944,8 +211,8 @@ static odp_crypto_session_t session_create(odp_crypto_op_t op,
if (rc < 0 && status == ODP_CRYPTO_SES_ERR_ALG_ORDER &&
ses_params.op_mode == ODP_CRYPTO_ASYNC) {
printf("\n Unsupported algorithm order: %s, %s, auth_cipher_text: %d\n",
- cipher_alg_name(cipher_alg),
- auth_alg_name(auth_alg),
+ cipher_alg_name(ref->cipher),
+ auth_alg_name(ref->auth),
ses_params.auth_cipher_text);
return ODP_CRYPTO_SESSION_INVALID;
}
@@ -977,8 +244,6 @@ static odp_crypto_session_t session_create(odp_crypto_op_t op,
static void alg_test_ses(odp_crypto_op_t op,
odp_crypto_op_type_t op_type,
- odp_cipher_alg_t cipher_alg,
- odp_auth_alg_t auth_alg,
alg_order_t order,
crypto_test_reference_t *ref,
odp_packet_data_range_t cipher_range,
@@ -994,13 +259,13 @@ static void alg_test_ses(odp_crypto_op_t op,
int rc;
uint32_t seg_len;
uint32_t max_shift;
- alg_test_param_t test_param;
+ crypto_op_test_param_t test_param;
if (digest_offset >= auth_range.offset &&
digest_offset < auth_range.offset + auth_range.length)
hash_mode = HASH_OVERLAP;
- session = session_create(op, op_type, cipher_alg, auth_alg, order, ref, hash_mode);
+ session = session_create(op, op_type, order, ref, hash_mode);
if (session == ODP_CRYPTO_SESSION_INVALID)
return;
@@ -1008,8 +273,6 @@ static void alg_test_ses(odp_crypto_op_t op,
test_param.session = session;
test_param.op = op;
test_param.op_type = op_type;
- test_param.cipher_alg = cipher_alg;
- test_param.auth_alg = auth_alg;
test_param.ref = ref;
test_param.cipher_range = cipher_range;
test_param.auth_range = auth_range;
@@ -1023,8 +286,8 @@ static void alg_test_ses(odp_crypto_op_t op,
seg_len = 0;
if (!full_test &&
- cipher_alg != ODP_CIPHER_ALG_NULL &&
- auth_alg != ODP_AUTH_ALG_NULL) {
+ ref->cipher != ODP_CIPHER_ALG_NULL &&
+ ref->auth != ODP_AUTH_ALG_NULL) {
/* run the loop body just once */
seg_len = max_shift / 2;
max_shift = seg_len;
@@ -1061,8 +324,6 @@ static void alg_test_ses(odp_crypto_op_t op,
}
static void alg_test(odp_crypto_op_t op,
- odp_cipher_alg_t cipher_alg,
- odp_auth_alg_t auth_alg,
alg_order_t order,
crypto_test_reference_t *ref,
odp_packet_data_range_t cipher_range,
@@ -1078,13 +339,8 @@ static void alg_test(odp_crypto_op_t op,
};
for (unsigned int n = 0; n < ARRAY_SIZE(op_types); n++) {
- if (!suite_context.packet &&
- op_types[n] != ODP_CRYPTO_OP_TYPE_LEGACY)
- continue;
alg_test_ses(op,
op_types[n],
- cipher_alg,
- auth_alg,
order,
ref,
cipher_range,
@@ -1109,12 +365,12 @@ static odp_bool_t aad_len_ok(const odp_crypto_auth_capability_t *capa, uint32_t
}
static void check_alg(odp_crypto_op_t op,
- odp_cipher_alg_t cipher_alg,
- odp_auth_alg_t auth_alg,
crypto_test_reference_t *ref,
size_t count)
{
int rc, i;
+ const odp_cipher_alg_t cipher_alg = ref->cipher;
+ const odp_auth_alg_t auth_alg = ref->auth;
int cipher_num = odp_crypto_cipher_capability(cipher_alg, NULL, 0);
int auth_num = odp_crypto_auth_capability(auth_alg, NULL, 0);
odp_bool_t cipher_ok = false;
@@ -1216,10 +472,10 @@ static void check_alg(odp_crypto_op_t op,
ref_length_in_bits(&ref[idx]) :
ref_length_in_bytes(&ref[idx]);
- alg_test(op, cipher_alg, auth_alg, AUTH_PLAINTEXT, &ref[idx],
+ alg_test(op, AUTH_PLAINTEXT, &ref[idx],
cipher_range, auth_range, digest_offs,
is_bit_mode_cipher, is_bit_mode_auth);
- alg_test(op, cipher_alg, auth_alg, AUTH_CIPHERTEXT, &ref[idx],
+ alg_test(op, AUTH_CIPHERTEXT, &ref[idx],
cipher_range, auth_range, digest_offs,
is_bit_mode_cipher, is_bit_mode_auth);
@@ -1254,214 +510,6 @@ static void check_alg(odp_crypto_op_t op,
CU_ASSERT(auth_ok);
}
-/**
- * Check if given cipher and authentication algorithms are supported
- *
- * @param cipher Cipher algorithm
- * @param auth Authentication algorithm
- *
- * @retval ODP_TEST_ACTIVE when both algorithms are supported
- * @retval ODP_TEST_INACTIVE when either algorithm is not supported
- */
-static int check_alg_support(odp_cipher_alg_t cipher, odp_auth_alg_t auth)
-{
- odp_crypto_capability_t capability;
-
- memset(&capability, 0, sizeof(odp_crypto_capability_t));
- if (odp_crypto_capability(&capability)) {
- fprintf(stderr, "odp_crypto_capability() failed\n");
- return ODP_TEST_INACTIVE;
- }
-
- if (suite_context.queue != ODP_QUEUE_INVALID) {
- if (suite_context.q_type == ODP_QUEUE_TYPE_PLAIN &&
- capability.queue_type_plain == 0)
- return ODP_TEST_INACTIVE;
- if (suite_context.q_type == ODP_QUEUE_TYPE_SCHED &&
- capability.queue_type_sched == 0)
- return ODP_TEST_INACTIVE;
- }
-
- if (suite_context.op_mode == ODP_CRYPTO_SYNC &&
- capability.sync_mode == ODP_SUPPORT_NO)
- return ODP_TEST_INACTIVE;
- if (suite_context.op_mode == ODP_CRYPTO_ASYNC &&
- capability.async_mode == ODP_SUPPORT_NO)
- return ODP_TEST_INACTIVE;
-
- /* Cipher algorithms */
- switch (cipher) {
- case ODP_CIPHER_ALG_NULL:
- if (!capability.ciphers.bit.null)
- return ODP_TEST_INACTIVE;
- break;
- case ODP_CIPHER_ALG_DES:
- if (!capability.ciphers.bit.des)
- return ODP_TEST_INACTIVE;
- break;
- case ODP_CIPHER_ALG_3DES_CBC:
- if (!capability.ciphers.bit.trides_cbc)
- return ODP_TEST_INACTIVE;
- break;
- case ODP_CIPHER_ALG_3DES_ECB:
- if (!capability.ciphers.bit.trides_ecb)
- return ODP_TEST_INACTIVE;
- break;
- case ODP_CIPHER_ALG_AES_CBC:
- if (!capability.ciphers.bit.aes_cbc)
- return ODP_TEST_INACTIVE;
- break;
- case ODP_CIPHER_ALG_AES_CTR:
- if (!capability.ciphers.bit.aes_ctr)
- return ODP_TEST_INACTIVE;
- break;
- case ODP_CIPHER_ALG_AES_ECB:
- if (!capability.ciphers.bit.aes_ecb)
- return ODP_TEST_INACTIVE;
- break;
- case ODP_CIPHER_ALG_AES_CFB128:
- if (!capability.ciphers.bit.aes_cfb128)
- return ODP_TEST_INACTIVE;
- break;
- case ODP_CIPHER_ALG_AES_XTS:
- if (!capability.ciphers.bit.aes_xts)
- return ODP_TEST_INACTIVE;
- break;
- case ODP_CIPHER_ALG_AES_GCM:
- if (!capability.ciphers.bit.aes_gcm)
- return ODP_TEST_INACTIVE;
- break;
- case ODP_CIPHER_ALG_AES_CCM:
- if (!capability.ciphers.bit.aes_ccm)
- return ODP_TEST_INACTIVE;
- break;
- case ODP_CIPHER_ALG_CHACHA20_POLY1305:
- if (!capability.ciphers.bit.chacha20_poly1305)
- return ODP_TEST_INACTIVE;
- break;
- case ODP_CIPHER_ALG_KASUMI_F8:
- if (!capability.ciphers.bit.kasumi_f8)
- return ODP_TEST_INACTIVE;
- break;
- case ODP_CIPHER_ALG_SNOW3G_UEA2:
- if (!capability.ciphers.bit.snow3g_uea2)
- return ODP_TEST_INACTIVE;
- break;
- case ODP_CIPHER_ALG_AES_EEA2:
- if (!capability.ciphers.bit.aes_eea2)
- return ODP_TEST_INACTIVE;
- break;
- case ODP_CIPHER_ALG_ZUC_EEA3:
- if (!capability.ciphers.bit.zuc_eea3)
- return ODP_TEST_INACTIVE;
- break;
- default:
- fprintf(stderr, "Unsupported cipher algorithm\n");
- return ODP_TEST_INACTIVE;
- }
-
- /* Authentication algorithms */
- switch (auth) {
- case ODP_AUTH_ALG_NULL:
- if (!capability.auths.bit.null)
- return ODP_TEST_INACTIVE;
- break;
- case ODP_AUTH_ALG_MD5_HMAC:
- if (!capability.auths.bit.md5_hmac)
- return ODP_TEST_INACTIVE;
- break;
- case ODP_AUTH_ALG_SHA1_HMAC:
- if (!capability.auths.bit.sha1_hmac)
- return ODP_TEST_INACTIVE;
- break;
- case ODP_AUTH_ALG_SHA224_HMAC:
- if (!capability.auths.bit.sha224_hmac)
- return ODP_TEST_INACTIVE;
- break;
- case ODP_AUTH_ALG_SHA256_HMAC:
- if (!capability.auths.bit.sha256_hmac)
- return ODP_TEST_INACTIVE;
- break;
- case ODP_AUTH_ALG_SHA384_HMAC:
- if (!capability.auths.bit.sha384_hmac)
- return ODP_TEST_INACTIVE;
- break;
- case ODP_AUTH_ALG_SHA512_HMAC:
- if (!capability.auths.bit.sha512_hmac)
- return ODP_TEST_INACTIVE;
- break;
- case ODP_AUTH_ALG_AES_XCBC_MAC:
- if (!capability.auths.bit.aes_xcbc_mac)
- return ODP_TEST_INACTIVE;
- break;
- case ODP_AUTH_ALG_AES_GCM:
- if (!capability.auths.bit.aes_gcm)
- return ODP_TEST_INACTIVE;
- break;
- case ODP_AUTH_ALG_AES_GMAC:
- if (!capability.auths.bit.aes_gmac)
- return ODP_TEST_INACTIVE;
- break;
- case ODP_AUTH_ALG_AES_CCM:
- if (!capability.auths.bit.aes_ccm)
- return ODP_TEST_INACTIVE;
- break;
- case ODP_AUTH_ALG_AES_CMAC:
- if (!capability.auths.bit.aes_cmac)
- return ODP_TEST_INACTIVE;
- break;
- case ODP_AUTH_ALG_CHACHA20_POLY1305:
- if (!capability.auths.bit.chacha20_poly1305)
- return ODP_TEST_INACTIVE;
- break;
- case ODP_AUTH_ALG_KASUMI_F9:
- if (!capability.auths.bit.kasumi_f9)
- return ODP_TEST_INACTIVE;
- break;
- case ODP_AUTH_ALG_SNOW3G_UIA2:
- if (!capability.auths.bit.snow3g_uia2)
- return ODP_TEST_INACTIVE;
- break;
- case ODP_AUTH_ALG_AES_EIA2:
- if (!capability.auths.bit.aes_eia2)
- return ODP_TEST_INACTIVE;
- break;
- case ODP_AUTH_ALG_ZUC_EIA3:
- if (!capability.auths.bit.zuc_eia3)
- return ODP_TEST_INACTIVE;
- break;
- case ODP_AUTH_ALG_MD5:
- if (!capability.auths.bit.md5)
- return ODP_TEST_INACTIVE;
- break;
- case ODP_AUTH_ALG_SHA1:
- if (!capability.auths.bit.sha1)
- return ODP_TEST_INACTIVE;
- break;
- case ODP_AUTH_ALG_SHA224:
- if (!capability.auths.bit.sha224)
- return ODP_TEST_INACTIVE;
- break;
- case ODP_AUTH_ALG_SHA256:
- if (!capability.auths.bit.sha256)
- return ODP_TEST_INACTIVE;
- break;
- case ODP_AUTH_ALG_SHA384:
- if (!capability.auths.bit.sha384)
- return ODP_TEST_INACTIVE;
- break;
- case ODP_AUTH_ALG_SHA512:
- if (!capability.auths.bit.sha512)
- return ODP_TEST_INACTIVE;
- break;
- default:
- fprintf(stderr, "Unsupported authentication algorithm\n");
- return ODP_TEST_INACTIVE;
- }
-
- return ODP_TEST_ACTIVE;
-}
-
static void test_capability(void)
{
odp_crypto_capability_t capa = {.max_sessions = 1};
@@ -1495,15 +543,14 @@ static int create_hash_test_reference(odp_auth_alg_t auth,
odp_bool_t ok;
const uint32_t auth_bytes = 100;
uint32_t enc_digest_offset = auth_bytes;
- odp_packet_data_range_t cipher_range = {.offset = 0, .length = 0};
- odp_packet_data_range_t auth_range = {.offset = 0};
+ ref->cipher = ODP_CIPHER_ALG_NULL;
+ ref->auth = auth;
ref->auth_key_length = capa->key_len;
ref->auth_iv_length = capa->iv_len;
ref->digest_length = capa->digest_len;
ref->is_length_in_bits = false;
ref->length = auth_bytes;
- auth_range.length = capa->bit_mode ? auth_bytes * 8 : auth_bytes;
if (ref->auth_key_length > MAX_KEY_LEN ||
ref->auth_iv_length > MAX_IV_LEN ||
@@ -1525,15 +572,28 @@ static int create_hash_test_reference(odp_auth_alg_t auth,
session = session_create(ODP_CRYPTO_OP_ENCODE,
ODP_CRYPTO_OP_TYPE_LEGACY,
- ODP_CIPHER_ALG_NULL,
- auth, AUTH_PLAINTEXT, ref, HASH_NO_OVERLAP);
+ AUTH_PLAINTEXT, ref, HASH_NO_OVERLAP);
if (session == ODP_CRYPTO_SESSION_INVALID)
return -1;
- rc = crypto_op(pkt, &pkt, &ok, session, ODP_CRYPTO_OP_TYPE_LEGACY, 0,
- ref->cipher_iv, ref->auth_iv,
- &cipher_range, &auth_range, ref->aad, enc_digest_offset);
+ odp_crypto_packet_op_param_t op_params = {
+ .session = session,
+ .cipher_iv_ptr = ref->cipher_iv,
+ .auth_iv_ptr = ref->auth_iv,
+ .hash_result_offset = enc_digest_offset,
+ .aad_ptr = ref->aad,
+ .cipher_range = {.offset = 0, .length = 0},
+ .auth_range = { .offset = 0,
+ .length = capa->bit_mode ? auth_bytes * 8 : auth_bytes },
+ .dst_offset_shift = 0,
+ };
+ rc = crypto_op(pkt, &pkt, &ok, &op_params, ODP_CRYPTO_OP_TYPE_LEGACY);
+
CU_ASSERT(rc == 0);
+ if (rc) {
+ (void)odp_crypto_session_destroy(session);
+ return -1;
+ }
CU_ASSERT(ok);
rc = odp_crypto_session_destroy(session);
@@ -1590,8 +650,6 @@ static void test_auth_hash_in_auth_range(odp_auth_alg_t auth,
* hash bytes in the ciphertext packet before calculating the hash.
*/
alg_test(ODP_CRYPTO_OP_DECODE,
- ODP_CIPHER_ALG_NULL,
- auth,
order,
&ref,
cipher_range, auth_range,
@@ -1619,8 +677,6 @@ static void test_auth_hash_in_auth_range(odp_auth_alg_t auth,
* the hash bytes in the plaintext packet before calculating the hash.
*/
alg_test(ODP_CRYPTO_OP_ENCODE,
- ODP_CIPHER_ALG_NULL,
- auth,
order,
&ref,
cipher_range, auth_range,
@@ -1700,8 +756,6 @@ static void test_auth_hashes_in_auth_range(void)
* Encode ref->plaintext and save result in ref->ciphertext.
*/
static int crypto_encode_ref(crypto_test_reference_t *ref,
- odp_cipher_alg_t cipher,
- odp_auth_alg_t auth,
odp_packet_data_range_t cipher_range,
odp_packet_data_range_t auth_range,
uint32_t hash_result_offset)
@@ -1720,8 +774,6 @@ static int crypto_encode_ref(crypto_test_reference_t *ref,
session = session_create(ODP_CRYPTO_OP_ENCODE,
ODP_CRYPTO_OP_TYPE_LEGACY,
- cipher,
- auth,
AUTH_PLAINTEXT,
ref,
HASH_OVERLAP);
@@ -1731,20 +783,31 @@ static int crypto_encode_ref(crypto_test_reference_t *ref,
return 1;
}
- if (cipher == ODP_CIPHER_ALG_NULL)
+ if (ref->cipher == ODP_CIPHER_ALG_NULL)
cipher_range = zero_range;
- if (auth == ODP_AUTH_ALG_NULL) {
+ if (ref->auth == ODP_AUTH_ALG_NULL) {
auth_range = zero_range;
hash_result_offset = 0;
}
CU_ASSERT_FATAL(hash_result_offset + ref->digest_length <= ref->length);
- rc = crypto_op(pkt, &pkt, &ok, session, ODP_CRYPTO_OP_TYPE_LEGACY, 0,
- ref->cipher_iv, ref->auth_iv,
- &cipher_range, &auth_range,
- ref->aad, hash_result_offset);
+ odp_crypto_packet_op_param_t op_params = {
+ .session = session,
+ .cipher_iv_ptr = ref->cipher_iv,
+ .auth_iv_ptr = ref->auth_iv,
+ .hash_result_offset = hash_result_offset,
+ .aad_ptr = ref->aad,
+ .cipher_range = cipher_range,
+ .auth_range = auth_range,
+ .dst_offset_shift = 0,
+ };
+ rc = crypto_op(pkt, &pkt, &ok, &op_params, ODP_CRYPTO_OP_TYPE_LEGACY);
CU_ASSERT(rc == 0);
+ if (rc) {
+ (void)odp_crypto_session_destroy(session);
+ return -1;
+ }
CU_ASSERT(ok);
rc = odp_crypto_session_destroy(session);
@@ -1780,8 +843,6 @@ static int create_combined_ref(const crypto_suite_t *suite,
crypto_test_reference_t ref_cipher_only;
crypto_test_reference_t ref_auth_only;
crypto_test_reference_t *first_ref, *second_ref;
- odp_auth_alg_t first_auth, second_auth;
- odp_cipher_alg_t first_cipher, second_cipher;
total_len = cipher_range->offset + cipher_range->length;
if (auth_range->offset + auth_range->length > total_len)
@@ -1789,6 +850,8 @@ static int create_combined_ref(const crypto_suite_t *suite,
if (digest_offset + suite->auth_capa->digest_len > total_len)
total_len = digest_offset + suite->auth_capa->digest_len;
+ ref->cipher = suite->cipher;
+ ref->auth = suite->auth;
ref->cipher_key_length = suite->cipher_capa->key_len;
ref->cipher_iv_length = suite->cipher_capa->iv_len;
ref->auth_key_length = suite->auth_capa->key_len;
@@ -1821,39 +884,31 @@ static int create_combined_ref(const crypto_suite_t *suite,
memset(ref->plaintext + digest_offset, 0, ref->digest_length);
ref_cipher_only = *ref;
+ ref_cipher_only.auth = ODP_AUTH_ALG_NULL;
ref_cipher_only.auth_key_length = 0;
ref_cipher_only.auth_iv_length = 0;
ref_cipher_only.aad_length = 0;
ref_cipher_only.digest_length = 0;
ref_auth_only = *ref;
+ ref_auth_only.cipher = ODP_CIPHER_ALG_NULL;
ref_auth_only.cipher_key_length = 0;
ref_auth_only.cipher_iv_length = 0;
if (suite->order == AUTH_CIPHERTEXT) {
first_ref = &ref_cipher_only;
- first_cipher = suite->cipher;
- first_auth = ODP_AUTH_ALG_NULL;
second_ref = &ref_auth_only;
- second_cipher = ODP_CIPHER_ALG_NULL;
- second_auth = suite->auth;
} else {
first_ref = &ref_auth_only;
- first_cipher = ODP_CIPHER_ALG_NULL;
- first_auth = suite->auth;
second_ref = &ref_cipher_only;
- second_cipher = suite->cipher;
- second_auth = ODP_AUTH_ALG_NULL;
}
rc = crypto_encode_ref(first_ref,
- first_cipher, first_auth,
*cipher_range, *auth_range,
digest_offset);
if (rc)
return 1;
memcpy(second_ref->plaintext, first_ref->ciphertext, ref->length);
rc = crypto_encode_ref(second_ref,
- second_cipher, second_auth,
*cipher_range, *auth_range,
digest_offset);
if (rc)
@@ -2135,8 +1190,6 @@ static void test_combo(const crypto_suite_t *suite,
return;
alg_test(ODP_CRYPTO_OP_ENCODE,
- suite->cipher,
- suite->auth,
suite->order,
&ref,
cipher_range, auth_range,
@@ -2145,8 +1198,6 @@ static void test_combo(const crypto_suite_t *suite,
suite->auth_capa->bit_mode);
alg_test(ODP_CRYPTO_OP_DECODE,
- suite->cipher,
- suite->auth,
suite->order,
&ref,
cipher_range, auth_range,
@@ -2238,8 +1289,6 @@ static int check_alg_null(void)
static void crypto_test_enc_alg_null(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
- ODP_CIPHER_ALG_NULL,
- ODP_AUTH_ALG_NULL,
null_reference,
ARRAY_SIZE(null_reference));
}
@@ -2247,8 +1296,6 @@ static void crypto_test_enc_alg_null(void)
static void crypto_test_dec_alg_null(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
- ODP_CIPHER_ALG_NULL,
- ODP_AUTH_ALG_NULL,
null_reference,
ARRAY_SIZE(null_reference));
}
@@ -2261,8 +1308,6 @@ static int check_alg_3des_cbc(void)
static void crypto_test_enc_alg_3des_cbc(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
- ODP_CIPHER_ALG_3DES_CBC,
- ODP_AUTH_ALG_NULL,
tdes_cbc_reference,
ARRAY_SIZE(tdes_cbc_reference));
}
@@ -2270,8 +1315,6 @@ static void crypto_test_enc_alg_3des_cbc(void)
static void crypto_test_dec_alg_3des_cbc(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
- ODP_CIPHER_ALG_3DES_CBC,
- ODP_AUTH_ALG_NULL,
tdes_cbc_reference,
ARRAY_SIZE(tdes_cbc_reference));
}
@@ -2284,8 +1327,6 @@ static int check_alg_3des_ecb(void)
static void crypto_test_enc_alg_3des_ecb(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
- ODP_CIPHER_ALG_3DES_ECB,
- ODP_AUTH_ALG_NULL,
tdes_ecb_reference,
ARRAY_SIZE(tdes_ecb_reference));
}
@@ -2293,8 +1334,6 @@ static void crypto_test_enc_alg_3des_ecb(void)
static void crypto_test_dec_alg_3des_ecb(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
- ODP_CIPHER_ALG_3DES_ECB,
- ODP_AUTH_ALG_NULL,
tdes_ecb_reference,
ARRAY_SIZE(tdes_ecb_reference));
}
@@ -2308,8 +1347,6 @@ static int check_alg_chacha20_poly1305(void)
static void crypto_test_enc_alg_chacha20_poly1305(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
- ODP_CIPHER_ALG_CHACHA20_POLY1305,
- ODP_AUTH_ALG_CHACHA20_POLY1305,
chacha20_poly1305_reference,
ARRAY_SIZE(chacha20_poly1305_reference));
}
@@ -2317,8 +1354,6 @@ static void crypto_test_enc_alg_chacha20_poly1305(void)
static void crypto_test_dec_alg_chacha20_poly1305(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
- ODP_CIPHER_ALG_CHACHA20_POLY1305,
- ODP_AUTH_ALG_CHACHA20_POLY1305,
chacha20_poly1305_reference,
ARRAY_SIZE(chacha20_poly1305_reference));
}
@@ -2331,8 +1366,6 @@ static int check_alg_aes_gcm(void)
static void crypto_test_enc_alg_aes_gcm(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
- ODP_CIPHER_ALG_AES_GCM,
- ODP_AUTH_ALG_AES_GCM,
aes_gcm_reference,
ARRAY_SIZE(aes_gcm_reference));
}
@@ -2340,8 +1373,6 @@ static void crypto_test_enc_alg_aes_gcm(void)
static void crypto_test_dec_alg_aes_gcm(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
- ODP_CIPHER_ALG_AES_GCM,
- ODP_AUTH_ALG_AES_GCM,
aes_gcm_reference,
ARRAY_SIZE(aes_gcm_reference));
}
@@ -2354,8 +1385,6 @@ static int check_alg_aes_ccm(void)
static void crypto_test_enc_alg_aes_ccm(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
- ODP_CIPHER_ALG_AES_CCM,
- ODP_AUTH_ALG_AES_CCM,
aes_ccm_reference,
ARRAY_SIZE(aes_ccm_reference));
}
@@ -2363,8 +1392,6 @@ static void crypto_test_enc_alg_aes_ccm(void)
static void crypto_test_dec_alg_aes_ccm(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
- ODP_CIPHER_ALG_AES_CCM,
- ODP_AUTH_ALG_AES_CCM,
aes_ccm_reference,
ARRAY_SIZE(aes_ccm_reference));
}
@@ -2377,8 +1404,6 @@ static int check_alg_aes_cbc(void)
static void crypto_test_enc_alg_aes_cbc(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
- ODP_CIPHER_ALG_AES_CBC,
- ODP_AUTH_ALG_NULL,
aes_cbc_reference,
ARRAY_SIZE(aes_cbc_reference));
}
@@ -2386,8 +1411,6 @@ static void crypto_test_enc_alg_aes_cbc(void)
static void crypto_test_dec_alg_aes_cbc(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
- ODP_CIPHER_ALG_AES_CBC,
- ODP_AUTH_ALG_NULL,
aes_cbc_reference,
ARRAY_SIZE(aes_cbc_reference));
}
@@ -2400,8 +1423,6 @@ static int check_alg_aes_ctr(void)
static void crypto_test_enc_alg_aes_ctr(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
- ODP_CIPHER_ALG_AES_CTR,
- ODP_AUTH_ALG_NULL,
aes_ctr_reference,
ARRAY_SIZE(aes_ctr_reference));
}
@@ -2409,8 +1430,6 @@ static void crypto_test_enc_alg_aes_ctr(void)
static void crypto_test_dec_alg_aes_ctr(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
- ODP_CIPHER_ALG_AES_CTR,
- ODP_AUTH_ALG_NULL,
aes_ctr_reference,
ARRAY_SIZE(aes_ctr_reference));
}
@@ -2423,8 +1442,6 @@ static int check_alg_aes_ecb(void)
static void crypto_test_enc_alg_aes_ecb(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
- ODP_CIPHER_ALG_AES_ECB,
- ODP_AUTH_ALG_NULL,
aes_ecb_reference,
ARRAY_SIZE(aes_ecb_reference));
}
@@ -2432,8 +1449,6 @@ static void crypto_test_enc_alg_aes_ecb(void)
static void crypto_test_dec_alg_aes_ecb(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
- ODP_CIPHER_ALG_AES_ECB,
- ODP_AUTH_ALG_NULL,
aes_ecb_reference,
ARRAY_SIZE(aes_ecb_reference));
}
@@ -2446,8 +1461,6 @@ static int check_alg_aes_cfb128(void)
static void crypto_test_enc_alg_aes_cfb128(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
- ODP_CIPHER_ALG_AES_CFB128,
- ODP_AUTH_ALG_NULL,
aes_cfb128_reference,
ARRAY_SIZE(aes_cfb128_reference));
}
@@ -2455,8 +1468,6 @@ static void crypto_test_enc_alg_aes_cfb128(void)
static void crypto_test_dec_alg_aes_cfb128(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
- ODP_CIPHER_ALG_AES_CFB128,
- ODP_AUTH_ALG_NULL,
aes_cfb128_reference,
ARRAY_SIZE(aes_cfb128_reference));
}
@@ -2469,8 +1480,6 @@ static int check_alg_aes_xts(void)
static void crypto_test_enc_alg_aes_xts(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
- ODP_CIPHER_ALG_AES_XTS,
- ODP_AUTH_ALG_NULL,
aes_xts_reference,
ARRAY_SIZE(aes_xts_reference));
}
@@ -2478,8 +1487,6 @@ static void crypto_test_enc_alg_aes_xts(void)
static void crypto_test_dec_alg_aes_xts(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
- ODP_CIPHER_ALG_AES_XTS,
- ODP_AUTH_ALG_NULL,
aes_xts_reference,
ARRAY_SIZE(aes_xts_reference));
}
@@ -2492,8 +1499,6 @@ static int check_alg_kasumi_f8(void)
static void crypto_test_enc_alg_kasumi_f8(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
- ODP_CIPHER_ALG_KASUMI_F8,
- ODP_AUTH_ALG_NULL,
kasumi_f8_reference,
ARRAY_SIZE(kasumi_f8_reference));
}
@@ -2501,8 +1506,6 @@ static void crypto_test_enc_alg_kasumi_f8(void)
static void crypto_test_dec_alg_kasumi_f8(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
- ODP_CIPHER_ALG_KASUMI_F8,
- ODP_AUTH_ALG_NULL,
kasumi_f8_reference,
ARRAY_SIZE(kasumi_f8_reference));
}
@@ -2515,8 +1518,6 @@ static int check_alg_snow3g_uea2(void)
static void crypto_test_enc_alg_snow3g_uea2(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
- ODP_CIPHER_ALG_SNOW3G_UEA2,
- ODP_AUTH_ALG_NULL,
snow3g_uea2_reference,
ARRAY_SIZE(snow3g_uea2_reference));
}
@@ -2524,8 +1525,6 @@ static void crypto_test_enc_alg_snow3g_uea2(void)
static void crypto_test_dec_alg_snow3g_uea2(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
- ODP_CIPHER_ALG_SNOW3G_UEA2,
- ODP_AUTH_ALG_NULL,
snow3g_uea2_reference,
ARRAY_SIZE(snow3g_uea2_reference));
}
@@ -2539,8 +1538,6 @@ static int check_alg_aes_eea2(void)
static void crypto_test_enc_alg_aes_eea2(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
- ODP_CIPHER_ALG_AES_EEA2,
- ODP_AUTH_ALG_NULL,
aes_eea2_reference,
ARRAY_SIZE(aes_eea2_reference));
}
@@ -2548,8 +1545,6 @@ static void crypto_test_enc_alg_aes_eea2(void)
static void crypto_test_dec_alg_aes_eea2(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
- ODP_CIPHER_ALG_AES_EEA2,
- ODP_AUTH_ALG_NULL,
aes_eea2_reference,
ARRAY_SIZE(aes_eea2_reference));
}
@@ -2562,8 +1557,6 @@ static int check_alg_zuc_eea3(void)
static void crypto_test_enc_alg_zuc_eea3(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
- ODP_CIPHER_ALG_ZUC_EEA3,
- ODP_AUTH_ALG_NULL,
zuc_eea3_reference,
ARRAY_SIZE(zuc_eea3_reference));
}
@@ -2571,8 +1564,6 @@ static void crypto_test_enc_alg_zuc_eea3(void)
static void crypto_test_dec_alg_zuc_eea3(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
- ODP_CIPHER_ALG_ZUC_EEA3,
- ODP_AUTH_ALG_NULL,
zuc_eea3_reference,
ARRAY_SIZE(zuc_eea3_reference));
}
@@ -2585,8 +1576,6 @@ static int check_alg_hmac_md5(void)
static void crypto_test_gen_alg_hmac_md5(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
- ODP_CIPHER_ALG_NULL,
- ODP_AUTH_ALG_MD5_HMAC,
hmac_md5_reference,
ARRAY_SIZE(hmac_md5_reference));
}
@@ -2594,8 +1583,6 @@ static void crypto_test_gen_alg_hmac_md5(void)
static void crypto_test_check_alg_hmac_md5(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
- ODP_CIPHER_ALG_NULL,
- ODP_AUTH_ALG_MD5_HMAC,
hmac_md5_reference,
ARRAY_SIZE(hmac_md5_reference));
}
@@ -2608,8 +1595,6 @@ static int check_alg_hmac_sha1(void)
static void crypto_test_gen_alg_hmac_sha1(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
- ODP_CIPHER_ALG_NULL,
- ODP_AUTH_ALG_SHA1_HMAC,
hmac_sha1_reference,
ARRAY_SIZE(hmac_sha1_reference));
}
@@ -2617,8 +1602,6 @@ static void crypto_test_gen_alg_hmac_sha1(void)
static void crypto_test_check_alg_hmac_sha1(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
- ODP_CIPHER_ALG_NULL,
- ODP_AUTH_ALG_SHA1_HMAC,
hmac_sha1_reference,
ARRAY_SIZE(hmac_sha1_reference));
}
@@ -2631,8 +1614,6 @@ static int check_alg_hmac_sha224(void)
static void crypto_test_gen_alg_hmac_sha224(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
- ODP_CIPHER_ALG_NULL,
- ODP_AUTH_ALG_SHA224_HMAC,
hmac_sha224_reference,
ARRAY_SIZE(hmac_sha224_reference));
}
@@ -2640,8 +1621,6 @@ static void crypto_test_gen_alg_hmac_sha224(void)
static void crypto_test_check_alg_hmac_sha224(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
- ODP_CIPHER_ALG_NULL,
- ODP_AUTH_ALG_SHA224_HMAC,
hmac_sha224_reference,
ARRAY_SIZE(hmac_sha224_reference));
}
@@ -2654,8 +1633,6 @@ static int check_alg_hmac_sha256(void)
static void crypto_test_gen_alg_hmac_sha256(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
- ODP_CIPHER_ALG_NULL,
- ODP_AUTH_ALG_SHA256_HMAC,
hmac_sha256_reference,
ARRAY_SIZE(hmac_sha256_reference));
}
@@ -2663,8 +1640,6 @@ static void crypto_test_gen_alg_hmac_sha256(void)
static void crypto_test_check_alg_hmac_sha256(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
- ODP_CIPHER_ALG_NULL,
- ODP_AUTH_ALG_SHA256_HMAC,
hmac_sha256_reference,
ARRAY_SIZE(hmac_sha256_reference));
}
@@ -2677,8 +1652,6 @@ static int check_alg_hmac_sha384(void)
static void crypto_test_gen_alg_hmac_sha384(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
- ODP_CIPHER_ALG_NULL,
- ODP_AUTH_ALG_SHA384_HMAC,
hmac_sha384_reference,
ARRAY_SIZE(hmac_sha384_reference));
}
@@ -2686,8 +1659,6 @@ static void crypto_test_gen_alg_hmac_sha384(void)
static void crypto_test_check_alg_hmac_sha384(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
- ODP_CIPHER_ALG_NULL,
- ODP_AUTH_ALG_SHA384_HMAC,
hmac_sha384_reference,
ARRAY_SIZE(hmac_sha384_reference));
}
@@ -2700,8 +1671,6 @@ static int check_alg_hmac_sha512(void)
static void crypto_test_gen_alg_hmac_sha512(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
- ODP_CIPHER_ALG_NULL,
- ODP_AUTH_ALG_SHA512_HMAC,
hmac_sha512_reference,
ARRAY_SIZE(hmac_sha512_reference));
}
@@ -2709,8 +1678,6 @@ static void crypto_test_gen_alg_hmac_sha512(void)
static void crypto_test_check_alg_hmac_sha512(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
- ODP_CIPHER_ALG_NULL,
- ODP_AUTH_ALG_SHA512_HMAC,
hmac_sha512_reference,
ARRAY_SIZE(hmac_sha512_reference));
}
@@ -2724,8 +1691,6 @@ static int check_alg_aes_xcbc(void)
static void crypto_test_gen_alg_aes_xcbc(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
- ODP_CIPHER_ALG_NULL,
- ODP_AUTH_ALG_AES_XCBC_MAC,
aes_xcbc_reference,
ARRAY_SIZE(aes_xcbc_reference));
}
@@ -2733,8 +1698,6 @@ static void crypto_test_gen_alg_aes_xcbc(void)
static void crypto_test_check_alg_aes_xcbc(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
- ODP_CIPHER_ALG_NULL,
- ODP_AUTH_ALG_AES_XCBC_MAC,
aes_xcbc_reference,
ARRAY_SIZE(aes_xcbc_reference));
}
@@ -2747,8 +1710,6 @@ static int check_alg_aes_gmac(void)
static void crypto_test_gen_alg_aes_gmac(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
- ODP_CIPHER_ALG_NULL,
- ODP_AUTH_ALG_AES_GMAC,
aes_gmac_reference,
ARRAY_SIZE(aes_gmac_reference));
}
@@ -2756,8 +1717,6 @@ static void crypto_test_gen_alg_aes_gmac(void)
static void crypto_test_check_alg_aes_gmac(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
- ODP_CIPHER_ALG_NULL,
- ODP_AUTH_ALG_AES_GMAC,
aes_gmac_reference,
ARRAY_SIZE(aes_gmac_reference));
}
@@ -2770,8 +1729,6 @@ static int check_alg_aes_cmac(void)
static void crypto_test_gen_alg_aes_cmac(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
- ODP_CIPHER_ALG_NULL,
- ODP_AUTH_ALG_AES_CMAC,
aes_cmac_reference,
ARRAY_SIZE(aes_cmac_reference));
}
@@ -2779,8 +1736,6 @@ static void crypto_test_gen_alg_aes_cmac(void)
static void crypto_test_check_alg_aes_cmac(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
- ODP_CIPHER_ALG_NULL,
- ODP_AUTH_ALG_AES_CMAC,
aes_cmac_reference,
ARRAY_SIZE(aes_cmac_reference));
}
@@ -2793,8 +1748,6 @@ static int check_alg_kasumi_f9(void)
static void crypto_test_gen_alg_kasumi_f9(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
- ODP_CIPHER_ALG_NULL,
- ODP_AUTH_ALG_KASUMI_F9,
kasumi_f9_reference,
ARRAY_SIZE(kasumi_f9_reference));
}
@@ -2802,8 +1755,6 @@ static void crypto_test_gen_alg_kasumi_f9(void)
static void crypto_test_check_alg_kasumi_f9(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
- ODP_CIPHER_ALG_NULL,
- ODP_AUTH_ALG_KASUMI_F9,
kasumi_f9_reference,
ARRAY_SIZE(kasumi_f9_reference));
}
@@ -2816,8 +1767,6 @@ static int check_alg_snow3g_uia2(void)
static void crypto_test_gen_alg_snow3g_uia2(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
- ODP_CIPHER_ALG_NULL,
- ODP_AUTH_ALG_SNOW3G_UIA2,
snow3g_uia2_reference,
ARRAY_SIZE(snow3g_uia2_reference));
}
@@ -2825,8 +1774,6 @@ static void crypto_test_gen_alg_snow3g_uia2(void)
static void crypto_test_check_alg_snow3g_uia2(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
- ODP_CIPHER_ALG_NULL,
- ODP_AUTH_ALG_SNOW3G_UIA2,
snow3g_uia2_reference,
ARRAY_SIZE(snow3g_uia2_reference));
}
@@ -2840,8 +1787,6 @@ static int check_alg_aes_eia2(void)
static void crypto_test_gen_alg_aes_eia2(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
- ODP_CIPHER_ALG_NULL,
- ODP_AUTH_ALG_AES_EIA2,
aes_eia2_reference,
ARRAY_SIZE(aes_eia2_reference));
}
@@ -2849,8 +1794,6 @@ static void crypto_test_gen_alg_aes_eia2(void)
static void crypto_test_check_alg_aes_eia2(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
- ODP_CIPHER_ALG_NULL,
- ODP_AUTH_ALG_AES_EIA2,
aes_eia2_reference,
ARRAY_SIZE(aes_eia2_reference));
}
@@ -2863,8 +1806,6 @@ static int check_alg_zuc_eia3(void)
static void crypto_test_gen_alg_zuc_eia3(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
- ODP_CIPHER_ALG_NULL,
- ODP_AUTH_ALG_ZUC_EIA3,
zuc_eia3_reference,
ARRAY_SIZE(zuc_eia3_reference));
}
@@ -2872,8 +1813,6 @@ static void crypto_test_gen_alg_zuc_eia3(void)
static void crypto_test_check_alg_zuc_eia3(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
- ODP_CIPHER_ALG_NULL,
- ODP_AUTH_ALG_ZUC_EIA3,
zuc_eia3_reference,
ARRAY_SIZE(zuc_eia3_reference));
}
@@ -2886,8 +1825,6 @@ static int check_alg_md5(void)
static void crypto_test_gen_alg_md5(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
- ODP_CIPHER_ALG_NULL,
- ODP_AUTH_ALG_MD5,
md5_reference,
ARRAY_SIZE(md5_reference));
}
@@ -2895,8 +1832,6 @@ static void crypto_test_gen_alg_md5(void)
static void crypto_test_check_alg_md5(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
- ODP_CIPHER_ALG_NULL,
- ODP_AUTH_ALG_MD5,
md5_reference,
ARRAY_SIZE(md5_reference));
}
@@ -2909,8 +1844,6 @@ static int check_alg_sha1(void)
static void crypto_test_gen_alg_sha1(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
- ODP_CIPHER_ALG_NULL,
- ODP_AUTH_ALG_SHA1,
sha1_reference,
ARRAY_SIZE(sha1_reference));
}
@@ -2918,8 +1851,6 @@ static void crypto_test_gen_alg_sha1(void)
static void crypto_test_check_alg_sha1(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
- ODP_CIPHER_ALG_NULL,
- ODP_AUTH_ALG_SHA1,
sha1_reference,
ARRAY_SIZE(sha1_reference));
}
@@ -2932,8 +1863,6 @@ static int check_alg_sha224(void)
static void crypto_test_gen_alg_sha224(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
- ODP_CIPHER_ALG_NULL,
- ODP_AUTH_ALG_SHA224,
sha224_reference,
ARRAY_SIZE(sha224_reference));
}
@@ -2941,8 +1870,6 @@ static void crypto_test_gen_alg_sha224(void)
static void crypto_test_check_alg_sha224(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
- ODP_CIPHER_ALG_NULL,
- ODP_AUTH_ALG_SHA224,
sha224_reference,
ARRAY_SIZE(sha224_reference));
}
@@ -2955,8 +1882,6 @@ static int check_alg_sha256(void)
static void crypto_test_gen_alg_sha256(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
- ODP_CIPHER_ALG_NULL,
- ODP_AUTH_ALG_SHA256,
sha256_reference,
ARRAY_SIZE(sha256_reference));
}
@@ -2964,8 +1889,6 @@ static void crypto_test_gen_alg_sha256(void)
static void crypto_test_check_alg_sha256(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
- ODP_CIPHER_ALG_NULL,
- ODP_AUTH_ALG_SHA256,
sha256_reference,
ARRAY_SIZE(sha256_reference));
}
@@ -2978,8 +1901,6 @@ static int check_alg_sha384(void)
static void crypto_test_gen_alg_sha384(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
- ODP_CIPHER_ALG_NULL,
- ODP_AUTH_ALG_SHA384,
sha384_reference,
ARRAY_SIZE(sha384_reference));
}
@@ -2987,8 +1908,6 @@ static void crypto_test_gen_alg_sha384(void)
static void crypto_test_check_alg_sha384(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
- ODP_CIPHER_ALG_NULL,
- ODP_AUTH_ALG_SHA384,
sha384_reference,
ARRAY_SIZE(sha384_reference));
}
@@ -3001,8 +1920,6 @@ static int check_alg_sha512(void)
static void crypto_test_gen_alg_sha512(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
- ODP_CIPHER_ALG_NULL,
- ODP_AUTH_ALG_SHA512,
sha512_reference,
ARRAY_SIZE(sha512_reference));
}
@@ -3010,8 +1927,6 @@ static void crypto_test_gen_alg_sha512(void)
static void crypto_test_check_alg_sha512(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
- ODP_CIPHER_ALG_NULL,
- ODP_AUTH_ALG_SHA512,
sha512_reference,
ARRAY_SIZE(sha512_reference));
}
@@ -3068,7 +1983,7 @@ static int crypto_suite_packet_async_plain_init(void)
out_queue = plain_compl_queue_create();
if (ODP_QUEUE_INVALID == out_queue) {
- fprintf(stderr, "Crypto outq creation failed.\n");
+ ODPH_ERR("Crypto outq creation failed\n");
return -1;
}
suite_context.queue = out_queue;
@@ -3090,7 +2005,7 @@ static int crypto_suite_packet_async_sched_init(void)
out_queue = sched_compl_queue_create();
if (ODP_QUEUE_INVALID == out_queue) {
- fprintf(stderr, "Crypto outq creation failed.\n");
+ ODPH_ERR("Crypto outq creation failed\n");
return -1;
}
suite_context.queue = out_queue;
@@ -3104,9 +2019,9 @@ static int crypto_suite_term(void)
{
if (ODP_QUEUE_INVALID != suite_context.queue) {
if (odp_queue_destroy(suite_context.queue))
- fprintf(stderr, "Crypto outq destroy failed.\n");
+ ODPH_ERR("Crypto outq destroy failed\n");
} else {
- fprintf(stderr, "Crypto outq not found.\n");
+ ODPH_ERR("Crypto outq not found\n");
}
return odp_cunit_print_inactive();
@@ -3277,7 +2192,7 @@ static int crypto_init(odp_instance_t *inst)
odph_helper_options_t helper_options;
if (odph_options(&helper_options)) {
- fprintf(stderr, "error: odph_options() failed.\n");
+ ODPH_ERR("odph_options() failed\n");
return -1;
}
@@ -3285,23 +2200,23 @@ static int crypto_init(odp_instance_t *inst)
init_param.mem_model = helper_options.mem_model;
if (0 != odp_init_global(inst, &init_param, NULL)) {
- fprintf(stderr, "error: odp_init_global() failed.\n");
+ ODPH_ERR("odp_init_global() failed\n");
return -1;
}
if (0 != odp_init_local(*inst, ODP_THREAD_CONTROL)) {
- fprintf(stderr, "error: odp_init_local() failed.\n");
+ ODPH_ERR("odp_init_local() failed\n");
return -1;
}
/* Configure the scheduler. */
if (odp_schedule_config(NULL)) {
- fprintf(stderr, "odp_schedule_config() failed.\n");
+ ODPH_ERR("odp_schedule_config() failed\n");
return -1;
}
if (odp_pool_capability(&pool_capa) < 0) {
- fprintf(stderr, "error: odp_pool_capability() failed.\n");
+ ODPH_ERR("odp_pool_capability() failed\n");
return -1;
}
@@ -3322,20 +2237,20 @@ static int crypto_init(odp_instance_t *inst)
if (pool_capa.pkt.max_seg_len &&
PKT_POOL_LEN > pool_capa.pkt.max_seg_len) {
- fprintf(stderr, "Warning: small packet segment length\n");
+ ODPH_ERR("Warning: small packet segment length\n");
params.pkt.seg_len = pool_capa.pkt.max_seg_len;
}
if (pool_capa.pkt.max_len &&
PKT_POOL_LEN > pool_capa.pkt.max_len) {
- fprintf(stderr, "Pool max packet length too small\n");
+ ODPH_ERR("Pool max packet length too small\n");
return -1;
}
pool = odp_pool_create("packet_pool", &params);
if (ODP_POOL_INVALID == pool) {
- fprintf(stderr, "Packet pool creation failed.\n");
+ ODPH_ERR("Packet pool creation failed\n");
return -1;
}
@@ -3349,18 +2264,18 @@ static int crypto_term(odp_instance_t inst)
pool = odp_pool_lookup("packet_pool");
if (ODP_POOL_INVALID != pool) {
if (odp_pool_destroy(pool))
- fprintf(stderr, "Packet pool destroy failed.\n");
+ ODPH_ERR("Packet pool destroy failed\n");
} else {
- fprintf(stderr, "Packet pool not found.\n");
+ ODPH_ERR("Packet pool not found\n");
}
if (0 != odp_term_local()) {
- fprintf(stderr, "error: odp_term_local() failed.\n");
+ ODPH_ERR("odp_term_local() failed\n");
return -1;
}
if (0 != odp_term_global(inst)) {
- fprintf(stderr, "error: odp_term_global() failed.\n");
+ ODPH_ERR("odp_term_global() failed\n");
return -1;
}
diff --git a/test/validation/api/crypto/test_vector_defs.h b/test/validation/api/crypto/test_vector_defs.h
new file mode 100644
index 000000000..46ae4e4e1
--- /dev/null
+++ b/test/validation/api/crypto/test_vector_defs.h
@@ -0,0 +1,3167 @@
+/* Copyright (c) 2014-2018, Linaro Limited
+ * Copyright (c) 2021-2023, Nokia
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef TEST_VECTOR_DEFS_H
+#define TEST_VECTOR_DEFS_H
+
+#include <odp_api.h>
+#include "test_vectors.h"
+
+ODP_STATIC_ASSERT(ODP_CIPHER_ALG_NULL == 0, "null cipher is not the default");
+ODP_STATIC_ASSERT(ODP_AUTH_ALG_NULL == 0, "null auth is not the default");
+
+static crypto_test_reference_t null_reference[] = {
+ {
+ .length = 8,
+ .plaintext = { 0x32, 0x6a, 0x49, 0x4c, 0xd3, 0x3f, 0xe7, 0x56 },
+ .ciphertext = { 0x32, 0x6a, 0x49, 0x4c, 0xd3, 0x3f, 0xe7, 0x56 }
+ },
+ {
+ .length = 16,
+ .plaintext = { 0x84, 0x40, 0x1f, 0x78, 0xfe, 0x6c, 0x10, 0x87,
+ 0x6d, 0x8e, 0xa2, 0x30, 0x94, 0xea, 0x53, 0x09 },
+ .ciphertext = { 0x84, 0x40, 0x1f, 0x78, 0xfe, 0x6c, 0x10, 0x87,
+ 0x6d, 0x8e, 0xa2, 0x30, 0x94, 0xea, 0x53, 0x09 }
+ }
+};
+
+/* TDES-CBC reference vectors, according to
+ * "http://csrc.nist.gov/groups/STM/cavp/documents/des/DESMMT.pdf"
+ */
+static crypto_test_reference_t tdes_cbc_reference[] = {
+ {
+ .cipher = ODP_CIPHER_ALG_3DES_CBC,
+ .cipher_key_length = TDES_CBC_KEY_LEN,
+ .cipher_key = { 0x62, 0x7f, 0x46, 0x0e, 0x08, 0x10, 0x4a, 0x10,
+ 0x43, 0xcd, 0x26, 0x5d, 0x58, 0x40, 0xea, 0xf1,
+ 0x31, 0x3e, 0xdf, 0x97, 0xdf, 0x2a, 0x8a, 0x8c},
+ .cipher_iv_length = TDES_CBC_IV_LEN,
+ .cipher_iv = { 0x8e, 0x29, 0xf7, 0x5e, 0xa7, 0x7e, 0x54, 0x75 },
+ .length = 8,
+ .plaintext = { 0x32, 0x6a, 0x49, 0x4c, 0xd3, 0x3f, 0xe7, 0x56 },
+ .ciphertext = { 0xb2, 0x2b, 0x8d, 0x66, 0xde, 0x97, 0x06, 0x92 }
+ },
+ {
+ .cipher = ODP_CIPHER_ALG_3DES_CBC,
+ .cipher_key_length = TDES_CBC_KEY_LEN,
+ .cipher_key = { 0x37, 0xae, 0x5e, 0xbf, 0x46, 0xdf, 0xf2, 0xdc,
+ 0x07, 0x54, 0xb9, 0x4f, 0x31, 0xcb, 0xb3, 0x85,
+ 0x5e, 0x7f, 0xd3, 0x6d, 0xc8, 0x70, 0xbf, 0xae},
+ .cipher_iv_length = TDES_CBC_IV_LEN,
+ .cipher_iv = {0x3d, 0x1d, 0xe3, 0xcc, 0x13, 0x2e, 0x3b, 0x65 },
+ .length = 16,
+ .plaintext = { 0x84, 0x40, 0x1f, 0x78, 0xfe, 0x6c, 0x10, 0x87,
+ 0x6d, 0x8e, 0xa2, 0x30, 0x94, 0xea, 0x53, 0x09 },
+ .ciphertext = { 0x7b, 0x1f, 0x7c, 0x7e, 0x3b, 0x1c, 0x94, 0x8e,
+ 0xbd, 0x04, 0xa7, 0x5f, 0xfb, 0xa7, 0xd2, 0xf5 }
+ }
+};
+
+/*
+ * TDES-ECB reference vectors, according to
+ * CAVS 18.0 TECBMMT
+ */
+static crypto_test_reference_t tdes_ecb_reference[] = {
+ /* CAVS 18.0 TECBMMT2.rsp #0 */
+ {
+ .cipher = ODP_CIPHER_ALG_3DES_ECB,
+ .cipher_key_length = TDES_ECB_KEY_LEN,
+ .cipher_key = { 0x15, 0x1f, 0x10, 0x38, 0x3d, 0x6d, 0x19, 0x9b,
+ 0x4a, 0x76, 0x3b, 0xd5, 0x4a, 0x46, 0xa4, 0x45,
+ 0x15, 0x1f, 0x10, 0x38, 0x3d, 0x6d, 0x19, 0x9b},
+ .length = 8,
+ .plaintext = { 0xd8, 0xda, 0x89, 0x29, 0x88, 0x78, 0xed, 0x7d },
+ .ciphertext = { 0x89, 0x32, 0x1b, 0xa7, 0x5b, 0xa5, 0x45, 0xdb }
+ },
+ /* CAVS 18.0 TECBMMT2.rsp #2 */
+ {
+ .cipher = ODP_CIPHER_ALG_3DES_ECB,
+ .cipher_key_length = TDES_ECB_KEY_LEN,
+ .cipher_key = { 0xcd, 0x3d, 0x9b, 0xf7, 0x2f, 0x8c, 0x8a, 0xb5,
+ 0xfe, 0xe6, 0x73, 0x34, 0x31, 0x1c, 0xa4, 0x62,
+ 0xcd, 0x3d, 0x9b, 0xf7, 0x2f, 0x8c, 0x8a, 0xb5},
+ .length = 24,
+ .plaintext = { 0x2f, 0x2a, 0x36, 0x1c, 0x8e, 0x14, 0x5d, 0xc0,
+ 0xa7, 0x4a, 0x1b, 0xdb, 0x7c, 0xa9, 0x29, 0xc3,
+ 0x38, 0x14, 0x4d, 0x89, 0x13, 0x5b, 0x50, 0xa7 },
+ .ciphertext = { 0x7f, 0x1f, 0xd3, 0x2b, 0x36, 0x90, 0x05, 0x4b,
+ 0xfa, 0x1b, 0x17, 0x35, 0x15, 0x79, 0x33, 0x80,
+ 0x99, 0xff, 0xa8, 0x4f, 0xea, 0x16, 0x8c, 0x6b }
+ }
+};
+
+static crypto_test_reference_t aes_cbc_reference[] = {
+ {
+ .cipher = ODP_CIPHER_ALG_AES_CBC,
+ .cipher_key_length = AES128_KEY_LEN,
+ .cipher_key = { 0x06, 0xa9, 0x21, 0x40, 0x36, 0xb8, 0xa1, 0x5b,
+ 0x51, 0x2e, 0x03, 0xd5, 0x34, 0x12, 0x00, 0x06},
+ .cipher_iv_length = AES_CBC_IV_LEN,
+ .cipher_iv = { 0x3d, 0xaf, 0xba, 0x42, 0x9d, 0x9e, 0xb4, 0x30,
+ 0xb4, 0x22, 0xda, 0x80, 0x2c, 0x9f, 0xac, 0x41 },
+ .length = 16,
+ .plaintext = "Single block msg",
+ .ciphertext = { 0xe3, 0x53, 0x77, 0x9c, 0x10, 0x79, 0xae, 0xb8,
+ 0x27, 0x08, 0x94, 0x2d, 0xbe, 0x77, 0x18, 0x1a }
+ },
+ {
+ .cipher = ODP_CIPHER_ALG_AES_CBC,
+ .cipher_key_length = AES128_KEY_LEN,
+ .cipher_key = { 0xc2, 0x86, 0x69, 0x6d, 0x88, 0x7c, 0x9a, 0xa0,
+ 0x61, 0x1b, 0xbb, 0x3e, 0x20, 0x25, 0xa4, 0x5a},
+ .cipher_iv_length = AES_CBC_IV_LEN,
+ .cipher_iv = { 0x56, 0x2e, 0x17, 0x99, 0x6d, 0x09, 0x3d, 0x28,
+ 0xdd, 0xb3, 0xba, 0x69, 0x5a, 0x2e, 0x6f, 0x58 },
+ .length = 32,
+ .plaintext = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f },
+ .ciphertext = { 0xd2, 0x96, 0xcd, 0x94, 0xc2, 0xcc, 0xcf, 0x8a,
+ 0x3a, 0x86, 0x30, 0x28, 0xb5, 0xe1, 0xdc, 0x0a,
+ 0x75, 0x86, 0x60, 0x2d, 0x25, 0x3c, 0xff, 0xf9,
+ 0x1b, 0x82, 0x66, 0xbe, 0xa6, 0xd6, 0x1a, 0xb1 }
+ },
+ {
+ .cipher = ODP_CIPHER_ALG_AES_CBC,
+ .cipher_key_length = AES128_KEY_LEN,
+ .cipher_key = { 0x6c, 0x3e, 0xa0, 0x47, 0x76, 0x30, 0xce, 0x21,
+ 0xa2, 0xce, 0x33, 0x4a, 0xa7, 0x46, 0xc2, 0xcd},
+ .cipher_iv_length = AES_CBC_IV_LEN,
+ .cipher_iv = { 0xc7, 0x82, 0xdc, 0x4c, 0x09, 0x8c, 0x66, 0xcb,
+ 0xd9, 0xcd, 0x27, 0xd8, 0x25, 0x68, 0x2c, 0x81 },
+ .length = 48,
+ .plaintext = "This is a 48-byte message (exactly 3 AES blocks)",
+ .ciphertext = { 0xd0, 0xa0, 0x2b, 0x38, 0x36, 0x45, 0x17, 0x53,
+ 0xd4, 0x93, 0x66, 0x5d, 0x33, 0xf0, 0xe8, 0x86,
+ 0x2d, 0xea, 0x54, 0xcd, 0xb2, 0x93, 0xab, 0xc7,
+ 0x50, 0x69, 0x39, 0x27, 0x67, 0x72, 0xf8, 0xd5,
+ 0x02, 0x1c, 0x19, 0x21, 0x6b, 0xad, 0x52, 0x5c,
+ 0x85, 0x79, 0x69, 0x5d, 0x83, 0xba, 0x26, 0x84 }
+ },
+ {
+ .cipher = ODP_CIPHER_ALG_AES_CBC,
+ .cipher_key_length = AES128_KEY_LEN,
+ .cipher_key = { 0x56, 0xe4, 0x7a, 0x38, 0xc5, 0x59, 0x89, 0x74,
+ 0xbc, 0x46, 0x90, 0x3d, 0xba, 0x29, 0x03, 0x49},
+ .cipher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0x92, 0x86, 0x65, 0x73, 0x1c,
+ 0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08,
+ 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c},
+ .cipher_iv_length = AES_CBC_IV_LEN,
+ .cipher_iv = { 0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad,
+ 0xde, 0xca, 0xf8, 0x88, 0x01, 0x23, 0x45, 0x67 },
+ .length = 32,
+ .plaintext = { 0x45, 0x00, 0x00, 0x28, 0xa4, 0xad, 0x40, 0x00,
+ 0x40, 0x06, 0x78, 0x80, 0x0a, 0x01, 0x03, 0x8f,
+ 0x0a, 0x01, 0x06, 0x12, 0x80, 0x23, 0x06, 0xb8,
+ 0xcb, 0x71, 0x26, 0x02, 0xdd, 0x6b, 0xb0, 0x3e },
+ .ciphertext = { 0x0d, 0xbe, 0x02, 0xda, 0x68, 0x9c, 0x8f, 0x30,
+ 0xce, 0x7c, 0x91, 0x7d, 0x41, 0x08, 0xf6, 0xf1,
+ 0x8e, 0x0d, 0x7f, 0x02, 0xb6, 0x80, 0x9a, 0x2d,
+ 0x53, 0x1c, 0xc6, 0x98, 0x85, 0xc3, 0x00, 0xe6},
+ },
+ /* NIST Special Publication 800-38A */
+ {
+ .cipher = ODP_CIPHER_ALG_AES_CBC,
+ .cipher_key_length = AES192_KEY_LEN,
+ .cipher_key = { 0x8e, 0x73, 0xb0, 0xf7, 0xda, 0x0e, 0x64, 0x52,
+ 0xc8, 0x10, 0xf3, 0x2b, 0x80, 0x90, 0x79, 0xe5,
+ 0x62, 0xf8, 0xea, 0xd2, 0x52, 0x2c, 0x6b, 0x7b},
+ .cipher_iv_length = AES_CBC_IV_LEN,
+ .cipher_iv = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
+ .length = 64,
+ .plaintext = { 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
+ 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
+ 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c,
+ 0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51,
+ 0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11,
+ 0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef,
+ 0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17,
+ 0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10 },
+ .ciphertext = { 0x4f, 0x02, 0x1d, 0xb2, 0x43, 0xbc, 0x63, 0x3d,
+ 0x71, 0x78, 0x18, 0x3a, 0x9f, 0xa0, 0x71, 0xe8,
+ 0xb4, 0xd9, 0xad, 0xa9, 0xad, 0x7d, 0xed, 0xf4,
+ 0xe5, 0xe7, 0x38, 0x76, 0x3f, 0x69, 0x14, 0x5a,
+ 0x57, 0x1b, 0x24, 0x20, 0x12, 0xfb, 0x7a, 0xe0,
+ 0x7f, 0xa9, 0xba, 0xac, 0x3d, 0xf1, 0x02, 0xe0,
+ 0x08, 0xb0, 0xe2, 0x79, 0x88, 0x59, 0x88, 0x81,
+ 0xd9, 0x20, 0xa9, 0xe6, 0x4f, 0x56, 0x15, 0xcd }
+ },
+ {
+ .cipher = ODP_CIPHER_ALG_AES_CBC,
+ .cipher_key_length = AES256_KEY_LEN,
+ .cipher_key = { 0xab, 0xbc, 0xcd, 0xde, 0xf0, 0x01, 0x12, 0x23,
+ 0x34, 0x45, 0x56, 0x67, 0x78, 0x89, 0x9a, 0xab,
+ 0xab, 0xbc, 0xcd, 0xde, 0xf0, 0x01, 0x12, 0x23,
+ 0x34, 0x45, 0x56, 0x67, 0x78, 0x89, 0x9a, 0xab},
+ .cipher_iv_length = AES_CBC_IV_LEN,
+ .cipher_iv = { 0x11, 0x22, 0x33, 0x44, 0x01, 0x02, 0x03, 0x04,
+ 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c },
+ .length = 48,
+ .plaintext = { 0x45, 0x00, 0x00, 0x30, 0x69, 0xa6, 0x40, 0x00,
+ 0x80, 0x06, 0x26, 0x90, 0xc0, 0xa8, 0x01, 0x02,
+ 0x93, 0x89, 0x15, 0x5e, 0x0a, 0x9e, 0x00, 0x8b,
+ 0x2d, 0xc5, 0x7e, 0xe0, 0x00, 0x00, 0x00, 0x00,
+ 0x70, 0x02, 0x40, 0x00, 0x20, 0xbf, 0x00, 0x00,
+ 0x02, 0x04, 0x05, 0xb4, 0x01, 0x01, 0x04, 0x02 },
+ .ciphertext = { 0x92, 0x1e, 0x2f, 0x37, 0x36, 0x3c, 0x45, 0xda,
+ 0xc9, 0x58, 0xb7, 0x07, 0x06, 0x56, 0x54, 0xc5,
+ 0x93, 0x46, 0x90, 0xb8, 0xcf, 0x0d, 0x4f, 0x79,
+ 0xf1, 0x32, 0xc2, 0xf7, 0x23, 0xb8, 0x83, 0x09,
+ 0xbc, 0x37, 0x1c, 0xeb, 0x95, 0x2c, 0x42, 0x7b,
+ 0x39, 0x10, 0xa8, 0x76, 0xfa, 0xbe, 0x91, 0xe9},
+ },
+ /* NIST Special Publication 800-38A */
+ {
+ .cipher = ODP_CIPHER_ALG_AES_CBC,
+ .cipher_key_length = AES256_KEY_LEN,
+ .cipher_key = { 0x60, 0x3d, 0xeb, 0x10, 0x15, 0xca, 0x71, 0xbe,
+ 0x2b, 0x73, 0xae, 0xf0, 0x85, 0x7d, 0x77, 0x81,
+ 0x1f, 0x35, 0x2c, 0x07, 0x3b, 0x61, 0x08, 0xd7,
+ 0x2d, 0x98, 0x10, 0xa3, 0x09, 0x14, 0xdf, 0xf4},
+ .cipher_iv_length = AES_CBC_IV_LEN,
+ .cipher_iv = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
+ .length = 64,
+ .plaintext = { 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
+ 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
+ 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c,
+ 0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51,
+ 0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11,
+ 0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef,
+ 0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17,
+ 0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10 },
+ .ciphertext = { 0xf5, 0x8c, 0x4c, 0x04, 0xd6, 0xe5, 0xf1, 0xba,
+ 0x77, 0x9e, 0xab, 0xfb, 0x5f, 0x7b, 0xfb, 0xd6,
+ 0x9c, 0xfc, 0x4e, 0x96, 0x7e, 0xdb, 0x80, 0x8d,
+ 0x67, 0x9f, 0x77, 0x7b, 0xc6, 0x70, 0x2c, 0x7d,
+ 0x39, 0xf2, 0x33, 0x69, 0xa9, 0xd9, 0xba, 0xcf,
+ 0xa5, 0x30, 0xe2, 0x63, 0x04, 0x23, 0x14, 0x61,
+ 0xb2, 0xeb, 0x05, 0xe2, 0xc3, 0x9b, 0xe9, 0xfc,
+ 0xda, 0x6c, 0x19, 0x07, 0x8c, 0x6a, 0x9d, 0x1b }
+ }
+};
+
+static crypto_test_reference_t aes_ctr_reference[] = {
+ /* RFC3686 https://tools.ietf.org/html/rfc3686 */
+ {
+ .cipher = ODP_CIPHER_ALG_AES_CTR,
+ .cipher_key_length = AES128_KEY_LEN,
+ .cipher_key = { 0x7E, 0x24, 0x06, 0x78, 0x17, 0xFA, 0xE0, 0xD7,
+ 0x43, 0xD6, 0xCE, 0x1F, 0x32, 0x53, 0x91, 0x63},
+ .cipher_iv_length = AES_CTR_IV_LEN,
+ .cipher_iv = { 0x00, 0x6C, 0xB6, 0xDB, 0xC0, 0x54, 0x3B, 0x59,
+ 0xDA, 0x48, 0xD9, 0x0B, 0x00, 0x00, 0x00, 0x01 },
+ .length = 32,
+ .plaintext = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F },
+ .ciphertext = { 0x51, 0x04, 0xA1, 0x06, 0x16, 0x8A, 0x72, 0xD9,
+ 0x79, 0x0D, 0x41, 0xEE, 0x8E, 0xDA, 0xD3, 0x88,
+ 0xEB, 0x2E, 0x1E, 0xFC, 0x46, 0xDA, 0x57, 0xC8,
+ 0xFC, 0xE6, 0x30, 0xDF, 0x91, 0x41, 0xBE, 0x28}
+ },
+ /* NIST Special Publication 800-38A */
+ {
+ .cipher = ODP_CIPHER_ALG_AES_CTR,
+ .cipher_key_length = AES128_KEY_LEN,
+ .cipher_key = { 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,
+ 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c},
+ .cipher_iv_length = AES_CTR_IV_LEN,
+ .cipher_iv = { 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
+ 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff },
+ .length = 64,
+ .plaintext = { 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
+ 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
+ 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c,
+ 0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51,
+ 0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11,
+ 0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef,
+ 0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17,
+ 0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10 },
+ .ciphertext = { 0x87, 0x4d, 0x61, 0x91, 0xb6, 0x20, 0xe3, 0x26,
+ 0x1b, 0xef, 0x68, 0x64, 0x99, 0x0d, 0xb6, 0xce,
+ 0x98, 0x06, 0xf6, 0x6b, 0x79, 0x70, 0xfd, 0xff,
+ 0x86, 0x17, 0x18, 0x7b, 0xb9, 0xff, 0xfd, 0xff,
+ 0x5a, 0xe4, 0xdf, 0x3e, 0xdb, 0xd5, 0xd3, 0x5e,
+ 0x5b, 0x4f, 0x09, 0x02, 0x0d, 0xb0, 0x3e, 0xab,
+ 0x1e, 0x03, 0x1d, 0xda, 0x2f, 0xbe, 0x03, 0xd1,
+ 0x79, 0x21, 0x70, 0xa0, 0xf3, 0x00, 0x9c, 0xee }
+ },
+ /* Generated by Crypto++ 5.6.1 (715 bytes data)*/
+ {
+ .cipher = ODP_CIPHER_ALG_AES_CTR,
+ .cipher_key_length = AES128_KEY_LEN,
+ .cipher_key = { 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,
+ 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c},
+ .cipher_iv_length = AES_CTR_IV_LEN,
+ .cipher_iv = { 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
+ 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff },
+ .length = 715,
+ .plaintext = { 0x00, 0x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
+ 0xA3, 0xE1, 0xCB, 0x44, 0x11, 0xC4, 0xDA, 0xA0,
+ 0xC2, 0xA8, 0x7D, 0xAE, 0xD2, 0x8A, 0xEE, 0x60,
+ 0xB7, 0xEC, 0x02, 0x58, 0xA9, 0xAF, 0x12, 0x5F,
+ 0x2D, 0xDC, 0x80, 0xB9, 0x87, 0x7E, 0xFE, 0x0F,
+ 0x37, 0x2D, 0x9B, 0x83, 0x2C, 0x78, 0x67, 0x70,
+ 0xA8, 0x4E, 0xA1, 0xA0, 0x7C, 0xB6, 0xE1, 0xA9,
+ 0x90, 0x7D, 0x65, 0x1B, 0xBD, 0x0E, 0xFD, 0xEF,
+ 0x2A, 0xFF, 0xC3 }
+ },
+ /* RFC3686 https://tools.ietf.org/html/rfc3686 */
+ {
+ .cipher = ODP_CIPHER_ALG_AES_CTR,
+ .cipher_key_length = AES192_KEY_LEN,
+ .cipher_key = { 0x02, 0xBF, 0x39, 0x1E, 0xE8, 0xEC, 0xB1, 0x59,
+ 0xB9, 0x59, 0x61, 0x7B, 0x09, 0x65, 0x27, 0x9B,
+ 0xF5, 0x9B, 0x60, 0xA7, 0x86, 0xD3, 0xE0, 0xFE},
+ .cipher_iv_length = AES_CTR_IV_LEN,
+ .cipher_iv = { 0x00, 0x07, 0xBD, 0xFD, 0x5C, 0xBD, 0x60, 0x27,
+ 0x8D, 0xCC, 0x09, 0x12, 0x00, 0x00, 0x00, 0x01 },
+ .length = 36,
+ .plaintext = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F,
+ 0x20, 0x21, 0x22, 0x23 },
+ .ciphertext = { 0x96, 0x89, 0x3F, 0xC5, 0x5E, 0x5C, 0x72, 0x2F,
+ 0x54, 0x0B, 0x7D, 0xD1, 0xDD, 0xF7, 0xE7, 0x58,
+ 0xD2, 0x88, 0xBC, 0x95, 0xC6, 0x91, 0x65, 0x88,
+ 0x45, 0x36, 0xC8, 0x11, 0x66, 0x2F, 0x21, 0x88,
+ 0xAB, 0xEE, 0x09, 0x35 }
+ },
+ /* NIST Special Publication 800-38A */
+ {
+ .cipher = ODP_CIPHER_ALG_AES_CTR,
+ .cipher_key_length = AES192_KEY_LEN,
+ .cipher_key = { 0x8e, 0x73, 0xb0, 0xf7, 0xda, 0x0e, 0x64, 0x52,
+ 0xc8, 0x10, 0xf3, 0x2b, 0x80, 0x90, 0x79, 0xe5,
+ 0x62, 0xf8, 0xea, 0xd2, 0x52, 0x2c, 0x6b, 0x7b},
+ .cipher_iv_length = AES_CTR_IV_LEN,
+ .cipher_iv = { 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
+ 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff },
+ .length = 64,
+ .plaintext = { 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
+ 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
+ 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c,
+ 0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51,
+ 0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11,
+ 0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef,
+ 0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17,
+ 0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10 },
+ .ciphertext = { 0x1a, 0xbc, 0x93, 0x24, 0x17, 0x52, 0x1c, 0xa2,
+ 0x4f, 0x2b, 0x04, 0x59, 0xfe, 0x7e, 0x6e, 0x0b,
+ 0x09, 0x03, 0x39, 0xec, 0x0a, 0xa6, 0xfa, 0xef,
+ 0xd5, 0xcc, 0xc2, 0xc6, 0xf4, 0xce, 0x8e, 0x94,
+ 0x1e, 0x36, 0xb2, 0x6b, 0xd1, 0xeb, 0xc6, 0x70,
+ 0xd1, 0xbd, 0x1d, 0x66, 0x56, 0x20, 0xab, 0xf7,
+ 0x4f, 0x78, 0xa7, 0xf6, 0xd2, 0x98, 0x09, 0x58,
+ 0x5a, 0x97, 0xda, 0xec, 0x58, 0xc6, 0xb0, 0x50 }
+ },
+ /* RFC3686 https://tools.ietf.org/html/rfc3686 */
+ {
+ .cipher = ODP_CIPHER_ALG_AES_CTR,
+ .cipher_key_length = AES256_KEY_LEN,
+ .cipher_key = { 0xFF, 0x7A, 0x61, 0x7C, 0xE6, 0x91, 0x48, 0xE4,
+ 0xF1, 0x72, 0x6E, 0x2F, 0x43, 0x58, 0x1D, 0xE2,
+ 0xAA, 0x62, 0xD9, 0xF8, 0x05, 0x53, 0x2E, 0xDF,
+ 0xF1, 0xEE, 0xD6, 0x87, 0xFB, 0x54, 0x15, 0x3D},
+ .cipher_iv_length = AES_CTR_IV_LEN,
+ .cipher_iv = { 0x00, 0x1C, 0xC5, 0xB7, 0x51, 0xA5, 0x1D, 0x70,
+ 0xA1, 0xC1, 0x11, 0x48, 0x00, 0x00, 0x00, 0x01 },
+ .length = 36,
+ .plaintext = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F,
+ 0x20, 0x21, 0x22, 0x23 },
+ .ciphertext = { 0xEB, 0x6C, 0x52, 0x82, 0x1D, 0x0B, 0xBB, 0xF7,
+ 0xCE, 0x75, 0x94, 0x46, 0x2A, 0xCA, 0x4F, 0xAA,
+ 0xB4, 0x07, 0xDF, 0x86, 0x65, 0x69, 0xFD, 0x07,
+ 0xF4, 0x8C, 0xC0, 0xB5, 0x83, 0xD6, 0x07, 0x1F,
+ 0x1E, 0xC0, 0xE6, 0xB8 },
+ },
+ /* NIST Special Publication 800-38A */
+ {
+ .cipher = ODP_CIPHER_ALG_AES_CTR,
+ .cipher_key_length = AES256_KEY_LEN,
+ .cipher_key = { 0x60, 0x3d, 0xeb, 0x10, 0x15, 0xca, 0x71, 0xbe,
+ 0x2b, 0x73, 0xae, 0xf0, 0x85, 0x7d, 0x77, 0x81,
+ 0x1f, 0x35, 0x2c, 0x07, 0x3b, 0x61, 0x08, 0xd7,
+ 0x2d, 0x98, 0x10, 0xa3, 0x09, 0x14, 0xdf, 0xf4},
+ .cipher_iv_length = AES_CTR_IV_LEN,
+ .cipher_iv = { 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
+ 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff },
+ .length = 64,
+ .plaintext = { 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
+ 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
+ 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c,
+ 0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51,
+ 0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11,
+ 0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef,
+ 0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17,
+ 0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10 },
+ .ciphertext = { 0x60, 0x1e, 0xc3, 0x13, 0x77, 0x57, 0x89, 0xa5,
+ 0xb7, 0xa7, 0xf5, 0x04, 0xbb, 0xf3, 0xd2, 0x28,
+ 0xf4, 0x43, 0xe3, 0xca, 0x4d, 0x62, 0xb5, 0x9a,
+ 0xca, 0x84, 0xe9, 0x90, 0xca, 0xca, 0xf5, 0xc5,
+ 0x2b, 0x09, 0x30, 0xda, 0xa2, 0x3d, 0xe9, 0x4c,
+ 0xe8, 0x70, 0x17, 0xba, 0x2d, 0x84, 0x98, 0x8d,
+ 0xdf, 0xc9, 0xc5, 0x8d, 0xb6, 0x7a, 0xad, 0xa6,
+ 0x13, 0xc2, 0xdd, 0x08, 0x45, 0x79, 0x41, 0xa6 }
+ },
+};
+
+static crypto_test_reference_t aes_ecb_reference[] = {
+ /* NIST Special Publication 800-38A */
+ {
+ .cipher = ODP_CIPHER_ALG_AES_ECB,
+ .cipher_key_length = AES128_KEY_LEN,
+ .cipher_key = { 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,
+ 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c},
+ .length = 64,
+ .plaintext = { 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
+ 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
+ 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c,
+ 0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51,
+ 0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11,
+ 0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef,
+ 0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17,
+ 0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10},
+ .ciphertext = { 0x3a, 0xd7, 0x7b, 0xb4, 0x0d, 0x7a, 0x36, 0x60,
+ 0xa8, 0x9e, 0xca, 0xf3, 0x24, 0x66, 0xef, 0x97,
+ 0xf5, 0xd3, 0xd5, 0x85, 0x03, 0xb9, 0x69, 0x9d,
+ 0xe7, 0x85, 0x89, 0x5a, 0x96, 0xfd, 0xba, 0xaf,
+ 0x43, 0xb1, 0xcd, 0x7f, 0x59, 0x8e, 0xce, 0x23,
+ 0x88, 0x1b, 0x00, 0xe3, 0xed, 0x03, 0x06, 0x88,
+ 0x7b, 0x0c, 0x78, 0x5e, 0x27, 0xe8, 0xad, 0x3f,
+ 0x82, 0x23, 0x20, 0x71, 0x04, 0x72, 0x5d, 0xd4 }
+ },
+ /* Generated by Crypto++ 5.6.1 (528 bytes) */
+ {
+ .cipher = ODP_CIPHER_ALG_AES_ECB,
+ .cipher_key_length = AES128_KEY_LEN,
+ .cipher_key = { 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,
+ 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c},
+ .length = 528,
+ .plaintext = { 0x00, 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f,
+ 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17,
+ 0x2a, 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac,
+ 0x9c, 0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e,
+ 0x51, 0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4,
+ 0x11, 0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52,
+ 0xef, 0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b,
+ 0x17, 0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37,
+ 0x10, 0x00, 0x00, 0x6b, 0xc1, 0xbe, 0xe2, 0x2e,
+ 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73,
+ 0x93, 0x17, 0x2a, 0xae, 0x2d, 0x8a, 0x57, 0x1e,
+ 0x03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, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c,
+ 0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51,
+ 0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11,
+ 0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef,
+ 0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17,
+ 0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10 },
+ .ciphertext = { 0xbd, 0x33, 0x4f, 0x1d, 0x6e, 0x45, 0xf2, 0x5f,
+ 0xf7, 0x12, 0xa2, 0x14, 0x57, 0x1f, 0xa5, 0xcc,
+ 0x97, 0x41, 0x04, 0x84, 0x6d, 0x0a, 0xd3, 0xad,
+ 0x77, 0x34, 0xec, 0xb3, 0xec, 0xee, 0x4e, 0xef,
+ 0xef, 0x7a, 0xfd, 0x22, 0x70, 0xe2, 0xe6, 0x0a,
+ 0xdc, 0xe0, 0xba, 0x2f, 0xac, 0xe6, 0x44, 0x4e,
+ 0x9a, 0x4b, 0x41, 0xba, 0x73, 0x8d, 0x6c, 0x72,
+ 0xfb, 0x16, 0x69, 0x16, 0x03, 0xc1, 0x8e, 0x0e }
+ },
+ /* NIST Special Publication 800-38A */
+ {
+ .cipher = ODP_CIPHER_ALG_AES_ECB,
+ .cipher_key_length = AES256_KEY_LEN,
+ .cipher_key = { 0x60, 0x3d, 0xeb, 0x10, 0x15, 0xca, 0x71, 0xbe,
+ 0x2b, 0x73, 0xae, 0xf0, 0x85, 0x7d, 0x77, 0x81,
+ 0x1f, 0x35, 0x2c, 0x07, 0x3b, 0x61, 0x08, 0xd7,
+ 0x2d, 0x98, 0x10, 0xa3, 0x09, 0x14, 0xdf, 0xf4},
+ .length = 64,
+ .plaintext = { 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
+ 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
+ 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c,
+ 0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51,
+ 0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11,
+ 0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef,
+ 0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17,
+ 0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10 },
+ .ciphertext = { 0xf3, 0xee, 0xd1, 0xbd, 0xb5, 0xd2, 0xa0, 0x3c,
+ 0x06, 0x4b, 0x5a, 0x7e, 0x3d, 0xb1, 0x81, 0xf8,
+ 0x59, 0x1c, 0xcb, 0x10, 0xd4, 0x10, 0xed, 0x26,
+ 0xdc, 0x5b, 0xa7, 0x4a, 0x31, 0x36, 0x28, 0x70,
+ 0xb6, 0xed, 0x21, 0xb9, 0x9c, 0xa6, 0xf4, 0xf9,
+ 0xf1, 0x53, 0xe7, 0xb1, 0xbe, 0xaf, 0xed, 0x1d,
+ 0x23, 0x30, 0x4b, 0x7a, 0x39, 0xf9, 0xf3, 0xff,
+ 0x06, 0x7d, 0x8d, 0x8f, 0x9e, 0x24, 0xec, 0xc7}
+ }
+};
+
+static crypto_test_reference_t aes_cfb128_reference[] = {
+ /* NIST Special Publication 800-38A */
+ {
+ .cipher = ODP_CIPHER_ALG_AES_CFB128,
+ .cipher_key_length = AES128_KEY_LEN,
+ .cipher_key = { 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,
+ 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c},
+ .cipher_iv_length = AES_CFB128_IV_LEN,
+ .cipher_iv = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
+ .length = 64,
+ .plaintext = { 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
+ 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
+ 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c,
+ 0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51,
+ 0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11,
+ 0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef,
+ 0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17,
+ 0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10},
+ .ciphertext = { 0x3b, 0x3f, 0xd9, 0x2e, 0xb7, 0x2d, 0xad, 0x20,
+ 0x33, 0x34, 0x49, 0xf8, 0xe8, 0x3c, 0xfb, 0x4a,
+ 0xc8, 0xa6, 0x45, 0x37, 0xa0, 0xb3, 0xa9, 0x3f,
+ 0xcd, 0xe3, 0xcd, 0xad, 0x9f, 0x1c, 0xe5, 0x8b,
+ 0x26, 0x75, 0x1f, 0x67, 0xa3, 0xcb, 0xb1, 0x40,
+ 0xb1, 0x80, 0x8c, 0xf1, 0x87, 0xa4, 0xf4, 0xdf,
+ 0xc0, 0x4b, 0x05, 0x35, 0x7c, 0x5d, 0x1c, 0x0e,
+ 0xea, 0xc4, 0xc6, 0x6f, 0x9f, 0xf7, 0xf2, 0xe6 }
+ },
+ /* NIST Special Publication 800-38A */
+ {
+ .cipher = ODP_CIPHER_ALG_AES_CFB128,
+ .cipher_key_length = AES192_KEY_LEN,
+ .cipher_key = { 0x8e, 0x73, 0xb0, 0xf7, 0xda, 0x0e, 0x64, 0x52,
+ 0xc8, 0x10, 0xf3, 0x2b, 0x80, 0x90, 0x79, 0xe5,
+ 0x62, 0xf8, 0xea, 0xd2, 0x52, 0x2c, 0x6b, 0x7b},
+ .cipher_iv_length = AES_CFB128_IV_LEN,
+ .cipher_iv = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
+ .length = 64,
+ .plaintext = { 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
+ 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
+ 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c,
+ 0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51,
+ 0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11,
+ 0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef,
+ 0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17,
+ 0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10 },
+ .ciphertext = { 0xcd, 0xc8, 0x0d, 0x6f, 0xdd, 0xf1, 0x8c, 0xab,
+ 0x34, 0xc2, 0x59, 0x09, 0xc9, 0x9a, 0x41, 0x74,
+ 0x67, 0xce, 0x7f, 0x7f, 0x81, 0x17, 0x36, 0x21,
+ 0x96, 0x1a, 0x2b, 0x70, 0x17, 0x1d, 0x3d, 0x7a,
+ 0x2e, 0x1e, 0x8a, 0x1d, 0xd5, 0x9b, 0x88, 0xb1,
+ 0xc8, 0xe6, 0x0f, 0xed, 0x1e, 0xfa, 0xc4, 0xc9,
+ 0xc0, 0x5f, 0x9f, 0x9c, 0xa9, 0x83, 0x4f, 0xa0,
+ 0x42, 0xae, 0x8f, 0xba, 0x58, 0x4b, 0x09, 0xff }
+ },
+ /* NIST Special Publication 800-38A */
+ {
+ .cipher = ODP_CIPHER_ALG_AES_CFB128,
+ .cipher_key_length = AES256_KEY_LEN,
+ .cipher_key = { 0x60, 0x3d, 0xeb, 0x10, 0x15, 0xca, 0x71, 0xbe,
+ 0x2b, 0x73, 0xae, 0xf0, 0x85, 0x7d, 0x77, 0x81,
+ 0x1f, 0x35, 0x2c, 0x07, 0x3b, 0x61, 0x08, 0xd7,
+ 0x2d, 0x98, 0x10, 0xa3, 0x09, 0x14, 0xdf, 0xf4},
+ .cipher_iv_length = AES_CFB128_IV_LEN,
+ .cipher_iv = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
+ .length = 64,
+ .plaintext = { 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
+ 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
+ 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c,
+ 0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51,
+ 0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11,
+ 0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef,
+ 0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17,
+ 0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10 },
+ .ciphertext = { 0xdc, 0x7e, 0x84, 0xbf, 0xda, 0x79, 0x16, 0x4b,
+ 0x7e, 0xcd, 0x84, 0x86, 0x98, 0x5d, 0x38, 0x60,
+ 0x39, 0xff, 0xed, 0x14, 0x3b, 0x28, 0xb1, 0xc8,
+ 0x32, 0x11, 0x3c, 0x63, 0x31, 0xe5, 0x40, 0x7b,
+ 0xdf, 0x10, 0x13, 0x24, 0x15, 0xe5, 0x4b, 0x92,
+ 0xa1, 0x3e, 0xd0, 0xa8, 0x26, 0x7a, 0xe2, 0xf9,
+ 0x75, 0xa3, 0x85, 0x74, 0x1a, 0xb9, 0xce, 0xf8,
+ 0x20, 0x31, 0x62, 0x3d, 0x55, 0xb1, 0xe4, 0x71 }
+ }
+};
+
+static crypto_test_reference_t aes_xts_reference[] = {
+ /* CAVS 11.0 XTSGen information, #1 */
+ {
+ .cipher = ODP_CIPHER_ALG_AES_XTS,
+ .cipher_key_length = AES128_XTS_KEY_LEN,
+ .cipher_key = { 0xa1, 0xb9, 0x0c, 0xba, 0x3f, 0x06, 0xac, 0x35,
+ 0x3b, 0x2c, 0x34, 0x38, 0x76, 0x08, 0x17, 0x62,
+ 0x09, 0x09, 0x23, 0x02, 0x6e, 0x91, 0x77, 0x18,
+ 0x15, 0xf2, 0x9d, 0xab, 0x01, 0x93, 0x2f, 0x2f},
+ .cipher_iv_length = AES_XTS_IV_LEN,
+ .cipher_iv = { 0x4f, 0xae, 0xf7, 0x11, 0x7c, 0xda, 0x59, 0xc6,
+ 0x6e, 0x4b, 0x92, 0x01, 0x3e, 0x76, 0x8a, 0xd5},
+ .length = 16,
+ .plaintext = { 0xeb, 0xab, 0xce, 0x95, 0xb1, 0x4d, 0x3c, 0x8d,
+ 0x6f, 0xb3, 0x50, 0x39, 0x07, 0x90, 0x31, 0x1c},
+ .ciphertext = { 0x77, 0x8a, 0xe8, 0xb4, 0x3c, 0xb9, 0x8d, 0x5a,
+ 0x82, 0x50, 0x81, 0xd5, 0xbe, 0x47, 0x1c, 0x63}
+ },
+ /* CAVS 11.0 XTSGen information, #101 */
+ {
+ .cipher = ODP_CIPHER_ALG_AES_XTS,
+ .cipher_key_length = AES128_XTS_KEY_LEN,
+ .cipher_key = { 0xb7, 0xb9, 0x3f, 0x51, 0x6a, 0xef, 0x29, 0x5e,
+ 0xff, 0x3a, 0x29, 0xd8, 0x37, 0xcf, 0x1f, 0x13,
+ 0x53, 0x47, 0xe8, 0xa2, 0x1d, 0xae, 0x61, 0x6f,
+ 0xf5, 0x06, 0x2b, 0x2e, 0x8d, 0x78, 0xce, 0x5e},
+ .cipher_iv_length = AES_XTS_IV_LEN,
+ .cipher_iv = { 0x87, 0x3e, 0xde, 0xa6, 0x53, 0xb6, 0x43, 0xbd,
+ 0x8b, 0xcf, 0x51, 0x40, 0x31, 0x97, 0xed, 0x14},
+ .length = 32,
+ .plaintext = { 0x23, 0x6f, 0x8a, 0x5b, 0x58, 0xdd, 0x55, 0xf6,
+ 0x19, 0x4e, 0xd7, 0x0c, 0x4a, 0xc1, 0xa1, 0x7f,
+ 0x1f, 0xe6, 0x0e, 0xc9, 0xa6, 0xc4, 0x54, 0xd0,
+ 0x87, 0xcc, 0xb7, 0x7d, 0x6b, 0x63, 0x8c, 0x47},
+ .ciphertext = { 0x22, 0xe6, 0xa3, 0xc6, 0x37, 0x9d, 0xcf, 0x75,
+ 0x99, 0xb0, 0x52, 0xb5, 0xa7, 0x49, 0xc7, 0xf7,
+ 0x8a, 0xd8, 0xa1, 0x1b, 0x9f, 0x1a, 0xa9, 0x43,
+ 0x0c, 0xf3, 0xae, 0xf4, 0x45, 0x68, 0x2e, 0x19}
+ },
+ /* CAVS 11.0 XTSGen information, #227 TODO (Length 130 bits)*/
+ /* {
+ .cipher = ODP_CIPHER_ALG_AES_XTS,
+ .cipher_key_length = AES128_XTS_KEY_LEN,
+ .cipher_key = { 0xec, 0x14, 0xc0, 0xa3, 0xb7, 0x72, 0x58, 0x5c,
+ 0x15, 0xd4, 0xeb, 0x94, 0xe6, 0x9e, 0x2c, 0x55,
+ 0x80, 0xcf, 0x3a, 0x63, 0xc1, 0x7c, 0xe9, 0xda,
+ 0xd8, 0x2b, 0xb4, 0x54, 0xe3, 0x87, 0x90, 0x45},
+ .cipher_iv_length = AES_XTS_IV_LEN,
+ .cipher_iv = { 0x4a, 0x02, 0x87, 0xc2, 0x6e, 0xd2, 0x41, 0x26,
+ 0x5b, 0x3a, 0x42, 0xcd, 0xd1, 0x9c, 0xea, 0xe2},
+ .length = 17,
+ .plaintext = { 0x50, 0x82, 0x64, 0x75, 0x82, 0xc6, 0xe5, 0xa7,
+ 0x88, 0x73, 0x6f, 0xc5, 0x90, 0x5e, 0xa5, 0x65,
+ 0xc0 },
+ .ciphertext = { 0x04, 0x3a, 0xb9, 0xc0, 0x3d, 0x5b, 0x44, 0x13,
+ 0x1d, 0x3e, 0x6e, 0xb2, 0x57, 0x61, 0x89, 0xde,
+ 0x80 },
+ }, */
+ /* CAVS 11.0 XTSGen information, #1 */
+ {
+ .cipher = ODP_CIPHER_ALG_AES_XTS,
+ .cipher_key_length = AES256_XTS_KEY_LEN,
+ .cipher_key = { 0x1e, 0xa6, 0x61, 0xc5, 0x8d, 0x94, 0x3a, 0x0e,
+ 0x48, 0x01, 0xe4, 0x2f, 0x4b, 0x09, 0x47, 0x14,
+ 0x9e, 0x7f, 0x9f, 0x8e, 0x3e, 0x68, 0xd0, 0xc7,
+ 0x50, 0x52, 0x10, 0xbd, 0x31, 0x1a, 0x0e, 0x7c,
+ 0xd6, 0xe1, 0x3f, 0xfd, 0xf2, 0x41, 0x8d, 0x8d,
+ 0x19, 0x11, 0xc0, 0x04, 0xcd, 0xa5, 0x8d, 0xa3,
+ 0xd6, 0x19, 0xb7, 0xe2, 0xb9, 0x14, 0x1e, 0x58,
+ 0x31, 0x8e, 0xea, 0x39, 0x2c, 0xf4, 0x1b, 0x08},
+ .cipher_iv_length = AES_XTS_IV_LEN,
+ .cipher_iv = { 0xad, 0xf8, 0xd9, 0x26, 0x27, 0x46, 0x4a, 0xd2,
+ 0xf0, 0x42, 0x8e, 0x84, 0xa9, 0xf8, 0x75, 0x64},
+ .length = 32,
+ .plaintext = { 0x2e, 0xed, 0xea, 0x52, 0xcd, 0x82, 0x15, 0xe1,
+ 0xac, 0xc6, 0x47, 0xe8, 0x10, 0xbb, 0xc3, 0x64,
+ 0x2e, 0x87, 0x28, 0x7f, 0x8d, 0x2e, 0x57, 0xe3,
+ 0x6c, 0x0a, 0x24, 0xfb, 0xc1, 0x2a, 0x20, 0x2e},
+ .ciphertext = { 0xcb, 0xaa, 0xd0, 0xe2, 0xf6, 0xce, 0xa3, 0xf5,
+ 0x0b, 0x37, 0xf9, 0x34, 0xd4, 0x6a, 0x9b, 0x13,
+ 0x0b, 0x9d, 0x54, 0xf0, 0x7e, 0x34, 0xf3, 0x6a,
+ 0xf7, 0x93, 0xe8, 0x6f, 0x73, 0xc6, 0xd7, 0xdb},
+ },
+ /* CAVS 11.0 XTSGen information, #110 */
+ {
+ .cipher = ODP_CIPHER_ALG_AES_XTS,
+ .cipher_key_length = AES256_XTS_KEY_LEN,
+ .cipher_key = { 0x6b, 0x19, 0x84, 0xc2, 0x4e, 0x7e, 0xb6, 0x62,
+ 0x8e, 0x3a, 0x11, 0xc9, 0xcc, 0xd2, 0x59, 0x40,
+ 0x33, 0xa3, 0xa0, 0xd9, 0x01, 0x6e, 0xae, 0x65,
+ 0xc2, 0xf2, 0x4e, 0x09, 0xb9, 0xa6, 0x6e, 0x9f,
+ 0xe9, 0xd1, 0x63, 0xa5, 0x06, 0xdf, 0xbc, 0xcf,
+ 0x2d, 0x93, 0xe8, 0x99, 0x1e, 0x2f, 0xc5, 0x60,
+ 0xe1, 0x04, 0x35, 0xb8, 0x90, 0xb5, 0x88, 0x9a,
+ 0x50, 0x03, 0xe4, 0xbf, 0x81, 0x7d, 0xc3, 0xe0},
+ .cipher_iv_length = AES_XTS_IV_LEN,
+ .cipher_iv = { 0x6b, 0xb0, 0xd3, 0xae, 0x4f, 0xa8, 0x6e, 0x43,
+ 0x16, 0x19, 0xe4, 0x07, 0xd5, 0x9a, 0xd4, 0xf4},
+ .length = 48,
+ .plaintext = { 0x6a, 0x74, 0x1a, 0x94, 0x5b, 0xfb, 0xf0, 0xc6,
+ 0x7a, 0xfd, 0x43, 0xba, 0x1f, 0x84, 0x18, 0x16,
+ 0xc0, 0x99, 0x51, 0x58, 0x05, 0xd0, 0xfc, 0x1f,
+ 0x7d, 0xbf, 0x6d, 0xe9, 0x00, 0xe0, 0xaa, 0x7a,
+ 0x21, 0x9c, 0x88, 0x56, 0x32, 0x71, 0xb0, 0x09,
+ 0xd1, 0xac, 0x90, 0xeb, 0x7d, 0xc9, 0x97, 0x35},
+ .ciphertext = { 0xe4, 0x7b, 0xce, 0x29, 0x2b, 0xaa, 0x63, 0xbe,
+ 0xf3, 0x16, 0xf6, 0x80, 0xa5, 0xf4, 0x80, 0xa7,
+ 0xb8, 0x83, 0xdf, 0xab, 0x6e, 0xd5, 0xa5, 0x7f,
+ 0x7e, 0x29, 0xec, 0xb8, 0x9e, 0x35, 0x4a, 0x31,
+ 0xc9, 0xb1, 0x74, 0xc4, 0xab, 0xad, 0x6c, 0xba,
+ 0xba, 0xba, 0x19, 0x14, 0x0c, 0x46, 0x20, 0xa3},
+ },
+ /* CAVS 11.0 XTSGen information, #211 TODO: length 140 bits */
+ /* {
+ .cipher = ODP_CIPHER_ALG_AES_XTS,
+ .cipher_key_length = AES256_XTS_KEY_LEN,
+ .cipher_key = { 0x62, 0xc2, 0xe4, 0xf8, 0x52, 0xa9, 0x3e, 0xea,
+ 0x4a, 0x2f, 0x61, 0xe8, 0x67, 0x68, 0x14, 0xf4,
+ 0xa8, 0x0d, 0xc4, 0x7e, 0xe1, 0x81, 0x32, 0xc8,
+ 0x38, 0xbf, 0x89, 0xa6, 0x18, 0xfd, 0xb8, 0xe2,
+ 0x91, 0x3e, 0x2e, 0x5c, 0x32, 0x1b, 0x19, 0xea,
+ 0x04, 0xbb, 0xa6, 0x34, 0x7d, 0x22, 0x6f, 0x41,
+ 0xdb, 0xee, 0x88, 0x0d, 0x61, 0x67, 0xb8, 0xe1,
+ 0xe9, 0x17, 0xfa, 0xf0, 0x46, 0xf0, 0x87, 0x5e},
+ .cipher_iv_length = AES_XTS_IV_LEN,
+ .cipher_iv = { 0x53, 0x7e, 0xe3, 0xdc, 0x13, 0xce, 0x27, 0xa8,
+ 0xd3, 0x0e, 0x6e, 0x42, 0xb5, 0xb9, 0x96, 0xae},
+ .length = 18,
+ .plaintext = { 0x00, 0xc9, 0xeb, 0x87, 0x78, 0xe0, 0x3d, 0xdd,
+ 0x5f, 0x3d, 0xe8, 0xc1, 0x8b, 0x34, 0x8f, 0xac,
+ 0x9c, 0x30},
+ .ciphertext = { 0x9d, 0x4a, 0x08, 0xac, 0x0f, 0xb4, 0x4e, 0x90,
+ 0xd0, 0x5f, 0x62, 0x86, 0x19, 0x3f, 0x3a, 0xab,
+ 0xc2, 0x90},
+ } */
+};
+
+/* AES-GCM test vectors extracted from
+ * https://tools.ietf.org/html/draft-mcgrew-gcm-test-01#section-2
+ */
+static crypto_test_reference_t aes_gcm_reference[] = {
+ {
+ .cipher = ODP_CIPHER_ALG_AES_GCM,
+ .auth = ODP_AUTH_ALG_AES_GCM,
+ .cipher_key_length = AES128_KEY_LEN,
+ .cipher_key = { 0x4c, 0x80, 0xcd, 0xef, 0xbb, 0x5d, 0x10, 0xda,
+ 0x90, 0x6a, 0xc7, 0x3c, 0x36, 0x13, 0xa6, 0x34},
+ .cipher_iv_length = AES_GCM_IV_LEN,
+ .cipher_iv = { 0x2e, 0x44, 0x3b, 0x68, 0x49, 0x56, 0xed, 0x7e,
+ 0x3b, 0x24, 0x4c, 0xfe },
+ .length = 72,
+ .plaintext = { 0x45, 0x00, 0x00, 0x48, 0x69, 0x9a, 0x00, 0x00,
+ 0x80, 0x11, 0x4d, 0xb7, 0xc0, 0xa8, 0x01, 0x02,
+ 0xc0, 0xa8, 0x01, 0x01, 0x0a, 0x9b, 0xf1, 0x56,
+ 0x38, 0xd3, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x04, 0x5f, 0x73, 0x69,
+ 0x70, 0x04, 0x5f, 0x75, 0x64, 0x70, 0x03, 0x73,
+ 0x69, 0x70, 0x09, 0x63, 0x79, 0x62, 0x65, 0x72,
+ 0x63, 0x69, 0x74, 0x79, 0x02, 0x64, 0x6b, 0x00,
+ 0x00, 0x21, 0x00, 0x01, 0x01, 0x02, 0x02, 0x01 },
+ .ciphertext = { 0xfe, 0xcf, 0x53, 0x7e, 0x72, 0x9d, 0x5b, 0x07,
+ 0xdc, 0x30, 0xdf, 0x52, 0x8d, 0xd2, 0x2b, 0x76,
+ 0x8d, 0x1b, 0x98, 0x73, 0x66, 0x96, 0xa6, 0xfd,
+ 0x34, 0x85, 0x09, 0xfa, 0x13, 0xce, 0xac, 0x34,
+ 0xcf, 0xa2, 0x43, 0x6f, 0x14, 0xa3, 0xf3, 0xcf,
+ 0x65, 0x92, 0x5b, 0xf1, 0xf4, 0xa1, 0x3c, 0x5d,
+ 0x15, 0xb2, 0x1e, 0x18, 0x84, 0xf5, 0xff, 0x62,
+ 0x47, 0xae, 0xab, 0xb7, 0x86, 0xb9, 0x3b, 0xce,
+ 0x61, 0xbc, 0x17, 0xd7, 0x68, 0xfd, 0x97, 0x32},
+ .aad_length = 12,
+ .aad = { 0x00, 0x00, 0x43, 0x21, 0x87, 0x65, 0x43, 0x21,
+ 0x00, 0x00, 0x00, 0x00 },
+ .digest_length = AES_GCM_DIGEST_LEN,
+ .digest = { 0x45, 0x90, 0x18, 0x14, 0x8f, 0x6c, 0xbe, 0x72,
+ 0x2f, 0xd0, 0x47, 0x96, 0x56, 0x2d, 0xfd, 0xb4 }
+ },
+ {
+ .cipher = ODP_CIPHER_ALG_AES_GCM,
+ .auth = ODP_AUTH_ALG_AES_GCM,
+ .cipher_key_length = AES128_KEY_LEN,
+ .cipher_key = { 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c,
+ 0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08},
+ .cipher_iv_length = AES_GCM_IV_LEN,
+ .cipher_iv = { 0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad,
+ 0xde, 0xca, 0xf8, 0x88 },
+ .length = 64,
+ .plaintext = { 0x45, 0x00, 0x00, 0x3e, 0x69, 0x8f, 0x00, 0x00,
+ 0x80, 0x11, 0x4d, 0xcc, 0xc0, 0xa8, 0x01, 0x02,
+ 0xc0, 0xa8, 0x01, 0x01, 0x0a, 0x98, 0x00, 0x35,
+ 0x00, 0x2a, 0x23, 0x43, 0xb2, 0xd0, 0x01, 0x00,
+ 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x03, 0x73, 0x69, 0x70, 0x09, 0x63, 0x79, 0x62,
+ 0x65, 0x72, 0x63, 0x69, 0x74, 0x79, 0x02, 0x64,
+ 0x6b, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01 },
+ .ciphertext = { 0xde, 0xb2, 0x2c, 0xd9, 0xb0, 0x7c, 0x72, 0xc1,
+ 0x6e, 0x3a, 0x65, 0xbe, 0xeb, 0x8d, 0xf3, 0x04,
+ 0xa5, 0xa5, 0x89, 0x7d, 0x33, 0xae, 0x53, 0x0f,
+ 0x1b, 0xa7, 0x6d, 0x5d, 0x11, 0x4d, 0x2a, 0x5c,
+ 0x3d, 0xe8, 0x18, 0x27, 0xc1, 0x0e, 0x9a, 0x4f,
+ 0x51, 0x33, 0x0d, 0x0e, 0xec, 0x41, 0x66, 0x42,
+ 0xcf, 0xbb, 0x85, 0xa5, 0xb4, 0x7e, 0x48, 0xa4,
+ 0xec, 0x3b, 0x9b, 0xa9, 0x5d, 0x91, 0x8b, 0xd1},
+ .aad_length = 8,
+ .aad = { 0x00, 0x00, 0xa5, 0xf8, 0x00, 0x00, 0x00, 0x0a },
+ .digest_length = AES_GCM_DIGEST_LEN,
+ .digest = { 0x83, 0xb7, 0x0d, 0x3a, 0xa8, 0xbc, 0x6e, 0xe4,
+ 0xc3, 0x09, 0xe9, 0xd8, 0x5a, 0x41, 0xad, 0x4a }
+ },
+ {
+ .cipher = ODP_CIPHER_ALG_AES_GCM,
+ .auth = ODP_AUTH_ALG_AES_GCM,
+ .cipher_key_length = AES128_KEY_LEN,
+ .cipher_key = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
+ .cipher_iv_length = AES_GCM_IV_LEN,
+ .cipher_iv = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00 },
+ .length = 64,
+ .plaintext = { 0x45, 0x00, 0x00, 0x3c, 0x99, 0xc5, 0x00, 0x00,
+ 0x80, 0x01, 0xcb, 0x7a, 0x40, 0x67, 0x93, 0x18,
+ 0x01, 0x01, 0x01, 0x01, 0x08, 0x00, 0x07, 0x5c,
+ 0x02, 0x00, 0x44, 0x00, 0x61, 0x62, 0x63, 0x64,
+ 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c,
+ 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74,
+ 0x75, 0x76, 0x77, 0x61, 0x62, 0x63, 0x64, 0x65,
+ 0x66, 0x67, 0x68, 0x69, 0x01, 0x02, 0x02, 0x01 },
+ .ciphertext = { 0x46, 0x88, 0xda, 0xf2, 0xf9, 0x73, 0xa3, 0x92,
+ 0x73, 0x29, 0x09, 0xc3, 0x31, 0xd5, 0x6d, 0x60,
+ 0xf6, 0x94, 0xab, 0xaa, 0x41, 0x4b, 0x5e, 0x7f,
+ 0xf5, 0xfd, 0xcd, 0xff, 0xf5, 0xe9, 0xa2, 0x84,
+ 0x45, 0x64, 0x76, 0x49, 0x27, 0x19, 0xff, 0xb6,
+ 0x4d, 0xe7, 0xd9, 0xdc, 0xa1, 0xe1, 0xd8, 0x94,
+ 0xbc, 0x3b, 0xd5, 0x78, 0x73, 0xed, 0x4d, 0x18,
+ 0x1d, 0x19, 0xd4, 0xd5, 0xc8, 0xc1, 0x8a, 0xf3},
+ .aad_length = 8,
+ .aad = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 },
+ .digest_length = AES_GCM_DIGEST_LEN,
+ .digest = { 0xf8, 0x21, 0xd4, 0x96, 0xee, 0xb0, 0x96, 0xe9,
+ 0x8a, 0xd2, 0xb6, 0x9e, 0x47, 0x99, 0xc7, 0x1d }
+ },
+ {
+ .cipher = ODP_CIPHER_ALG_AES_GCM,
+ .auth = ODP_AUTH_ALG_AES_GCM,
+ .cipher_key_length = AES128_KEY_LEN,
+ .cipher_key = { 0x3d, 0xe0, 0x98, 0x74, 0xb3, 0x88, 0xe6, 0x49,
+ 0x19, 0x88, 0xd0, 0xc3, 0x60, 0x7e, 0xae, 0x1f},
+ .cipher_iv_length = AES_GCM_IV_LEN,
+ .cipher_iv = { 0x57, 0x69, 0x0e, 0x43, 0x4e, 0x28, 0x00, 0x00,
+ 0xa2, 0xfc, 0xa1, 0xa3 },
+ .length = 28,
+ .plaintext = { 0x45, 0x00, 0x00, 0x1c, 0x42, 0xa2, 0x00, 0x00,
+ 0x80, 0x01, 0x44, 0x1f, 0x40, 0x67, 0x93, 0xb6,
+ 0xe0, 0x00, 0x00, 0x02, 0x0a, 0x00, 0xf5, 0xff,
+ 0x01, 0x02, 0x02, 0x01 },
+ .ciphertext = { 0xfb, 0xa2, 0xca, 0x84, 0x5e, 0x5d, 0xf9, 0xf0,
+ 0xf2, 0x2c, 0x3e, 0x6e, 0x86, 0xdd, 0x83, 0x1e,
+ 0x1f, 0xc6, 0x57, 0x92, 0xcd, 0x1a, 0xf9, 0x13,
+ 0x0e, 0x13, 0x79, 0xed },
+ .aad_length = 12,
+ .aad = { 0x42, 0xf6, 0x7e, 0x3f, 0x10, 0x10, 0x10, 0x10,
+ 0x10, 0x10, 0x10, 0x10 },
+ .digest_length = AES_GCM_DIGEST_LEN,
+ .digest = { 0x36, 0x9f, 0x07, 0x1f, 0x35, 0xe0, 0x34, 0xbe,
+ 0x95, 0xf1, 0x12, 0xe4, 0xe7, 0xd0, 0x5d, 0x35 }
+ },
+ {
+ .cipher = ODP_CIPHER_ALG_AES_GCM,
+ .auth = ODP_AUTH_ALG_AES_GCM,
+ .cipher_key_length = AES192_KEY_LEN,
+ .cipher_key = { 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c,
+ 0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08,
+ 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c},
+ .cipher_iv_length = AES_GCM_IV_LEN,
+ .cipher_iv = { 0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad,
+ 0xde, 0xca, 0xf8, 0x88 },
+ .length = 40,
+ .plaintext = { 0x45, 0x00, 0x00, 0x28, 0xa4, 0xad, 0x40, 0x00,
+ 0x40, 0x06, 0x78, 0x80, 0x0a, 0x01, 0x03, 0x8f,
+ 0x0a, 0x01, 0x06, 0x12, 0x80, 0x23, 0x06, 0xb8,
+ 0xcb, 0x71, 0x26, 0x02, 0xdd, 0x6b, 0xb0, 0x3e,
+ 0x50, 0x10, 0x16, 0xd0, 0x75, 0x68, 0x00, 0x01 },
+ .ciphertext = { 0xa5, 0xb1, 0xf8, 0x06, 0x60, 0x29, 0xae, 0xa4,
+ 0x0e, 0x59, 0x8b, 0x81, 0x22, 0xde, 0x02, 0x42,
+ 0x09, 0x38, 0xb3, 0xab, 0x33, 0xf8, 0x28, 0xe6,
+ 0x87, 0xb8, 0x85, 0x8b, 0x5b, 0xfb, 0xdb, 0xd0,
+ 0x31, 0x5b, 0x27, 0x45, 0x21, 0x44, 0xcc, 0x77},
+ .aad_length = 8,
+ .aad = { 0x00, 0x00, 0xa5, 0xf8, 0x00, 0x00, 0x00, 0x0a },
+ .digest_length = AES_GCM_DIGEST_LEN,
+ .digest = { 0x95, 0x45, 0x7b, 0x96, 0x52, 0x03, 0x7f, 0x53,
+ 0x18, 0x02, 0x7b, 0x5b, 0x4c, 0xd7, 0xa6, 0x36 }
+ },
+ {
+ .cipher = ODP_CIPHER_ALG_AES_GCM,
+ .auth = ODP_AUTH_ALG_AES_GCM,
+ .cipher_key_length = AES256_KEY_LEN,
+ .cipher_key = { 0xab, 0xbc, 0xcd, 0xde, 0xf0, 0x01, 0x12, 0x23,
+ 0x34, 0x45, 0x56, 0x67, 0x78, 0x89, 0x9a, 0xab,
+ 0xab, 0xbc, 0xcd, 0xde, 0xf0, 0x01, 0x12, 0x23,
+ 0x34, 0x45, 0x56, 0x67, 0x78, 0x89, 0x9a, 0xab},
+ .cipher_iv_length = AES_GCM_IV_LEN,
+ .cipher_iv = { 0x11, 0x22, 0x33, 0x44, 0x01, 0x02, 0x03, 0x04,
+ 0x05, 0x06, 0x07, 0x08 },
+ .length = 52,
+ .plaintext = { 0x45, 0x00, 0x00, 0x30, 0x69, 0xa6, 0x40, 0x00,
+ 0x80, 0x06, 0x26, 0x90, 0xc0, 0xa8, 0x01, 0x02,
+ 0x93, 0x89, 0x15, 0x5e, 0x0a, 0x9e, 0x00, 0x8b,
+ 0x2d, 0xc5, 0x7e, 0xe0, 0x00, 0x00, 0x00, 0x00,
+ 0x70, 0x02, 0x40, 0x00, 0x20, 0xbf, 0x00, 0x00,
+ 0x02, 0x04, 0x05, 0xb4, 0x01, 0x01, 0x04, 0x02,
+ 0x01, 0x02, 0x02, 0x01 },
+ .ciphertext = { 0xff, 0x42, 0x5c, 0x9b, 0x72, 0x45, 0x99, 0xdf,
+ 0x7a, 0x3b, 0xcd, 0x51, 0x01, 0x94, 0xe0, 0x0d,
+ 0x6a, 0x78, 0x10, 0x7f, 0x1b, 0x0b, 0x1c, 0xbf,
+ 0x06, 0xef, 0xae, 0x9d, 0x65, 0xa5, 0xd7, 0x63,
+ 0x74, 0x8a, 0x63, 0x79, 0x85, 0x77, 0x1d, 0x34,
+ 0x7f, 0x05, 0x45, 0x65, 0x9f, 0x14, 0xe9, 0x9d,
+ 0xef, 0x84, 0x2d, 0x8e },
+ .aad_length = 8,
+ .aad = { 0x4a, 0x2c, 0xbf, 0xe3, 0x00, 0x00, 0x00, 0x02 },
+ .digest_length = AES_GCM_DIGEST_LEN,
+ .digest = { 0xb3, 0x35, 0xf4, 0xee, 0xcf, 0xdb, 0xf8, 0x31,
+ 0x82, 0x4b, 0x4c, 0x49, 0x15, 0x95, 0x6c, 0x96 }
+ }
+};
+
+static crypto_test_reference_t aes_ccm_reference[] = {
+ /*
+ * AES-CCM reference from RFC 3610
+ */
+ {
+ .cipher = ODP_CIPHER_ALG_AES_CCM,
+ .auth = ODP_AUTH_ALG_AES_CCM,
+ .cipher_key_length = AES128_KEY_LEN,
+ .cipher_key = { 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
+ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf},
+ .cipher_iv_length = 13,
+ .cipher_iv = { 0x00, 0x00, 0x00, 0x03, 0x02, 0x01, 0x00, 0xa0,
+ 0xa1, 0xa2, 0xa3, 0xa4, 0xa5 },
+ .aad_length = 8,
+ .aad = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 },
+ .length = 23,
+ .plaintext = { 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e },
+ .ciphertext = { 0x58, 0x8c, 0x97, 0x9a, 0x61, 0xc6, 0x63, 0xd2,
+ 0xf0, 0x66, 0xd0, 0xc2, 0xc0, 0xf9, 0x89, 0x80,
+ 0x6d, 0x5f, 0x6b, 0x61, 0xda, 0xc3, 0x84 },
+ .digest_length = 8,
+ .digest = { 0x17, 0xe8, 0xd1, 0x2c, 0xfd, 0xf9, 0x26, 0xe0 }
+ },
+ /* The rest of test vectors are generated manually, no "interesting"
+ * vectors for use cases in RFC 3610 or SP 800-38C. */
+ {
+ .cipher = ODP_CIPHER_ALG_AES_CCM,
+ .auth = ODP_AUTH_ALG_AES_CCM,
+ .cipher_key_length = AES192_KEY_LEN,
+ .cipher_key = { 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
+ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
+ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7},
+ .cipher_iv_length = 13,
+ .cipher_iv = { 0x00, 0x00, 0x00, 0x03, 0x02, 0x01, 0x00, 0xa0,
+ 0xa1, 0xa2, 0xa3, 0xa4, 0xa5 },
+ .aad_length = 8,
+ .aad = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 },
+ .length = 23,
+ .plaintext = { 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e },
+ .ciphertext = { 0x57, 0x9f, 0xb8, 0x6e, 0xdd, 0xb4, 0xa6, 0x4a,
+ 0xae, 0x5f, 0xe9, 0x6d, 0xbd, 0x75, 0x44, 0x05,
+ 0x33, 0xa9, 0xfc, 0x3a, 0x84, 0x57, 0x36 },
+ .digest_length = 8,
+ .digest = { 0x67, 0xae, 0xc8, 0x0a, 0xc5, 0x88, 0xab, 0x16 }
+ },
+ {
+ .cipher = ODP_CIPHER_ALG_AES_CCM,
+ .auth = ODP_AUTH_ALG_AES_CCM,
+ .cipher_key_length = AES256_KEY_LEN,
+ .cipher_key = { 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
+ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
+ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7,
+ 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf},
+ .cipher_iv_length = 13,
+ .cipher_iv = { 0x00, 0x00, 0x00, 0x03, 0x02, 0x01, 0x00, 0xa0,
+ 0xa1, 0xa2, 0xa3, 0xa4, 0xa5 },
+ .aad_length = 8,
+ .aad = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 },
+ .length = 23,
+ .plaintext = { 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e },
+ .ciphertext = { 0x59, 0x61, 0x55, 0x10, 0xa7, 0xc4, 0x3b, 0xfb,
+ 0x12, 0x3d, 0x63, 0x6b, 0x46, 0x13, 0xc0, 0x3c,
+ 0x6c, 0xe2, 0x69, 0x07, 0x10, 0x2a, 0x3f },
+ .digest_length = 8,
+ .digest = { 0xb5, 0x57, 0x2a, 0x17, 0x2d, 0x49, 0x16, 0xd5 }
+ },
+ {
+ .cipher = ODP_CIPHER_ALG_AES_CCM,
+ .auth = ODP_AUTH_ALG_AES_CCM,
+ .cipher_key_length = AES128_KEY_LEN,
+ .cipher_key = { 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
+ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf},
+ .cipher_iv_length = 11,
+ .cipher_iv = { 0x00, 0x00, 0x00, 0x03, 0x02, 0x01, 0x00, 0xa0,
+ 0xa1, 0xa2, 0xa3 },
+ .aad_length = 8,
+ .aad = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 },
+ .length = 23,
+ .plaintext = { 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e },
+ .ciphertext = { 0xaa, 0x2d, 0x3e, 0xcb, 0xa6, 0x68, 0x63, 0x75,
+ 0x8f, 0x03, 0x01, 0x51, 0x16, 0xde, 0x30, 0xed,
+ 0x8a, 0xb5, 0x42, 0xdc, 0xfa, 0x72, 0xd0 },
+ .digest_length = 8,
+ .digest = { 0x63, 0xe7, 0x01, 0x5c, 0x69, 0xaf, 0xb4, 0x0c }
+ },
+ {
+ .cipher = ODP_CIPHER_ALG_AES_CCM,
+ .auth = ODP_AUTH_ALG_AES_CCM,
+ .cipher_key_length = AES192_KEY_LEN,
+ .cipher_key = { 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
+ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
+ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7},
+ .cipher_iv_length = 11,
+ .cipher_iv = { 0x00, 0x00, 0x00, 0x03, 0x02, 0x01, 0x00, 0xa0,
+ 0xa1, 0xa2, 0xa3 },
+ .aad_length = 8,
+ .aad = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 },
+ .length = 23,
+ .plaintext = { 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e },
+ .ciphertext = { 0xee, 0x99, 0x99, 0x1e, 0xc5, 0x8f, 0xd7, 0x7e,
+ 0x56, 0x71, 0x16, 0x39, 0x8e, 0xc4, 0x4f, 0xcc,
+ 0x14, 0x45, 0x57, 0x3e, 0x38, 0x76, 0x51 },
+ .digest_length = 8,
+ .digest = { 0x31, 0x29, 0x47, 0xa4, 0x6d, 0x76, 0x34, 0xb4 }
+ },
+ {
+ .cipher = ODP_CIPHER_ALG_AES_CCM,
+ .auth = ODP_AUTH_ALG_AES_CCM,
+ .cipher_key_length = AES256_KEY_LEN,
+ .cipher_key = { 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
+ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
+ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7,
+ 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf},
+ .cipher_iv_length = 11,
+ .cipher_iv = { 0x00, 0x00, 0x00, 0x03, 0x02, 0x01, 0x00, 0xa0,
+ 0xa1, 0xa2, 0xa3 },
+ .aad_length = 8,
+ .aad = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 },
+ .length = 23,
+ .plaintext = { 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e },
+ .ciphertext = { 0xfa, 0x07, 0x47, 0x5c, 0xe8, 0xc9, 0x37, 0x88,
+ 0x54, 0x64, 0xb8, 0xc3, 0x85, 0xbb, 0x76, 0x0b,
+ 0xf2, 0xc2, 0x4c, 0x4e, 0x31, 0x16, 0x77 },
+ .digest_length = 8,
+ .digest = { 0x88, 0x56, 0x7e, 0x19, 0x84, 0x13, 0x29, 0xc4 }
+ },
+};
+
+static crypto_test_reference_t aes_gmac_reference[] = {
+ {
+ .auth = ODP_AUTH_ALG_AES_GMAC,
+ .auth_key_length = AES128_KEY_LEN,
+ .auth_key = { 0x4c, 0x80, 0xcd, 0xef, 0xbb, 0x5d, 0x10, 0xda,
+ 0x90, 0x6a, 0xc7, 0x3c, 0x36, 0x13, 0xa6, 0x34},
+ .auth_iv_length = AES_GCM_IV_LEN,
+ .auth_iv = { 0x22, 0x43, 0x3c, 0x64, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00 },
+ .length = 68,
+ .plaintext = { 0x00, 0x00, 0x43, 0x21, 0x00, 0x00, 0x00, 0x07,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x45, 0x00, 0x00, 0x30, 0xda, 0x3a, 0x00, 0x00,
+ 0x80, 0x01, 0xdf, 0x3b, 0xc0, 0xa8, 0x00, 0x05,
+ 0xc0, 0xa8, 0x00, 0x01, 0x08, 0x00, 0xc6, 0xcd,
+ 0x02, 0x00, 0x07, 0x00, 0x61, 0x62, 0x63, 0x64,
+ 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c,
+ 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74,
+ 0x01, 0x02, 0x02, 0x01 },
+ .ciphertext = { 0x00, 0x00, 0x43, 0x21, 0x00, 0x00, 0x00, 0x07,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x45, 0x00, 0x00, 0x30, 0xda, 0x3a, 0x00, 0x00,
+ 0x80, 0x01, 0xdf, 0x3b, 0xc0, 0xa8, 0x00, 0x05,
+ 0xc0, 0xa8, 0x00, 0x01, 0x08, 0x00, 0xc6, 0xcd,
+ 0x02, 0x00, 0x07, 0x00, 0x61, 0x62, 0x63, 0x64,
+ 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c,
+ 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74,
+ 0x01, 0x02, 0x02, 0x01 },
+ .digest_length = AES_GCM_DIGEST_LEN,
+ .digest = { 0xf2, 0xa9, 0xa8, 0x36, 0xe1, 0x55, 0x10, 0x6a,
+ 0xa8, 0xdc, 0xd6, 0x18, 0xe4, 0x09, 0x9a, 0xaa }
+ },
+ /* AES192-GMAC from DPDK 17.02 */
+ {
+ .auth = ODP_AUTH_ALG_AES_GMAC,
+ .auth_key_length = AES192_KEY_LEN,
+ .auth_key = { 0xaa, 0x74, 0x0a, 0xbf, 0xad, 0xcd, 0xa7, 0x79,
+ 0x22, 0x0d, 0x3b, 0x40, 0x6c, 0x5d, 0x7e, 0xc0,
+ 0x9a, 0x77, 0xfe, 0x9d, 0x94, 0x10, 0x45, 0x39},
+ .auth_iv_length = AES_GCM_IV_LEN,
+ .auth_iv = { 0xab, 0x22, 0x65, 0xb4, 0xc1, 0x68, 0x95, 0x55,
+ 0x61, 0xf0, 0x43, 0x15 },
+ .length = 80,
+ .plaintext = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
+ 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10,
+ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
+ 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10,
+ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
+ 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10,
+ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
+ 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10,
+ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
+ 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10},
+ .ciphertext = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
+ 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10,
+ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
+ 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10,
+ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
+ 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10,
+ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
+ 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10,
+ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
+ 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10},
+ .digest_length = AES_GCM_DIGEST_LEN,
+ .digest = { 0xCF, 0x82, 0x80, 0x64, 0x02, 0x46, 0xF4, 0xFB,
+ 0x33, 0xAE, 0x1D, 0x90, 0xEA, 0x48, 0x83, 0xDB },
+ },
+ /* AES256-GMAC from DPDK 17.02 */
+ {
+ .auth = ODP_AUTH_ALG_AES_GMAC,
+ .auth_key_length = AES256_KEY_LEN,
+ .auth_key = { 0xb5, 0x48, 0xe4, 0x93, 0x4f, 0x5c, 0x64, 0xd3,
+ 0xc0, 0xf0, 0xb7, 0x8f, 0x7b, 0x4d, 0x88, 0x24,
+ 0xaa, 0xc4, 0x6b, 0x3c, 0x8d, 0x2c, 0xc3, 0x5e,
+ 0xe4, 0xbf, 0xb2, 0x54, 0xe4, 0xfc, 0xba, 0xf7},
+ .auth_iv_length = AES_GCM_IV_LEN,
+ .auth_iv = { 0x2e, 0xed, 0xe1, 0xdc, 0x64, 0x47, 0xc7, 0xaf,
+ 0xc4, 0x41, 0x53, 0x58 },
+ .length = 65,
+ .plaintext = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
+ 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10,
+ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
+ 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10,
+ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
+ 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10,
+ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
+ 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10,
+ 0x01, 0x02 },
+ .ciphertext = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
+ 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10,
+ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
+ 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10,
+ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
+ 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10,
+ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
+ 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10,
+ 0x01, 0x02 },
+ .digest_length = AES_GCM_DIGEST_LEN,
+ .digest = { 0x77, 0x46, 0x0D, 0x6F, 0xB1, 0x87, 0xDB, 0xA9,
+ 0x46, 0xAD, 0xCD, 0xFB, 0xB7, 0xF9, 0x13, 0xA1 },
+ }
+};
+
+/*
+ * Test vectors from SP800-38B / CSRC examples
+ * 12-byte vectors are just truncated 16-byte vectors
+ */
+static crypto_test_reference_t aes_cmac_reference[] = {
+ {
+ .auth = ODP_AUTH_ALG_AES_CMAC,
+ .auth_key_length = AES128_KEY_LEN,
+ .auth_key = { 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,
+ 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c },
+ .length = 16,
+ .plaintext = { 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
+ 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a},
+ .ciphertext = { 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
+ 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a
+ },
+ .digest_length = 16,
+ .digest = { 0x07, 0x0a, 0x16, 0xb4, 0x6b, 0x4d, 0x41, 0x44,
+ 0xf7, 0x9b, 0xdd, 0x9d, 0xd0, 0x4a, 0x28, 0x7c },
+ },
+ {
+ .copy_previous_vector = 1,
+ .digest_length = 12,
+ },
+ {
+ .auth = ODP_AUTH_ALG_AES_CMAC,
+ .auth_key_length = AES192_KEY_LEN,
+ .auth_key = { 0x8e, 0x73, 0xb0, 0xf7, 0xda, 0x0e, 0x64, 0x52,
+ 0xc8, 0x10, 0xf3, 0x2b, 0x80, 0x90, 0x79, 0xe5,
+ 0x62, 0xf8, 0xea, 0xd2, 0x52, 0x2c, 0x6b, 0x7b },
+ .length = 16,
+ .plaintext = { 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
+ 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a},
+ .ciphertext = { 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
+ 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a
+ },
+ .digest_length = 16,
+ .digest = { 0x9e, 0x99, 0xa7, 0xbf, 0x31, 0xe7, 0x10, 0x90,
+ 0x06, 0x62, 0xf6, 0x5e, 0x61, 0x7c, 0x51, 0x84 },
+ },
+ {
+ .copy_previous_vector = 1,
+ .digest_length = 12,
+ },
+ {
+ .auth = ODP_AUTH_ALG_AES_CMAC,
+ .auth_key_length = AES256_KEY_LEN,
+ .auth_key = { 0x60, 0x3d, 0xeb, 0x10, 0x15, 0xca, 0x71, 0xbe,
+ 0x2b, 0x73, 0xae, 0xf0, 0x85, 0x7d, 0x77, 0x81,
+ 0x1f, 0x35, 0x2c, 0x07, 0x3b, 0x61, 0x08, 0xd7,
+ 0x2d, 0x98, 0x10, 0xa3, 0x09, 0x14, 0xdf, 0xf4 },
+ .length = 16,
+ .plaintext = { 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
+ 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a},
+ .ciphertext = { 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
+ 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a
+ },
+ .digest_length = 16,
+ .digest = { 0x28, 0xa7, 0x02, 0x3f, 0x45, 0x2e, 0x8f, 0x82,
+ 0xbd, 0x4b, 0xf2, 0x8d, 0x8c, 0x37, 0xc3, 0x5c },
+ },
+ {
+ .copy_previous_vector = 1,
+ .digest_length = 12,
+ },
+};
+
+/*
+ * Test vector from RFC 7539, sections 2.8.2, A.5
+ */
+static crypto_test_reference_t chacha20_poly1305_reference[] = {
+ {
+ .cipher = ODP_CIPHER_ALG_CHACHA20_POLY1305,
+ .auth = ODP_AUTH_ALG_CHACHA20_POLY1305,
+ .cipher_key_length = CHACHA20_POLY1305_KEY_LEN,
+ .cipher_key = { 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
+ 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
+ 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
+ 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f},
+ .cipher_iv_length = CHACHA20_POLY1305_IV_LEN,
+ .cipher_iv = { 0x07, 0x00, 0x00, 0x00, 0x40, 0x41, 0x42, 0x43,
+ 0x44, 0x45, 0x46, 0x47 },
+ .length = 114,
+ .plaintext = { 0x4c, 0x61, 0x64, 0x69, 0x65, 0x73, 0x20, 0x61,
+ 0x6e, 0x64, 0x20, 0x47, 0x65, 0x6e, 0x74, 0x6c,
+ 0x65, 0x6d, 0x65, 0x6e, 0x20, 0x6f, 0x66, 0x20,
+ 0x74, 0x68, 0x65, 0x20, 0x63, 0x6c, 0x61, 0x73,
+ 0x73, 0x20, 0x6f, 0x66, 0x20, 0x27, 0x39, 0x39,
+ 0x3a, 0x20, 0x49, 0x66, 0x20, 0x49, 0x20, 0x63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65, 0x86, 0xce, 0xc6, 0x4b,
+ 0x61, 0x16 },
+ .aad_length = 12,
+ .aad = { 0x50, 0x51, 0x52, 0x53, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4,
+ 0xc5, 0xc6, 0xc7 },
+ .digest_length = 16,
+ .digest = { 0x1a, 0xe1, 0x0b, 0x59, 0x4f, 0x09, 0xe2, 0x6a,
+ 0x7e, 0x90, 0x2e, 0xcb, 0xd0, 0x60, 0x06, 0x91 }
+ },
+ {
+ .cipher = ODP_CIPHER_ALG_CHACHA20_POLY1305,
+ .auth = ODP_AUTH_ALG_CHACHA20_POLY1305,
+ .cipher_key_length = CHACHA20_POLY1305_KEY_LEN,
+ .cipher_key = { 0x1c, 0x92, 0x40, 0xa5, 0xeb, 0x55, 0xd3, 0x8a,
+ 0xf3, 0x33, 0x88, 0x86, 0x04, 0xf6, 0xb5, 0xf0,
+ 0x47, 0x39, 0x17, 0xc1, 0x40, 0x2b, 0x80, 0x09,
+ 0x9d, 0xca, 0x5c, 0xbc, 0x20, 0x70, 0x75, 0xc0},
+ .cipher_iv_length = CHACHA20_POLY1305_IV_LEN,
+ .cipher_iv = { 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04,
+ 0x05, 0x06, 0x07, 0x08 },
+ .length = 265,
+ .plaintext = { 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x65, 0x74,
+ 0x2d, 0x44, 0x72, 0x61, 0x66, 0x74, 0x73, 0x20,
+ 0x61, 0x72, 0x65, 0x20, 0x64, 0x72, 0x61, 0x66,
+ 0x74, 0x20, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65,
+ 0x6e, 0x74, 0x73, 0x20, 0x76, 0x61, 0x6c, 0x69,
+ 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x61, 0x20,
+ 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x20,
+ 0x6f, 0x66, 0x20, 0x73, 0x69, 0x78, 0x20, 0x6d,
+ 0x6f, 0x6e, 0x74, 0x68, 0x73, 0x20, 0x61, 0x6e,
+ 0x64, 0x20, 0x6d, 0x61, 0x79, 0x20, 0x62, 0x65,
+ 0x20, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64,
+ 0x2c, 0x20, 0x72, 0x65, 0x70, 0x6c, 0x61, 0x63,
+ 0x65, 0x64, 0x2c, 0x20, 0x6f, 0x72, 0x20, 0x6f,
+ 0x62, 0x73, 0x6f, 0x6c, 0x65, 0x74, 0x65, 0x64,
+ 0x20, 0x62, 0x79, 0x20, 0x6f, 0x74, 0x68, 0x65,
+ 0x72, 0x20, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65,
+ 0x6e, 0x74, 0x73, 0x20, 0x61, 0x74, 0x20, 0x61,
+ 0x6e, 0x79, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x2e,
+ 0x20, 0x49, 0x74, 0x20, 0x69, 0x73, 0x20, 0x69,
+ 0x6e, 0x61, 0x70, 0x70, 0x72, 0x6f, 0x70, 0x72,
+ 0x69, 0x61, 0x74, 0x65, 0x20, 0x74, 0x6f, 0x20,
+ 0x75, 0x73, 0x65, 0x20, 0x49, 0x6e, 0x74, 0x65,
+ 0x72, 0x6e, 0x65, 0x74, 0x2d, 0x44, 0x72, 0x61,
+ 0x66, 0x74, 0x73, 0x20, 0x61, 0x73, 0x20, 0x72,
+ 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65,
+ 0x20, 0x6d, 0x61, 0x74, 0x65, 0x72, 0x69, 0x61,
+ 0x6c, 0x20, 0x6f, 0x72, 0x20, 0x74, 0x6f, 0x20,
+ 0x63, 0x69, 0x74, 0x65, 0x20, 0x74, 0x68, 0x65,
+ 0x6d, 0x20, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x20,
+ 0x74, 0x68, 0x61, 0x6e, 0x20, 0x61, 0x73, 0x20,
+ 0x2f, 0xe2, 0x80, 0x9c, 0x77, 0x6f, 0x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 0x82, 0xa1, 0xb0, 0xa0, 0x6c, 0x52, 0x3e,
+ 0xaf, 0x45, 0x34, 0xd7, 0xf8, 0x3f, 0xa1, 0x15,
+ 0x5b, 0x00, 0x47, 0x71, 0x8c, 0xbc, 0x54, 0x6a,
+ 0x0d, 0x07, 0x2b, 0x04, 0xb3, 0x56, 0x4e, 0xea,
+ 0x1b, 0x42, 0x22, 0x73, 0xf5, 0x48, 0x27, 0x1a,
+ 0x0b, 0xb2, 0x31, 0x60, 0x53, 0xfa, 0x76, 0x99,
+ 0x19, 0x55, 0xeb, 0xd6, 0x31, 0x59, 0x43, 0x4e,
+ 0xce, 0xbb, 0x4e, 0x46, 0x6d, 0xae, 0x5a, 0x10,
+ 0x73, 0xa6, 0x72, 0x76, 0x27, 0x09, 0x7a, 0x10,
+ 0x49, 0xe6, 0x17, 0xd9, 0x1d, 0x36, 0x10, 0x94,
+ 0xfa, 0x68, 0xf0, 0xff, 0x77, 0x98, 0x71, 0x30,
+ 0x30, 0x5b, 0xea, 0xba, 0x2e, 0xda, 0x04, 0xdf,
+ 0x99, 0x7b, 0x71, 0x4d, 0x6c, 0x6f, 0x2c, 0x29,
+ 0xa6, 0xad, 0x5c, 0xb4, 0x02, 0x2b, 0x02, 0x70,
+ 0x9b },
+ .aad_length = 12,
+ .aad = { 0xf3, 0x33, 0x88, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x4e, 0x91 },
+ .digest_length = CHACHA20_POLY1305_CHECK_LEN,
+ .digest = { 0xee, 0xad, 0x9d, 0x67, 0x89, 0x0c, 0xbb, 0x22,
+ 0x39, 0x23, 0x36, 0xfe, 0xa1, 0x85, 0x1f, 0x38 }
+ },
+};
+
+static crypto_test_reference_t hmac_md5_reference[] = {
+ {
+ .auth = ODP_AUTH_ALG_MD5_HMAC,
+ .auth_key_length = HMAC_MD5_KEY_LEN,
+ .auth_key = { 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
+ 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b },
+ .length = 8,
+ /* "Hi There" */
+ .plaintext = { 0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65},
+ .ciphertext = { 0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65},
+ .digest_length = HMAC_MD5_CHECK_LEN,
+ .digest = { 0x92, 0x94, 0x72, 0x7a, 0x36, 0x38, 0xbb, 0x1c,
+ 0x13, 0xf4, 0x8e, 0xf8, 0x15, 0x8b, 0xfc, 0x9d },
+
+ },
+ {
+ .copy_previous_vector = 1,
+ .digest_length = HMAC_MD5_96_CHECK_LEN,
+ },
+ {
+ .auth = ODP_AUTH_ALG_MD5_HMAC,
+ .auth_key_length = HMAC_MD5_KEY_LEN,
+ /* "Jefe" */
+ .auth_key = { 0x4a, 0x65, 0x66, 0x65 },
+ .length = 28,
+ /* what do ya want for nothing?*/
+ .plaintext = { 0x77, 0x68, 0x61, 0x74, 0x20, 0x64, 0x6f, 0x20,
+ 0x79, 0x61, 0x20, 0x77, 0x61, 0x6e, 0x74, 0x20,
+ 0x66, 0x6f, 0x72, 0x20, 0x6e, 0x6f, 0x74, 0x68,
+ 0x69, 0x6e, 0x67, 0x3f },
+ .ciphertext = { 0x77, 0x68, 0x61, 0x74, 0x20, 0x64, 0x6f, 0x20,
+ 0x79, 0x61, 0x20, 0x77, 0x61, 0x6e, 0x74, 0x20,
+ 0x66, 0x6f, 0x72, 0x20, 0x6e, 0x6f, 0x74, 0x68,
+ 0x69, 0x6e, 0x67, 0x3f },
+ .digest_length = HMAC_MD5_CHECK_LEN,
+ .digest = { 0x75, 0x0c, 0x78, 0x3e, 0x6a, 0xb0, 0xb5, 0x03,
+ 0xea, 0xa8, 0x6e, 0x31, 0x0a, 0x5d, 0xb7, 0x38 },
+
+ },
+ {
+ .copy_previous_vector = 1,
+ .digest_length = HMAC_MD5_96_CHECK_LEN,
+ },
+ {
+ .auth = ODP_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t hmac_sha1_reference[] = {
+ {
+ .auth = ODP_AUTH_ALG_SHA1_HMAC,
+ .auth_key_length = HMAC_SHA1_KEY_LEN,
+ .auth_key = { 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
+ 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
+ 0x0b, 0x0b, 0x0b, 0x0b },
+ .length = 8,
+ /* "Hi There" */
+ .plaintext = { 0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65},
+ .ciphertext = { 0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65},
+ .digest_length = HMAC_SHA1_CHECK_LEN,
+ .digest = { 0xb6, 0x17, 0x31, 0x86, 0x55, 0x05, 0x72, 0x64,
+ 0xe2, 0x8b, 0xc0, 0xb6, 0xfb, 0x37, 0x8c, 0x8e,
+ 0xf1, 0x46, 0xbe, 0x00 }
+ },
+ {
+ .copy_previous_vector = 1,
+ .digest_length = HMAC_SHA1_96_CHECK_LEN,
+ },
+ {
+ .auth = ODP_AUTH_ALG_SHA1_HMAC,
+ .auth_key_length = HMAC_SHA1_KEY_LEN,
+ /* "Jefe" */
+ .auth_key = { 0x4a, 0x65, 0x66, 0x65 },
+ .length = 28,
+ /* what do ya want for nothing?*/
+ .plaintext = { 0x77, 0x68, 0x61, 0x74, 0x20, 0x64, 0x6f, 0x20,
+ 0x79, 0x61, 0x20, 0x77, 0x61, 0x6e, 0x74, 0x20,
+ 0x66, 0x6f, 0x72, 0x20, 0x6e, 0x6f, 0x74, 0x68,
+ 0x69, 0x6e, 0x67, 0x3f },
+ .ciphertext = { 0x77, 0x68, 0x61, 0x74, 0x20, 0x64, 0x6f, 0x20,
+ 0x79, 0x61, 0x20, 0x77, 0x61, 0x6e, 0x74, 0x20,
+ 0x66, 0x6f, 0x72, 0x20, 0x6e, 0x6f, 0x74, 0x68,
+ 0x69, 0x6e, 0x67, 0x3f },
+ .digest_length = HM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 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
+ 0xdd, 0xdd },
+ .digest_length = HMAC_SHA1_CHECK_LEN,
+ .digest = { 0x12, 0x5d, 0x73, 0x42, 0xb9, 0xac, 0x11, 0xcd,
+ 0x91, 0xa3, 0x9a, 0xf4, 0x8a, 0xa1, 0x7b, 0x4f,
+ 0x63, 0xf1, 0x75, 0xd3 }
+ },
+ {
+ .copy_previous_vector = 1,
+ .digest_length = HMAC_SHA1_96_CHECK_LEN,
+ },
+};
+
+static crypto_test_reference_t hmac_sha224_reference[] = {
+ {
+ .auth = ODP_AUTH_ALG_SHA224_HMAC,
+ .auth_key_length = HMAC_SHA224_KEY_LEN,
+ .auth_key = { 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
+ 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
+ 0x0b, 0x0b, 0x0b, 0x0b },
+ .length = 8,
+ /* "Hi There" */
+ .plaintext = { 0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65},
+ .ciphertext = { 0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65},
+ .digest_length = HMAC_SHA224_CHECK_LEN,
+ .digest = { 0x89, 0x6f, 0xb1, 0x12, 0x8a, 0xbb, 0xdf, 0x19,
+ 0x68, 0x32, 0x10, 0x7c, 0xd4, 0x9d, 0xf3, 0x3f,
+ 0x47, 0xb4, 0xb1, 0x16, 0x99, 0x12, 0xba, 0x4f,
+ 0x53, 0x68, 0x4b, 0x22 }
+ },
+ {
+ .auth = ODP_AUTH_ALG_SHA224_HMAC,
+ .auth_key_length = HMAC_SHA224_KEY_LEN,
+ /* "Jefe" */
+ .auth_key = { 0x4a, 0x65, 0x66, 0x65 },
+ .length = 28,
+ /* what do ya want for nothing?*/
+ .plaintext = { 0x77, 0x68, 0x61, 0x74, 0x20, 0x64, 0x6f, 0x20,
+ 0x79, 0x61, 0x20, 0x77, 0x61, 0x6e, 0x74, 0x20,
+ 0x66, 0x6f, 0x72, 0x20, 0x6e, 0x6f, 0x74, 0x68,
+ 0x69, 0x6e, 0x67, 0x3f },
+ .ciphertext = { 0x77, 0x68, 0x61, 0x74, 0x20, 0x64, 0x6f, 0x20,
+ 0x79, 0x61, 0x20, 0x77, 0x61, 0x6e, 0x74, 0x20,
+ 0x66, 0x6f, 0x72, 0x20, 0x6e, 0x6f, 0x74, 0x68,
+ 0x69, 0x6e, 0x67, 0x3f },
+ .digest_length = HMAC_SHA224_CHECK_LEN,
+ .digest = { 0xa3, 0x0e, 0x01, 0x09, 0x8b, 0xc6, 0xdb, 0xbf,
+ 0x45, 0x69, 0x0f, 0x3a, 0x7e, 0x9e, 0x6d, 0x0f,
+ 0x8b, 0xbe, 0xa2, 0xa3, 0x9e, 0x61, 0x48, 0x00,
+ 0x8f, 0xd0, 0x5e, 0x44 }
+ },
+ {
+ .auth = ODP_AUTH_ALG_SHA224_HMAC,
+ .auth_key_length = HMAC_SHA224_KEY_LEN,
+ .auth_key = { 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
+ 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
+ 0xaa, 0xaa, 0xaa, 0xaa },
+ .length = 50,
+ .plaintext = { 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
+ 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
+ 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
+ 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
+ 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
+ 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
+ 0xdd, 0xdd },
+ .ciphertext = { 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
+ 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
+ 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
+ 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
+ 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
+ 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
+ 0xdd, 0xdd },
+ .digest_length = HMAC_SHA224_CHECK_LEN,
+ .digest = { 0x7f, 0xb3, 0xcb, 0x35, 0x88, 0xc6, 0xc1, 0xf6,
+ 0xff, 0xa9, 0x69, 0x4d, 0x7d, 0x6a, 0xd2, 0x64,
+ 0x93, 0x65, 0xb0, 0xc1, 0xf6, 0x5d, 0x69, 0xd1,
+ 0xec, 0x83, 0x33, 0xea }
+ }
+};
+
+static crypto_test_reference_t hmac_sha256_reference[] = {
+ {
+ .auth = ODP_AUTH_ALG_SHA256_HMAC,
+ .auth_key_length = HMAC_SHA256_KEY_LEN,
+ .auth_key = { 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
+ 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
+ 0x0b, 0x0b, 0x0b, 0x0b },
+ .length = 8,
+ /* "Hi There" */
+ .plaintext = { 0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65},
+ .ciphertext = { 0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65},
+ .digest_length = HMAC_SHA256_CHECK_LEN,
+ .digest = { 0xb0, 0x34, 0x4c, 0x61, 0xd8, 0xdb, 0x38, 0x53,
+ 0x5c, 0xa8, 0xaf, 0xce, 0xaf, 0x0b, 0xf1, 0x2b,
+ 0x88, 0x1d, 0xc2, 0x00, 0xc9, 0x83, 0x3d, 0xa7,
+ 0x26, 0xe9, 0x37, 0x6c, 0x2e, 0x32, 0xcf, 0xf7 }
+ },
+ {
+ .copy_previous_vector = 1,
+ .digest_length = HMAC_SHA256_128_CHECK_LEN,
+ },
+ {
+ .auth = ODP_AUTH_ALG_SHA256_HMAC,
+ .auth_key_length = HMAC_SHA256_KEY_LEN,
+ /* "Jefe" */
+ .auth_key = { 0x4a, 0x65, 0x66, 0x65 },
+ .length = 28,
+ /* what do ya want for nothing?*/
+ .plaintext = { 0x77, 0x68, 0x61, 0x74, 0x20, 0x64, 0x6f, 0x20,
+ 0x79, 0x61, 0x20, 0x77, 0x61, 0x6e, 0x74, 0x20,
+ 0x66, 0x6f, 0x72, 0x20, 0x6e, 0x6f, 0x74, 0x68,
+ 0x69, 0x6e, 0x67, 0x3f },
+ .ciphertext = { 0x77, 0x68, 0x61, 0x74, 0x20, 0x64, 0x6f, 0x20,
+ 0x79, 0x61, 0x20, 0x77, 0x61, 0x6e, 0x74, 0x20,
+ 0x66, 0x6f, 0x72, 0x20, 0x6e, 0x6f, 0x74, 0x68,
+ 0x69, 0x6e, 0x67, 0x3f },
+ .digest_length = HMAC_SHA256_CHECK_LEN,
+ .digest = { 0x5b, 0xdc, 0xc1, 0x46, 0xbf, 0x60, 0x75, 0x4e,
+ 0x6a, 0x04, 0x24, 0x26, 0x08, 0x95, 0x75, 0xc7,
+ 0x5a, 0x00, 0x3f, 0x08, 0x9d, 0x27, 0x39, 0x83,
+ 0x9d, 0xec, 0x58, 0xb9, 0x64, 0xec, 0x38, 0x43 }
+ },
+ {
+ .copy_previous_vector = 1,
+ .digest_length = HMAC_SHA256_128_CHECK_LEN,
+ },
+ {
+ .auth = ODP_AUTH_ALG_SHA256_HMAC,
+ .auth_key_length = HMAC_SHA256_KEY_LEN,
+ .auth_key = { 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
+ 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
+ 0xaa, 0xaa, 0xaa, 0xaa },
+ .length = 50,
+ .plaintext = { 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
+ 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
+ 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
+ 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
+ 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
+ 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
+ 0xdd, 0xdd },
+ .ciphertext = { 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
+ 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
+ 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
+ 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
+ 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
+ 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
+ 0xdd, 0xdd },
+ .digest_length = HMAC_SHA256_CHECK_LEN,
+ .digest = { 0x77, 0x3e, 0xa9, 0x1e, 0x36, 0x80, 0x0e, 0x46,
+ 0x85, 0x4d, 0xb8, 0xeb, 0xd0, 0x91, 0x81, 0xa7,
+ 0x29, 0x59, 0x09, 0x8b, 0x3e, 0xf8, 0xc1, 0x22,
+ 0xd9, 0x63, 0x55, 0x14, 0xce, 0xd5, 0x65, 0xfe }
+ },
+ {
+ .copy_previous_vector = 1,
+ .digest_length = HMAC_SHA256_128_CHECK_LEN,
+ },
+};
+
+static crypto_test_reference_t hmac_sha384_reference[] = {
+ {
+ .auth = ODP_AUTH_ALG_SHA384_HMAC,
+ .auth_key_length = HMAC_SHA384_KEY_LEN,
+ .auth_key = { 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
+ 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
+ 0x0b, 0x0b, 0x0b, 0x0b },
+ .length = 8,
+ /* "Hi There" */
+ .plaintext = { 0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65},
+ .ciphertext = { 0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65},
+ .digest_length = HMAC_SHA384_CHECK_LEN,
+ .digest = { 0xaf, 0xd0, 0x39, 0x44, 0xd8, 0x48, 0x95, 0x62,
+ 0x6b, 0x08, 0x25, 0xf4, 0xab, 0x46, 0x90, 0x7f,
+ 0x15, 0xf9, 0xda, 0xdb, 0xe4, 0x10, 0x1e, 0xc6,
+ 0x82, 0xaa, 0x03, 0x4c, 0x7c, 0xeb, 0xc5, 0x9c,
+ 0xfa, 0xea, 0x9e, 0xa9, 0x07, 0x6e, 0xde, 0x7f,
+ 0x4a, 0xf1, 0x52, 0xe8, 0xb2, 0xfa, 0x9c, 0xb6 }
+ },
+ {
+ .copy_previous_vector = 1,
+ .digest_length = HMAC_SHA384_192_CHECK_LEN,
+ },
+ {
+ .auth = ODP_AUTH_ALG_SHA384_HMAC,
+ .auth_key_length = HMAC_SHA384_KEY_LEN,
+ /* "Jefe" */
+ .auth_key = { 0x4a, 0x65, 0x66, 0x65 },
+ .length = 28,
+ /* what do ya want for nothing?*/
+ .plaintext = { 0x77, 0x68, 0x61, 0x74, 0x20, 0x64, 0x6f, 0x20,
+ 0x79, 0x61, 0x20, 0x77, 0x61, 0x6e, 0x74, 0x20,
+ 0x66, 0x6f, 0x72, 0x20, 0x6e, 0x6f, 0x74, 0x68,
+ 0x69, 0x6e, 0x67, 0x3f },
+ .ciphertext = { 0x77, 0x68, 0x61, 0x74, 0x20, 0x64, 0x6f, 0x20,
+ 0x79, 0x61, 0x20, 0x77, 0x61, 0x6e, 0x74, 0x20,
+ 0x66, 0x6f, 0x72, 0x20, 0x6e, 0x6f, 0x74, 0x68,
+ 0x69, 0x6e, 0x67, 0x3f },
+ .digest_length = HMAC_SHA384_CHECK_LEN,
+ .digest = { 0xaf, 0x45, 0xd2, 0xe3, 0x76, 0x48, 0x40, 0x31,
+ 0x61, 0x7f, 0x78, 0xd2, 0xb5, 0x8a, 0x6b, 0x1b,
+ 0x9c, 0x7e, 0xf4, 0x64, 0xf5, 0xa0, 0x1b, 0x47,
+ 0xe4, 0x2e, 0xc3, 0x73, 0x63, 0x22, 0x44, 0x5e,
+ 0x8e, 0x22, 0x40, 0xca, 0x5e, 0x69, 0xe2, 0xc7,
+ 0x8b, 0x32, 0x39, 0xec, 0xfa, 0xb2, 0x16, 0x49 }
+ },
+ {
+ .copy_previous_vector = 1,
+ .digest_length = HMAC_SHA384_192_CHECK_LEN,
+ },
+ {
+ .auth = ODP_AUTH_ALG_SHA384_HMAC,
+ .auth_key_length = HMAC_SHA384_KEY_LEN,
+ .auth_key = { 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
+ 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
+ 0xaa, 0xaa, 0xaa, 0xaa },
+ .length = 50,
+ .plaintext = { 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
+ 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
+ 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
+ 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
+ 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
+ 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
+ 0xdd, 0xdd },
+ .ciphertext = { 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
+ 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
+ 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
+ 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
+ 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
+ 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
+ 0xdd, 0xdd },
+ .digest_length = HMAC_SHA384_CHECK_LEN,
+ .digest = {0x88, 0x06, 0x26, 0x08, 0xd3, 0xe6, 0xad, 0x8a,
+ 0x0a, 0xa2, 0xac, 0xe0, 0x14, 0xc8, 0xa8, 0x6f,
+ 0x0a, 0xa6, 0x35, 0xd9, 0x47, 0xac, 0x9f, 0xeb,
+ 0xe8, 0x3e, 0xf4, 0xe5, 0x59, 0x66, 0x14, 0x4b,
+ 0x2a, 0x5a, 0xb3, 0x9d, 0xc1, 0x38, 0x14, 0xb9,
+ 0x4e, 0x3a, 0xb6, 0xe1, 0x01, 0xa3, 0x4f, 0x27 }
+ },
+ {
+ .copy_previous_vector = 1,
+ .digest_length = HMAC_SHA384_192_CHECK_LEN,
+ },
+};
+
+static crypto_test_reference_t hmac_sha512_reference[] = {
+ {
+ .auth = ODP_AUTH_ALG_SHA512_HMAC,
+ .auth_key_length = HMAC_SHA512_KEY_LEN,
+ .auth_key = { 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
+ 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
+ 0x0b, 0x0b, 0x0b, 0x0b },
+ .length = 8,
+ /* "Hi There" */
+ .plaintext = { 0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65},
+ .ciphertext = { 0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65},
+ .digest_length = HMAC_SHA512_CHECK_LEN,
+ .digest = { 0x87, 0xaa, 0x7c, 0xde, 0xa5, 0xef, 0x61, 0x9d,
+ 0x4f, 0xf0, 0xb4, 0x24, 0x1a, 0x1d, 0x6c, 0xb0,
+ 0x23, 0x79, 0xf4, 0xe2, 0xce, 0x4e, 0xc2, 0x78,
+ 0x7a, 0xd0, 0xb3, 0x05, 0x45, 0xe1, 0x7c, 0xde,
+ 0xda, 0xa8, 0x33, 0xb7, 0xd6, 0xb8, 0xa7, 0x02,
+ 0x03, 0x8b, 0x27, 0x4e, 0xae, 0xa3, 0xf4, 0xe4,
+ 0xbe, 0x9d, 0x91, 0x4e, 0xeb, 0x61, 0xf1, 0x70,
+ 0x2e, 0x69, 0x6c, 0x20, 0x3a, 0x12, 0x68, 0x54 }
+ },
+ {
+ .copy_previous_vector = 1,
+ .digest_length = HMAC_SHA512_256_CHECK_LEN,
+ },
+ {
+ .auth = ODP_AUTH_ALG_SHA512_HMAC,
+ .auth_key_length = HMAC_SHA512_KEY_LEN,
+ /* "Jefe" */
+ .auth_key = { 0x4a, 0x65, 0x66, 0x65 },
+ .length = 28,
+ /* what do ya want for nothing?*/
+ .plaintext = { 0x77, 0x68, 0x61, 0x74, 0x20, 0x64, 0x6f, 0x20,
+ 0x79, 0x61, 0x20, 0x77, 0x61, 0x6e, 0x74, 0x20,
+ 0x66, 0x6f, 0x72, 0x20, 0x6e, 0x6f, 0x74, 0x68,
+ 0x69, 0x6e, 0x67, 0x3f },
+ .ciphertext = { 0x77, 0x68, 0x61, 0x74, 0x20, 0x64, 0x6f, 0x20,
+ 0x79, 0x61, 0x20, 0x77, 0x61, 0x6e, 0x74, 0x20,
+ 0x66, 0x6f, 0x72, 0x20, 0x6e, 0x6f, 0x74, 0x68,
+ 0x69, 0x6e, 0x67, 0x3f },
+ .digest_length = HMAC_SHA512_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d, 0xdd, 0xdd, 0xdd, 0xdd,
+ 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
+ 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
+ 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
+ 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
+ 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
+ 0xdd, 0xdd },
+ .digest_length = HMAC_SHA512_CHECK_LEN,
+ .digest = { 0xfa, 0x73, 0xb0, 0x08, 0x9d, 0x56, 0xa2, 0x84,
+ 0xef, 0xb0, 0xf0, 0x75, 0x6c, 0x89, 0x0b, 0xe9,
+ 0xb1, 0xb5, 0xdb, 0xdd, 0x8e, 0xe8, 0x1a, 0x36,
+ 0x55, 0xf8, 0x3e, 0x33, 0xb2, 0x27, 0x9d, 0x39,
+ 0xbf, 0x3e, 0x84, 0x82, 0x79, 0xa7, 0x22, 0xc8,
+ 0x06, 0xb4, 0x85, 0xa4, 0x7e, 0x67, 0xc8, 0x07,
+ 0xb9, 0x46, 0xa3, 0x37, 0xbe, 0xe8, 0x94, 0x26,
+ 0x74, 0x27, 0x88, 0x59, 0xe1, 0x32, 0x92, 0xfb }
+ },
+ {
+ .copy_previous_vector = 1,
+ .digest_length = HMAC_SHA512_256_CHECK_LEN,
+ },
+};
+
+/*
+ * RFC 3566
+ */
+static crypto_test_reference_t aes_xcbc_reference[] = {
+ /* Test Case #1 */
+ {
+ .auth = ODP_AUTH_ALG_AES_XCBC_MAC,
+ .auth_key_length = AES_XCBC_MAC_KEY_LEN,
+ .auth_key = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f},
+ .length = 0,
+ .digest_length = AES_XCBC_MAC_CHECK_LEN,
+ .digest = {0x75, 0xf0, 0x25, 0x1d, 0x52, 0x8a, 0xc0, 0x1c,
+ 0x45, 0x73, 0xdf, 0xd5, 0x84, 0xd7, 0x9f, 0x29}
+ },
+ {
+ .copy_previous_vector = 1,
+ .digest_length = AES_XCBC_MAC_96_CHECK_LEN,
+ },
+ /* Test Case #2 */
+ {
+ .auth = ODP_AUTH_ALG_AES_XCBC_MAC,
+ .auth_key_length = AES_XCBC_MAC_KEY_LEN,
+ .auth_key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
+ .length = 3,
+ .plaintext = { 0x00, 0x01, 0x02 },
+ .ciphertext = { 0x00, 0x01, 0x02 },
+ .digest_length = AES_XCBC_MAC_CHECK_LEN,
+ .digest = { 0x5b, 0x37, 0x65, 0x80, 0xae, 0x2f, 0x19, 0xaf,
+ 0xe7, 0x21, 0x9c, 0xee, 0xf1, 0x72, 0x75, 0x6f }
+ },
+ {
+ .copy_previous_vector = 1,
+ .digest_length = AES_XCBC_MAC_96_CHECK_LEN,
+ },
+ /* Test Case #3 */
+ {
+ .auth = ODP_AUTH_ALG_AES_XCBC_MAC,
+ .auth_key_length = AES_XCBC_MAC_KEY_LEN,
+ .auth_key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
+ .length = 16,
+ .plaintext = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
+ .ciphertext = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
+ .digest_length = AES_XCBC_MAC_CHECK_LEN,
+ .digest = { 0xd2, 0xa2, 0x46, 0xfa, 0x34, 0x9b, 0x68, 0xa7,
+ 0x99, 0x98, 0xa4, 0x39, 0x4f, 0xf7, 0xa2, 0x63 }
+ },
+ {
+ .copy_previous_vector = 1,
+ .digest_length = AES_XCBC_MAC_96_CHECK_LEN,
+ },
+ /* Test Case #4 */
+ {
+ .auth = ODP_AUTH_ALG_AES_XCBC_MAC,
+ .auth_key_length = AES_XCBC_MAC_KEY_LEN,
+ .auth_key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
+ .length = 20,
+ .plaintext = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x10, 0x11, 0x12, 0x13 },
+ .ciphertext = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x10, 0x11, 0x12, 0x13 },
+ .digest_length = AES_XCBC_MAC_CHECK_LEN,
+ .digest = { 0x47, 0xf5, 0x1b, 0x45, 0x64, 0x96, 0x62, 0x15,
+ 0xb8, 0x98, 0x5c, 0x63, 0x05, 0x5e, 0xd3, 0x08 }
+ },
+ {
+ .copy_previous_vector = 1,
+ .digest_length = AES_XCBC_MAC_96_CHECK_LEN,
+ },
+ /* Test Case #5 */
+ {
+ .auth = ODP_AUTH_ALG_AES_XCBC_MAC,
+ .auth_key_length = AES_XCBC_MAC_KEY_LEN,
+ .auth_key = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f},
+ .length = 32,
+ .plaintext = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f},
+ .ciphertext = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f},
+ .digest_length = AES_XCBC_MAC_CHECK_LEN,
+ .digest = {0xf5, 0x4f, 0x0e, 0xc8, 0xd2, 0xb9, 0xf3, 0xd3,
+ 0x68, 0x07, 0x73, 0x4b, 0xd5, 0x28, 0x3f, 0xd4}
+ },
+ {
+ .copy_previous_vector = 1,
+ .digest_length = AES_XCBC_MAC_96_CHECK_LEN,
+ },
+ /* Test Case #6 */
+ {
+ .auth = ODP_AUTH_ALG_AES_XCBC_MAC,
+ .auth_key_length = AES_XCBC_MAC_KEY_LEN,
+ .auth_key = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f},
+ .length = 34,
+ .plaintext = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
+ 0x20, 0x21},
+ .ciphertext = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
+ 0x20, 0x21},
+ .digest_length = AES_XCBC_MAC_CHECK_LEN,
+ .digest = {0xbe, 0xcb, 0xb3, 0xbc, 0xcd, 0xb5, 0x18, 0xa3,
+ 0x06, 0x77, 0xd5, 0x48, 0x1f, 0xb6, 0xb4, 0xd8}
+ },
+ {
+ .copy_previous_vector = 1,
+ .digest_length = AES_XCBC_MAC_96_CHECK_LEN,
+ },
+ /* Test Case #7 */
+ {
+ .auth = ODP_AUTH_ALG_AES_XCBC_MAC,
+ .auth_key_length = AES_XCBC_MAC_KEY_LEN,
+ .auth_key = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f},
+ .length = 1000,
+ /* Plaintext is 1000 zero bytes. No explicit init needed. */
+ .digest_length = AES_XCBC_MAC_CHECK_LEN,
+ .digest = {0xf0, 0xda, 0xfe, 0xe8, 0x95, 0xdb, 0x30, 0x25,
+ 0x37, 0x61, 0x10, 0x3b, 0x5d, 0x84, 0x52, 0x8f}
+ },
+ {
+ .copy_previous_vector = 1,
+ .digest_length = AES_XCBC_MAC_96_CHECK_LEN,
+ },
+};
+
+/*
+ * Kasumi F8 and F9 test vectors are taken from
+ * 3GPP TS 35.203 V9.0.0 (2009-12)
+ * 3rd Generation Partnership Project;
+ * Technical Specification Group Services and System Aspects;
+ * 3G Security;
+ * Specification of the 3GPP Confidentiality
+ * and Integrity Algorithms;
+ * Document 3: Implementors' Test Data
+ * (Release 9)
+ */
+static crypto_test_reference_t kasumi_f8_reference[] = {
+ {
+ .cipher = ODP_CIPHER_ALG_KASUMI_F8,
+ .cipher_key_length = KASUMI_F8_KEY_LEN,
+ .cipher_key = { 0x5a, 0xcb, 0x1d, 0x64, 0x4c, 0x0d, 0x51, 0x20,
+ 0x4e, 0xa5, 0xf1, 0x45, 0x10, 0x10, 0xd8, 0x52},
+ .cipher_iv_length = KASUMI_F8_IV_LEN,
+ .cipher_iv = { 0xfa, 0x55, 0x6b, 0x26, 0x1c, 0x00, 0x00, 0x00},
+ .length = 120, /* 15 bytes */
+ .is_length_in_bits = true,
+ .plaintext = { 0xad, 0x9c, 0x44, 0x1f, 0x89, 0x0b, 0x38, 0xc4,
+ 0x57, 0xa4, 0x9d, 0x42, 0x14, 0x07, 0xe8 },
+ .ciphertext = { 0x9b, 0xc9, 0x2c, 0xa8, 0x03, 0xc6, 0x7b, 0x28,
+ 0xa1, 0x1a, 0x4b, 0xee, 0x5a, 0x0c, 0x25 }
+ }
+};
+
+static crypto_test_reference_t kasumi_f9_reference[] = {
+ {
+ .auth = ODP_AUTH_ALG_KASUMI_F9,
+ .auth_key_length = KASUMI_F9_KEY_LEN,
+ .auth_key = { 0xc7, 0x36, 0xc6, 0xaa, 0xb2, 0x2b, 0xff, 0xf9,
+ 0x1e, 0x26, 0x98, 0xd2, 0xe2, 0x2a, 0xd5, 0x7e },
+ .auth_iv_length = KASUMI_F9_IV_LEN,
+ .auth_iv = { 0x14, 0x79, 0x3e, 0x41, 0x03, 0x97, 0xe8, 0xfd,
+ 0x01, },
+ .length = 384, /* 48 bytes */
+ .is_length_in_bits = true,
+ .plaintext = { 0xd0, 0xa7, 0xd4, 0x63, 0xdf, 0x9f, 0xb2, 0xb2,
+ 0x78, 0x83, 0x3f, 0xa0, 0x2e, 0x23, 0x5a, 0xa1,
+ 0x72, 0xbd, 0x97, 0x0c, 0x14, 0x73, 0xe1, 0x29,
+ 0x07, 0xfb, 0x64, 0x8b, 0x65, 0x99, 0xaa, 0xa0,
+ 0xb2, 0x4a, 0x03, 0x86, 0x65, 0x42, 0x2b, 0x20,
+ 0xa4, 0x99, 0x27, 0x6a, 0x50, 0x42, 0x70, 0x09},
+ .ciphertext = { 0xd0, 0xa7, 0xd4, 0x63, 0xdf, 0x9f, 0xb2, 0xb2,
+ 0x78, 0x83, 0x3f, 0xa0, 0x2e, 0x23, 0x5a, 0xa1,
+ 0x72, 0xbd, 0x97, 0x0c, 0x14, 0x73, 0xe1, 0x29,
+ 0x07, 0xfb, 0x64, 0x8b, 0x65, 0x99, 0xaa, 0xa0,
+ 0xb2, 0x4a, 0x03, 0x86, 0x65, 0x42, 0x2b, 0x20,
+ 0xa4, 0x99, 0x27, 0x6a, 0x50, 0x42, 0x70, 0x09},
+ .digest_length = KASUMI_F9_DIGEST_LEN,
+ .digest = { 0xdd, 0x7d, 0xfa, 0xdd },
+ }
+};
+
+/*
+ * Snow3G UEA2 & UIA2 test vectors are taken from
+ * Specification of the 3GPP Confidentiality and
+ * Integrity Algorithms UEA2 & UIA2
+ * Document 3: Implementors’ Test Data
+ * Version: 1.1
+ * Date: 25 th October 2012
+ */
+static crypto_test_reference_t snow3g_uea2_reference[] = {
+ {
+ .cipher = ODP_CIPHER_ALG_SNOW3G_UEA2,
+ .cipher_key_length = SNOW3G_UEA2_KEY_LEN,
+ .cipher_key = { 0x5a, 0xcb, 0x1d, 0x64, 0x4c, 0x0d, 0x51, 0x20,
+ 0x4e, 0xa5, 0xf1, 0x45, 0x10, 0x10, 0xd8, 0x52},
+ .cipher_iv_length = SNOW3G_UEA2_IV_LEN,
+ .cipher_iv = { 0xfa, 0x55, 0x6b, 0x26, 0x1c, 0x00, 0x00, 0x00,
+ 0xfa, 0x55, 0x6b, 0x26, 0x1c, 0x00, 0x00, 0x00},
+ .length = 120, /* 15 bytes */
+ .is_length_in_bits = true,
+ .plaintext = { 0xad, 0x9c, 0x44, 0x1f, 0x89, 0x0b, 0x38, 0xc4,
+ 0x57, 0xa4, 0x9d, 0x42, 0x14, 0x07, 0xe8 },
+ .ciphertext = { 0xba, 0x0f, 0x31, 0x30, 0x03, 0x34, 0xc5, 0x6b,
+ 0x52, 0xa7, 0x49, 0x7c, 0xba, 0xc0, 0x46 }
+ }
+};
+
+static crypto_test_reference_t snow3g_uia2_reference[] = {
+ {
+ .auth = ODP_AUTH_ALG_SNOW3G_UIA2,
+ .auth_key_length = SNOW3G_UIA2_KEY_LEN,
+ .auth_key = { 0xc7, 0x36, 0xc6, 0xaa, 0xb2, 0x2b, 0xff, 0xf9,
+ 0x1e, 0x26, 0x98, 0xd2, 0xe2, 0x2a, 0xd5, 0x7e},
+ .auth_iv_length = SNOW3G_UIA2_IV_LEN,
+ .auth_iv = { 0x14, 0x79, 0x3e, 0x41, 0x03, 0x97, 0xe8, 0xfd,
+ 0x94, 0x79, 0x3e, 0x41, 0x03, 0x97, 0x68, 0xfd },
+ .length = 384, /* 48 bytes */
+ .is_length_in_bits = true,
+ .plaintext = { 0xd0, 0xa7, 0xd4, 0x63, 0xdf, 0x9f, 0xb2, 0xb2,
+ 0x78, 0x83, 0x3f, 0xa0, 0x2e, 0x23, 0x5a, 0xa1,
+ 0x72, 0xbd, 0x97, 0x0c, 0x14, 0x73, 0xe1, 0x29,
+ 0x07, 0xfb, 0x64, 0x8b, 0x65, 0x99, 0xaa, 0xa0,
+ 0xb2, 0x4a, 0x03, 0x86, 0x65, 0x42, 0x2b, 0x20,
+ 0xa4, 0x99, 0x27, 0x6a, 0x50, 0x42, 0x70, 0x09},
+ .ciphertext = { 0xd0, 0xa7, 0xd4, 0x63, 0xdf, 0x9f, 0xb2, 0xb2,
+ 0x78, 0x83, 0x3f, 0xa0, 0x2e, 0x23, 0x5a, 0xa1,
+ 0x72, 0xbd, 0x97, 0x0c, 0x14, 0x73, 0xe1, 0x29,
+ 0x07, 0xfb, 0x64, 0x8b, 0x65, 0x99, 0xaa, 0xa0,
+ 0xb2, 0x4a, 0x03, 0x86, 0x65, 0x42, 0x2b, 0x20,
+ 0xa4, 0x99, 0x27, 0x6a, 0x50, 0x42, 0x70, 0x09},
+ .digest_length = SNOW3G_UIA2_DIGEST_LEN,
+ .digest = { 0x38, 0xb5, 0x54, 0xc0 }
+ }
+};
+
+/*
+ * AES EEA2 and AES EIA2 test vectors from
+ * Specification of the 3GPP Confidentiality and Integrity
+ * Algorithms 128-EEA2 & 128-EIA2
+ */
+static crypto_test_reference_t aes_eea2_reference[] = {
+ {
+ .cipher = ODP_CIPHER_ALG_AES_EEA2,
+ .cipher_key_length = AES_EEA2_KEY_LEN,
+ .cipher_key = { 0xD3, 0xC5, 0xD5, 0x92, 0x32, 0x7F, 0xB1, 0x1C,
+ 0x40, 0x35, 0xC6, 0x68, 0x0A, 0xF8, 0xC6, 0xD1},
+ .cipher_iv_length = AES_EEA2_IV_LEN,
+ .cipher_iv = { 0x39, 0x8a, 0x59, 0xb4, 0xac, },
+ .length = 253,
+ .is_length_in_bits = true,
+ .plaintext = { 0x98, 0x1B, 0xA6, 0x82, 0x4C, 0x1B, 0xFB, 0x1A,
+ 0xB4, 0x85, 0x47, 0x20, 0x29, 0xB7, 0x1D, 0x80,
+ 0x8C, 0xE3, 0x3E, 0x2C, 0xC3, 0xC0, 0xB5, 0xFC,
+ 0x1F, 0x3D, 0xE8, 0xA6, 0xDC, 0x66, 0xB1, 0xF0 },
+ .ciphertext = { 0xE9, 0xFE, 0xD8, 0xA6, 0x3D, 0x15, 0x53, 0x04,
+ 0xD7, 0x1D, 0xF2, 0x0B, 0xF3, 0xE8, 0x22, 0x14,
+ 0xB2, 0x0E, 0xD7, 0xDA, 0xD2, 0xF2, 0x33, 0xDC,
+ 0x3C, 0x22, 0xD7, 0xBD, 0xEE, 0xED, 0x8E, 0x78}
+ },
+ {
+ .cipher = ODP_CIPHER_ALG_AES_EEA2,
+ .cipher_key_length = AES_EEA2_KEY_LEN,
+ .cipher_key = { 0x2B, 0xD6, 0x45, 0x9F, 0x82, 0xC4, 0x40, 0xE0,
+ 0x95, 0x2C, 0x49, 0x10, 0x48, 0x05, 0xFF, 0x48},
+ .cipher_iv_length = AES_EEA2_IV_LEN,
+ .cipher_iv = { 0xc6, 0x75, 0xa6, 0x4b, 0x64, },
+ .length = 798,
+ .is_length_in_bits = true,
+ .plaintext = { 0x7E, 0xC6, 0x12, 0x72, 0x74, 0x3B, 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0x87, 0xB8,
+ 0x95, 0x60, 0x86, 0xBC, 0xAB, 0x18, 0x83, 0x60,
+ 0x42, 0xE2, 0xE6, 0xCE, 0x42, 0x43, 0x2A, 0x17,
+ 0x10, 0x5C, 0x53, 0xD0 }
+ },
+};
+
+static crypto_test_reference_t aes_eia2_reference[] = {
+ /* 3GPP TS 33.401, C.2.1 */
+ {
+ .auth = ODP_AUTH_ALG_AES_EIA2,
+ .auth_key_length = AES_EIA2_KEY_LEN,
+ .auth_key = { 0x2b, 0xd6, 0x45, 0x9f, 0x82, 0xc5, 0xb3, 0x00,
+ 0x95, 0x2c, 0x49, 0x10, 0x48, 0x81, 0xff, 0x48 },
+ .auth_iv_length = AES_EIA2_IV_LEN,
+ .auth_iv = { 0x38, 0xa6, 0xf0, 0x56, 0xc0 },
+ .length = 58,
+ .is_length_in_bits = true,
+ .plaintext = { 0x33, 0x32, 0x34, 0x62, 0x63, 0x39, 0x38, 0x40 },
+ .ciphertext = { 0x33, 0x32, 0x34, 0x62, 0x63, 0x39, 0x38, 0x40 },
+ .digest_length = AES_EIA2_DIGEST_LEN,
+ .digest = { 0x11, 0x8c, 0x6e, 0xb8 }
+ },
+ /* 3GPP TS 33.401, C.2.2. */
+ {
+ .auth = ODP_AUTH_ALG_AES_EIA2,
+ .auth_key_length = AES_EIA2_KEY_LEN,
+ .auth_key = { 0xD3, 0xC5, 0xD5, 0x92, 0x32, 0x7F, 0xB1, 0x1C,
+ 0x40, 0x35, 0xC6, 0x68, 0x0A, 0xF8, 0xC6, 0xD1 },
+ .auth_iv_length = AES_EIA2_IV_LEN,
+ .auth_iv = { 0x39, 0x8a, 0x59, 0xb4, 0xd4, },
+ .length = 64, /* 8 bytes */
+ .is_length_in_bits = true,
+ .plaintext = { 0x48, 0x45, 0x83, 0xd5, 0xaf, 0xe0, 0x82, 0xae },
+ .ciphertext = { 0x48, 0x45, 0x83, 0xd5, 0xaf, 0xe0, 0x82, 0xae},
+ .digest_length = AES_EIA2_DIGEST_LEN,
+ .digest = { 0xb9, 0x37, 0x87, 0xe6 }
+ },
+ /* 3GPP TS 33.401, C.2.5 */
+ {
+ .auth = ODP_AUTH_ALG_AES_EIA2,
+ .auth_key_length = AES_EIA2_KEY_LEN,
+ .auth_key = { 0x83, 0xfd, 0x23, 0xa2, 0x44, 0xa7, 0x4c, 0xf3,
+ 0x58, 0xda, 0x30, 0x19, 0xf1, 0x72, 0x26, 0x35 },
+ .auth_iv_length = AES_EIA2_IV_LEN,
+ .auth_iv = { 0x36, 0xaf, 0x61, 0x44, 0x7c },
+ .length = 768, /* 96 bytes */
+ .is_length_in_bits = true,
+ .plaintext = { 0x35, 0xc6, 0x87, 0x16, 0x63, 0x3c, 0x66, 0xfb,
+ 0x75, 0x0c, 0x26, 0x68, 0x65, 0xd5, 0x3c, 0x11,
+ 0xea, 0x05, 0xb1, 0xe9, 0xfa, 0x49, 0xc8, 0x39,
+ 0x8d, 0x48, 0xe1, 0xef, 0xa5, 0x90, 0x9d, 0x39,
+ 0x47, 0x90, 0x28, 0x37, 0xf5, 0xae, 0x96, 0xd5,
+ 0xa0, 0x5b, 0xc8, 0xd6, 0x1c, 0xa8, 0xdb, 0xef,
+ 0x1b, 0x13, 0xa4, 0xb4, 0xab, 0xfe, 0x4f, 0xb1,
+ 0x00, 0x60, 0x45, 0xb6, 0x74, 0xbb, 0x54, 0x72,
+ 0x93, 0x04, 0xc3, 0x82, 0xbe, 0x53, 0xa5, 0xaf,
+ 0x05, 0x55, 0x61, 0x76, 0xf6, 0xea, 0xa2, 0xef,
+ 0x1d, 0x05, 0xe4, 0xb0, 0x83, 0x18, 0x1e, 0xe6,
+ 0x74, 0xcd, 0xa5, 0xa4, 0x85, 0xf7, 0x4d, 0x7a },
+ .ciphertext = { 0x35, 0xc6, 0x87, 0x16, 0x63, 0x3c, 0x66, 0xfb,
+ 0x75, 0x0c, 0x26, 0x68, 0x65, 0xd5, 0x3c, 0x11,
+ 0xea, 0x05, 0xb1, 0xe9, 0xfa, 0x49, 0xc8, 0x39,
+ 0x8d, 0x48, 0xe1, 0xef, 0xa5, 0x90, 0x9d, 0x39,
+ 0x47, 0x90, 0x28, 0x37, 0xf5, 0xae, 0x96, 0xd5,
+ 0xa0, 0x5b, 0xc8, 0xd6, 0x1c, 0xa8, 0xdb, 0xef,
+ 0x1b, 0x13, 0xa4, 0xb4, 0xab, 0xfe, 0x4f, 0xb1,
+ 0x00, 0x60, 0x45, 0xb6, 0x74, 0xbb, 0x54, 0x72,
+ 0x93, 0x04, 0xc3, 0x82, 0xbe, 0x53, 0xa5, 0xaf,
+ 0x05, 0x55, 0x61, 0x76, 0xf6, 0xea, 0xa2, 0xef,
+ 0x1d, 0x05, 0xe4, 0xb0, 0x83, 0x18, 0x1e, 0xe6,
+ 0x74, 0xcd, 0xa5, 0xa4, 0x85, 0xf7, 0x4d, 0x7a },
+ .digest_length = AES_EIA2_DIGEST_LEN,
+ .digest = { 0xe6, 0x57, 0xe1, 0x82 }
+ },
+};
+
+/*
+ * ZUC EEA3 and EIA3 test vectors from
+ * Specification of the 3GPP Confidentiality and Integrity
+ * Algorithms 128-EEA3 & 128-EIA3
+ * Document 3: Implementor’s Test Data
+ * Version: 1.1
+ * Date: 4 th Jan. 2011
+ */
+static crypto_test_reference_t zuc_eea3_reference[] = {
+ {
+ .cipher = ODP_CIPHER_ALG_ZUC_EEA3,
+ .cipher_key_length = ZUC_EEA3_KEY_LEN,
+ .cipher_key = { 0xe5, 0xbd, 0x3e, 0xa0, 0xeb, 0x55, 0xad, 0xe8,
+ 0x66, 0xc6, 0xac, 0x58, 0xbd, 0x54, 0x30, 0x2a},
+ .cipher_iv_length = ZUC_EEA3_IV_LEN,
+ .cipher_iv = { 0x00, 0x05, 0x68, 0x23, 0xc4, 0x00, 0x00, 0x00,
+ 0x00, 0x05, 0x68, 0x23, 0xc4, 0x00, 0x00, 0x00 },
+ .length = 800, /* 100 bytes */
+ .is_length_in_bits = true,
+ .plaintext = { 0x14, 0xa8, 0xef, 0x69, 0x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xb2, 0xf2, 0xbc, 0xa6,
+ 0xdf, 0x5a, 0x47, 0x3a, 0x57, 0xa4, 0xa0, 0x0d,
+ 0x98, 0x5e, 0xba, 0xd8, 0x80, 0xd6, 0xf2, 0x38,
+ 0x64, 0xa0, 0x7b, 0x01 }
+ },
+
+ /* Privately generated test data */
+ {
+ .cipher = ODP_CIPHER_ALG_ZUC_EEA3,
+ .cipher_key_length = ZUC_EEA3_256_KEY_LEN,
+ .cipher_key = { 0xf7, 0xb4, 0x04, 0x5a, 0x81, 0x5c, 0x1b, 0x01,
+ 0x82, 0xf9, 0xf4, 0x26, 0x80, 0xd4, 0x56, 0x26,
+ 0xd5, 0xf7, 0x4b, 0x68, 0x48, 0x6b, 0x92, 0x6a,
+ 0x34, 0x1f, 0x86, 0x66, 0x60, 0x0a, 0xfc, 0x57},
+ .cipher_iv_length = ZUC_EEA3_256_IV_LEN,
+ .cipher_iv = { 0x8e, 0x5d, 0xbc, 0x3f, 0xb9, 0xae, 0x66, 0xa3,
+ 0xb9, 0x5c, 0x12, 0x14, 0xdb, 0xc5, 0xbc, 0x18,
+ 0x48, 0x12, 0x09, 0x06, 0x25, 0x33, 0x2e, 0x12,
+ 0x12 },
+ .length = 1024,
+ .is_length_in_bits = true,
+ .plaintext = { 0x36, 0xdb, 0x63, 0x68, 0xb5, 0x1f, 0x4e, 0x92,
+ 0x46, 0x1f, 0xde, 0xdb, 0xc2, 0xec, 0xfa, 0x7e,
+ 0x49, 0x85, 0x77, 0xaa, 0x46, 0x98, 0x30, 0x2d,
+ 0x3b, 0xc4, 0x11, 0x24, 0x98, 0x20, 0xa9, 0xce,
+ 0xfb, 0x0d, 0x36, 0xb0, 0x2c, 0x85, 0x42, 0x72,
+ 0xa4, 0x21, 0x4e, 0x66, 0x0d, 0x48, 0xe4, 0x57,
+ 0xce, 0x5b, 0x01, 0x14, 0xf3, 0x31, 0x42, 0x2e,
+ 0xf5, 0x53, 0x52, 0x8d, 0x73, 0xfc, 0x5c, 0x6e,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a, 0x6d, 0x01, 0xe3, 0x6c, 0xb9, 0x76,
+ 0x80, 0x53, 0xbb, 0x27, 0xb8, 0x18, 0x47, 0x6c,
+ 0xae, 0xb5, 0x44, 0x60, 0x43, 0x9d, 0xa7, 0x3f }
+ },
+ /* Privately generated test data */
+ {
+ .cipher = ODP_CIPHER_ALG_ZUC_EEA3,
+ .cipher_key_length = ZUC_EEA3_256_KEY_LEN,
+ .cipher_key = { 0x1d, 0x0f, 0x0e, 0x75, 0x86, 0xb3, 0xfc, 0x65,
+ 0x94, 0xbf, 0xaa, 0xa8, 0xf5, 0xd0, 0x0f, 0xe8,
+ 0x14, 0x7a, 0x96, 0x61, 0x15, 0x49, 0x79, 0x71,
+ 0x13, 0x82, 0xb4, 0xae, 0x34, 0x04, 0x75, 0x51 },
+ .cipher_iv_length = ZUC_EEA3_256_IV_LEN,
+ .cipher_iv = { 0x98, 0xcc, 0x89, 0x9f, 0xaf, 0x6d, 0x64, 0xb6,
+ 0xb1, 0xe8, 0x21, 0x72, 0xee, 0xb6, 0xcc, 0xe3,
+ 0xcf, 0x32, 0x28, 0x21, 0x21, 0x0d, 0x1e, 0x1c,
+ 0x34 },
+ .length = 1928,
+ .is_length_in_bits = true,
+ .plaintext = { 0xa4, 0xcb, 0x6e, 0x76, 0x99, 0xfb, 0x0c, 0xab,
+ 0x6d, 0x57, 0xb1, 0x69, 0xc0, 0x47, 0x80, 0x63,
+ 0x00, 0xe1, 0xf9, 0x51, 0x10, 0xbe, 0xc0, 0x0f,
+ 0x99, 0x62, 0x2d, 0x71, 0xca, 0x75, 0xa0, 0x6e,
+ 0x41, 0x0e, 0xe4, 0xda, 0x09, 0xf1, 0x86, 0x76,
+ 0x48, 0x37, 0xe0, 0x08, 0x7e, 0x60, 0x6c, 0x7f,
+ 0x41, 0x65, 0xd0, 0x51, 0x24, 0x91, 0x61, 0xbd,
+ 0xf3, 0x8e, 0x2e, 0xbd, 0x04, 0xce, 0x2b, 0x45,
+ 0xdc, 0x0f, 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x40, 0x75, 0xeb, 0x12, 0xcf, 0x26, 0x5c,
+ 0x5f, 0xa3, 0x3c, 0xb6, 0x12, 0x45, 0xf3, 0x0a,
+ 0x38, 0x09, 0xa8, 0x36, 0x32, 0x4a, 0x2f, 0xad,
+ 0x50, 0x11, 0x38, 0xba, 0x8f, 0xdd, 0xd1, 0x58,
+ 0xd7, 0x3d, 0x3a, 0x40, 0x7c, 0x3f, 0xa7, 0x98,
+ 0xf3, 0x12, 0x7f, 0x9f, 0x89, 0xcf, 0x48, 0x58,
+ 0x01, 0xeb, 0x98, 0x7c, 0x59, 0x11, 0x9f, 0x57,
+ 0x74, 0x5f, 0x70, 0x72, 0x74, 0xa4, 0x82, 0x3c,
+ 0x36, 0xe6, 0x31, 0x9e, 0xba, 0x7b, 0x53, 0xfc,
+ 0x56 }
+ },
+};
+
+static crypto_test_reference_t zuc_eia3_reference[] = {
+ {
+ .auth = ODP_AUTH_ALG_ZUC_EIA3,
+ .auth_key_length = ZUC_EIA3_KEY_LEN,
+ .auth_key = { 0xc9, 0xe6, 0xce, 0xc4, 0x60, 0x7c, 0x72, 0xdb,
+ 0x00, 0x0a, 0xef, 0xa8, 0x83, 0x85, 0xab, 0x0a },
+ .auth_iv_length = ZUC_EIA3_IV_LEN,
+ .auth_iv = { 0xa9, 0x40, 0x59, 0xda, 0x50, 0x00, 0x00, 0x00,
+ 0x29, 0x40, 0x59, 0xda, 0x50, 0x00, 0x80, 0x00 },
+ .length = 584, /* 73 bytes */
+ .is_length_in_bits = true,
+ .plaintext = { 0x98, 0x3b, 0x41, 0xd4, 0x7d, 0x78, 0x0c, 0x9e,
+ 0x1a, 0xd1, 0x1d, 0x7e, 0xb7, 0x03, 0x91, 0xb1,
+ 0xde, 0x0b, 0x35, 0xda, 0x2d, 0xc6, 0x2f, 0x83,
+ 0xe7, 0xb7, 0x8d, 0x63, 0x06, 0xca, 0x0e, 0xa0,
+ 0x7e, 0x94, 0x1b, 0x7b, 0xe9, 0x13, 0x48, 0xf9,
+ 0xfc, 0xb1, 0x70, 0xe2, 0x21, 0x7f, 0xec, 0xd9,
+ 0x7f, 0x9f, 0x68, 0xad, 0xb1, 0x6e, 0x5d, 0x7d,
+ 0x21, 0xe5, 0x69, 0xd2, 0x80, 0xed, 0x77, 0x5c,
+ 0xeb, 0xde, 0x3f, 0x40, 0x93, 0xc5, 0x38, 0x81,
+ 0x00, 0x00, 0x00, 0x00 },
+ .ciphertext = { 0x98, 0x3b, 0x41, 0xd4, 0x7d, 0x78, 0x0c, 0x9e,
+ 0x1a, 0xd1, 0x1d, 0x7e, 0xb7, 0x03, 0x91, 0xb1,
+ 0xde, 0x0b, 0x35, 0xda, 0x2d, 0xc6, 0x2f, 0x83,
+ 0xe7, 0xb7, 0x8d, 0x63, 0x06, 0xca, 0x0e, 0xa0,
+ 0x7e, 0x94, 0x1b, 0x7b, 0xe9, 0x13, 0x48, 0xf9,
+ 0xfc, 0xb1, 0x70, 0xe2, 0x21, 0x7f, 0xec, 0xd9,
+ 0x7f, 0x9f, 0x68, 0xad, 0xb1, 0x6e, 0x5d, 0x7d,
+ 0x21, 0xe5, 0x69, 0xd2, 0x80, 0xed, 0x77, 0x5c,
+ 0xeb, 0xde, 0x3f, 0x40, 0x93, 0xc5, 0x38, 0x81,
+ 0x00, 0x00, 0x00, 0x00 },
+ .digest_length = ZUC_EIA3_DIGEST_LEN,
+ .digest = { 0x24, 0xa8, 0x42, 0xb3 }
+ },
+ /* Privately generated test data */
+ {
+ .auth = ODP_AUTH_ALG_ZUC_EIA3,
+ .auth_key_length = ZUC_EIA3_256_KEY_LEN,
+ .auth_key = { 0xe3, 0x8e, 0xaf, 0x08, 0xde, 0x8c, 0x08, 0x41,
+ 0x7f, 0x2b, 0x97, 0x20, 0x10, 0x87, 0xc7, 0xf7,
+ 0xbe, 0x3c, 0xd2, 0x68, 0x80, 0x10, 0x1e, 0x71,
+ 0xfd, 0xb2, 0xbb, 0xad, 0x25, 0x0f, 0x06, 0x08 },
+ .auth_iv_length = ZUC_EIA3_256_IV_LEN,
+ .auth_iv = { 0xf5, 0x8d, 0x08, 0x26, 0x94, 0x14, 0xc7, 0x4d,
+ 0xf5, 0x7c, 0x9c, 0xaa, 0x45, 0x53, 0xfd, 0x85,
+ 0x23, 0x0b, 0x00, 0x0e, 0x26, 0x2b, 0x0f, 0x01,
+ 0x26 },
+ .length = 360,
+ .is_length_in_bits = true,
+ .plaintext = { 0x08, 0xba, 0x8d, 0xf1, 0xf8, 0x62, 0xa6, 0xaf,
+ 0xf9, 0x03, 0x88, 0x9c, 0xa3, 0x68, 0x6b, 0x87,
+ 0xb6, 0x92, 0xd1, 0x47, 0x3e, 0x54, 0xaf, 0x46,
+ 0x07, 0x8f, 0x89, 0xea, 0x26, 0x9d, 0x0e, 0x2f,
+ 0x57, 0x9b, 0x20, 0x4f, 0xfe, 0xc7, 0xfe, 0xf7,
+ 0xca, 0x86, 0x93, 0x6d, 0xee },
+ .ciphertext = { 0x08, 0xba, 0x8d, 0xf1, 0xf8, 0x62, 0xa6, 0xaf,
+ 0xf9, 0x03, 0x88, 0x9c, 0xa3, 0x68, 0x6b, 0x87,
+ 0xb6, 0x92, 0xd1, 0x47, 0x3e, 0x54, 0xaf, 0x46,
+ 0x07, 0x8f, 0x89, 0xea, 0x26, 0x9d, 0x0e, 0x2f,
+ 0x57, 0x9b, 0x20, 0x4f, 0xfe, 0xc7, 0xfe, 0xf7,
+ 0xca, 0x86, 0x93, 0x6d, 0xee },
+ .digest_length = ZUC_EIA3_DIGEST_LEN,
+ .digest = {0x58, 0x19, 0xab, 0xa5}
+ },
+ /* Privately generated test data */
+ {
+ .auth = ODP_AUTH_ALG_ZUC_EIA3,
+ .auth_key_length = ZUC_EIA3_256_KEY_LEN,
+ .auth_key = { 0x6a, 0x7e, 0x4c, 0x7e, 0x51, 0x25, 0xb3, 0x48,
+ 0x84, 0x53, 0x3a, 0x94, 0xfb, 0x31, 0x99, 0x90,
+ 0x32, 0x57, 0x44, 0xee, 0x9b, 0x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, 0x09,
+ 0x42, 0xe5, 0x06, 0xc4, 0x33, 0xaf, 0xcd, 0xa3,
+ 0x84, 0x7f, 0x2d, 0xad, 0xd4, 0x76, 0x47, 0xde,
+ 0x32, 0x1c, 0xec, 0x4a, 0xc4, 0x30, 0xf6, 0x20,
+ 0x23, 0x85, 0x6c, 0xfb, 0xb2, 0x07, 0x04, 0xf4,
+ 0xec, 0x0b, 0xb9, 0x20, 0xba, 0x86, 0xc3, 0x3e,
+ 0x05, 0xf1, 0xec, 0xd9, 0x67, 0x33, 0xb7, 0x99,
+ 0x50, 0xa3, 0xe3, 0x14, 0xd3, 0xd9, 0x34, 0xf7,
+ 0x5e, 0xa0, 0xf2, 0x10, 0xa8, 0xf6, 0x05, 0x94,
+ 0x01, 0xbe, 0xb4, 0xbc, 0x44, 0x78, 0xfa, 0x49,
+ 0x69, 0xe6, 0x23, 0xd0, 0x1a, 0xda, 0x69 },
+ .digest_length = ZUC_EIA3_DIGEST_LEN,
+ .digest = {0xd1, 0x1e, 0x33, 0xf6}
+ },
+};
+
+/*
+ * MD5 test vectors from RFC 1321
+ */
+static crypto_test_reference_t md5_reference[] = {
+ {
+ .auth = ODP_AUTH_ALG_MD5,
+ .length = 3,
+ .plaintext = { 0x61, 0x62, 0x63 },
+ .ciphertext = { 0x61, 0x62, 0x63 },
+ .digest_length = MD5_DIGEST_LEN,
+ .digest = { 0x90, 0x01, 0x50, 0x98, 0x3c, 0xd2, 0x4f, 0xb0,
+ 0xd6, 0x96, 0x3f, 0x7d, 0x28, 0xe1, 0x7f, 0x72}
+ },
+ {
+ .auth = ODP_AUTH_ALG_MD5,
+ .length = 62,
+ .plaintext = { 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
+ 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50,
+ 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
+ 0x59, 0x5a, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66,
+ 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e,
+ 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76,
+ 0x77, 0x78, 0x79, 0x7a, 0x30, 0x31, 0x32, 0x33,
+ 0x34, 0x35, 0x36, 0x37, 0x38, 0x39 },
+ .ciphertext = { 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
+ 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50,
+ 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
+ 0x59, 0x5a, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66,
+ 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e,
+ 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76,
+ 0x77, 0x78, 0x79, 0x7a, 0x30, 0x31, 0x32, 0x33,
+ 0x34, 0x35, 0x36, 0x37, 0x38, 0x39 },
+ .digest_length = MD5_DIGEST_LEN,
+ .digest = { 0xd1, 0x74, 0xab, 0x98, 0xd2, 0x77, 0xd9, 0xf5,
+ 0xa5, 0x61, 0x1c, 0x2c, 0x9f, 0x41, 0x9d, 0x9f},
+ }
+};
+
+/*
+ * SHA test vectors from Crypto++
+ */
+static crypto_test_reference_t sha1_reference[] = {
+ {
+ .auth = ODP_AUTH_ALG_SHA1,
+ .length = 3,
+ .plaintext = { 0x61, 0x62, 0x63 },
+ .ciphertext = { 0x61, 0x62, 0x63 },
+ .digest_length = SHA1_DIGEST_LEN,
+ .digest = { 0xA9, 0x99, 0x3E, 0x36, 0x47, 0x06, 0x81, 0x6A,
+ 0xBA, 0x3E, 0x25, 0x71, 0x78, 0x50, 0xC2, 0x6C,
+ 0x9C, 0xD0, 0xD8, 0x9D},
+ },
+ {
+ .auth = ODP_AUTH_ALG_SHA1,
+ .length = 56,
+ .plaintext = { 0x61, 0x62, 0x63, 0x64, 0x62, 0x63, 0x64, 0x65,
+ 0x63, 0x64, 0x65, 0x66, 0x64, 0x65, 0x66, 0x67,
+ 0x65, 0x66, 0x67, 0x68, 0x66, 0x67, 0x68, 0x69,
+ 0x67, 0x68, 0x69, 0x6a, 0x68, 0x69, 0x6a, 0x6b,
+ 0x69, 0x6a, 0x6b, 0x6c, 0x6a, 0x6b, 0x6c, 0x6d,
+ 0x6b, 0x6c, 0x6d, 0x6e, 0x6c, 0x6d, 0x6e, 0x6f,
+ 0x6d, 0x6e, 0x6f, 0x70, 0x6e, 0x6f, 0x70, 0x71},
+ .ciphertext = { 0x61, 0x62, 0x63, 0x64, 0x62, 0x63, 0x64, 0x65,
+ 0x63, 0x64, 0x65, 0x66, 0x64, 0x65, 0x66, 0x67,
+ 0x65, 0x66, 0x67, 0x68, 0x66, 0x67, 0x68, 0x69,
+ 0x67, 0x68, 0x69, 0x6a, 0x68, 0x69, 0x6a, 0x6b,
+ 0x69, 0x6a, 0x6b, 0x6c, 0x6a, 0x6b, 0x6c, 0x6d,
+ 0x6b, 0x6c, 0x6d, 0x6e, 0x6c, 0x6d, 0x6e, 0x6f,
+ 0x6d, 0x6e, 0x6f, 0x70, 0x6e, 0x6f, 0x70, 0x71},
+ .digest_length = SHA1_DIGEST_LEN,
+ .digest = { 0x84, 0x98, 0x3E, 0x44, 0x1C, 0x3B, 0xD2, 0x6E,
+ 0xBA, 0xAE, 0x4A, 0xA1, 0xF9, 0x51, 0x29, 0xE5,
+ 0xE5, 0x46, 0x70, 0xF1},
+ }
+};
+
+static crypto_test_reference_t sha224_reference[] = {
+ {
+ .auth = ODP_AUTH_ALG_SHA224,
+ .length = 3,
+ .plaintext = { 0x61, 0x62, 0x63 },
+ .ciphertext = { 0x61, 0x62, 0x63 },
+ .digest_length = SHA224_DIGEST_LEN,
+ .digest = { 0x23, 0x09, 0x7d, 0x22, 0x34, 0x05, 0xd8, 0x22,
+ 0x86, 0x42, 0xa4, 0x77, 0xbd, 0xa2, 0x55, 0xb3,
+ 0x2a, 0xad, 0xbc, 0xe4, 0xbd, 0xa0, 0xb3, 0xf7,
+ 0xe3, 0x6c, 0x9d, 0xa7 },
+ },
+ {
+ .auth = ODP_AUTH_ALG_SHA224,
+ .length = 56,
+ .plaintext = { 0x61, 0x62, 0x63, 0x64, 0x62, 0x63, 0x64, 0x65,
+ 0x63, 0x64, 0x65, 0x66, 0x64, 0x65, 0x66, 0x67,
+ 0x65, 0x66, 0x67, 0x68, 0x66, 0x67, 0x68, 0x69,
+ 0x67, 0x68, 0x69, 0x6a, 0x68, 0x69, 0x6a, 0x6b,
+ 0x69, 0x6a, 0x6b, 0x6c, 0x6a, 0x6b, 0x6c, 0x6d,
+ 0x6b, 0x6c, 0x6d, 0x6e, 0x6c, 0x6d, 0x6e, 0x6f,
+ 0x6d, 0x6e, 0x6f, 0x70, 0x6e, 0x6f, 0x70, 0x71},
+ .ciphertext = { 0x61, 0x62, 0x63, 0x64, 0x62, 0x63, 0x64, 0x65,
+ 0x63, 0x64, 0x65, 0x66, 0x64, 0x65, 0x66, 0x67,
+ 0x65, 0x66, 0x67, 0x68, 0x66, 0x67, 0x68, 0x69,
+ 0x67, 0x68, 0x69, 0x6a, 0x68, 0x69, 0x6a, 0x6b,
+ 0x69, 0x6a, 0x6b, 0x6c, 0x6a, 0x6b, 0x6c, 0x6d,
+ 0x6b, 0x6c, 0x6d, 0x6e, 0x6c, 0x6d, 0x6e, 0x6f,
+ 0x6d, 0x6e, 0x6f, 0x70, 0x6e, 0x6f, 0x70, 0x71},
+ .digest_length = SHA224_DIGEST_LEN,
+ .digest = { 0x75, 0x38, 0x8b, 0x16, 0x51, 0x27, 0x76, 0xcc,
+ 0x5d, 0xba, 0x5d, 0xa1, 0xfd, 0x89, 0x01, 0x50,
+ 0xb0, 0xc6, 0x45, 0x5c, 0xb4, 0xf5, 0x8b, 0x19,
+ 0x52, 0x52, 0x25, 0x25},
+ }
+};
+
+static crypto_test_reference_t sha256_reference[] = {
+ {
+ .auth = ODP_AUTH_ALG_SHA256,
+ .length = 3,
+ .plaintext = { 0x61, 0x62, 0x63 },
+ .ciphertext = { 0x61, 0x62, 0x63 },
+ .digest_length = SHA256_DIGEST_LEN,
+ .digest = { 0xba, 0x78, 0x16, 0xbf, 0x8f, 0x01, 0xcf, 0xea,
+ 0x41, 0x41, 0x40, 0xde, 0x5d, 0xae, 0x22, 0x23,
+ 0xb0, 0x03, 0x61, 0xa3, 0x96, 0x17, 0x7a, 0x9c,
+ 0xb4, 0x10, 0xff, 0x61, 0xf2, 0x00, 0x15, 0xad},
+ },
+ {
+ .auth = ODP_AUTH_ALG_SHA256,
+ .length = 56,
+ .plaintext = { 0x61, 0x62, 0x63, 0x64, 0x62, 0x63, 0x64, 0x65,
+ 0x63, 0x64, 0x65, 0x66, 0x64, 0x65, 0x66, 0x67,
+ 0x65, 0x66, 0x67, 0x68, 0x66, 0x67, 0x68, 0x69,
+ 0x67, 0x68, 0x69, 0x6a, 0x68, 0x69, 0x6a, 0x6b,
+ 0x69, 0x6a, 0x6b, 0x6c, 0x6a, 0x6b, 0x6c, 0x6d,
+ 0x6b, 0x6c, 0x6d, 0x6e, 0x6c, 0x6d, 0x6e, 0x6f,
+ 0x6d, 0x6e, 0x6f, 0x70, 0x6e, 0x6f, 0x70, 0x71},
+ .ciphertext = { 0x61, 0x62, 0x63, 0x64, 0x62, 0x63, 0x64, 0x65,
+ 0x63, 0x64, 0x65, 0x66, 0x64, 0x65, 0x66, 0x67,
+ 0x65, 0x66, 0x67, 0x68, 0x66, 0x67, 0x68, 0x69,
+ 0x67, 0x68, 0x69, 0x6a, 0x68, 0x69, 0x6a, 0x6b,
+ 0x69, 0x6a, 0x6b, 0x6c, 0x6a, 0x6b, 0x6c, 0x6d,
+ 0x6b, 0x6c, 0x6d, 0x6e, 0x6c, 0x6d, 0x6e, 0x6f,
+ 0x6d, 0x6e, 0x6f, 0x70, 0x6e, 0x6f, 0x70, 0x71},
+ .digest_length = SHA256_DIGEST_LEN,
+ .digest = { 0x24, 0x8d, 0x6a, 0x61, 0xd2, 0x06, 0x38, 0xb8,
+ 0xe5, 0xc0, 0x26, 0x93, 0x0c, 0x3e, 0x60, 0x39,
+ 0xa3, 0x3c, 0xe4, 0x59, 0x64, 0xff, 0x21, 0x67,
+ 0xf6, 0xec, 0xed, 0xd4, 0x19, 0xdb, 0x06, 0xc1},
+ }
+};
+
+static crypto_test_reference_t sha384_reference[] = {
+ {
+ .auth = ODP_AUTH_ALG_SHA384,
+ .length = 3,
+ .plaintext = { 0x61, 0x62, 0x63 },
+ .ciphertext = { 0x61, 0x62, 0x63 },
+ .digest_length = SHA384_DIGEST_LEN,
+ .digest = { 0xcb, 0x00, 0x75, 0x3f, 0x45, 0xa3, 0x5e, 0x8b,
+ 0xb5, 0xa0, 0x3d, 0x69, 0x9a, 0xc6, 0x50, 0x07,
+ 0x27, 0x2c, 0x32, 0xab, 0x0e, 0xde, 0xd1, 0x63,
+ 0x1a, 0x8b, 0x60, 0x5a, 0x43, 0xff, 0x5b, 0xed,
+ 0x80, 0x86, 0x07, 0x2b, 0xa1, 0xe7, 0xcc, 0x23,
+ 0x58, 0xba, 0xec, 0xa1, 0x34, 0xc8, 0x25, 0xa7},
+ },
+ {
+ .auth = ODP_AUTH_ALG_SHA384,
+ .length = 112,
+ .plaintext = { 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68,
+ 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,
+ 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a,
+ 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b,
+ 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c,
+ 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d,
+ 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e,
+ 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d,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xe8,
+ 0x3d, 0x19, 0x2f, 0xc7, 0x82, 0xcd, 0x1b, 0x47,
+ 0x53, 0x11, 0x1b, 0x17, 0x3b, 0x3b, 0x05, 0xd2,
+ 0x2f, 0xa0, 0x80, 0x86, 0xe3, 0xb0, 0xf7, 0x12,
+ 0xfc, 0xc7, 0xc7, 0x1a, 0x55, 0x7e, 0x2d, 0xb9,
+ 0x66, 0xc3, 0xe9, 0xfa, 0x91, 0x74, 0x60, 0x39},
+ }
+};
+
+static crypto_test_reference_t sha512_reference[] = {
+ {
+ .auth = ODP_AUTH_ALG_SHA512,
+ .length = 3,
+ .plaintext = { 0x61, 0x62, 0x63 },
+ .ciphertext = { 0x61, 0x62, 0x63 },
+ .digest_length = SHA512_DIGEST_LEN,
+ .digest = { 0xdd, 0xaf, 0x35, 0xa1, 0x93, 0x61, 0x7a, 0xba,
+ 0xcc, 0x41, 0x73, 0x49, 0xae, 0x20, 0x41, 0x31,
+ 0x12, 0xe6, 0xfa, 0x4e, 0x89, 0xa9, 0x7e, 0xa2,
+ 0x0a, 0x9e, 0xee, 0xe6, 0x4b, 0x55, 0xd3, 0x9a,
+ 0x21, 0x92, 0x99, 0x2a, 0x27, 0x4f, 0xc1, 0xa8,
+ 0x36, 0xba, 0x3c, 0x23, 0xa3, 0xfe, 0xeb, 0xbd,
+ 0x45, 0x4d, 0x44, 0x23, 0x64, 0x3c, 0xe8, 0x0e,
+ 0x2a, 0x9a, 0xc9, 0x4f, 0xa5, 0x4c, 0xa4, 0x9f},
+ },
+ {
+ .auth = ODP_AUTH_ALG_SHA512,
+ .length = 112,
+ .plaintext = { 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68,
+ 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,
+ 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a,
+ 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b,
+ 0x65, 0x66, 0x67, 0x68,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d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74,
+ 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75},
+ .digest_length = SHA512_DIGEST_LEN,
+ .digest = { 0x8e, 0x95, 0x9b, 0x75, 0xda, 0xe3, 0x13, 0xda,
+ 0x8c, 0xf4, 0xf7, 0x28, 0x14, 0xfc, 0x14, 0x3f,
+ 0x8f, 0x77, 0x79, 0xc6, 0xeb, 0x9f, 0x7f, 0xa1,
+ 0x72, 0x99, 0xae, 0xad, 0xb6, 0x88, 0x90, 0x18,
+ 0x50, 0x1d, 0x28, 0x9e, 0x49, 0x00, 0xf7, 0xe4,
+ 0x33, 0x1b, 0x99, 0xde, 0xc4, 0xb5, 0x43, 0x3a,
+ 0xc7, 0xd3, 0x29, 0xee, 0xb6, 0xdd, 0x26, 0x54,
+ 0x5e, 0x96, 0xe5, 0x5b, 0x87, 0x4b, 0xe9, 0x09},
+ }
+};
+
+#endif
diff --git a/test/validation/api/crypto/test_vectors.h b/test/validation/api/crypto/test_vectors.h
index b9a9c2f06..a38644246 100644
--- a/test/validation/api/crypto/test_vectors.h
+++ b/test/validation/api/crypto/test_vectors.h
@@ -1,17 +1,20 @@
/* Copyright (c) 2014-2018, Linaro Limited
- * Copyright (c) 2021-2022, Nokia
+ * Copyright (c) 2021-2023, Nokia
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
-#ifndef _ODP_TEST_CRYPTO_VECTORS_H_
-#define _ODP_TEST_CRYPTO_VECTORS_H_
+#ifndef TEST_VECTORS_H
+#define TEST_VECTORS_H
+#include <odp_api.h>
#include "test_vectors_len.h"
typedef struct crypto_test_reference_s {
uint8_t copy_previous_vector; /* does not copy digest_length */
+ odp_cipher_alg_t cipher;
+ odp_auth_alg_t auth;
uint32_t cipher_key_length;
uint8_t cipher_key[MAX_KEY_LEN];
uint32_t auth_key_length;
@@ -30,6 +33,9 @@ typedef struct crypto_test_reference_s {
uint8_t digest[MAX_DIGEST_LEN];
} crypto_test_reference_t;
+ODP_STATIC_ASSERT(ODP_CIPHER_ALG_NULL == 0, "null cipher is not the default");
+ODP_STATIC_ASSERT(ODP_AUTH_ALG_NULL == 0, "null auth is not the default");
+
/*
* Return test data length in bytes, rounding up to full bytes.
*/
@@ -46,3039 +52,7 @@ static inline uint32_t ref_length_in_bits(const crypto_test_reference_t *ref)
return ref->is_length_in_bits ? ref->length : 8 * ref->length;
}
-static crypto_test_reference_t null_reference[] = {
- {
- .length = 8,
- .plaintext = { 0x32, 0x6a, 0x49, 0x4c, 0xd3, 0x3f, 0xe7, 0x56 },
- .ciphertext = { 0x32, 0x6a, 0x49, 0x4c, 0xd3, 0x3f, 0xe7, 0x56 }
- },
- {
- .length = 16,
- .plaintext = { 0x84, 0x40, 0x1f, 0x78, 0xfe, 0x6c, 0x10, 0x87,
- 0x6d, 0x8e, 0xa2, 0x30, 0x94, 0xea, 0x53, 0x09 },
- .ciphertext = { 0x84, 0x40, 0x1f, 0x78, 0xfe, 0x6c, 0x10, 0x87,
- 0x6d, 0x8e, 0xa2, 0x30, 0x94, 0xea, 0x53, 0x09 }
- }
-};
-
-/* TDES-CBC reference vectors, according to
- * "http://csrc.nist.gov/groups/STM/cavp/documents/des/DESMMT.pdf"
- */
-static crypto_test_reference_t tdes_cbc_reference[] = {
- {
- .cipher_key_length = TDES_CBC_KEY_LEN,
- .cipher_key = { 0x62, 0x7f, 0x46, 0x0e, 0x08, 0x10, 0x4a, 0x10,
- 0x43, 0xcd, 0x26, 0x5d, 0x58, 0x40, 0xea, 0xf1,
- 0x31, 0x3e, 0xdf, 0x97, 0xdf, 0x2a, 0x8a, 0x8c},
- .cipher_iv_length = TDES_CBC_IV_LEN,
- .cipher_iv = { 0x8e, 0x29, 0xf7, 0x5e, 0xa7, 0x7e, 0x54, 0x75 },
- .length = 8,
- .plaintext = { 0x32, 0x6a, 0x49, 0x4c, 0xd3, 0x3f, 0xe7, 0x56 },
- .ciphertext = { 0xb2, 0x2b, 0x8d, 0x66, 0xde, 0x97, 0x06, 0x92 }
- },
- {
- .cipher_key_length = TDES_CBC_KEY_LEN,
- .cipher_key = { 0x37, 0xae, 0x5e, 0xbf, 0x46, 0xdf, 0xf2, 0xdc,
- 0x07, 0x54, 0xb9, 0x4f, 0x31, 0xcb, 0xb3, 0x85,
- 0x5e, 0x7f, 0xd3, 0x6d, 0xc8, 0x70, 0xbf, 0xae},
- .cipher_iv_length = TDES_CBC_IV_LEN,
- .cipher_iv = {0x3d, 0x1d, 0xe3, 0xcc, 0x13, 0x2e, 0x3b, 0x65 },
- .length = 16,
- .plaintext = { 0x84, 0x40, 0x1f, 0x78, 0xfe, 0x6c, 0x10, 0x87,
- 0x6d, 0x8e, 0xa2, 0x30, 0x94, 0xea, 0x53, 0x09 },
- .ciphertext = { 0x7b, 0x1f, 0x7c, 0x7e, 0x3b, 0x1c, 0x94, 0x8e,
- 0xbd, 0x04, 0xa7, 0x5f, 0xfb, 0xa7, 0xd2, 0xf5 }
- }
-};
-
-/*
- * TDES-ECB reference vectors, according to
- * CAVS 18.0 TECBMMT
- */
-static crypto_test_reference_t tdes_ecb_reference[] = {
- /* CAVS 18.0 TECBMMT2.rsp #0 */
- {
- .cipher_key_length = TDES_ECB_KEY_LEN,
- .cipher_key = { 0x15, 0x1f, 0x10, 0x38, 0x3d, 0x6d, 0x19, 0x9b,
- 0x4a, 0x76, 0x3b, 0xd5, 0x4a, 0x46, 0xa4, 0x45,
- 0x15, 0x1f, 0x10, 0x38, 0x3d, 0x6d, 0x19, 0x9b},
- .length = 8,
- .plaintext = { 0xd8, 0xda, 0x89, 0x29, 0x88, 0x78, 0xed, 0x7d },
- .ciphertext = { 0x89, 0x32, 0x1b, 0xa7, 0x5b, 0xa5, 0x45, 0xdb }
- },
- /* CAVS 18.0 TECBMMT2.rsp #2 */
- {
- .cipher_key_length = TDES_ECB_KEY_LEN,
- .cipher_key = { 0xcd, 0x3d, 0x9b, 0xf7, 0x2f, 0x8c, 0x8a, 0xb5,
- 0xfe, 0xe6, 0x73, 0x34, 0x31, 0x1c, 0xa4, 0x62,
- 0xcd, 0x3d, 0x9b, 0xf7, 0x2f, 0x8c, 0x8a, 0xb5},
- .length = 24,
- .plaintext = { 0x2f, 0x2a, 0x36, 0x1c, 0x8e, 0x14, 0x5d, 0xc0,
- 0xa7, 0x4a, 0x1b, 0xdb, 0x7c, 0xa9, 0x29, 0xc3,
- 0x38, 0x14, 0x4d, 0x89, 0x13, 0x5b, 0x50, 0xa7 },
- .ciphertext = { 0x7f, 0x1f, 0xd3, 0x2b, 0x36, 0x90, 0x05, 0x4b,
- 0xfa, 0x1b, 0x17, 0x35, 0x15, 0x79, 0x33, 0x80,
- 0x99, 0xff, 0xa8, 0x4f, 0xea, 0x16, 0x8c, 0x6b }
- }
-};
-
-static crypto_test_reference_t aes_cbc_reference[] = {
- {
- .cipher_key_length = AES128_KEY_LEN,
- .cipher_key = { 0x06, 0xa9, 0x21, 0x40, 0x36, 0xb8, 0xa1, 0x5b,
- 0x51, 0x2e, 0x03, 0xd5, 0x34, 0x12, 0x00, 0x06},
- .cipher_iv_length = AES_CBC_IV_LEN,
- .cipher_iv = { 0x3d, 0xaf, 0xba, 0x42, 0x9d, 0x9e, 0xb4, 0x30,
- 0xb4, 0x22, 0xda, 0x80, 0x2c, 0x9f, 0xac, 0x41 },
- .length = 16,
- .plaintext = "Single block msg",
- .ciphertext = { 0xe3, 0x53, 0x77, 0x9c, 0x10, 0x79, 0xae, 0xb8,
- 0x27, 0x08, 0x94, 0x2d, 0xbe, 0x77, 0x18, 0x1a }
- },
- {
- .cipher_key_length = AES128_KEY_LEN,
- .cipher_key = { 0xc2, 0x86, 0x69, 0x6d, 0x88, 0x7c, 0x9a, 0xa0,
- 0x61, 0x1b, 0xbb, 0x3e, 0x20, 0x25, 0xa4, 0x5a},
- .cipher_iv_length = AES_CBC_IV_LEN,
- .cipher_iv = { 0x56, 0x2e, 0x17, 0x99, 0x6d, 0x09, 0x3d, 0x28,
- 0xdd, 0xb3, 0xba, 0x69, 0x5a, 0x2e, 0x6f, 0x58 },
- .length = 32,
- .plaintext = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
- 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
- 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f },
- .ciphertext = { 0xd2, 0x96, 0xcd, 0x94, 0xc2, 0xcc, 0xcf, 0x8a,
- 0x3a, 0x86, 0x30, 0x28, 0xb5, 0xe1, 0xdc, 0x0a,
- 0x75, 0x86, 0x60, 0x2d, 0x25, 0x3c, 0xff, 0xf9,
- 0x1b, 0x82, 0x66, 0xbe, 0xa6, 0xd6, 0x1a, 0xb1 }
- },
- {
- .cipher_key_length = AES128_KEY_LEN,
- .cipher_key = { 0x6c, 0x3e, 0xa0, 0x47, 0x76, 0x30, 0xce, 0x21,
- 0xa2, 0xce, 0x33, 0x4a, 0xa7, 0x46, 0xc2, 0xcd},
- .cipher_iv_length = AES_CBC_IV_LEN,
- .cipher_iv = { 0xc7, 0x82, 0xdc, 0x4c, 0x09, 0x8c, 0x66, 0xcb,
- 0xd9, 0xcd, 0x27, 0xd8, 0x25, 0x68, 0x2c, 0x81 },
- .length = 48,
- .plaintext = "This is a 48-byte message (exactly 3 AES blocks)",
- .ciphertext = { 0xd0, 0xa0, 0x2b, 0x38, 0x36, 0x45, 0x17, 0x53,
- 0xd4, 0x93, 0x66, 0x5d, 0x33, 0xf0, 0xe8, 0x86,
- 0x2d, 0xea, 0x54, 0xcd, 0xb2, 0x93, 0xab, 0xc7,
- 0x50, 0x69, 0x39, 0x27, 0x67, 0x72, 0xf8, 0xd5,
- 0x02, 0x1c, 0x19, 0x21, 0x6b, 0xad, 0x52, 0x5c,
- 0x85, 0x79, 0x69, 0x5d, 0x83, 0xba, 0x26, 0x84 }
- },
- {
- .cipher_key_length = AES128_KEY_LEN,
- .cipher_key = { 0x56, 0xe4, 0x7a, 0x38, 0xc5, 0x59, 0x89, 0x74,
- 0xbc, 0x46, 0x90, 0x3d, 0xba, 0x29, 0x03, 0x49},
- .cipher_iv_length = AES_CBC_IV_LEN,
- .cipher_iv = { 0x8c, 0xe8, 0x2e, 0xef, 0xbe, 0xa0, 0xda, 0x3c,
- 0x44, 0x69, 0x9e, 0xd7, 0xdb, 0x51, 0xb7, 0xd9 },
- .length = 64,
- .plaintext = { 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
- 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
- 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7,
- 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
- 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
- 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
- 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7,
- 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf },
- .ciphertext = { 0xc3, 0x0e, 0x32, 0xff, 0xed, 0xc0, 0x77, 0x4e,
- 0x6a, 0xff, 0x6a, 0xf0, 0x86, 0x9f, 0x71, 0xaa,
- 0x0f, 0x3a, 0xf0, 0x7a, 0x9a, 0x31, 0xa9, 0xc6,
- 0x84, 0xdb, 0x20, 0x7e, 0xb0, 0xef, 0x8e, 0x4e,
- 0x35, 0x90, 0x7a, 0xa6, 0x32, 0xc3, 0xff, 0xdf,
- 0x86, 0x8b, 0xb7, 0xb2, 0x9d, 0x3d, 0x46, 0xad,
- 0x83, 0xce, 0x9f, 0x9a, 0x10, 0x2e, 0xe9, 0x9d,
- 0x49, 0xa5, 0x3e, 0x87, 0xf4, 0xc3, 0xda, 0x55 }
- },
- {
- .cipher_key_length = AES192_KEY_LEN,
- .cipher_key = { 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c,
- 0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08,
- 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c},
- .cipher_iv_length = AES_CBC_IV_LEN,
- .cipher_iv = { 0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad,
- 0xde, 0xca, 0xf8, 0x88, 0x01, 0x23, 0x45, 0x67 },
- .length = 32,
- .plaintext = { 0x45, 0x00, 0x00, 0x28, 0xa4, 0xad, 0x40, 0x00,
- 0x40, 0x06, 0x78, 0x80, 0x0a, 0x01, 0x03, 0x8f,
- 0x0a, 0x01, 0x06, 0x12, 0x80, 0x23, 0x06, 0xb8,
- 0xcb, 0x71, 0x26, 0x02, 0xdd, 0x6b, 0xb0, 0x3e },
- .ciphertext = { 0x0d, 0xbe, 0x02, 0xda, 0x68, 0x9c, 0x8f, 0x30,
- 0xce, 0x7c, 0x91, 0x7d, 0x41, 0x08, 0xf6, 0xf1,
- 0x8e, 0x0d, 0x7f, 0x02, 0xb6, 0x80, 0x9a, 0x2d,
- 0x53, 0x1c, 0xc6, 0x98, 0x85, 0xc3, 0x00, 0xe6},
- },
- /* NIST Special Publication 800-38A */
- {
- .cipher_key_length = AES192_KEY_LEN,
- .cipher_key = { 0x8e, 0x73, 0xb0, 0xf7, 0xda, 0x0e, 0x64, 0x52,
- 0xc8, 0x10, 0xf3, 0x2b, 0x80, 0x90, 0x79, 0xe5,
- 0x62, 0xf8, 0xea, 0xd2, 0x52, 0x2c, 0x6b, 0x7b},
- .cipher_iv_length = AES_CBC_IV_LEN,
- .cipher_iv = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
- 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
- .length = 64,
- .plaintext = { 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
- 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
- 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c,
- 0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51,
- 0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11,
- 0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef,
- 0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17,
- 0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10 },
- .ciphertext = { 0x4f, 0x02, 0x1d, 0xb2, 0x43, 0xbc, 0x63, 0x3d,
- 0x71, 0x78, 0x18, 0x3a, 0x9f, 0xa0, 0x71, 0xe8,
- 0xb4, 0xd9, 0xad, 0xa9, 0xad, 0x7d, 0xed, 0xf4,
- 0xe5, 0xe7, 0x38, 0x76, 0x3f, 0x69, 0x14, 0x5a,
- 0x57, 0x1b, 0x24, 0x20, 0x12, 0xfb, 0x7a, 0xe0,
- 0x7f, 0xa9, 0xba, 0xac, 0x3d, 0xf1, 0x02, 0xe0,
- 0x08, 0xb0, 0xe2, 0x79, 0x88, 0x59, 0x88, 0x81,
- 0xd9, 0x20, 0xa9, 0xe6, 0x4f, 0x56, 0x15, 0xcd }
- },
- {
- .cipher_key_length = AES256_KEY_LEN,
- .cipher_key = { 0xab, 0xbc, 0xcd, 0xde, 0xf0, 0x01, 0x12, 0x23,
- 0x34, 0x45, 0x56, 0x67, 0x78, 0x89, 0x9a, 0xab,
- 0xab, 0xbc, 0xcd, 0xde, 0xf0, 0x01, 0x12, 0x23,
- 0x34, 0x45, 0x56, 0x67, 0x78, 0x89, 0x9a, 0xab},
- .cipher_iv_length = AES_CBC_IV_LEN,
- .cipher_iv = { 0x11, 0x22, 0x33, 0x44, 0x01, 0x02, 0x03, 0x04,
- 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c },
- .length = 48,
- .plaintext = { 0x45, 0x00, 0x00, 0x30, 0x69, 0xa6, 0x40, 0x00,
- 0x80, 0x06, 0x26, 0x90, 0xc0, 0xa8, 0x01, 0x02,
- 0x93, 0x89, 0x15, 0x5e, 0x0a, 0x9e, 0x00, 0x8b,
- 0x2d, 0xc5, 0x7e, 0xe0, 0x00, 0x00, 0x00, 0x00,
- 0x70, 0x02, 0x40, 0x00, 0x20, 0xbf, 0x00, 0x00,
- 0x02, 0x04, 0x05, 0xb4, 0x01, 0x01, 0x04, 0x02 },
- .ciphertext = { 0x92, 0x1e, 0x2f, 0x37, 0x36, 0x3c, 0x45, 0xda,
- 0xc9, 0x58, 0xb7, 0x07, 0x06, 0x56, 0x54, 0xc5,
- 0x93, 0x46, 0x90, 0xb8, 0xcf, 0x0d, 0x4f, 0x79,
- 0xf1, 0x32, 0xc2, 0xf7, 0x23, 0xb8, 0x83, 0x09,
- 0xbc, 0x37, 0x1c, 0xeb, 0x95, 0x2c, 0x42, 0x7b,
- 0x39, 0x10, 0xa8, 0x76, 0xfa, 0xbe, 0x91, 0xe9},
- },
- /* NIST Special Publication 800-38A */
- {
- .cipher_key_length = AES256_KEY_LEN,
- .cipher_key = { 0x60, 0x3d, 0xeb, 0x10, 0x15, 0xca, 0x71, 0xbe,
- 0x2b, 0x73, 0xae, 0xf0, 0x85, 0x7d, 0x77, 0x81,
- 0x1f, 0x35, 0x2c, 0x07, 0x3b, 0x61, 0x08, 0xd7,
- 0x2d, 0x98, 0x10, 0xa3, 0x09, 0x14, 0xdf, 0xf4},
- .cipher_iv_length = AES_CBC_IV_LEN,
- .cipher_iv = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
- 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
- .length = 64,
- .plaintext = { 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
- 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
- 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c,
- 0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51,
- 0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11,
- 0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef,
- 0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17,
- 0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10 },
- .ciphertext = { 0xf5, 0x8c, 0x4c, 0x04, 0xd6, 0xe5, 0xf1, 0xba,
- 0x77, 0x9e, 0xab, 0xfb, 0x5f, 0x7b, 0xfb, 0xd6,
- 0x9c, 0xfc, 0x4e, 0x96, 0x7e, 0xdb, 0x80, 0x8d,
- 0x67, 0x9f, 0x77, 0x7b, 0xc6, 0x70, 0x2c, 0x7d,
- 0x39, 0xf2, 0x33, 0x69, 0xa9, 0xd9, 0xba, 0xcf,
- 0xa5, 0x30, 0xe2, 0x63, 0x04, 0x23, 0x14, 0x61,
- 0xb2, 0xeb, 0x05, 0xe2, 0xc3, 0x9b, 0xe9, 0xfc,
- 0xda, 0x6c, 0x19, 0x07, 0x8c, 0x6a, 0x9d, 0x1b }
- }
-};
-
-static crypto_test_reference_t aes_ctr_reference[] = {
- /* RFC3686 https://tools.ietf.org/html/rfc3686 */
- {
- .cipher_key_length = AES128_KEY_LEN,
- .cipher_key = { 0x7E, 0x24, 0x06, 0x78, 0x17, 0xFA, 0xE0, 0xD7,
- 0x43, 0xD6, 0xCE, 0x1F, 0x32, 0x53, 0x91, 0x63},
- .cipher_iv_length = AES_CTR_IV_LEN,
- .cipher_iv = { 0x00, 0x6C, 0xB6, 0xDB, 0xC0, 0x54, 0x3B, 0x59,
- 0xDA, 0x48, 0xD9, 0x0B, 0x00, 0x00, 0x00, 0x01 },
- .length = 32,
- .plaintext = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
- 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
- 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F },
- .ciphertext = { 0x51, 0x04, 0xA1, 0x06, 0x16, 0x8A, 0x72, 0xD9,
- 0x79, 0x0D, 0x41, 0xEE, 0x8E, 0xDA, 0xD3, 0x88,
- 0xEB, 0x2E, 0x1E, 0xFC, 0x46, 0xDA, 0x57, 0xC8,
- 0xFC, 0xE6, 0x30, 0xDF, 0x91, 0x41, 0xBE, 0x28}
- },
- /* NIST Special Publication 800-38A */
- {
- .cipher_key_length = AES128_KEY_LEN,
- .cipher_key = { 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,
- 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c},
- .cipher_iv_length = AES_CTR_IV_LEN,
- .cipher_iv = { 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
- 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff },
- .length = 64,
- .plaintext = { 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
- 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
- 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c,
- 0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51,
- 0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11,
- 0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef,
- 0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17,
- 0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10 },
- .ciphertext = { 0x87, 0x4d, 0x61, 0x91, 0xb6, 0x20, 0xe3, 0x26,
- 0x1b, 0xef, 0x68, 0x64, 0x99, 0x0d, 0xb6, 0xce,
- 0x98, 0x06, 0xf6, 0x6b, 0x79, 0x70, 0xfd, 0xff,
- 0x86, 0x17, 0x18, 0x7b, 0xb9, 0xff, 0xfd, 0xff,
- 0x5a, 0xe4, 0xdf, 0x3e, 0xdb, 0xd5, 0xd3, 0x5e,
- 0x5b, 0x4f, 0x09, 0x02, 0x0d, 0xb0, 0x3e, 0xab,
- 0x1e, 0x03, 0x1d, 0xda, 0x2f, 0xbe, 0x03, 0xd1,
- 0x79, 0x21, 0x70, 0xa0, 0xf3, 0x00, 0x9c, 0xee }
- },
- /* Generated by Crypto++ 5.6.1 (715 bytes data)*/
- {
- .cipher_key_length = AES128_KEY_LEN,
- .cipher_key = { 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,
- 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c},
- .cipher_iv_length = AES_CTR_IV_LEN,
- .cipher_iv = { 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
- 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff },
- .length = 715,
- .plaintext = { 0x00, 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f,
- 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17,
- 0x2a, 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac,
- 0x9c, 0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e,
- 0x51, 0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4,
- 0x11, 0xe5, 0xfb, 0xc1, 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_key = { 0x02, 0xBF, 0x39, 0x1E, 0xE8, 0xEC, 0xB1, 0x59,
- 0xB9, 0x59, 0x61, 0x7B, 0x09, 0x65, 0x27, 0x9B,
- 0xF5, 0x9B, 0x60, 0xA7, 0x86, 0xD3, 0xE0, 0xFE},
- .cipher_iv_length = AES_CTR_IV_LEN,
- .cipher_iv = { 0x00, 0x07, 0xBD, 0xFD, 0x5C, 0xBD, 0x60, 0x27,
- 0x8D, 0xCC, 0x09, 0x12, 0x00, 0x00, 0x00, 0x01 },
- .length = 36,
- .plaintext = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
- 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
- 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F,
- 0x20, 0x21, 0x22, 0x23 },
- .ciphertext = { 0x96, 0x89, 0x3F, 0xC5, 0x5E, 0x5C, 0x72, 0x2F,
- 0x54, 0x0B, 0x7D, 0xD1, 0xDD, 0xF7, 0xE7, 0x58,
- 0xD2, 0x88, 0xBC, 0x95, 0xC6, 0x91, 0x65, 0x88,
- 0x45, 0x36, 0xC8, 0x11, 0x66, 0x2F, 0x21, 0x88,
- 0xAB, 0xEE, 0x09, 0x35 }
- },
- /* NIST Special Publication 800-38A */
- {
- .cipher_key_length = AES192_KEY_LEN,
- .cipher_key = { 0x8e, 0x73, 0xb0, 0xf7, 0xda, 0x0e, 0x64, 0x52,
- 0xc8, 0x10, 0xf3, 0x2b, 0x80, 0x90, 0x79, 0xe5,
- 0x62, 0xf8, 0xea, 0xd2, 0x52, 0x2c, 0x6b, 0x7b},
- .cipher_iv_length = AES_CTR_IV_LEN,
- .cipher_iv = { 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
- 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff },
- .length = 64,
- .plaintext = { 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
- 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
- 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c,
- 0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51,
- 0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11,
- 0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef,
- 0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17,
- 0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10 },
- .ciphertext = { 0x1a, 0xbc, 0x93, 0x24, 0x17, 0x52, 0x1c, 0xa2,
- 0x4f, 0x2b, 0x04, 0x59, 0xfe, 0x7e, 0x6e, 0x0b,
- 0x09, 0x03, 0x39, 0xec, 0x0a, 0xa6, 0xfa, 0xef,
- 0xd5, 0xcc, 0xc2, 0xc6, 0xf4, 0xce, 0x8e, 0x94,
- 0x1e, 0x36, 0xb2, 0x6b, 0xd1, 0xeb, 0xc6, 0x70,
- 0xd1, 0xbd, 0x1d, 0x66, 0x56, 0x20, 0xab, 0xf7,
- 0x4f, 0x78, 0xa7, 0xf6, 0xd2, 0x98, 0x09, 0x58,
- 0x5a, 0x97, 0xda, 0xec, 0x58, 0xc6, 0xb0, 0x50 }
- },
- /* RFC3686 https://tools.ietf.org/html/rfc3686 */
- {
- .cipher_key_length = AES256_KEY_LEN,
- .cipher_key = { 0xFF, 0x7A, 0x61, 0x7C, 0xE6, 0x91, 0x48, 0xE4,
- 0xF1, 0x72, 0x6E, 0x2F, 0x43, 0x58, 0x1D, 0xE2,
- 0xAA, 0x62, 0xD9, 0xF8, 0x05, 0x53, 0x2E, 0xDF,
- 0xF1, 0xEE, 0xD6, 0x87, 0xFB, 0x54, 0x15, 0x3D},
- .cipher_iv_length = AES_CTR_IV_LEN,
- .cipher_iv = { 0x00, 0x1C, 0xC5, 0xB7, 0x51, 0xA5, 0x1D, 0x70,
- 0xA1, 0xC1, 0x11, 0x48, 0x00, 0x00, 0x00, 0x01 },
- .length = 36,
- .plaintext = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
- 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
- 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F,
- 0x20, 0x21, 0x22, 0x23 },
- .ciphertext = { 0xEB, 0x6C, 0x52, 0x82, 0x1D, 0x0B, 0xBB, 0xF7,
- 0xCE, 0x75, 0x94, 0x46, 0x2A, 0xCA, 0x4F, 0xAA,
- 0xB4, 0x07, 0xDF, 0x86, 0x65, 0x69, 0xFD, 0x07,
- 0xF4, 0x8C, 0xC0, 0xB5, 0x83, 0xD6, 0x07, 0x1F,
- 0x1E, 0xC0, 0xE6, 0xB8 },
- },
- /* NIST Special Publication 800-38A */
- {
- .cipher_key_length = AES256_KEY_LEN,
- .cipher_key = { 0x60, 0x3d, 0xeb, 0x10, 0x15, 0xca, 0x71, 0xbe,
- 0x2b, 0x73, 0xae, 0xf0, 0x85, 0x7d, 0x77, 0x81,
- 0x1f, 0x35, 0x2c, 0x07, 0x3b, 0x61, 0x08, 0xd7,
- 0x2d, 0x98, 0x10, 0xa3, 0x09, 0x14, 0xdf, 0xf4},
- .cipher_iv_length = AES_CTR_IV_LEN,
- .cipher_iv = { 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
- 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff },
- .length = 64,
- .plaintext = { 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
- 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
- 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c,
- 0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51,
- 0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11,
- 0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef,
- 0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17,
- 0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10 },
- .ciphertext = { 0x60, 0x1e, 0xc3, 0x13, 0x77, 0x57, 0x89, 0xa5,
- 0xb7, 0xa7, 0xf5, 0x04, 0xbb, 0xf3, 0xd2, 0x28,
- 0xf4, 0x43, 0xe3, 0xca, 0x4d, 0x62, 0xb5, 0x9a,
- 0xca, 0x84, 0xe9, 0x90, 0xca, 0xca, 0xf5, 0xc5,
- 0x2b, 0x09, 0x30, 0xda, 0xa2, 0x3d, 0xe9, 0x4c,
- 0xe8, 0x70, 0x17, 0xba, 0x2d, 0x84, 0x98, 0x8d,
- 0xdf, 0xc9, 0xc5, 0x8d, 0xb6, 0x7a, 0xad, 0xa6,
- 0x13, 0xc2, 0xdd, 0x08, 0x45, 0x79, 0x41, 0xa6 }
- },
-};
-
-static crypto_test_reference_t aes_ecb_reference[] = {
- /* NIST Special Publication 800-38A */
- {
- .cipher_key_length = AES128_KEY_LEN,
- .cipher_key = { 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,
- 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c},
- .length = 64,
- .plaintext = { 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
- 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
- 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c,
- 0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51,
- 0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11,
- 0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef,
- 0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17,
- 0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10},
- .ciphertext = { 0x3a, 0xd7, 0x7b, 0xb4, 0x0d, 0x7a, 0x36, 0x60,
- 0xa8, 0x9e, 0xca, 0xf3, 0x24, 0x66, 0xef, 0x97,
- 0xf5, 0xd3, 0xd5, 0x85, 0x03, 0xb9, 0x69, 0x9d,
- 0xe7, 0x85, 0x89, 0x5a, 0x96, 0xfd, 0xba, 0xaf,
- 0x43, 0xb1, 0xcd, 0x7f, 0x59, 0x8e, 0xce, 0x23,
- 0x88, 0x1b, 0x00, 0xe3, 0xed, 0x03, 0x06, 0x88,
- 0x7b, 0x0c, 0x78, 0x5e, 0x27, 0xe8, 0xad, 0x3f,
- 0x82, 0x23, 0x20, 0x71, 0x04, 0x72, 0x5d, 0xd4 }
- },
- /* Generated by Crypto++ 5.6.1 (528 bytes) */
- {
- .cipher_key_length = AES128_KEY_LEN,
- .cipher_key = { 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,
- 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c},
- .length = 528,
- .plaintext = { 0x00, 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f,
- 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17,
- 0x2a, 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac,
- 0x9c, 0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e,
- 0x51, 0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4,
- 0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0x6A, 0x2B, 0x6D, 0x3A,
- 0x7C, 0xE8, 0x86, 0x68, 0xBE, 0xAD, 0x64, 0x61,
- 0x4E, 0x90, 0x00, 0xAC, 0xFB, 0xA7, 0x9E, 0xB3,
- 0x60, 0x16, 0x06, 0x21, 0x4E, 0x21, 0xE0, 0x8F,
- 0x14, 0xCE, 0x77, 0xE3, 0x6B, 0xB6, 0x6F, 0xE4,
- 0xA0, 0xFC, 0xD2, 0xA2, 0x1B, 0xCA, 0xA2, 0x39,
- 0x1A, 0x9C, 0x20, 0x16, 0xAC, 0x3B, 0xC7, 0xCD,
- 0xF1, 0x43, 0x8E, 0xB6, 0xDD, 0x26, 0x69, 0x66,
- 0x44, 0x58, 0x3E, 0x2B, 0x0A, 0x0C, 0x68, 0x62,
- 0x9D, 0x73, 0x6F, 0x67, 0x23, 0xDF, 0x66, 0x85,
- 0x9C, 0xF8, 0x0B, 0x4E, 0x5B, 0x5C, 0x5B, 0xF0,
- 0x3F, 0x33, 0x4D, 0x65, 0xC4, 0x8D, 0xB3, 0xB2,
- 0x66, 0x0E, 0x2C, 0xE3, 0x3B, 0x51, 0x0F, 0xD6,
- 0x0C, 0x91, 0x2B, 0x85, 0xD1, 0x6A, 0xEE, 0x7C,
- 0xDB, 0xFD, 0xF6, 0x28, 0x5B, 0x0A, 0x77, 0xBA,
- 0xE0, 0x7D, 0x98, 0x7F, 0x9C, 0xE1, 0x72, 0xA5,
- 0x48, 0xE6, 0xBF, 0x0A, 0x30, 0xCF, 0x09, 0x9A,
- 0xA8, 0x2B, 0xE0, 0xA2, 0x5E, 0x0E, 0x89, 0x19 }
- },
- /* NIST Special Publication 800-38A */
- {
- .cipher_key_length = AES192_KEY_LEN,
- .cipher_key = { 0x8e, 0x73, 0xb0, 0xf7, 0xda, 0x0e, 0x64, 0x52,
- 0xc8, 0x10, 0xf3, 0x2b, 0x80, 0x90, 0x79, 0xe5,
- 0x62, 0xf8, 0xea, 0xd2, 0x52, 0x2c, 0x6b, 0x7b},
- .length = 64,
- .plaintext = { 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
- 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
- 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c,
- 0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51,
- 0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11,
- 0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef,
- 0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17,
- 0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10 },
- .ciphertext = { 0xbd, 0x33, 0x4f, 0x1d, 0x6e, 0x45, 0xf2, 0x5f,
- 0xf7, 0x12, 0xa2, 0x14, 0x57, 0x1f, 0xa5, 0xcc,
- 0x97, 0x41, 0x04, 0x84, 0x6d, 0x0a, 0xd3, 0xad,
- 0x77, 0x34, 0xec, 0xb3, 0xec, 0xee, 0x4e, 0xef,
- 0xef, 0x7a, 0xfd, 0x22, 0x70, 0xe2, 0xe6, 0x0a,
- 0xdc, 0xe0, 0xba, 0x2f, 0xac, 0xe6, 0x44, 0x4e,
- 0x9a, 0x4b, 0x41, 0xba, 0x73, 0x8d, 0x6c, 0x72,
- 0xfb, 0x16, 0x69, 0x16, 0x03, 0xc1, 0x8e, 0x0e }
- },
- /* NIST Special Publication 800-38A */
- {
- .cipher_key_length = AES256_KEY_LEN,
- .cipher_key = { 0x60, 0x3d, 0xeb, 0x10, 0x15, 0xca, 0x71, 0xbe,
- 0x2b, 0x73, 0xae, 0xf0, 0x85, 0x7d, 0x77, 0x81,
- 0x1f, 0x35, 0x2c, 0x07, 0x3b, 0x61, 0x08, 0xd7,
- 0x2d, 0x98, 0x10, 0xa3, 0x09, 0x14, 0xdf, 0xf4},
- .length = 64,
- .plaintext = { 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
- 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
- 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c,
- 0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51,
- 0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11,
- 0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef,
- 0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17,
- 0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10 },
- .ciphertext = { 0xf3, 0xee, 0xd1, 0xbd, 0xb5, 0xd2, 0xa0, 0x3c,
- 0x06, 0x4b, 0x5a, 0x7e, 0x3d, 0xb1, 0x81, 0xf8,
- 0x59, 0x1c, 0xcb, 0x10, 0xd4, 0x10, 0xed, 0x26,
- 0xdc, 0x5b, 0xa7, 0x4a, 0x31, 0x36, 0x28, 0x70,
- 0xb6, 0xed, 0x21, 0xb9, 0x9c, 0xa6, 0xf4, 0xf9,
- 0xf1, 0x53, 0xe7, 0xb1, 0xbe, 0xaf, 0xed, 0x1d,
- 0x23, 0x30, 0x4b, 0x7a, 0x39, 0xf9, 0xf3, 0xff,
- 0x06, 0x7d, 0x8d, 0x8f, 0x9e, 0x24, 0xec, 0xc7}
- }
-};
-
-static crypto_test_reference_t aes_cfb128_reference[] = {
- /* NIST Special Publication 800-38A */
- {
- .cipher_key_length = AES128_KEY_LEN,
- .cipher_key = { 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,
- 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c},
- .cipher_iv_length = AES_CFB128_IV_LEN,
- .cipher_iv = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
- 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
- .length = 64,
- .plaintext = { 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
- 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
- 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c,
- 0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51,
- 0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11,
- 0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef,
- 0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17,
- 0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10},
- .ciphertext = { 0x3b, 0x3f, 0xd9, 0x2e, 0xb7, 0x2d, 0xad, 0x20,
- 0x33, 0x34, 0x49, 0xf8, 0xe8, 0x3c, 0xfb, 0x4a,
- 0xc8, 0xa6, 0x45, 0x37, 0xa0, 0xb3, 0xa9, 0x3f,
- 0xcd, 0xe3, 0xcd, 0xad, 0x9f, 0x1c, 0xe5, 0x8b,
- 0x26, 0x75, 0x1f, 0x67, 0xa3, 0xcb, 0xb1, 0x40,
- 0xb1, 0x80, 0x8c, 0xf1, 0x87, 0xa4, 0xf4, 0xdf,
- 0xc0, 0x4b, 0x05, 0x35, 0x7c, 0x5d, 0x1c, 0x0e,
- 0xea, 0xc4, 0xc6, 0x6f, 0x9f, 0xf7, 0xf2, 0xe6 }
- },
- /* NIST Special Publication 800-38A */
- {
- .cipher_key_length = AES192_KEY_LEN,
- .cipher_key = { 0x8e, 0x73, 0xb0, 0xf7, 0xda, 0x0e, 0x64, 0x52,
- 0xc8, 0x10, 0xf3, 0x2b, 0x80, 0x90, 0x79, 0xe5,
- 0x62, 0xf8, 0xea, 0xd2, 0x52, 0x2c, 0x6b, 0x7b},
- .cipher_iv_length = AES_CFB128_IV_LEN,
- .cipher_iv = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
- 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
- .length = 64,
- .plaintext = { 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
- 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
- 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c,
- 0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51,
- 0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11,
- 0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef,
- 0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17,
- 0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10 },
- .ciphertext = { 0xcd, 0xc8, 0x0d, 0x6f, 0xdd, 0xf1, 0x8c, 0xab,
- 0x34, 0xc2, 0x59, 0x09, 0xc9, 0x9a, 0x41, 0x74,
- 0x67, 0xce, 0x7f, 0x7f, 0x81, 0x17, 0x36, 0x21,
- 0x96, 0x1a, 0x2b, 0x70, 0x17, 0x1d, 0x3d, 0x7a,
- 0x2e, 0x1e, 0x8a, 0x1d, 0xd5, 0x9b, 0x88, 0xb1,
- 0xc8, 0xe6, 0x0f, 0xed, 0x1e, 0xfa, 0xc4, 0xc9,
- 0xc0, 0x5f, 0x9f, 0x9c, 0xa9, 0x83, 0x4f, 0xa0,
- 0x42, 0xae, 0x8f, 0xba, 0x58, 0x4b, 0x09, 0xff }
- },
- /* NIST Special Publication 800-38A */
- {
- .cipher_key_length = AES256_KEY_LEN,
- .cipher_key = { 0x60, 0x3d, 0xeb, 0x10, 0x15, 0xca, 0x71, 0xbe,
- 0x2b, 0x73, 0xae, 0xf0, 0x85, 0x7d, 0x77, 0x81,
- 0x1f, 0x35, 0x2c, 0x07, 0x3b, 0x61, 0x08, 0xd7,
- 0x2d, 0x98, 0x10, 0xa3, 0x09, 0x14, 0xdf, 0xf4},
- .cipher_iv_length = AES_CFB128_IV_LEN,
- .cipher_iv = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
- 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
- .length = 64,
- .plaintext = { 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
- 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
- 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c,
- 0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51,
- 0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11,
- 0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef,
- 0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17,
- 0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10 },
- .ciphertext = { 0xdc, 0x7e, 0x84, 0xbf, 0xda, 0x79, 0x16, 0x4b,
- 0x7e, 0xcd, 0x84, 0x86, 0x98, 0x5d, 0x38, 0x60,
- 0x39, 0xff, 0xed, 0x14, 0x3b, 0x28, 0xb1, 0xc8,
- 0x32, 0x11, 0x3c, 0x63, 0x31, 0xe5, 0x40, 0x7b,
- 0xdf, 0x10, 0x13, 0x24, 0x15, 0xe5, 0x4b, 0x92,
- 0xa1, 0x3e, 0xd0, 0xa8, 0x26, 0x7a, 0xe2, 0xf9,
- 0x75, 0xa3, 0x85, 0x74, 0x1a, 0xb9, 0xce, 0xf8,
- 0x20, 0x31, 0x62, 0x3d, 0x55, 0xb1, 0xe4, 0x71 }
- }
-};
-
-static crypto_test_reference_t aes_xts_reference[] = {
- /* CAVS 11.0 XTSGen information, #1 */
- {
- .cipher_key_length = AES128_XTS_KEY_LEN,
- .cipher_key = { 0xa1, 0xb9, 0x0c, 0xba, 0x3f, 0x06, 0xac, 0x35,
- 0x3b, 0x2c, 0x34, 0x38, 0x76, 0x08, 0x17, 0x62,
- 0x09, 0x09, 0x23, 0x02, 0x6e, 0x91, 0x77, 0x18,
- 0x15, 0xf2, 0x9d, 0xab, 0x01, 0x93, 0x2f, 0x2f},
- .cipher_iv_length = AES_XTS_IV_LEN,
- .cipher_iv = { 0x4f, 0xae, 0xf7, 0x11, 0x7c, 0xda, 0x59, 0xc6,
- 0x6e, 0x4b, 0x92, 0x01, 0x3e, 0x76, 0x8a, 0xd5},
- .length = 16,
- .plaintext = { 0xeb, 0xab, 0xce, 0x95, 0xb1, 0x4d, 0x3c, 0x8d,
- 0x6f, 0xb3, 0x50, 0x39, 0x07, 0x90, 0x31, 0x1c},
- .ciphertext = { 0x77, 0x8a, 0xe8, 0xb4, 0x3c, 0xb9, 0x8d, 0x5a,
- 0x82, 0x50, 0x81, 0xd5, 0xbe, 0x47, 0x1c, 0x63}
- },
- /* CAVS 11.0 XTSGen information, #101 */
- {
- .cipher_key_length = AES128_XTS_KEY_LEN,
- .cipher_key = { 0xb7, 0xb9, 0x3f, 0x51, 0x6a, 0xef, 0x29, 0x5e,
- 0xff, 0x3a, 0x29, 0xd8, 0x37, 0xcf, 0x1f, 0x13,
- 0x53, 0x47, 0xe8, 0xa2, 0x1d, 0xae, 0x61, 0x6f,
- 0xf5, 0x06, 0x2b, 0x2e, 0x8d, 0x78, 0xce, 0x5e},
- .cipher_iv_length = AES_XTS_IV_LEN,
- .cipher_iv = { 0x87, 0x3e, 0xde, 0xa6, 0x53, 0xb6, 0x43, 0xbd,
- 0x8b, 0xcf, 0x51, 0x40, 0x31, 0x97, 0xed, 0x14},
- .length = 32,
- .plaintext = { 0x23, 0x6f, 0x8a, 0x5b, 0x58, 0xdd, 0x55, 0xf6,
- 0x19, 0x4e, 0xd7, 0x0c, 0x4a, 0xc1, 0xa1, 0x7f,
- 0x1f, 0xe6, 0x0e, 0xc9, 0xa6, 0xc4, 0x54, 0xd0,
- 0x87, 0xcc, 0xb7, 0x7d, 0x6b, 0x63, 0x8c, 0x47},
- .ciphertext = { 0x22, 0xe6, 0xa3, 0xc6, 0x37, 0x9d, 0xcf, 0x75,
- 0x99, 0xb0, 0x52, 0xb5, 0xa7, 0x49, 0xc7, 0xf7,
- 0x8a, 0xd8, 0xa1, 0x1b, 0x9f, 0x1a, 0xa9, 0x43,
- 0x0c, 0xf3, 0xae, 0xf4, 0x45, 0x68, 0x2e, 0x19}
- },
- /* CAVS 11.0 XTSGen information, #227 TODO (Length 130 bits)*/
- /* {
- .cipher_key_length = AES128_XTS_KEY_LEN,
- .cipher_key = { 0xec, 0x14, 0xc0, 0xa3, 0xb7, 0x72, 0x58, 0x5c,
- 0x15, 0xd4, 0xeb, 0x94, 0xe6, 0x9e, 0x2c, 0x55,
- 0x80, 0xcf, 0x3a, 0x63, 0xc1, 0x7c, 0xe9, 0xda,
- 0xd8, 0x2b, 0xb4, 0x54, 0xe3, 0x87, 0x90, 0x45},
- .cipher_iv_length = AES_XTS_IV_LEN,
- .cipher_iv = { 0x4a, 0x02, 0x87, 0xc2, 0x6e, 0xd2, 0x41, 0x26,
- 0x5b, 0x3a, 0x42, 0xcd, 0xd1, 0x9c, 0xea, 0xe2},
- .length = 17,
- .plaintext = { 0x50, 0x82, 0x64, 0x75, 0x82, 0xc6, 0xe5, 0xa7,
- 0x88, 0x73, 0x6f, 0xc5, 0x90, 0x5e, 0xa5, 0x65,
- 0xc0 },
- .ciphertext = { 0x04, 0x3a, 0xb9, 0xc0, 0x3d, 0x5b, 0x44, 0x13,
- 0x1d, 0x3e, 0x6e, 0xb2, 0x57, 0x61, 0x89, 0xde,
- 0x80 },
- }, */
- /* CAVS 11.0 XTSGen information, #1 */
- {
- .cipher_key_length = AES256_XTS_KEY_LEN,
- .cipher_key = { 0x1e, 0xa6, 0x61, 0xc5, 0x8d, 0x94, 0x3a, 0x0e,
- 0x48, 0x01, 0xe4, 0x2f, 0x4b, 0x09, 0x47, 0x14,
- 0x9e, 0x7f, 0x9f, 0x8e, 0x3e, 0x68, 0xd0, 0xc7,
- 0x50, 0x52, 0x10, 0xbd, 0x31, 0x1a, 0x0e, 0x7c,
- 0xd6, 0xe1, 0x3f, 0xfd, 0xf2, 0x41, 0x8d, 0x8d,
- 0x19, 0x11, 0xc0, 0x04, 0xcd, 0xa5, 0x8d, 0xa3,
- 0xd6, 0x19, 0xb7, 0xe2, 0xb9, 0x14, 0x1e, 0x58,
- 0x31, 0x8e, 0xea, 0x39, 0x2c, 0xf4, 0x1b, 0x08},
- .cipher_iv_length = AES_XTS_IV_LEN,
- .cipher_iv = { 0xad, 0xf8, 0xd9, 0x26, 0x27, 0x46, 0x4a, 0xd2,
- 0xf0, 0x42, 0x8e, 0x84, 0xa9, 0xf8, 0x75, 0x64},
- .length = 32,
- .plaintext = { 0x2e, 0xed, 0xea, 0x52, 0xcd, 0x82, 0x15, 0xe1,
- 0xac, 0xc6, 0x47, 0xe8, 0x10, 0xbb, 0xc3, 0x64,
- 0x2e, 0x87, 0x28, 0x7f, 0x8d, 0x2e, 0x57, 0xe3,
- 0x6c, 0x0a, 0x24, 0xfb, 0xc1, 0x2a, 0x20, 0x2e},
- .ciphertext = { 0xcb, 0xaa, 0xd0, 0xe2, 0xf6, 0xce, 0xa3, 0xf5,
- 0x0b, 0x37, 0xf9, 0x34, 0xd4, 0x6a, 0x9b, 0x13,
- 0x0b, 0x9d, 0x54, 0xf0, 0x7e, 0x34, 0xf3, 0x6a,
- 0xf7, 0x93, 0xe8, 0x6f, 0x73, 0xc6, 0xd7, 0xdb},
- },
- /* CAVS 11.0 XTSGen information, #110 */
- {
- .cipher_key_length = AES256_XTS_KEY_LEN,
- .cipher_key = { 0x6b, 0x19, 0x84, 0xc2, 0x4e, 0x7e, 0xb6, 0x62,
- 0x8e, 0x3a, 0x11, 0xc9, 0xcc, 0xd2, 0x59, 0x40,
- 0x33, 0xa3, 0xa0, 0xd9, 0x01, 0x6e, 0xae, 0x65,
- 0xc2, 0xf2, 0x4e, 0x09, 0xb9, 0xa6, 0x6e, 0x9f,
- 0xe9, 0xd1, 0x63, 0xa5, 0x06, 0xdf, 0xbc, 0xcf,
- 0x2d, 0x93, 0xe8, 0x99, 0x1e, 0x2f, 0xc5, 0x60,
- 0xe1, 0x04, 0x35, 0xb8, 0x90, 0xb5, 0x88, 0x9a,
- 0x50, 0x03, 0xe4, 0xbf, 0x81, 0x7d, 0xc3, 0xe0},
- .cipher_iv_length = AES_XTS_IV_LEN,
- .cipher_iv = { 0x6b, 0xb0, 0xd3, 0xae, 0x4f, 0xa8, 0x6e, 0x43,
- 0x16, 0x19, 0xe4, 0x07, 0xd5, 0x9a, 0xd4, 0xf4},
- .length = 48,
- .plaintext = { 0x6a, 0x74, 0x1a, 0x94, 0x5b, 0xfb, 0xf0, 0xc6,
- 0x7a, 0xfd, 0x43, 0xba, 0x1f, 0x84, 0x18, 0x16,
- 0xc0, 0x99, 0x51, 0x58, 0x05, 0xd0, 0xfc, 0x1f,
- 0x7d, 0xbf, 0x6d, 0xe9, 0x00, 0xe0, 0xaa, 0x7a,
- 0x21, 0x9c, 0x88, 0x56, 0x32, 0x71, 0xb0, 0x09,
- 0xd1, 0xac, 0x90, 0xeb, 0x7d, 0xc9, 0x97, 0x35},
- .ciphertext = { 0xe4, 0x7b, 0xce, 0x29, 0x2b, 0xaa, 0x63, 0xbe,
- 0xf3, 0x16, 0xf6, 0x80, 0xa5, 0xf4, 0x80, 0xa7,
- 0xb8, 0x83, 0xdf, 0xab, 0x6e, 0xd5, 0xa5, 0x7f,
- 0x7e, 0x29, 0xec, 0xb8, 0x9e, 0x35, 0x4a, 0x31,
- 0xc9, 0xb1, 0x74, 0xc4, 0xab, 0xad, 0x6c, 0xba,
- 0xba, 0xba, 0x19, 0x14, 0x0c, 0x46, 0x20, 0xa3},
- },
- /* CAVS 11.0 XTSGen information, #211 TODO: length 140 bits */
- /* {
- .cipher_key_length = AES256_XTS_KEY_LEN,
- .cipher_key = { 0x62, 0xc2, 0xe4, 0xf8, 0x52, 0xa9, 0x3e, 0xea,
- 0x4a, 0x2f, 0x61, 0xe8, 0x67, 0x68, 0x14, 0xf4,
- 0xa8, 0x0d, 0xc4, 0x7e, 0xe1, 0x81, 0x32, 0xc8,
- 0x38, 0xbf, 0x89, 0xa6, 0x18, 0xfd, 0xb8, 0xe2,
- 0x91, 0x3e, 0x2e, 0x5c, 0x32, 0x1b, 0x19, 0xea,
- 0x04, 0xbb, 0xa6, 0x34, 0x7d, 0x22, 0x6f, 0x41,
- 0xdb, 0xee, 0x88, 0x0d, 0x61, 0x67, 0xb8, 0xe1,
- 0xe9, 0x17, 0xfa, 0xf0, 0x46, 0xf0, 0x87, 0x5e},
- .cipher_iv_length = AES_XTS_IV_LEN,
- .cipher_iv = { 0x53, 0x7e, 0xe3, 0xdc, 0x13, 0xce, 0x27, 0xa8,
- 0xd3, 0x0e, 0x6e, 0x42, 0xb5, 0xb9, 0x96, 0xae},
- .length = 18,
- .plaintext = { 0x00, 0xc9, 0xeb, 0x87, 0x78, 0xe0, 0x3d, 0xdd,
- 0x5f, 0x3d, 0xe8, 0xc1, 0x8b, 0x34, 0x8f, 0xac,
- 0x9c, 0x30},
- .ciphertext = { 0x9d, 0x4a, 0x08, 0xac, 0x0f, 0xb4, 0x4e, 0x90,
- 0xd0, 0x5f, 0x62, 0x86, 0x19, 0x3f, 0x3a, 0xab,
- 0xc2, 0x90},
- } */
-};
-
-/* AES-GCM test vectors extracted from
- * https://tools.ietf.org/html/draft-mcgrew-gcm-test-01#section-2
- */
-static crypto_test_reference_t aes_gcm_reference[] = {
- {
- .cipher_key_length = AES128_KEY_LEN,
- .cipher_key = { 0x4c, 0x80, 0xcd, 0xef, 0xbb, 0x5d, 0x10, 0xda,
- 0x90, 0x6a, 0xc7, 0x3c, 0x36, 0x13, 0xa6, 0x34},
- .cipher_iv_length = AES_GCM_IV_LEN,
- .cipher_iv = { 0x2e, 0x44, 0x3b, 0x68, 0x49, 0x56, 0xed, 0x7e,
- 0x3b, 0x24, 0x4c, 0xfe },
- .length = 72,
- .plaintext = { 0x45, 0x00, 0x00, 0x48, 0x69, 0x9a, 0x00, 0x00,
- 0x80, 0x11, 0x4d, 0xb7, 0xc0, 0xa8, 0x01, 0x02,
- 0xc0, 0xa8, 0x01, 0x01, 0x0a, 0x9b, 0xf1, 0x56,
- 0x38, 0xd3, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x04, 0x5f, 0x73, 0x69,
- 0x70, 0x04, 0x5f, 0x75, 0x64, 0x70, 0x03, 0x73,
- 0x69, 0x70, 0x09, 0x63, 0x79, 0x62, 0x65, 0x72,
- 0x63, 0x69, 0x74, 0x79, 0x02, 0x64, 0x6b, 0x00,
- 0x00, 0x21, 0x00, 0x01, 0x01, 0x02, 0x02, 0x01 },
- .ciphertext = { 0xfe, 0xcf, 0x53, 0x7e, 0x72, 0x9d, 0x5b, 0x07,
- 0xdc, 0x30, 0xdf, 0x52, 0x8d, 0xd2, 0x2b, 0x76,
- 0x8d, 0x1b, 0x98, 0x73, 0x66, 0x96, 0xa6, 0xfd,
- 0x34, 0x85, 0x09, 0xfa, 0x13, 0xce, 0xac, 0x34,
- 0xcf, 0xa2, 0x43, 0x6f, 0x14, 0xa3, 0xf3, 0xcf,
- 0x65, 0x92, 0x5b, 0xf1, 0xf4, 0xa1, 0x3c, 0x5d,
- 0x15, 0xb2, 0x1e, 0x18, 0x84, 0xf5, 0xff, 0x62,
- 0x47, 0xae, 0xab, 0xb7, 0x86, 0xb9, 0x3b, 0xce,
- 0x61, 0xbc, 0x17, 0xd7, 0x68, 0xfd, 0x97, 0x32},
- .aad_length = 12,
- .aad = { 0x00, 0x00, 0x43, 0x21, 0x87, 0x65, 0x43, 0x21,
- 0x00, 0x00, 0x00, 0x00 },
- .digest_length = AES_GCM_DIGEST_LEN,
- .digest = { 0x45, 0x90, 0x18, 0x14, 0x8f, 0x6c, 0xbe, 0x72,
- 0x2f, 0xd0, 0x47, 0x96, 0x56, 0x2d, 0xfd, 0xb4 }
- },
- {
- .cipher_key_length = AES128_KEY_LEN,
- .cipher_key = { 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c,
- 0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08},
- .cipher_iv_length = AES_GCM_IV_LEN,
- .cipher_iv = { 0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad,
- 0xde, 0xca, 0xf8, 0x88 },
- .length = 64,
- .plaintext = { 0x45, 0x00, 0x00, 0x3e, 0x69, 0x8f, 0x00, 0x00,
- 0x80, 0x11, 0x4d, 0xcc, 0xc0, 0xa8, 0x01, 0x02,
- 0xc0, 0xa8, 0x01, 0x01, 0x0a, 0x98, 0x00, 0x35,
- 0x00, 0x2a, 0x23, 0x43, 0xb2, 0xd0, 0x01, 0x00,
- 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x03, 0x73, 0x69, 0x70, 0x09, 0x63, 0x79, 0x62,
- 0x65, 0x72, 0x63, 0x69, 0x74, 0x79, 0x02, 0x64,
- 0x6b, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01 },
- .ciphertext = { 0xde, 0xb2, 0x2c, 0xd9, 0xb0, 0x7c, 0x72, 0xc1,
- 0x6e, 0x3a, 0x65, 0xbe, 0xeb, 0x8d, 0xf3, 0x04,
- 0xa5, 0xa5, 0x89, 0x7d, 0x33, 0xae, 0x53, 0x0f,
- 0x1b, 0xa7, 0x6d, 0x5d, 0x11, 0x4d, 0x2a, 0x5c,
- 0x3d, 0xe8, 0x18, 0x27, 0xc1, 0x0e, 0x9a, 0x4f,
- 0x51, 0x33, 0x0d, 0x0e, 0xec, 0x41, 0x66, 0x42,
- 0xcf, 0xbb, 0x85, 0xa5, 0xb4, 0x7e, 0x48, 0xa4,
- 0xec, 0x3b, 0x9b, 0xa9, 0x5d, 0x91, 0x8b, 0xd1},
- .aad_length = 8,
- .aad = { 0x00, 0x00, 0xa5, 0xf8, 0x00, 0x00, 0x00, 0x0a },
- .digest_length = AES_GCM_DIGEST_LEN,
- .digest = { 0x83, 0xb7, 0x0d, 0x3a, 0xa8, 0xbc, 0x6e, 0xe4,
- 0xc3, 0x09, 0xe9, 0xd8, 0x5a, 0x41, 0xad, 0x4a }
- },
- {
- .cipher_key_length = AES128_KEY_LEN,
- .cipher_key = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
- .cipher_iv_length = AES_GCM_IV_LEN,
- .cipher_iv = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00 },
- .length = 64,
- .plaintext = { 0x45, 0x00, 0x00, 0x3c, 0x99, 0xc5, 0x00, 0x00,
- 0x80, 0x01, 0xcb, 0x7a, 0x40, 0x67, 0x93, 0x18,
- 0x01, 0x01, 0x01, 0x01, 0x08, 0x00, 0x07, 0x5c,
- 0x02, 0x00, 0x44, 0x00, 0x61, 0x62, 0x63, 0x64,
- 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c,
- 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74,
- 0x75, 0x76, 0x77, 0x61, 0x62, 0x63, 0x64, 0x65,
- 0x66, 0x67, 0x68, 0x69, 0x01, 0x02, 0x02, 0x01 },
- .ciphertext = { 0x46, 0x88, 0xda, 0xf2, 0xf9, 0x73, 0xa3, 0x92,
- 0x73, 0x29, 0x09, 0xc3, 0x31, 0xd5, 0x6d, 0x60,
- 0xf6, 0x94, 0xab, 0xaa, 0x41, 0x4b, 0x5e, 0x7f,
- 0xf5, 0xfd, 0xcd, 0xff, 0xf5, 0xe9, 0xa2, 0x84,
- 0x45, 0x64, 0x76, 0x49, 0x27, 0x19, 0xff, 0xb6,
- 0x4d, 0xe7, 0xd9, 0xdc, 0xa1, 0xe1, 0xd8, 0x94,
- 0xbc, 0x3b, 0xd5, 0x78, 0x73, 0xed, 0x4d, 0x18,
- 0x1d, 0x19, 0xd4, 0xd5, 0xc8, 0xc1, 0x8a, 0xf3},
- .aad_length = 8,
- .aad = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 },
- .digest_length = AES_GCM_DIGEST_LEN,
- .digest = { 0xf8, 0x21, 0xd4, 0x96, 0xee, 0xb0, 0x96, 0xe9,
- 0x8a, 0xd2, 0xb6, 0x9e, 0x47, 0x99, 0xc7, 0x1d }
- },
- {
- .cipher_key_length = AES128_KEY_LEN,
- .cipher_key = { 0x3d, 0xe0, 0x98, 0x74, 0xb3, 0x88, 0xe6, 0x49,
- 0x19, 0x88, 0xd0, 0xc3, 0x60, 0x7e, 0xae, 0x1f},
- .cipher_iv_length = AES_GCM_IV_LEN,
- .cipher_iv = { 0x57, 0x69, 0x0e, 0x43, 0x4e, 0x28, 0x00, 0x00,
- 0xa2, 0xfc, 0xa1, 0xa3 },
- .length = 28,
- .plaintext = { 0x45, 0x00, 0x00, 0x1c, 0x42, 0xa2, 0x00, 0x00,
- 0x80, 0x01, 0x44, 0x1f, 0x40, 0x67, 0x93, 0xb6,
- 0xe0, 0x00, 0x00, 0x02, 0x0a, 0x00, 0xf5, 0xff,
- 0x01, 0x02, 0x02, 0x01 },
- .ciphertext = { 0xfb, 0xa2, 0xca, 0x84, 0x5e, 0x5d, 0xf9, 0xf0,
- 0xf2, 0x2c, 0x3e, 0x6e, 0x86, 0xdd, 0x83, 0x1e,
- 0x1f, 0xc6, 0x57, 0x92, 0xcd, 0x1a, 0xf9, 0x13,
- 0x0e, 0x13, 0x79, 0xed },
- .aad_length = 12,
- .aad = { 0x42, 0xf6, 0x7e, 0x3f, 0x10, 0x10, 0x10, 0x10,
- 0x10, 0x10, 0x10, 0x10 },
- .digest_length = AES_GCM_DIGEST_LEN,
- .digest = { 0x36, 0x9f, 0x07, 0x1f, 0x35, 0xe0, 0x34, 0xbe,
- 0x95, 0xf1, 0x12, 0xe4, 0xe7, 0xd0, 0x5d, 0x35 }
- },
- {
- .cipher_key_length = AES192_KEY_LEN,
- .cipher_key = { 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c,
- 0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08,
- 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c},
- .cipher_iv_length = AES_GCM_IV_LEN,
- .cipher_iv = { 0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad,
- 0xde, 0xca, 0xf8, 0x88 },
- .length = 40,
- .plaintext = { 0x45, 0x00, 0x00, 0x28, 0xa4, 0xad, 0x40, 0x00,
- 0x40, 0x06, 0x78, 0x80, 0x0a, 0x01, 0x03, 0x8f,
- 0x0a, 0x01, 0x06, 0x12, 0x80, 0x23, 0x06, 0xb8,
- 0xcb, 0x71, 0x26, 0x02, 0xdd, 0x6b, 0xb0, 0x3e,
- 0x50, 0x10, 0x16, 0xd0, 0x75, 0x68, 0x00, 0x01 },
- .ciphertext = { 0xa5, 0xb1, 0xf8, 0x06, 0x60, 0x29, 0xae, 0xa4,
- 0x0e, 0x59, 0x8b, 0x81, 0x22, 0xde, 0x02, 0x42,
- 0x09, 0x38, 0xb3, 0xab, 0x33, 0xf8, 0x28, 0xe6,
- 0x87, 0xb8, 0x85, 0x8b, 0x5b, 0xfb, 0xdb, 0xd0,
- 0x31, 0x5b, 0x27, 0x45, 0x21, 0x44, 0xcc, 0x77},
- .aad_length = 8,
- .aad = { 0x00, 0x00, 0xa5, 0xf8, 0x00, 0x00, 0x00, 0x0a },
- .digest_length = AES_GCM_DIGEST_LEN,
- .digest = { 0x95, 0x45, 0x7b, 0x96, 0x52, 0x03, 0x7f, 0x53,
- 0x18, 0x02, 0x7b, 0x5b, 0x4c, 0xd7, 0xa6, 0x36 }
- },
- {
- .cipher_key_length = AES256_KEY_LEN,
- .cipher_key = { 0xab, 0xbc, 0xcd, 0xde, 0xf0, 0x01, 0x12, 0x23,
- 0x34, 0x45, 0x56, 0x67, 0x78, 0x89, 0x9a, 0xab,
- 0xab, 0xbc, 0xcd, 0xde, 0xf0, 0x01, 0x12, 0x23,
- 0x34, 0x45, 0x56, 0x67, 0x78, 0x89, 0x9a, 0xab},
- .cipher_iv_length = AES_GCM_IV_LEN,
- .cipher_iv = { 0x11, 0x22, 0x33, 0x44, 0x01, 0x02, 0x03, 0x04,
- 0x05, 0x06, 0x07, 0x08 },
- .length = 52,
- .plaintext = { 0x45, 0x00, 0x00, 0x30, 0x69, 0xa6, 0x40, 0x00,
- 0x80, 0x06, 0x26, 0x90, 0xc0, 0xa8, 0x01, 0x02,
- 0x93, 0x89, 0x15, 0x5e, 0x0a, 0x9e, 0x00, 0x8b,
- 0x2d, 0xc5, 0x7e, 0xe0, 0x00, 0x00, 0x00, 0x00,
- 0x70, 0x02, 0x40, 0x00, 0x20, 0xbf, 0x00, 0x00,
- 0x02, 0x04, 0x05, 0xb4, 0x01, 0x01, 0x04, 0x02,
- 0x01, 0x02, 0x02, 0x01 },
- .ciphertext = { 0xff, 0x42, 0x5c, 0x9b, 0x72, 0x45, 0x99, 0xdf,
- 0x7a, 0x3b, 0xcd, 0x51, 0x01, 0x94, 0xe0, 0x0d,
- 0x6a, 0x78, 0x10, 0x7f, 0x1b, 0x0b, 0x1c, 0xbf,
- 0x06, 0xef, 0xae, 0x9d, 0x65, 0xa5, 0xd7, 0x63,
- 0x74, 0x8a, 0x63, 0x79, 0x85, 0x77, 0x1d, 0x34,
- 0x7f, 0x05, 0x45, 0x65, 0x9f, 0x14, 0xe9, 0x9d,
- 0xef, 0x84, 0x2d, 0x8e },
- .aad_length = 8,
- .aad = { 0x4a, 0x2c, 0xbf, 0xe3, 0x00, 0x00, 0x00, 0x02 },
- .digest_length = AES_GCM_DIGEST_LEN,
- .digest = { 0xb3, 0x35, 0xf4, 0xee, 0xcf, 0xdb, 0xf8, 0x31,
- 0x82, 0x4b, 0x4c, 0x49, 0x15, 0x95, 0x6c, 0x96 }
- }
-};
-
-static crypto_test_reference_t aes_ccm_reference[] = {
- /*
- * AES-CCM reference from RFC 3610
- */
- {
- .cipher_key_length = AES128_KEY_LEN,
- .cipher_key = { 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
- 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf},
- .cipher_iv_length = 13,
- .cipher_iv = { 0x00, 0x00, 0x00, 0x03, 0x02, 0x01, 0x00, 0xa0,
- 0xa1, 0xa2, 0xa3, 0xa4, 0xa5 },
- .aad_length = 8,
- .aad = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 },
- .length = 23,
- .plaintext = { 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
- 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e },
- .ciphertext = { 0x58, 0x8c, 0x97, 0x9a, 0x61, 0xc6, 0x63, 0xd2,
- 0xf0, 0x66, 0xd0, 0xc2, 0xc0, 0xf9, 0x89, 0x80,
- 0x6d, 0x5f, 0x6b, 0x61, 0xda, 0xc3, 0x84 },
- .digest_length = 8,
- .digest = { 0x17, 0xe8, 0xd1, 0x2c, 0xfd, 0xf9, 0x26, 0xe0 }
- },
- /* The rest of test vectors are generated manually, no "interesting"
- * vectors for use cases in RFC 3610 or SP 800-38C. */
- {
- .cipher_key_length = AES192_KEY_LEN,
- .cipher_key = { 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
- 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
- 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7},
- .cipher_iv_length = 13,
- .cipher_iv = { 0x00, 0x00, 0x00, 0x03, 0x02, 0x01, 0x00, 0xa0,
- 0xa1, 0xa2, 0xa3, 0xa4, 0xa5 },
- .aad_length = 8,
- .aad = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 },
- .length = 23,
- .plaintext = { 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
- 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e },
- .ciphertext = { 0x57, 0x9f, 0xb8, 0x6e, 0xdd, 0xb4, 0xa6, 0x4a,
- 0xae, 0x5f, 0xe9, 0x6d, 0xbd, 0x75, 0x44, 0x05,
- 0x33, 0xa9, 0xfc, 0x3a, 0x84, 0x57, 0x36 },
- .digest_length = 8,
- .digest = { 0x67, 0xae, 0xc8, 0x0a, 0xc5, 0x88, 0xab, 0x16 }
- },
- {
- .cipher_key_length = AES256_KEY_LEN,
- .cipher_key = { 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
- 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
- 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7,
- 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf},
- .cipher_iv_length = 13,
- .cipher_iv = { 0x00, 0x00, 0x00, 0x03, 0x02, 0x01, 0x00, 0xa0,
- 0xa1, 0xa2, 0xa3, 0xa4, 0xa5 },
- .aad_length = 8,
- .aad = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 },
- .length = 23,
- .plaintext = { 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
- 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e },
- .ciphertext = { 0x59, 0x61, 0x55, 0x10, 0xa7, 0xc4, 0x3b, 0xfb,
- 0x12, 0x3d, 0x63, 0x6b, 0x46, 0x13, 0xc0, 0x3c,
- 0x6c, 0xe2, 0x69, 0x07, 0x10, 0x2a, 0x3f },
- .digest_length = 8,
- .digest = { 0xb5, 0x57, 0x2a, 0x17, 0x2d, 0x49, 0x16, 0xd5 }
- },
- {
- .cipher_key_length = AES128_KEY_LEN,
- .cipher_key = { 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
- 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf},
- .cipher_iv_length = 11,
- .cipher_iv = { 0x00, 0x00, 0x00, 0x03, 0x02, 0x01, 0x00, 0xa0,
- 0xa1, 0xa2, 0xa3 },
- .aad_length = 8,
- .aad = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 },
- .length = 23,
- .plaintext = { 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
- 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e },
- .ciphertext = { 0xaa, 0x2d, 0x3e, 0xcb, 0xa6, 0x68, 0x63, 0x75,
- 0x8f, 0x03, 0x01, 0x51, 0x16, 0xde, 0x30, 0xed,
- 0x8a, 0xb5, 0x42, 0xdc, 0xfa, 0x72, 0xd0 },
- .digest_length = 8,
- .digest = { 0x63, 0xe7, 0x01, 0x5c, 0x69, 0xaf, 0xb4, 0x0c }
- },
- {
- .cipher_key_length = AES192_KEY_LEN,
- .cipher_key = { 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
- 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
- 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7},
- .cipher_iv_length = 11,
- .cipher_iv = { 0x00, 0x00, 0x00, 0x03, 0x02, 0x01, 0x00, 0xa0,
- 0xa1, 0xa2, 0xa3 },
- .aad_length = 8,
- .aad = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 },
- .length = 23,
- .plaintext = { 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
- 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e },
- .ciphertext = { 0xee, 0x99, 0x99, 0x1e, 0xc5, 0x8f, 0xd7, 0x7e,
- 0x56, 0x71, 0x16, 0x39, 0x8e, 0xc4, 0x4f, 0xcc,
- 0x14, 0x45, 0x57, 0x3e, 0x38, 0x76, 0x51 },
- .digest_length = 8,
- .digest = { 0x31, 0x29, 0x47, 0xa4, 0x6d, 0x76, 0x34, 0xb4 }
- },
- {
- .cipher_key_length = AES256_KEY_LEN,
- .cipher_key = { 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
- 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
- 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7,
- 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf},
- .cipher_iv_length = 11,
- .cipher_iv = { 0x00, 0x00, 0x00, 0x03, 0x02, 0x01, 0x00, 0xa0,
- 0xa1, 0xa2, 0xa3 },
- .aad_length = 8,
- .aad = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 },
- .length = 23,
- .plaintext = { 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
- 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e },
- .ciphertext = { 0xfa, 0x07, 0x47, 0x5c, 0xe8, 0xc9, 0x37, 0x88,
- 0x54, 0x64, 0xb8, 0xc3, 0x85, 0xbb, 0x76, 0x0b,
- 0xf2, 0xc2, 0x4c, 0x4e, 0x31, 0x16, 0x77 },
- .digest_length = 8,
- .digest = { 0x88, 0x56, 0x7e, 0x19, 0x84, 0x13, 0x29, 0xc4 }
- },
-};
-
-static crypto_test_reference_t aes_gmac_reference[] = {
- {
- .auth_key_length = AES128_KEY_LEN,
- .auth_key = { 0x4c, 0x80, 0xcd, 0xef, 0xbb, 0x5d, 0x10, 0xda,
- 0x90, 0x6a, 0xc7, 0x3c, 0x36, 0x13, 0xa6, 0x34},
- .auth_iv_length = AES_GCM_IV_LEN,
- .auth_iv = { 0x22, 0x43, 0x3c, 0x64, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00 },
- .length = 68,
- .plaintext = { 0x00, 0x00, 0x43, 0x21, 0x00, 0x00, 0x00, 0x07,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x45, 0x00, 0x00, 0x30, 0xda, 0x3a, 0x00, 0x00,
- 0x80, 0x01, 0xdf, 0x3b, 0xc0, 0xa8, 0x00, 0x05,
- 0xc0, 0xa8, 0x00, 0x01, 0x08, 0x00, 0xc6, 0xcd,
- 0x02, 0x00, 0x07, 0x00, 0x61, 0x62, 0x63, 0x64,
- 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c,
- 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74,
- 0x01, 0x02, 0x02, 0x01 },
- .ciphertext = { 0x00, 0x00, 0x43, 0x21, 0x00, 0x00, 0x00, 0x07,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x45, 0x00, 0x00, 0x30, 0xda, 0x3a, 0x00, 0x00,
- 0x80, 0x01, 0xdf, 0x3b, 0xc0, 0xa8, 0x00, 0x05,
- 0xc0, 0xa8, 0x00, 0x01, 0x08, 0x00, 0xc6, 0xcd,
- 0x02, 0x00, 0x07, 0x00, 0x61, 0x62, 0x63, 0x64,
- 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c,
- 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74,
- 0x01, 0x02, 0x02, 0x01 },
- .digest_length = AES_GCM_DIGEST_LEN,
- .digest = { 0xf2, 0xa9, 0xa8, 0x36, 0xe1, 0x55, 0x10, 0x6a,
- 0xa8, 0xdc, 0xd6, 0x18, 0xe4, 0x09, 0x9a, 0xaa }
- },
- /* AES192-GMAC from DPDK 17.02 */
- {
- .auth_key_length = AES192_KEY_LEN,
- .auth_key = { 0xaa, 0x74, 0x0a, 0xbf, 0xad, 0xcd, 0xa7, 0x79,
- 0x22, 0x0d, 0x3b, 0x40, 0x6c, 0x5d, 0x7e, 0xc0,
- 0x9a, 0x77, 0xfe, 0x9d, 0x94, 0x10, 0x45, 0x39},
- .auth_iv_length = AES_GCM_IV_LEN,
- .auth_iv = { 0xab, 0x22, 0x65, 0xb4, 0xc1, 0x68, 0x95, 0x55,
- 0x61, 0xf0, 0x43, 0x15 },
- .length = 80,
- .plaintext = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
- 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10,
- 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
- 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10,
- 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
- 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10,
- 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
- 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10,
- 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
- 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10},
- .ciphertext = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
- 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10,
- 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
- 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10,
- 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
- 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10,
- 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
- 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10,
- 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
- 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10},
- .digest_length = AES_GCM_DIGEST_LEN,
- .digest = { 0xCF, 0x82, 0x80, 0x64, 0x02, 0x46, 0xF4, 0xFB,
- 0x33, 0xAE, 0x1D, 0x90, 0xEA, 0x48, 0x83, 0xDB },
- },
- /* AES256-GMAC from DPDK 17.02 */
- {
- .auth_key_length = AES256_KEY_LEN,
- .auth_key = { 0xb5, 0x48, 0xe4, 0x93, 0x4f, 0x5c, 0x64, 0xd3,
- 0xc0, 0xf0, 0xb7, 0x8f, 0x7b, 0x4d, 0x88, 0x24,
- 0xaa, 0xc4, 0x6b, 0x3c, 0x8d, 0x2c, 0xc3, 0x5e,
- 0xe4, 0xbf, 0xb2, 0x54, 0xe4, 0xfc, 0xba, 0xf7},
- .auth_iv_length = AES_GCM_IV_LEN,
- .auth_iv = { 0x2e, 0xed, 0xe1, 0xdc, 0x64, 0x47, 0xc7, 0xaf,
- 0xc4, 0x41, 0x53, 0x58 },
- .length = 65,
- .plaintext = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
- 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10,
- 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
- 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10,
- 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
- 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10,
- 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
- 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10,
- 0x01, 0x02 },
- .ciphertext = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
- 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10,
- 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
- 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10,
- 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
- 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10,
- 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
- 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10,
- 0x01, 0x02 },
- .digest_length = AES_GCM_DIGEST_LEN,
- .digest = { 0x77, 0x46, 0x0D, 0x6F, 0xB1, 0x87, 0xDB, 0xA9,
- 0x46, 0xAD, 0xCD, 0xFB, 0xB7, 0xF9, 0x13, 0xA1 },
- }
-};
-
-/*
- * Test vectors from SP800-38B / CSRC examples
- * 12-byte vectors are just truncated 16-byte vectors
- */
-static crypto_test_reference_t aes_cmac_reference[] = {
- {
- .auth_key_length = AES128_KEY_LEN,
- .auth_key = { 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,
- 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c },
- .length = 16,
- .plaintext = { 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
- 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a},
- .ciphertext = { 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
- 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a
- },
- .digest_length = 16,
- .digest = { 0x07, 0x0a, 0x16, 0xb4, 0x6b, 0x4d, 0x41, 0x44,
- 0xf7, 0x9b, 0xdd, 0x9d, 0xd0, 0x4a, 0x28, 0x7c },
- },
- {
- .copy_previous_vector = 1,
- .digest_length = 12,
- },
- {
- .auth_key_length = AES192_KEY_LEN,
- .auth_key = { 0x8e, 0x73, 0xb0, 0xf7, 0xda, 0x0e, 0x64, 0x52,
- 0xc8, 0x10, 0xf3, 0x2b, 0x80, 0x90, 0x79, 0xe5,
- 0x62, 0xf8, 0xea, 0xd2, 0x52, 0x2c, 0x6b, 0x7b },
- .length = 16,
- .plaintext = { 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
- 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a},
- .ciphertext = { 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
- 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a
- },
- .digest_length = 16,
- .digest = { 0x9e, 0x99, 0xa7, 0xbf, 0x31, 0xe7, 0x10, 0x90,
- 0x06, 0x62, 0xf6, 0x5e, 0x61, 0x7c, 0x51, 0x84 },
- },
- {
- .copy_previous_vector = 1,
- .digest_length = 12,
- },
- {
- .auth_key_length = AES256_KEY_LEN,
- .auth_key = { 0x60, 0x3d, 0xeb, 0x10, 0x15, 0xca, 0x71, 0xbe,
- 0x2b, 0x73, 0xae, 0xf0, 0x85, 0x7d, 0x77, 0x81,
- 0x1f, 0x35, 0x2c, 0x07, 0x3b, 0x61, 0x08, 0xd7,
- 0x2d, 0x98, 0x10, 0xa3, 0x09, 0x14, 0xdf, 0xf4 },
- .length = 16,
- .plaintext = { 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
- 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a},
- .ciphertext = { 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
- 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a
- },
- .digest_length = 16,
- .digest = { 0x28, 0xa7, 0x02, 0x3f, 0x45, 0x2e, 0x8f, 0x82,
- 0xbd, 0x4b, 0xf2, 0x8d, 0x8c, 0x37, 0xc3, 0x5c },
- },
- {
- .copy_previous_vector = 1,
- .digest_length = 12,
- },
-};
-
-/*
- * Test vector from RFC 7539, sections 2.8.2, A.5
- */
-static crypto_test_reference_t chacha20_poly1305_reference[] = {
- {
- .cipher_key_length = CHACHA20_POLY1305_KEY_LEN,
- .cipher_key = { 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
- 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
- 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
- 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f},
- .cipher_iv_length = CHACHA20_POLY1305_IV_LEN,
- .cipher_iv = { 0x07, 0x00, 0x00, 0x00, 0x40, 0x41, 0x42, 0x43,
- 0x44, 0x45, 0x46, 0x47 },
- .length = 114,
- .plaintext = { 0x4c, 0x61, 0x64, 0x69, 0x65, 0x73, 0x20, 0x61,
- 0x6e, 0x64, 0x20, 0x47, 0x65, 0x6e, 0x74, 0x6c,
- 0x65, 0x6d, 0x65, 0x6e, 0x20, 0x6f, 0x66, 0x20,
- 0x74, 0x68, 0x65, 0x20, 0x63, 0x6c, 0x61, 0x73,
- 0x73, 0x20, 0x6f, 0x66, 0x20, 0x27, 0x39, 0x39,
- 0x3a, 0x20, 0x49, 0x66, 0x20, 0x49, 0x20, 0x63,
- 0x6f, 0x75, 0x6c, 0x64, 0x20, 0x6f, 0x66, 0x66,
- 0x65, 0x72, 0x20, 0x79, 0x6f, 0x75, 0x20, 0x6f,
- 0x6e, 0x6c, 0x79, 0x20, 0x6f, 0x6e, 0x65, 0x20,
- 0x74, 0x69, 0x70, 0x20, 0x66, 0x6f, 0x72, 0x20,
- 0x74, 0x68, 0x65, 0x20, 0x66, 0x75, 0x74, 0x75,
- 0x72, 0x65, 0x2c, 0x20, 0x73, 0x75, 0x6e, 0x73,
- 0x63, 0x72, 0x65, 0x65, 0x6e, 0x20, 0x77, 0x6f,
- 0x75, 0x6c, 0x64, 0x20, 0x62, 0x65, 0x20, 0x69,
- 0x74, 0x2e },
- .ciphertext = { 0xd3, 0x1a, 0x8d, 0x34, 0x64, 0x8e, 0x60, 0xdb,
- 0x7b, 0x86, 0xaf, 0xbc, 0x53, 0xef, 0x7e, 0xc2,
- 0xa4, 0xad, 0xed, 0x51, 0x29, 0x6e, 0x08, 0xfe,
- 0xa9, 0xe2, 0xb5, 0xa7, 0x36, 0xee, 0x62, 0xd6,
- 0x3d, 0xbe, 0xa4, 0x5e, 0x8c, 0xa9, 0x67, 0x12,
- 0x82, 0xfa, 0xfb, 0x69, 0xda, 0x92, 0x72, 0x8b,
- 0x1a, 0x71, 0xde, 0x0a, 0x9e, 0x06, 0x0b, 0x29,
- 0x05, 0xd6, 0xa5, 0xb6, 0x7e, 0xcd, 0x3b, 0x36,
- 0x92, 0xdd, 0xbd, 0x7f, 0x2d, 0x77, 0x8b, 0x8c,
- 0x98, 0x03, 0xae, 0xe3, 0x28, 0x09, 0x1b, 0x58,
- 0xfa, 0xb3, 0x24, 0xe4, 0xfa, 0xd6, 0x75, 0x94,
- 0x55, 0x85, 0x80, 0x8b, 0x48, 0x31, 0xd7, 0xbc,
- 0x3f, 0xf4, 0xde, 0xf0, 0x8e, 0x4b, 0x7a, 0x9d,
- 0xe5, 0x76, 0xd2, 0x65, 0x86, 0xce, 0xc6, 0x4b,
- 0x61, 0x16 },
- .aad_length = 12,
- .aad = { 0x50, 0x51, 0x52, 0x53, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4,
- 0xc5, 0xc6, 0xc7 },
- .digest_length = 16,
- .digest = { 0x1a, 0xe1, 0x0b, 0x59, 0x4f, 0x09, 0xe2, 0x6a,
- 0x7e, 0x90, 0x2e, 0xcb, 0xd0, 0x60, 0x06, 0x91 }
- },
- {
- .cipher_key_length = CHACHA20_POLY1305_KEY_LEN,
- .cipher_key = { 0x1c, 0x92, 0x40, 0xa5, 0xeb, 0x55, 0xd3, 0x8a,
- 0xf3, 0x33, 0x88, 0x86, 0x04, 0xf6, 0xb5, 0xf0,
- 0x47, 0x39, 0x17, 0xc1, 0x40, 0x2b, 0x80, 0x09,
- 0x9d, 0xca, 0x5c, 0xbc, 0x20, 0x70, 0x75, 0xc0},
- .cipher_iv_length = CHACHA20_POLY1305_IV_LEN,
- .cipher_iv = { 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04,
- 0x05, 0x06, 0x07, 0x08 },
- .length = 265,
- .plaintext = { 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x65, 0x74,
- 0x2d, 0x44, 0x72, 0x61, 0x66, 0x74, 0x73, 0x20,
- 0x61, 0x72, 0x65, 0x20, 0x64, 0x72, 0x61, 0x66,
- 0x74, 0x20, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65,
- 0x6e, 0x74, 0x73, 0x20, 0x76, 0x61, 0x6c, 0x69,
- 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x61, 0x20,
- 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x20,
- 0x6f, 0x66, 0x20, 0x73, 0x69, 0x78, 0x20, 0x6d,
- 0x6f, 0x6e, 0x74, 0x68, 0x73, 0x20, 0x61, 0x6e,
- 0x64, 0x20, 0x6d, 0x61, 0x79, 0x20, 0x62, 0x65,
- 0x20, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64,
- 0x2c, 0x20, 0x72, 0x65, 0x70, 0x6c, 0x61, 0x63,
- 0x65, 0x64, 0x2c, 0x20, 0x6f, 0x72, 0x20, 0x6f,
- 0x62, 0x73, 0x6f, 0x6c, 0x65, 0x74, 0x65, 0x64,
- 0x20, 0x62, 0x79, 0x20, 0x6f, 0x74, 0x68, 0x65,
- 0x72, 0x20, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65,
- 0x6e, 0x74, 0x73, 0x20, 0x61, 0x74, 0x20, 0x61,
- 0x6e, 0x79, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x2e,
- 0x20, 0x49, 0x74, 0x20, 0x69, 0x73, 0x20, 0x69,
- 0x6e, 0x61, 0x70, 0x70, 0x72, 0x6f, 0x70, 0x72,
- 0x69, 0x61, 0x74, 0x65, 0x20, 0x74, 0x6f, 0x20,
- 0x75, 0x73, 0x65, 0x20, 0x49, 0x6e, 0x74, 0x65,
- 0x72, 0x6e, 0x65, 0x74, 0x2d, 0x44, 0x72, 0x61,
- 0x66, 0x74, 0x73, 0x20, 0x61, 0x73, 0x20, 0x72,
- 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65,
- 0x20, 0x6d, 0x61, 0x74, 0x65, 0x72, 0x69, 0x61,
- 0x6c, 0x20, 0x6f, 0x72, 0x20, 0x74, 0x6f, 0x20,
- 0x63, 0x69, 0x74, 0x65, 0x20, 0x74, 0x68, 0x65,
- 0x6d, 0x20, 0x6f,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52, 0x16, 0xcd, 0xe7, 0xa4, 0xe9,
- 0x90, 0x40, 0xc5, 0xa4, 0x04, 0x33, 0x22, 0x5e,
- 0xe2, 0x82, 0xa1, 0xb0, 0xa0, 0x6c, 0x52, 0x3e,
- 0xaf, 0x45, 0x34, 0xd7, 0xf8, 0x3f, 0xa1, 0x15,
- 0x5b, 0x00, 0x47, 0x71, 0x8c, 0xbc, 0x54, 0x6a,
- 0x0d, 0x07, 0x2b, 0x04, 0xb3, 0x56, 0x4e, 0xea,
- 0x1b, 0x42, 0x22, 0x73, 0xf5, 0x48, 0x27, 0x1a,
- 0x0b, 0xb2, 0x31, 0x60, 0x53, 0xfa, 0x76, 0x99,
- 0x19, 0x55, 0xeb, 0xd6, 0x31, 0x59, 0x43, 0x4e,
- 0xce, 0xbb, 0x4e, 0x46, 0x6d, 0xae, 0x5a, 0x10,
- 0x73, 0xa6, 0x72, 0x76, 0x27, 0x09, 0x7a, 0x10,
- 0x49, 0xe6, 0x17, 0xd9, 0x1d, 0x36, 0x10, 0x94,
- 0xfa, 0x68, 0xf0, 0xff, 0x77, 0x98, 0x71, 0x30,
- 0x30, 0x5b, 0xea, 0xba, 0x2e, 0xda, 0x04, 0xdf,
- 0x99, 0x7b, 0x71, 0x4d, 0x6c, 0x6f, 0x2c, 0x29,
- 0xa6, 0xad, 0x5c, 0xb4, 0x02, 0x2b, 0x02, 0x70,
- 0x9b },
- .aad_length = 12,
- .aad = { 0xf3, 0x33, 0x88, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x4e, 0x91 },
- .digest_length = CHACHA20_POLY1305_CHECK_LEN,
- .digest = { 0xee, 0xad, 0x9d, 0x67, 0x89, 0x0c, 0xbb, 0x22,
- 0x39, 0x23, 0x36, 0xfe, 0xa1, 0x85, 0x1f, 0x38 }
- },
-};
-
-static crypto_test_reference_t hmac_md5_reference[] = {
- {
- .auth_key_length = HMAC_MD5_KEY_LEN,
- .auth_key = { 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
- 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b },
- .length = 8,
- /* "Hi There" */
- .plaintext = { 0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65},
- .ciphertext = { 0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65},
- .digest_length = HMAC_MD5_CHECK_LEN,
- .digest = { 0x92, 0x94, 0x72, 0x7a, 0x36, 0x38, 0xbb, 0x1c,
- 0x13, 0xf4, 0x8e, 0xf8, 0x15, 0x8b, 0xfc, 0x9d },
-
- },
- {
- .copy_previous_vector = 1,
- .digest_length = HMAC_MD5_96_CHECK_LEN,
- },
- {
- .auth_key_length = HMAC_MD5_KEY_LEN,
- /* "Jefe" */
- .auth_key = { 0x4a, 0x65, 0x66, 0x65 },
- .length = 28,
- /* what do ya want for nothing?*/
- .plaintext = { 0x77, 0x68, 0x61, 0x74, 0x20, 0x64, 0x6f, 0x20,
- 0x79, 0x61, 0x20, 0x77, 0x61, 0x6e, 0x74, 0x20,
- 0x66, 0x6f, 0x72, 0x20, 0x6e, 0x6f, 0x74, 0x68,
- 0x69, 0x6e, 0x67, 0x3f },
- .ciphertext = { 0x77, 0x68, 0x61, 0x74, 0x20, 0x64, 0x6f, 0x20,
- 0x79, 0x61, 0x20, 0x77, 0x61, 0x6e, 0x74, 0x20,
- 0x66, 0x6f, 0x72, 0x20, 0x6e, 0x6f, 0x74, 0x68,
- 0x69, 0x6e, 0x67, 0x3f },
- .digest_length = HMAC_MD5_CHECK_LEN,
- .digest = { 0x75, 0x0c, 0x78, 0x3e, 0x6a, 0xb0, 0xb5, 0x03,
- 0xea, 0xa8, 0x6e, 0x31, 0x0a, 0x5d, 0xb7, 0x38 },
-
- },
- {
- .copy_previous_vector = 1,
- .digest_length = HMAC_MD5_96_CHECK_LEN,
- },
- {
- .auth_key_length = HMAC_MD5_KEY_LEN,
- .auth_key = { 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
- 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa },
- .length = 50,
- .plaintext = { 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
- 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
- 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
- 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
- 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
- 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
- 0xdd, 0xdd },
- .ciphertext = { 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
- 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
- 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
- 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
- 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
- 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
- 0xdd, 0xdd },
- .digest_length = HMAC_MD5_CHECK_LEN,
- .digest = { 0x56, 0xbe, 0x34, 0x52, 0x1d, 0x14, 0x4c, 0x88,
- 0xdb, 0xb8, 0xc7, 0x33, 0xf0, 0xe8, 0xb3, 0xf6 }
- },
- {
- .copy_previous_vector = 1,
- .digest_length = HMAC_MD5_96_CHECK_LEN,
- },
-};
-
-static crypto_test_reference_t hmac_sha1_reference[] = {
- {
- .auth_key_length = HMAC_SHA1_KEY_LEN,
- .auth_key = { 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
- 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
- 0x0b, 0x0b, 0x0b, 0x0b },
- .length = 8,
- /* "Hi There" */
- .plaintext = { 0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65},
- .ciphertext = { 0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65},
- .digest_length = HMAC_SHA1_CHECK_LEN,
- .digest = { 0xb6, 0x17, 0x31, 0x86, 0x55, 0x05, 0x72, 0x64,
- 0xe2, 0x8b, 0xc0, 0xb6, 0xfb, 0x37, 0x8c, 0x8e,
- 0xf1, 0x46, 0xbe, 0x00 }
- },
- {
- .copy_previous_vector = 1,
- .digest_length = HMAC_SHA1_96_CHECK_LEN,
- },
- {
- .auth_key_length = HMAC_SHA1_KEY_LEN,
- /* "Jefe" */
- .auth_key = { 0x4a, 0x65, 0x66, 0x65 },
- .length = 28,
- /* what do ya want for nothing?*/
- .plaintext = { 0x77, 0x68, 0x61, 0x74, 0x20, 0x64, 0x6f, 0x20,
- 0x79, 0x61, 0x20, 0x77, 0x61, 0x6e, 0x74, 0x20,
- 0x66, 0x6f, 0x72, 0x20, 0x6e, 0x6f, 0x74, 0x68,
- 0x69, 0x6e, 0x67, 0x3f },
- .ciphertext = { 0x77, 0x68, 0x61, 0x74, 0x20, 0x64, 0x6f, 0x20,
- 0x79, 0x61, 0x20, 0x77, 0x61, 0x6e, 0x74, 0x20,
- 0x66, 0x6f, 0x72, 0x20, 0x6e, 0x6f, 0x74, 0x68,
- 0x69, 0x6e, 0x67, 0x3f },
- .digest_length = HMAC_SHA1_CHECK_LEN,
- .digest = { 0xef, 0xfc, 0xdf, 0x6a, 0xe5, 0xeb, 0x2f, 0xa2,
- 0xd2, 0x74, 0x16, 0xd5, 0xf1, 0x84, 0xdf, 0x9c,
- 0x25, 0x9a, 0x7c, 0x79 }
- },
- {
- .copy_previous_vector = 1,
- .digest_length = HMAC_SHA1_96_CHECK_LEN,
- },
- {
- .auth_key_length = HMAC_SHA1_KEY_LEN,
- .auth_key = { 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
- 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
- 0xaa, 0xaa, 0xaa, 0xaa },
- .length = 50,
- .plaintext = { 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
- 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
- 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
- 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
- 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
- 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
- 0xdd, 0xdd },
- .ciphertext = { 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
- 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
- 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
- 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
- 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
- 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
- 0xdd, 0xdd },
- .digest_length = HMAC_SHA1_CHECK_LEN,
- .digest = { 0x12, 0x5d, 0x73, 0x42, 0xb9, 0xac, 0x11, 0xcd,
- 0x91, 0xa3, 0x9a, 0xf4, 0x8a, 0xa1, 0x7b, 0x4f,
- 0x63, 0xf1, 0x75, 0xd3 }
- },
- {
- .copy_previous_vector = 1,
- .digest_length = HMAC_SHA1_96_CHECK_LEN,
- },
-};
-
-static crypto_test_reference_t hmac_sha224_reference[] = {
- {
- .auth_key_length = HMAC_SHA224_KEY_LEN,
- .auth_key = { 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
- 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
- 0x0b, 0x0b, 0x0b, 0x0b },
- .length = 8,
- /* "Hi There" */
- .plaintext = { 0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65},
- .ciphertext = { 0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65},
- .digest_length = HMAC_SHA224_CHECK_LEN,
- .digest = { 0x89, 0x6f, 0xb1, 0x12, 0x8a, 0xbb, 0xdf, 0x19,
- 0x68, 0x32, 0x10, 0x7c, 0xd4, 0x9d, 0xf3, 0x3f,
- 0x47, 0xb4, 0xb1, 0x16, 0x99, 0x12, 0xba, 0x4f,
- 0x53, 0x68, 0x4b, 0x22 }
- },
- {
- .auth_key_length = HMAC_SHA224_KEY_LEN,
- /* "Jefe" */
- .auth_key = { 0x4a, 0x65, 0x66, 0x65 },
- .length = 28,
- /* what do ya want for nothing?*/
- .plaintext = { 0x77, 0x68, 0x61, 0x74, 0x20, 0x64, 0x6f, 0x20,
- 0x79, 0x61, 0x20, 0x77, 0x61, 0x6e, 0x74, 0x20,
- 0x66, 0x6f, 0x72, 0x20, 0x6e, 0x6f, 0x74, 0x68,
- 0x69, 0x6e, 0x67, 0x3f },
- .ciphertext = { 0x77, 0x68, 0x61, 0x74, 0x20, 0x64, 0x6f, 0x20,
- 0x79, 0x61, 0x20, 0x77, 0x61, 0x6e, 0x74, 0x20,
- 0x66, 0x6f, 0x72, 0x20, 0x6e, 0x6f, 0x74, 0x68,
- 0x69, 0x6e, 0x67, 0x3f },
- .digest_length = HMAC_SHA224_CHECK_LEN,
- .digest = { 0xa3, 0x0e, 0x01, 0x09, 0x8b, 0xc6, 0xdb, 0xbf,
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, 0xa9, 0x69, 0x4d, 0x7d, 0x6a, 0xd2, 0x64,
- 0x93, 0x65, 0xb0, 0xc1, 0xf6, 0x5d, 0x69, 0xd1,
- 0xec, 0x83, 0x33, 0xea }
- }
-};
-
-static crypto_test_reference_t hmac_sha256_reference[] = {
- {
- .auth_key_length = HMAC_SHA256_KEY_LEN,
- .auth_key = { 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
- 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
- 0x0b, 0x0b, 0x0b, 0x0b },
- .length = 8,
- /* "Hi There" */
- .plaintext = { 0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65},
- .ciphertext = { 0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65},
- .digest_length = HMAC_SHA256_CHECK_LEN,
- .digest = { 0xb0, 0x34, 0x4c, 0x61, 0xd8, 0xdb, 0x38, 0x53,
- 0x5c, 0xa8, 0xaf, 0xce, 0xaf, 0x0b, 0xf1, 0x2b,
- 0x88, 0x1d, 0xc2, 0x00, 0xc9, 0x83, 0x3d, 0xa7,
- 0x26, 0xe9, 0x37, 0x6c, 0x2e, 0x32, 0xcf, 0xf7 }
- },
- {
- .copy_previous_vector = 1,
- .digest_length = HMAC_SHA256_128_CHECK_LEN,
- },
- {
- .auth_key_length = HMAC_SHA256_KEY_LEN,
- /* "Jefe" */
- .auth_key = { 0x4a, 0x65, 0x66, 0x65 },
- .length = 28,
- /* what do ya want for nothing?*/
- .plaintext = { 0x77, 0x68, 0x61, 0x74, 0x20, 0x64, 0x6f, 0x20,
- 0x79, 0x61, 0x20, 0x77, 0x61, 0x6e, 0x74, 0x20,
- 0x66, 0x6f, 0x72, 0x20, 0x6e, 0x6f, 0x74, 0x68,
- 0x69, 0x6e, 0x67, 0x3f },
- .ciphertext = { 0x77, 0x68, 0x61, 0x74, 0x20, 0x64, 0x6f, 0x20,
- 0x79, 0x61, 0x20, 0x77, 0x61, 0x6e, 0x74, 0x20,
- 0x66, 0x6f, 0x72, 0x20, 0x6e, 0x6f, 0x74, 0x68,
- 0x69, 0x6e, 0x67, 0x3f },
- .digest_length = HMAC_SHA256_CHECK_LEN,
- .digest = { 0x5b, 0xdc, 0xc1, 0x46, 0xbf, 0x60, 0x75, 0x4e,
- 0x6a, 0x04, 0x24, 0x26, 0x08, 0x95, 0x75, 0xc7,
- 0x5a, 0x00, 0x3f, 0x08, 0x9d, 0x27, 0x39, 0x83,
- 0x9d, 0xec, 0x58, 0xb9, 0x64, 0xec, 0x38, 0x43 }
- },
- {
- .copy_previous_vector = 1,
- .digest_length = HMAC_SHA256_128_CHECK_LEN,
- },
- {
- .auth_key_length = HMAC_SHA256_KEY_LEN,
- .auth_key = { 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
- 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
- 0xaa, 0xaa, 0xaa, 0xaa },
- .length = 50,
- .plaintext = { 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
- 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
- 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
- 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
- 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
- 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
- 0xdd, 0xdd },
- .ciphertext = { 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
- 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
- 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
- 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
- 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
- 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
- 0xdd, 0xdd },
- .digest_length = HMAC_SHA256_CHECK_LEN,
- .digest = { 0x77, 0x3e, 0xa9, 0x1e, 0x36, 0x80, 0x0e, 0x46,
- 0x85, 0x4d, 0xb8, 0xeb, 0xd0, 0x91, 0x81, 0xa7,
- 0x29, 0x59, 0x09, 0x8b, 0x3e, 0xf8, 0xc1, 0x22,
- 0xd9, 0x63, 0x55, 0x14, 0xce, 0xd5, 0x65, 0xfe }
- },
- {
- .copy_previous_vector = 1,
- .digest_length = HMAC_SHA256_128_CHECK_LEN,
- },
-};
-
-static crypto_test_reference_t hmac_sha384_reference[] = {
- {
- .auth_key_length = HMAC_SHA384_KEY_LEN,
- .auth_key = { 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
- 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
- 0x0b, 0x0b, 0x0b, 0x0b },
- .length = 8,
- /* "Hi There" */
- .plaintext = { 0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65},
- .ciphertext = { 0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65},
- .digest_length = HMAC_SHA384_CHECK_LEN,
- .digest = { 0xaf, 0xd0, 0x39, 0x44, 0xd8, 0x48, 0x95, 0x62,
- 0x6b, 0x08, 0x25, 0xf4, 0xab, 0x46, 0x90, 0x7f,
- 0x15, 0xf9, 0xda, 0xdb, 0xe4, 0x10, 0x1e, 0xc6,
- 0x82, 0xaa, 0x03, 0x4c, 0x7c, 0xeb, 0xc5, 0x9c,
- 0xfa, 0xea, 0x9e, 0xa9, 0x07, 0x6e, 0xde, 0x7f,
- 0x4a, 0xf1, 0x52, 0xe8, 0xb2, 0xfa, 0x9c, 0xb6 }
- },
- {
- .copy_previous_vector = 1,
- .digest_length = HMAC_SHA384_192_CHECK_LEN,
- },
- {
- .auth_key_length = HMAC_SHA384_KEY_LEN,
- /* "Jefe" */
- .auth_key = { 0x4a, 0x65, 0x66, 0x65 },
- .length = 28,
- /* what do ya want for nothing?*/
- .plaintext = { 0x77, 0x68, 0x61, 0x74, 0x20, 0x64, 0x6f, 0x20,
- 0x79, 0x61, 0x20, 0x77, 0x61, 0x6e, 0x74, 0x20,
- 0x66, 0x6f, 0x72, 0x20, 0x6e, 0x6f, 0x74, 0x68,
- 0x69, 0x6e, 0x67, 0x3f },
- .ciphertext = { 0x77, 0x68, 0x61, 0x74, 0x20, 0x64, 0x6f, 0x20,
- 0x79, 0x61, 0x20, 0x77, 0x61, 0x6e, 0x74, 0x20,
- 0x66, 0x6f, 0x72, 0x20, 0x6e, 0x6f, 0x74, 0x68,
- 0x69, 0x6e, 0x67, 0x3f },
- .digest_length = HMAC_SHA384_CHECK_LEN,
- .digest = { 0xaf, 0x45, 0xd2, 0xe3, 0x76, 0x48, 0x40, 0x31,
- 0x61, 0x7f, 0x78, 0xd2, 0xb5, 0x8a, 0x6b, 0x1b,
- 0x9c, 0x7e, 0xf4, 0x64, 0xf5, 0xa0, 0x1b, 0x47,
- 0xe4, 0x2e, 0xc3, 0x73, 0x63, 0x22, 0x44, 0x5e,
- 0x8e, 0x22, 0x40, 0xca, 0x5e, 0x69, 0xe2, 0xc7,
- 0x8b, 0x32, 0x39, 0xec, 0xfa, 0xb2, 0x16, 0x49 }
- },
- {
- .copy_previous_vector = 1,
- .digest_length = HMAC_SHA384_192_CHECK_LEN,
- },
- {
- .auth_key_length = HMAC_SHA384_KEY_LEN,
- .auth_key = { 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
- 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
- 0xaa, 0xaa, 0xaa, 0xaa },
- .length = 50,
- .plaintext = { 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
- 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
- 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
- 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
- 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
- 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
- 0xdd, 0xdd },
- .ciphertext = { 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
- 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
- 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
- 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
- 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
- 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
- 0xdd, 0xdd },
- .digest_length = HMAC_SHA384_CHECK_LEN,
- .digest = {0x88, 0x06, 0x26, 0x08, 0xd3, 0xe6, 0xad, 0x8a,
- 0x0a, 0xa2, 0xac, 0xe0, 0x14, 0xc8, 0xa8, 0x6f,
- 0x0a, 0xa6, 0x35, 0xd9, 0x47, 0xac, 0x9f, 0xeb,
- 0xe8, 0x3e, 0xf4, 0xe5, 0x59, 0x66, 0x14, 0x4b,
- 0x2a, 0x5a, 0xb3, 0x9d, 0xc1, 0x38, 0x14, 0xb9,
- 0x4e, 0x3a, 0xb6, 0xe1, 0x01, 0xa3, 0x4f, 0x27 }
- },
- {
- .copy_previous_vector = 1,
- .digest_length = HMAC_SHA384_192_CHECK_LEN,
- },
-};
-
-static crypto_test_reference_t hmac_sha512_reference[] = {
- {
- .auth_key_length = HMAC_SHA512_KEY_LEN,
- .auth_key = { 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
- 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
- 0x0b, 0x0b, 0x0b, 0x0b },
- .length = 8,
- /* "Hi There" */
- .plaintext = { 0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65},
- .ciphertext = { 0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65},
- .digest_length = HMAC_SHA512_CHECK_LEN,
- .digest = { 0x87, 0xaa, 0x7c, 0xde, 0xa5, 0xef, 0x61, 0x9d,
- 0x4f, 0xf0, 0xb4, 0x24, 0x1a, 0x1d, 0x6c, 0xb0,
- 0x23, 0x79, 0xf4, 0xe2, 0xce, 0x4e, 0xc2, 0x78,
- 0x7a, 0xd0, 0xb3, 0x05, 0x45, 0xe1, 0x7c, 0xde,
- 0xda, 0xa8, 0x33, 0xb7, 0xd6, 0xb8, 0xa7, 0x02,
- 0x03, 0x8b, 0x27, 0x4e, 0xae, 0xa3, 0xf4, 0xe4,
- 0xbe, 0x9d, 0x91, 0x4e, 0xeb, 0x61, 0xf1, 0x70,
- 0x2e, 0x69, 0x6c, 0x20, 0x3a, 0x12, 0x68, 0x54 }
- },
- {
- .copy_previous_vector = 1,
- .digest_length = HMAC_SHA512_256_CHECK_LEN,
- },
- {
- .auth_key_length = HMAC_SHA512_KEY_LEN,
- /* "Jefe" */
- .auth_key = { 0x4a, 0x65, 0x66, 0x65 },
- .length = 28,
- /* what do ya want for nothing?*/
- .plaintext = { 0x77, 0x68, 0x61, 0x74, 0x20, 0x64, 0x6f, 0x20,
- 0x79, 0x61, 0x20, 0x77, 0x61, 0x6e, 0x74, 0x20,
- 0x66, 0x6f, 0x72, 0x20, 0x6e, 0x6f, 0x74, 0x68,
- 0x69, 0x6e, 0x67, 0x3f },
- .ciphertext = { 0x77, 0x68, 0x61, 0x74, 0x20, 0x64, 0x6f, 0x20,
- 0x79, 0x61, 0x20, 0x77, 0x61, 0x6e, 0x74, 0x20,
- 0x66, 0x6f, 0x72, 0x20, 0x6e, 0x6f, 0x74, 0x68,
- 0x69, 0x6e, 0x67, 0x3f },
- .digest_length = HMAC_SHA512_CHECK_LEN,
- .digest = { 0x16, 0x4b, 0x7a, 0x7b, 0xfc, 0xf8, 0x19, 0xe2,
- 0xe3, 0x95, 0xfb, 0xe7, 0x3b, 0x56, 0xe0, 0xa3,
- 0x87, 0xbd, 0x64, 0x22, 0x2e, 0x83, 0x1f, 0xd6,
- 0x10, 0x27, 0x0c, 0xd7, 0xea, 0x25, 0x05, 0x54,
- 0x97, 0x58, 0xbf, 0x75, 0xc0, 0x5a, 0x99, 0x4a,
- 0x6d, 0x03, 0x4f, 0x65, 0xf8, 0xf0, 0xe6, 0xfd,
- 0xca, 0xea, 0xb1, 0xa3, 0x4d, 0x4a, 0x6b, 0x4b,
- 0x63, 0x6e, 0x07, 0x0a, 0x38, 0xbc, 0xe7, 0x37 }
- },
- {
- .copy_previous_vector = 1,
- .digest_length = HMAC_SHA512_256_CHECK_LEN,
- },
- {
- .auth_key_length = HMAC_SHA512_KEY_LEN,
- .auth_key = { 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
- 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
- 0xaa, 0xaa, 0xaa, 0xaa },
- .length = 50,
- .plaintext = { 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
- 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
- 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
- 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
- 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
- 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
- 0xdd, 0xdd },
- .ciphertext = { 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
- 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
- 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
- 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
- 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
- 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
- 0xdd, 0xdd },
- .digest_length = HMAC_SHA512_CHECK_LEN,
- .digest = { 0xfa, 0x73, 0xb0, 0x08, 0x9d, 0x56, 0xa2, 0x84,
- 0xef, 0xb0, 0xf0, 0x75, 0x6c, 0x89, 0x0b, 0xe9,
- 0xb1, 0xb5, 0xdb, 0xdd, 0x8e, 0xe8, 0x1a, 0x36,
- 0x55, 0xf8, 0x3e, 0x33, 0xb2, 0x27, 0x9d, 0x39,
- 0xbf, 0x3e, 0x84, 0x82, 0x79, 0xa7, 0x22, 0xc8,
- 0x06, 0xb4, 0x85, 0xa4, 0x7e, 0x67, 0xc8, 0x07,
- 0xb9, 0x46, 0xa3, 0x37, 0xbe, 0xe8, 0x94, 0x26,
- 0x74, 0x27, 0x88, 0x59, 0xe1, 0x32, 0x92, 0xfb }
- },
- {
- .copy_previous_vector = 1,
- .digest_length = HMAC_SHA512_256_CHECK_LEN,
- },
-};
-
-/*
- * RFC 3566
- */
-static crypto_test_reference_t aes_xcbc_reference[] = {
- /* Test Case #1 */
- {
- .auth_key_length = AES_XCBC_MAC_KEY_LEN,
- .auth_key = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
- 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f},
- .length = 0,
- .digest_length = AES_XCBC_MAC_CHECK_LEN,
- .digest = {0x75, 0xf0, 0x25, 0x1d, 0x52, 0x8a, 0xc0, 0x1c,
- 0x45, 0x73, 0xdf, 0xd5, 0x84, 0xd7, 0x9f, 0x29}
- },
- {
- .copy_previous_vector = 1,
- .digest_length = AES_XCBC_MAC_96_CHECK_LEN,
- },
- /* Test Case #2 */
- {
- .auth_key_length = AES_XCBC_MAC_KEY_LEN,
- .auth_key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
- 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
- .length = 3,
- .plaintext = { 0x00, 0x01, 0x02 },
- .ciphertext = { 0x00, 0x01, 0x02 },
- .digest_length = AES_XCBC_MAC_CHECK_LEN,
- .digest = { 0x5b, 0x37, 0x65, 0x80, 0xae, 0x2f, 0x19, 0xaf,
- 0xe7, 0x21, 0x9c, 0xee, 0xf1, 0x72, 0x75, 0x6f }
- },
- {
- .copy_previous_vector = 1,
- .digest_length = AES_XCBC_MAC_96_CHECK_LEN,
- },
- /* Test Case #3 */
- {
- .auth_key_length = AES_XCBC_MAC_KEY_LEN,
- .auth_key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
- 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
- .length = 16,
- .plaintext = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
- 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
- .ciphertext = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
- 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
- .digest_length = AES_XCBC_MAC_CHECK_LEN,
- .digest = { 0xd2, 0xa2, 0x46, 0xfa, 0x34, 0x9b, 0x68, 0xa7,
- 0x99, 0x98, 0xa4, 0x39, 0x4f, 0xf7, 0xa2, 0x63 }
- },
- {
- .copy_previous_vector = 1,
- .digest_length = AES_XCBC_MAC_96_CHECK_LEN,
- },
- /* Test Case #4 */
- {
- .auth_key_length = AES_XCBC_MAC_KEY_LEN,
- .auth_key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
- 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
- .length = 20,
- .plaintext = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
- 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
- 0x10, 0x11, 0x12, 0x13 },
- .ciphertext = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
- 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
- 0x10, 0x11, 0x12, 0x13 },
- .digest_length = AES_XCBC_MAC_CHECK_LEN,
- .digest = { 0x47, 0xf5, 0x1b, 0x45, 0x64, 0x96, 0x62, 0x15,
- 0xb8, 0x98, 0x5c, 0x63, 0x05, 0x5e, 0xd3, 0x08 }
- },
- {
- .copy_previous_vector = 1,
- .digest_length = AES_XCBC_MAC_96_CHECK_LEN,
- },
- /* Test Case #5 */
- {
- .auth_key_length = AES_XCBC_MAC_KEY_LEN,
- .auth_key = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
- 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f},
- .length = 32,
- .plaintext = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
- 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
- 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f},
- .ciphertext = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
- 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
- 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f},
- .digest_length = AES_XCBC_MAC_CHECK_LEN,
- .digest = {0xf5, 0x4f, 0x0e, 0xc8, 0xd2, 0xb9, 0xf3, 0xd3,
- 0x68, 0x07, 0x73, 0x4b, 0xd5, 0x28, 0x3f, 0xd4}
- },
- {
- .copy_previous_vector = 1,
- .digest_length = AES_XCBC_MAC_96_CHECK_LEN,
- },
- /* Test Case #6 */
- {
- .auth_key_length = AES_XCBC_MAC_KEY_LEN,
- .auth_key = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
- 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f},
- .length = 34,
- .plaintext = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
- 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
- 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
- 0x20, 0x21},
- .ciphertext = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
- 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
- 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
- 0x20, 0x21},
- .digest_length = AES_XCBC_MAC_CHECK_LEN,
- .digest = {0xbe, 0xcb, 0xb3, 0xbc, 0xcd, 0xb5, 0x18, 0xa3,
- 0x06, 0x77, 0xd5, 0x48, 0x1f, 0xb6, 0xb4, 0xd8}
- },
- {
- .copy_previous_vector = 1,
- .digest_length = AES_XCBC_MAC_96_CHECK_LEN,
- },
- /* Test Case #7 */
- {
- .auth_key_length = AES_XCBC_MAC_KEY_LEN,
- .auth_key = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
- 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f},
- .length = 1000,
- /* Plaintext is 1000 zero bytes. No explicit init needed. */
- .digest_length = AES_XCBC_MAC_CHECK_LEN,
- .digest = {0xf0, 0xda, 0xfe, 0xe8, 0x95, 0xdb, 0x30, 0x25,
- 0x37, 0x61, 0x10, 0x3b, 0x5d, 0x84, 0x52, 0x8f}
- },
- {
- .copy_previous_vector = 1,
- .digest_length = AES_XCBC_MAC_96_CHECK_LEN,
- },
-};
-
-/*
- * Kasumi F8 and F9 test vectors are taken from
- * 3GPP TS 35.203 V9.0.0 (2009-12)
- * 3rd Generation Partnership Project;
- * Technical Specification Group Services and System Aspects;
- * 3G Security;
- * Specification of the 3GPP Confidentiality
- * and Integrity Algorithms;
- * Document 3: Implementors' Test Data
- * (Release 9)
- */
-static crypto_test_reference_t kasumi_f8_reference[] = {
- {
- .cipher_key_length = KASUMI_F8_KEY_LEN,
- .cipher_key = { 0x5a, 0xcb, 0x1d, 0x64, 0x4c, 0x0d, 0x51, 0x20,
- 0x4e, 0xa5, 0xf1, 0x45, 0x10, 0x10, 0xd8, 0x52},
- .cipher_iv_length = KASUMI_F8_IV_LEN,
- .cipher_iv = { 0xfa, 0x55, 0x6b, 0x26, 0x1c, 0x00, 0x00, 0x00},
- .length = 120, /* 15 bytes */
- .is_length_in_bits = true,
- .plaintext = { 0xad, 0x9c, 0x44, 0x1f, 0x89, 0x0b, 0x38, 0xc4,
- 0x57, 0xa4, 0x9d, 0x42, 0x14, 0x07, 0xe8 },
- .ciphertext = { 0x9b, 0xc9, 0x2c, 0xa8, 0x03, 0xc6, 0x7b, 0x28,
- 0xa1, 0x1a, 0x4b, 0xee, 0x5a, 0x0c, 0x25 }
- }
-};
-
-static crypto_test_reference_t kasumi_f9_reference[] = {
- {
- .auth_key_length = KASUMI_F9_KEY_LEN,
- .auth_key = { 0xc7, 0x36, 0xc6, 0xaa, 0xb2, 0x2b, 0xff, 0xf9,
- 0x1e, 0x26, 0x98, 0xd2, 0xe2, 0x2a, 0xd5, 0x7e },
- .auth_iv_length = KASUMI_F9_IV_LEN,
- .auth_iv = { 0x14, 0x79, 0x3e, 0x41, 0x03, 0x97, 0xe8, 0xfd,
- 0x01, },
- .length = 384, /* 48 bytes */
- .is_length_in_bits = true,
- .plaintext = { 0xd0, 0xa7, 0xd4, 0x63, 0xdf, 0x9f, 0xb2, 0xb2,
- 0x78, 0x83, 0x3f, 0xa0, 0x2e, 0x23, 0x5a, 0xa1,
- 0x72, 0xbd, 0x97, 0x0c, 0x14, 0x73, 0xe1, 0x29,
- 0x07, 0xfb, 0x64, 0x8b, 0x65, 0x99, 0xaa, 0xa0,
- 0xb2, 0x4a, 0x03, 0x86, 0x65, 0x42, 0x2b, 0x20,
- 0xa4, 0x99, 0x27, 0x6a, 0x50, 0x42, 0x70, 0x09},
- .ciphertext = { 0xd0, 0xa7, 0xd4, 0x63, 0xdf, 0x9f, 0xb2, 0xb2,
- 0x78, 0x83, 0x3f, 0xa0, 0x2e, 0x23, 0x5a, 0xa1,
- 0x72, 0xbd, 0x97, 0x0c, 0x14, 0x73, 0xe1, 0x29,
- 0x07, 0xfb, 0x64, 0x8b, 0x65, 0x99, 0xaa, 0xa0,
- 0xb2, 0x4a, 0x03, 0x86, 0x65, 0x42, 0x2b, 0x20,
- 0xa4, 0x99, 0x27, 0x6a, 0x50, 0x42, 0x70, 0x09},
- .digest_length = KASUMI_F9_DIGEST_LEN,
- .digest = { 0xdd, 0x7d, 0xfa, 0xdd },
- }
-};
-
-/*
- * Snow3G UEA2 & UIA2 test vectors are taken from
- * Specification of the 3GPP Confidentiality and
- * Integrity Algorithms UEA2 & UIA2
- * Document 3: Implementors’ Test Data
- * Version: 1.1
- * Date: 25 th October 2012
- */
-static crypto_test_reference_t snow3g_uea2_reference[] = {
- {
- .cipher_key_length = SNOW3G_UEA2_KEY_LEN,
- .cipher_key = { 0x5a, 0xcb, 0x1d, 0x64, 0x4c, 0x0d, 0x51, 0x20,
- 0x4e, 0xa5, 0xf1, 0x45, 0x10, 0x10, 0xd8, 0x52},
- .cipher_iv_length = SNOW3G_UEA2_IV_LEN,
- .cipher_iv = { 0xfa, 0x55, 0x6b, 0x26, 0x1c, 0x00, 0x00, 0x00,
- 0xfa, 0x55, 0x6b, 0x26, 0x1c, 0x00, 0x00, 0x00},
- .length = 120, /* 15 bytes */
- .is_length_in_bits = true,
- .plaintext = { 0xad, 0x9c, 0x44, 0x1f, 0x89, 0x0b, 0x38, 0xc4,
- 0x57, 0xa4, 0x9d, 0x42, 0x14, 0x07, 0xe8 },
- .ciphertext = { 0xba, 0x0f, 0x31, 0x30, 0x03, 0x34, 0xc5, 0x6b,
- 0x52, 0xa7, 0x49, 0x7c, 0xba, 0xc0, 0x46 }
- }
-};
-
-static crypto_test_reference_t snow3g_uia2_reference[] = {
- {
- .auth_key_length = SNOW3G_UIA2_KEY_LEN,
- .auth_key = { 0xc7, 0x36, 0xc6, 0xaa, 0xb2, 0x2b, 0xff, 0xf9,
- 0x1e, 0x26, 0x98, 0xd2, 0xe2, 0x2a, 0xd5, 0x7e},
- .auth_iv_length = SNOW3G_UIA2_IV_LEN,
- .auth_iv = { 0x14, 0x79, 0x3e, 0x41, 0x03, 0x97, 0xe8, 0xfd,
- 0x94, 0x79, 0x3e, 0x41, 0x03, 0x97, 0x68, 0xfd },
- .length = 384, /* 48 bytes */
- .is_length_in_bits = true,
- .plaintext = { 0xd0, 0xa7, 0xd4, 0x63, 0xdf, 0x9f, 0xb2, 0xb2,
- 0x78, 0x83, 0x3f, 0xa0, 0x2e, 0x23, 0x5a, 0xa1,
- 0x72, 0xbd, 0x97, 0x0c, 0x14, 0x73, 0xe1, 0x29,
- 0x07, 0xfb, 0x64, 0x8b, 0x65, 0x99, 0xaa, 0xa0,
- 0xb2, 0x4a, 0x03, 0x86, 0x65, 0x42, 0x2b, 0x20,
- 0xa4, 0x99, 0x27, 0x6a, 0x50, 0x42, 0x70, 0x09},
- .ciphertext = { 0xd0, 0xa7, 0xd4, 0x63, 0xdf, 0x9f, 0xb2, 0xb2,
- 0x78, 0x83, 0x3f, 0xa0, 0x2e, 0x23, 0x5a, 0xa1,
- 0x72, 0xbd, 0x97, 0x0c, 0x14, 0x73, 0xe1, 0x29,
- 0x07, 0xfb, 0x64, 0x8b, 0x65, 0x99, 0xaa, 0xa0,
- 0xb2, 0x4a, 0x03, 0x86, 0x65, 0x42, 0x2b, 0x20,
- 0xa4, 0x99, 0x27, 0x6a, 0x50, 0x42, 0x70, 0x09},
- .digest_length = SNOW3G_UIA2_DIGEST_LEN,
- .digest = { 0x38, 0xb5, 0x54, 0xc0 }
- }
-};
-
-/*
- * AES EEA2 and AES EIA2 test vectors from
- * Specification of the 3GPP Confidentiality and Integrity
- * Algorithms 128-EEA2 & 128-EIA2
- */
-static crypto_test_reference_t aes_eea2_reference[] = {
- {
- .cipher_key_length = AES_EEA2_KEY_LEN,
- .cipher_key = { 0xD3, 0xC5, 0xD5, 0x92, 0x32, 0x7F, 0xB1, 0x1C,
- 0x40, 0x35, 0xC6, 0x68, 0x0A, 0xF8, 0xC6, 0xD1},
- .cipher_iv_length = AES_EEA2_IV_LEN,
- .cipher_iv = { 0x39, 0x8a, 0x59, 0xb4, 0xac, },
- .length = 253,
- .is_length_in_bits = true,
- .plaintext = { 0x98, 0x1B, 0xA6, 0x82, 0x4C, 0x1B, 0xFB, 0x1A,
- 0xB4, 0x85, 0x47, 0x20, 0x29, 0xB7, 0x1D, 0x80,
- 0x8C, 0xE3, 0x3E, 0x2C, 0xC3, 0xC0, 0xB5, 0xFC,
- 0x1F, 0x3D, 0xE8, 0xA6, 0xDC, 0x66, 0xB1, 0xF0 },
- .ciphertext = { 0xE9, 0xFE, 0xD8, 0xA6, 0x3D, 0x15, 0x53, 0x04,
- 0xD7, 0x1D, 0xF2, 0x0B, 0xF3, 0xE8, 0x22, 0x14,
- 0xB2, 0x0E, 0xD7, 0xDA, 0xD2, 0xF2, 0x33, 0xDC,
- 0x3C, 0x22, 0xD7, 0xBD, 0xEE, 0xED, 0x8E, 0x78}
- },
- {
- .cipher_key_length = AES_EEA2_KEY_LEN,
- .cipher_key = { 0x2B, 0xD6, 0x45, 0x9F, 0x82, 0xC4, 0x40, 0xE0,
- 0x95, 0x2C, 0x49, 0x10, 0x48, 0x05, 0xFF, 0x48},
- .cipher_iv_length = AES_EEA2_IV_LEN,
- .cipher_iv = { 0xc6, 0x75, 0xa6, 0x4b, 0x64, },
- .length = 798,
- .is_length_in_bits = true,
- .plaintext = { 0x7E, 0xC6, 0x12, 0x72, 0x74, 0x3B, 0xF1, 0x61,
- 0x47, 0x26, 0x44, 0x6A, 0x6C, 0x38, 0xCE, 0xD1,
- 0x66, 0xF6, 0xCA, 0x76, 0xEB, 0x54, 0x30, 0x04,
- 0x42, 0x86, 0x34, 0x6C, 0xEF, 0x13, 0x0F, 0x92,
- 0x92, 0x2B, 0x03, 0x45, 0x0D, 0x3A, 0x99, 0x75,
- 0xE5, 0xBD, 0x2E, 0xA0, 0xEB, 0x55, 0xAD, 0x8E,
- 0x1B, 0x19, 0x9E, 0x3E, 0xC4, 0x31, 0x60, 0x20,
- 0xE9, 0xA1, 0xB2, 0x85, 0xE7, 0x62, 0x79, 0x53,
- 0x59, 0xB7, 0xBD, 0xFD, 0x39, 0xBE, 0xF4, 0xB2,
- 0x48, 0x45, 0x83, 0xD5, 0xAF, 0xE0, 0x82, 0xAE,
- 0xE6, 0x38, 0xBF, 0x5F, 0xD5, 0xA6, 0x06, 0x19,
- 0x39, 0x01, 0xA0, 0x8F, 0x4A, 0xB4, 0x1A, 0xAB,
- 0x9B, 0x13, 0x48, 0x80 },
- .ciphertext = { 0x59, 0x61, 0x60, 0x53, 0x53, 0xC6, 0x4B, 0xDC,
- 0xA1, 0x5B, 0x19, 0x5E, 0x28, 0x85, 0x53, 0xA9,
- 0x10, 0x63, 0x25, 0x06, 0xD6, 0x20, 0x0A, 0xA7,
- 0x90, 0xC4, 0xC8, 0x06, 0xC9, 0x99, 0x04, 0xCF,
- 0x24, 0x45, 0xCC, 0x50, 0xBB, 0x1C, 0xF1, 0x68,
- 0xA4, 0x96, 0x73, 0x73, 0x4E, 0x08, 0x1B, 0x57,
- 0xE3, 0x24, 0xCE, 0x52, 0x59, 0xC0, 0xE7, 0x8D,
- 0x4C, 0xD9, 0x7B, 0x87, 0x09, 0x76, 0x50, 0x3C,
- 0x09, 0x43, 0xF2, 0xCB, 0x5A, 0xE8, 0xF0, 0x52,
- 0xC7, 0xB7, 0xD3, 0x92, 0x23, 0x95, 0x87, 0xB8,
- 0x95, 0x60, 0x86, 0xBC, 0xAB, 0x18, 0x83, 0x60,
- 0x42, 0xE2, 0xE6, 0xCE, 0x42, 0x43, 0x2A, 0x17,
- 0x10, 0x5C, 0x53, 0xD0 }
- },
-};
-
-static crypto_test_reference_t aes_eia2_reference[] = {
- /* 3GPP TS 33.401, C.2.1 */
- {
- .auth_key_length = AES_EIA2_KEY_LEN,
- .auth_key = { 0x2b, 0xd6, 0x45, 0x9f, 0x82, 0xc5, 0xb3, 0x00,
- 0x95, 0x2c, 0x49, 0x10, 0x48, 0x81, 0xff, 0x48 },
- .auth_iv_length = AES_EIA2_IV_LEN,
- .auth_iv = { 0x38, 0xa6, 0xf0, 0x56, 0xc0 },
- .length = 58,
- .is_length_in_bits = true,
- .plaintext = { 0x33, 0x32, 0x34, 0x62, 0x63, 0x39, 0x38, 0x40 },
- .ciphertext = { 0x33, 0x32, 0x34, 0x62, 0x63, 0x39, 0x38, 0x40 },
- .digest_length = AES_EIA2_DIGEST_LEN,
- .digest = { 0x11, 0x8c, 0x6e, 0xb8 }
- },
- /* 3GPP TS 33.401, C.2.2. */
- {
- .auth_key_length = AES_EIA2_KEY_LEN,
- .auth_key = { 0xD3, 0xC5, 0xD5, 0x92, 0x32, 0x7F, 0xB1, 0x1C,
- 0x40, 0x35, 0xC6, 0x68, 0x0A, 0xF8, 0xC6, 0xD1 },
- .auth_iv_length = AES_EIA2_IV_LEN,
- .auth_iv = { 0x39, 0x8a, 0x59, 0xb4, 0xd4, },
- .length = 64, /* 8 bytes */
- .is_length_in_bits = true,
- .plaintext = { 0x48, 0x45, 0x83, 0xd5, 0xaf, 0xe0, 0x82, 0xae },
- .ciphertext = { 0x48, 0x45, 0x83, 0xd5, 0xaf, 0xe0, 0x82, 0xae},
- .digest_length = AES_EIA2_DIGEST_LEN,
- .digest = { 0xb9, 0x37, 0x87, 0xe6 }
- },
- /* 3GPP TS 33.401, C.2.5 */
- {
- .auth_key_length = AES_EIA2_KEY_LEN,
- .auth_key = { 0x83, 0xfd, 0x23, 0xa2, 0x44, 0xa7, 0x4c, 0xf3,
- 0x58, 0xda, 0x30, 0x19, 0xf1, 0x72, 0x26, 0x35 },
- .auth_iv_length = AES_EIA2_IV_LEN,
- .auth_iv = { 0x36, 0xaf, 0x61, 0x44, 0x7c },
- .length = 768, /* 96 bytes */
- .is_length_in_bits = true,
- .plaintext = { 0x35, 0xc6, 0x87, 0x16, 0x63, 0x3c, 0x66, 0xfb,
- 0x75, 0x0c, 0x26, 0x68, 0x65, 0xd5, 0x3c, 0x11,
- 0xea, 0x05, 0xb1, 0xe9, 0xfa, 0x49, 0xc8, 0x39,
- 0x8d, 0x48, 0xe1, 0xef, 0xa5, 0x90, 0x9d, 0x39,
- 0x47, 0x90, 0x28, 0x37, 0xf5, 0xae, 0x96, 0xd5,
- 0xa0, 0x5b, 0xc8, 0xd6, 0x1c, 0xa8, 0xdb, 0xef,
- 0x1b, 0x13, 0xa4, 0xb4, 0xab, 0xfe, 0x4f, 0xb1,
- 0x00, 0x60, 0x45, 0xb6, 0x74, 0xbb, 0x54, 0x72,
- 0x93, 0x04, 0xc3, 0x82, 0xbe, 0x53, 0xa5, 0xaf,
- 0x05, 0x55, 0x61, 0x76, 0xf6, 0xea, 0xa2, 0xef,
- 0x1d, 0x05, 0xe4, 0xb0, 0x83, 0x18, 0x1e, 0xe6,
- 0x74, 0xcd, 0xa5, 0xa4, 0x85, 0xf7, 0x4d, 0x7a },
- .ciphertext = { 0x35, 0xc6, 0x87, 0x16, 0x63, 0x3c, 0x66, 0xfb,
- 0x75, 0x0c, 0x26, 0x68, 0x65, 0xd5, 0x3c, 0x11,
- 0xea, 0x05, 0xb1, 0xe9, 0xfa, 0x49, 0xc8, 0x39,
- 0x8d, 0x48, 0xe1, 0xef, 0xa5, 0x90, 0x9d, 0x39,
- 0x47, 0x90, 0x28, 0x37, 0xf5, 0xae, 0x96, 0xd5,
- 0xa0, 0x5b, 0xc8, 0xd6, 0x1c, 0xa8, 0xdb, 0xef,
- 0x1b, 0x13, 0xa4, 0xb4, 0xab, 0xfe, 0x4f, 0xb1,
- 0x00, 0x60, 0x45, 0xb6, 0x74, 0xbb, 0x54, 0x72,
- 0x93, 0x04, 0xc3, 0x82, 0xbe, 0x53, 0xa5, 0xaf,
- 0x05, 0x55, 0x61, 0x76, 0xf6, 0xea, 0xa2, 0xef,
- 0x1d, 0x05, 0xe4, 0xb0, 0x83, 0x18, 0x1e, 0xe6,
- 0x74, 0xcd, 0xa5, 0xa4, 0x85, 0xf7, 0x4d, 0x7a },
- .digest_length = AES_EIA2_DIGEST_LEN,
- .digest = { 0xe6, 0x57, 0xe1, 0x82 }
- },
-};
-
-/*
- * ZUC EEA3 and EIA3 test vectors from
- * Specification of the 3GPP Confidentiality and Integrity
- * Algorithms 128-EEA3 & 128-EIA3
- * Document 3: Implementor’s Test Data
- * Version: 1.1
- * Date: 4 th Jan. 2011
- */
-static crypto_test_reference_t zuc_eea3_reference[] = {
- {
- .cipher_key_length = ZUC_EEA3_KEY_LEN,
- .cipher_key = { 0xe5, 0xbd, 0x3e, 0xa0, 0xeb, 0x55, 0xad, 0xe8,
- 0x66, 0xc6, 0xac, 0x58, 0xbd, 0x54, 0x30, 0x2a},
- .cipher_iv_length = ZUC_EEA3_IV_LEN,
- .cipher_iv = { 0x00, 0x05, 0x68, 0x23, 0xc4, 0x00, 0x00, 0x00,
- 0x00, 0x05, 0x68, 0x23, 0xc4, 0x00, 0x00, 0x00 },
- .length = 800, /* 100 bytes */
- .is_length_in_bits = true,
- .plaintext = { 0x14, 0xa8, 0xef, 0x69, 0x3d, 0x67, 0x85, 0x07,
- 0xbb, 0xe7, 0x27, 0x0a, 0x7f, 0x67, 0xff, 0x50,
- 0x06, 0xc3, 0x52, 0x5b, 0x98, 0x07, 0xe4, 0x67,
- 0xc4, 0xe5, 0x60, 0x00, 0xba, 0x33, 0x8f, 0x5d,
- 0x42, 0x95, 0x59, 0x03, 0x67, 0x51, 0x82, 0x22,
- 0x46, 0xc8, 0x0d, 0x3b, 0x38, 0xf0, 0x7f, 0x4b,
- 0xe2, 0xd8, 0xff, 0x58, 0x05, 0xf5, 0x13, 0x22,
- 0x29, 0xbd, 0xe9, 0x3b, 0xbb, 0xdc, 0xaf, 0x38,
- 0x2b, 0xf1, 0xee, 0x97, 0x2f, 0xbf, 0x99, 0x77,
- 0xba, 0xda, 0x89, 0x45, 0x84, 0x7a, 0x2a, 0x6c,
- 0x9a, 0xd3, 0x4a, 0x66, 0x75, 0x54, 0xe0, 0x4d,
- 0x1f, 0x7f, 0xa2, 0xc3, 0x32, 0x41, 0xbd, 0x8f,
- 0x01, 0xba, 0x22, 0x0d },
- .ciphertext = { 0x13, 0x1d, 0x43, 0xe0, 0xde, 0xa1, 0xbe, 0x5c,
- 0x5a, 0x1b, 0xfd, 0x97, 0x1d, 0x85, 0x2c, 0xbf,
- 0x71, 0x2d, 0x7b, 0x4f, 0x57, 0x96, 0x1f, 0xea,
- 0x32, 0x08, 0xaf, 0xa8, 0xbc, 0xa4, 0x33, 0xf4,
- 0x56, 0xad, 0x09, 0xc7, 0x41, 0x7e, 0x58, 0xbc,
- 0x69, 0xcf, 0x88, 0x66, 0xd1, 0x35, 0x3f, 0x74,
- 0x86, 0x5e, 0x80, 0x78, 0x1d, 0x20, 0x2d, 0xfb,
- 0x3e, 0xcf, 0xf7, 0xfc, 0xbc, 0x3b, 0x19, 0x0f,
- 0xe8, 0x2a, 0x20, 0x4e, 0xd0, 0xe3, 0x50, 0xfc,
- 0x0f, 0x6f, 0x26, 0x13, 0xb2, 0xf2, 0xbc, 0xa6,
- 0xdf, 0x5a, 0x47, 0x3a, 0x57, 0xa4, 0xa0, 0x0d,
- 0x98, 0x5e, 0xba, 0xd8, 0x80, 0xd6, 0xf2, 0x38,
- 0x64, 0xa0, 0x7b, 0x01 }
- },
-
- /* Privately generated test data */
- {
- .cipher_key_length = ZUC_EEA3_256_KEY_LEN,
- .cipher_key = { 0xf7, 0xb4, 0x04, 0x5a, 0x81, 0x5c, 0x1b, 0x01,
- 0x82, 0xf9, 0xf4, 0x26, 0x80, 0xd4, 0x56, 0x26,
- 0xd5, 0xf7, 0x4b, 0x68, 0x48, 0x6b, 0x92, 0x6a,
- 0x34, 0x1f, 0x86, 0x66, 0x60, 0x0a, 0xfc, 0x57},
- .cipher_iv_length = ZUC_EEA3_256_IV_LEN,
- .cipher_iv = { 0x8e, 0x5d, 0xbc, 0x3f, 0xb9, 0xae, 0x66, 0xa3,
- 0xb9, 0x5c, 0x12, 0x14, 0xdb, 0xc5, 0xbc, 0x18,
- 0x48, 0x12, 0x09, 0x06, 0x25, 0x33, 0x2e, 0x12,
- 0x12 },
- .length = 1024,
- .is_length_in_bits = true,
- .plaintext = { 0x36, 0xdb, 0x63, 0x68, 0xb5, 0x1f, 0x4e, 0x92,
- 0x46, 0x1f, 0xde, 0xdb, 0xc2, 0xec, 0xfa, 0x7e,
- 0x49, 0x85, 0x77, 0xaa, 0x46, 0x98, 0x30, 0x2d,
- 0x3b, 0xc4, 0x11, 0x24, 0x98, 0x20, 0xa9, 0xce,
- 0xfb, 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a4,
- 0x8c, 0x15, 0x85, 0x81, 0xa6, 0xd3, 0x73, 0x1c,
- 0x29, 0x0b, 0xee, 0x3c, 0x57, 0xfa, 0x82, 0xad,
- 0x6f, 0xe0, 0xa1, 0x54, 0x8d, 0xa4, 0x92, 0x29,
- 0xf4, 0xfa, 0x6d, 0x01, 0xe3, 0x6c, 0xb9, 0x76,
- 0x80, 0x53, 0xbb, 0x27, 0xb8, 0x18, 0x47, 0x6c,
- 0xae, 0xb5, 0x44, 0x60, 0x43, 0x9d, 0xa7, 0x3f }
- },
- /* Privately generated test data */
- {
- .cipher_key_length = ZUC_EEA3_256_KEY_LEN,
- .cipher_key = { 0x1d, 0x0f, 0x0e, 0x75, 0x86, 0xb3, 0xfc, 0x65,
- 0x94, 0xbf, 0xaa, 0xa8, 0xf5, 0xd0, 0x0f, 0xe8,
- 0x14, 0x7a, 0x96, 0x61, 0x15, 0x49, 0x79, 0x71,
- 0x13, 0x82, 0xb4, 0xae, 0x34, 0x04, 0x75, 0x51 },
- .cipher_iv_length = ZUC_EEA3_256_IV_LEN,
- .cipher_iv = { 0x98, 0xcc, 0x89, 0x9f, 0xaf, 0x6d, 0x64, 0xb6,
- 0xb1, 0xe8, 0x21, 0x72, 0xee, 0xb6, 0xcc, 0xe3,
- 0xcf, 0x32, 0x28, 0x21, 0x21, 0x0d, 0x1e, 0x1c,
- 0x34 },
- .length = 1928,
- .is_length_in_bits = true,
- .plaintext = { 0xa4, 0xcb, 0x6e, 0x76, 0x99, 0xfb, 0x0c, 0xab,
- 0x6d, 0x57, 0xb1, 0x69, 0xc0, 0x47, 0x80, 0x63,
- 0x00, 0xe1, 0xf9, 0x51, 0x10, 0xbe, 0xc0, 0x0f,
- 0x99, 0x62, 0x2d, 0x71, 0xca, 0x75, 0xa0, 0x6e,
- 0x41, 0x0e, 0xe4, 0xda, 0x09, 0xf1, 0x86, 0x76,
- 0x48, 0x37, 0xe0, 0x08, 0x7e, 0x60, 0x6c, 0x7f,
- 0x41, 0x65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9, 0xcf, 0x32, 0xc5, 0xc1, 0x31, 0x0c, 0xa8,
- 0x86, 0x40, 0x75, 0xeb, 0x12, 0xcf, 0x26, 0x5c,
- 0x5f, 0xa3, 0x3c, 0xb6, 0x12, 0x45, 0xf3, 0x0a,
- 0x38, 0x09, 0xa8, 0x36, 0x32, 0x4a, 0x2f, 0xad,
- 0x50, 0x11, 0x38, 0xba, 0x8f, 0xdd, 0xd1, 0x58,
- 0xd7, 0x3d, 0x3a, 0x40, 0x7c, 0x3f, 0xa7, 0x98,
- 0xf3, 0x12, 0x7f, 0x9f, 0x89, 0xcf, 0x48, 0x58,
- 0x01, 0xeb, 0x98, 0x7c, 0x59, 0x11, 0x9f, 0x57,
- 0x74, 0x5f, 0x70, 0x72, 0x74, 0xa4, 0x82, 0x3c,
- 0x36, 0xe6, 0x31, 0x9e, 0xba, 0x7b, 0x53, 0xfc,
- 0x56 }
- },
-};
-
-static crypto_test_reference_t zuc_eia3_reference[] = {
- {
- .auth_key_length = ZUC_EIA3_KEY_LEN,
- .auth_key = { 0xc9, 0xe6, 0xce, 0xc4, 0x60, 0x7c, 0x72, 0xdb,
- 0x00, 0x0a, 0xef, 0xa8, 0x83, 0x85, 0xab, 0x0a },
- .auth_iv_length = ZUC_EIA3_IV_LEN,
- .auth_iv = { 0xa9, 0x40, 0x59, 0xda, 0x50, 0x00, 0x00, 0x00,
- 0x29, 0x40, 0x59, 0xda, 0x50, 0x00, 0x80, 0x00 },
- .length = 584, /* 73 bytes */
- .is_length_in_bits = true,
- .plaintext = { 0x98, 0x3b, 0x41, 0xd4, 0x7d, 0x78, 0x0c, 0x9e,
- 0x1a, 0xd1, 0x1d, 0x7e, 0xb7, 0x03, 0x91, 0xb1,
- 0xde, 0x0b, 0x35, 0xda, 0x2d, 0xc6, 0x2f, 0x83,
- 0xe7, 0xb7, 0x8d, 0x63, 0x06, 0xca, 0x0e, 0xa0,
- 0x7e, 0x94, 0x1b, 0x7b, 0xe9, 0x13, 0x48, 0xf9,
- 0xfc, 0xb1, 0x70, 0xe2, 0x21, 0x7f, 0xec, 0xd9,
- 0x7f, 0x9f, 0x68, 0xad, 0xb1, 0x6e, 0x5d, 0x7d,
- 0x21, 0xe5, 0x69, 0xd2, 0x80, 0xed, 0x77, 0x5c,
- 0xeb, 0xde, 0x3f, 0x40, 0x93, 0xc5, 0x38, 0x81,
- 0x00, 0x00, 0x00, 0x00 },
- .ciphertext = { 0x98, 0x3b, 0x41, 0xd4, 0x7d, 0x78, 0x0c, 0x9e,
- 0x1a, 0xd1, 0x1d, 0x7e, 0xb7, 0x03, 0x91, 0xb1,
- 0xde, 0x0b, 0x35, 0xda, 0x2d, 0xc6, 0x2f, 0x83,
- 0xe7, 0xb7, 0x8d, 0x63, 0x06, 0xca, 0x0e, 0xa0,
- 0x7e, 0x94, 0x1b, 0x7b, 0xe9, 0x13, 0x48, 0xf9,
- 0xfc, 0xb1, 0x70, 0xe2, 0x21, 0x7f, 0xec, 0xd9,
- 0x7f, 0x9f, 0x68, 0xad, 0xb1, 0x6e, 0x5d, 0x7d,
- 0x21, 0xe5, 0x69, 0xd2, 0x80, 0xed, 0x77, 0x5c,
- 0xeb, 0xde, 0x3f, 0x40, 0x93, 0xc5, 0x38, 0x81,
- 0x00, 0x00, 0x00, 0x00 },
- .digest_length = ZUC_EIA3_DIGEST_LEN,
- .digest = { 0x24, 0xa8, 0x42, 0xb3 }
- },
- /* Privately generated test data */
- {
- .auth_key_length = ZUC_EIA3_256_KEY_LEN,
- .auth_key = { 0xe3, 0x8e, 0xaf, 0x08, 0xde, 0x8c, 0x08, 0x41,
- 0x7f, 0x2b, 0x97, 0x20, 0x10, 0x87, 0xc7, 0xf7,
- 0xbe, 0x3c, 0xd2, 0x68, 0x80, 0x10, 0x1e, 0x71,
- 0xfd, 0xb2, 0xbb, 0xad, 0x25, 0x0f, 0x06, 0x08 },
- .auth_iv_length = ZUC_EIA3_256_IV_LEN,
- .auth_iv = { 0xf5, 0x8d, 0x08, 0x26, 0x94, 0x14, 0xc7, 0x4d,
- 0xf5, 0x7c, 0x9c, 0xaa, 0x45, 0x53, 0xfd, 0x85,
- 0x23, 0x0b, 0x00, 0x0e, 0x26, 0x2b, 0x0f, 0x01,
- 0x26 },
- .length = 360,
- .is_length_in_bits = true,
- .plaintext = { 0x08, 0xba, 0x8d, 0xf1, 0xf8, 0x62, 0xa6, 0xaf,
- 0xf9, 0x03, 0x88, 0x9c, 0xa3, 0x68, 0x6b, 0x87,
- 0xb6, 0x92, 0xd1, 0x47, 0x3e, 0x54, 0xaf, 0x46,
- 0x07, 0x8f, 0x89, 0xea, 0x26, 0x9d, 0x0e, 0x2f,
- 0x57, 0x9b, 0x20, 0x4f, 0xfe, 0xc7, 0xfe, 0xf7,
- 0xca, 0x86, 0x93, 0x6d, 0xee },
- .ciphertext = { 0x08, 0xba, 0x8d, 0xf1, 0xf8, 0x62, 0xa6, 0xaf,
- 0xf9, 0x03, 0x88, 0x9c, 0xa3, 0x68, 0x6b, 0x87,
- 0xb6, 0x92, 0xd1, 0x47, 0x3e, 0x54, 0xaf, 0x46,
- 0x07, 0x8f, 0x89, 0xea, 0x26, 0x9d, 0x0e, 0x2f,
- 0x57, 0x9b, 0x20, 0x4f, 0xfe, 0xc7, 0xfe, 0xf7,
- 0xca, 0x86, 0x93, 0x6d, 0xee },
- .digest_length = ZUC_EIA3_DIGEST_LEN,
- .digest = {0x58, 0x19, 0xab, 0xa5}
- },
- /* Privately generated test data */
- {
- .auth_key_length = ZUC_EIA3_256_KEY_LEN,
- .auth_key = { 0x6a, 0x7e, 0x4c, 0x7e, 0x51, 0x25, 0xb3, 0x48,
- 0x84, 0x53, 0x3a, 0x94, 0xfb, 0x31, 0x99, 0x90,
- 0x32, 0x57, 0x44, 0xee, 0x9b, 0xbc, 0xe9, 0xe5,
- 0x25, 0xcf, 0x08, 0xf5, 0xe9, 0xe2, 0x5e, 0x53 },
- .auth_iv_length = ZUC_EIA3_256_IV_LEN,
- .auth_iv = { 0x60, 0xaa, 0xd2, 0xb2, 0xd0, 0x85, 0xfa, 0x54,
- 0xd8, 0x35, 0xe8, 0xd4, 0x66, 0x82, 0x64, 0x98,
- 0xd9, 0x2a, 0x08, 0x1d, 0x35, 0x19, 0x17, 0x01,
- 0x1A },
- .length = 2872,
- .is_length_in_bits = true,
- .plaintext = { 0xc6, 0x69, 0x73, 0x51, 0xff, 0x4a, 0xec, 0x29,
- 0xcd, 0xba, 0xab, 0xf2, 0xfb, 0xe3, 0x46, 0x7c,
- 0xc2, 0x54, 0xf8, 0x1b, 0xe8, 0xe7, 0x8d, 0x76,
- 0x5a, 0x2e, 0x63, 0x33, 0x9f, 0xc9, 0x9a, 0x66,
- 0x32, 0x0d, 0xb7, 0x31, 0x58, 0xa3, 0x5a, 0x25,
- 0x5d, 0x05, 0x17, 0x58, 0xe9, 0x5e, 0xd4, 0xab,
- 0xb2, 0xcd, 0xc6, 0x9b, 0xb4, 0x54, 0x11, 0x0e,
- 0x82, 0x74, 0x41, 0x21, 0x3d, 0xdc, 0x87, 0x70,
- 0xe9, 0x3e, 0xa1, 0x41, 0xe1, 0xfc, 0x67, 0x3e,
- 0x01, 0x7e, 0x97, 0xea, 0xdc, 0x6b, 0x96, 0x8f,
- 0x38, 0x5c, 0x2a, 0xec, 0xb0, 0x3b, 0xfb, 0x32,
- 0xaf, 0x3c, 0x54, 0xec, 0x18, 0xdb, 0x5c, 0x02,
- 0x1a, 0xfe, 0x43, 0xfb, 0xfa, 0xaa, 0x3a, 0xfb,
- 0x29, 0xd1, 0xe6, 0x05, 0x3c, 0x7c, 0x94, 0x75,
- 0xd8, 0xbe, 0x61, 0x89, 0xf9, 0x5c, 0xbb, 0xa8,
- 0x99, 0x0f, 0x95, 0xb1, 0xeb, 0xf1, 0xb3, 0x05,
- 0xef, 0xf7, 0x00, 0xe9, 0xa1, 0x3a, 0xe5, 0xca,
- 0x0b, 0xcb, 0xd0, 0x48, 0x47, 0x64, 0xbd, 0x1f,
- 0x23, 0x1e, 0xa8, 0x1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0xb9, 0x20, 0xba, 0x86, 0xc3, 0x3e,
- 0x05, 0xf1, 0xec, 0xd9, 0x67, 0x33, 0xb7, 0x99,
- 0x50, 0xa3, 0xe3, 0x14, 0xd3, 0xd9, 0x34, 0xf7,
- 0x5e, 0xa0, 0xf2, 0x10, 0xa8, 0xf6, 0x05, 0x94,
- 0x01, 0xbe, 0xb4, 0xbc, 0x44, 0x78, 0xfa, 0x49,
- 0x69, 0xe6, 0x23, 0xd0, 0x1a, 0xda, 0x69 },
- .digest_length = ZUC_EIA3_DIGEST_LEN,
- .digest = {0xd1, 0x1e, 0x33, 0xf6}
- },
-};
-
-/*
- * MD5 test vectors from RFC 1321
- */
-static crypto_test_reference_t md5_reference[] = {
- {
- .length = 3,
- .plaintext = { 0x61, 0x62, 0x63 },
- .ciphertext = { 0x61, 0x62, 0x63 },
- .digest_length = MD5_DIGEST_LEN,
- .digest = { 0x90, 0x01, 0x50, 0x98, 0x3c, 0xd2, 0x4f, 0xb0,
- 0xd6, 0x96, 0x3f, 0x7d, 0x28, 0xe1, 0x7f, 0x72}
- },
- {
- .length = 62,
- .plaintext = { 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
- 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50,
- 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
- 0x59, 0x5a, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66,
- 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e,
- 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76,
- 0x77, 0x78, 0x79, 0x7a, 0x30, 0x31, 0x32, 0x33,
- 0x34, 0x35, 0x36, 0x37, 0x38, 0x39 },
- .ciphertext = { 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
- 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50,
- 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
- 0x59, 0x5a, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66,
- 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e,
- 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76,
- 0x77, 0x78, 0x79, 0x7a, 0x30, 0x31, 0x32, 0x33,
- 0x34, 0x35, 0x36, 0x37, 0x38, 0x39 },
- .digest_length = MD5_DIGEST_LEN,
- .digest = { 0xd1, 0x74, 0xab, 0x98, 0xd2, 0x77, 0xd9, 0xf5,
- 0xa5, 0x61, 0x1c, 0x2c, 0x9f, 0x41, 0x9d, 0x9f},
- }
-};
-
-/*
- * SHA test vectors from Crypto++
- */
-static crypto_test_reference_t sha1_reference[] = {
- {
- .length = 3,
- .plaintext = { 0x61, 0x62, 0x63 },
- .ciphertext = { 0x61, 0x62, 0x63 },
- .digest_length = SHA1_DIGEST_LEN,
- .digest = { 0xA9, 0x99, 0x3E, 0x36, 0x47, 0x06, 0x81, 0x6A,
- 0xBA, 0x3E, 0x25, 0x71, 0x78, 0x50, 0xC2, 0x6C,
- 0x9C, 0xD0, 0xD8, 0x9D},
- },
- {
- .length = 56,
- .plaintext = { 0x61, 0x62, 0x63, 0x64, 0x62, 0x63, 0x64, 0x65,
- 0x63, 0x64, 0x65, 0x66, 0x64, 0x65, 0x66, 0x67,
- 0x65, 0x66, 0x67, 0x68, 0x66, 0x67, 0x68, 0x69,
- 0x67, 0x68, 0x69, 0x6a, 0x68, 0x69, 0x6a, 0x6b,
- 0x69, 0x6a, 0x6b, 0x6c, 0x6a, 0x6b, 0x6c, 0x6d,
- 0x6b, 0x6c, 0x6d, 0x6e, 0x6c, 0x6d, 0x6e, 0x6f,
- 0x6d, 0x6e, 0x6f, 0x70, 0x6e, 0x6f, 0x70, 0x71},
- .ciphertext = { 0x61, 0x62, 0x63, 0x64, 0x62, 0x63, 0x64, 0x65,
- 0x63, 0x64, 0x65, 0x66, 0x64, 0x65, 0x66, 0x67,
- 0x65, 0x66, 0x67, 0x68, 0x66, 0x67, 0x68, 0x69,
- 0x67, 0x68, 0x69, 0x6a, 0x68, 0x69, 0x6a, 0x6b,
- 0x69, 0x6a, 0x6b, 0x6c, 0x6a, 0x6b, 0x6c, 0x6d,
- 0x6b, 0x6c, 0x6d, 0x6e, 0x6c, 0x6d, 0x6e, 0x6f,
- 0x6d, 0x6e, 0x6f, 0x70, 0x6e, 0x6f, 0x70, 0x71},
- .digest_length = SHA1_DIGEST_LEN,
- .digest = { 0x84, 0x98, 0x3E, 0x44, 0x1C, 0x3B, 0xD2, 0x6E,
- 0xBA, 0xAE, 0x4A, 0xA1, 0xF9, 0x51, 0x29, 0xE5,
- 0xE5, 0x46, 0x70, 0xF1},
- }
-};
-
-static crypto_test_reference_t sha224_reference[] = {
- {
- .length = 3,
- .plaintext = { 0x61, 0x62, 0x63 },
- .ciphertext = { 0x61, 0x62, 0x63 },
- .digest_length = SHA224_DIGEST_LEN,
- .digest = { 0x23, 0x09, 0x7d, 0x22, 0x34, 0x05, 0xd8, 0x22,
- 0x86, 0x42, 0xa4, 0x77, 0xbd, 0xa2, 0x55, 0xb3,
- 0x2a, 0xad, 0xbc, 0xe4, 0xbd, 0xa0, 0xb3, 0xf7,
- 0xe3, 0x6c, 0x9d, 0xa7 },
- },
- {
- .length = 56,
- .plaintext = { 0x61, 0x62, 0x63, 0x64, 0x62, 0x63, 0x64, 0x65,
- 0x63, 0x64, 0x65, 0x66, 0x64, 0x65, 0x66, 0x67,
- 0x65, 0x66, 0x67, 0x68, 0x66, 0x67, 0x68, 0x69,
- 0x67, 0x68, 0x69, 0x6a, 0x68, 0x69, 0x6a, 0x6b,
- 0x69, 0x6a, 0x6b, 0x6c, 0x6a, 0x6b, 0x6c, 0x6d,
- 0x6b, 0x6c, 0x6d, 0x6e, 0x6c, 0x6d, 0x6e, 0x6f,
- 0x6d, 0x6e, 0x6f, 0x70, 0x6e, 0x6f, 0x70, 0x71},
- .ciphertext = { 0x61, 0x62, 0x63, 0x64, 0x62, 0x63, 0x64, 0x65,
- 0x63, 0x64, 0x65, 0x66, 0x64, 0x65, 0x66, 0x67,
- 0x65, 0x66, 0x67, 0x68, 0x66, 0x67, 0x68, 0x69,
- 0x67, 0x68, 0x69, 0x6a, 0x68, 0x69, 0x6a, 0x6b,
- 0x69, 0x6a, 0x6b, 0x6c, 0x6a, 0x6b, 0x6c, 0x6d,
- 0x6b, 0x6c, 0x6d, 0x6e, 0x6c, 0x6d, 0x6e, 0x6f,
- 0x6d, 0x6e, 0x6f, 0x70, 0x6e, 0x6f, 0x70, 0x71},
- .digest_length = SHA224_DIGEST_LEN,
- .digest = { 0x75, 0x38, 0x8b, 0x16, 0x51, 0x27, 0x76, 0xcc,
- 0x5d, 0xba, 0x5d, 0xa1, 0xfd, 0x89, 0x01, 0x50,
- 0xb0, 0xc6, 0x45, 0x5c, 0xb4, 0xf5, 0x8b, 0x19,
- 0x52, 0x52, 0x25, 0x25},
- }
-};
-
-static crypto_test_reference_t sha256_reference[] = {
- {
- .length = 3,
- .plaintext = { 0x61, 0x62, 0x63 },
- .ciphertext = { 0x61, 0x62, 0x63 },
- .digest_length = SHA256_DIGEST_LEN,
- .digest = { 0xba, 0x78, 0x16, 0xbf, 0x8f, 0x01, 0xcf, 0xea,
- 0x41, 0x41, 0x40, 0xde, 0x5d, 0xae, 0x22, 0x23,
- 0xb0, 0x03, 0x61, 0xa3, 0x96, 0x17, 0x7a, 0x9c,
- 0xb4, 0x10, 0xff, 0x61, 0xf2, 0x00, 0x15, 0xad},
- },
- {
- .length = 56,
- .plaintext = { 0x61, 0x62, 0x63, 0x64, 0x62, 0x63, 0x64, 0x65,
- 0x63, 0x64, 0x65, 0x66, 0x64, 0x65, 0x66, 0x67,
- 0x65, 0x66, 0x67, 0x68, 0x66, 0x67, 0x68, 0x69,
- 0x67, 0x68, 0x69, 0x6a, 0x68, 0x69, 0x6a, 0x6b,
- 0x69, 0x6a, 0x6b, 0x6c, 0x6a, 0x6b, 0x6c, 0x6d,
- 0x6b, 0x6c, 0x6d, 0x6e, 0x6c, 0x6d, 0x6e, 0x6f,
- 0x6d, 0x6e, 0x6f, 0x70, 0x6e, 0x6f, 0x70, 0x71},
- .ciphertext = { 0x61, 0x62, 0x63, 0x64, 0x62, 0x63, 0x64, 0x65,
- 0x63, 0x64, 0x65, 0x66, 0x64, 0x65, 0x66, 0x67,
- 0x65, 0x66, 0x67, 0x68, 0x66, 0x67, 0x68, 0x69,
- 0x67, 0x68, 0x69, 0x6a, 0x68, 0x69, 0x6a, 0x6b,
- 0x69, 0x6a, 0x6b, 0x6c, 0x6a, 0x6b, 0x6c, 0x6d,
- 0x6b, 0x6c, 0x6d, 0x6e, 0x6c, 0x6d, 0x6e, 0x6f,
- 0x6d, 0x6e, 0x6f, 0x70, 0x6e, 0x6f, 0x70, 0x71},
- .digest_length = SHA256_DIGEST_LEN,
- .digest = { 0x24, 0x8d, 0x6a, 0x61, 0xd2, 0x06, 0x38, 0xb8,
- 0xe5, 0xc0, 0x26, 0x93, 0x0c, 0x3e, 0x60, 0x39,
- 0xa3, 0x3c, 0xe4, 0x59, 0x64, 0xff, 0x21, 0x67,
- 0xf6, 0xec, 0xed, 0xd4, 0x19, 0xdb, 0x06, 0xc1},
- }
-};
-
-static crypto_test_reference_t sha384_reference[] = {
- {
- .length = 3,
- .plaintext = { 0x61, 0x62, 0x63 },
- .ciphertext = { 0x61, 0x62, 0x63 },
- .digest_length = SHA384_DIGEST_LEN,
- .digest = { 0xcb, 0x00, 0x75, 0x3f, 0x45, 0xa3, 0x5e, 0x8b,
- 0xb5, 0xa0, 0x3d, 0x69, 0x9a, 0xc6, 0x50, 0x07,
- 0x27, 0x2c, 0x32, 0xab, 0x0e, 0xde, 0xd1, 0x63,
- 0x1a, 0x8b, 0x60, 0x5a, 0x43, 0xff, 0x5b, 0xed,
- 0x80, 0x86, 0x07, 0x2b, 0xa1, 0xe7, 0xcc, 0x23,
- 0x58, 0xba, 0xec, 0xa1, 0x34, 0xc8, 0x25, 0xa7},
- },
- {
- .length = 112,
- .plaintext = { 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68,
- 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,
- 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a,
- 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b,
- 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c,
- 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d,
- 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e,
- 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
- 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70,
- 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71,
- 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72,
- 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73,
- 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74,
- 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75},
- .ciphertext = { 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68,
- 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,
- 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a,
- 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b,
- 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c,
- 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d,
- 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e,
- 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
- 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70,
- 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71,
- 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72,
- 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73,
- 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74,
- 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75},
- .digest_length = SHA384_DIGEST_LEN,
- .digest = { 0x09, 0x33, 0x0c, 0x33, 0xf7, 0x11, 0x47, 0xe8,
- 0x3d, 0x19, 0x2f, 0xc7, 0x82, 0xcd, 0x1b, 0x47,
- 0x53, 0x11, 0x1b, 0x17, 0x3b, 0x3b, 0x05, 0xd2,
- 0x2f, 0xa0, 0x80, 0x86, 0xe3, 0xb0, 0xf7, 0x12,
- 0xfc, 0xc7, 0xc7, 0x1a, 0x55, 0x7e, 0x2d, 0xb9,
- 0x66, 0xc3, 0xe9, 0xfa, 0x91, 0x74, 0x60, 0x39},
- }
-};
-
-static crypto_test_reference_t sha512_reference[] = {
- {
- .length = 3,
- .plaintext = { 0x61, 0x62, 0x63 },
- .ciphertext = { 0x61, 0x62, 0x63 },
- .digest_length = SHA512_DIGEST_LEN,
- .digest = { 0xdd, 0xaf, 0x35, 0xa1, 0x93, 0x61, 0x7a, 0xba,
- 0xcc, 0x41, 0x73, 0x49, 0xae, 0x20, 0x41, 0x31,
- 0x12, 0xe6, 0xfa, 0x4e, 0x89, 0xa9, 0x7e, 0xa2,
- 0x0a, 0x9e, 0xee, 0xe6, 0x4b, 0x55, 0xd3, 0x9a,
- 0x21, 0x92, 0x99, 0x2a, 0x27, 0x4f, 0xc1, 0xa8,
- 0x36, 0xba, 0x3c, 0x23, 0xa3, 0xfe, 0xeb, 0xbd,
- 0x45, 0x4d, 0x44, 0x23, 0x64, 0x3c, 0xe8, 0x0e,
- 0x2a, 0x9a, 0xc9, 0x4f, 0xa5, 0x4c, 0xa4, 0x9f},
- },
- {
- .length = 112,
- .plaintext = { 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68,
- 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,
- 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a,
- 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b,
- 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c,
- 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d,
- 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e,
- 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
- 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70,
- 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71,
- 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72,
- 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73,
- 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74,
- 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75},
- .ciphertext = { 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68,
- 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,
- 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a,
- 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b,
- 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c,
- 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d,
- 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e,
- 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
- 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70,
- 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71,
- 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72,
- 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73,
- 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74,
- 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75},
- .digest_length = SHA512_DIGEST_LEN,
- .digest = { 0x8e, 0x95, 0x9b, 0x75, 0xda, 0xe3, 0x13, 0xda,
- 0x8c, 0xf4, 0xf7, 0x28, 0x14, 0xfc, 0x14, 0x3f,
- 0x8f, 0x77, 0x79, 0xc6, 0xeb, 0x9f, 0x7f, 0xa1,
- 0x72, 0x99, 0xae, 0xad, 0xb6, 0x88, 0x90, 0x18,
- 0x50, 0x1d, 0x28, 0x9e, 0x49, 0x00, 0xf7, 0xe4,
- 0x33, 0x1b, 0x99, 0xde, 0xc4, 0xb5, 0x43, 0x3a,
- 0xc7, 0xd3, 0x29, 0xee, 0xb6, 0xdd, 0x26, 0x54,
- 0x5e, 0x96, 0xe5, 0x5b, 0x87, 0x4b, 0xe9, 0x09},
- }
-};
-
-static void init_reference(crypto_test_reference_t *ref, int size)
+static inline void init_reference(crypto_test_reference_t *ref, int size)
{
int n;
crypto_test_reference_t *prev = NULL;
diff --git a/test/validation/api/crypto/util.c b/test/validation/api/crypto/util.c
new file mode 100644
index 000000000..557e5e951
--- /dev/null
+++ b/test/validation/api/crypto/util.c
@@ -0,0 +1,310 @@
+/* Copyright (c) 2014-2018, Linaro Limited
+ * Copyright (c) 2021-2023, Nokia
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <string.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <odp_api.h>
+#include <odp_cunit_common.h>
+#include <odp/helper/odph_api.h>
+#include "util.h"
+
+struct suite_context_s suite_context;
+
+const char *auth_alg_name(odp_auth_alg_t auth)
+{
+ switch (auth) {
+ case ODP_AUTH_ALG_NULL:
+ return "ODP_AUTH_ALG_NULL";
+ case ODP_AUTH_ALG_MD5_HMAC:
+ return "ODP_AUTH_ALG_MD5_HMAC";
+ case ODP_AUTH_ALG_SHA1_HMAC:
+ return "ODP_AUTH_ALG_SHA1_HMAC";
+ case ODP_AUTH_ALG_SHA224_HMAC:
+ return "ODP_AUTH_ALG_SHA224_HMAC";
+ case ODP_AUTH_ALG_SHA256_HMAC:
+ return "ODP_AUTH_ALG_SHA256_HMAC";
+ case ODP_AUTH_ALG_SHA384_HMAC:
+ return "ODP_AUTH_ALG_SHA384_HMAC";
+ case ODP_AUTH_ALG_SHA512_HMAC:
+ return "ODP_AUTH_ALG_SHA512_HMAC";
+ case ODP_AUTH_ALG_AES_XCBC_MAC:
+ return "ODP_AUTH_ALG_AES_XCBC_MAC";
+ case ODP_AUTH_ALG_AES_GCM:
+ return "ODP_AUTH_ALG_AES_GCM";
+ case ODP_AUTH_ALG_AES_GMAC:
+ return "ODP_AUTH_ALG_AES_GMAC";
+ case ODP_AUTH_ALG_AES_CCM:
+ return "ODP_AUTH_ALG_AES_CCM";
+ case ODP_AUTH_ALG_AES_CMAC:
+ return "ODP_AUTH_ALG_AES_CMAC";
+ case ODP_AUTH_ALG_CHACHA20_POLY1305:
+ return "ODP_AUTH_ALG_CHACHA20_POLY1305";
+ case ODP_AUTH_ALG_KASUMI_F9:
+ return "ODP_AUTH_ALG_KASUMI_F9";
+ case ODP_AUTH_ALG_SNOW3G_UIA2:
+ return "ODP_AUTH_ALG_SNOW3G_UIA2";
+ case ODP_AUTH_ALG_AES_EIA2:
+ return "ODP_AUTH_ALG_AES_EIA2";
+ case ODP_AUTH_ALG_ZUC_EIA3:
+ return "ODP_AUTH_ALG_ZUC_EIA3";
+ case ODP_AUTH_ALG_MD5:
+ return "ODP_AUTH_ALG_MD5";
+ case ODP_AUTH_ALG_SHA1:
+ return "ODP_AUTH_ALG_SHA1";
+ case ODP_AUTH_ALG_SHA224:
+ return "ODP_AUTH_ALG_SHA224";
+ case ODP_AUTH_ALG_SHA256:
+ return "ODP_AUTH_ALG_SHA256";
+ case ODP_AUTH_ALG_SHA384:
+ return "ODP_AUTH_ALG_SHA384";
+ case ODP_AUTH_ALG_SHA512:
+ return "ODP_AUTH_ALG_SHA512";
+ default:
+ return "Unknown";
+ }
+}
+
+const char *cipher_alg_name(odp_cipher_alg_t cipher)
+{
+ switch (cipher) {
+ case ODP_CIPHER_ALG_NULL:
+ return "ODP_CIPHER_ALG_NULL";
+ case ODP_CIPHER_ALG_DES:
+ return "ODP_CIPHER_ALG_DES";
+ case ODP_CIPHER_ALG_3DES_CBC:
+ return "ODP_CIPHER_ALG_3DES_CBC";
+ case ODP_CIPHER_ALG_3DES_ECB:
+ return "ODP_CIPHER_ALG_3DES_ECB";
+ case ODP_CIPHER_ALG_AES_CBC:
+ return "ODP_CIPHER_ALG_AES_CBC";
+ case ODP_CIPHER_ALG_AES_CTR:
+ return "ODP_CIPHER_ALG_AES_CTR";
+ case ODP_CIPHER_ALG_AES_ECB:
+ return "ODP_CIPHER_ALG_AES_ECB";
+ case ODP_CIPHER_ALG_AES_CFB128:
+ return "ODP_CIPHER_ALG_AES_CFB128";
+ case ODP_CIPHER_ALG_AES_XTS:
+ return "ODP_CIPHER_ALG_AES_XTS";
+ case ODP_CIPHER_ALG_AES_GCM:
+ return "ODP_CIPHER_ALG_AES_GCM";
+ case ODP_CIPHER_ALG_AES_CCM:
+ return "ODP_CIPHER_ALG_AES_CCM";
+ case ODP_CIPHER_ALG_CHACHA20_POLY1305:
+ return "ODP_CIPHER_ALG_CHACHA20_POLY1305";
+ case ODP_CIPHER_ALG_KASUMI_F8:
+ return "ODP_CIPHER_ALG_KASUMI_F8";
+ case ODP_CIPHER_ALG_SNOW3G_UEA2:
+ return "ODP_CIPHER_ALG_SNOW3G_UEA2";
+ case ODP_CIPHER_ALG_AES_EEA2:
+ return "ODP_CIPHER_ALG_AES_EEA2";
+ case ODP_CIPHER_ALG_ZUC_EEA3:
+ return "ODP_CIPHER_ALG_ZUC_EEA3";
+ default:
+ return "Unknown";
+ }
+}
+
+int check_alg_support(odp_cipher_alg_t cipher, odp_auth_alg_t auth)
+{
+ odp_crypto_capability_t capability;
+
+ memset(&capability, 0, sizeof(odp_crypto_capability_t));
+ if (odp_crypto_capability(&capability)) {
+ ODPH_ERR("odp_crypto_capability() failed\n");
+ return ODP_TEST_INACTIVE;
+ }
+
+ if (suite_context.queue != ODP_QUEUE_INVALID) {
+ if (suite_context.q_type == ODP_QUEUE_TYPE_PLAIN &&
+ capability.queue_type_plain == 0)
+ return ODP_TEST_INACTIVE;
+ if (suite_context.q_type == ODP_QUEUE_TYPE_SCHED &&
+ capability.queue_type_sched == 0)
+ return ODP_TEST_INACTIVE;
+ }
+
+ if (suite_context.op_mode == ODP_CRYPTO_SYNC &&
+ capability.sync_mode == ODP_SUPPORT_NO)
+ return ODP_TEST_INACTIVE;
+ if (suite_context.op_mode == ODP_CRYPTO_ASYNC &&
+ capability.async_mode == ODP_SUPPORT_NO)
+ return ODP_TEST_INACTIVE;
+
+ /* Cipher algorithms */
+ switch (cipher) {
+ case ODP_CIPHER_ALG_NULL:
+ if (!capability.ciphers.bit.null)
+ return ODP_TEST_INACTIVE;
+ break;
+ case ODP_CIPHER_ALG_DES:
+ if (!capability.ciphers.bit.des)
+ return ODP_TEST_INACTIVE;
+ break;
+ case ODP_CIPHER_ALG_3DES_CBC:
+ if (!capability.ciphers.bit.trides_cbc)
+ return ODP_TEST_INACTIVE;
+ break;
+ case ODP_CIPHER_ALG_3DES_ECB:
+ if (!capability.ciphers.bit.trides_ecb)
+ return ODP_TEST_INACTIVE;
+ break;
+ case ODP_CIPHER_ALG_AES_CBC:
+ if (!capability.ciphers.bit.aes_cbc)
+ return ODP_TEST_INACTIVE;
+ break;
+ case ODP_CIPHER_ALG_AES_CTR:
+ if (!capability.ciphers.bit.aes_ctr)
+ return ODP_TEST_INACTIVE;
+ break;
+ case ODP_CIPHER_ALG_AES_ECB:
+ if (!capability.ciphers.bit.aes_ecb)
+ return ODP_TEST_INACTIVE;
+ break;
+ case ODP_CIPHER_ALG_AES_CFB128:
+ if (!capability.ciphers.bit.aes_cfb128)
+ return ODP_TEST_INACTIVE;
+ break;
+ case ODP_CIPHER_ALG_AES_XTS:
+ if (!capability.ciphers.bit.aes_xts)
+ return ODP_TEST_INACTIVE;
+ break;
+ case ODP_CIPHER_ALG_AES_GCM:
+ if (!capability.ciphers.bit.aes_gcm)
+ return ODP_TEST_INACTIVE;
+ break;
+ case ODP_CIPHER_ALG_AES_CCM:
+ if (!capability.ciphers.bit.aes_ccm)
+ return ODP_TEST_INACTIVE;
+ break;
+ case ODP_CIPHER_ALG_CHACHA20_POLY1305:
+ if (!capability.ciphers.bit.chacha20_poly1305)
+ return ODP_TEST_INACTIVE;
+ break;
+ case ODP_CIPHER_ALG_KASUMI_F8:
+ if (!capability.ciphers.bit.kasumi_f8)
+ return ODP_TEST_INACTIVE;
+ break;
+ case ODP_CIPHER_ALG_SNOW3G_UEA2:
+ if (!capability.ciphers.bit.snow3g_uea2)
+ return ODP_TEST_INACTIVE;
+ break;
+ case ODP_CIPHER_ALG_AES_EEA2:
+ if (!capability.ciphers.bit.aes_eea2)
+ return ODP_TEST_INACTIVE;
+ break;
+ case ODP_CIPHER_ALG_ZUC_EEA3:
+ if (!capability.ciphers.bit.zuc_eea3)
+ return ODP_TEST_INACTIVE;
+ break;
+ default:
+ ODPH_ERR("Unsupported cipher algorithm\n");
+ return ODP_TEST_INACTIVE;
+ }
+
+ /* Authentication algorithms */
+ switch (auth) {
+ case ODP_AUTH_ALG_NULL:
+ if (!capability.auths.bit.null)
+ return ODP_TEST_INACTIVE;
+ break;
+ case ODP_AUTH_ALG_MD5_HMAC:
+ if (!capability.auths.bit.md5_hmac)
+ return ODP_TEST_INACTIVE;
+ break;
+ case ODP_AUTH_ALG_SHA1_HMAC:
+ if (!capability.auths.bit.sha1_hmac)
+ return ODP_TEST_INACTIVE;
+ break;
+ case ODP_AUTH_ALG_SHA224_HMAC:
+ if (!capability.auths.bit.sha224_hmac)
+ return ODP_TEST_INACTIVE;
+ break;
+ case ODP_AUTH_ALG_SHA256_HMAC:
+ if (!capability.auths.bit.sha256_hmac)
+ return ODP_TEST_INACTIVE;
+ break;
+ case ODP_AUTH_ALG_SHA384_HMAC:
+ if (!capability.auths.bit.sha384_hmac)
+ return ODP_TEST_INACTIVE;
+ break;
+ case ODP_AUTH_ALG_SHA512_HMAC:
+ if (!capability.auths.bit.sha512_hmac)
+ return ODP_TEST_INACTIVE;
+ break;
+ case ODP_AUTH_ALG_AES_XCBC_MAC:
+ if (!capability.auths.bit.aes_xcbc_mac)
+ return ODP_TEST_INACTIVE;
+ break;
+ case ODP_AUTH_ALG_AES_GCM:
+ if (!capability.auths.bit.aes_gcm)
+ return ODP_TEST_INACTIVE;
+ break;
+ case ODP_AUTH_ALG_AES_GMAC:
+ if (!capability.auths.bit.aes_gmac)
+ return ODP_TEST_INACTIVE;
+ break;
+ case ODP_AUTH_ALG_AES_CCM:
+ if (!capability.auths.bit.aes_ccm)
+ return ODP_TEST_INACTIVE;
+ break;
+ case ODP_AUTH_ALG_AES_CMAC:
+ if (!capability.auths.bit.aes_cmac)
+ return ODP_TEST_INACTIVE;
+ break;
+ case ODP_AUTH_ALG_CHACHA20_POLY1305:
+ if (!capability.auths.bit.chacha20_poly1305)
+ return ODP_TEST_INACTIVE;
+ break;
+ case ODP_AUTH_ALG_KASUMI_F9:
+ if (!capability.auths.bit.kasumi_f9)
+ return ODP_TEST_INACTIVE;
+ break;
+ case ODP_AUTH_ALG_SNOW3G_UIA2:
+ if (!capability.auths.bit.snow3g_uia2)
+ return ODP_TEST_INACTIVE;
+ break;
+ case ODP_AUTH_ALG_AES_EIA2:
+ if (!capability.auths.bit.aes_eia2)
+ return ODP_TEST_INACTIVE;
+ break;
+ case ODP_AUTH_ALG_ZUC_EIA3:
+ if (!capability.auths.bit.zuc_eia3)
+ return ODP_TEST_INACTIVE;
+ break;
+ case ODP_AUTH_ALG_MD5:
+ if (!capability.auths.bit.md5)
+ return ODP_TEST_INACTIVE;
+ break;
+ case ODP_AUTH_ALG_SHA1:
+ if (!capability.auths.bit.sha1)
+ return ODP_TEST_INACTIVE;
+ break;
+ case ODP_AUTH_ALG_SHA224:
+ if (!capability.auths.bit.sha224)
+ return ODP_TEST_INACTIVE;
+ break;
+ case ODP_AUTH_ALG_SHA256:
+ if (!capability.auths.bit.sha256)
+ return ODP_TEST_INACTIVE;
+ break;
+ case ODP_AUTH_ALG_SHA384:
+ if (!capability.auths.bit.sha384)
+ return ODP_TEST_INACTIVE;
+ break;
+ case ODP_AUTH_ALG_SHA512:
+ if (!capability.auths.bit.sha512)
+ return ODP_TEST_INACTIVE;
+ break;
+ default:
+ ODPH_ERR("Unsupported authentication algorithm\n");
+ return ODP_TEST_INACTIVE;
+ }
+
+ return ODP_TEST_ACTIVE;
+}
+
diff --git a/test/validation/api/crypto/util.h b/test/validation/api/crypto/util.h
new file mode 100644
index 000000000..a81a56820
--- /dev/null
+++ b/test/validation/api/crypto/util.h
@@ -0,0 +1,50 @@
+/* Copyright (c) 2014-2018, Linaro Limited
+ * Copyright (c) 2021-2023, Nokia
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef UTIL_H
+#define UTIL_H
+
+#include <stdint.h>
+#include <odp_api.h>
+#include <odp_cunit_common.h>
+
+#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
+
+struct suite_context_s {
+ odp_crypto_op_mode_t op_mode;
+ odp_pool_t pool;
+ odp_queue_t queue;
+ odp_queue_type_t q_type;
+ odp_event_t (*compl_queue_deq)(void);
+};
+
+extern struct suite_context_s suite_context;
+
+const char *auth_alg_name(odp_auth_alg_t auth);
+
+const char *cipher_alg_name(odp_cipher_alg_t cipher);
+
+/*
+ * Check if given cipher and authentication algorithms are supported
+ *
+ * cipher Cipher algorithm
+ * auth Authentication algorithm
+ *
+ * returns ODP_TEST_ACTIVE when both algorithms are supported or
+ * ODP_TEST_INACTIVE when either algorithm is not supported
+ */
+int check_alg_support(odp_cipher_alg_t cipher, odp_auth_alg_t auth);
+
+static inline void fill_with_pattern(uint8_t *buf, uint32_t len)
+{
+ static uint8_t value;
+
+ for (uint32_t n = 0; n < len; n++)
+ buf[n] = value++;
+}
+
+#endif
diff --git a/test/validation/api/dma/dma.c b/test/validation/api/dma/dma.c
index ad42c9bb3..6c8eeb00c 100644
--- a/test/validation/api/dma/dma.c
+++ b/test/validation/api/dma/dma.c
@@ -101,7 +101,7 @@ static int dma_suite_init(void)
pkt_len = MIN(pkt_len, global.dma_capa.max_seg_len);
odp_pool_param_init(&pool_param);
pool_param.type = ODP_POOL_PACKET;
- pool_param.pkt.num = 4;
+ pool_param.pkt.num = global.dma_capa.max_src_segs + global.dma_capa.max_dst_segs;
pool_param.pkt.len = pkt_len;
pool_param.pkt.max_len = pkt_len;
@@ -173,7 +173,7 @@ static int dma_suite_term(void)
return -1;
}
- return 0;
+ return odp_cunit_print_inactive();
}
static void test_dma_capability(void)
@@ -234,6 +234,7 @@ static void test_dma_param(uint8_t fill)
memset(&dma_pool_param, fill, sizeof(dma_pool_param));
odp_dma_pool_param_init(&dma_pool_param);
+ CU_ASSERT(dma_pool_param.uarea_size == 0);
CU_ASSERT(dma_pool_param.cache_size <= global.dma_capa.pool.max_cache_size);
CU_ASSERT(dma_pool_param.cache_size >= global.dma_capa.pool.min_cache_size);
}
@@ -269,6 +270,54 @@ static void test_dma_debug(void)
CU_ASSERT(odp_dma_destroy(dma) == 0);
}
+static void test_dma_same_name_null(void)
+{
+ odp_dma_param_t dma_param;
+ odp_dma_t dma_a, dma_b;
+
+ odp_dma_param_init(&dma_param);
+ dma_param.compl_mode_mask = ODP_DMA_COMPL_SYNC;
+ dma_a = odp_dma_create(NULL, &dma_param);
+
+ CU_ASSERT_FATAL(dma_a != ODP_DMA_INVALID);
+
+ dma_b = odp_dma_create(NULL, &dma_param);
+
+ CU_ASSERT_FATAL(dma_b != ODP_DMA_INVALID);
+ CU_ASSERT(odp_dma_to_u64(dma_a) != odp_dma_to_u64(dma_b));
+ CU_ASSERT(odp_dma_destroy(dma_a) == 0);
+ CU_ASSERT(odp_dma_destroy(dma_b) == 0);
+}
+
+static void test_dma_same_name_named(void)
+{
+ odp_dma_param_t dma_param;
+ const char *name = "DMA session";
+ odp_dma_t dma, dma_a, dma_b;
+
+ odp_dma_param_init(&dma_param);
+ dma_param.compl_mode_mask = ODP_DMA_COMPL_SYNC;
+ dma_a = odp_dma_create(name, &dma_param);
+
+ CU_ASSERT_FATAL(dma_a != ODP_DMA_INVALID);
+
+ dma = odp_dma_lookup(name);
+
+ CU_ASSERT(odp_dma_to_u64(dma) == odp_dma_to_u64(dma_a));
+
+ dma_b = odp_dma_create(name, &dma_param);
+
+ CU_ASSERT_FATAL(dma_b != ODP_DMA_INVALID);
+
+ dma = odp_dma_lookup(name);
+
+ CU_ASSERT(odp_dma_to_u64(dma) == odp_dma_to_u64(dma_a) ||
+ odp_dma_to_u64(dma) == odp_dma_to_u64(dma_b));
+ CU_ASSERT(odp_dma_to_u64(dma_a) != odp_dma_to_u64(dma_b));
+ CU_ASSERT(odp_dma_destroy(dma_a) == 0);
+ CU_ASSERT(odp_dma_destroy(dma_b) == 0);
+}
+
static void test_dma_compl_pool(void)
{
odp_pool_t pool;
@@ -291,6 +340,7 @@ static void test_dma_compl_pool(void)
CU_ASSERT(pool_info.pool_ext == 0);
CU_ASSERT(pool_info.type == ODP_POOL_DMA_COMPL);
CU_ASSERT(pool_info.dma_pool_param.num == global.dma_capa.max_transfers);
+ CU_ASSERT(pool_info.dma_pool_param.uarea_size == 0);
CU_ASSERT(pool_info.dma_pool_param.cache_size == global.cache_size);
for (i = 0; i < global.dma_capa.max_transfers; i++) {
@@ -364,6 +414,50 @@ static void test_dma_compl_pool_max_pools(void)
}
}
+static void test_dma_compl_user_area(void)
+{
+ odp_dma_pool_param_t dma_pool_param;
+ uint32_t num = MIN(10, global.dma_capa.pool.max_num),
+ size = global.dma_capa.pool.max_uarea_size, i;
+ odp_pool_t pool;
+ odp_dma_compl_t compl_evs[num];
+ void *addr, *prev = NULL;
+
+ odp_dma_pool_param_init(&dma_pool_param);
+ dma_pool_param.num = num;
+ dma_pool_param.uarea_size = size;
+ pool = odp_dma_pool_create(NULL, &dma_pool_param);
+
+ CU_ASSERT_FATAL(pool != ODP_POOL_INVALID);
+
+ for (i = 0; i < num; i++) {
+ odp_event_t ev;
+
+ compl_evs[i] = odp_dma_compl_alloc(pool);
+
+ if (compl_evs[i] == ODP_DMA_COMPL_INVALID)
+ break;
+
+ addr = odp_dma_compl_user_area(compl_evs[i]);
+
+ CU_ASSERT_FATAL(addr != NULL);
+ CU_ASSERT(prev != addr);
+
+ ev = odp_dma_compl_to_event(compl_evs[i]);
+ CU_ASSERT(odp_event_user_area(ev) == addr);
+
+ prev = addr;
+ memset(addr, 0, size);
+ }
+
+ CU_ASSERT(i == num);
+
+ for (uint32_t j = 0; j < i; j++)
+ odp_dma_compl_free(compl_evs[j]);
+
+ CU_ASSERT(odp_pool_destroy(pool) == 0);
+}
+
static void init_source(uint8_t *src, uint32_t len)
{
uint32_t i;
@@ -1043,6 +1137,17 @@ static int check_sync(void)
return ODP_TEST_ACTIVE;
}
+static int check_session_count(void)
+{
+ if (global.disabled)
+ return ODP_TEST_INACTIVE;
+
+ if (global.dma_capa.max_sessions > 1)
+ return ODP_TEST_ACTIVE;
+
+ return ODP_TEST_INACTIVE;
+}
+
static int check_event(void)
{
if (global.disabled)
@@ -1054,6 +1159,18 @@ static int check_event(void)
return ODP_TEST_INACTIVE;
}
+static int check_event_user_area(void)
+{
+ if (global.disabled)
+ return ODP_TEST_INACTIVE;
+
+ if ((global.dma_capa.compl_mode_mask & ODP_DMA_COMPL_EVENT) &&
+ global.dma_capa.pool.max_uarea_size > 0)
+ return ODP_TEST_ACTIVE;
+
+ return ODP_TEST_INACTIVE;
+}
+
static int check_scheduled(void)
{
if (global.disabled)
@@ -1126,6 +1243,72 @@ static void test_dma_addr_to_addr_sync_res(void)
test_dma_addr_to_addr(ODP_DMA_COMPL_SYNC, 1, 0, RESULT);
}
+static void get_seg_lens(uint32_t max_len, uint32_t *src, uint32_t *dst)
+{
+ uint32_t src_segs = *src, dst_segs = *dst;
+
+ *src = max_len / src_segs;
+ *dst = *src * src_segs / dst_segs + *src * src_segs % dst_segs;
+}
+
+static void test_dma_addr_to_addr_sync_max_seg(void)
+{
+ odp_dma_param_t dma_param;
+ odp_dma_transfer_param_t trs_param;
+ odp_dma_t dma;
+ odp_dma_seg_t src_seg[global.dma_capa.max_src_segs];
+ odp_dma_seg_t dst_seg[global.dma_capa.max_dst_segs];
+ uint32_t src_len = global.dma_capa.max_src_segs, dst_len = global.dma_capa.max_dst_segs,
+ len;
+ int ret;
+
+ init_source(global.src_addr, global.data_size);
+ memset(global.dst_addr, 0, global.data_size);
+ odp_dma_param_init(&dma_param);
+ dma_param.compl_mode_mask = ODP_DMA_COMPL_SYNC;
+ dma = odp_dma_create("addr_to_addr_max_seg", &dma_param);
+
+ CU_ASSERT_FATAL(dma != ODP_DMA_INVALID);
+
+ get_seg_lens(global.len, &src_len, &dst_len);
+
+ for (uint32_t i = 0; i < global.dma_capa.max_src_segs; i++) {
+ uint8_t *addr = global.src_addr + i * src_len;
+
+ memset(&src_seg[i], 0, sizeof(odp_dma_seg_t));
+ src_seg[i].addr = addr;
+ src_seg[i].len = src_len;
+ }
+
+ len = src_len * global.dma_capa.max_src_segs;
+
+ for (uint32_t i = 0; i < global.dma_capa.max_dst_segs; i++) {
+ uint8_t *addr = global.dst_addr + i * dst_len;
+
+ memset(&dst_seg[i], 0, sizeof(odp_dma_seg_t));
+ dst_seg[i].addr = addr;
+ dst_seg[i].len = MIN(len, dst_len);
+ len -= dst_len;
+ }
+
+ odp_dma_transfer_param_init(&trs_param);
+ trs_param.src_format = ODP_DMA_FORMAT_ADDR;
+ trs_param.dst_format = ODP_DMA_FORMAT_ADDR;
+ trs_param.num_src = global.dma_capa.max_src_segs;
+ trs_param.num_dst = global.dma_capa.max_dst_segs;
+ trs_param.src_seg = src_seg;
+ trs_param.dst_seg = dst_seg;
+ ret = do_transfer(dma, &trs_param, 0, 0);
+
+ if (ret > 0) {
+ len = src_len * global.dma_capa.max_src_segs;
+
+ CU_ASSERT(check_equal(global.src_addr, global.dst_addr, len) == 0);
+ }
+
+ CU_ASSERT(odp_dma_destroy(dma) == 0);
+}
+
static void test_dma_addr_to_pkt_sync(void)
{
test_dma_addr_to_pkt(ODP_DMA_COMPL_SYNC, 0);
@@ -1141,6 +1324,87 @@ static void test_dma_pkt_to_pkt_sync(void)
test_dma_pkt_to_pkt(ODP_DMA_COMPL_SYNC, 0);
}
+static void test_dma_pkt_to_pkt_sync_max_seg(void)
+{
+ odp_dma_param_t dma_param;
+ odp_dma_transfer_param_t trs_param;
+ odp_dma_t dma;
+ odp_packet_t pkt;
+ odp_dma_seg_t src_seg[global.dma_capa.max_src_segs];
+ odp_dma_seg_t dst_seg[global.dma_capa.max_dst_segs];
+ uint32_t src_len = global.dma_capa.max_src_segs, dst_len = global.dma_capa.max_dst_segs,
+ len;
+ int ret;
+
+ odp_dma_param_init(&dma_param);
+ dma_param.compl_mode_mask = ODP_DMA_COMPL_SYNC;
+ dma = odp_dma_create("pkt_to_pkt_max_seg", &dma_param);
+
+ CU_ASSERT_FATAL(dma != ODP_DMA_INVALID);
+
+ pkt = odp_packet_alloc(global.pkt_pool, global.pkt_len);
+
+ CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
+
+ get_seg_lens(odp_packet_seg_len(pkt), &src_len, &dst_len);
+ odp_packet_free(pkt);
+
+ for (uint32_t i = 0; i < global.dma_capa.max_src_segs; i++) {
+ pkt = odp_packet_alloc(global.pkt_pool, src_len);
+
+ CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
+
+ init_source(odp_packet_data(pkt), src_len);
+ memset(&src_seg[i], 0, sizeof(odp_dma_seg_t));
+ src_seg[i].packet = pkt;
+ src_seg[i].len = src_len;
+ }
+
+ len = src_len * global.dma_capa.max_src_segs;
+
+ for (uint32_t i = 0; i < global.dma_capa.max_dst_segs; i++) {
+ pkt = odp_packet_alloc(global.pkt_pool, dst_len);
+
+ CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
+
+ memset(odp_packet_data(pkt), 0, dst_len);
+ memset(&dst_seg[i], 0, sizeof(odp_dma_seg_t));
+ dst_seg[i].packet = pkt;
+ dst_seg[i].len = MIN(len, dst_len);
+ len -= dst_len;
+ }
+
+ odp_dma_transfer_param_init(&trs_param);
+ trs_param.src_format = ODP_DMA_FORMAT_PACKET;
+ trs_param.dst_format = ODP_DMA_FORMAT_PACKET;
+ trs_param.num_src = global.dma_capa.max_src_segs;
+ trs_param.num_dst = global.dma_capa.max_dst_segs;
+ trs_param.src_seg = src_seg;
+ trs_param.dst_seg = dst_seg;
+ ret = do_transfer(dma, &trs_param, 0, 0);
+
+ if (ret > 0) {
+ len = src_len * global.dma_capa.max_src_segs;
+ uint8_t src[len], dst[len];
+
+ for (uint32_t i = 0; i < global.dma_capa.max_src_segs; i++) {
+ memcpy(src + i * src_len, odp_packet_data(src_seg[i].packet),
+ src_seg[i].len);
+ odp_packet_free(src_seg[i].packet);
+ }
+
+ for (uint32_t i = 0; i < global.dma_capa.max_dst_segs; i++) {
+ memcpy(dst + i * dst_len, odp_packet_data(dst_seg[i].packet),
+ dst_seg[i].len);
+ odp_packet_free(dst_seg[i].packet);
+ }
+
+ CU_ASSERT(check_equal(src, dst, len) == 0);
+ }
+
+ CU_ASSERT(odp_dma_destroy(dma) == 0);
+}
+
static void test_dma_addr_to_addr_poll(void)
{
test_dma_addr_to_addr(ODP_DMA_COMPL_POLL, 1, 0, 0);
@@ -1298,16 +1562,21 @@ odp_testinfo_t dma_suite[] = {
ODP_TEST_INFO(test_dma_capability),
ODP_TEST_INFO_CONDITIONAL(test_dma_param_init, check_sync),
ODP_TEST_INFO_CONDITIONAL(test_dma_debug, check_sync),
+ ODP_TEST_INFO_CONDITIONAL(test_dma_same_name_null, check_session_count),
+ ODP_TEST_INFO_CONDITIONAL(test_dma_same_name_named, check_session_count),
ODP_TEST_INFO_CONDITIONAL(test_dma_compl_pool, check_event),
ODP_TEST_INFO_CONDITIONAL(test_dma_compl_pool_same_name, check_event),
ODP_TEST_INFO_CONDITIONAL(test_dma_compl_pool_max_pools, check_event),
+ ODP_TEST_INFO_CONDITIONAL(test_dma_compl_user_area, check_event_user_area),
ODP_TEST_INFO_CONDITIONAL(test_dma_addr_to_addr_sync, check_sync),
ODP_TEST_INFO_CONDITIONAL(test_dma_addr_to_addr_sync_mtrs, check_sync),
ODP_TEST_INFO_CONDITIONAL(test_dma_addr_to_addr_sync_mseg, check_sync),
ODP_TEST_INFO_CONDITIONAL(test_dma_addr_to_addr_sync_res, check_sync),
+ ODP_TEST_INFO_CONDITIONAL(test_dma_addr_to_addr_sync_max_seg, check_sync),
ODP_TEST_INFO_CONDITIONAL(test_dma_addr_to_pkt_sync, check_sync),
ODP_TEST_INFO_CONDITIONAL(test_dma_pkt_to_addr_sync, check_sync),
ODP_TEST_INFO_CONDITIONAL(test_dma_pkt_to_pkt_sync, check_sync),
+ ODP_TEST_INFO_CONDITIONAL(test_dma_pkt_to_pkt_sync_max_seg, check_sync),
ODP_TEST_INFO_CONDITIONAL(test_dma_addr_to_addr_poll, check_poll),
ODP_TEST_INFO_CONDITIONAL(test_dma_addr_to_addr_poll_mtrs, check_poll),
ODP_TEST_INFO_CONDITIONAL(test_dma_addr_to_addr_poll_mseg, check_poll),
diff --git a/test/validation/api/init/.gitignore b/test/validation/api/init/.gitignore
index e312d2cf6..4e14eb040 100644
--- a/test/validation/api/init/.gitignore
+++ b/test/validation/api/init/.gitignore
@@ -6,3 +6,4 @@ init_num_thr
init_feature_enabled
init_feature_disabled
init_test_param_init
+init_test_term_abnormal
diff --git a/test/validation/api/init/Makefile.am b/test/validation/api/init/Makefile.am
index 1ddf1dd0d..8226b87ce 100644
--- a/test/validation/api/init/Makefile.am
+++ b/test/validation/api/init/Makefile.am
@@ -4,7 +4,7 @@ include ../Makefile.inc
# the same application process to call odp_init_global() multiple times.
test_PROGRAMS = init_defaults init_abort init_log init_num_thr \
init_feature_enabled init_feature_disabled init_log_thread \
- init_test_param_init
+ init_test_param_init init_test_term_abnormal
init_defaults_CPPFLAGS = -DINIT_TEST=0 $(AM_CPPFLAGS)
init_abort_CPPFLAGS = -DINIT_TEST=1 $(AM_CPPFLAGS)
@@ -14,6 +14,7 @@ init_feature_enabled_CPPFLAGS = -DINIT_TEST=4 $(AM_CPPFLAGS)
init_feature_disabled_CPPFLAGS = -DINIT_TEST=5 $(AM_CPPFLAGS)
init_log_thread_CPPFLAGS = -DINIT_TEST=6 $(AM_CPPFLAGS)
init_test_param_init_CPPFLAGS = -DINIT_TEST=7 $(AM_CPPFLAGS)
+init_test_term_abnormal_CPPFLAGS = -DINIT_TEST=8 $(AM_CPPFLAGS)
init_defaults_SOURCES = init_main.c
init_abort_SOURCES = init_main.c
@@ -23,3 +24,4 @@ init_feature_enabled_SOURCES = init_main.c
init_feature_disabled_SOURCES = init_main.c
init_log_thread_SOURCES = init_main.c
init_test_param_init_SOURCES = init_main.c
+init_test_term_abnormal_SOURCES = init_main.c
diff --git a/test/validation/api/init/init_main.c b/test/validation/api/init/init_main.c
index 5cbaf72eb..c3dba105e 100644
--- a/test/validation/api/init/init_main.c
+++ b/test/validation/api/init/init_main.c
@@ -1,11 +1,12 @@
/* Copyright (c) 2015-2018, Linaro Limited
- * Copyright (c) 2019-2022, Nokia
+ * Copyright (c) 2019-2023, Nokia
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <odp_api.h>
+#include <odp/helper/odph_api.h>
#include <odp_cunit_common.h>
#include <stdarg.h>
@@ -241,6 +242,24 @@ static void init_test_feature_disabled(void)
init_test_feature(1);
}
+static void init_test_term_abnormal(void)
+{
+ int ret;
+ odp_instance_t instance;
+
+ ret = odp_init_global(&instance, NULL, NULL);
+ CU_ASSERT_FATAL(ret == 0);
+
+ ret = odp_init_local(instance, ODP_THREAD_WORKER);
+ CU_ASSERT_FATAL(ret == 0);
+
+ /* odp_term_abnormal() is allowed to fail */
+ ret = odp_term_abnormal(instance, 0, NULL);
+
+ if (ret < 0)
+ ODPH_ERR("Failed to perform all abnormal termination actions: %d\n", ret);
+}
+
odp_testinfo_t testinfo[] = {
ODP_TEST_INFO(init_test_defaults),
ODP_TEST_INFO(init_test_abort),
@@ -250,6 +269,7 @@ odp_testinfo_t testinfo[] = {
ODP_TEST_INFO(init_test_feature_disabled),
ODP_TEST_INFO(init_test_log_thread),
ODP_TEST_INFO(init_test_param_init),
+ ODP_TEST_INFO(init_test_term_abnormal)
};
odp_testinfo_t init_suite[] = {
@@ -265,7 +285,7 @@ odp_suiteinfo_t init_suites[] = {
static int fill_testinfo(odp_testinfo_t *info, unsigned int test_case)
{
if (test_case >= (sizeof(testinfo) / sizeof(odp_testinfo_t))) {
- printf("Bad test case number %u\n", test_case);
+ ODPH_ERR("Bad test case number %u\n", test_case);
return -1;
}
diff --git a/test/validation/api/ipsec/ipsec.c b/test/validation/api/ipsec/ipsec.c
index 11860bf9b..ea2685666 100644
--- a/test/validation/api/ipsec/ipsec.c
+++ b/test/validation/api/ipsec/ipsec.c
@@ -57,12 +57,12 @@ static odp_pktio_t pktio_create(odp_pool_t pool)
if (pktio == ODP_PKTIO_INVALID) {
ret = odp_pool_destroy(pool);
if (ret)
- fprintf(stderr, "unable to destroy pool.\n");
+ ODPH_ERR("Unable to destroy pool\n");
return ODP_PKTIO_INVALID;
}
if (odp_pktio_capability(pktio, &capa)) {
- fprintf(stderr, "pktio capabilities failed.\n");
+ ODPH_ERR("Pktio capabilities failed\n");
return ODP_PKTIO_INVALID;
}
@@ -70,12 +70,12 @@ static odp_pktio_t pktio_create(odp_pool_t pool)
pktin_param.queue_param.sched.sync = ODP_SCHED_SYNC_ATOMIC;
if (odp_pktin_queue_config(pktio, &pktin_param)) {
- fprintf(stderr, "pktin queue config failed.\n");
+ ODPH_ERR("Pktin queue config failed\n");
return ODP_PKTIO_INVALID;
}
if (odp_pktout_queue_config(pktio, NULL)) {
- fprintf(stderr, "pktout queue config failed.\n");
+ ODPH_ERR("Pktout queue config failed\n");
return ODP_PKTIO_INVALID;
}
@@ -213,7 +213,7 @@ static void pktio_stop(odp_pktio_t pktio)
odp_pktin_event_queue(pktio, &queue, 1);
if (odp_pktio_stop(pktio))
- fprintf(stderr, "IPsec pktio stop failed.\n");
+ ODPH_ERR("IPsec pktio stop failed\n");
while (1) {
odp_event_t ev = recv_event(queue, 0);
@@ -266,7 +266,7 @@ int ipsec_check(odp_bool_t ah,
if (ah && (ODP_SUPPORT_NO == capa.proto_ah))
return ODP_TEST_INACTIVE;
- if (odph_ipsec_alg_check(capa, cipher, cipher_bits / 8, auth,
+ if (odph_ipsec_alg_check(&capa, cipher, cipher_bits / 8, auth,
auth_bits / 8) < 0)
return ODP_TEST_INACTIVE;
@@ -395,7 +395,10 @@ void ipsec_sa_param_fill(odp_ipsec_sa_param_t *param,
param->dir = dir;
if (dir == ODP_IPSEC_DIR_INBOUND) {
param->inbound.lookup_mode = ODP_IPSEC_LOOKUP_SPI;
- param->inbound.antireplay_ws = capa.max_antireplay_ws;
+ if (auth_alg == ODP_AUTH_ALG_NULL)
+ param->inbound.antireplay_ws = 0;
+ else
+ param->inbound.antireplay_ws = capa.max_antireplay_ws;
}
param->proto = proto;
@@ -455,6 +458,9 @@ static void ipsec_status_event_handle(odp_event_t ev_status,
CU_ASSERT_EQUAL(1, odp_event_is_valid(ev_status));
CU_ASSERT_EQUAL_FATAL(ODP_EVENT_IPSEC_STATUS, odp_event_type(ev_status));
+ /* No user area for IPsec status events */
+ CU_ASSERT(odp_event_user_area(ev_status) == NULL);
+
CU_ASSERT_EQUAL(0, odp_ipsec_status(&status, ev_status));
CU_ASSERT_EQUAL(ODP_IPSEC_STATUS_WARN, status.id);
CU_ASSERT_EQUAL(sa, status.sa);
@@ -1276,7 +1282,7 @@ int ipsec_suite_term(void)
if (ODP_QUEUE_INVALID != suite_context.queue) {
if (odp_queue_destroy(suite_context.queue))
- fprintf(stderr, "IPsec destq destroy failed.\n");
+ ODPH_ERR("IPsec destq destroy failed\n");
}
if (odp_cunit_print_inactive())
@@ -1329,7 +1335,7 @@ int ipsec_suite_plain_init(void)
dest_queue = plain_queue_create("ipsec-out");
if (ODP_QUEUE_INVALID == dest_queue) {
- fprintf(stderr, "IPsec destq creation failed.\n");
+ ODPH_ERR("IPsec destq creation failed\n");
return -1;
}
@@ -1345,7 +1351,7 @@ int ipsec_suite_sched_init(void)
dest_queue = sched_queue_create("ipsec-out");
if (ODP_QUEUE_INVALID == dest_queue) {
- fprintf(stderr, "IPsec destq creation failed.\n");
+ ODPH_ERR("IPsec destq creation failed\n");
return -1;
}
@@ -1371,7 +1377,7 @@ int ipsec_init(odp_instance_t *inst, odp_ipsec_op_mode_t mode)
suite_context.default_queue = ODP_QUEUE_INVALID;
if (odph_options(&helper_options)) {
- fprintf(stderr, "error: odph_options() failed.\n");
+ ODPH_ERR("odph_options() failed\n");
return -1;
}
@@ -1379,22 +1385,22 @@ int ipsec_init(odp_instance_t *inst, odp_ipsec_op_mode_t mode)
init_param.mem_model = helper_options.mem_model;
if (0 != odp_init_global(inst, &init_param, NULL)) {
- fprintf(stderr, "error: odp_init_global() failed.\n");
+ ODPH_ERR("odp_init_global() failed\n");
return -1;
}
if (0 != odp_init_local(*inst, ODP_THREAD_CONTROL)) {
- fprintf(stderr, "error: odp_init_local() failed.\n");
+ ODPH_ERR("odp_init_local() failed\n");
return -1;
}
if (odp_schedule_config(NULL)) {
- fprintf(stderr, "odp_schedule_config() failed.\n");
+ ODPH_ERR("odp_schedule_config() failed\n");
return -1;
}
if (odp_pool_capability(&pool_capa) < 0) {
- fprintf(stderr, "error: odp_pool_capability() failed.\n");
+ ODPH_ERR("odp_pool_capability() failed\n");
return -1;
}
@@ -1406,27 +1412,27 @@ int ipsec_init(odp_instance_t *inst, odp_ipsec_op_mode_t mode)
if (pool_capa.pkt.max_seg_len &&
MAX_PKT_LEN > pool_capa.pkt.max_seg_len) {
- fprintf(stderr, "Warning: small packet segment length\n");
+ ODPH_ERR("Warning: small packet segment length\n");
params.pkt.seg_len = pool_capa.pkt.max_seg_len;
}
if (pool_capa.pkt.max_len &&
MAX_PKT_LEN > pool_capa.pkt.max_len) {
- fprintf(stderr, "Pool max packet length too small\n");
+ ODPH_ERR("Pool max packet length too small\n");
return -1;
}
pool = odp_pool_create("packet_pool", &params);
if (ODP_POOL_INVALID == pool) {
- fprintf(stderr, "Packet pool creation failed.\n");
+ ODPH_ERR("Packet pool creation failed\n");
return -1;
}
if (mode == ODP_IPSEC_OP_MODE_INLINE) {
pktio = pktio_create(pool);
if (ODP_PKTIO_INVALID == pktio) {
- fprintf(stderr, "IPsec pktio creation failed.\n");
+ ODPH_ERR("IPsec pktio creation failed\n");
return -1;
}
}
@@ -1466,7 +1472,7 @@ int ipsec_config(odp_instance_t ODP_UNUSED inst)
suite_context.default_queue = sched_queue_create("ipsec-default");
if (ODP_QUEUE_INVALID == suite_context.default_queue) {
- fprintf(stderr, "IPsec defaultq creation failed.\n");
+ ODPH_ERR("IPsec defaultq creation failed\n");
return -1;
}
}
@@ -1561,26 +1567,26 @@ int ipsec_term(odp_instance_t inst)
if (ODP_PKTIO_INVALID != pktio) {
if (odp_pktio_close(pktio))
- fprintf(stderr, "IPsec pktio close failed.\n");
+ ODPH_ERR("IPsec pktio close failed\n");
}
if (ODP_QUEUE_INVALID != default_queue) {
if (odp_queue_destroy(default_queue))
- fprintf(stderr, "IPsec defaultq destroy failed.\n");
+ ODPH_ERR("IPsec defaultq destroy failed\n");
}
if (ODP_POOL_INVALID != pool) {
if (odp_pool_destroy(pool))
- fprintf(stderr, "Packet pool destroy failed.\n");
+ ODPH_ERR("Packet pool destroy failed\n");
}
if (0 != odp_term_local()) {
- fprintf(stderr, "error: odp_term_local() failed.\n");
+ ODPH_ERR("odp_term_local() failed\n");
return -1;
}
if (0 != odp_term_global(inst)) {
- fprintf(stderr, "error: odp_term_global() failed.\n");
+ ODPH_ERR("odp_term_global() failed\n");
return -1;
}
diff --git a/test/validation/api/lock/lock.c b/test/validation/api/lock/lock.c
index 729994d66..5210f7e5d 100644
--- a/test/validation/api/lock/lock.c
+++ b/test/validation/api/lock/lock.c
@@ -569,12 +569,12 @@ static int spinlock_functional_test(void *arg UNUSED)
if ((global_mem->g_verbose) &&
((sync_failures != 0) || (is_locked_errs != 0)))
- printf("\nThread %" PRIu32 " (id=%d core=%d) had %" PRIu32
- " sync_failures and %" PRIu32
- " is_locked_errs in %" PRIu32
- " iterations\n", thread_num,
- per_thread_mem->thread_id, per_thread_mem->thread_core,
- sync_failures, is_locked_errs, iterations);
+ ODPH_ERR("Thread %" PRIu32 " (id=%d core=%d) had %" PRIu32
+ " sync_failures and %" PRIu32
+ " is_locked_errs in %" PRIu32
+ " iterations\n", thread_num,
+ per_thread_mem->thread_id, per_thread_mem->thread_core,
+ sync_failures, is_locked_errs, iterations);
CU_ASSERT(sync_failures == 0);
CU_ASSERT(is_locked_errs == 0);
@@ -675,14 +675,14 @@ static int spinlock_recursive_functional_test(void *arg UNUSED)
if ((global_mem->g_verbose) &&
(sync_failures != 0 || recursive_errs != 0 || is_locked_errs != 0))
- printf("\nThread %" PRIu32 " (id=%d core=%d) had %" PRIu32
- " sync_failures and %" PRIu32
- " recursive_errs and %" PRIu32
- " is_locked_errs in %" PRIu32
- " iterations\n", thread_num,
- per_thread_mem->thread_id, per_thread_mem->thread_core,
- sync_failures, recursive_errs, is_locked_errs,
- iterations);
+ ODPH_ERR("Thread %" PRIu32 " (id=%d core=%d) had %" PRIu32
+ " sync_failures and %" PRIu32
+ " recursive_errs and %" PRIu32
+ " is_locked_errs in %" PRIu32
+ " iterations\n", thread_num,
+ per_thread_mem->thread_id, per_thread_mem->thread_core,
+ sync_failures, recursive_errs, is_locked_errs,
+ iterations);
CU_ASSERT(sync_failures == 0);
CU_ASSERT(recursive_errs == 0);
@@ -765,12 +765,12 @@ static int ticketlock_functional_test(void *arg UNUSED)
if ((global_mem->g_verbose) &&
((sync_failures != 0) || (is_locked_errs != 0)))
- printf("\nThread %" PRIu32 " (id=%d core=%d) had %" PRIu32
- " sync_failures and %" PRIu32
- " is_locked_errs in %" PRIu32 " iterations\n",
- thread_num,
- per_thread_mem->thread_id, per_thread_mem->thread_core,
- sync_failures, is_locked_errs, iterations);
+ ODPH_ERR("Thread %" PRIu32 " (id=%d core=%d) had %" PRIu32
+ " sync_failures and %" PRIu32
+ " is_locked_errs in %" PRIu32 " iterations\n",
+ thread_num,
+ per_thread_mem->thread_id, per_thread_mem->thread_core,
+ sync_failures, is_locked_errs, iterations);
CU_ASSERT(sync_failures == 0);
CU_ASSERT(is_locked_errs == 0);
@@ -858,11 +858,11 @@ static int rwlock_functional_test(void *arg UNUSED)
}
if ((global_mem->g_verbose) && (sync_failures != 0))
- printf("\nThread %" PRIu32 " (id=%d core=%d) had %" PRIu32
- " sync_failures in %" PRIu32 " iterations\n", thread_num,
- per_thread_mem->thread_id,
- per_thread_mem->thread_core,
- sync_failures, iterations);
+ ODPH_ERR("Thread %" PRIu32 " (id=%d core=%d) had %" PRIu32
+ " sync_failures in %" PRIu32 " iterations\n", thread_num,
+ per_thread_mem->thread_id,
+ per_thread_mem->thread_core,
+ sync_failures, iterations);
CU_ASSERT(sync_failures == 0);
@@ -985,13 +985,13 @@ static int rwlock_recursive_functional_test(void *arg UNUSED)
}
if ((global_mem->g_verbose) && (sync_failures != 0))
- printf("\nThread %" PRIu32 " (id=%d core=%d) had %" PRIu32
- " sync_failures and %" PRIu32
- " recursive_errs in %" PRIu32
- " iterations\n", thread_num,
- per_thread_mem->thread_id,
- per_thread_mem->thread_core,
- sync_failures, recursive_errs, iterations);
+ ODPH_ERR("Thread %" PRIu32 " (id=%d core=%d) had %" PRIu32
+ " sync_failures and %" PRIu32
+ " recursive_errs in %" PRIu32
+ " iterations\n", thread_num,
+ per_thread_mem->thread_id,
+ per_thread_mem->thread_core,
+ sync_failures, recursive_errs, iterations);
CU_ASSERT(sync_failures == 0);
CU_ASSERT(recursive_errs == 0);
@@ -1153,7 +1153,7 @@ static int lock_init(odp_instance_t *inst)
odph_helper_options_t helper_options;
if (odph_options(&helper_options)) {
- fprintf(stderr, "error: odph_options() failed.\n");
+ ODPH_ERR("odph_options() failed\n");
return -1;
}
@@ -1161,18 +1161,18 @@ static int lock_init(odp_instance_t *inst)
init_param.mem_model = helper_options.mem_model;
if (0 != odp_init_global(inst, &init_param, NULL)) {
- fprintf(stderr, "error: odp_init_global() failed.\n");
+ ODPH_ERR("odp_init_global() failed\n");
return -1;
}
if (0 != odp_init_local(*inst, ODP_THREAD_CONTROL)) {
- fprintf(stderr, "error: odp_init_local() failed.\n");
+ ODPH_ERR("odp_init_local() failed\n");
return -1;
}
global_shm = odp_shm_reserve(GLOBAL_SHM_NAME,
sizeof(global_shared_mem_t), 64, 0);
if (ODP_SHM_INVALID == global_shm) {
- fprintf(stderr, "Unable reserve memory for global_shm\n");
+ ODPH_ERR("Unable to reserve memory for global_shm\n");
return -1;
}
@@ -1208,17 +1208,17 @@ static int lock_term(odp_instance_t inst)
shm = odp_shm_lookup(GLOBAL_SHM_NAME);
if (0 != odp_shm_free(shm)) {
- fprintf(stderr, "error: odp_shm_free() failed.\n");
+ ODPH_ERR("odp_shm_free() failed\n");
return -1;
}
if (0 != odp_term_local()) {
- fprintf(stderr, "error: odp_term_local() failed.\n");
+ ODPH_ERR("odp_term_local() failed\n");
return -1;
}
if (0 != odp_term_global(inst)) {
- fprintf(stderr, "error: odp_term_global() failed.\n");
+ ODPH_ERR("odp_term_global() failed\n");
return -1;
}
diff --git a/test/validation/api/packet/packet.c b/test/validation/api/packet/packet.c
index c654aa055..a7631d47c 100644
--- a/test/validation/api/packet/packet.c
+++ b/test/validation/api/packet/packet.c
@@ -200,7 +200,7 @@ static int packet_suite_init(void)
memset(&pool_capa, 0, sizeof(odp_pool_capability_t));
if (odp_pool_capability(&pool_capa) < 0) {
- printf("pool_capability failed\n");
+ ODPH_ERR("odp_pool_capability() failed\n");
return -1;
}
@@ -246,14 +246,14 @@ static int packet_suite_init(void)
default_pool = odp_pool_create("default_pool", &params);
if (default_pool == ODP_POOL_INVALID) {
- printf("default pool create failed\n");
+ ODPH_ERR("Default pool create failed\n");
return -1;
}
test_packet = odp_packet_alloc(default_pool, packet_len);
if (test_packet == ODP_PACKET_INVALID) {
- printf("test_packet alloc failed\n");
+ ODPH_ERR("Packet alloc failed\n");
return -1;
}
@@ -277,7 +277,7 @@ static int packet_suite_init(void)
segmented_packet_len > pool_capa.pkt.min_seg_len);
if (ret != PACKET_POOL_NUM_SEG) {
- printf("packet alloc failed\n");
+ ODPH_ERR("Packet alloc failed\n");
return -1;
}
segmented_test_packet = pkt_tbl[0];
@@ -285,7 +285,7 @@ static int packet_suite_init(void)
if (odp_packet_is_valid(test_packet) == 0 ||
odp_packet_is_valid(segmented_test_packet) == 0) {
- printf("packet_is_valid failed\n");
+ ODPH_ERR("odp_packet_is_valid() failed\n");
return -1;
}
@@ -299,7 +299,7 @@ static int packet_suite_init(void)
udat = odp_packet_user_area(test_packet);
if (odp_packet_user_area_size(test_packet) < uarea_size) {
- printf("Bad packet user area size %u\n", odp_packet_user_area_size(test_packet));
+ ODPH_ERR("Bad packet user area size %u\n", odp_packet_user_area_size(test_packet));
return -1;
}
@@ -308,8 +308,8 @@ static int packet_suite_init(void)
udat = odp_packet_user_area(segmented_test_packet);
if (odp_packet_user_area_size(segmented_test_packet) < uarea_size) {
- printf("Bad segmented packet user area size %u\n",
- odp_packet_user_area_size(segmented_test_packet));
+ ODPH_ERR("Bad segmented packet user area size %u\n",
+ odp_packet_user_area_size(segmented_test_packet));
return -1;
}
@@ -873,6 +873,12 @@ static void packet_test_basic_metadata(void)
CU_ASSERT(!odp_time_cmp(ts, odp_packet_ts(pkt)));
odp_packet_has_ts_clr(pkt);
CU_ASSERT(!odp_packet_has_ts(pkt));
+
+ CU_ASSERT(odp_packet_free_ctrl(pkt) == ODP_PACKET_FREE_CTRL_DISABLED);
+ odp_packet_free_ctrl_set(pkt, ODP_PACKET_FREE_CTRL_DONT_FREE);
+ CU_ASSERT(odp_packet_free_ctrl(pkt) == ODP_PACKET_FREE_CTRL_DONT_FREE);
+ odp_packet_free_ctrl_set(pkt, ODP_PACKET_FREE_CTRL_DISABLED);
+ CU_ASSERT(odp_packet_free_ctrl(pkt) == ODP_PACKET_FREE_CTRL_DISABLED);
}
static void packet_test_length(void)
@@ -3255,6 +3261,8 @@ static void packet_vector_test_user_area(void)
CU_ASSERT_FATAL(pool != ODP_POOL_INVALID);
for (i = 0; i < num; i++) {
+ odp_event_t ev;
+
pktv[i] = odp_packet_vector_alloc(pool);
if (pktv[i] == ODP_PACKET_VECTOR_INVALID)
@@ -3265,6 +3273,9 @@ static void packet_vector_test_user_area(void)
CU_ASSERT_FATAL(addr != NULL);
CU_ASSERT(prev != addr);
+ ev = odp_packet_vector_to_event(pktv[i]);
+ CU_ASSERT(odp_event_user_area(ev) == addr);
+
prev = addr;
memset(addr, 0, size);
}
@@ -3337,14 +3348,14 @@ static int packet_vector_suite_init(void)
vector_default_pool = odp_pool_create("vector_default_pool", &params);
if (vector_default_pool == ODP_POOL_INVALID) {
- ODPH_ERR("default vector pool create failed\n");
+ ODPH_ERR("Default vector pool create failed\n");
goto err1;
}
/* Allocating a default vector */
pktv_default = odp_packet_vector_alloc(vector_default_pool);
if (pktv_default == ODP_PACKET_VECTOR_INVALID) {
- ODPH_ERR("default vector packet allocation failed\n");
+ ODPH_ERR("Default vector packet allocation failed\n");
goto err2;
}
return 0;
@@ -3400,7 +3411,7 @@ static void packet_test_max_pools(void)
CU_ASSERT(num_pool == max_pools);
if (num_pool != max_pools)
- printf("Error: created only %u pools\n", num_pool);
+ ODPH_ERR("Created only %u pools\n", num_pool);
for (i = 0; i < num_pool; i++) {
packet[i] = odp_packet_alloc(pool[i], len);
@@ -3436,6 +3447,7 @@ static void packet_test_user_area(void)
odp_pool_param_t param;
odp_packet_t pkt;
odp_pool_t pool;
+ odp_event_t ev;
memcpy(&param, &default_param, sizeof(odp_pool_param_t));
@@ -3451,6 +3463,8 @@ static void packet_test_user_area(void)
} else {
CU_ASSERT(odp_packet_user_area(pkt) == NULL);
}
+ ev = odp_packet_to_event(pkt);
+ CU_ASSERT(odp_event_user_area(ev) == odp_packet_user_area(pkt));
odp_packet_free(pkt);
CU_ASSERT(odp_pool_destroy(pool) == 0);
@@ -3464,6 +3478,8 @@ static void packet_test_user_area(void)
pkt = odp_packet_alloc(pool, param.pkt.len);
CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
CU_ASSERT_FATAL(odp_packet_user_area(pkt) != NULL);
+ ev = odp_packet_to_event(pkt);
+ CU_ASSERT(odp_event_user_area(ev) == odp_packet_user_area(pkt));
CU_ASSERT(odp_packet_user_area_size(pkt) >= 1);
*(char *)odp_packet_user_area(pkt) = 0;
CU_ASSERT_FATAL(odp_packet_is_valid(pkt) == 1);
@@ -3476,6 +3492,8 @@ static void packet_test_user_area(void)
pkt = odp_packet_alloc(pool, param.pkt.len);
CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
CU_ASSERT_FATAL(odp_packet_user_area(pkt) != NULL);
+ ev = odp_packet_to_event(pkt);
+ CU_ASSERT(odp_event_user_area(ev) == odp_packet_user_area(pkt));
CU_ASSERT(odp_packet_user_area_size(pkt) == param.pkt.uarea_size);
memset(odp_packet_user_area(pkt), 0, param.pkt.uarea_size);
CU_ASSERT_FATAL(odp_packet_is_valid(pkt) == 1);
@@ -3492,7 +3510,7 @@ static int packet_parse_suite_init(void)
memset(&pool_capa, 0, sizeof(odp_pool_capability_t));
if (odp_pool_capability(&pool_capa) < 0) {
- printf("pool_capability failed\n");
+ ODPH_ERR("odp_pool_capability() failed\n");
return -1;
}
diff --git a/test/validation/api/pktio/parser.c b/test/validation/api/pktio/parser.c
index 2b5042724..7d243877c 100644
--- a/test/validation/api/pktio/parser.c
+++ b/test/validation/api/pktio/parser.c
@@ -70,20 +70,19 @@ static int pkt_pool_create(void)
odp_pool_param_t params;
if (odp_pool_capability(&capa) != 0) {
- printf("Error: unable to query pool capability.\n");
+ ODPH_ERR("Unable to query pool capability\n");
return -1;
}
if (capa.pkt.max_num && capa.pkt.max_num < PKT_POOL_NUM) {
- printf("Error: packet pool size not supported.\n");
- printf("MAX: %" PRIu32 "\n", capa.pkt.max_num);
+ ODPH_ERR("Packet pool size not supported: MAX=%" PRIu32 "\n", capa.pkt.max_num);
return -1;
} else if (capa.pkt.max_len && capa.pkt.max_len < PKT_POOL_BUF_LEN) {
- printf("Error: packet length not supported.\n");
+ ODPH_ERR("Packet length not supported\n");
return -1;
} else if (capa.pkt.max_seg_len &&
capa.pkt.max_seg_len < PKT_POOL_BUF_LEN) {
- printf("Error: segment length not supported.\n");
+ ODPH_ERR("Segment length not supported\n");
return -1;
}
@@ -95,7 +94,7 @@ static int pkt_pool_create(void)
parser_pool = odp_pool_create("pkt_pool_default", &params);
if (parser_pool == ODP_POOL_INVALID) {
- printf("Error: packet pool create failed.\n");
+ ODPH_ERR("Packet pool create failed\n");
return -1;
}
@@ -115,24 +114,24 @@ static odp_pktio_t create_pktio(int iface_idx, odp_pool_t pool)
pktio = odp_pktio_open(iface, pool, &pktio_param);
if (pktio == ODP_PKTIO_INVALID) {
- printf("Error: failed to open %s\n", iface);
+ ODPH_ERR("Failed to open %s\n", iface);
return ODP_PKTIO_INVALID;
}
odp_pktio_config_init(&config);
config.parser.layer = ODP_PROTO_LAYER_ALL;
if (odp_pktio_config(pktio, &config)) {
- printf("Error: failed to configure %s\n", iface);
+ ODPH_ERR("Failed to configure %s\n", iface);
return ODP_PKTIO_INVALID;
}
/* By default, single input and output queue is used */
if (odp_pktin_queue_config(pktio, NULL)) {
- printf("Error: failed to config input queue for %s\n", iface);
+ ODPH_ERR("Failed to config input queue for %s\n", iface);
return ODP_PKTIO_INVALID;
}
if (odp_pktout_queue_config(pktio, NULL)) {
- printf("Error: failed to config output queue for %s\n", iface);
+ ODPH_ERR("Failed to config output queue for %s\n", iface);
return ODP_PKTIO_INVALID;
}
@@ -151,7 +150,7 @@ static odp_packet_t create_packet(const uint8_t *data, uint32_t len)
return ODP_PACKET_INVALID;
if (odp_packet_copy_from_mem(pkt, 0, len, data)) {
- printf("Error: failed to copy test packet data\n");
+ ODPH_ERR("Failed to copy test packet data\n");
odp_packet_free(pkt);
return ODP_PACKET_INVALID;
}
@@ -513,7 +512,7 @@ int parser_suite_init(void)
}
if (pkt_pool_create() != 0) {
- printf("Error: failed to create parser pool\n");
+ ODPH_ERR("Failed to create parser pool\n");
return -1;
}
@@ -525,22 +524,22 @@ int parser_suite_init(void)
io->name = iface_name[i];
io->hdl = create_pktio(i, parser_pool);
if (io->hdl == ODP_PKTIO_INVALID) {
- printf("Error: failed to open iface");
+ ODPH_ERR("Failed to open iface");
return -1;
}
if (odp_pktout_queue(io->hdl, &io->pktout, 1) != 1) {
- printf("Error: failed to start iface: %s\n", io->name);
+ ODPH_ERR("Failed to start iface: %s\n", io->name);
return -1;
}
if (odp_pktin_queue(io->hdl, &io->pktin, 1) != 1) {
- printf("Error: failed to start iface: %s\n", io->name);
+ ODPH_ERR("Failed to start iface: %s\n", io->name);
return -1;
}
if (odp_pktio_start(io->hdl)) {
- printf("Error: failed to start iface: %s\n", io->name);
+ ODPH_ERR("Failed to start iface: %s\n", io->name);
return -1;
}
@@ -562,19 +561,17 @@ int parser_suite_term(void)
for (i = 0; i < num_ifaces; ++i) {
if (odp_pktio_stop(pktios[i].hdl)) {
- printf("Error: failed to stop pktio: %s\n",
- pktios[i].name);
+ ODPH_ERR("Failed to stop pktio: %s\n", pktios[i].name);
ret = -1;
}
if (odp_pktio_close(pktios[i].hdl)) {
- printf("Error: failed to close pktio: %s\n",
- pktios[i].name);
+ ODPH_ERR("Failed to close pktio: %s\n", pktios[i].name);
ret = -1;
}
}
if (odp_pool_destroy(parser_pool) != 0) {
- printf("Error: failed to destroy packet pool\n");
+ ODPH_ERR("Failed to destroy packet pool\n");
ret = -1;
}
diff --git a/test/validation/api/pktio/pktio.c b/test/validation/api/pktio/pktio.c
index 2f4dda4a4..f412a01c4 100644
--- a/test/validation/api/pktio/pktio.c
+++ b/test/validation/api/pktio/pktio.c
@@ -3495,7 +3495,7 @@ static void pktio_test_pktout_ts(void)
}
}
-static void pktio_test_pktout_compl(bool use_plain_queue)
+static void pktio_test_pktout_compl_event(bool use_plain_queue)
{
odp_pktio_t pktio[MAX_NUM_IFACES] = {ODP_PKTIO_INVALID};
odp_queue_t compl_queue[TX_BATCH_LEN];
@@ -3550,7 +3550,9 @@ static void pktio_test_pktout_compl(bool use_plain_queue)
/* Configure Tx completion offload for PKTIO Tx */
if (i == 0) {
- CU_ASSERT_FATAL(pktio_capa.tx_compl.mode_all == 1);
+ CU_ASSERT_FATAL(pktio_capa.tx_compl.mode_event == 1);
+ CU_ASSERT_FATAL(pktio_capa.tx_compl.mode_all ==
+ pktio_capa.tx_compl.mode_event);
if (use_plain_queue) {
/* CU_ASSERT needs these extra braces */
CU_ASSERT_FATAL(pktio_capa.tx_compl.queue_type_plain != 0);
@@ -3559,7 +3561,7 @@ static void pktio_test_pktout_compl(bool use_plain_queue)
}
odp_pktio_config_init(&config);
- config.pktout.bit.tx_compl_ena = 1;
+ config.tx_compl.mode_event = 1;
CU_ASSERT_FATAL(odp_pktio_config(pktio[i], &config) == 0);
}
@@ -3583,10 +3585,30 @@ static void pktio_test_pktout_compl(bool use_plain_queue)
memset(&opt, 0, sizeof(opt));
+ /* Disabled by default */
+ CU_ASSERT(odp_packet_has_tx_compl_request(pkt_tbl[0]) == 0);
+
+ /* Check that disable works. Also COMPL_ALL should be still supported. */
+ opt.queue = compl_queue[0];
+ opt.mode = ODP_PACKET_TX_COMPL_ALL;
+ odp_packet_tx_compl_request(pkt_tbl[0], &opt);
+ CU_ASSERT(odp_packet_has_tx_compl_request(pkt_tbl[0]) != 0);
+ opt.mode = ODP_PACKET_TX_COMPL_DISABLED;
+ odp_packet_tx_compl_request(pkt_tbl[0], &opt);
+ CU_ASSERT(odp_packet_has_tx_compl_request(pkt_tbl[0]) == 0);
+ opt.queue = compl_queue[0];
+ opt.mode = ODP_PACKET_TX_COMPL_EVENT;
+ odp_packet_tx_compl_request(pkt_tbl[0], &opt);
+ CU_ASSERT(odp_packet_has_tx_compl_request(pkt_tbl[0]) != 0);
+ opt.mode = ODP_PACKET_TX_COMPL_DISABLED;
+ odp_packet_tx_compl_request(pkt_tbl[0], &opt);
+ CU_ASSERT(odp_packet_has_tx_compl_request(pkt_tbl[0]) == 0);
+
/* Prepare batch of pkts with different tx completion queues */
for (i = 0; i < TX_BATCH_LEN; i++) {
+ CU_ASSERT(odp_packet_has_tx_compl_request(pkt_tbl[i]) == 0);
opt.queue = compl_queue[i];
- opt.mode = ODP_PACKET_TX_COMPL_ALL;
+ opt.mode = ODP_PACKET_TX_COMPL_EVENT;
odp_packet_tx_compl_request(pkt_tbl[i], &opt);
CU_ASSERT(odp_packet_has_tx_compl_request(pkt_tbl[i]) != 0);
/* Set pkt sequence number as its user ptr */
@@ -3623,6 +3645,9 @@ static void pktio_test_pktout_compl(bool use_plain_queue)
CU_ASSERT(odp_packet_tx_compl_user_ptr(tx_compl) ==
(const void *)&pkt_seq[i]);
+ /* No user area for TX completion events */
+ CU_ASSERT(odp_event_user_area(ev) == NULL);
+
/* Alternatively call event free / compl free */
if (i % 2)
odp_packet_tx_compl_free(tx_compl);
@@ -3657,6 +3682,10 @@ static void pktio_test_pktout_compl(bool use_plain_queue)
break;
}
}
+
+ /* No user area for TX completion events */
+ CU_ASSERT(odp_event_user_area(ev) == NULL);
+
/* Check that sequence number is found */
CU_ASSERT(j < TX_BATCH_LEN);
@@ -3690,7 +3719,104 @@ static void pktio_test_pktout_compl(bool use_plain_queue)
odp_queue_destroy(compl_queue[i]);
}
-static int pktio_check_pktout_compl(bool plain)
+static void pktio_test_pktout_compl_poll(void)
+{
+ odp_pktio_t pktio[MAX_NUM_IFACES] = {ODP_PKTIO_INVALID};
+ odp_packet_t pkt_tbl[TX_BATCH_LEN];
+ odp_pktio_capability_t pktio_capa;
+ odp_pktout_queue_t pktout_queue;
+ uint32_t pkt_seq[TX_BATCH_LEN];
+ odp_pktio_t pktio_tx, pktio_rx;
+ odp_packet_tx_compl_opt_t opt;
+ pktio_info_t pktio_rx_info;
+ odp_pktio_config_t config;
+ int ret, i, num_rx = 0;
+
+ CU_ASSERT_FATAL(num_ifaces >= 1);
+
+ /* Open and configure interfaces */
+ for (i = 0; i < num_ifaces; ++i) {
+ pktio[i] = create_pktio(i, ODP_PKTIN_MODE_DIRECT,
+ ODP_PKTOUT_MODE_DIRECT);
+ CU_ASSERT_FATAL(pktio[i] != ODP_PKTIO_INVALID);
+
+ CU_ASSERT_FATAL(odp_pktio_capability(pktio[i], &pktio_capa) == 0);
+
+ /* Configure Tx completion offload for PKTIO Tx */
+ if (i == 0) {
+ CU_ASSERT_FATAL(pktio_capa.tx_compl.mode_poll == 1);
+ CU_ASSERT_FATAL(pktio_capa.tx_compl.max_compl_id >= (TX_BATCH_LEN - 1));
+
+ odp_pktio_config_init(&config);
+ config.tx_compl.mode_poll = 1;
+ config.tx_compl.max_compl_id = TX_BATCH_LEN - 1;
+ CU_ASSERT_FATAL(odp_pktio_config(pktio[i], &config) == 0);
+ }
+
+ CU_ASSERT_FATAL(odp_pktio_start(pktio[i]) == 0);
+ }
+
+ for (i = 0; i < num_ifaces; i++)
+ _pktio_wait_linkup(pktio[i]);
+
+ pktio_tx = pktio[0];
+ pktio_rx = (num_ifaces > 1) ? pktio[1] : pktio_tx;
+ pktio_rx_info.id = pktio_rx;
+ pktio_rx_info.inq = ODP_QUEUE_INVALID;
+ pktio_rx_info.in_mode = ODP_PKTIN_MODE_DIRECT;
+
+ ret = create_packets(pkt_tbl, pkt_seq, TX_BATCH_LEN, pktio_tx, pktio_rx);
+ CU_ASSERT_FATAL(ret == TX_BATCH_LEN);
+
+ ret = odp_pktout_queue(pktio_tx, &pktout_queue, 1);
+ CU_ASSERT_FATAL(ret > 0);
+
+ memset(&opt, 0, sizeof(opt));
+
+ /* Disabled by default */
+ CU_ASSERT(odp_packet_has_tx_compl_request(pkt_tbl[0]) == 0);
+
+ /* Check that disable works */
+ opt.compl_id = 0;
+ opt.mode = ODP_PACKET_TX_COMPL_POLL;
+ odp_packet_tx_compl_request(pkt_tbl[0], &opt);
+ CU_ASSERT(odp_packet_has_tx_compl_request(pkt_tbl[0]) != 0);
+ opt.mode = ODP_PACKET_TX_COMPL_DISABLED;
+ odp_packet_tx_compl_request(pkt_tbl[0], &opt);
+ CU_ASSERT(odp_packet_has_tx_compl_request(pkt_tbl[0]) == 0);
+
+ /* Prepare batch of pkts with different tx completion identifiers */
+ for (i = 0; i < TX_BATCH_LEN; i++) {
+ CU_ASSERT(odp_packet_has_tx_compl_request(pkt_tbl[i]) == 0);
+ opt.compl_id = i;
+ opt.mode = ODP_PACKET_TX_COMPL_EVENT;
+ odp_packet_tx_compl_request(pkt_tbl[i], &opt);
+ CU_ASSERT(odp_packet_has_tx_compl_request(pkt_tbl[i]) != 0);
+ /* Set pkt sequence number as its user ptr */
+ odp_packet_user_ptr_set(pkt_tbl[i], (const void *)&pkt_seq[i]);
+ }
+
+ CU_ASSERT_FATAL(odp_pktout_send(pktout_queue, pkt_tbl, TX_BATCH_LEN) == TX_BATCH_LEN);
+
+ num_rx = wait_for_packets(&pktio_rx_info, pkt_tbl, pkt_seq, TX_BATCH_LEN, TXRX_MODE_SINGLE,
+ ODP_TIME_SEC_IN_NS, false);
+ CU_ASSERT(num_rx == TX_BATCH_LEN);
+ for (i = 0; i < num_rx; i++)
+ odp_packet_free(pkt_tbl[i]);
+
+ /* Transmits should be complete since we received the packets already */
+ for (i = 0; i < num_rx; i++) {
+ ret = odp_packet_tx_compl_done(pktio_tx, i);
+ CU_ASSERT(ret > 0);
+ }
+
+ for (i = 0; i < num_ifaces; i++) {
+ CU_ASSERT_FATAL(odp_pktio_stop(pktio[i]) == 0);
+ CU_ASSERT_FATAL(odp_pktio_close(pktio[i]) == 0);
+ }
+}
+
+static int pktio_check_pktout_compl_event(bool plain)
{
odp_pktio_param_t pktio_param;
odp_pktio_capability_t capa;
@@ -3708,7 +3834,7 @@ static int pktio_check_pktout_compl(bool plain)
ret = odp_pktio_capability(pktio, &capa);
(void)odp_pktio_close(pktio);
- if (ret < 0 || !capa.tx_compl.mode_all ||
+ if (ret < 0 || !capa.tx_compl.mode_event ||
(plain && !capa.tx_compl.queue_type_plain) ||
(!plain && !capa.tx_compl.queue_type_sched))
return ODP_TEST_INACTIVE;
@@ -3716,24 +3842,49 @@ static int pktio_check_pktout_compl(bool plain)
return ODP_TEST_ACTIVE;
}
-static int pktio_check_pktout_compl_plain_queue(void)
+static int pktio_check_pktout_compl_poll(void)
+{
+ odp_pktio_param_t pktio_param;
+ odp_pktio_capability_t capa;
+ odp_pktio_t pktio;
+ int ret;
+
+ odp_pktio_param_init(&pktio_param);
+ pktio_param.in_mode = ODP_PKTIN_MODE_DIRECT;
+ pktio_param.out_mode = ODP_PKTOUT_MODE_DIRECT;
+
+ pktio = odp_pktio_open(iface_name[0], pool[0], &pktio_param);
+ if (pktio == ODP_PKTIO_INVALID)
+ return ODP_TEST_INACTIVE;
+
+ ret = odp_pktio_capability(pktio, &capa);
+ (void)odp_pktio_close(pktio);
+
+ if (ret < 0 || capa.tx_compl.mode_poll == 0 ||
+ capa.tx_compl.max_compl_id < (TX_BATCH_LEN - 1))
+ return ODP_TEST_INACTIVE;
+
+ return ODP_TEST_ACTIVE;
+}
+
+static int pktio_check_pktout_compl_event_plain_queue(void)
{
- return pktio_check_pktout_compl(true);
+ return pktio_check_pktout_compl_event(true);
}
-static int pktio_check_pktout_compl_sched_queue(void)
+static int pktio_check_pktout_compl_event_sched_queue(void)
{
- return pktio_check_pktout_compl(false);
+ return pktio_check_pktout_compl_event(false);
}
-static void pktio_test_pktout_compl_plain_queue(void)
+static void pktio_test_pktout_compl_event_plain_queue(void)
{
- pktio_test_pktout_compl(true);
+ pktio_test_pktout_compl_event(true);
}
-static void pktio_test_pktout_compl_sched_queue(void)
+static void pktio_test_pktout_compl_event_sched_queue(void)
{
- pktio_test_pktout_compl(false);
+ pktio_test_pktout_compl_event(false);
}
static void pktio_test_chksum(void (*config_fn)(odp_pktio_t, odp_pktio_t),
@@ -5172,10 +5323,11 @@ odp_testinfo_t pktio_suite_unsegmented[] = {
pktio_check_maxlen_set),
ODP_TEST_INFO_CONDITIONAL(pktio_test_pktout_aging_tmo,
pktio_check_pktout_aging_tmo),
- ODP_TEST_INFO_CONDITIONAL(pktio_test_pktout_compl_plain_queue,
- pktio_check_pktout_compl_plain_queue),
- ODP_TEST_INFO_CONDITIONAL(pktio_test_pktout_compl_sched_queue,
- pktio_check_pktout_compl_sched_queue),
+ ODP_TEST_INFO_CONDITIONAL(pktio_test_pktout_compl_event_plain_queue,
+ pktio_check_pktout_compl_event_plain_queue),
+ ODP_TEST_INFO_CONDITIONAL(pktio_test_pktout_compl_event_sched_queue,
+ pktio_check_pktout_compl_event_sched_queue),
+ ODP_TEST_INFO_CONDITIONAL(pktio_test_pktout_compl_poll, pktio_check_pktout_compl_poll),
ODP_TEST_INFO_CONDITIONAL(pktio_test_enable_pause_rx, pktio_check_pause_rx),
ODP_TEST_INFO_CONDITIONAL(pktio_test_enable_pause_tx, pktio_check_pause_tx),
ODP_TEST_INFO_CONDITIONAL(pktio_test_enable_pause_both, pktio_check_pause_both),
diff --git a/test/validation/api/pool/pool.c b/test/validation/api/pool/pool.c
index cded05650..b335f194c 100644
--- a/test/validation/api/pool/pool.c
+++ b/test/validation/api/pool/pool.c
@@ -1098,6 +1098,7 @@ static int pool_check_timeout_pool_statistics(void)
static void pool_test_pool_statistics(odp_pool_type_t pool_type)
{
odp_pool_stats_t stats;
+ odp_pool_stats_selected_t selected;
odp_pool_param_t param;
odp_pool_stats_opt_t supported;
uint32_t i, j, num_pool, num_obj, cache_size;
@@ -1164,8 +1165,8 @@ static void pool_test_pool_statistics(odp_pool_type_t pool_type)
CU_ASSERT_FATAL(max_pools != 0);
/* Extra alloc rounds for testing odp_pool_stats_t.alloc_fails */
- uint32_t num_alloc_rounds = num_obj + 100;
- odp_event_t event[max_pools][num_alloc_rounds];
+ uint32_t num_allocs = num_obj + 100;
+ odp_event_t event[max_pools][num_allocs];
uint32_t num_event[max_pools];
odp_pool_t pool[max_pools];
@@ -1187,22 +1188,40 @@ static void pool_test_pool_statistics(odp_pool_type_t pool_type)
stats.thread.first = first;
stats.thread.last = last;
CU_ASSERT_FATAL(odp_pool_stats(pool[i], &stats) == 0);
+ CU_ASSERT_FATAL(odp_pool_stats_selected(pool[i], &selected, &supported) == 0);
CU_ASSERT(stats.available <= num_obj);
+ if (supported.bit.available)
+ CU_ASSERT(selected.available <= num_obj);
CU_ASSERT(stats.alloc_ops == 0);
+ if (supported.bit.alloc_ops)
+ CU_ASSERT(selected.alloc_ops == 0);
CU_ASSERT(stats.alloc_fails == 0);
+ if (supported.bit.alloc_fails)
+ CU_ASSERT(selected.alloc_fails == 0);
CU_ASSERT(stats.free_ops == 0);
+ if (supported.bit.free_ops)
+ CU_ASSERT(selected.free_ops == 0);
CU_ASSERT(stats.total_ops == 0);
+ if (supported.bit.total_ops)
+ CU_ASSERT(selected.total_ops == 0);
CU_ASSERT(stats.cache_available <= num_obj);
+ if (supported.bit.cache_available)
+ CU_ASSERT(selected.cache_available <= num_obj);
CU_ASSERT(stats.cache_alloc_ops == 0);
+ if (supported.bit.cache_alloc_ops)
+ CU_ASSERT(selected.cache_alloc_ops == 0);
CU_ASSERT(stats.cache_free_ops == 0);
+ if (supported.bit.cache_free_ops)
+ CU_ASSERT(selected.cache_free_ops == 0);
+
CU_ASSERT(stats.thread.first == first);
CU_ASSERT(stats.thread.last == last);
for (j = 0; j < ODP_POOL_MAX_THREAD_STATS; j++)
CU_ASSERT(stats.thread.cache_available[j] <= stats.cache_available);
/* Allocate the events */
- for (j = 0; j < num_alloc_rounds; j++) {
+ for (j = 0; j < num_allocs; j++) {
odp_event_t new_event = ODP_EVENT_INVALID;
uint64_t total_cached = 0;
uint16_t first_id = 0;
@@ -1236,8 +1255,14 @@ static void pool_test_pool_statistics(odp_pool_type_t pool_type)
num_fails++;
CU_ASSERT_FATAL(odp_pool_stats(pool[i], &stats) == 0);
+ CU_ASSERT_FATAL(odp_pool_stats_selected(pool[i], &selected,
+ &supported) == 0);
CU_ASSERT(stats.available <= num_obj - num_events);
+ if (supported.bit.available)
+ CU_ASSERT(selected.available <= num_obj - num_events);
CU_ASSERT(stats.cache_available <= num_obj - num_events);
+ if (supported.bit.cache_available)
+ CU_ASSERT(selected.cache_available <= num_obj - num_events);
while (first_id < odp_thread_count_max()) {
stats.thread.first = first_id;
@@ -1264,39 +1289,70 @@ static void pool_test_pool_statistics(odp_pool_type_t pool_type)
CU_ASSERT(num_events == num_obj);
num_event[i] = num_events;
+ /* Allow implementation some time to update counters */
+ odp_time_wait_ns(ODP_TIME_MSEC_IN_NS);
+
stats.thread.first = first;
stats.thread.last = last;
CU_ASSERT_FATAL(odp_pool_stats(pool[i], &stats) == 0);
+ CU_ASSERT_FATAL(odp_pool_stats_selected(pool[i], &selected, &supported) == 0);
/* All events are allocated, available count in pool and pool
* local caches should be zero. */
CU_ASSERT(stats.available == 0);
+ if (supported.bit.available)
+ CU_ASSERT(selected.available == 0);
CU_ASSERT(stats.cache_available == 0);
+ if (supported.bit.cache_available)
+ CU_ASSERT(selected.cache_available == 0);
for (j = 0; j < ODP_POOL_MAX_THREAD_STATS; j++)
CU_ASSERT(stats.thread.cache_available[j] == 0);
- if (supported.bit.alloc_ops)
- CU_ASSERT(stats.alloc_ops > 0 && stats.alloc_ops <= num_obj + 1);
- if (supported.bit.alloc_fails)
+ if (supported.bit.alloc_ops) {
+ CU_ASSERT(stats.alloc_ops > 0 && stats.alloc_ops <= num_allocs);
+ CU_ASSERT(selected.alloc_ops > 0 && selected.alloc_ops <= num_allocs);
+ }
+ if (supported.bit.alloc_fails) {
CU_ASSERT(stats.alloc_fails == num_fails);
- if (supported.bit.total_ops)
- CU_ASSERT(stats.total_ops > 0 && stats.total_ops <= num_obj + 1);
+ CU_ASSERT(selected.alloc_fails == num_fails);
+ }
+ if (supported.bit.total_ops) {
+ CU_ASSERT(stats.total_ops > 0 && stats.total_ops <= num_allocs);
+ CU_ASSERT(selected.total_ops > 0 && selected.total_ops <= num_allocs);
+ }
CU_ASSERT(stats.free_ops == 0);
+ if (supported.bit.free_ops)
+ CU_ASSERT(selected.free_ops == 0);
+ CU_ASSERT(stats.cache_alloc_ops <= num_allocs);
+ if (supported.bit.cache_alloc_ops)
+ CU_ASSERT(selected.cache_alloc_ops <= num_allocs);
CU_ASSERT(stats.cache_free_ops == 0);
+ if (supported.bit.cache_free_ops)
+ CU_ASSERT(selected.cache_free_ops == 0);
}
for (i = 0; i < num_pool; i++) {
odp_event_free_multi(event[i], num_event[i]);
+ /* Allow implementation some time to update counters */
+ odp_time_wait_ns(ODP_TIME_MSEC_IN_NS);
+
stats.thread.first = odp_thread_id();
stats.thread.last = odp_thread_id();
CU_ASSERT_FATAL(odp_pool_stats(pool[i], &stats) == 0);
+ CU_ASSERT_FATAL(odp_pool_stats_selected(pool[i], &selected, &supported) == 0);
- if (supported.bit.available && supported.bit.cache_available)
+ if (supported.bit.available && supported.bit.cache_available) {
CU_ASSERT(stats.available + stats.cache_available == num_obj);
- if (supported.bit.free_ops)
+ CU_ASSERT(selected.available + selected.cache_available == num_obj);
+ }
+ if (supported.bit.free_ops) {
CU_ASSERT(stats.free_ops > 0);
- if (supported.bit.total_ops)
+ CU_ASSERT(selected.free_ops > 0);
+ }
+ if (supported.bit.total_ops) {
CU_ASSERT(stats.total_ops > 0);
+ CU_ASSERT(selected.total_ops > 0);
+ }
if (i == 0) {
printf("\nPool Statistics\n---------------\n");
@@ -1314,13 +1370,26 @@ static void pool_test_pool_statistics(odp_pool_type_t pool_type)
CU_ASSERT_FATAL(odp_pool_stats_reset(pool[i]) == 0);
CU_ASSERT_FATAL(odp_pool_stats(pool[i], &stats) == 0);
+ CU_ASSERT_FATAL(odp_pool_stats_selected(pool[i], &selected, &supported) == 0);
CU_ASSERT(stats.alloc_ops == 0);
+ if (supported.bit.alloc_ops)
+ CU_ASSERT(selected.alloc_ops == 0);
CU_ASSERT(stats.alloc_fails == 0);
+ if (supported.bit.alloc_fails)
+ CU_ASSERT(selected.alloc_fails == 0);
CU_ASSERT(stats.free_ops == 0);
+ if (supported.bit.free_ops)
+ CU_ASSERT(selected.free_ops == 0);
CU_ASSERT(stats.total_ops == 0);
+ if (supported.bit.total_ops)
+ CU_ASSERT(selected.total_ops == 0);
CU_ASSERT(stats.cache_alloc_ops == 0);
+ if (supported.bit.cache_alloc_ops)
+ CU_ASSERT(selected.cache_alloc_ops == 0);
CU_ASSERT(stats.cache_free_ops == 0);
+ if (supported.bit.cache_free_ops)
+ CU_ASSERT(selected.cache_free_ops == 0);
CU_ASSERT(odp_pool_destroy(pool[i]) == 0);
}
@@ -1858,7 +1927,7 @@ static int pool_suite_init(void)
memset(&default_pool_param, 0, sizeof(odp_pool_param_t));
if (odp_pool_capability(&global_pool_capa) < 0) {
- printf("pool_capability failed in suite init\n");
+ ODPH_ERR("odp_pool_capability() failed in suite init\n");
return -1;
}
@@ -1872,12 +1941,12 @@ static int pool_ext_suite_init(void)
memset(&global_pool_ext_capa, 0, sizeof(odp_pool_ext_capability_t));
if (odp_pool_ext_capability(ODP_POOL_PACKET, &global_pool_ext_capa)) {
- printf("Pool ext capa failed in suite init\n");
+ ODPH_ERR("Pool ext capa failed in suite init\n");
return -1;
}
if (global_pool_ext_capa.type != ODP_POOL_PACKET) {
- printf("Bad type from pool ext capa in suite init\n");
+ ODPH_ERR("Bad type from pool ext capa in suite init\n");
return -1;
}
diff --git a/test/validation/api/queue/queue.c b/test/validation/api/queue/queue.c
index f661da075..2cd474455 100644
--- a/test/validation/api/queue/queue.c
+++ b/test/validation/api/queue/queue.c
@@ -6,6 +6,7 @@
*/
#include <odp_api.h>
+#include <odp/helper/odph_api.h>
#include <odp_cunit_common.h>
#define MAX_WORKERS 32
@@ -65,7 +66,7 @@ static int queue_suite_init(void)
ODP_CACHE_LINE_SIZE, 0);
if (shm == ODP_SHM_INVALID) {
- printf("Shared memory reserve failed\n");
+ ODPH_ERR("Shared memory reserve failed\n");
return -1;
}
@@ -91,7 +92,7 @@ static int queue_suite_init(void)
pool = odp_pool_create("msg_pool", &params);
if (ODP_POOL_INVALID == pool) {
- printf("Pool create failed.\n");
+ ODPH_ERR("Pool create failed\n");
return -1;
}
return 0;
@@ -103,17 +104,17 @@ static int queue_suite_term(void)
shm = odp_shm_lookup(GLOBALS_NAME);
if (shm == ODP_SHM_INVALID) {
- printf("SHM lookup failed.\n");
+ ODPH_ERR("SHM lookup failed\n");
return -1;
}
if (odp_shm_free(shm)) {
- printf("SHM free failed.\n");
+ ODPH_ERR("SHM free failed\n");
return -1;
}
if (odp_pool_destroy(pool)) {
- printf("Pool destroy failed.\n");
+ ODPH_ERR("Pool destroy failed\n");
return -1;
}
@@ -455,7 +456,7 @@ static int queue_pair_work_loop(void *arg)
buf = odp_buffer_from_event(ev);
data = odp_buffer_addr(buf);
if (*data != i) {
- printf("Seq error: expected %u, recv %u\n", i, *data);
+ ODPH_ERR("Seq error: expected %u, recv %u\n", i, *data);
CU_FAIL("Sequence number error");
}
diff --git a/test/validation/api/scheduler/scheduler.c b/test/validation/api/scheduler/scheduler.c
index cd9ad1ac1..ec06cf27d 100644
--- a/test/validation/api/scheduler/scheduler.c
+++ b/test/validation/api/scheduler/scheduler.c
@@ -3155,12 +3155,12 @@ static int create_queues(test_globals_t *globals)
int sched_types;
if (odp_queue_capability(&queue_capa) < 0) {
- printf("Queue capability query failed\n");
+ ODPH_ERR("Queue capability query failed\n");
return -1;
}
if (odp_schedule_capability(&sched_capa) < 0) {
- printf("Queue capability query failed\n");
+ ODPH_ERR("Queue capability query failed\n");
return -1;
}
@@ -3196,9 +3196,9 @@ static int create_queues(test_globals_t *globals)
num_plain = (prios * queues_per_prio);
}
if (!queues_per_prio) {
- printf("Not enough queues. At least %d scheduled queues and "
- "%d plain queus required.\n",
- ((prios * sched_types) + CHAOS_NUM_QUEUES), prios);
+ ODPH_ERR("Not enough queues. At least %d scheduled queues and "
+ "%d plain queues required.\n",
+ ((prios * sched_types) + CHAOS_NUM_QUEUES), prios);
return -1;
}
globals->queues_per_prio = queues_per_prio;
@@ -3211,7 +3211,7 @@ static int create_queues(test_globals_t *globals)
queue_ctx_pool = odp_pool_create(QUEUE_CTX_POOL_NAME, &params);
if (queue_ctx_pool == ODP_POOL_INVALID) {
- printf("Pool creation failed (queue ctx).\n");
+ ODPH_ERR("Pool creation failed (queue ctx)\n");
return -1;
}
globals->queue_ctx_pool = queue_ctx_pool;
@@ -3231,7 +3231,7 @@ static int create_queues(test_globals_t *globals)
q = odp_queue_create(name, &p);
if (q == ODP_QUEUE_INVALID) {
- printf("Parallel queue create failed.\n");
+ ODPH_ERR("Parallel queue create failed\n");
return -1;
}
@@ -3241,21 +3241,21 @@ static int create_queues(test_globals_t *globals)
q = odp_queue_create(name, &p);
if (q == ODP_QUEUE_INVALID) {
- printf("Atomic queue create failed.\n");
+ ODPH_ERR("Atomic queue create failed\n");
return -1;
}
snprintf(name, sizeof(name), "plain_%d_%d_o", i, j);
pq = odp_queue_create(name, NULL);
if (pq == ODP_QUEUE_INVALID) {
- printf("Plain queue create failed.\n");
+ ODPH_ERR("Plain queue create failed\n");
return -1;
}
queue_ctx_buf = odp_buffer_alloc(queue_ctx_pool);
if (queue_ctx_buf == ODP_BUFFER_INVALID) {
- printf("Cannot allocate plain queue ctx buf\n");
+ ODPH_ERR("Cannot allocate plain queue ctx buf\n");
return -1;
}
@@ -3266,7 +3266,7 @@ static int create_queues(test_globals_t *globals)
rc = odp_queue_context_set(pq, pqctx, 0);
if (rc != 0) {
- printf("Cannot set plain queue context\n");
+ ODPH_ERR("Cannot set plain queue context\n");
return -1;
}
@@ -3277,7 +3277,7 @@ static int create_queues(test_globals_t *globals)
q = odp_queue_create(name, &p);
if (q == ODP_QUEUE_INVALID) {
- printf("Ordered queue create failed.\n");
+ ODPH_ERR("Ordered queue create failed\n");
return -1;
}
if (odp_queue_lock_count(q) !=
@@ -3293,7 +3293,7 @@ static int create_queues(test_globals_t *globals)
queue_ctx_buf = odp_buffer_alloc(queue_ctx_pool);
if (queue_ctx_buf == ODP_BUFFER_INVALID) {
- printf("Cannot allocate queue ctx buf\n");
+ ODPH_ERR("Cannot allocate queue ctx buf\n");
return -1;
}
@@ -3311,7 +3311,7 @@ static int create_queues(test_globals_t *globals)
rc = odp_queue_context_set(q, qctx, 0);
if (rc != 0) {
- printf("Cannot set queue context\n");
+ ODPH_ERR("Cannot set queue context\n");
return -1;
}
}
@@ -3522,14 +3522,14 @@ static int scheduler_test_global_init(void)
sizeof(test_globals_t), ODP_CACHE_LINE_SIZE, 0);
if (shm == ODP_SHM_INVALID) {
- printf("Shared memory reserve failed (globals).\n");
+ ODPH_ERR("Shared memory reserve failed (globals)\n");
return -1;
}
globals = odp_shm_addr(shm);
if (!globals) {
- printf("Shared memory reserve failed (globals).\n");
+ ODPH_ERR("Shared memory reserve failed (globals)\n");
return -1;
}
@@ -3544,7 +3544,7 @@ static int scheduler_test_global_init(void)
ODP_CACHE_LINE_SIZE, 0);
if (shm == ODP_SHM_INVALID) {
- printf("Shared memory reserve failed (args).\n");
+ ODPH_ERR("Shared memory reserve failed (args)\n");
return -1;
}
@@ -3552,7 +3552,7 @@ static int scheduler_test_global_init(void)
globals->shm_args = shm;
if (!args) {
- printf("Shared memory reserve failed (args).\n");
+ ODPH_ERR("Shared memory reserve failed (args)\n");
return -1;
}
@@ -3572,14 +3572,14 @@ static int scheduler_test_global_init(void)
pool = odp_pool_create(MSG_POOL_NAME, &params);
if (pool == ODP_POOL_INVALID) {
- printf("Pool creation failed (msg).\n");
+ ODPH_ERR("Pool creation failed (msg)\n");
return -1;
}
globals->pool = pool;
if (odp_schedule_capability(&sched_capa)) {
- printf("odp_schedule_capability() failed\n");
+ ODPH_ERR("odp_schedule_capability() failed\n");
return -1;
}
@@ -3599,7 +3599,7 @@ static int scheduler_test_global_init(void)
/* Configure the scheduler. All test cases share the config. */
if (odp_schedule_config(&sched_config)) {
- printf("odp_schedule_config() failed.\n");
+ ODPH_ERR("odp_schedule_config() failed\n");
return -1;
}
diff --git a/test/validation/api/scheduler/scheduler_no_predef_groups.c b/test/validation/api/scheduler/scheduler_no_predef_groups.c
index 3dd79ebcc..1b941ac61 100644
--- a/test/validation/api/scheduler/scheduler_no_predef_groups.c
+++ b/test/validation/api/scheduler/scheduler_no_predef_groups.c
@@ -139,7 +139,7 @@ static int scheduler_suite_init(void)
odp_schedule_config_t sched_config;
if (odp_schedule_capability(&sched_capa)) {
- printf("odp_schedule_capability() failed\n");
+ ODPH_ERR("odp_schedule_capability() failed\n");
return -1;
}
@@ -152,7 +152,7 @@ static int scheduler_suite_init(void)
/* Configure the scheduler. All test cases share the config. */
if (odp_schedule_config(&sched_config)) {
- printf("odp_schedule_config() failed.\n");
+ ODPH_ERR("odp_schedule_config() failed\n");
return -1;
}
diff --git a/test/validation/api/stash/stash.c b/test/validation/api/stash/stash.c
index fd4c04577..67c336a2f 100644
--- a/test/validation/api/stash/stash.c
+++ b/test/validation/api/stash/stash.c
@@ -5,6 +5,8 @@
*/
#include <odp_api.h>
+#include <odp/helper/odph_api.h>
+
#include "odp_cunit_common.h"
#include <string.h>
@@ -63,7 +65,7 @@ static int stash_suite_init(void)
odp_stash_capability_t *capa_fifo = &global.capa_fifo;
if (odp_stash_capability(capa_default, ODP_STASH_TYPE_DEFAULT)) {
- printf("stash capability failed for the default type\n");
+ ODPH_ERR("Stash capability failed for the default type\n");
return -1;
}
diff --git a/test/validation/api/thread/thread.c b/test/validation/api/thread/thread.c
index 2dc799c2a..87c23e74e 100644
--- a/test/validation/api/thread/thread.c
+++ b/test/validation/api/thread/thread.c
@@ -30,7 +30,7 @@ static int thread_global_init(odp_instance_t *inst)
odph_helper_options_t helper_options;
if (odph_options(&helper_options)) {
- fprintf(stderr, "error: odph_options() failed.\n");
+ ODPH_ERR("odph_options() failed\n");
return -1;
}
@@ -38,11 +38,11 @@ static int thread_global_init(odp_instance_t *inst)
init_param.mem_model = helper_options.mem_model;
if (0 != odp_init_global(inst, &init_param, NULL)) {
- fprintf(stderr, "error: odp_init_global() failed.\n");
+ ODPH_ERR("odp_init_global() failed\n");
return -1;
}
if (0 != odp_init_local(*inst, ODP_THREAD_CONTROL)) {
- fprintf(stderr, "error: odp_init_local() failed.\n");
+ ODPH_ERR("odp_init_local() failed\n");
return -1;
}
@@ -50,7 +50,7 @@ static int thread_global_init(odp_instance_t *inst)
sizeof(global_shared_mem_t),
ODP_CACHE_LINE_SIZE, 0);
if (global_shm == ODP_SHM_INVALID) {
- fprintf(stderr, "Unable reserve memory for global_shm\n");
+ ODPH_ERR("Unable to reserve memory for global_shm\n");
return -1;
}
@@ -66,17 +66,17 @@ static int thread_global_term(odp_instance_t inst)
shm = odp_shm_lookup(GLOBAL_SHM_NAME);
if (0 != odp_shm_free(shm)) {
- fprintf(stderr, "error: odp_shm_free() failed.\n");
+ ODPH_ERR("odp_shm_free() failed\n");
return -1;
}
if (0 != odp_term_local()) {
- fprintf(stderr, "error: odp_term_local() failed.\n");
+ ODPH_ERR("odp_term_local() failed\n");
return -1;
}
if (0 != odp_term_global(inst)) {
- fprintf(stderr, "error: odp_term_global() failed.\n");
+ ODPH_ERR("odp_term_global() failed\n");
return -1;
}
diff --git a/test/validation/api/time/time.c b/test/validation/api/time/time.c
index f285bf8e4..22189ce03 100644
--- a/test/validation/api/time/time.c
+++ b/test/validation/api/time/time.c
@@ -1,5 +1,5 @@
/* Copyright (c) 2015-2018, Linaro Limited
- * Copyright (c) 2019-2022, Nokia
+ * Copyright (c) 2019-2023, Nokia
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
@@ -12,6 +12,7 @@
#include <time.h>
#include <odp_api.h>
+#include <odp/helper/odph_api.h>
#include "odp_cunit_common.h"
#define BUSY_LOOP_CNT 30000000 /* used for t > min resolution */
@@ -19,6 +20,11 @@
#define MAX_TIME_RATE 15000000000
#define DELAY_TOLERANCE 40000000 /* deviation for delay */
#define WAIT_SECONDS 3
+#define MAX_WORKERS 32
+#define TIME_SAMPLES 2
+#define TIME_TOLERANCE_NS 1000000
+#define TIME_TOLERANCE_CI_NS 40000000
+#define GLOBAL_SHM_NAME "GlobalTimeTest"
static uint64_t local_res;
static uint64_t global_res;
@@ -28,6 +34,96 @@ typedef uint64_t time_res_cb(void);
typedef odp_time_t time_from_ns_cb(uint64_t ns);
typedef uint64_t time_nsec_cb(void);
+typedef struct {
+ uint32_t num_threads;
+ odp_barrier_t test_barrier;
+ odp_time_t time[MAX_WORKERS + 1][TIME_SAMPLES];
+} global_shared_mem_t;
+
+static global_shared_mem_t *global_mem;
+static odp_instance_t *instance;
+
+static int time_global_init(odp_instance_t *inst)
+{
+ odp_shm_t global_shm;
+ odp_init_t init_param;
+ odph_helper_options_t helper_options;
+ uint32_t workers_count, max_threads;
+
+ if (odph_options(&helper_options)) {
+ ODPH_ERR("odph_options() failed\n");
+ return -1;
+ }
+
+ odp_init_param_init(&init_param);
+ init_param.mem_model = helper_options.mem_model;
+
+ if (0 != odp_init_global(inst, &init_param, NULL)) {
+ ODPH_ERR("odp_init_global() failed\n");
+ return -1;
+ }
+ if (0 != odp_init_local(*inst, ODP_THREAD_CONTROL)) {
+ ODPH_ERR("odp_init_local() failed\n");
+ return -1;
+ }
+
+ global_shm = odp_shm_reserve(GLOBAL_SHM_NAME,
+ sizeof(global_shared_mem_t),
+ ODP_CACHE_LINE_SIZE, 0);
+ if (global_shm == ODP_SHM_INVALID) {
+ ODPH_ERR("Unable reserve memory for global_shm\n");
+ return -1;
+ }
+
+ global_mem = odp_shm_addr(global_shm);
+ memset(global_mem, 0, sizeof(global_shared_mem_t));
+
+ global_mem->num_threads = MAX_WORKERS;
+
+ workers_count = odp_cpumask_default_worker(NULL, 0);
+
+ max_threads = (workers_count >= MAX_WORKERS) ?
+ MAX_WORKERS : workers_count;
+
+ if (max_threads < global_mem->num_threads) {
+ printf("Requested num of threads is too large\n");
+ printf("reducing from %" PRIu32 " to %" PRIu32 "\n",
+ global_mem->num_threads,
+ max_threads);
+ global_mem->num_threads = max_threads;
+ }
+
+ printf("Num of threads used = %" PRIu32 "\n",
+ global_mem->num_threads);
+
+ instance = inst;
+
+ return 0;
+}
+
+static int time_global_term(odp_instance_t inst)
+{
+ odp_shm_t shm;
+
+ shm = odp_shm_lookup(GLOBAL_SHM_NAME);
+ if (0 != odp_shm_free(shm)) {
+ ODPH_ERR("odp_shm_free() failed\n");
+ return -1;
+ }
+
+ if (0 != odp_term_local()) {
+ ODPH_ERR("odp_term_local() failed\n");
+ return -1;
+ }
+
+ if (0 != odp_term_global(inst)) {
+ ODPH_ERR("odp_term_global() failed\n");
+ return -1;
+ }
+
+ return 0;
+}
+
static void time_test_constants(void)
{
uint64_t ns;
@@ -423,16 +519,14 @@ static void time_test_wait_until(time_cb time_cur, time_from_ns_cb time_from_ns)
DELAY_TOLERANCE);
if (odp_time_cmp(wait, lower_limit) < 0) {
- fprintf(stderr, "Exceed lower limit: "
- "wait is %" PRIu64 ", lower_limit %" PRIu64 "\n",
- odp_time_to_ns(wait), odp_time_to_ns(lower_limit));
+ ODPH_ERR("Exceed lower limit: wait is %" PRIu64 ", lower_limit %" PRIu64 "\n",
+ odp_time_to_ns(wait), odp_time_to_ns(lower_limit));
CU_FAIL("Exceed lower limit\n");
}
if (odp_time_cmp(wait, upper_limit) > 0) {
- fprintf(stderr, "Exceed upper limit: "
- "wait is %" PRIu64 ", upper_limit %" PRIu64 "\n",
- odp_time_to_ns(wait), odp_time_to_ns(lower_limit));
+ ODPH_ERR("Exceed upper limit: wait is %" PRIu64 ", upper_limit %" PRIu64 "\n",
+ odp_time_to_ns(wait), odp_time_to_ns(lower_limit));
CU_FAIL("Exceed upper limit\n");
}
}
@@ -466,16 +560,14 @@ static void time_test_wait_ns(void)
DELAY_TOLERANCE);
if (odp_time_cmp(diff, lower_limit) < 0) {
- fprintf(stderr, "Exceed lower limit: "
- "diff is %" PRIu64 ", lower_limit %" PRIu64 "\n",
- odp_time_to_ns(diff), odp_time_to_ns(lower_limit));
+ ODPH_ERR("Exceed lower limit: diff is %" PRIu64 ", lower_limit %" PRIu64 "\n",
+ odp_time_to_ns(diff), odp_time_to_ns(lower_limit));
CU_FAIL("Exceed lower limit\n");
}
if (odp_time_cmp(diff, upper_limit) > 0) {
- fprintf(stderr, "Exceed upper limit: "
- "diff is %" PRIu64 ", upper_limit %" PRIu64 "\n",
- odp_time_to_ns(diff), odp_time_to_ns(upper_limit));
+ ODPH_ERR("Exceed upper limit: diff is %" PRIu64 ", upper_limit %" PRIu64 "\n",
+ odp_time_to_ns(diff), odp_time_to_ns(upper_limit));
CU_FAIL("Exceed upper limit\n");
}
}
@@ -486,13 +578,13 @@ static void check_time_diff(double t_odp, double t_system,
{
if (t_odp > t_system * 1.05) {
CU_FAIL("ODP time too high");
- fprintf(stderr, "ODP time too high (%s/%d): t_odp: %f, t_system: %f\n",
- test, id, t_odp, t_system);
+ ODPH_ERR("ODP time too high (%s/%d): t_odp: %f, t_system: %f\n",
+ test, id, t_odp, t_system);
}
if (t_odp < t_system * 0.95) {
CU_FAIL("ODP time too low");
- fprintf(stderr, "ODP time too low (%s/%d): t_odp: %f, t_system: %f\n",
- test, id, t_odp, t_system);
+ ODPH_ERR("ODP time too low (%s/%d): t_odp: %f, t_system: %f\n",
+ test, id, t_odp, t_system);
}
}
@@ -589,6 +681,138 @@ static void time_test_accuracy_nsec(void)
}
}
+static int time_test_global_sync_thr(void *arg ODP_UNUSED)
+{
+ int tid = odp_thread_id();
+ odp_shm_t global_shm = odp_shm_lookup(GLOBAL_SHM_NAME);
+ global_shared_mem_t *global_mem = odp_shm_addr(global_shm);
+
+ if (!global_mem)
+ return 1;
+
+ odp_barrier_wait(&global_mem->test_barrier);
+ global_mem->time[tid][0] = odp_time_global();
+ odp_time_wait_ns(ODP_TIME_MSEC_IN_NS * 100);
+ odp_barrier_wait(&global_mem->test_barrier);
+ global_mem->time[tid][1] = odp_time_global();
+
+ return 0;
+}
+
+static void time_test_global_sync(const int ctrl)
+{
+ odp_cpumask_t cpumask;
+ odph_thread_common_param_t thr_common;
+ odph_thread_param_t thr_param;
+ odph_thread_t thread_tbl[MAX_WORKERS];
+ const uint64_t tolerance =
+ odp_cunit_ci() ? TIME_TOLERANCE_CI_NS : TIME_TOLERANCE_NS;
+ const int num = ctrl ? 2 : global_mem->num_threads;
+
+ if (num < 2) {
+ printf(" number of threads is less than two, test skipped. ");
+ return;
+ }
+
+ odp_barrier_init(&global_mem->test_barrier, num);
+
+ odph_thread_param_init(&thr_param);
+ thr_param.start = time_test_global_sync_thr;
+
+ odph_thread_common_param_init(&thr_common);
+ thr_common.instance = *instance;
+
+ int thr = 0;
+
+ if (ctrl) {
+ /* Test sync between one control and one worker thread. */
+ odp_cpumask_default_control(&cpumask, 1);
+ thr_common.cpumask = &cpumask;
+ thr_param.thr_type = ODP_THREAD_CONTROL;
+
+ int r = odph_thread_create(&thread_tbl[thr++],
+ &thr_common, &thr_param, 1);
+ CU_ASSERT_FATAL(r == 1);
+ odp_cpumask_default_worker(&cpumask, 1);
+ } else {
+ /* Test sync between num worker threads. */
+ odp_cpumask_default_worker(&cpumask, num);
+ }
+
+ int cpu = odp_cpumask_first(&cpumask);
+
+ while (cpu >= 0) {
+ odp_cpumask_t cpumask_one;
+
+ /*
+ * Delay for more than the tolerance, so that we notice if the
+ * thread's view of global time is affected.
+ */
+ odp_time_wait_ns(tolerance * 2);
+
+ odp_cpumask_zero(&cpumask_one);
+ odp_cpumask_set(&cpumask_one, cpu);
+ thr_common.cpumask = &cpumask_one;
+ thr_param.thr_type = ODP_THREAD_WORKER;
+
+ int r = odph_thread_create(&thread_tbl[thr++],
+ &thr_common, &thr_param, 1);
+ CU_ASSERT_FATAL(r == 1);
+
+ cpu = odp_cpumask_next(&cpumask, cpu);
+ }
+
+ CU_ASSERT(odph_thread_join(thread_tbl, num) == num);
+
+ for (int s = 0; s < TIME_SAMPLES; s++) {
+ int min_idx = 0, max_idx = 0;
+ uint64_t min = UINT64_MAX, max = 0;
+ double avg = 0;
+
+ for (int i = 1; i < num + 1; i++) {
+ uint64_t t = odp_time_to_ns(global_mem->time[i][s]);
+
+ if (t < min) {
+ min = t;
+ min_idx = i;
+ }
+ }
+
+ printf("\nround %d\nthread time diffs: ", s);
+
+ for (int i = 1; i < num + 1; i++) {
+ uint64_t t = odp_time_to_ns(global_mem->time[i][s]) - min;
+
+ printf("%" PRIu64 " ", t);
+
+ if (t > max) {
+ max = t;
+ max_idx = i;
+ }
+
+ avg += t;
+ }
+
+ /* The min result itself is not included in the average. */
+ avg /= num - 1;
+ printf("\nmin: %" PRIu64 " (tid %d) max diff: %" PRIu64
+ " (tid %d) avg diff: %g", min, min_idx, max, max_idx, avg);
+ CU_ASSERT(max < tolerance);
+ }
+
+ printf("\n");
+}
+
+static void time_test_global_sync_workers(void)
+{
+ time_test_global_sync(0);
+}
+
+static void time_test_global_sync_control(void)
+{
+ time_test_global_sync(1);
+}
+
odp_testinfo_t time_suite_time[] = {
ODP_TEST_INFO(time_test_constants),
ODP_TEST_INFO(time_test_local_res),
@@ -614,6 +838,8 @@ odp_testinfo_t time_suite_time[] = {
ODP_TEST_INFO(time_test_global_strict_diff),
ODP_TEST_INFO(time_test_global_strict_sum),
ODP_TEST_INFO(time_test_global_strict_cmp),
+ ODP_TEST_INFO(time_test_global_sync_workers),
+ ODP_TEST_INFO(time_test_global_sync_control),
ODP_TEST_INFO_NULL
};
@@ -630,6 +856,9 @@ int main(int argc, char *argv[])
if (odp_cunit_parse_options(argc, argv))
return -1;
+ odp_cunit_register_global_init(time_global_init);
+ odp_cunit_register_global_term(time_global_term);
+
ret = odp_cunit_register(time_suites);
if (ret == 0)
diff --git a/test/validation/api/timer/timer.c b/test/validation/api/timer/timer.c
index eb7f0772a..dad99ab41 100644
--- a/test/validation/api/timer/timer.c
+++ b/test/validation/api/timer/timer.c
@@ -15,6 +15,8 @@
#include <odp/helper/odph_api.h>
#include "odp_cunit_common.h"
+#include <stdint.h>
+
#define MAX_WORKERS 32
#define GLOBAL_SHM_NAME "GlobalTimerTest"
@@ -117,7 +119,7 @@ static int timer_global_init(odp_instance_t *inst)
int i;
if (odph_options(&helper_options)) {
- fprintf(stderr, "error: odph_options() failed.\n");
+ ODPH_ERR("odph_options() failed\n");
return -1;
}
@@ -125,11 +127,11 @@ static int timer_global_init(odp_instance_t *inst)
init_param.mem_model = helper_options.mem_model;
if (0 != odp_init_global(inst, &init_param, NULL)) {
- fprintf(stderr, "error: odp_init_global() failed.\n");
+ ODPH_ERR("odp_init_global() failed\n");
return -1;
}
if (0 != odp_init_local(*inst, ODP_THREAD_CONTROL)) {
- fprintf(stderr, "error: odp_init_local() failed.\n");
+ ODPH_ERR("odp_init_local() failed\n");
return -1;
}
@@ -137,7 +139,7 @@ static int timer_global_init(odp_instance_t *inst)
sizeof(global_shared_mem_t),
ODP_CACHE_LINE_SIZE, 0);
if (global_shm == ODP_SHM_INVALID) {
- fprintf(stderr, "Unable reserve memory for global_shm\n");
+ ODPH_ERR("Unable to reserve memory for global_shm\n");
return -1;
}
@@ -149,7 +151,7 @@ static int timer_global_init(odp_instance_t *inst)
memset(&capa, 0, sizeof(capa));
if (odp_timer_capability(ODP_CLOCK_DEFAULT, &capa)) {
- fprintf(stderr, "Timer capability failed\n");
+ ODPH_ERR("Timer capability failed\n");
return -1;
}
@@ -162,7 +164,7 @@ static int timer_global_init(odp_instance_t *inst)
res_capa.res_ns = res_ns;
if (odp_timer_res_capability(ODP_CLOCK_DEFAULT, &res_capa)) {
- fprintf(stderr, "Timer resolution capability failed\n");
+ ODPH_ERR("Timer resolution capability failed\n");
return -1;
}
@@ -178,7 +180,7 @@ static int timer_global_init(odp_instance_t *inst)
range = (RANGE_MS * 1000) + THREE_POINT_THREE_MSEC;
if ((max_tmo - min_tmo) < range) {
- fprintf(stderr, "Validation test needs %u msec range\n", range);
+ ODPH_ERR("Validation test needs %u msec range\n", range);
return -1;
}
@@ -209,17 +211,17 @@ static int timer_global_term(odp_instance_t inst)
shm = odp_shm_lookup(GLOBAL_SHM_NAME);
if (0 != odp_shm_free(shm)) {
- fprintf(stderr, "error: odp_shm_free() failed.\n");
+ ODPH_ERR("odp_shm_free() failed\n");
return -1;
}
if (0 != odp_term_local()) {
- fprintf(stderr, "error: odp_term_local() failed.\n");
+ ODPH_ERR("odp_term_local() failed\n");
return -1;
}
if (0 != odp_term_global(inst)) {
- fprintf(stderr, "error: odp_term_global() failed.\n");
+ ODPH_ERR("odp_term_global() failed\n");
return -1;
}
@@ -279,7 +281,7 @@ static void timer_test_capa_run(odp_timer_clk_src_t clk_src)
CU_ASSERT_FATAL(ret == 0);
CU_ASSERT(capa.highest_res_ns == capa.max_res.res_ns);
- /* Assuming max resoultion to be 100 msec or better */
+ /* Assuming max resolution to be 100 msec or better */
CU_ASSERT(capa.max_res.res_ns <= 100000000);
CU_ASSERT(capa.max_res.res_hz >= 10);
CU_ASSERT(capa.max_res.res_ns < capa.max_res.max_tmo);
@@ -302,6 +304,13 @@ static void timer_test_capa_run(odp_timer_clk_src_t clk_src)
CU_ASSERT(res_capa.min_tmo == capa.max_res.min_tmo);
CU_ASSERT(res_capa.max_tmo == capa.max_res.max_tmo);
+ if (capa.max_res.res_ns > 1) {
+ memset(&res_capa, 0, sizeof(res_capa));
+ res_capa.res_ns = capa.max_res.res_ns - 1;
+ ret = odp_timer_res_capability(clk_src, &res_capa);
+ CU_ASSERT(ret < 0);
+ }
+
/* Set max resolution in hz */
memset(&res_capa, 0, sizeof(res_capa));
res_capa.res_hz = capa.max_res.res_hz;
@@ -312,6 +321,13 @@ static void timer_test_capa_run(odp_timer_clk_src_t clk_src)
CU_ASSERT(res_capa.min_tmo == capa.max_res.min_tmo);
CU_ASSERT(res_capa.max_tmo == capa.max_res.max_tmo);
+ if (capa.max_res.res_hz < UINT64_MAX) {
+ memset(&res_capa, 0, sizeof(res_capa));
+ res_capa.res_hz = capa.max_res.res_hz + 1;
+ ret = odp_timer_res_capability(clk_src, &res_capa);
+ CU_ASSERT(ret < 0);
+ }
+
/* Set max timeout */
memset(&res_capa, 0, sizeof(res_capa));
res_capa.max_tmo = capa.max_tmo.max_tmo;
@@ -322,6 +338,13 @@ static void timer_test_capa_run(odp_timer_clk_src_t clk_src)
CU_ASSERT(res_capa.min_tmo == capa.max_tmo.min_tmo);
CU_ASSERT(res_capa.res_ns == capa.max_tmo.res_ns);
CU_ASSERT(res_capa.res_hz == capa.max_tmo.res_hz);
+
+ if (capa.max_tmo.max_tmo < UINT64_MAX) {
+ memset(&res_capa, 0, sizeof(res_capa));
+ res_capa.max_tmo = capa.max_tmo.max_tmo + 1;
+ ret = odp_timer_res_capability(clk_src, &res_capa);
+ CU_ASSERT(ret < 0);
+ }
}
static void timer_test_capa(void)
@@ -494,6 +517,8 @@ static void timer_test_timeout_user_area(void)
CU_ASSERT_FATAL(pool != ODP_POOL_INVALID);
for (i = 0; i < num; i++) {
+ odp_event_t ev;
+
tmo[i] = odp_timeout_alloc(pool);
if (tmo[i] == ODP_TIMEOUT_INVALID)
@@ -505,6 +530,9 @@ static void timer_test_timeout_user_area(void)
CU_ASSERT_FATAL(addr != NULL);
CU_ASSERT(prev != addr);
+ ev = odp_timeout_to_event(tmo[i]);
+ CU_ASSERT(odp_event_user_area(ev) == addr);
+
prev = addr;
memset(addr, 0, size);
}
@@ -749,9 +777,9 @@ static void timer_pool_max_res(void)
ev = ODP_EVENT_INVALID;
ret = odp_timer_cancel(timer, &ev);
- CU_ASSERT(ret == 0);
+ CU_ASSERT(ret == ODP_TIMER_SUCCESS);
- if (ret == 0) {
+ if (ret == ODP_TIMER_SUCCESS) {
CU_ASSERT(ev != ODP_EVENT_INVALID);
odp_event_free(ev);
}
@@ -922,9 +950,9 @@ static void timer_single_shot(odp_queue_type_t queue_type, odp_timer_tick_type_t
if (cancel) {
ret = odp_timer_cancel(timer, &ev);
- CU_ASSERT(ret == 0);
+ CU_ASSERT(ret == ODP_TIMER_SUCCESS);
- if (ret == 0)
+ if (ret == ODP_TIMER_SUCCESS)
CU_ASSERT(ev != ODP_EVENT_INVALID);
} else {
uint64_t diff_ns;
@@ -1061,6 +1089,148 @@ static void timer_sched_abs_wait_3sec(void)
timer_single_shot(ODP_QUEUE_TYPE_SCHED, ABSOLUTE, START, TIMEOUT, 30, 110 * MSEC);
}
+static void timer_pool_current_tick_run(odp_timer_clk_src_t clk_src)
+{
+ odp_timer_capability_t capa;
+ odp_timer_pool_param_t tp_param;
+ odp_timer_pool_t tp;
+ uint64_t t1, t2, ticks, min, max;
+ uint64_t nsec = 100 * ODP_TIME_MSEC_IN_NS;
+
+ memset(&capa, 0, sizeof(capa));
+ CU_ASSERT_FATAL(odp_timer_capability(clk_src, &capa) == 0);
+
+ /* Highest resolution */
+ odp_timer_pool_param_init(&tp_param);
+ tp_param.res_hz = capa.max_res.res_hz;
+ tp_param.min_tmo = capa.max_res.min_tmo;
+ tp_param.max_tmo = capa.max_res.max_tmo;
+ tp_param.num_timers = 100;
+ tp_param.clk_src = clk_src;
+
+ tp = odp_timer_pool_create("cur_tick", &tp_param);
+ CU_ASSERT_FATAL(tp != ODP_TIMER_POOL_INVALID);
+
+ odp_timer_pool_start();
+
+ /* Allow +-10% error margin */
+ min = odp_timer_ns_to_tick(tp, 0.9 * nsec);
+ max = odp_timer_ns_to_tick(tp, 1.1 * nsec);
+
+ t1 = odp_timer_current_tick(tp);
+
+ odp_time_wait_ns(nsec);
+
+ t2 = odp_timer_current_tick(tp);
+
+ ticks = t2 - t1;
+
+ CU_ASSERT(t2 >= t1);
+ CU_ASSERT(ticks >= min);
+ CU_ASSERT(ticks <= max);
+
+ printf("\nClock source %i\n", clk_src);
+ printf(" Time nsec: %" PRIu64 "\n", nsec);
+ printf(" Measured ticks: %" PRIu64 "\n", ticks);
+ printf(" Expected ticks: %" PRIu64 "\n", odp_timer_ns_to_tick(tp, nsec));
+
+ odp_timer_pool_destroy(tp);
+}
+
+static void timer_pool_current_tick(void)
+{
+ odp_timer_clk_src_t clk_src;
+ int i;
+
+ for (i = 0; i < ODP_CLOCK_NUM_SRC; i++) {
+ clk_src = ODP_CLOCK_SRC_0 + i;
+ if (global_mem->clk_supported[i]) {
+ ODPH_DBG("\nTesting clock source: %i\n", clk_src);
+ timer_pool_current_tick_run(clk_src);
+ }
+ }
+}
+
+static void timer_pool_sample_ticks_run(odp_timer_clk_src_t clk_2)
+{
+ odp_timer_capability_t capa;
+ odp_timer_pool_param_t tp_param;
+ odp_timer_pool_t tp[2];
+ uint64_t t1[2], t2[2], ticks[2], min[2], max[2];
+ uint64_t clk_count[2] = {0};
+ odp_timer_clk_src_t clk_1 = ODP_CLOCK_DEFAULT;
+ uint64_t nsec = 100 * ODP_TIME_MSEC_IN_NS;
+
+ /* Highest resolution */
+ odp_timer_pool_param_init(&tp_param);
+ tp_param.num_timers = 100;
+
+ /* First timer pool: default clock source */
+ memset(&capa, 0, sizeof(capa));
+ CU_ASSERT_FATAL(odp_timer_capability(clk_1, &capa) == 0);
+ tp_param.clk_src = clk_1;
+ tp_param.res_hz = capa.max_res.res_hz;
+ tp_param.min_tmo = capa.max_res.min_tmo;
+ tp_param.max_tmo = capa.max_res.max_tmo;
+
+ tp[0] = odp_timer_pool_create("timer_pool_0", &tp_param);
+ CU_ASSERT_FATAL(tp[0] != ODP_TIMER_POOL_INVALID);
+
+ /* Second timer pool: another clock source */
+ memset(&capa, 0, sizeof(capa));
+ CU_ASSERT_FATAL(odp_timer_capability(clk_2, &capa) == 0);
+ tp_param.clk_src = clk_2;
+ tp_param.res_hz = capa.max_res.res_hz;
+ tp_param.min_tmo = capa.max_res.min_tmo;
+ tp_param.max_tmo = capa.max_res.max_tmo;
+
+ tp[1] = odp_timer_pool_create("timer_pool_1", &tp_param);
+ CU_ASSERT_FATAL(tp[1] != ODP_TIMER_POOL_INVALID);
+
+ odp_timer_pool_start();
+
+ /* Allow +-10% error margin */
+ min[0] = odp_timer_ns_to_tick(tp[0], 0.9 * nsec);
+ max[0] = odp_timer_ns_to_tick(tp[0], 1.1 * nsec);
+ min[1] = odp_timer_ns_to_tick(tp[1], 0.9 * nsec);
+ max[1] = odp_timer_ns_to_tick(tp[1], 1.1 * nsec);
+
+ CU_ASSERT_FATAL(odp_timer_sample_ticks(tp, t1, NULL, 2) == 0);
+
+ odp_time_wait_ns(nsec);
+
+ CU_ASSERT_FATAL(odp_timer_sample_ticks(tp, t2, clk_count, 2) == 0);
+
+ ticks[0] = t2[0] - t1[0];
+ ticks[1] = t2[1] - t1[1];
+
+ CU_ASSERT(t2[0] >= t1[0]);
+ CU_ASSERT(t2[1] >= t1[1]);
+ CU_ASSERT(ticks[0] >= min[0]);
+ CU_ASSERT(ticks[1] >= min[1]);
+ CU_ASSERT(ticks[0] <= max[0]);
+ CU_ASSERT(ticks[1] <= max[1]);
+
+ printf("\nClock source: %i, %i\n", clk_1, clk_2);
+ printf(" Time nsec: %" PRIu64 "\n", nsec);
+ printf(" Measured ticks: %" PRIu64 ", %" PRIu64 "\n", ticks[0], ticks[1]);
+ printf(" Expected ticks: %" PRIu64 ", %" PRIu64 "\n",
+ odp_timer_ns_to_tick(tp[0], nsec), odp_timer_ns_to_tick(tp[1], nsec));
+ printf(" T2 tick: %" PRIu64 ", %" PRIu64 "\n", t2[0], t2[1]);
+ printf(" Clk count: %" PRIu64 ", %" PRIu64 "\n", clk_count[0], clk_count[1]);
+
+ odp_timer_pool_destroy(tp[0]);
+ odp_timer_pool_destroy(tp[1]);
+}
+
+static void timer_pool_sample_ticks(void)
+{
+ for (int i = 0; i < ODP_CLOCK_NUM_SRC; i++) {
+ if (global_mem->clk_supported[i])
+ timer_pool_sample_ticks_run(ODP_CLOCK_SRC_0 + i);
+ }
+}
+
static void timer_pool_tick_info_run(odp_timer_clk_src_t clk_src)
{
odp_timer_capability_t capa;
@@ -1572,7 +1742,7 @@ static void timer_test_cancel(void)
odp_timer_t tim;
odp_event_t ev;
odp_timeout_t tmo;
- odp_timer_set_t rc;
+ odp_timer_retval_t rc;
int ret;
memset(&capa, 0, sizeof(capa));
@@ -1632,7 +1802,7 @@ static void timer_test_cancel(void)
CU_FAIL_FATAL("Failed to set timer (relative time)");
ev = ODP_EVENT_INVALID;
- if (odp_timer_cancel(tim, &ev) != 0)
+ if (odp_timer_cancel(tim, &ev) != ODP_TIMER_SUCCESS)
CU_FAIL_FATAL("Failed to cancel timer (relative time)");
if (ev == ODP_EVENT_INVALID)
@@ -1815,7 +1985,7 @@ static void timer_test_tmo_limit(odp_queue_type_t queue_type,
t2 = odp_time_local();
diff_ns = odp_time_diff_ns(t2, t1);
- CU_ASSERT(ret == 0);
+ CU_ASSERT(ret == ODP_TIMER_SUCCESS);
CU_ASSERT(ev != ODP_EVENT_INVALID);
if (ev != ODP_EVENT_INVALID)
@@ -1962,7 +2132,6 @@ static int worker_entrypoint(void *arg ODP_UNUSED)
int thr = odp_thread_id();
uint32_t i, allocated;
unsigned seed = thr;
- int rc;
odp_queue_t queue;
struct test_timer *tt;
uint32_t nset;
@@ -1976,7 +2145,7 @@ static int worker_entrypoint(void *arg ODP_UNUSED)
odp_event_t ev;
struct timespec ts;
uint32_t nstale;
- odp_timer_set_t timer_rc;
+ odp_timer_retval_t rc;
odp_timer_start_t start_param;
odp_timer_pool_t tp = global_mem->tp;
odp_pool_t tbp = global_mem->tbp;
@@ -2049,11 +2218,11 @@ static int worker_entrypoint(void *arg ODP_UNUSED)
start_param.tmo_ev = tt[i].ev;
tt[i].ev = ODP_EVENT_INVALID;
- timer_rc = odp_timer_start(tt[i].tim, &start_param);
- if (timer_rc == ODP_TIMER_TOO_NEAR) {
+ rc = odp_timer_start(tt[i].tim, &start_param);
+ if (rc == ODP_TIMER_TOO_NEAR) {
ODPH_ERR("Missed tick, setting timer\n");
- } else if (timer_rc != ODP_TIMER_SUCCESS) {
- ODPH_ERR("Failed to set timer: %d\n", timer_rc);
+ } else if (rc != ODP_TIMER_SUCCESS) {
+ ODPH_ERR("Failed to set timer: %d\n", rc);
CU_FAIL("Failed to set timer");
} else {
tt[i].tick = tck;
@@ -2087,16 +2256,18 @@ static int worker_entrypoint(void *arg ODP_UNUSED)
goto sleep;
/* Timer active, cancel it */
rc = odp_timer_cancel(tt[i].tim, &tt[i].ev);
- if (rc != 0) {
+
+ if (rc == ODP_TIMER_SUCCESS) {
+ tt[i].tick = TICK_INVALID;
+ ncancel++;
+ } else if (rc == ODP_TIMER_TOO_NEAR) {
/* Cancel failed, timer already expired */
ntoolate++;
- ODPH_DBG("Failed to cancel timer, probably already expired\n");
+ ODPH_DBG("Failed to cancel timer, already expired\n");
} else {
- tt[i].tick = TICK_INVALID;
- ncancel++;
+ CU_FAIL_FATAL("Cancel failed");
}
} else {
- odp_timer_set_t rc;
uint64_t cur_tick;
uint64_t tck;
int reset_timer = 0;
@@ -2151,15 +2322,21 @@ sleep:
CU_FAIL_FATAL("nanosleep failed");
}
- /* Cancel and free all timers */
+ /* Try to cancel all active timers */
nstale = 0;
for (i = 0; i < allocated; i++) {
- (void)odp_timer_cancel(tt[i].tim, &tt[i].ev);
+ if (tt[i].ev != ODP_EVENT_INVALID)
+ continue;
+
+ rc = odp_timer_cancel(tt[i].tim, &tt[i].ev);
tt[i].tick = TICK_INVALID;
- if (tt[i].ev == ODP_EVENT_INVALID)
- /* Cancel too late, timer already expired and
- * timeout enqueued */
+
+ if (rc == ODP_TIMER_TOO_NEAR) {
+ /* Cancel too late, timer already expired and timeout enqueued */
nstale++;
+ } else if (rc != ODP_TIMER_SUCCESS) {
+ CU_FAIL("Timer cancel failed");
+ }
}
ODPH_DBG("Thread %u: %" PRIu32 " timers set\n", thr, nset);
@@ -2207,8 +2384,7 @@ sleep:
if (ev != ODP_EVENT_INVALID)
CU_FAIL("Unexpected event received");
- rc = odp_queue_destroy(queue);
- CU_ASSERT(rc == 0);
+ CU_ASSERT(odp_queue_destroy(queue) == 0);
for (i = 0; i < allocated; i++) {
if (tt[i].ev != ODP_EVENT_INVALID)
odp_event_free(tt[i].ev);
@@ -2407,11 +2583,15 @@ static void timer_test_periodic_capa(void)
CU_ASSERT_FATAL(min_fract.integer || min_fract.numer);
CU_ASSERT_FATAL(max_fract.integer || max_fract.numer);
- if (min_fract.numer)
+ if (min_fract.numer) {
CU_ASSERT_FATAL(min_fract.denom);
+ CU_ASSERT_FATAL(min_fract.numer < min_fract.denom);
+ }
- if (max_fract.numer)
+ if (max_fract.numer) {
CU_ASSERT_FATAL(max_fract.denom);
+ CU_ASSERT_FATAL(max_fract.numer < max_fract.denom);
+ }
min_freq = odp_fract_u64_to_dbl(&min_fract);
max_freq = odp_fract_u64_to_dbl(&max_fract);
@@ -2497,8 +2677,11 @@ static void timer_test_periodic_capa(void)
capa.base_freq_hz.numer != base_freq.numer ||
capa.base_freq_hz.denom != base_freq.denom)
- if (capa.base_freq_hz.numer)
+ if (capa.base_freq_hz.numer) {
CU_ASSERT_FATAL(capa.base_freq_hz.denom);
+ CU_ASSERT_FATAL(capa.base_freq_hz.numer <
+ capa.base_freq_hz.denom);
+ }
CU_ASSERT(odp_fract_u64_to_dbl(&capa.base_freq_hz) >= min_freq);
CU_ASSERT(odp_fract_u64_to_dbl(&capa.base_freq_hz) <= max_freq);
@@ -2583,6 +2766,11 @@ static void timer_test_periodic(odp_queue_type_t queue_type, int use_first)
if (ret == 0) {
/* Allow 10% difference in outputted base frequency */
CU_ASSERT((freq_out > (0.9 * freq)) && (freq_out < (1.1 * freq)));
+
+ if (periodic_capa.base_freq_hz.numer) {
+ CU_ASSERT_FATAL(periodic_capa.base_freq_hz.numer <
+ periodic_capa.base_freq_hz.denom);
+ }
} else {
CU_ASSERT(base_freq.integer == periodic_capa.base_freq_hz.integer);
CU_ASSERT(base_freq.numer == periodic_capa.base_freq_hz.numer);
@@ -2798,6 +2986,8 @@ odp_testinfo_t timer_suite[] = {
ODP_TEST_INFO(timer_pool_create_destroy),
ODP_TEST_INFO(timer_pool_create_max),
ODP_TEST_INFO(timer_pool_max_res),
+ ODP_TEST_INFO(timer_pool_current_tick),
+ ODP_TEST_INFO(timer_pool_sample_ticks),
ODP_TEST_INFO(timer_pool_tick_info),
ODP_TEST_INFO_CONDITIONAL(timer_plain_rel_wait, check_plain_queue_support),
ODP_TEST_INFO_CONDITIONAL(timer_plain_abs_wait, check_plain_queue_support),