MCPcopy Create free account
hub / github.com/F-Stack/f-stack / cperf_check_test_vector

Function cperf_check_test_vector

dpdk/app/test-crypto-perf/main.c:428–546  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

426}
427
428static int
429cperf_check_test_vector(struct cperf_options *opts,
430 struct cperf_test_vector *test_vec)
431{
432 if (opts->op_type == CPERF_CIPHER_ONLY) {
433 if (opts->cipher_algo == RTE_CRYPTO_CIPHER_NULL) {
434 if (test_vec->plaintext.data == NULL)
435 return -1;
436 } else {
437 if (test_vec->plaintext.data == NULL)
438 return -1;
439 if (test_vec->plaintext.length < opts->max_buffer_size)
440 return -1;
441 if (test_vec->ciphertext.data == NULL)
442 return -1;
443 if (test_vec->ciphertext.length < opts->max_buffer_size)
444 return -1;
445 /* Cipher IV is only required for some algorithms */
446 if (opts->cipher_iv_sz &&
447 test_vec->cipher_iv.data == NULL)
448 return -1;
449 if (test_vec->cipher_iv.length != opts->cipher_iv_sz)
450 return -1;
451 if (test_vec->cipher_key.data == NULL)
452 return -1;
453 if (test_vec->cipher_key.length != opts->cipher_key_sz)
454 return -1;
455 }
456 } else if (opts->op_type == CPERF_AUTH_ONLY) {
457 if (opts->auth_algo != RTE_CRYPTO_AUTH_NULL) {
458 if (test_vec->plaintext.data == NULL)
459 return -1;
460 if (test_vec->plaintext.length < opts->max_buffer_size)
461 return -1;
462 /* Auth key is only required for some algorithms */
463 if (opts->auth_key_sz &&
464 test_vec->auth_key.data == NULL)
465 return -1;
466 if (test_vec->auth_key.length != opts->auth_key_sz)
467 return -1;
468 if (test_vec->auth_iv.length != opts->auth_iv_sz)
469 return -1;
470 /* Auth IV is only required for some algorithms */
471 if (opts->auth_iv_sz && test_vec->auth_iv.data == NULL)
472 return -1;
473 if (test_vec->digest.data == NULL)
474 return -1;
475 if (test_vec->digest.length < opts->digest_sz)
476 return -1;
477 }
478
479 } else if (opts->op_type == CPERF_CIPHER_THEN_AUTH ||
480 opts->op_type == CPERF_AUTH_THEN_CIPHER) {
481 if (opts->cipher_algo == RTE_CRYPTO_CIPHER_NULL) {
482 if (test_vec->plaintext.data == NULL)
483 return -1;
484 if (test_vec->plaintext.length < opts->max_buffer_size)
485 return -1;

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected