Skip to content

Commit 382a34f

Browse files
committed
evp_fetch: add an option to specify the algorithm to fetch in addition to the envvar
Signed-off-by: Eugene Syromiatnikov <[email protected]>
1 parent 22a5d09 commit 382a34f

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

source/evp_fetch.c

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,10 +289,22 @@ void do_fetch(size_t num)
289289
static void
290290
usage(const char *progname)
291291
{
292-
printf("Usage: %s [-t]" PQ_USAGE_OPT " threadcount\n"
292+
printf("Usage: %s [-t] [-f TYPE:ALGORITHM]" PQ_USAGE_OPT " threadcount\n"
293293
"-t - terse output\n"
294-
PQ_USAGE_DESC,
294+
"-f - fetch only the specified algorithm\n"
295+
PQ_USAGE_DESC
296+
"\nEnvironment variables:\n"
297+
" EVP_FETCH_TYPE - if no -f option is provided, fetch only\n"
298+
" the specified TYPE:ALGORITHM\n",
295299
progname);
300+
301+
printf("\nAvailable TYPE:ALGORITHM combinations:\n");
302+
for (size_t i = 0; i < ARRAY_SIZE(fetch_entries); i++) {
303+
const fetch_type_t ft = fetch_entries[i].ftype;
304+
305+
if (ft >= 0 && ft < ARRAY_SIZE(type_map) && type_map[ft] != NULL)
306+
printf(" %s:%s\n", type_map[ft], fetch_entries[i].alg);
307+
}
296308
}
297309

298310
int main(int argc, char *argv[])
@@ -307,11 +319,14 @@ int main(int argc, char *argv[])
307319
char *fetch_type = getenv("EVP_FETCH_TYPE");
308320
int opt;
309321

310-
while ((opt = getopt(argc, argv, "t" PQ_GETOPT)) != -1) {
322+
while ((opt = getopt(argc, argv, "tf:" PQ_GETOPT)) != -1) {
311323
switch (opt) {
312324
case 't':
313325
terse = 1;
314326
break;
327+
case 'f':
328+
fetch_type = optarg;
329+
break;
315330
#ifdef OPENSSL_DO_PQ
316331
case 'q':
317332
pq = 1;

0 commit comments

Comments
 (0)