[gnutls-devel] GnuTLS | Use custom free/realloc for GMP to safely delete temporary secrets (!1554)

Read-only notification of GnuTLS library development activities gnutls-devel at lists.gnutls.org
Wed Mar 16 20:05:00 CET 2022




Alexander Sosedkin commented on a discussion on lib/safe-memfuncs.c: https://gitlab.com/gnutls/gnutls/-/merge_requests/1554#note_877545808

> + * @old_size: the size of memory before reallocation
> + * @new_size: the size of memory after reallocation
> + *
> + * This function will operate similarly to realloc(), but will safely
> + * zeroize discarded memory.
> + *
> + **/
> +void *gnutls_realloc_zero(void *data, size_t old_size, size_t new_size)
> +{
> +	void *newptr = NULL;
> +
> +	/* mini-gmp always passes old_size of 0 */
> +	if (old_size == 0) {
> +		newptr = realloc(data, new_size);
> +		if (newptr == NULL)
> +			abort();

Uh, OK, sorry.

-- 
Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/gnutls/-/merge_requests/1554#note_877545808
You're receiving this email because of your account on gitlab.com.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gnupg.org/pipermail/gnutls-devel/attachments/20220316/23209dba/attachment-0001.html>


More information about the Gnutls-devel mailing list