diff options
author | Matt Caswell <matt@openssl.org> | 2020-05-06 12:29:57 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2020-05-16 17:10:03 +0100 |
commit | d40b42ab4c8a88740a2cc2a20c709fe869c4dd1e (patch) | |
tree | 0dfa4439f3de544d7e52abf56c578e10e5346458 /test | |
parent | 827f04d5105e9bec0af214c42b8ad799fba5bb0d (diff) | |
download | openssl-d40b42ab4c8a88740a2cc2a20c709fe869c4dd1e.zip openssl-d40b42ab4c8a88740a2cc2a20c709fe869c4dd1e.tar.gz openssl-d40b42ab4c8a88740a2cc2a20c709fe869c4dd1e.tar.bz2 |
Maintain strict type discipline between the core and providers
A provider could be linked against a different version of libcrypto than
the version of libcrypto that loaded the provider. Different versions of
libcrypto could define opaque types differently. It must never occur that
a type created in one libcrypto is used directly by the other libcrypto.
This will cause crashes.
We can "cheat" for "built-in" providers that are part of libcrypto itself,
because we know that the two libcrypto versions are the same - but not for
other providers.
To ensure this does not occur we use different types names for the handful
of opaque types that are passed between the core and providers.
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/11758)
Diffstat (limited to 'test')
-rw-r--r-- | test/p_test.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/test/p_test.c b/test/p_test.c index cecb40e..5a49123 100644 --- a/test/p_test.c +++ b/test/p_test.c @@ -48,9 +48,9 @@ static const OSSL_PARAM *p_gettable_params(void *_) return p_param_types; } -static int p_get_params(void *vprov, OSSL_PARAM params[]) +static int p_get_params(void *vhand, OSSL_PARAM params[]) { - const OSSL_PROVIDER *prov = vprov; + const OSSL_CORE_HANDLE *hand = vhand; OSSL_PARAM *p = params; int ok = 1; @@ -77,7 +77,7 @@ static int p_get_params(void *vprov, OSSL_PARAM params[]) opensslv = provname = greeting = NULL; - if (c_get_params(prov, counter_request)) { + if (c_get_params(hand, counter_request)) { if (greeting) { strcpy(buf, greeting); } else { @@ -119,7 +119,7 @@ static const OSSL_DISPATCH p_test_table[] = { { 0, NULL } }; -int OSSL_provider_init(const OSSL_PROVIDER *provider, +int OSSL_provider_init(const OSSL_CORE_HANDLE *handle, const OSSL_DISPATCH *in, const OSSL_DISPATCH **out, void **provctx) @@ -139,7 +139,7 @@ int OSSL_provider_init(const OSSL_PROVIDER *provider, } /* Because we use this in get_params, we need to pass it back */ - *provctx = (void *)provider; + *provctx = (void *)handle; *out = p_test_table; return 1; |