diff options
author | Pauli <paul.dale@oracle.com> | 2020-09-22 09:36:53 +1000 |
---|---|---|
committer | Pauli <paul.dale@oracle.com> | 2020-09-23 15:28:30 +1000 |
commit | 2ff4e15dc2a981a447859558c8de2c96ba804c5b (patch) | |
tree | a3d58430aa50035ca49b64fcf7fcdd4ae4cc8a8e /apps/lib | |
parent | 0ed26fb63c814458e9906a916fe3ce5ca961842f (diff) | |
download | openssl-2ff4e15dc2a981a447859558c8de2c96ba804c5b.tar.gz |
list: add capability to print details about the current DRBGs
This allows a user to confirm that the DRBG their configuration specified is
being used.
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/12931)
Diffstat (limited to 'apps/lib')
-rw-r--r-- | apps/lib/app_params.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/apps/lib/app_params.c b/apps/lib/app_params.c index 3305b1e922..04337cbc83 100644 --- a/apps/lib/app_params.c +++ b/apps/lib/app_params.c @@ -94,3 +94,39 @@ int print_param_types(const char *thing, const OSSL_PARAM *pdefs, int indent) return 1; } +void print_param_value(const OSSL_PARAM *p, int indent) +{ + int64_t i; + uint64_t u; + + printf("%*s%s: ", indent, "", p->key); + switch (p->data_type) { + case OSSL_PARAM_UNSIGNED_INTEGER: + if (OSSL_PARAM_get_uint64(p, &u)) + BIO_printf(bio_out, "%llu\n", (unsigned long long int)u); + else + BIO_printf(bio_out, "error getting value\n"); + break; + case OSSL_PARAM_INTEGER: + if (OSSL_PARAM_get_int64(p, &i)) + BIO_printf(bio_out, "%lld\n", (long long int)i); + else + BIO_printf(bio_out, "error getting value\n"); + break; + case OSSL_PARAM_UTF8_PTR: + BIO_printf(bio_out, "'%s'\n", *(char **)(p->data)); + break; + case OSSL_PARAM_UTF8_STRING: + BIO_printf(bio_out, "'%s'\n", (char *)p->data); + break; + case OSSL_PARAM_OCTET_PTR: + case OSSL_PARAM_OCTET_STRING: + BIO_printf(bio_out, "<%zu bytes>\n", p->data_size); + break; + default: + BIO_printf(bio_out, "unknown type (%u) of %zu bytes\n", + p->data_type, p->data_size); + break; + } +} + |