openssl/providers/common
Shane Lontis f75abcc0f0 Fix Use after free when copying cipher ctx
Fixes #10438
issue found by clusterfuzz/ossfuzz

The dest was getting a copy of the src structure which contained a pointer that should point to an offset inside itself - because of the copy it was pointing to the original structure.

The setup for a ctx is mainly done by the initkey method in the PROV_CIPHER_HW structure. Because of this it makes sense that the structure should also contain a copyctx method that is use to resolve any pointers that need to be setup.

A dup_ctx has been added to the cipher_enc tests in evp_test. It does a dup after setup and then frees the original ctx. This detects any floating pointers in the duplicated context that were pointing back to the freed ctx.

Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/10443)
2019-11-18 13:13:05 +10:00
..
ciphers Providers: fix OSSL_FUNC_CIPHER_CIPHER functions 2019-10-11 15:55:36 +02:00
digests Cleanup: move remaining providers/common/include/internal/*.h 2019-10-10 14:12:15 +02:00
include/prov Fix Use after free when copying cipher ctx 2019-11-18 13:13:05 +10:00
build.info Rename providers/common/provlib.c to nid_to_name.c 2019-11-10 05:05:06 +01:00
nid_to_name.c Rename providers/common/provlib.c to nid_to_name.c 2019-11-10 05:05:06 +01:00
provider_err.c Implement provider support for Asym Ciphers 2019-11-14 09:29:46 +00:00
provider_util.c [KDF] Add feedback-mode and CMAC support to KBKDF 2019-10-17 12:45:03 +10:00