[openssl/openssl] 144d09: speed: Fix memory leak

Ingo Franzki noreply at github.com
Fri Jul 21 00:20:13 UTC 2023


  Branch: refs/heads/openssl-3.0
  Home:   https://github.com/openssl/openssl
  Commit: 144d095e9459cf6223003a8c85035bd8f190d82c
      https://github.com/openssl/openssl/commit/144d095e9459cf6223003a8c85035bd8f190d82c
  Author: Ingo Franzki <ifranzki at linux.ibm.com>
  Date:   2023-07-21 (Fri, 21 Jul 2023)

  Changed paths:

  Log Message:
  -----------
  speed: Fix memory leak

Free the signature stack after iterating over all found signatures.
Free the kem and signature stacks at the end of speed_main() if not
NULL.

Signed-off-by: Ingo Franzki <ifranzki at linux.ibm.com>

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

(cherry picked from commit cc7e2b20de02959c328f96e464e5fb8b256a00e0)


  Commit: 2fb42a7b768d2a6bc3374c7e7ca9ec7332a05d85
      https://github.com/openssl/openssl/commit/2fb42a7b768d2a6bc3374c7e7ca9ec7332a05d85
  Author: Ingo Franzki <ifranzki at linux.ibm.com>
  Date:   2023-07-21 (Fri, 21 Jul 2023)

  Changed paths:
    M apps/speed.c

  Log Message:
  -----------
  speed: Fix execution of EdDSA measurement

Running 'openssl speed eddsa' fails with

Doing 253 bits sign Ed25519 ops for 10s: EdDSA sign failure
000003FF9306C7D0:error:030000BC:digital envelope routines:EVP_DigestSign:
                           final error:crypto/evp/m_sigver.c:585:
-1 253 bits Ed25519 sign ops in 0.00s
Doing 253 bits verify Ed25519 ops for 10s: EdDSA verify failure
000003FF9306C7D0:error:030000BC:digital envelope routines:EVP_DigestVerify:
                           final error:crypto/evp/m_sigver.c:694:
-1 253 bits Ed25519 verify ops in 0.00s

This is because the EVP_DigestSign/Verify() calls in the EdDSA_sign/verify_loop()
fail because the context has already been finalized by the previous
EVP_DigestSign/Verify call during the EdDSA signature test done by speed_main().

This happens since commit 3fc2b7d6b8f961144905330dfd4689f5bd515199 where the
EVP_DigestSign/Verify() functions have been changed to set a flag that the
context has been finalized.

Fix this by re-initializing the context using EVP_DigestSign/Verify() in the
EdDSA_sign/verify_loop().

Signed-off-by: Ingo Franzki <ifranzki at linux.ibm.com>

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

(cherry picked from commit 0c85bcbaeabe3a695831bec44ab87964725a51a6)


Compare: https://github.com/openssl/openssl/compare/099fb2dd95de...2fb42a7b768d


More information about the openssl-commits mailing list