decoder memory-management question
D. J. Bernstein
posting-openssl-users at box.cr.yp.to
Fri Mar 1 15:32:55 UTC 2024
It seems that an OSSL_FUNC_DECODER_DECODE function dynamically allocates
space for a key, sets up an OSSL_OBJECT_PARAM_REFERENCE with the address
of a pointer to the key, and passes that to data_cb(), which (typically)
calls an OSSL_FUNC_KEYMGMT_LOAD function to copy that pointer into a
previously allocated key-management object.
After data_cb() returns, the OSSL_FUNC_DECODER_DECODE function passes
the pointer to *_free(), so (to avoid use-after-free, double-free, and
memory leaks) it's critical for the OSSL_FUNC_KEYMGMT_LOAD function to
have set the pointer to 0 (via the supplied address) if and only if it
in fact copied the pointer.
Did I get the memory-management responsibilities straight here? This is
extrapolating from code; I wasn't able to find documentation on point.
---D. J. Bernstein
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://mta.openssl.org/pipermail/openssl-users/attachments/20240301/ab32c649/attachment.sig>
More information about the openssl-users
mailing list