summaryrefslogtreecommitdiff
path: root/crypto/context.c
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2020-10-17 07:07:41 +0200
committerRichard Levitte <levitte@openssl.org>2021-01-12 19:02:11 +0100
commitd6d42cda5fbc05aeaadf8c760db60e9089e3609b (patch)
tree273838dfcbed4ddcd97b287a8db2187508536e13 /crypto/context.c
parent0d11846e4b2850773d1ee0df206608549a7d45d0 (diff)
downloadopenssl-new-d6d42cda5fbc05aeaadf8c760db60e9089e3609b.tar.gz
Use centralized fetching errors
We've spread around FETCH_FAILED errors in quite a few places, and that gives somewhat crude error records, as there's no way to tell if the error was unavailable algorithms or some other error at such high levels. As an alternative, we take recording of these kinds of errors down to the fetching functions, which are in a much better place to tell what kind of error it was, thereby relieving the higher level calls from having to guess. Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/13467)
Diffstat (limited to 'crypto/context.c')
-rw-r--r--crypto/context.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/crypto/context.c b/crypto/context.c
index 4dbfb723e1..c351ff9619 100644
--- a/crypto/context.c
+++ b/crypto/context.c
@@ -368,3 +368,16 @@ int ossl_lib_ctx_onfree(OSSL_LIB_CTX *ctx, ossl_lib_ctx_onfree_fn onfreefn)
return 1;
}
+
+const char *ossl_lib_ctx_get_descriptor(OSSL_LIB_CTX *libctx)
+{
+#ifdef FIPS_MODULE
+ return "FIPS internal library context";
+#else
+ if (ossl_lib_ctx_is_global_default(libctx))
+ return "Global default library context";
+ if (ossl_lib_ctx_is_default(libctx))
+ return "Thread-local default library context";
+ return "Non-default library context";
+#endif
+}