[openssl/openssl] 9559ad: Make DSA_sign() test for negative p,q,g values.

Shane noreply at github.com
Fri Mar 31 19:20:37 UTC 2023


  Branch: refs/heads/master
  Home:   https://github.com/openssl/openssl
  Commit: 9559ad0e8d433a2a212b63cc848fa2ac82a9b048
      https://github.com/openssl/openssl/commit/9559ad0e8d433a2a212b63cc848fa2ac82a9b048
  Author: slontis <shane.lontis at oracle.com>
  Date:   2023-03-31 (Fri, 31 Mar 2023)

  Changed paths:
    M crypto/dsa/dsa_ossl.c
    M crypto/dsa/dsa_sign.c
    M test/dsatest.c

  Log Message:
  -----------
  Make DSA_sign() test for negative p,q,g values.

Related to #20268

DSA_sign() assumes that the signature passed in is related to DSA_size().
If q is negative then DSA_size() actually fails and returns 0.

A test that tries to allocate the signature buffer using DSA_size() and then
pass it to DSA_sign() will then either.

(1) Have a signature buffer of NULL. In this case it was leaking data
returned via i2d_DSA_SIG.

(2) Cause a seg fault because we created a buffer that was not large
enough to hold the signature. As it already checked zero we also now
check for negative values also.

Reviewed-by: Tomas Mraz <tomas at openssl.org>
Reviewed-by: Paul Dale <pauli at openssl.org>
Reviewed-by: Todd Short <todd.short at me.com>
(Merged from https://github.com/openssl/openssl/pull/20553)




More information about the openssl-commits mailing list