From 3641f04fb06e9679a67da113bab65e5f1bb5e9ba Mon Sep 17 00:00:00 2001 From: Tomas Mraz Date: Fri, 5 Nov 2021 14:14:45 +0100 Subject: [PATCH] doc: Document outcome of multiple digestsign/digestverify calls Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/16964) --- doc/man3/EVP_DigestSignInit.pod | 7 ++++--- doc/man3/EVP_DigestVerifyInit.pod | 9 +++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/doc/man3/EVP_DigestSignInit.pod b/doc/man3/EVP_DigestSignInit.pod index c8385949fb6..228e9d1c5f8 100644 --- a/doc/man3/EVP_DigestSignInit.pod +++ b/doc/man3/EVP_DigestSignInit.pod @@ -167,9 +167,10 @@ The call to EVP_DigestSignFinal() internally finalizes a copy of the digest context. This means that calls to EVP_DigestSignUpdate() and EVP_DigestSignFinal() can be called later to digest and sign additional data. -Since only a copy of the digest context is ever finalized, the context must -be cleaned up after use by calling EVP_MD_CTX_free() or a memory leak -will occur. +EVP_DigestSignInit() and EVP_DigestSignInit_ex() functions can be called +multiple times on a context and the parameters set by previous calls should be +preserved if the I parameter is NULL. The call then just resets the state +of the I. The use of EVP_PKEY_get_size() with these functions is discouraged because some signature operations may have a signature length which depends on the diff --git a/doc/man3/EVP_DigestVerifyInit.pod b/doc/man3/EVP_DigestVerifyInit.pod index 9a02f12e375..398146b5b8e 100644 --- a/doc/man3/EVP_DigestVerifyInit.pod +++ b/doc/man3/EVP_DigestVerifyInit.pod @@ -57,7 +57,7 @@ EVP_MD_CTX is freed). If the EVP_PKEY_CTX to be used is created by EVP_DigestVerifyInit_ex then it will use the B specified in I and the property query string specified in I. -No B will be created by EVP_DigestSignInit_ex() if the +No B will be created by EVP_DigestVerifyInit_ex() if the passed B has already been assigned one via L. See also L. @@ -156,9 +156,10 @@ The call to EVP_DigestVerifyFinal() internally finalizes a copy of the digest context. This means that EVP_VerifyUpdate() and EVP_VerifyFinal() can be called later to digest and verify additional data. -Since only a copy of the digest context is ever finalized, the context must -be cleaned up after use by calling EVP_MD_CTX_free() or a memory leak -will occur. +EVP_DigestVerifyInit() and EVP_DigestVerifyInit_ex() functions can be called +multiple times on a context and the parameters set by previous calls should be +preserved if the I parameter is NULL. The call then just resets the state +of the I. =head1 SEE ALSO -- 2.47.3