[gnutls-devel] GnuTLS | RFE: gnutls_datum_wipe() (similar to private _gnutls_free_key_datum()) (#1001)

Development of GNU's TLS library gnutls-devel at lists.gnutls.org
Sat May 23 09:40:02 CEST 2020



Glenn Strauss created an issue: https://gitlab.com/gnutls/gnutls/-/issues/1001



RFE: gnutls_datum_wipe() (similar to private _gnutls_free_key_datum())

GnuTLS does not expose _gnutls_free_key_datum().

Please consider creating public interfaces for wiping gnutls_datum_t, such as the following:

```
void
gnutls_datum_wipe (gnutls_datum_t * const d)
{
    if (NULL == d) return;

    if (d->data) {
        if (d->size)
            gnutls_memset(d->data, 0, d->size);
        gnutls_free(d->data);
        d->data = NULL;
    }

    d->size = 0;
}

gnutls_datum_t *
gnutls__datum_alloc (void)
{
    gnutls_datum_t *d = gnutls_malloc(sizeof(gnutls_datum_t));
    if (d) {
        d->data = NULL;
        d->size = 0;
    }
    return d;
}

void
gnutls_datum_free (gnutls_datum_t * const d)
{
    if (NULL == d) return;
    gnutls_free(d->data);
    gnutls_free(d);
}

void
gnutls_datum_wipe_free (gnutls_datum_t * const d)
{
    if (NULL == d) return;
    gnutls_datum_wipe(d);
    gnutls_free(d);
}
```

-- 
Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/gnutls/-/issues/1001
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/20200523/348a5db5/attachment.html>


More information about the Gnutls-devel mailing list