Re: d2i_TYPE, reuse and libctx/propq

Viktor Dukhovni <[email protected]> Wed, 3 Sep 2025 11:29:11 +1000
Newsgroups gmane.comp.encryption.openssl.user
Message-ID <[email protected]>
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>.

-- 
    Viktor.  🇺🇦 Слава Україні!

-- 
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/aLeZ59x4FicqtoPy%40chardros.imrryr.org.