Fix an ENGINE leak in asn1_item_digest_with_libctx
authorMatt Caswell <matt@openssl.org>
Thu, 30 Jul 2020 14:15:05 +0000 (15:15 +0100)
committerPauli <paul.dale@oracle.com>
Sat, 1 Aug 2020 01:55:34 +0000 (11:55 +1000)
commit0f9fdefeb05768b86f4364a8e976c87ee197638e
treebe53a1820a1e422c38e8eff74ec9dda3d0a4a46d
parent790a1b030ac6f968104e17fe5b721c581ebd1d3e
Fix an ENGINE leak in asn1_item_digest_with_libctx

Commit 6725682d introduced a call to ENGINE_get_digest_engine() into
the function asn1_item_digest_with_libctx() to determine whether there
is an ENGINE registered to handle the specified digest. However that
function increases the ref count on the returned ENGINE object, so it
must be freed.

Fixes #12558

[extended tests]

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/12560)
crypto/asn1/a_digest.c