<!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 style="color: #777777;">
<a href="https://gitlab.com/andrew-aladev">Andrew Aladjev</a>
commented:
</p>
<div style="">
<p dir="auto"><code>lib/nettle/cipher.c</code>:</p>
<pre class="code highlight js-syntax-highlight plaintext" lang="plaintext" v-pre="true"><code><span id="LC1" class="line" lang="plaintext">if (gnutls_memcmp(((uint8_t*)encr)+encr_size, tag, tag_size) != 0) {</span>
<span id="LC2" class="line" lang="plaintext">  fprintf(stderr, "algo: %d\n", ctx->cipher->algo);</span>
<span id="LC3" class="line" lang="plaintext">  return gnutls_assert_val(GNUTLS_E_DECRYPTION_FAILED);</span>
<span id="LC4" class="line" lang="plaintext">}</span></code></pre>
<p dir="auto">This is the place where <code>GNUTLS_E_DECRYPTION_FAILED</code> was born. <code>algo</code> equals <code>11 GNUTLS_CIPHER_AES_256_GCM</code>.</p>
<pre class="code highlight js-syntax-highlight plaintext" lang="plaintext" v-pre="true"><code><span id="LC1" class="line" lang="plaintext">static void</span>
<span id="LC2" class="line" lang="plaintext">_gcm_decrypt(struct nettle_cipher_ctx *ctx, size_t length, uint8_t * dst,</span>
<span id="LC3" class="line" lang="plaintext">                const uint8_t * src)</span>
<span id="LC4" class="line" lang="plaintext">{</span>
<span id="LC5" class="line" lang="plaintext">       gcm_decrypt(GCM_CTX_GET_CTX(ctx->ctx_ptr), GCM_CTX_GET_KEY(ctx->ctx_ptr),</span>
<span id="LC6" class="line" lang="plaintext">                   GCM_CTX_GET_CIPHER(ctx->ctx_ptr), ctx->cipher->encrypt_block,</span>
<span id="LC7" class="line" lang="plaintext">                   length, dst, src);</span>
<span id="LC8" class="line" lang="plaintext">}</span></code></pre>
<p dir="auto">This is the function called as <code>ctx->cipher->decrypt(ctx, encr_size, plain, encr);</code> before <code>gnutls_memcmp</code> in <code>lib/nettle/cipher.c</code>. This function comes from <code>nettle</code> library and it is broken.</p>
</div>


</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/941#note_289743162">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/8803f0c212ddfe8e1bdc8baa0ffb8886/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/941#note_289743162"}}</script>


</p>
</div>
</body>
</html>