EVP: Don't call digest_custom() quite so early
authorRichard Levitte <levitte@openssl.org>
Tue, 10 Mar 2020 21:07:10 +0000 (22:07 +0100)
committerRichard Levitte <levitte@openssl.org>
Sun, 15 Mar 2020 18:42:04 +0000 (19:42 +0100)
A huge problem with calling digest_custom() already in the
initialization of DigestSign, DigestVerify etc, is that it force all
callers to know that certain controls must be performed before Init
and the rest after.  This has lead to quite interesting hacks in our
own openssl app, where the SM2 ID had to get special treatment instead
of just being another sign option or verification option among others.

This change moves the call of digest_custom() to the Update and Final
functions, to be done exactly once, subject to a flag that's set in
the Init function.  Seeing to the process of data, through these
operations, this makes no difference at all.  Seeing to making it
possible to perform all controls after the Init call, this makes a
huge difference.

Fixes #11293

Reviewed-by: Paul Yang <kaishen.yy@antfin.com>
(Merged from https://github.com/openssl/openssl/pull/11302)


No differences found