summaryrefslogtreecommitdiff
path: root/src/usr.bin/openssl/apps.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/usr.bin/openssl/apps.c')
-rw-r--r--src/usr.bin/openssl/apps.c30
1 files changed, 1 insertions, 29 deletions
diff --git a/src/usr.bin/openssl/apps.c b/src/usr.bin/openssl/apps.c
index f58aa5365f..a04190910d 100644
--- a/src/usr.bin/openssl/apps.c
+++ b/src/usr.bin/openssl/apps.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: apps.c,v 1.68 2024/08/18 20:24:11 tb Exp $ */ 1/* $OpenBSD: apps.c,v 1.69 2024/08/29 17:01:02 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -2156,31 +2156,3 @@ show_cipher(const OBJ_NAME *name, void *arg)
2156 2156
2157 fprintf(stderr, " -%-24s%s", name->name, (++*n % 3 != 0 ? "" : "\n")); 2157 fprintf(stderr, " -%-24s%s", name->name, (++*n % 3 != 0 ? "" : "\n"));
2158} 2158}
2159
2160int
2161pkey_check(BIO *out, EVP_PKEY *pkey, int (check_fn)(EVP_PKEY_CTX *),
2162 const char *desc)
2163{
2164 EVP_PKEY_CTX *ctx;
2165
2166 if ((ctx = EVP_PKEY_CTX_new(pkey, NULL)) == NULL) {
2167 ERR_print_errors(bio_err);
2168 return 0;
2169 }
2170
2171 if (check_fn(ctx) == 1) {
2172 BIO_printf(out, "%s valid\n", desc);
2173 } else {
2174 unsigned long err;
2175
2176 BIO_printf(out, "%s invalid\n", desc);
2177
2178 while ((err = ERR_get_error()) != 0)
2179 BIO_printf(out, "Detailed error: %s\n",
2180 ERR_reason_error_string(err));
2181 }
2182
2183 EVP_PKEY_CTX_free(ctx);
2184
2185 return 1;
2186}