examples/fips_validation: support self-test only
authorOlivier Matz <olivier.matz@6wind.com>
Tue, 6 Oct 2020 07:41:43 +0000 (09:41 +0200)
committerAkhil Goyal <akhil.goyal@nxp.com>
Wed, 14 Oct 2020 20:22:06 +0000 (22:22 +0200)
Make it possible to pass the self-tests when no req path is set.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
examples/fips_validation/main.c

index 0a1c8b5..ee3a890 100644 (file)
@@ -315,8 +315,21 @@ cryptodev_fips_validate_parse_args(int argc, char **argv)
                }
        }
 
-       if (env.req_path == NULL || env.rsp_path == NULL ||
-                       env.dev_id == UINT32_MAX) {
+       if (env.dev_id == UINT32_MAX) {
+               RTE_LOG(ERR, USER1, "No device specified\n");
+               cryptodev_fips_validate_usage(prgname);
+               return -EINVAL;
+       }
+
+       if ((env.req_path == NULL && env.rsp_path != NULL) ||
+                       (env.req_path != NULL && env.rsp_path == NULL)) {
+               RTE_LOG(ERR, USER1, "Missing req path or rsp path\n");
+               cryptodev_fips_validate_usage(prgname);
+               return -EINVAL;
+       }
+
+       if (env.req_path == NULL && env.self_test == 0) {
+               RTE_LOG(ERR, USER1, "--self-test must be set if req path is missing\n");
                cryptodev_fips_validate_usage(prgname);
                return -EINVAL;
        }
@@ -348,6 +361,11 @@ main(int argc, char *argv[])
                return -1;
        }
 
+       if (env.req_path == NULL || env.rsp_path == NULL) {
+               printf("No request, exit.\n");
+               goto exit;
+       }
+
        if (!env.is_path_folder) {
                printf("Processing file %s... ", env.req_path);