summaryrefslogtreecommitdiffstats
path: root/apps/lib
diff options
context:
space:
mode:
authorPauli <pauli@openssl.org>2021-07-08 11:22:14 +1000
committerPauli <pauli@openssl.org>2021-07-12 09:13:41 +1000
commit242dfd8a1b93326d200383948a8d57db5ce57de0 (patch)
tree78a8f00fdf180b0bc3a3dba09ac31ddbff63798d /apps/lib
parentac1e85f464568d14962162fe97670a53f11f6bfc (diff)
apps: add query to allow a command to know of a provider command line option was processed
Better fixing: Fixing #15683 Fixing #15686 Replacing rather than fixing: Fixing #15414 Since that claims to fix another: Fixing #15372 Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/16022)
Diffstat (limited to 'apps/lib')
-rw-r--r--apps/lib/app_provider.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/apps/lib/app_provider.c b/apps/lib/app_provider.c
index c3100b2fa8..63f78ae07d 100644
--- a/apps/lib/app_provider.c
+++ b/apps/lib/app_provider.c
@@ -13,6 +13,9 @@
#include <openssl/provider.h>
#include <openssl/safestack.h>
+/* Non-zero if any of the provider options have been seen */
+static int provider_option_given = 0;
+
DEFINE_STACK_OF(OSSL_PROVIDER)
/*
@@ -64,6 +67,9 @@ static int opt_provider_path(const char *path)
int opt_provider(int opt)
{
+ const int given = provider_option_given;
+
+ provider_option_given = 1;
switch ((enum prov_range)opt) {
case OPT_PROV__FIRST:
case OPT_PROV__LAST:
@@ -75,5 +81,12 @@ int opt_provider(int opt)
case OPT_PROV_PROPQUERY:
return app_set_propq(opt_arg());
}
+ /* Should never get here but if we do, undo what we did earlier */
+ provider_option_given = given;
return 0;
}
+
+int opt_provider_option_given(void)
+{
+ return provider_option_given;
+}