Re: d2i_TYPE, reuse and libctx/propq

Michael Richardson <mcr-SWp7JaYWvAQV+D8aMU/[email protected]> Fri, 05 Sep 2025 14:58:41 -0400
Newsgroups gmane.comp.encryption.openssl.user
Message-ID <[email protected]>
Viktor Dukhovni <[email protected]> wrote:
    > On Tue, Sep 02, 2025 at 07:52:40PM -0400, Michael Richardson wrote:

    >> I think it should instead say:
    >>
    >> If a is not NULL, then the contents of the pointer will be examined.
    >>
    >> If *a is not NULL, then it is assumed that caller has allocated a new TYPE
    >> structure, and it will be used.  This is the "reuse" capability.
    >> Please see BUGS below.
    >> If an error occurs, then the structure will not be used or modified.
    >>
    >> If a is NULL, or *a is NULL, then a new structure will be allocated.
    >> (A NULL libctx and a NULL propq will be provided)
    >> If *a is not NULL, then it will be set to the newly allocated structure.
    >>
    >> When an existing structure is reused, the reused structure is not
    >> completely cleared.  This may results in memory leaks, and reference
    >> count leaks, particularly when errors occur. (See BUGS).
    >> From OpenSSL 3.x onwards, the only supported use for the reuse mechanism
    >> is to allocate the TYPE structure with one of the many _ex() routines,
    >> such that the libctx and propq can be initialized.  No other reuse is
    >> supported.

    > If possible, please open an issue or pull request at
    > <https://github.com/openssl/openssl>.

https://github.com/openssl/openssl/pull/28456
Not sure if I<> is correct annotation for a and *a.

-- 
You received this message because you are subscribed to the Google Groups "openssl-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openssl-users+unsubscribe-MCmKBN63+Bmbup2nOX2J7Q@public.gmane.org
To view this discussion visit https://groups.google.com/a/openssl.org/d/msgid/openssl-users/3669.1757098721%40obiwan.sandelman.ca.
signature.asc (application/pgp-signature, 511 B)
-----BEGIN PGP SIGNATURE-----

iQFFBAEBCgAvFiEEbsyLEzg/qUTA43uogItw+93Q3WUFAmi7MuERHG1jckBzYW5k
ZWxtYW4uY2EACgkQgItw+93Q3WU43Qf/e9l2Z5kkQom4NIcsFTQl3fQtxp6dGebj
Qt6CKkmbfVrHZzSNwdwdfOLh8liuxWled8cwSn1GSVFo3mmbMvVzwC/T078kvSh5
JjSI3Yg2sWVIf2kCw2xzc2UdbQTWCknszMyCMx9vz8ele3UaH9jR0oSjaIgF2j3P
4JGILLuQ4ehXKPEtLblQb4Ihl2jSzLU8PUTpQDyAU1l2/u5hgkOrvchaWnqNrr80
W7vMKsAYkGWnFQu8nBdTILpWKkD80akDxBXfqIwJz0T88koED3EoLmNnjWdvDwCN
7OAgwI8DTWAeQGnW5wJajNDNOzPkame5pOzhNX+SkmJWAINe+puCIA==
=XrL3
-----END PGP SIGNATURE-----