examples/fips_validation: cleanup bypass tests in response file
PATCH 1/1 examples/fips_validation: cleanup bypass tests in response file
Remove garbage entries for bypassed tests in response file.
--- examples/fips_validation/main.c | 74 ++++++++++++++++----------------- 1 file changed, 35 insertions(+), 39 deletions(-)
examples/fips_validation/main.c +35 -39
@@ -802,7 +802,7 @@ prepare_aes_xform(struct rte_crypto_sym_xform *xform)RTE_LOG (ERR ,USER1 ,"PMD %s key length %u IV length %u\n" , info.device_name, cipher_xform->key.length, cipher_xform->iv.length); -return -EPERM ; +return -ENOTSUP ; }return 0 ;
@@ -850,7 +850,7 @@ prepare_tdes_xform(struct rte_crypto_sym_xform *xform)RTE_LOG (ERR ,USER1 ,"PMD %s key length %u IV length %u\n" , info.device_name, cipher_xform->key.length, cipher_xform->iv.length); -return -EPERM ; +return -ENOTSUP ; }return 0 ;
@@ -887,7 +887,7 @@ prepare_hmac_xform(struct rte_crypto_sym_xform *xform)RTE_LOG (ERR ,USER1 ,"PMD %s key length %u IV length %u\n" , info.device_name, auth_xform->key.length, auth_xform->digest_length); -return -EPERM ; +return -ENOTSUP ; }return 0 ;
@@ -933,7 +933,7 @@ prepare_gcm_xform(struct rte_crypto_sym_xform *xform) aead_xform->digest_length, aead_xform->aad_length, aead_xform->iv.length); -return -EPERM ; +return -ENOTSUP ; }return 0 ;
@@ -978,7 +978,7 @@ prepare_gmac_xform(struct rte_crypto_sym_xform *xform) info.device_name, auth_xform->key.length, auth_xform->digest_length, auth_xform->iv.length); -return -EPERM ; +return -ENOTSUP ; }return 0 ;
@@ -1016,7 +1016,7 @@ prepare_cmac_xform(struct rte_crypto_sym_xform *xform)RTE_LOG (ERR ,USER1 ,"PMD %s key length %u IV length %u\n" , info.device_name, auth_xform->key.length, auth_xform->digest_length); -return -EPERM ; +return -ENOTSUP ; }return 0 ;
@@ -1062,7 +1062,7 @@ prepare_ccm_xform(struct rte_crypto_sym_xform *xform) aead_xform->digest_length, aead_xform->aad_length, aead_xform->iv.length); -return -EPERM ; +return -ENOTSUP ; }return 0 ;
@@ -1097,7 +1097,7 @@ prepare_sha_xform(struct rte_crypto_sym_xform *xform)RTE_LOG (ERR ,USER1 ,"PMD %s key length %u digest length %u\n" , info.device_name, auth_xform->key.length, auth_xform->digest_length); -return -EPERM ; +return -ENOTSUP ; }return 0 ;
@@ -1137,7 +1137,7 @@ prepare_xts_xform(struct rte_crypto_sym_xform *xform)RTE_LOG (ERR ,USER1 ,"PMD %s key length %u IV length %u\n" , info.device_name, cipher_xform->key.length, cipher_xform->iv.length); -return -EPERM ; +return -ENOTSUP ; }return 0 ;
@@ -1252,7 +1252,7 @@ fips_generic_test(void) ret =fips_run_test ();if (ret <0 ) { -if (ret == -EPERM || ret == -ENOTSUP ) { +if (ret == -ENOTSUP ) {fprintf (info.fp_wr,"Bypass\n\n" );return 0 ; }
@@ -1287,7 +1287,7 @@ fips_generic_test(void)fprintf (info.fp_wr,"\n" );free (val.val); -return 0 ; +return 1 ; } static int
@@ -1456,7 +1456,7 @@ fips_mct_tdes_test(void)free (val.val); -return 0 ; +return 1 ; } static int
@@ -1535,7 +1535,7 @@ fips_mct_aes_ecb_test(void)free (val.val); -return 0 ; +return 1 ; }static int fips_mct_aes_test (void )
@@ -1643,7 +1643,7 @@ fips_mct_aes_test(void)free (val.val); -return 0 ; +return 1 ; } static int
@@ -1729,7 +1729,7 @@ fips_mct_sha_test(void)free (val.val); -return 0 ; +return 1 ; }
@@ -1844,18 +1844,15 @@ fips_test_one_file(void) } ret =fips_test_parse_one_case (); -switch (ret) { -case 0 : - ret = test_ops.test (); -if (ret ==0 ) -break ; -RTE_LOG (ERR ,USER1 ,"Error %i: test block\n" , +if (ret <0 ) { +RTE_LOG (ERR ,USER1 ,"Error %i: Parse block\n" , ret); goto error_one_case; -case 1 : -break ; -default : -RTE_LOG (ERR ,USER1 ,"Error %i: Parse block\n" , + } + + ret = test_ops.test (); +if (ret <0 ) { +RTE_LOG (ERR ,USER1 ,"Error %i: test block\n" , ret); goto error_one_case; }
@@ -1905,22 +1902,21 @@ fips_test_one_test_case(void)int ret; ret =fips_test_parse_one_json_case (); +if (ret <0 ) { +RTE_LOG (ERR ,USER1 ,"Error %i: Parse block\n" , + ret); + goto exit; + } -switch (ret) { -case 0 : - ret = test_ops.test (); -if (ret ==0 ) -break ; + ret = test_ops.test (); +if (ret <0 ) {RTE_LOG (ERR ,USER1 ,"Error %i: test block\n" , ret); -break ; -case 1 : -break ; -default : -RTE_LOG (ERR ,USER1 ,"Error %i: Parse block\n" , - ret); + goto exit; } -return 0 ; + +exit: +return ret; } static int
@@ -1958,8 +1954,8 @@ fips_test_one_test_group(void) tests_size =json_array_size (tests);for (test_idx =0 ; test_idx < tests_size; test_idx++) { json_info.json_test_case =json_array_get (tests, test_idx); -fips_test_one_test_case (); -json_array_append_new (write_tests, json_info.json_write_case); +if (fips_test_one_test_case () >0 ) +json_array_append_new (write_tests, json_info.json_write_case); }return 0 ;
Signature · 1 line
2.25.1
PATCH 1/1 examples/fips_validation: cleanup bypass tests in response file
Remove garbage entries for bypassed tests in response file.
--- examples/fips_validation/main.c | 74 ++++++++++++++++----------------- 1 file changed, 35 insertions(+), 39 deletions(-)
examples/fips_validation/main.c +35 -39
@@ -805,7 +805,7 @@ prepare_aes_xform(struct rte_crypto_sym_xform *xform)RTE_LOG (ERR ,USER1 ,"PMD %s key length %u IV length %u\n" , info.device_name, cipher_xform->key.length, cipher_xform->iv.length); -return -EPERM ; +return -ENOTSUP ; }return 0 ;
@@ -853,7 +853,7 @@ prepare_tdes_xform(struct rte_crypto_sym_xform *xform)RTE_LOG (ERR ,USER1 ,"PMD %s key length %u IV length %u\n" , info.device_name, cipher_xform->key.length, cipher_xform->iv.length); -return -EPERM ; +return -ENOTSUP ; }return 0 ;
@@ -890,7 +890,7 @@ prepare_hmac_xform(struct rte_crypto_sym_xform *xform)RTE_LOG (ERR ,USER1 ,"PMD %s key length %u IV length %u\n" , info.device_name, auth_xform->key.length, auth_xform->digest_length); -return -EPERM ; +return -ENOTSUP ; }return 0 ;
@@ -936,7 +936,7 @@ prepare_gcm_xform(struct rte_crypto_sym_xform *xform) aead_xform->digest_length, aead_xform->aad_length, aead_xform->iv.length); -return -EPERM ; +return -ENOTSUP ; }return 0 ;
@@ -981,7 +981,7 @@ prepare_gmac_xform(struct rte_crypto_sym_xform *xform) info.device_name, auth_xform->key.length, auth_xform->digest_length, auth_xform->iv.length); -return -EPERM ; +return -ENOTSUP ; }return 0 ;
@@ -1019,7 +1019,7 @@ prepare_cmac_xform(struct rte_crypto_sym_xform *xform)RTE_LOG (ERR ,USER1 ,"PMD %s key length %u IV length %u\n" , info.device_name, auth_xform->key.length, auth_xform->digest_length); -return -EPERM ; +return -ENOTSUP ; }return 0 ;
@@ -1065,7 +1065,7 @@ prepare_ccm_xform(struct rte_crypto_sym_xform *xform) aead_xform->digest_length, aead_xform->aad_length, aead_xform->iv.length); -return -EPERM ; +return -ENOTSUP ; }return 0 ;
@@ -1100,7 +1100,7 @@ prepare_sha_xform(struct rte_crypto_sym_xform *xform)RTE_LOG (ERR ,USER1 ,"PMD %s key length %u digest length %u\n" , info.device_name, auth_xform->key.length, auth_xform->digest_length); -return -EPERM ; +return -ENOTSUP ; }return 0 ;
@@ -1140,7 +1140,7 @@ prepare_xts_xform(struct rte_crypto_sym_xform *xform)RTE_LOG (ERR ,USER1 ,"PMD %s key length %u IV length %u\n" , info.device_name, cipher_xform->key.length, cipher_xform->iv.length); -return -EPERM ; +return -ENOTSUP ; }return 0 ;
@@ -1255,7 +1255,7 @@ fips_generic_test(void) ret =fips_run_test ();if (ret <0 ) { -if (ret == -EPERM || ret == -ENOTSUP ) { +if (ret == -ENOTSUP ) {fprintf (info.fp_wr,"Bypass\n\n" );return 0 ; }
@@ -1290,7 +1290,7 @@ fips_generic_test(void)fprintf (info.fp_wr,"\n" );free (val.val); -return 0 ; +return 1 ; } static int
@@ -1459,7 +1459,7 @@ fips_mct_tdes_test(void)free (val.val); -return 0 ; +return 1 ; } static int
@@ -1538,7 +1538,7 @@ fips_mct_aes_ecb_test(void)free (val.val); -return 0 ; +return 1 ; }static int fips_mct_aes_test (void )
@@ -1646,7 +1646,7 @@ fips_mct_aes_test(void)free (val.val); -return 0 ; +return 1 ; } static int
@@ -1732,7 +1732,7 @@ fips_mct_sha_test(void)free (val.val); -return 0 ; +return 1 ; }
@@ -1847,18 +1847,15 @@ fips_test_one_file(void) } ret =fips_test_parse_one_case (); -switch (ret) { -case 0 : - ret = test_ops.test (); -if (ret ==0 ) -break ; -RTE_LOG (ERR ,USER1 ,"Error %i: test block\n" , +if (ret <0 ) { +RTE_LOG (ERR ,USER1 ,"Error %i: Parse block\n" , ret); goto error_one_case; -case 1 : -break ; -default : -RTE_LOG (ERR ,USER1 ,"Error %i: Parse block\n" , + } + + ret = test_ops.test (); +if (ret <0 ) { +RTE_LOG (ERR ,USER1 ,"Error %i: test block\n" , ret); goto error_one_case; }
@@ -1908,22 +1905,21 @@ fips_test_one_test_case(void)int ret; ret =fips_test_parse_one_json_case (); +if (ret <0 ) { +RTE_LOG (ERR ,USER1 ,"Error %i: Parse block\n" , + ret); + goto exit; + } -switch (ret) { -case 0 : - ret = test_ops.test (); -if (ret ==0 ) -break ; + ret = test_ops.test (); +if (ret <0 ) {RTE_LOG (ERR ,USER1 ,"Error %i: test block\n" , ret); -break ; -case 1 : -break ; -default : -RTE_LOG (ERR ,USER1 ,"Error %i: Parse block\n" , - ret); + goto exit; } -return 0 ; + +exit: +return ret; } static int
@@ -1968,8 +1964,8 @@ fips_test_one_test_group(void) tests_size =json_array_size (tests);for (test_idx =0 ; test_idx < tests_size; test_idx++) { json_info.json_test_case =json_array_get (tests, test_idx); -fips_test_one_test_case (); -json_array_append_new (write_tests, json_info.json_write_case); +if (fips_test_one_test_case () >0 ) +json_array_append_new (write_tests, json_info.json_write_case); }return 0 ;
Signature · 1 line
2.25.1
PATCH 1/1 examples/fips_validation: cleanup bypass tests in response file
Remove garbage entries for bypassed tests in response file.
---
Depends-on: series-22738 ("Add JSON vector set support to fips validation")
--- examples/fips_validation/main.c | 74 ++++++++++++++++----------------- 1 file changed, 35 insertions(+), 39 deletions(-)
examples/fips_validation/main.c +35 -39
@@ -805,7 +805,7 @@ prepare_aes_xform(struct rte_crypto_sym_xform *xform)RTE_LOG (ERR ,USER1 ,"PMD %s key length %u IV length %u\n" , info.device_name, cipher_xform->key.length, cipher_xform->iv.length); -return -EPERM ; +return -ENOTSUP ; }return 0 ;
@@ -853,7 +853,7 @@ prepare_tdes_xform(struct rte_crypto_sym_xform *xform)RTE_LOG (ERR ,USER1 ,"PMD %s key length %u IV length %u\n" , info.device_name, cipher_xform->key.length, cipher_xform->iv.length); -return -EPERM ; +return -ENOTSUP ; }return 0 ;
@@ -890,7 +890,7 @@ prepare_hmac_xform(struct rte_crypto_sym_xform *xform)RTE_LOG (ERR ,USER1 ,"PMD %s key length %u IV length %u\n" , info.device_name, auth_xform->key.length, auth_xform->digest_length); -return -EPERM ; +return -ENOTSUP ; }return 0 ;
@@ -936,7 +936,7 @@ prepare_gcm_xform(struct rte_crypto_sym_xform *xform) aead_xform->digest_length, aead_xform->aad_length, aead_xform->iv.length); -return -EPERM ; +return -ENOTSUP ; }return 0 ;
@@ -981,7 +981,7 @@ prepare_gmac_xform(struct rte_crypto_sym_xform *xform) info.device_name, auth_xform->key.length, auth_xform->digest_length, auth_xform->iv.length); -return -EPERM ; +return -ENOTSUP ; }return 0 ;
@@ -1019,7 +1019,7 @@ prepare_cmac_xform(struct rte_crypto_sym_xform *xform)RTE_LOG (ERR ,USER1 ,"PMD %s key length %u IV length %u\n" , info.device_name, auth_xform->key.length, auth_xform->digest_length); -return -EPERM ; +return -ENOTSUP ; }return 0 ;
@@ -1065,7 +1065,7 @@ prepare_ccm_xform(struct rte_crypto_sym_xform *xform) aead_xform->digest_length, aead_xform->aad_length, aead_xform->iv.length); -return -EPERM ; +return -ENOTSUP ; }return 0 ;
@@ -1100,7 +1100,7 @@ prepare_sha_xform(struct rte_crypto_sym_xform *xform)RTE_LOG (ERR ,USER1 ,"PMD %s key length %u digest length %u\n" , info.device_name, auth_xform->key.length, auth_xform->digest_length); -return -EPERM ; +return -ENOTSUP ; }return 0 ;
@@ -1140,7 +1140,7 @@ prepare_xts_xform(struct rte_crypto_sym_xform *xform)RTE_LOG (ERR ,USER1 ,"PMD %s key length %u IV length %u\n" , info.device_name, cipher_xform->key.length, cipher_xform->iv.length); -return -EPERM ; +return -ENOTSUP ; }return 0 ;
@@ -1255,7 +1255,7 @@ fips_generic_test(void) ret =fips_run_test ();if (ret <0 ) { -if (ret == -EPERM || ret == -ENOTSUP ) { +if (ret == -ENOTSUP ) {fprintf (info.fp_wr,"Bypass\n\n" );return 0 ; }
@@ -1290,7 +1290,7 @@ fips_generic_test(void)fprintf (info.fp_wr,"\n" );free (val.val); -return 0 ; +return 1 ; } static int
@@ -1459,7 +1459,7 @@ fips_mct_tdes_test(void)free (val.val); -return 0 ; +return 1 ; } static int
@@ -1538,7 +1538,7 @@ fips_mct_aes_ecb_test(void)free (val.val); -return 0 ; +return 1 ; }static int fips_mct_aes_test (void )
@@ -1646,7 +1646,7 @@ fips_mct_aes_test(void)free (val.val); -return 0 ; +return 1 ; } static int
@@ -1732,7 +1732,7 @@ fips_mct_sha_test(void)free (val.val); -return 0 ; +return 1 ; }
@@ -1847,18 +1847,15 @@ fips_test_one_file(void) } ret =fips_test_parse_one_case (); -switch (ret) { -case 0 : - ret = test_ops.test (); -if (ret ==0 ) -break ; -RTE_LOG (ERR ,USER1 ,"Error %i: test block\n" , +if (ret <0 ) { +RTE_LOG (ERR ,USER1 ,"Error %i: Parse block\n" , ret); goto error_one_case; -case 1 : -break ; -default : -RTE_LOG (ERR ,USER1 ,"Error %i: Parse block\n" , + } + + ret = test_ops.test (); +if (ret <0 ) { +RTE_LOG (ERR ,USER1 ,"Error %i: test block\n" , ret); goto error_one_case; }
@@ -1908,22 +1905,21 @@ fips_test_one_test_case(void)int ret; ret =fips_test_parse_one_json_case (); +if (ret <0 ) { +RTE_LOG (ERR ,USER1 ,"Error %i: Parse block\n" , + ret); + goto exit; + } -switch (ret) { -case 0 : - ret = test_ops.test (); -if (ret ==0 ) -break ; + ret = test_ops.test (); +if (ret <0 ) {RTE_LOG (ERR ,USER1 ,"Error %i: test block\n" , ret); -break ; -case 1 : -break ; -default : -RTE_LOG (ERR ,USER1 ,"Error %i: Parse block\n" , - ret); + goto exit; } -return 0 ; + +exit: +return ret; } static int
@@ -1968,8 +1964,8 @@ fips_test_one_test_group(void) tests_size =json_array_size (tests);for (test_idx =0 ; test_idx < tests_size; test_idx++) { json_info.json_test_case =json_array_get (tests, test_idx); -fips_test_one_test_case (); -json_array_append_new (write_tests, json_info.json_write_case); +if (fips_test_one_test_case () >0 ) +json_array_append_new (write_tests, json_info.json_write_case); }return 0 ;
Signature · 1 line
2.25.1
PATCH v2 1/1 examples/fips_validation: reset IV generation in every test group
In reply to Gowrishankar MuthukrishnanReset IV generation in every test group.
---
v2:
- rebase on latest main.
--- examples/fips_validation/fips_validation_gcm.c | 1 + 1 file changed, 1 insertion(+)
examples/fips_validation/fips_validation_gcm.c +1 -0
@@ -344,6 +344,7 @@ parse_test_gcm_json_init(void) direction_obj =json_object_get (json_info.json_test_group,DIR_JSON_STR ); direction_str =json_string_value (direction_obj); + info.interim_info.gcm_data.gen_iv =0 ;if (strcmp (direction_str,OP_ENC_JSON_STR ) ==0 ) {json_t *ivGen_obj =json_object_get (json_info.json_test_group,IVGEN_JSON_STR );
Signature · 1 line
2.25.1
PATCH 1/1 examples/fips_validation: add parsing for aes_cbc
In reply to Gowrishankar MuthukrishnanAdded function to parse algorithm for AES_CBC test.
--- examples/fips_validation/fips_validation.c | 14 +- examples/fips_validation/fips_validation.h | 1 + .../fips_validation/fips_validation_aes.c | 218 ++++++++++++++++++ examples/fips_validation/main.c | 70 ++++-- 4 files changed, 275 insertions(+), 28 deletions(-)
examples/fips_validation/fips_validation.c +9 -5
@@ -120,7 +120,7 @@ fips_test_parse_header(void)for (i =0 ; i < info.nb_vec_lines; i++) {if (!algo_parsed) { -if (strstr (info.vec[i],"AESVS" )) { +if (strstr (info.vec[i],"AESVS" ) ||strstr (info.vec[i],"AES-CBC" )) { algo_parsed =1 ; info.algo =FIPS_TEST_ALGO_AES ; ret =parse_test_aes_init ();
@@ -456,14 +456,18 @@ fips_test_parse_one_json_vector_set(void)const char *algo_str =json_string_value (algo_obj);/* Vector sets contain the algorithm type, and nothing else we need. */ -if (strstr (algo_str,"AES-GCM" )) +if (strstr (algo_str,"AES-GCM" )) { info.algo =FIPS_TEST_ALGO_AES_GCM ; -if (strstr (algo_str,"HMAC" )) + }else if (strstr (algo_str,"HMAC" )) { info.algo =FIPS_TEST_ALGO_HMAC ; -if (strstr (algo_str,"CMAC" )) + }else if (strstr (algo_str,"CMAC" )) { info.algo =FIPS_TEST_ALGO_AES_CMAC ; -else + }else if (strstr (algo_str,"AES-CBC" )) { + info.algo =FIPS_TEST_ALGO_AES ; + info.interim_info.aes_data.cipher_algo =RTE_CRYPTO_CIPHER_AES_CBC ; + }else {return -EINVAL ; + }return 0 ; }
examples/fips_validation/fips_validation.h +1 -0
@@ -103,6 +103,7 @@ enum fips_aesavs_test_types {AESAVS_TYPE_VARTXT ,AESAVS_TYPE_MMT ,AESAVS_TYPE_MCT , + AESAVS_TYPE_AFT, }; enum fips_tdes_test_types {
examples/fips_validation/fips_validation_aes.c +218 -0
260 lines not on this page · raw message
examples/fips_validation/main.c +47 -23
144 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v2 1/1 examples/fips_validation: add parsing for aes_cbc
Added function to parse algorithm for AES_CBC test.
---
Depends-on: series-22738 ("Add JSON vector set support to fips validation")
v2:
- minor cleanup.
--- examples/fips_validation/fips_validation.c | 8 +- examples/fips_validation/fips_validation.h | 4 + .../fips_validation/fips_validation_aes.c | 223 ++++++++++++++++++ examples/fips_validation/main.c | 73 ++++-- 4 files changed, 281 insertions(+), 27 deletions(-)
examples/fips_validation/fips_validation.c +5 -3
@@ -120,7 +120,7 @@ fips_test_parse_header(void)for (i =0 ; i < info.nb_vec_lines; i++) {if (!algo_parsed) { -if (strstr (info.vec[i],"AESVS" )) { +if (strstr (info.vec[i],"AES" )) { algo_parsed =1 ; info.algo =FIPS_TEST_ALGO_AES ; ret =parse_test_aes_init ();
@@ -458,10 +458,12 @@ fips_test_parse_one_json_vector_set(void)/* Vector sets contain the algorithm type, and nothing else we need. */ if (strstr (algo_str,"AES-GCM" )) info.algo =FIPS_TEST_ALGO_AES_GCM ; -if (strstr (algo_str,"HMAC" )) +else if (strstr (algo_str,"HMAC" )) info.algo =FIPS_TEST_ALGO_HMAC ; -if (strstr (algo_str,"CMAC" )) +else if (strstr (algo_str,"CMAC" )) info.algo =FIPS_TEST_ALGO_AES_CMAC ; +else if (strstr (algo_str,"AES-CBC" )) + info.algo =FIPS_TEST_ALGO_AES ;else return -EINVAL ;
examples/fips_validation/fips_validation.h +4 -0
@@ -103,6 +103,7 @@ enum fips_aesavs_test_types {AESAVS_TYPE_VARTXT ,AESAVS_TYPE_MMT ,AESAVS_TYPE_MCT , + AESAVS_TYPE_AFT, }; enum fips_tdes_test_types {
@@ -263,6 +264,9 @@ parse_test_hmac_json_algorithm(void);int parse_test_cmac_json_init (void ); +int +parse_test_aes_json_init (void ); +int parser_read_cmac_direction_str (const char *key,char *src,struct fips_val *val);#endif /* RTE_HAS_JANSSON */
examples/fips_validation/fips_validation_aes.c +223 -0
247 lines not on this page · raw message
examples/fips_validation/main.c +49 -24
146 lines not on this page · raw message
Signature · 1 line
2.25.1