]> git.ipfire.org Git - thirdparty/openssl.git/commit
Replumbing: re-implement error reporting for providers
authorRichard Levitte <levitte@openssl.org>
Tue, 18 Jun 2019 09:18:31 +0000 (11:18 +0200)
committerRichard Levitte <levitte@openssl.org>
Tue, 2 Jul 2019 15:02:02 +0000 (17:02 +0200)
commit6ebc2f56f04ac2738d3b9bfc732063ad8f51e75d
tree329b14debd30025b8e1bf175c1bd1bb96a5ca346
parent7c95390ef021e18d6b834cea9009d0d26b4642d5
Replumbing: re-implement error reporting for providers

The idea is that providers should only have to report a reason code.
The library code is considered to be libcrypto internal, and are
allocated dynamically and automatically for providers on creation.

We reserve the upper 8 bits of the reason code for internal OpenSSL
use.  This allows our own providers to report errors in form of a
packed number that includes library number, function number and
reason number.

With this, a provider can potentially use any reason number it wants
from 1 to 16777216, although the current error semantics really only
allow 1 to 4095 (because only the lower 12 bits are currently
considered an actual reason code by the ERR subsystem).

A provider can provide a reason string table in form of an array of
ERR_STRING_DATA, with each item containing just the reason code and
the associated string, with the dispatch function numbered
OSSL_FUNC_PROVIDER_GET_REASON_STRINGS matching the type
OSSL_provider_get_reason_strings_fn.
If available, libcrypto will call that function on provider
activation.

Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9174)
crypto/provider_core.c
include/openssl/core_numbers.h