[openssl/openssl] 70fa17: eliminate use of CRYPTO_GET_REF in sslapitest

"'Neil Horman' via openssl-commits" <[email protected]>
Newsgroups gmane.comp.encryption.openssl.cvs
Message-ID <openssl/openssl/push/refs/heads/master/[email protected]>
  Branch: refs/heads/master
  Home:   https://github.com/openssl/openssl
  Commit: 70fa179635fb3daf2e1b1e0d2888f1f8bf79ff16
      https://github.com/openssl/openssl/commit/70fa179635fb3daf2e1b1e0d2888f1f8bf79ff16
  Author: Neil Horman <[email protected]>
  Date:   2026-07-04 (Sat, 04 Jul 2026)

  Changed paths:
    M test/sslapitest.c

  Log Message:
  -----------
  eliminate use of CRYPTO_GET_REF in sslapitest

CRYPTO_GET_REF is almost by definition a TOCTOU race, and we shouldn't
use it.

As part of the effort to deprecate it, eliminate its use from
sslapitest.

Avoid the use-after-free possibility by getting a session with
SSL_get1_session (which increments the refcount) and freeing it after
we're done with it.

Reviewed-by: Kurt Roeckx <[email protected]>
Reviewed-by: Paul Dale <[email protected]>
Reviewed-by: Norbert Pocs <[email protected]>
Reviewed-by: Nikola Pajkovsky <[email protected]>
Reviewed-by: Bob Beck <[email protected]>
MergeDate: Sat Jul  4 16:47:10 2026
(Merged from https://github.com/openssl/openssl/pull/31750)


  Commit: 16be8273addbb7c667e9ff12fdb6bf892c43d161
      https://github.com/openssl/openssl/commit/16be8273addbb7c667e9ff12fdb6bf892c43d161
  Author: Neil Horman <[email protected]>
  Date:   2026-07-04 (Sat, 04 Jul 2026)

  Changed paths:
    M crypto/bio/bio_lib.c

  Log Message:
  -----------
  Replace use of CRYPTO_GET_REF in bio_lib

BIO_free_all makes use of CRYPTO_GET_REF to determine if there is
another user of a BIO chain at some artibrary point within the chain.

But CRYPTO_GET_REF is begging for a TOCTOU error, and so we're
deprecating it.

replace the use of GET_REF with an internal version of BIO_free that
returns the value of the resultant ref count, and use that instead, so
we are TOCTOU free

Reviewed-by: Kurt Roeckx <[email protected]>
Reviewed-by: Paul Dale <[email protected]>
Reviewed-by: Norbert Pocs <[email protected]>
Reviewed-by: Nikola Pajkovsky <[email protected]>
Reviewed-by: Bob Beck <[email protected]>
MergeDate: Sat Jul  4 16:47:13 2026
(Merged from https://github.com/openssl/openssl/pull/31750)


  Commit: 562d2a137a53faac1f2d59e23e3eb458af2edac7
      https://github.com/openssl/openssl/commit/562d2a137a53faac1f2d59e23e3eb458af2edac7
  Author: Neil Horman <[email protected]>
  Date:   2026-07-04 (Sat, 04 Jul 2026)

  Changed paths:
    M include/internal/refcount.h

  Log Message:
  -----------
  Remove CRYPTO_GET_REF

This function should never have existed.  Its a TOCTOU waiting to
happen.  Now that we've eliminated all internal uses, and given that its
an internal function, send it to a nice farm upstate, where it can run
and play with all the other functions that shouldn't have been.

Reviewed-by: Kurt Roeckx <[email protected]>
Reviewed-by: Paul Dale <[email protected]>
Reviewed-by: Norbert Pocs <[email protected]>
Reviewed-by: Nikola Pajkovsky <[email protected]>
Reviewed-by: Bob Beck <[email protected]>
MergeDate: Sat Jul  4 16:47:16 2026
(Merged from https://github.com/openssl/openssl/pull/31750)


Compare: https://github.com/openssl/openssl/compare/f908737d5823...562d2a137a53

To unsubscribe from these emails, change your notification settings at https://github.com/openssl/openssl/settings/notifications

-- 
You received this message because you are subscribed to the Google Groups "openssl-commits" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion visit https://groups.google.com/a/openssl.org/d/msgid/openssl-commits/openssl/openssl/push/refs/heads/master/f90873-562d2a%40github.com.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.