24#include <sys/resource.h>
27#include <odp/helper/odph_api.h>
32#define POOL_NUM_PKT 64
35#define MAX_AUTH_DIGEST_LEN 32
37static uint8_t test_aad[AAD_LEN] = {1, 2, 3, 4, 5, 6, 7, 8};
38static uint8_t test_iv[16] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16};
40static uint8_t test_key16[16] = { 0x01, 0x02, 0x03, 0x04, 0x05,
41 0x06, 0x07, 0x08, 0x09, 0x0a,
42 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
46static uint8_t test_key20[20] = { 0x01, 0x02, 0x03, 0x04, 0x05,
47 0x06, 0x07, 0x08, 0x09, 0x0a,
48 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
49 0x10, 0x11, 0x12, 0x13, 0x14,
52static uint8_t test_key24[24] = { 0x01, 0x02, 0x03, 0x04, 0x05,
53 0x06, 0x07, 0x08, 0x09, 0x0a,
54 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
55 0x10, 0x11, 0x12, 0x13, 0x14,
56 0x15, 0x16, 0x17, 0x18
59static uint8_t test_key32[32] = { 0x01, 0x02, 0x03, 0x04, 0x05,
60 0x06, 0x07, 0x08, 0x09, 0x0a,
61 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
62 0x10, 0x11, 0x12, 0x13, 0x14,
63 0x15, 0x16, 0x17, 0x18, 0x19,
64 0x1a, 0x1b, 0x1c, 0x1d, 0x1e,
68static uint8_t test_key64[64] = { 0x01, 0x02, 0x03, 0x04, 0x05,
69 0x06, 0x07, 0x08, 0x09, 0x0a,
70 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
71 0x10, 0x11, 0x12, 0x13, 0x14,
72 0x15, 0x16, 0x17, 0x18, 0x19,
73 0x1a, 0x1b, 0x1c, 0x1d, 0x1e,
74 0x1f, 0x20, 0x21, 0x22, 0x23,
75 0x24, 0x25, 0x26, 0x27, 0x28,
76 0x29, 0x2a, 0x4b, 0x2c, 0x2d,
77 0x2e, 0x2f, 0x30, 0x31, 0x32,
78 0x33, 0x34, 0x55, 0x36, 0x37,
79 0x38, 0x39, 0x5a, 0x3b, 0x3c,
80 0x3d, 0x3e, 0x5f, 0x40,
90 int cipher_in_bit_mode;
141 crypto_alg_config_t *alg_config;
178 double rusage_thread;
179} crypto_run_result_t;
186 struct rusage ru_self;
187 struct rusage ru_thread;
191typedef struct test_run_arg_t {
192 crypto_args_t crypto_args;
193 crypto_alg_config_t *crypto_alg_config;
198static void parse_args(
int argc,
char *argv[], crypto_args_t *cargs);
199static void usage(
char *progname);
204static unsigned int payloads[] = {
214static unsigned num_payloads;
219static crypto_alg_config_t algs_config[] = {
221 .name =
"3des-cbc-null",
226 .length =
sizeof(test_key24)
233 .name =
"3des-cbc-hmac-md5-96",
238 .length =
sizeof(test_key24)
244 .length =
sizeof(test_key16)
246 .auth_digest_len = 12,
250 .name =
"null-hmac-md5-96",
256 .length =
sizeof(test_key16)
258 .auth_digest_len = 12,
262 .name =
"aes-cbc-null",
267 .length =
sizeof(test_key16)
274 .name =
"aes-cbc-hmac-sha1-96",
279 .length =
sizeof(test_key16)
285 .length =
sizeof(test_key20)
287 .auth_digest_len = 12,
291 .name =
"null-hmac-sha1-96",
297 .length =
sizeof(test_key20)
299 .auth_digest_len = 12,
303 .name =
"aes-ctr-null",
308 .length =
sizeof(test_key16)
315 .name =
"aes-ctr-hmac-sha1-96",
320 .length =
sizeof(test_key16)
326 .length =
sizeof(test_key20)
328 .auth_digest_len = 12,
332 .name =
"null-hmac-sha256-128",
338 .length =
sizeof(test_key32)
340 .auth_digest_len = 16,
344 .name =
"null-hmac-sha512-256",
350 .length =
sizeof(test_key64)
352 .auth_digest_len = 32,
356 .name =
"null-aes-gmac",
362 .length =
sizeof(test_key16)
365 .auth_digest_len = 16,
374 .length =
sizeof(test_key16)
378 .auth_digest_len = 16,
379 .auth_aad_len = AAD_LEN,
388 .length =
sizeof(test_key16)
392 .auth_digest_len = 16,
393 .auth_aad_len = AAD_LEN,
397 .name =
"chacha20-poly1305",
402 .length =
sizeof(test_key32)
406 .auth_digest_len = 16,
407 .auth_aad_len = AAD_LEN,
416 .length =
sizeof(test_key16)
429 .length =
sizeof(test_key16)
432 .auth_digest_len = 4,
436 .name =
"zuc-eea3-zuc-eia3",
441 .length =
sizeof(test_key16)
447 .length =
sizeof(test_key16)
450 .auth_digest_len = 4,
454 .name =
"snow3g-uea2",
459 .length =
sizeof(test_key16)
466 .name =
"snow3g-uia2",
472 .length =
sizeof(test_key16)
475 .auth_digest_len = 4,
479 .name =
"snow3g-uea2-snow3g-uia2",
484 .length =
sizeof(test_key16)
490 .length =
sizeof(test_key16)
493 .auth_digest_len = 4,
502static crypto_alg_config_t *
503find_config_by_name(
const char *name) {
505 crypto_alg_config_t *ret = NULL;
507 for (i = 0; i < ODPH_ARRAY_SIZE(algs_config); i++) {
508 if (strcmp(algs_config[i].name, name) == 0) {
509 ret = algs_config + i;
521print_config_names(
const char *prefix) {
524 for (i = 0; i < ODPH_ARRAY_SIZE(algs_config); i++)
525 printf(
"%s %s\n", prefix, algs_config[i].name);
532fill_time_record(time_record_t *rec)
534 gettimeofday(&rec->tv, NULL);
535 getrusage(RUSAGE_SELF, &rec->ru_self);
536 getrusage(RUSAGE_THREAD, &rec->ru_thread);
543static unsigned long long
544get_rusage_diff(
struct rusage *start,
struct rusage *end)
546 unsigned long long rusage_diff;
547 unsigned long long rusage_start;
548 unsigned long long rusage_end;
550 rusage_start = (start->ru_utime.tv_sec * 1000000) +
551 (start->ru_utime.tv_usec);
552 rusage_start += (start->ru_stime.tv_sec * 1000000) +
553 (start->ru_stime.tv_usec);
555 rusage_end = (end->ru_utime.tv_sec * 1000000) +
556 (end->ru_utime.tv_usec);
557 rusage_end += (end->ru_stime.tv_sec * 1000000) +
558 (end->ru_stime.tv_usec);
560 rusage_diff = rusage_end - rusage_start;
569static unsigned long long
570get_rusage_self_diff(time_record_t *start, time_record_t *end)
572 return get_rusage_diff(&start->ru_self, &end->ru_self);
579static unsigned long long
580get_rusage_thread_diff(time_record_t *start, time_record_t *end)
582 return get_rusage_diff(&start->ru_thread, &end->ru_thread);
588static unsigned long long
589get_elapsed_usec(time_record_t *start, time_record_t *end)
591 unsigned long long s;
592 unsigned long long e;
594 s = (start->tv.tv_sec * 1000000) +
596 e = (end->tv.tv_sec * 1000000) +
602#define REPORT_HEADER "%30.30s %15s %15s %15s %15s %15s %15s\n"
603#define REPORT_LINE "%30.30s %15d %15d %15.3f %15.3f %15.3f %15d\n"
609print_result_header(
void)
611 printf(REPORT_HEADER,
612 "algorithm",
"avg over #",
"payload (bytes)",
"elapsed (us)",
613 "rusg self (us)",
"rusg thrd (us)",
"throughput (Kb)");
620print_result(crypto_args_t *cargs,
621 unsigned int payload_length,
622 crypto_alg_config_t *config,
623 crypto_run_result_t *result)
625 unsigned int throughput;
627 throughput = (1000000.0 / result->elapsed) * payload_length / 1024;
629 config->name, cargs->iteration_count, payload_length,
630 result->elapsed, result->rusage_self, result->rusage_thread,
638print_mem(
const char *msg,
639 const unsigned char *ptr,
648 printf(
"\n%s (bytes size = %d)", msg, len);
650 for (i = 0; i < len; i += 16) {
652 sprintf(p,
"\n%04x ", i); p += 8;
654 for (j = 0; j < 16; j++) {
658 sprintf(p,
" %02x", (ptr)[i + j]); p += 3;
661 for (; j < 16; j++) {
662 sprintf(p,
" "); p += 3;
665 sprintf(p,
" "); p += 3;
667 for (j = 0; j < 16; j++) {
671 *p++ = (
' ' <= c && c <=
'~') ? c :
'.';
685 crypto_alg_config_t *config,
686 crypto_args_t *cargs)
694 params.
cipher_alg = config->session.cipher_alg;
695 params.
cipher_key = config->session.cipher_key;
697 params.
auth_alg = config->session.auth_alg;
698 params.
auth_key = config->session.auth_key;
706 if (cargs->schedule || cargs->poll) {
709 ODPH_ERR(
"crypto-out queue not found\n");
720 switch (ses_create_rc) {
722 printf(
" requested algorithm combination not supported\n");
725 printf(
" requested algorithm order not supported\n");
728 printf(
" requested session parameters not supported\n");
733 ODPH_ERR(
"crypto session create failed.\n");
741make_packet(
odp_pool_t pkt_pool,
unsigned int payload_length)
747 ODPH_ERR(
"failed to allocate buffer\n");
753 memset(mem, 1, payload_length);
763run_measure_one(crypto_args_t *cargs,
764 crypto_alg_config_t *config,
766 unsigned int payload_length,
767 crypto_run_result_t *result)
775 uint32_t packet_len = payload_length + MAX_AUTH_DIGEST_LEN;
779 ODPH_ERR(
"pkt_pool not found\n");
784 if (cargs->schedule || cargs->poll) {
786 ODPH_ERR(
"crypto-out queue not found\n");
791 if (cargs->reuse_packet) {
792 pkt = make_packet(pkt_pool, packet_len);
797 time_record_t start, end;
798 int packets_sent = 0;
799 int packets_received = 0;
802 memset(¶ms, 0,
sizeof(params));
816 fill_time_record(&start);
818 while ((packets_sent < cargs->iteration_count) ||
819 (packets_received < cargs->iteration_count)) {
822 if ((packets_sent < cargs->iteration_count) &&
823 (packets_sent - packets_received <
827 if (!cargs->reuse_packet) {
828 pkt = make_packet(pkt_pool, packet_len);
833 if (cargs->debug_packets) {
835 print_mem(
"Packet before encryption:",
836 mem, payload_length);
839 if (cargs->schedule || cargs->poll) {
842 ODPH_ERR(
"failed odp_crypto_packet_op_enq: rc = %d\n", rc);
843 if (!cargs->reuse_packet)
852 ODPH_ERR(
"failed odp_crypto_packet_op: rc = %d\n", rc);
853 if (!cargs->reuse_packet)
860 ODPH_ERR(
"Crypto operation failed\n");
864 if (cargs->debug_packets) {
866 print_mem(
"Immediately encrypted "
873 if (cargs->reuse_packet)
880 if (cargs->schedule || cargs->poll) {
893 ODPH_ERR(
"Crypto operation failed\n");
897 if (cargs->debug_packets) {
899 print_mem(
"Received encrypted packet",
903 session.auth_digest_len);
905 if (cargs->reuse_packet)
919 fill_time_record(&end);
924 count = get_elapsed_usec(&start, &end);
925 result->elapsed = count /
926 cargs->iteration_count;
928 count = get_rusage_self_diff(&start, &end);
929 result->rusage_self = count /
930 cargs->iteration_count;
932 count = get_rusage_thread_diff(&start, &end);
933 result->rusage_thread = count /
934 cargs->iteration_count;
937 if (cargs->reuse_packet)
940 return rc < 0 ? rc : 0;
1059 if (check_cipher_alg(crypto_capa, param->
cipher_alg))
1072 for (
int n = 0; n < num; n++) {
1087 if (len < capa->aad_len.min || len > capa->
aad_len.
max)
1105 ODPH_ERR(
"MAX_AUTH_DIGEST_LEN too low\n");
1109 if (check_auth_alg(crypto_capa, param->
auth_alg))
1122 for (
int n = 0; n < num; n++) {
1143static int run_measure_one_config(test_run_arg_t *arg)
1145 crypto_run_result_t result;
1147 crypto_args_t *cargs = &arg->crypto_args;
1148 crypto_alg_config_t *config = arg->crypto_alg_config;
1154 if (check_cipher_params(&crypto_capa, &config->session,
1155 &config->cipher_in_bit_mode)) {
1156 printf(
" Cipher algorithm not supported\n");
1160 if (check_auth_params(&crypto_capa, &config->session,
1161 &config->auth_in_bit_mode)) {
1162 printf(
" Auth algorithm not supported\n");
1166#if ODP_VERSION_API >= ODP_VERSION_API_NUM(1, 42, 0)
1168 config->cipher_in_bit_mode = 0;
1169 config->auth_in_bit_mode = 0;
1173 rc = create_session_from_config(&session, config, cargs);
1175 printf(
" => %s skipped\n", config->name);
1176 return rc > 0 ? 0 : -1;
1179 if (cargs->payload_length) {
1180 rc = run_measure_one(cargs, config, &session,
1181 cargs->payload_length, &result);
1183 print_result_header();
1184 print_result(cargs, cargs->payload_length,
1190 print_result_header();
1191 for (i = 0; i < num_payloads; i++) {
1192 rc = run_measure_one(cargs, config, &session,
1193 payloads[i], &result);
1196 print_result(cargs, payloads[i],
1206static int run_thr_func(
void *arg)
1208 run_measure_one_config((test_run_arg_t *)arg);
1212int main(
int argc,
char *argv[])
1214 crypto_args_t cargs;
1219 test_run_arg_t test_run_arg;
1222 int num_workers = 1;
1223 odph_helper_options_t helper_options;
1224 odph_thread_t thread_tbl[num_workers];
1225 odph_thread_common_param_t thr_common;
1226 odph_thread_param_t thr_param;
1231 uint32_t max_seg_len;
1235 argc = odph_parse_options(argc, argv);
1236 if (odph_options(&helper_options)) {
1237 ODPH_ERR(
"Reading ODP helper options failed.\n");
1242 init_param.
mem_model = helper_options.mem_model;
1244 memset(&cargs, 0,
sizeof(cargs));
1247 parse_args(argc, argv, &cargs);
1251 ODPH_ERR(
"ODP global init failed.\n");
1259 memset(&crypto_capa, 0,
sizeof(crypto_capa));
1262 ODPH_ERR(
"Crypto capability request failed.\n");
1267 ODPH_ERR(
"scheduled type completion queue not supported.\n");
1272 ODPH_ERR(
"plain type completion queue not supported.\n");
1277 ODPH_ERR(
"Pool capability request failed.\n");
1283 for (i = 0; i < ODPH_ARRAY_SIZE(payloads); i++) {
1284 if (payloads[i] + MAX_AUTH_DIGEST_LEN > max_seg_len)
1293 params.
pkt.
len = max_seg_len;
1294 params.
pkt.
num = POOL_NUM_PKT;
1299 ODPH_ERR(
"packet pool create failed.\n");
1305 if (cargs.schedule) {
1312 }
else if (cargs.poll) {
1316 if (cargs.schedule || cargs.poll) {
1318 ODPH_ERR(
"crypto-out queue create failed.\n");
1323 if (cargs.schedule) {
1324 printf(
"Run in async scheduled mode\n");
1328 sizeof(cpumaskstr));
1329 printf(
"num worker threads: %i\n",
1331 printf(
"first CPU: %i\n",
1333 printf(
"cpu mask: %s\n",
1335 }
else if (cargs.poll) {
1336 printf(
"Run in async poll mode\n");
1338 printf(
"Run in sync mode\n");
1341 test_run_arg.crypto_args = cargs;
1342 test_run_arg.crypto_alg_config = cargs.alg_config;
1343 test_run_arg.crypto_capa = crypto_capa;
1345 if (cargs.alg_config) {
1346 odph_thread_common_param_init(&thr_common);
1347 thr_common.instance = instance;
1348 thr_common.cpumask = &cpumask;
1349 thr_common.share_param = 1;
1351 if (cargs.schedule) {
1352 odph_thread_param_init(&thr_param);
1353 thr_param.start = run_thr_func;
1354 thr_param.arg = &test_run_arg;
1357 memset(thread_tbl, 0,
sizeof(thread_tbl));
1358 odph_thread_create(thread_tbl, &thr_common, &thr_param, num_workers);
1360 odph_thread_join(thread_tbl, num_workers);
1362 run_measure_one_config(&test_run_arg);
1365 for (i = 0; i < ODPH_ARRAY_SIZE(algs_config); i++) {
1366 test_run_arg.crypto_alg_config = algs_config + i;
1367 run_measure_one_config(&test_run_arg);
1371 if (cargs.schedule || cargs.poll)
1374 ODPH_ERR(
"Error: pool destroy\n");
1379 ODPH_ERR(
"Error: term local\n");
1384 ODPH_ERR(
"Error: term global\n");
1391static void parse_args(
int argc,
char *argv[], crypto_args_t *cargs)
1394 static const struct option longopts[] = {
1395 {
"algorithm", optional_argument, NULL,
'a'},
1396 {
"debug", no_argument, NULL,
'd'},
1397 {
"flight", optional_argument, NULL,
'f'},
1398 {
"help", no_argument, NULL,
'h'},
1399 {
"iterations", optional_argument, NULL,
'i'},
1400 {
"payload", optional_argument, NULL,
'l'},
1401 {
"sessions", optional_argument, NULL,
'm'},
1402 {
"reuse", no_argument, NULL,
'r'},
1403 {
"poll", no_argument, NULL,
'p'},
1404 {
"schedule", no_argument, NULL,
's'},
1408 static const char *shortopts =
"+a:c:df:hi:m:l:spr";
1410 cargs->in_flight = 1;
1411 cargs->debug_packets = 0;
1412 cargs->iteration_count = 10000;
1413 cargs->payload_length = 0;
1414 cargs->alg_config = NULL;
1415 cargs->reuse_packet = 0;
1416 cargs->schedule = 0;
1419 opt = getopt_long(argc, argv, shortopts, longopts, NULL);
1426 cargs->alg_config = find_config_by_name(optarg);
1427 if (!cargs->alg_config) {
1428 printf(
"cannot test crypto '%s' configuration\n",
1435 cargs->debug_packets = 1;
1438 cargs->iteration_count = atoi(optarg);
1441 cargs->in_flight = atoi(optarg);
1448 cargs->max_sessions = atoi(optarg);
1451 cargs->payload_length = atoi(optarg);
1454 cargs->reuse_packet = 1;
1457 cargs->schedule = 1;
1469 if ((cargs->in_flight > 1) && cargs->reuse_packet) {
1470 printf(
"-f (in flight > 1) and -r (reuse packet) options are not compatible\n");
1474 if (cargs->schedule && cargs->poll) {
1475 printf(
"-s (schedule) and -p (poll) options are not compatible\n");
1484static void usage(
char *progname)
1487 "Usage: %s OPTIONS\n"
1488 " E.g. %s -i 100000\n"
1490 "OpenDataPlane crypto speed measure.\n"
1491 "Optional OPTIONS\n"
1492 " -a, --algorithm <name> Specify algorithm name (default all)\n"
1493 " Supported values are:\n",
1494 progname, progname);
1496 print_config_names(
" ");
1497 printf(
" -d, --debug Enable dump of processed packets.\n"
1498 " -f, --flight <number> Max number of packet processed in parallel (default 1)\n"
1499 " -i, --iterations <number> Number of iterations.\n"
1500 " -l, --payload Payload length.\n"
1501 " -r, --reuse Output encrypted packet is passed as input\n"
1502 " to next encrypt iteration.\n"
1503 " -s, --schedule Use scheduler for completion events.\n"
1504 " -p, --poll Poll completion queue for completion events.\n"
1505 " -h, --help Display help and exit.\n"
#define odp_unlikely(x)
Branch unlikely taken.
int odp_cpumask_default_worker(odp_cpumask_t *mask, int num)
Default CPU mask for worker threads.
int odp_cpumask_first(const odp_cpumask_t *mask)
Find first set CPU in mask.
int32_t odp_cpumask_to_str(const odp_cpumask_t *mask, char *str, int32_t size)
Format a string from CPU mask.
#define ODP_CPUMASK_STR_SIZE
The maximum number of characters needed to record any CPU mask as a string (output of odp_cpumask_to_...
int odp_crypto_cipher_capability(odp_cipher_alg_t cipher, odp_crypto_cipher_capability_t capa[], int num)
Query supported cipher algorithm capabilities.
odp_cipher_alg_t
Crypto API cipher algorithm.
int odp_crypto_capability(odp_crypto_capability_t *capa)
Query crypto capabilities.
void odp_crypto_session_param_init(odp_crypto_session_param_t *param)
Initialize crypto session parameters.
uint64_t odp_crypto_session_t
Crypto API opaque session handle.
int odp_crypto_session_create(const odp_crypto_session_param_t *param, odp_crypto_session_t *session, odp_crypto_ses_create_err_t *status)
Crypto session creation.
int odp_crypto_result(odp_crypto_packet_result_t *result, odp_packet_t packet)
Get crypto operation results from a crypto processed packet.
int odp_crypto_session_destroy(odp_crypto_session_t session)
Crypto session destroy.
int odp_crypto_op(const odp_packet_t pkt_in[], odp_packet_t pkt_out[], const odp_crypto_packet_op_param_t param[], int num_pkt)
Crypto packet operation.
odp_auth_alg_t
Crypto API authentication algorithm.
odp_crypto_ses_create_err_t
Crypto API session creation return code.
odp_packet_t odp_crypto_packet_from_event(odp_event_t ev)
Return crypto processed packet that is associated with event.
int odp_crypto_op_enq(const odp_packet_t pkt_in[], const odp_packet_t pkt_out[], const odp_crypto_packet_op_param_t param[], int num_pkt)
Crypto packet operation.
int odp_crypto_auth_capability(odp_auth_alg_t auth, odp_crypto_auth_capability_t capa[], int num)
Query supported authentication algorithm capabilities.
@ ODP_CIPHER_ALG_SNOW3G_UEA2
Confidentiality UEA2 algorithm (128-EEA1)
@ ODP_CIPHER_ALG_AES_CCM
AES-CCM.
@ ODP_CIPHER_ALG_AES_CTR
AES with counter mode.
@ ODP_CIPHER_ALG_CHACHA20_POLY1305
ChaCha20-Poly1305.
@ ODP_CIPHER_ALG_AES_CBC
AES with cipher block chaining.
@ ODP_CIPHER_ALG_AES_GCM
AES-GCM.
@ ODP_CIPHER_ALG_3DES_CBC
Triple DES with cipher block chaining.
@ ODP_CIPHER_ALG_NULL
No cipher algorithm specified.
@ ODP_CIPHER_ALG_ZUC_EEA3
ZUC based confidentiality algorithm.
@ ODP_CRYPTO_OP_TYPE_BASIC
Input packet data and metadata are copied to the output packet and then processed.
@ ODP_AUTH_ALG_SHA384_HMAC
HMAC-SHA-384.
@ ODP_AUTH_ALG_CHACHA20_POLY1305
ChaCha20-Poly1305 AEAD.
@ ODP_AUTH_ALG_NULL
No authentication algorithm specified.
@ ODP_AUTH_ALG_MD5_HMAC
HMAC-MD5.
@ ODP_AUTH_ALG_SHA512_HMAC
HMAC-SHA-512.
@ ODP_AUTH_ALG_SHA1_HMAC
HMAC-SHA-1.
@ ODP_AUTH_ALG_SHA256_HMAC
HMAC-SHA-256.
@ ODP_AUTH_ALG_SNOW3G_UIA2
Integrity UIA2 algorithm (128-EIA1)
@ ODP_AUTH_ALG_AES_GMAC
AES-GMAC.
@ ODP_AUTH_ALG_AES_GCM
AES-GCM.
@ ODP_AUTH_ALG_AES_CCM
AES-CCM.
@ ODP_AUTH_ALG_ZUC_EIA3
ZUC-based integrity algorithm.
@ ODP_CRYPTO_SES_ERR_ALG_COMBO
Unsupported combination of algorithms.
@ ODP_CRYPTO_SES_ERR_ALG_ORDER
Unsupported order of cipher and auth.
@ ODP_CRYPTO_SES_ERR_PARAMS
Unsupported combination of session creation parameters.
@ ODP_CRYPTO_OP_ENCODE
Encrypt and/or compute authentication ICV.
@ ODP_CRYPTO_SYNC
Synchronous, return results immediately.
@ ODP_CRYPTO_ASYNC
Asynchronous, return results via posted event.
#define ODP_EVENT_INVALID
Invalid event.
void odp_init_param_init(odp_init_t *param)
Initialize the odp_init_t to default values for all fields.
int odp_init_local(odp_instance_t instance, odp_thread_type_t thr_type)
Thread local ODP initialization.
int odp_init_global(odp_instance_t *instance, const odp_init_t *params, const odp_platform_init_t *platform_params)
Global ODP initialization.
int odp_term_local(void)
Thread local ODP termination.
int odp_term_global(odp_instance_t instance)
Global ODP termination.
uint64_t odp_instance_t
ODP instance ID.
void * odp_packet_data(odp_packet_t pkt)
Packet data pointer.
odp_packet_t odp_packet_alloc(odp_pool_t pool, uint32_t len)
Allocate a packet from a packet pool.
void odp_packet_free(odp_packet_t pkt)
Free packet.
#define ODP_PACKET_INVALID
Invalid packet.
odp_pool_t odp_pool_create(const char *name, const odp_pool_param_t *param)
Create a pool.
int odp_pool_capability(odp_pool_capability_t *capa)
Query pool capabilities.
void odp_pool_param_init(odp_pool_param_t *param)
Initialize pool params.
int odp_pool_destroy(odp_pool_t pool)
Destroy a pool previously created by odp_pool_create()
void odp_pool_print(odp_pool_t pool)
Print pool info.
odp_pool_t odp_pool_lookup(const char *name)
Find a pool by name.
#define ODP_POOL_INVALID
Invalid pool.
@ ODP_POOL_PACKET
Packet pool.
odp_queue_t odp_queue_lookup(const char *name)
Find a queue by name.
void odp_queue_param_init(odp_queue_param_t *param)
Initialize queue params.
#define ODP_QUEUE_INVALID
Invalid queue.
odp_event_t odp_queue_deq(odp_queue_t queue)
Dequeue an event from a queue.
odp_queue_t odp_queue_create(const char *name, const odp_queue_param_t *param)
Queue create.
int odp_queue_destroy(odp_queue_t queue)
Destroy ODP queue.
@ ODP_QUEUE_TYPE_SCHED
Scheduled queue.
@ ODP_QUEUE_TYPE_PLAIN
Plain queue.
#define ODP_SCHED_SYNC_PARALLEL
Parallel scheduled queues.
#define ODP_SCHED_NO_WAIT
Do not wait.
int odp_schedule_default_prio(void)
Default scheduling priority level.
int odp_schedule_config(const odp_schedule_config_t *config)
Global schedule configuration.
odp_event_t odp_schedule(odp_queue_t *from, uint64_t wait)
Schedule an event.
#define ODP_SCHED_GROUP_ALL
Group of all threads.
void odp_sys_info_print(void)
Print system info.
@ ODP_THREAD_WORKER
Worker thread.
Authentication algorithm capabilities.
struct odp_crypto_auth_capability_t::@26 aad_len
Additional Authenticated Data (AAD) lengths.
uint32_t min
Minimum AAD length in bytes.
uint32_t max
Maximum AAD length in bytes.
odp_bool_t bit_mode
Auth algorithm supports bit mode.
uint32_t inc
Increment of supported lengths between min and max (in bytes)
uint32_t digest_len
Digest length in bytes.
uint32_t key_len
Key length in bytes.
uint32_t iv_len
IV length in bytes.
odp_bool_t queue_type_sched
Scheduled crypto completion queue support.
odp_crypto_cipher_algos_t ciphers
Supported cipher algorithms.
odp_bool_t queue_type_plain
Plain crypto completion queue support.
odp_crypto_auth_algos_t auths
Supported authentication algorithms.
Cipher algorithm capabilities.
odp_bool_t bit_mode
Cipher supports bit mode.
uint32_t key_len
Key length in bytes.
uint32_t iv_len
IV length in bytes.
uint32_t length
Key length in bytes.
Crypto packet API per packet operation parameters.
uint32_t hash_result_offset
Offset from start of packet for hash result.
const uint8_t * aad_ptr
Pointer to AAD.
const uint8_t * cipher_iv_ptr
IV pointer for cipher.
const uint8_t * auth_iv_ptr
IV pointer for authentication.
odp_packet_data_range_t cipher_range
Data range to be ciphered.
odp_crypto_session_t session
Session handle from creation.
odp_packet_data_range_t auth_range
Data range to be authenticated.
Crypto API session creation parameters.
odp_bool_t auth_cipher_text
Authenticate cipher vs.
odp_crypto_key_t auth_key
Authentication key.
uint32_t auth_aad_len
Additional Authenticated Data (AAD) length in bytes.
odp_crypto_op_type_t op_type
Crypto operation type.
odp_crypto_key_t cipher_key
Cipher key.
odp_queue_t compl_queue
Async mode completion event queue.
uint32_t cipher_iv_len
Cipher IV length.
uint32_t auth_digest_len
Authentication digest length in bytes.
odp_auth_alg_t auth_alg
Authentication algorithm.
odp_crypto_op_mode_t op_mode
Operation mode when using packet interface: sync or async.
odp_cipher_alg_t cipher_alg
Cipher algorithm.
uint32_t auth_iv_len
Authentication IV length.
odp_crypto_op_t op
Encode vs.
Global initialization parameters.
odp_mem_model_t mem_model
Application memory model.
uint32_t offset
Offset from beginning of packet.
uint32_t length
Length of data to operate on.
struct odp_pool_capability_t::@134 pkt
Packet pool capabilities
uint32_t max_seg_len
Maximum packet segment data length in bytes.
uint32_t num
Number of buffers in the pool.
struct odp_pool_param_t::@139 pkt
Parameters for packet pools.
odp_pool_type_t type
Pool type.
uint32_t len
Minimum length of 'num' packets.
uint32_t seg_len
Minimum number of packet data bytes that can be stored in the first segment of a newly allocated pack...
odp_schedule_param_t sched
Scheduler parameters.
odp_queue_type_t type
Queue type.
odp_schedule_group_t group
Thread group.
odp_schedule_prio_t prio
Priority level.
odp_schedule_sync_t sync
Synchronization method.
uint32_t null
ODP_AUTH_ALG_NULL.
uint32_t sha1_hmac
ODP_AUTH_ALG_SHA1_HMAC.
uint32_t sha512_hmac
ODP_AUTH_ALG_SHA512_HMAC.
uint32_t zuc_eia3
ODP_AUTH_ALG_ZUC_EIA3.
uint32_t snow3g_uia2
ODP_AUTH_ALG_SNOW3G_UIA2.
uint32_t aes_gmac
ODP_AUTH_ALG_AES_GMAC.
uint32_t aes_gcm
ODP_AUTH_ALG_AES_GCM.
uint32_t md5_hmac
ODP_AUTH_ALG_MD5_HMAC.
uint32_t sha384_hmac
ODP_AUTH_ALG_SHA384_HMAC.
uint32_t sha256_hmac
ODP_AUTH_ALG_SHA256_HMAC.
uint32_t chacha20_poly1305
ODP_AUTH_ALG_CHACHA20_POLY1305.
struct odp_crypto_auth_algos_t::@25 bit
Authentication algorithms.
uint32_t aes_ccm
ODP_AUTH_ALG_AES_CCM.
struct odp_crypto_cipher_algos_t::@24 bit
Cipher algorithms.
uint32_t aes_gcm
ODP_CIPHER_ALG_AES_GCM.
uint32_t trides_cbc
ODP_CIPHER_ALG_3DES_CBC.
uint32_t aes_ctr
ODP_CIPHER_ALG_AES_CTR.
uint32_t aes_cbc
ODP_CIPHER_ALG_AES_CBC.
uint32_t des
ODP_CIPHER_ALG_DES.
uint32_t zuc_eea3
ODP_CIPHER_ALG_ZUC_EEA3.
uint32_t null
ODP_CIPHER_ALG_NULL.
uint32_t chacha20_poly1305
ODP_CIPHER_ALG_CHACHA20_POLY1305.
uint32_t snow3g_uea2
ODP_CIPHER_ALG_SNOW3G_UEA2.
uint32_t aes_ccm
ODP_CIPHER_ALG_AES_CCM.