diff options
author | Richard Levitte <levitte@openssl.org> | 2020-11-04 16:14:00 +0100 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2020-11-13 09:35:31 +0100 |
commit | a150f8e1fcc38752fef4d7c75d765d8efc7d46d6 (patch) | |
tree | f7f62c9a5d8407d8b17820fbef67378aa7b9ddbb /crypto/engine | |
parent | 9311d0c471ca2eaa259e8c1bbbeb7c46394c7ba2 (diff) | |
download | openssl-a150f8e1fcc38752fef4d7c75d765d8efc7d46d6.tar.gz |
CRYPTO: refactor ERR_raise()+ERR_add_error_data() to ERR_raise_data()
This is not done absolutely everywhere, as there are places where
the use of ERR_add_error_data() is quite complex, but at least the
simple cases are done.
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/13318)
Diffstat (limited to 'crypto/engine')
-rw-r--r-- | crypto/engine/eng_cnf.c | 12 | ||||
-rw-r--r-- | crypto/engine/eng_fat.c | 5 | ||||
-rw-r--r-- | crypto/engine/eng_list.c | 3 |
3 files changed, 9 insertions, 11 deletions
diff --git a/crypto/engine/eng_cnf.c b/crypto/engine/eng_cnf.c index 4a14400a04..14744bb7f5 100644 --- a/crypto/engine/eng_cnf.c +++ b/crypto/engine/eng_cnf.c @@ -133,12 +133,12 @@ static int int_engine_configure(const char *name, const char *value, const CONF ret = 1; err: if (ret != 1) { - ERR_raise(ERR_LIB_ENGINE, - ENGINE_R_ENGINE_CONFIGURATION_ERROR); - if (ecmd) - ERR_add_error_data(6, "section=", ecmd->section, - ", name=", ecmd->name, - ", value=", ecmd->value); + if (ecmd == NULL) + ERR_raise(ERR_LIB_ENGINE, ENGINE_R_ENGINE_CONFIGURATION_ERROR); + else + ERR_raise_data(ERR_LIB_ENGINE, ENGINE_R_ENGINE_CONFIGURATION_ERROR, + "section=%s, name=%s, value=%s", + ecmd->section, ecmd->name, ecmd->value); } ENGINE_free(e); return ret; diff --git a/crypto/engine/eng_fat.c b/crypto/engine/eng_fat.c index 7b971678fd..78537057b7 100644 --- a/crypto/engine/eng_fat.c +++ b/crypto/engine/eng_fat.c @@ -85,9 +85,8 @@ int ENGINE_set_default_string(ENGINE *e, const char *def_list) { unsigned int flags = 0; if (!CONF_parse_list(def_list, ',', 1, int_def_cb, &flags)) { - ERR_raise(ERR_LIB_ENGINE, - ENGINE_R_INVALID_STRING); - ERR_add_error_data(2, "str=", def_list); + ERR_raise_data(ERR_LIB_ENGINE, ENGINE_R_INVALID_STRING, + "str=%s", def_list); return 0; } return ENGINE_set_default(e, flags); diff --git a/crypto/engine/eng_list.c b/crypto/engine/eng_list.c index 3008384d3f..de3475fe22 100644 --- a/crypto/engine/eng_list.c +++ b/crypto/engine/eng_list.c @@ -335,8 +335,7 @@ ENGINE *ENGINE_by_id(const char *id) } notfound: ENGINE_free(iterator); - ERR_raise(ERR_LIB_ENGINE, ENGINE_R_NO_SUCH_ENGINE); - ERR_add_error_data(2, "id=", id); + ERR_raise_data(ERR_LIB_ENGINE, ENGINE_R_NO_SUCH_ENGINE, "id=%s", id); return NULL; /* EEK! Experimental code ends */ } |