Maintain strict type discipline between the core and providers
authorMatt Caswell <matt@openssl.org>
Wed, 6 May 2020 11:29:57 +0000 (12:29 +0100)
committerMatt Caswell <matt@openssl.org>
Sat, 16 May 2020 16:10:03 +0000 (17:10 +0100)
commitd40b42ab4c8a88740a2cc2a20c709fe869c4dd1e
tree0dfa4439f3de544d7e52abf56c578e10e5346458
parent827f04d5105e9bec0af214c42b8ad799fba5bb0d
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)
38 files changed:
crypto/initthread.c
crypto/provider_core.c
crypto/serializer/serializer_pkey.c
include/internal/cryptlib.h
include/openssl/bio.h
include/openssl/core.h
include/openssl/core_numbers.h
providers/common/bio_prov.c
providers/common/include/prov/bio.h
providers/common/include/prov/provider_ctx.h
providers/common/include/prov/providercommon.h
providers/common/provider_ctx.c
providers/defltprov.c
providers/fips/fipsprov.c
providers/fips/self_test.c
providers/implementations/serializers/serializer_common.c
providers/implementations/serializers/serializer_dh.c
providers/implementations/serializers/serializer_dh_param.c
providers/implementations/serializers/serializer_dh_priv.c
providers/implementations/serializers/serializer_dh_pub.c
providers/implementations/serializers/serializer_dsa.c
providers/implementations/serializers/serializer_dsa_param.c
providers/implementations/serializers/serializer_dsa_priv.c
providers/implementations/serializers/serializer_dsa_pub.c
providers/implementations/serializers/serializer_ec.c
providers/implementations/serializers/serializer_ec_param.c
providers/implementations/serializers/serializer_ec_priv.c
providers/implementations/serializers/serializer_ec_pub.c
providers/implementations/serializers/serializer_ecx.c
providers/implementations/serializers/serializer_ecx_priv.c
providers/implementations/serializers/serializer_ecx_pub.c
providers/implementations/serializers/serializer_ffc_params.c
providers/implementations/serializers/serializer_rsa.c
providers/implementations/serializers/serializer_rsa_priv.c
providers/implementations/serializers/serializer_rsa_pub.c
providers/legacyprov.c
providers/nullprov.c
test/p_test.c