<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<meta content="text/html; charset=US-ASCII" http-equiv="Content-Type">
<title>
GitLab
</title>
<style>img {
max-width: 100%; height: auto;
}
</style>
</head>
<body>
<div class="content">
<p class="details" style="font-style: italic; color: #777;">
<a href="https://gitlab.com/gstrauss">Glenn Strauss</a> created an issue:
</p>
<div></div>
<p dir="auto">RFE: gnutls_datum_wipe() (similar to private _gnutls_free_key_datum())</p>
<p dir="auto">GnuTLS does not expose _gnutls_free_key_datum().</p>
<p dir="auto">Please consider creating public interfaces for wiping gnutls_datum_t, such as the following:</p>
<pre class="code highlight js-syntax-highlight plaintext" lang="plaintext" v-pre="true"><code><span id="LC1" class="line" lang="plaintext">void</span>
<span id="LC2" class="line" lang="plaintext">gnutls_datum_wipe (gnutls_datum_t * const d)</span>
<span id="LC3" class="line" lang="plaintext">{</span>
<span id="LC4" class="line" lang="plaintext"> if (NULL == d) return;</span>
<span id="LC5" class="line" lang="plaintext"></span>
<span id="LC6" class="line" lang="plaintext"> if (d->data) {</span>
<span id="LC7" class="line" lang="plaintext"> if (d->size)</span>
<span id="LC8" class="line" lang="plaintext"> gnutls_memset(d->data, 0, d->size);</span>
<span id="LC9" class="line" lang="plaintext"> gnutls_free(d->data);</span>
<span id="LC10" class="line" lang="plaintext"> d->data = NULL;</span>
<span id="LC11" class="line" lang="plaintext"> }</span>
<span id="LC12" class="line" lang="plaintext"></span>
<span id="LC13" class="line" lang="plaintext"> d->size = 0;</span>
<span id="LC14" class="line" lang="plaintext">}</span>
<span id="LC15" class="line" lang="plaintext"></span>
<span id="LC16" class="line" lang="plaintext">gnutls_datum_t *</span>
<span id="LC17" class="line" lang="plaintext">gnutls__datum_alloc (void)</span>
<span id="LC18" class="line" lang="plaintext">{</span>
<span id="LC19" class="line" lang="plaintext"> gnutls_datum_t *d = gnutls_malloc(sizeof(gnutls_datum_t));</span>
<span id="LC20" class="line" lang="plaintext"> if (d) {</span>
<span id="LC21" class="line" lang="plaintext"> d->data = NULL;</span>
<span id="LC22" class="line" lang="plaintext"> d->size = 0;</span>
<span id="LC23" class="line" lang="plaintext"> }</span>
<span id="LC24" class="line" lang="plaintext"> return d;</span>
<span id="LC25" class="line" lang="plaintext">}</span>
<span id="LC26" class="line" lang="plaintext"></span>
<span id="LC27" class="line" lang="plaintext">void</span>
<span id="LC28" class="line" lang="plaintext">gnutls_datum_free (gnutls_datum_t * const d)</span>
<span id="LC29" class="line" lang="plaintext">{</span>
<span id="LC30" class="line" lang="plaintext"> if (NULL == d) return;</span>
<span id="LC31" class="line" lang="plaintext"> gnutls_free(d->data);</span>
<span id="LC32" class="line" lang="plaintext"> gnutls_free(d);</span>
<span id="LC33" class="line" lang="plaintext">}</span>
<span id="LC34" class="line" lang="plaintext"></span>
<span id="LC35" class="line" lang="plaintext">void</span>
<span id="LC36" class="line" lang="plaintext">gnutls_datum_wipe_free (gnutls_datum_t * const d)</span>
<span id="LC37" class="line" lang="plaintext">{</span>
<span id="LC38" class="line" lang="plaintext"> if (NULL == d) return;</span>
<span id="LC39" class="line" lang="plaintext"> gnutls_datum_wipe(d);</span>
<span id="LC40" class="line" lang="plaintext"> gnutls_free(d);</span>
<span id="LC41" class="line" lang="plaintext">}</span></code></pre>
</div>
<div class="footer" style="margin-top: 10px;">
<p style="font-size: small; color: #777;">
—
<br>
Reply to this email directly or <a href="https://gitlab.com/gnutls/gnutls/-/issues/1001">view it on GitLab</a>.
<br>
You're receiving this email because of your account on gitlab.com.
If you'd like to receive fewer emails, you can
<a href="https://gitlab.com/-/sent_notifications/b6254c78e62bef63339a6965f27c4b2e/unsubscribe">unsubscribe</a>
from this thread or
adjust your notification settings.
<script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","action":{"@type":"ViewAction","name":"View Issue","url":"https://gitlab.com/gnutls/gnutls/-/issues/1001"}}</script>
</p>
</div>
</body>
</html>