summaryrefslogtreecommitdiffstats
path: root/crypto/store
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2021-05-15 10:27:09 +0100
committerMatt Caswell <matt@openssl.org>2021-05-18 15:30:25 +0100
commit40692ed7c80ae3bb6c92c674fb90a5e15d81052d (patch)
treee21057e3572c5d67325487563e0a940ebc4d0d13 /crypto/store
parent9be5f9a8698b0d902ef1281716eda73a4d8478ed (diff)
Better error messages if there are no encoders/decoders/store loaders
If you don't have the base or default providers loaded and therefore there are no encoders/decoders or store loaders then the error messages can be cryptic. We provide better hints about how to fix the problem. Fixes #13798 Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15306)
Diffstat (limited to 'crypto/store')
-rw-r--r--crypto/store/store_err.c4
-rw-r--r--crypto/store/store_lib.c7
2 files changed, 9 insertions, 2 deletions
diff --git a/crypto/store/store_err.c b/crypto/store/store_err.c
index ab0a2c6cd2..8aa3444693 100644
--- a/crypto/store/store_err.c
+++ b/crypto/store/store_err.c
@@ -1,6 +1,6 @@
/*
* Generated by util/mkerr.pl DO NOT EDIT
- * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -40,6 +40,8 @@ static const ERR_STRING_DATA OSSL_STORE_str_reasons[] = {
"not a public key"},
{ERR_PACK(ERR_LIB_OSSL_STORE, 0, OSSL_STORE_R_NOT_PARAMETERS),
"not parameters"},
+ {ERR_PACK(ERR_LIB_OSSL_STORE, 0, OSSL_STORE_R_NO_LOADERS_FOUND),
+ "no loaders found"},
{ERR_PACK(ERR_LIB_OSSL_STORE, 0, OSSL_STORE_R_PASSPHRASE_CALLBACK_ERROR),
"passphrase callback error"},
{ERR_PACK(ERR_LIB_OSSL_STORE, 0, OSSL_STORE_R_PATH_MUST_BE_ABSOLUTE),
diff --git a/crypto/store/store_lib.c b/crypto/store/store_lib.c
index 158b7be79d..1409f3aef4 100644
--- a/crypto/store/store_lib.c
+++ b/crypto/store/store_lib.c
@@ -144,8 +144,13 @@ OSSL_STORE_open_ex(const char *uri, OSSL_LIB_CTX *libctx, const char *propq,
if (loader != NULL)
OSSL_TRACE1(STORE, "Found loader for scheme %s\n", schemes[i]);
- if (loader_ctx == NULL)
+ if (loader_ctx == NULL) {
+ ERR_raise_data(ERR_LIB_OSSL_STORE, OSSL_STORE_R_NO_LOADERS_FOUND,
+ "No store loaders were found. For standard store "
+ "loaders you need at least one of the default or base "
+ "providers available. Did you forget to load them?");
goto err;
+ }
OSSL_TRACE2(STORE, "Opened %s => %p\n", uri, (void *)loader_ctx);