[openssl/openssl] 221d65: evp_md: assert digest is provided for algctx reuse

kaduk noreply at reply.github.openssl.org
Mon May 9 06:50:42 UTC 2022


  Branch: refs/heads/master
  Home:   https://github.openssl.org/openssl/openssl
  Commit: 221d65ba534d23a240ccadd0c2679b222aae35b1
      https://github.openssl.org/openssl/openssl/commit/221d65ba534d23a240ccadd0c2679b222aae35b1
  Author: Benjamin Kaduk <bkaduk at akamai.com>
  Date:   2022-05-08 (Sun, 08 May 2022)

  Changed paths:
    M crypto/evp/digest.c

  Log Message:
  -----------
  evp_md: assert digest is provided for algctx reuse

When reusing an algctx (it was always freed on reinitialization,
prior to #18105), assert that the associated digest is provided.
We implicitly rely on this for algctx reuse to be safe (since
an implicit fetch could potentially change the digest object used,
including provider, which accordingly could change the layout of the
algctx object.

>From code inspection, this is currently always the case -- the only
way to set an algctx requires the provider to be set, and the only
ways to change or remove a provider without destroying the entier
EVP_MD_CTX will also free the algctx.  Adding an assertion will help
ensure that this remains true as the code evolves.

Reviewed-by: Tomas Mraz <tomas at openssl.org>
Reviewed-by: Paul Dale <pauli at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18224)




More information about the openssl-commits mailing list