]>
Commit | Line | Data |
---|---|---|
753149d9 | 1 | /* |
33388b44 | 2 | * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. |
753149d9 RL |
3 | * |
4 | * Licensed under the Apache License 2.0 (the "License"). You may not use | |
5 | * this file except in compliance with the License. You can obtain a copy | |
6 | * in the file LICENSE in the source distribution or at | |
7 | * https://www.openssl.org/source/license.html | |
8 | */ | |
9 | ||
41bbba53 | 10 | /* We need to use some deprecated APIs */ |
ad8fc6f6 P |
11 | #define OPENSSL_SUPPRESS_DEPRECATED |
12 | ||
753149d9 RL |
13 | #include <string.h> |
14 | #include <openssl/evp.h> | |
15 | #include <openssl/err.h> | |
b8441adb RL |
16 | #include <openssl/provider.h> |
17 | #include <openssl/safestack.h> | |
55accfd2 | 18 | #include <openssl/kdf.h> |
ece9304c RL |
19 | #include <openssl/encoder.h> |
20 | #include <openssl/decoder.h> | |
dfc0857d | 21 | #include <openssl/core_names.h> |
753149d9 | 22 | #include "apps.h" |
16485a3a | 23 | #include "app_params.h" |
753149d9 RL |
24 | #include "progs.h" |
25 | #include "opt.h" | |
031873fe | 26 | #include "names.h" |
753149d9 | 27 | |
ad623ec0 RL |
28 | static int verbose = 0; |
29 | ||
ad623ec0 RL |
30 | static void legacy_cipher_fn(const EVP_CIPHER *c, |
31 | const char *from, const char *to, void *arg) | |
753149d9 RL |
32 | { |
33 | if (c != NULL) { | |
b8441adb | 34 | BIO_printf(arg, " %s\n", EVP_CIPHER_name(c)); |
753149d9 RL |
35 | } else { |
36 | if (from == NULL) | |
37 | from = "<undefined>"; | |
38 | if (to == NULL) | |
39 | to = "<undefined>"; | |
b8441adb RL |
40 | BIO_printf(arg, " %s => %s\n", from, to); |
41 | } | |
42 | } | |
43 | ||
44 | DEFINE_STACK_OF(EVP_CIPHER) | |
45 | static int cipher_cmp(const EVP_CIPHER * const *a, | |
46 | const EVP_CIPHER * const *b) | |
47 | { | |
031873fe | 48 | int ret = EVP_CIPHER_number(*a) - EVP_CIPHER_number(*b); |
b8441adb RL |
49 | |
50 | if (ret == 0) | |
51 | ret = strcmp(OSSL_PROVIDER_name(EVP_CIPHER_provider(*a)), | |
52 | OSSL_PROVIDER_name(EVP_CIPHER_provider(*b))); | |
53 | ||
54 | return ret; | |
55 | } | |
56 | ||
57 | static void collect_ciphers(EVP_CIPHER *cipher, void *stack) | |
58 | { | |
59 | STACK_OF(EVP_CIPHER) *cipher_stack = stack; | |
60 | ||
d5f85429 RL |
61 | if (sk_EVP_CIPHER_push(cipher_stack, cipher) > 0) |
62 | EVP_CIPHER_up_ref(cipher); | |
b8441adb RL |
63 | } |
64 | ||
65 | static void list_ciphers(void) | |
66 | { | |
67 | STACK_OF(EVP_CIPHER) *ciphers = sk_EVP_CIPHER_new(cipher_cmp); | |
68 | int i; | |
69 | ||
2dee33df P |
70 | if (ciphers == NULL) { |
71 | BIO_printf(bio_err, "ERROR: Memory allocation\n"); | |
72 | return; | |
73 | } | |
b8441adb | 74 | BIO_printf(bio_out, "Legacy:\n"); |
ad623ec0 | 75 | EVP_CIPHER_do_all_sorted(legacy_cipher_fn, bio_out); |
b8441adb RL |
76 | |
77 | BIO_printf(bio_out, "Provided:\n"); | |
031873fe | 78 | EVP_CIPHER_do_all_provided(NULL, collect_ciphers, ciphers); |
b8441adb RL |
79 | sk_EVP_CIPHER_sort(ciphers); |
80 | for (i = 0; i < sk_EVP_CIPHER_num(ciphers); i++) { | |
81 | const EVP_CIPHER *c = sk_EVP_CIPHER_value(ciphers, i); | |
031873fe RL |
82 | STACK_OF(OPENSSL_CSTRING) *names = |
83 | sk_OPENSSL_CSTRING_new(name_cmp); | |
b8441adb | 84 | |
031873fe RL |
85 | EVP_CIPHER_names_do_all(c, collect_names, names); |
86 | ||
87 | BIO_printf(bio_out, " "); | |
88 | print_names(bio_out, names); | |
b8441adb RL |
89 | BIO_printf(bio_out, " @ %s\n", |
90 | OSSL_PROVIDER_name(EVP_CIPHER_provider(c))); | |
031873fe RL |
91 | |
92 | sk_OPENSSL_CSTRING_free(names); | |
93 | ||
ad623ec0 RL |
94 | if (verbose) { |
95 | print_param_types("retrievable algorithm parameters", | |
16485a3a | 96 | EVP_CIPHER_gettable_params(c), 4); |
ad623ec0 | 97 | print_param_types("retrievable operation parameters", |
41f7ecf3 | 98 | EVP_CIPHER_gettable_ctx_params(c), 4); |
ad623ec0 | 99 | print_param_types("settable operation parameters", |
41f7ecf3 | 100 | EVP_CIPHER_settable_ctx_params(c), 4); |
ad623ec0 | 101 | } |
753149d9 | 102 | } |
550f974a | 103 | sk_EVP_CIPHER_pop_free(ciphers, EVP_CIPHER_free); |
753149d9 RL |
104 | } |
105 | ||
106 | static void list_md_fn(const EVP_MD *m, | |
107 | const char *from, const char *to, void *arg) | |
108 | { | |
109 | if (m != NULL) { | |
b8441adb | 110 | BIO_printf(arg, " %s\n", EVP_MD_name(m)); |
753149d9 RL |
111 | } else { |
112 | if (from == NULL) | |
113 | from = "<undefined>"; | |
114 | if (to == NULL) | |
115 | to = "<undefined>"; | |
b8441adb RL |
116 | BIO_printf((BIO *)arg, " %s => %s\n", from, to); |
117 | } | |
118 | } | |
119 | ||
120 | DEFINE_STACK_OF(EVP_MD) | |
121 | static int md_cmp(const EVP_MD * const *a, const EVP_MD * const *b) | |
122 | { | |
031873fe | 123 | int ret = EVP_MD_number(*a) - EVP_MD_number(*b); |
b8441adb RL |
124 | |
125 | if (ret == 0) | |
126 | ret = strcmp(OSSL_PROVIDER_name(EVP_MD_provider(*a)), | |
127 | OSSL_PROVIDER_name(EVP_MD_provider(*b))); | |
128 | ||
129 | return ret; | |
130 | } | |
131 | ||
132 | static void collect_digests(EVP_MD *md, void *stack) | |
133 | { | |
134 | STACK_OF(EVP_MD) *digest_stack = stack; | |
135 | ||
d5f85429 RL |
136 | if (sk_EVP_MD_push(digest_stack, md) > 0) |
137 | EVP_MD_up_ref(md); | |
b8441adb RL |
138 | } |
139 | ||
140 | static void list_digests(void) | |
141 | { | |
142 | STACK_OF(EVP_MD) *digests = sk_EVP_MD_new(md_cmp); | |
143 | int i; | |
144 | ||
2dee33df P |
145 | if (digests == NULL) { |
146 | BIO_printf(bio_err, "ERROR: Memory allocation\n"); | |
147 | return; | |
148 | } | |
b8441adb RL |
149 | BIO_printf(bio_out, "Legacy:\n"); |
150 | EVP_MD_do_all_sorted(list_md_fn, bio_out); | |
151 | ||
152 | BIO_printf(bio_out, "Provided:\n"); | |
031873fe | 153 | EVP_MD_do_all_provided(NULL, collect_digests, digests); |
b8441adb RL |
154 | sk_EVP_MD_sort(digests); |
155 | for (i = 0; i < sk_EVP_MD_num(digests); i++) { | |
ad623ec0 | 156 | const EVP_MD *m = sk_EVP_MD_value(digests, i); |
031873fe RL |
157 | STACK_OF(OPENSSL_CSTRING) *names = |
158 | sk_OPENSSL_CSTRING_new(name_cmp); | |
b8441adb | 159 | |
031873fe RL |
160 | EVP_MD_names_do_all(m, collect_names, names); |
161 | ||
162 | BIO_printf(bio_out, " "); | |
163 | print_names(bio_out, names); | |
b8441adb | 164 | BIO_printf(bio_out, " @ %s\n", |
ad623ec0 | 165 | OSSL_PROVIDER_name(EVP_MD_provider(m))); |
031873fe RL |
166 | |
167 | sk_OPENSSL_CSTRING_free(names); | |
168 | ||
ad623ec0 RL |
169 | if (verbose) { |
170 | print_param_types("retrievable algorithm parameters", | |
16485a3a | 171 | EVP_MD_gettable_params(m), 4); |
ad623ec0 | 172 | print_param_types("retrievable operation parameters", |
e6879a31 | 173 | EVP_MD_gettable_ctx_params(m), 4); |
ad623ec0 | 174 | print_param_types("settable operation parameters", |
e6879a31 | 175 | EVP_MD_settable_ctx_params(m), 4); |
ad623ec0 | 176 | } |
753149d9 | 177 | } |
3fd70262 | 178 | sk_EVP_MD_pop_free(digests, EVP_MD_free); |
753149d9 RL |
179 | } |
180 | ||
467b8e56 RL |
181 | DEFINE_STACK_OF(EVP_MAC) |
182 | static int mac_cmp(const EVP_MAC * const *a, const EVP_MAC * const *b) | |
753149d9 | 183 | { |
031873fe | 184 | int ret = EVP_MAC_number(*a) - EVP_MAC_number(*b); |
467b8e56 RL |
185 | |
186 | if (ret == 0) | |
187 | ret = strcmp(OSSL_PROVIDER_name(EVP_MAC_provider(*a)), | |
188 | OSSL_PROVIDER_name(EVP_MAC_provider(*b))); | |
189 | ||
190 | return ret; | |
191 | } | |
192 | ||
193 | static void collect_macs(EVP_MAC *mac, void *stack) | |
194 | { | |
195 | STACK_OF(EVP_MAC) *mac_stack = stack; | |
196 | ||
d5f85429 RL |
197 | if (sk_EVP_MAC_push(mac_stack, mac) > 0) |
198 | EVP_MAC_up_ref(mac); | |
467b8e56 RL |
199 | } |
200 | ||
201 | static void list_macs(void) | |
202 | { | |
203 | STACK_OF(EVP_MAC) *macs = sk_EVP_MAC_new(mac_cmp); | |
204 | int i; | |
205 | ||
2dee33df P |
206 | if (macs == NULL) { |
207 | BIO_printf(bio_err, "ERROR: Memory allocation\n"); | |
208 | return; | |
209 | } | |
467b8e56 | 210 | BIO_printf(bio_out, "Provided MACs:\n"); |
031873fe | 211 | EVP_MAC_do_all_provided(NULL, collect_macs, macs); |
467b8e56 RL |
212 | sk_EVP_MAC_sort(macs); |
213 | for (i = 0; i < sk_EVP_MAC_num(macs); i++) { | |
214 | const EVP_MAC *m = sk_EVP_MAC_value(macs, i); | |
031873fe RL |
215 | STACK_OF(OPENSSL_CSTRING) *names = |
216 | sk_OPENSSL_CSTRING_new(name_cmp); | |
217 | ||
218 | EVP_MAC_names_do_all(m, collect_names, names); | |
467b8e56 | 219 | |
031873fe RL |
220 | BIO_printf(bio_out, " "); |
221 | print_names(bio_out, names); | |
467b8e56 RL |
222 | BIO_printf(bio_out, " @ %s\n", |
223 | OSSL_PROVIDER_name(EVP_MAC_provider(m))); | |
224 | ||
031873fe RL |
225 | sk_OPENSSL_CSTRING_free(names); |
226 | ||
467b8e56 RL |
227 | if (verbose) { |
228 | print_param_types("retrievable algorithm parameters", | |
16485a3a | 229 | EVP_MAC_gettable_params(m), 4); |
467b8e56 | 230 | print_param_types("retrievable operation parameters", |
41f7ecf3 | 231 | EVP_MAC_gettable_ctx_params(m), 4); |
467b8e56 | 232 | print_param_types("settable operation parameters", |
41f7ecf3 | 233 | EVP_MAC_settable_ctx_params(m), 4); |
467b8e56 | 234 | } |
753149d9 | 235 | } |
467b8e56 | 236 | sk_EVP_MAC_pop_free(macs, EVP_MAC_free); |
753149d9 RL |
237 | } |
238 | ||
55accfd2 P |
239 | /* |
240 | * KDFs and PRFs | |
241 | */ | |
242 | DEFINE_STACK_OF(EVP_KDF) | |
243 | static int kdf_cmp(const EVP_KDF * const *a, const EVP_KDF * const *b) | |
244 | { | |
031873fe | 245 | int ret = EVP_KDF_number(*a) - EVP_KDF_number(*b); |
55accfd2 P |
246 | |
247 | if (ret == 0) | |
248 | ret = strcmp(OSSL_PROVIDER_name(EVP_KDF_provider(*a)), | |
249 | OSSL_PROVIDER_name(EVP_KDF_provider(*b))); | |
250 | ||
251 | return ret; | |
252 | } | |
253 | ||
254 | static void collect_kdfs(EVP_KDF *kdf, void *stack) | |
255 | { | |
256 | STACK_OF(EVP_KDF) *kdf_stack = stack; | |
257 | ||
258 | sk_EVP_KDF_push(kdf_stack, kdf); | |
259 | EVP_KDF_up_ref(kdf); | |
260 | } | |
261 | ||
262 | static void list_kdfs(void) | |
263 | { | |
264 | STACK_OF(EVP_KDF) *kdfs = sk_EVP_KDF_new(kdf_cmp); | |
265 | int i; | |
266 | ||
2dee33df P |
267 | if (kdfs == NULL) { |
268 | BIO_printf(bio_err, "ERROR: Memory allocation\n"); | |
269 | return; | |
270 | } | |
55accfd2 | 271 | BIO_printf(bio_out, "Provided KDFs and PDFs:\n"); |
031873fe | 272 | EVP_KDF_do_all_provided(NULL, collect_kdfs, kdfs); |
55accfd2 P |
273 | sk_EVP_KDF_sort(kdfs); |
274 | for (i = 0; i < sk_EVP_KDF_num(kdfs); i++) { | |
031873fe RL |
275 | const EVP_KDF *k = sk_EVP_KDF_value(kdfs, i); |
276 | STACK_OF(OPENSSL_CSTRING) *names = | |
277 | sk_OPENSSL_CSTRING_new(name_cmp); | |
55accfd2 | 278 | |
031873fe RL |
279 | EVP_KDF_names_do_all(k, collect_names, names); |
280 | ||
281 | BIO_printf(bio_out, " "); | |
282 | print_names(bio_out, names); | |
55accfd2 | 283 | BIO_printf(bio_out, " @ %s\n", |
031873fe RL |
284 | OSSL_PROVIDER_name(EVP_KDF_provider(k))); |
285 | ||
286 | sk_OPENSSL_CSTRING_free(names); | |
55accfd2 P |
287 | |
288 | if (verbose) { | |
289 | print_param_types("retrievable algorithm parameters", | |
031873fe | 290 | EVP_KDF_gettable_params(k), 4); |
55accfd2 | 291 | print_param_types("retrievable operation parameters", |
031873fe | 292 | EVP_KDF_gettable_ctx_params(k), 4); |
55accfd2 | 293 | print_param_types("settable operation parameters", |
031873fe | 294 | EVP_KDF_settable_ctx_params(k), 4); |
55accfd2 P |
295 | } |
296 | } | |
297 | sk_EVP_KDF_pop_free(kdfs, EVP_KDF_free); | |
298 | } | |
299 | ||
2dee33df P |
300 | /* |
301 | * RANDs | |
302 | */ | |
303 | DEFINE_STACK_OF(EVP_RAND) | |
304 | ||
305 | static int rand_cmp(const EVP_RAND * const *a, const EVP_RAND * const *b) | |
306 | { | |
307 | int ret = strcasecmp(EVP_RAND_name(*a), EVP_RAND_name(*b)); | |
308 | ||
309 | if (ret == 0) | |
310 | ret = strcmp(OSSL_PROVIDER_name(EVP_RAND_provider(*a)), | |
311 | OSSL_PROVIDER_name(EVP_RAND_provider(*b))); | |
312 | ||
313 | return ret; | |
314 | } | |
315 | ||
316 | static void collect_rands(EVP_RAND *rand, void *stack) | |
317 | { | |
318 | STACK_OF(EVP_RAND) *rand_stack = stack; | |
319 | ||
320 | sk_EVP_RAND_push(rand_stack, rand); | |
321 | EVP_RAND_up_ref(rand); | |
322 | } | |
323 | ||
324 | static void list_random_generators(void) | |
325 | { | |
326 | STACK_OF(EVP_RAND) *rands = sk_EVP_RAND_new(rand_cmp); | |
327 | int i; | |
328 | ||
329 | if (rands == NULL) { | |
330 | BIO_printf(bio_err, "ERROR: Memory allocation\n"); | |
331 | return; | |
332 | } | |
333 | BIO_printf(bio_out, "Provided RNGs and seed sources:\n"); | |
334 | EVP_RAND_do_all_provided(NULL, collect_rands, rands); | |
335 | sk_EVP_RAND_sort(rands); | |
336 | for (i = 0; i < sk_EVP_RAND_num(rands); i++) { | |
337 | const EVP_RAND *m = sk_EVP_RAND_value(rands, i); | |
338 | ||
339 | BIO_printf(bio_out, " %s", EVP_RAND_name(m)); | |
340 | BIO_printf(bio_out, " @ %s\n", | |
341 | OSSL_PROVIDER_name(EVP_RAND_provider(m))); | |
342 | ||
343 | if (verbose) { | |
344 | print_param_types("retrievable algorithm parameters", | |
345 | EVP_RAND_gettable_params(m), 4); | |
346 | print_param_types("retrievable operation parameters", | |
347 | EVP_RAND_gettable_ctx_params(m), 4); | |
348 | print_param_types("settable operation parameters", | |
349 | EVP_RAND_settable_ctx_params(m), 4); | |
350 | } | |
351 | } | |
352 | sk_EVP_RAND_pop_free(rands, EVP_RAND_free); | |
353 | } | |
354 | ||
dfc0857d | 355 | /* |
ece9304c | 356 | * Encoders |
dfc0857d | 357 | */ |
ece9304c RL |
358 | DEFINE_STACK_OF(OSSL_ENCODER) |
359 | static int encoder_cmp(const OSSL_ENCODER * const *a, | |
360 | const OSSL_ENCODER * const *b) | |
dfc0857d | 361 | { |
ece9304c | 362 | int ret = OSSL_ENCODER_number(*a) - OSSL_ENCODER_number(*b); |
dfc0857d P |
363 | |
364 | if (ret == 0) | |
ece9304c RL |
365 | ret = strcmp(OSSL_PROVIDER_name(OSSL_ENCODER_provider(*a)), |
366 | OSSL_PROVIDER_name(OSSL_ENCODER_provider(*b))); | |
dfc0857d P |
367 | return ret; |
368 | } | |
369 | ||
ece9304c | 370 | static void collect_encoders(OSSL_ENCODER *encoder, void *stack) |
dfc0857d | 371 | { |
ece9304c | 372 | STACK_OF(OSSL_ENCODER) *encoder_stack = stack; |
dfc0857d | 373 | |
ece9304c RL |
374 | sk_OSSL_ENCODER_push(encoder_stack, encoder); |
375 | OSSL_ENCODER_up_ref(encoder); | |
dfc0857d P |
376 | } |
377 | ||
ece9304c | 378 | static void list_encoders(void) |
dfc0857d | 379 | { |
ece9304c | 380 | STACK_OF(OSSL_ENCODER) *encoders; |
dfc0857d P |
381 | int i; |
382 | ||
ece9304c RL |
383 | encoders = sk_OSSL_ENCODER_new(encoder_cmp); |
384 | if (encoders == NULL) { | |
dfc0857d P |
385 | BIO_printf(bio_err, "ERROR: Memory allocation\n"); |
386 | return; | |
387 | } | |
ece9304c RL |
388 | BIO_printf(bio_out, "Provided ENCODERs:\n"); |
389 | OSSL_ENCODER_do_all_provided(NULL, collect_encoders, encoders); | |
390 | sk_OSSL_ENCODER_sort(encoders); | |
dfc0857d | 391 | |
ece9304c RL |
392 | for (i = 0; i < sk_OSSL_ENCODER_num(encoders); i++) { |
393 | OSSL_ENCODER *k = sk_OSSL_ENCODER_value(encoders, i); | |
dfc0857d P |
394 | STACK_OF(OPENSSL_CSTRING) *names = |
395 | sk_OPENSSL_CSTRING_new(name_cmp); | |
396 | ||
ece9304c | 397 | OSSL_ENCODER_names_do_all(k, collect_names, names); |
dfc0857d P |
398 | |
399 | BIO_printf(bio_out, " "); | |
400 | print_names(bio_out, names); | |
401 | BIO_printf(bio_out, " @ %s (%s)\n", | |
ece9304c RL |
402 | OSSL_PROVIDER_name(OSSL_ENCODER_provider(k)), |
403 | OSSL_ENCODER_properties(k)); | |
dfc0857d P |
404 | |
405 | sk_OPENSSL_CSTRING_free(names); | |
406 | ||
407 | if (verbose) { | |
408 | print_param_types("settable operation parameters", | |
ece9304c | 409 | OSSL_ENCODER_settable_ctx_params(k), 4); |
dfc0857d P |
410 | } |
411 | } | |
ece9304c | 412 | sk_OSSL_ENCODER_pop_free(encoders, OSSL_ENCODER_free); |
dfc0857d P |
413 | } |
414 | ||
a3f15e23 | 415 | /* |
ece9304c | 416 | * Decoders |
a3f15e23 | 417 | */ |
ece9304c RL |
418 | DEFINE_STACK_OF(OSSL_DECODER) |
419 | static int decoder_cmp(const OSSL_DECODER * const *a, | |
420 | const OSSL_DECODER * const *b) | |
a3f15e23 | 421 | { |
ece9304c | 422 | int ret = OSSL_DECODER_number(*a) - OSSL_DECODER_number(*b); |
a3f15e23 P |
423 | |
424 | if (ret == 0) | |
ece9304c RL |
425 | ret = strcmp(OSSL_PROVIDER_name(OSSL_DECODER_provider(*a)), |
426 | OSSL_PROVIDER_name(OSSL_DECODER_provider(*b))); | |
a3f15e23 P |
427 | return ret; |
428 | } | |
429 | ||
ece9304c | 430 | static void collect_decoders(OSSL_DECODER *decoder, void *stack) |
a3f15e23 | 431 | { |
ece9304c | 432 | STACK_OF(OSSL_DECODER) *decoder_stack = stack; |
a3f15e23 | 433 | |
ece9304c RL |
434 | sk_OSSL_DECODER_push(decoder_stack, decoder); |
435 | OSSL_DECODER_up_ref(decoder); | |
a3f15e23 P |
436 | } |
437 | ||
ece9304c | 438 | static void list_decoders(void) |
a3f15e23 | 439 | { |
ece9304c | 440 | STACK_OF(OSSL_DECODER) *decoders; |
a3f15e23 P |
441 | int i; |
442 | ||
ece9304c RL |
443 | decoders = sk_OSSL_DECODER_new(decoder_cmp); |
444 | if (decoders == NULL) { | |
a3f15e23 P |
445 | BIO_printf(bio_err, "ERROR: Memory allocation\n"); |
446 | return; | |
447 | } | |
ece9304c RL |
448 | BIO_printf(bio_out, "Provided DECODERs:\n"); |
449 | OSSL_DECODER_do_all_provided(NULL, collect_decoders, | |
450 | decoders); | |
451 | sk_OSSL_DECODER_sort(decoders); | |
a3f15e23 | 452 | |
ece9304c RL |
453 | for (i = 0; i < sk_OSSL_DECODER_num(decoders); i++) { |
454 | OSSL_DECODER *k = sk_OSSL_DECODER_value(decoders, i); | |
a3f15e23 P |
455 | STACK_OF(OPENSSL_CSTRING) *names = |
456 | sk_OPENSSL_CSTRING_new(name_cmp); | |
457 | ||
ece9304c | 458 | OSSL_DECODER_names_do_all(k, collect_names, names); |
a3f15e23 P |
459 | |
460 | BIO_printf(bio_out, " "); | |
461 | print_names(bio_out, names); | |
462 | BIO_printf(bio_out, " @ %s (%s)\n", | |
ece9304c RL |
463 | OSSL_PROVIDER_name(OSSL_DECODER_provider(k)), |
464 | OSSL_DECODER_properties(k)); | |
a3f15e23 P |
465 | |
466 | sk_OPENSSL_CSTRING_free(names); | |
467 | ||
468 | if (verbose) { | |
469 | print_param_types("settable operation parameters", | |
ece9304c | 470 | OSSL_DECODER_settable_ctx_params(k), 4); |
a3f15e23 P |
471 | } |
472 | } | |
ece9304c | 473 | sk_OSSL_DECODER_pop_free(decoders, OSSL_DECODER_free); |
a3f15e23 P |
474 | } |
475 | ||
753149d9 RL |
476 | static void list_missing_help(void) |
477 | { | |
478 | const FUNCTION *fp; | |
479 | const OPTIONS *o; | |
480 | ||
481 | for (fp = functions; fp->name != NULL; fp++) { | |
482 | if ((o = fp->help) != NULL) { | |
483 | /* If there is help, list what flags are not documented. */ | |
484 | for ( ; o->name != NULL; o++) { | |
485 | if (o->helpstr == NULL) | |
486 | BIO_printf(bio_out, "%s %s\n", fp->name, o->name); | |
487 | } | |
488 | } else if (fp->func != dgst_main) { | |
489 | /* If not aliased to the dgst command, */ | |
490 | BIO_printf(bio_out, "%s *\n", fp->name); | |
491 | } | |
492 | } | |
493 | } | |
494 | ||
495 | static void list_objects(void) | |
496 | { | |
497 | int max_nid = OBJ_new_nid(0); | |
498 | int i; | |
499 | char *oid_buf = NULL; | |
500 | int oid_size = 0; | |
501 | ||
502 | /* Skip 0, since that's NID_undef */ | |
503 | for (i = 1; i < max_nid; i++) { | |
504 | const ASN1_OBJECT *obj = OBJ_nid2obj(i); | |
505 | const char *sn = OBJ_nid2sn(i); | |
506 | const char *ln = OBJ_nid2ln(i); | |
507 | int n = 0; | |
508 | ||
509 | /* | |
510 | * If one of the retrieved objects somehow generated an error, | |
511 | * we ignore it. The check for NID_undef below will detect the | |
512 | * error and simply skip to the next NID. | |
513 | */ | |
514 | ERR_clear_error(); | |
515 | ||
516 | if (OBJ_obj2nid(obj) == NID_undef) | |
517 | continue; | |
518 | ||
519 | if ((n = OBJ_obj2txt(NULL, 0, obj, 1)) == 0) { | |
520 | BIO_printf(bio_out, "# None-OID object: %s, %s\n", sn, ln); | |
521 | continue; | |
522 | } | |
523 | if (n < 0) | |
524 | break; /* Error */ | |
525 | ||
526 | if (n > oid_size) { | |
527 | oid_buf = OPENSSL_realloc(oid_buf, n + 1); | |
528 | if (oid_buf == NULL) { | |
529 | BIO_printf(bio_err, "ERROR: Memory allocation\n"); | |
530 | break; /* Error */ | |
531 | } | |
532 | oid_size = n + 1; | |
533 | } | |
534 | if (OBJ_obj2txt(oid_buf, oid_size, obj, 1) < 0) | |
535 | break; /* Error */ | |
536 | if (ln == NULL || strcmp(sn, ln) == 0) | |
537 | BIO_printf(bio_out, "%s = %s\n", sn, oid_buf); | |
538 | else | |
539 | BIO_printf(bio_out, "%s = %s, %s\n", sn, ln, oid_buf); | |
540 | } | |
541 | ||
542 | OPENSSL_free(oid_buf); | |
543 | } | |
544 | ||
545 | static void list_options_for_command(const char *command) | |
546 | { | |
547 | const FUNCTION *fp; | |
548 | const OPTIONS *o; | |
549 | ||
550 | for (fp = functions; fp->name != NULL; fp++) | |
551 | if (strcmp(fp->name, command) == 0) | |
552 | break; | |
553 | if (fp->name == NULL) { | |
554 | BIO_printf(bio_err, "Invalid command '%s'; type \"help\" for a list.\n", | |
ece9304c | 555 | command); |
753149d9 RL |
556 | return; |
557 | } | |
558 | ||
559 | if ((o = fp->help) == NULL) | |
560 | return; | |
561 | ||
562 | for ( ; o->name != NULL; o++) { | |
3a4e43de RS |
563 | char c = o->valtype; |
564 | ||
65718c51 RS |
565 | if (o->name == OPT_PARAM_STR) |
566 | break; | |
567 | ||
753149d9 RL |
568 | if (o->name == OPT_HELP_STR |
569 | || o->name == OPT_MORE_STR | |
5388f986 | 570 | || o->name == OPT_SECTION_STR |
753149d9 RL |
571 | || o->name[0] == '\0') |
572 | continue; | |
3a4e43de | 573 | BIO_printf(bio_out, "%s %c\n", o->name, c == '\0' ? '-' : c); |
753149d9 | 574 | } |
833f7c8c RS |
575 | /* Always output the -- marker since it is sometimes documented. */ |
576 | BIO_printf(bio_out, "- -\n"); | |
753149d9 RL |
577 | } |
578 | ||
579 | static void list_type(FUNC_TYPE ft, int one) | |
580 | { | |
581 | FUNCTION *fp; | |
582 | int i = 0; | |
583 | DISPLAY_COLUMNS dc; | |
584 | ||
585 | memset(&dc, 0, sizeof(dc)); | |
586 | if (!one) | |
587 | calculate_columns(functions, &dc); | |
588 | ||
589 | for (fp = functions; fp->name != NULL; fp++) { | |
590 | if (fp->type != ft) | |
591 | continue; | |
592 | if (one) { | |
593 | BIO_printf(bio_out, "%s\n", fp->name); | |
594 | } else { | |
595 | if (i % dc.columns == 0 && i > 0) | |
596 | BIO_printf(bio_out, "\n"); | |
597 | BIO_printf(bio_out, "%-*s", dc.width, fp->name); | |
598 | i++; | |
599 | } | |
600 | } | |
601 | if (!one) | |
602 | BIO_printf(bio_out, "\n\n"); | |
603 | } | |
604 | ||
605 | static void list_pkey(void) | |
606 | { | |
607 | int i; | |
608 | ||
609 | for (i = 0; i < EVP_PKEY_asn1_get_count(); i++) { | |
610 | const EVP_PKEY_ASN1_METHOD *ameth; | |
611 | int pkey_id, pkey_base_id, pkey_flags; | |
612 | const char *pinfo, *pem_str; | |
613 | ameth = EVP_PKEY_asn1_get0(i); | |
614 | EVP_PKEY_asn1_get0_info(&pkey_id, &pkey_base_id, &pkey_flags, | |
615 | &pinfo, &pem_str, ameth); | |
616 | if (pkey_flags & ASN1_PKEY_ALIAS) { | |
617 | BIO_printf(bio_out, "Name: %s\n", OBJ_nid2ln(pkey_id)); | |
618 | BIO_printf(bio_out, "\tAlias for: %s\n", | |
619 | OBJ_nid2ln(pkey_base_id)); | |
620 | } else { | |
621 | BIO_printf(bio_out, "Name: %s\n", pinfo); | |
622 | BIO_printf(bio_out, "\tType: %s Algorithm\n", | |
623 | pkey_flags & ASN1_PKEY_DYNAMIC ? | |
624 | "External" : "Builtin"); | |
625 | BIO_printf(bio_out, "\tOID: %s\n", OBJ_nid2ln(pkey_id)); | |
626 | if (pem_str == NULL) | |
627 | pem_str = "(none)"; | |
628 | BIO_printf(bio_out, "\tPEM string: %s\n", pem_str); | |
629 | } | |
630 | ||
631 | } | |
632 | } | |
633 | ||
41bbba53 | 634 | #ifndef OPENSSL_NO_DEPRECATED_3_0 |
753149d9 RL |
635 | static void list_pkey_meth(void) |
636 | { | |
637 | size_t i; | |
638 | size_t meth_count = EVP_PKEY_meth_get_count(); | |
639 | ||
640 | for (i = 0; i < meth_count; i++) { | |
641 | const EVP_PKEY_METHOD *pmeth = EVP_PKEY_meth_get0(i); | |
642 | int pkey_id, pkey_flags; | |
643 | ||
644 | EVP_PKEY_meth_get0_info(&pkey_id, &pkey_flags, pmeth); | |
645 | BIO_printf(bio_out, "%s\n", OBJ_nid2ln(pkey_id)); | |
646 | BIO_printf(bio_out, "\tType: %s Algorithm\n", | |
647 | pkey_flags & ASN1_PKEY_DYNAMIC ? "External" : "Builtin"); | |
648 | } | |
649 | } | |
41bbba53 | 650 | #endif |
753149d9 | 651 | |
0a684b09 | 652 | #ifndef OPENSSL_NO_DEPRECATED_3_0 |
753149d9 RL |
653 | static void list_engines(void) |
654 | { | |
0a684b09 | 655 | # ifndef OPENSSL_NO_ENGINE |
753149d9 RL |
656 | ENGINE *e; |
657 | ||
658 | BIO_puts(bio_out, "Engines:\n"); | |
659 | e = ENGINE_get_first(); | |
660 | while (e) { | |
661 | BIO_printf(bio_out, "%s\n", ENGINE_get_id(e)); | |
662 | e = ENGINE_get_next(e); | |
663 | } | |
0a684b09 | 664 | # else |
753149d9 | 665 | BIO_puts(bio_out, "Engine support is disabled.\n"); |
0a684b09 | 666 | # endif |
753149d9 | 667 | } |
0a684b09 | 668 | #endif |
753149d9 RL |
669 | |
670 | static void list_disabled(void) | |
671 | { | |
672 | BIO_puts(bio_out, "Disabled algorithms:\n"); | |
673 | #ifdef OPENSSL_NO_ARIA | |
674 | BIO_puts(bio_out, "ARIA\n"); | |
675 | #endif | |
676 | #ifdef OPENSSL_NO_BF | |
677 | BIO_puts(bio_out, "BF\n"); | |
678 | #endif | |
679 | #ifdef OPENSSL_NO_BLAKE2 | |
680 | BIO_puts(bio_out, "BLAKE2\n"); | |
681 | #endif | |
682 | #ifdef OPENSSL_NO_CAMELLIA | |
683 | BIO_puts(bio_out, "CAMELLIA\n"); | |
684 | #endif | |
685 | #ifdef OPENSSL_NO_CAST | |
686 | BIO_puts(bio_out, "CAST\n"); | |
687 | #endif | |
688 | #ifdef OPENSSL_NO_CMAC | |
689 | BIO_puts(bio_out, "CMAC\n"); | |
690 | #endif | |
691 | #ifdef OPENSSL_NO_CMS | |
692 | BIO_puts(bio_out, "CMS\n"); | |
693 | #endif | |
694 | #ifdef OPENSSL_NO_COMP | |
695 | BIO_puts(bio_out, "COMP\n"); | |
696 | #endif | |
697 | #ifdef OPENSSL_NO_DES | |
698 | BIO_puts(bio_out, "DES\n"); | |
699 | #endif | |
700 | #ifdef OPENSSL_NO_DGRAM | |
701 | BIO_puts(bio_out, "DGRAM\n"); | |
702 | #endif | |
703 | #ifdef OPENSSL_NO_DH | |
704 | BIO_puts(bio_out, "DH\n"); | |
705 | #endif | |
706 | #ifdef OPENSSL_NO_DSA | |
707 | BIO_puts(bio_out, "DSA\n"); | |
708 | #endif | |
709 | #if defined(OPENSSL_NO_DTLS) | |
710 | BIO_puts(bio_out, "DTLS\n"); | |
711 | #endif | |
712 | #if defined(OPENSSL_NO_DTLS1) | |
713 | BIO_puts(bio_out, "DTLS1\n"); | |
714 | #endif | |
715 | #if defined(OPENSSL_NO_DTLS1_2) | |
716 | BIO_puts(bio_out, "DTLS1_2\n"); | |
717 | #endif | |
718 | #ifdef OPENSSL_NO_EC | |
719 | BIO_puts(bio_out, "EC\n"); | |
720 | #endif | |
721 | #ifdef OPENSSL_NO_EC2M | |
722 | BIO_puts(bio_out, "EC2M\n"); | |
723 | #endif | |
0a684b09 | 724 | #if defined(OPENSSL_NO_ENGINE) && !defined(OPENSSL_NO_DEPRECATED_3_0) |
753149d9 RL |
725 | BIO_puts(bio_out, "ENGINE\n"); |
726 | #endif | |
727 | #ifdef OPENSSL_NO_GOST | |
728 | BIO_puts(bio_out, "GOST\n"); | |
729 | #endif | |
730 | #ifdef OPENSSL_NO_IDEA | |
731 | BIO_puts(bio_out, "IDEA\n"); | |
732 | #endif | |
733 | #ifdef OPENSSL_NO_MD2 | |
734 | BIO_puts(bio_out, "MD2\n"); | |
735 | #endif | |
736 | #ifdef OPENSSL_NO_MD4 | |
737 | BIO_puts(bio_out, "MD4\n"); | |
738 | #endif | |
739 | #ifdef OPENSSL_NO_MD5 | |
740 | BIO_puts(bio_out, "MD5\n"); | |
741 | #endif | |
742 | #ifdef OPENSSL_NO_MDC2 | |
743 | BIO_puts(bio_out, "MDC2\n"); | |
744 | #endif | |
745 | #ifdef OPENSSL_NO_OCB | |
746 | BIO_puts(bio_out, "OCB\n"); | |
747 | #endif | |
748 | #ifdef OPENSSL_NO_OCSP | |
749 | BIO_puts(bio_out, "OCSP\n"); | |
750 | #endif | |
751 | #ifdef OPENSSL_NO_PSK | |
752 | BIO_puts(bio_out, "PSK\n"); | |
753 | #endif | |
754 | #ifdef OPENSSL_NO_RC2 | |
755 | BIO_puts(bio_out, "RC2\n"); | |
756 | #endif | |
757 | #ifdef OPENSSL_NO_RC4 | |
758 | BIO_puts(bio_out, "RC4\n"); | |
759 | #endif | |
760 | #ifdef OPENSSL_NO_RC5 | |
761 | BIO_puts(bio_out, "RC5\n"); | |
762 | #endif | |
763 | #ifdef OPENSSL_NO_RMD160 | |
764 | BIO_puts(bio_out, "RMD160\n"); | |
765 | #endif | |
766 | #ifdef OPENSSL_NO_RSA | |
767 | BIO_puts(bio_out, "RSA\n"); | |
768 | #endif | |
769 | #ifdef OPENSSL_NO_SCRYPT | |
770 | BIO_puts(bio_out, "SCRYPT\n"); | |
771 | #endif | |
772 | #ifdef OPENSSL_NO_SCTP | |
773 | BIO_puts(bio_out, "SCTP\n"); | |
774 | #endif | |
775 | #ifdef OPENSSL_NO_SEED | |
776 | BIO_puts(bio_out, "SEED\n"); | |
777 | #endif | |
778 | #ifdef OPENSSL_NO_SM2 | |
779 | BIO_puts(bio_out, "SM2\n"); | |
780 | #endif | |
781 | #ifdef OPENSSL_NO_SM3 | |
782 | BIO_puts(bio_out, "SM3\n"); | |
783 | #endif | |
784 | #ifdef OPENSSL_NO_SM4 | |
785 | BIO_puts(bio_out, "SM4\n"); | |
786 | #endif | |
787 | #ifdef OPENSSL_NO_SOCK | |
788 | BIO_puts(bio_out, "SOCK\n"); | |
789 | #endif | |
790 | #ifdef OPENSSL_NO_SRP | |
791 | BIO_puts(bio_out, "SRP\n"); | |
792 | #endif | |
793 | #ifdef OPENSSL_NO_SRTP | |
794 | BIO_puts(bio_out, "SRTP\n"); | |
795 | #endif | |
796 | #ifdef OPENSSL_NO_SSL3 | |
797 | BIO_puts(bio_out, "SSL3\n"); | |
798 | #endif | |
799 | #ifdef OPENSSL_NO_TLS1 | |
800 | BIO_puts(bio_out, "TLS1\n"); | |
801 | #endif | |
802 | #ifdef OPENSSL_NO_TLS1_1 | |
803 | BIO_puts(bio_out, "TLS1_1\n"); | |
804 | #endif | |
805 | #ifdef OPENSSL_NO_TLS1_2 | |
806 | BIO_puts(bio_out, "TLS1_2\n"); | |
807 | #endif | |
808 | #ifdef OPENSSL_NO_WHIRLPOOL | |
809 | BIO_puts(bio_out, "WHIRLPOOL\n"); | |
810 | #endif | |
811 | #ifndef ZLIB | |
812 | BIO_puts(bio_out, "ZLIB\n"); | |
813 | #endif | |
814 | } | |
815 | ||
816 | /* Unified enum for help and list commands. */ | |
817 | typedef enum HELPLIST_CHOICE { | |
ad623ec0 | 818 | OPT_ERR = -1, OPT_EOF = 0, OPT_HELP, OPT_ONE, OPT_VERBOSE, |
753149d9 RL |
819 | OPT_COMMANDS, OPT_DIGEST_COMMANDS, OPT_MAC_ALGORITHMS, OPT_OPTIONS, |
820 | OPT_DIGEST_ALGORITHMS, OPT_CIPHER_COMMANDS, OPT_CIPHER_ALGORITHMS, | |
0a684b09 | 821 | OPT_PK_ALGORITHMS, OPT_PK_METHOD, OPT_DISABLED, |
ece9304c RL |
822 | OPT_KDF_ALGORITHMS, OPT_RANDOM_GENERATORS, OPT_ENCODERS, |
823 | OPT_DECODERS, | |
dfc0857d | 824 | OPT_MISSING_HELP, OPT_OBJECTS, |
0a684b09 P |
825 | #ifndef OPENSSL_NO_DEPRECATED_3_0 |
826 | OPT_ENGINES, | |
827 | #endif | |
6bd4e3f2 | 828 | OPT_PROV_ENUM |
753149d9 RL |
829 | } HELPLIST_CHOICE; |
830 | ||
831 | const OPTIONS list_options[] = { | |
5388f986 RS |
832 | |
833 | OPT_SECTION("General"), | |
753149d9 | 834 | {"help", OPT_HELP, '-', "Display this summary"}, |
5388f986 RS |
835 | |
836 | OPT_SECTION("Output"), | |
753149d9 | 837 | {"1", OPT_ONE, '-', "List in one column"}, |
ad623ec0 | 838 | {"verbose", OPT_VERBOSE, '-', "Verbose listing"}, |
753149d9 | 839 | {"commands", OPT_COMMANDS, '-', "List of standard commands"}, |
d333c311 | 840 | {"standard-commands", OPT_COMMANDS, '-', "List of standard commands"}, |
753149d9 RL |
841 | {"digest-commands", OPT_DIGEST_COMMANDS, '-', |
842 | "List of message digest commands"}, | |
843 | {"digest-algorithms", OPT_DIGEST_ALGORITHMS, '-', | |
844 | "List of message digest algorithms"}, | |
55accfd2 P |
845 | {"kdf-algorithms", OPT_KDF_ALGORITHMS, '-', |
846 | "List of key derivation and pseudo random function algorithms"}, | |
2dee33df | 847 | {"random-generators", OPT_RANDOM_GENERATORS, '-', |
ece9304c | 848 | "List of random number generators"}, |
753149d9 RL |
849 | {"mac-algorithms", OPT_MAC_ALGORITHMS, '-', |
850 | "List of message authentication code algorithms"}, | |
851 | {"cipher-commands", OPT_CIPHER_COMMANDS, '-', "List of cipher commands"}, | |
852 | {"cipher-algorithms", OPT_CIPHER_ALGORITHMS, '-', | |
853 | "List of cipher algorithms"}, | |
ece9304c RL |
854 | {"encoders", OPT_ENCODERS, '-', "List of encoding methods" }, |
855 | {"decoders", OPT_DECODERS, '-', "List of decoding methods" }, | |
753149d9 RL |
856 | {"public-key-algorithms", OPT_PK_ALGORITHMS, '-', |
857 | "List of public key algorithms"}, | |
41bbba53 | 858 | #ifndef OPENSSL_NO_DEPRECATED_3_0 |
753149d9 RL |
859 | {"public-key-methods", OPT_PK_METHOD, '-', |
860 | "List of public key methods"}, | |
861 | {"engines", OPT_ENGINES, '-', | |
862 | "List of loaded engines"}, | |
0a684b09 | 863 | #endif |
dfc0857d | 864 | {"disabled", OPT_DISABLED, '-', "List of disabled features"}, |
753149d9 RL |
865 | {"missing-help", OPT_MISSING_HELP, '-', |
866 | "List missing detailed help strings"}, | |
867 | {"options", OPT_OPTIONS, 's', | |
868 | "List options for specified command"}, | |
869 | {"objects", OPT_OBJECTS, '-', | |
870 | "List built in objects (OID<->name mappings)"}, | |
6bd4e3f2 P |
871 | |
872 | OPT_PROV_OPTIONS, | |
753149d9 RL |
873 | {NULL} |
874 | }; | |
875 | ||
876 | int list_main(int argc, char **argv) | |
877 | { | |
878 | char *prog; | |
879 | HELPLIST_CHOICE o; | |
880 | int one = 0, done = 0; | |
ad623ec0 RL |
881 | struct { |
882 | unsigned int commands:1; | |
2dee33df | 883 | unsigned int random_generators:1; |
ad623ec0 RL |
884 | unsigned int digest_commands:1; |
885 | unsigned int digest_algorithms:1; | |
55accfd2 | 886 | unsigned int kdf_algorithms:1; |
ad623ec0 RL |
887 | unsigned int mac_algorithms:1; |
888 | unsigned int cipher_commands:1; | |
889 | unsigned int cipher_algorithms:1; | |
ece9304c RL |
890 | unsigned int encoder_algorithms:1; |
891 | unsigned int decoder_algorithms:1; | |
ad623ec0 RL |
892 | unsigned int pk_algorithms:1; |
893 | unsigned int pk_method:1; | |
0a684b09 | 894 | #ifndef OPENSSL_NO_DEPRECATED_3_0 |
ad623ec0 | 895 | unsigned int engines:1; |
0a684b09 | 896 | #endif |
ad623ec0 RL |
897 | unsigned int disabled:1; |
898 | unsigned int missing_help:1; | |
899 | unsigned int objects:1; | |
900 | unsigned int options:1; | |
901 | } todo = { 0, }; | |
902 | ||
903 | verbose = 0; /* Clear a possible previous call */ | |
753149d9 RL |
904 | |
905 | prog = opt_init(argc, argv, list_options); | |
906 | while ((o = opt_next()) != OPT_EOF) { | |
907 | switch (o) { | |
908 | case OPT_EOF: /* Never hit, but suppresses warning */ | |
909 | case OPT_ERR: | |
910 | opthelp: | |
911 | BIO_printf(bio_err, "%s: Use -help for summary.\n", prog); | |
912 | return 1; | |
913 | case OPT_HELP: | |
914 | opt_help(list_options); | |
915 | break; | |
916 | case OPT_ONE: | |
917 | one = 1; | |
918 | break; | |
919 | case OPT_COMMANDS: | |
ad623ec0 | 920 | todo.commands = 1; |
753149d9 RL |
921 | break; |
922 | case OPT_DIGEST_COMMANDS: | |
ad623ec0 | 923 | todo.digest_commands = 1; |
753149d9 RL |
924 | break; |
925 | case OPT_DIGEST_ALGORITHMS: | |
ad623ec0 | 926 | todo.digest_algorithms = 1; |
753149d9 | 927 | break; |
55accfd2 P |
928 | case OPT_KDF_ALGORITHMS: |
929 | todo.kdf_algorithms = 1; | |
930 | break; | |
2dee33df P |
931 | case OPT_RANDOM_GENERATORS: |
932 | todo.random_generators = 1; | |
933 | break; | |
753149d9 | 934 | case OPT_MAC_ALGORITHMS: |
ad623ec0 | 935 | todo.mac_algorithms = 1; |
753149d9 RL |
936 | break; |
937 | case OPT_CIPHER_COMMANDS: | |
ad623ec0 | 938 | todo.cipher_commands = 1; |
753149d9 RL |
939 | break; |
940 | case OPT_CIPHER_ALGORITHMS: | |
ad623ec0 | 941 | todo.cipher_algorithms = 1; |
753149d9 | 942 | break; |
ece9304c RL |
943 | case OPT_ENCODERS: |
944 | todo.encoder_algorithms = 1; | |
dfc0857d | 945 | break; |
ece9304c RL |
946 | case OPT_DECODERS: |
947 | todo.decoder_algorithms = 1; | |
a3f15e23 | 948 | break; |
753149d9 | 949 | case OPT_PK_ALGORITHMS: |
ad623ec0 | 950 | todo.pk_algorithms = 1; |
753149d9 RL |
951 | break; |
952 | case OPT_PK_METHOD: | |
ad623ec0 | 953 | todo.pk_method = 1; |
753149d9 | 954 | break; |
0a684b09 | 955 | #ifndef OPENSSL_NO_DEPRECATED_3_0 |
753149d9 | 956 | case OPT_ENGINES: |
ad623ec0 | 957 | todo.engines = 1; |
753149d9 | 958 | break; |
0a684b09 | 959 | #endif |
753149d9 | 960 | case OPT_DISABLED: |
ad623ec0 | 961 | todo.disabled = 1; |
753149d9 RL |
962 | break; |
963 | case OPT_MISSING_HELP: | |
ad623ec0 | 964 | todo.missing_help = 1; |
753149d9 RL |
965 | break; |
966 | case OPT_OBJECTS: | |
ad623ec0 | 967 | todo.objects = 1; |
753149d9 RL |
968 | break; |
969 | case OPT_OPTIONS: | |
970 | list_options_for_command(opt_arg()); | |
971 | break; | |
ad623ec0 RL |
972 | case OPT_VERBOSE: |
973 | verbose = 1; | |
974 | break; | |
6bd4e3f2 P |
975 | case OPT_PROV_CASES: |
976 | if (!opt_provider(o)) | |
977 | return 1; | |
978 | break; | |
753149d9 RL |
979 | } |
980 | done = 1; | |
981 | } | |
982 | if (opt_num_rest() != 0) { | |
983 | BIO_printf(bio_err, "Extra arguments given.\n"); | |
984 | goto opthelp; | |
985 | } | |
986 | ||
ad623ec0 RL |
987 | if (todo.commands) |
988 | list_type(FT_general, one); | |
2dee33df P |
989 | if (todo.random_generators) |
990 | list_random_generators(); | |
ad623ec0 RL |
991 | if (todo.digest_commands) |
992 | list_type(FT_md, one); | |
993 | if (todo.digest_algorithms) | |
994 | list_digests(); | |
55accfd2 P |
995 | if (todo.kdf_algorithms) |
996 | list_kdfs(); | |
ad623ec0 | 997 | if (todo.mac_algorithms) |
467b8e56 | 998 | list_macs(); |
ad623ec0 RL |
999 | if (todo.cipher_commands) |
1000 | list_type(FT_cipher, one); | |
1001 | if (todo.cipher_algorithms) | |
1002 | list_ciphers(); | |
ece9304c RL |
1003 | if (todo.encoder_algorithms) |
1004 | list_encoders(); | |
1005 | if (todo.decoder_algorithms) | |
1006 | list_decoders(); | |
ad623ec0 RL |
1007 | if (todo.pk_algorithms) |
1008 | list_pkey(); | |
41bbba53 | 1009 | #ifndef OPENSSL_NO_DEPRECATED_3_0 |
ad623ec0 RL |
1010 | if (todo.pk_method) |
1011 | list_pkey_meth(); | |
1012 | if (todo.engines) | |
1013 | list_engines(); | |
0a684b09 | 1014 | #endif |
ad623ec0 RL |
1015 | if (todo.disabled) |
1016 | list_disabled(); | |
1017 | if (todo.missing_help) | |
1018 | list_missing_help(); | |
1019 | if (todo.objects) | |
1020 | list_objects(); | |
1021 | ||
753149d9 RL |
1022 | if (!done) |
1023 | goto opthelp; | |
1024 | ||
1025 | return 0; | |
1026 | } |