<!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/smuellerDD">Stephan Mueller</a>
commented on a
discussion on <a href="https://gitlab.com/gnutls/gnutls/-/merge_requests/1404#note_552438883">lib/accelerated/afalg.c</a>:
</p>
<table>
<tr class="line_holder" id="">
<td class="old_line diff-line-num" data-linenumber="512" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #f0f0f0; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#fafafa">
512
</td>
<td class="new_line diff-line-num" data-linenumber="505" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #f0f0f0; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#fafafa">
505
</td>
<td class="line_content" style="padding-left: 0.5em; padding-right: 0.5em;">
<pre style="margin: 0;"> <span id="LC505" class="line" lang="c">            <span class="k" style="font-weight: 600;">goto</span> <span class="n" style="color: #333;">end</span><span class="p">;</span></span>
</pre>
</td>
</tr>
<tr class="line_holder" id="">
<td class="old_line diff-line-num" data-linenumber="513" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #f0f0f0; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#fafafa">
513
</td>
<td class="new_line diff-line-num" data-linenumber="506" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #f0f0f0; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#fafafa">
506
</td>
<td class="line_content" style="padding-left: 0.5em; padding-right: 0.5em;">
<pre style="margin: 0;"> <span id="LC506" class="line" lang="c">    <span class="p">}</span></span>
</pre>
</td>
</tr>
<tr class="line_holder" id="">
<td class="old_line diff-line-num" data-linenumber="514" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #f0f0f0; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#fafafa">
514
</td>
<td class="new_line diff-line-num" data-linenumber="507" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #f0f0f0; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#fafafa">
507
</td>
<td class="line_content" style="padding-left: 0.5em; padding-right: 0.5em;">
<pre style="margin: 0;"> <span id="LC507" class="line" lang="c"></span>
</pre>
</td>
</tr>
<tr class="line_holder old" id="">
<td class="old_line diff-line-num old" data-linenumber="515" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #fac5cd; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#f9d7dc">
515
</td>
<td class="new_line diff-line-num old" data-linenumber="508" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #fac5cd; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#f9d7dc">
 
</td>
<td class="line_content old" style="padding-left: 0.5em; padding-right: 0.5em;" bgcolor="#fbe9eb">
<pre style="margin: 0;">-<span id="LC515" class="line" lang="c">    <span class="cm" style="color: #998; font-style: italic;">/* The kernel may set the AAD, avoid modification of auth */</span></span>
</pre>
</td>
</tr>
<tr class="line_holder old" id="">
<td class="old_line diff-line-num old" data-linenumber="516" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #fac5cd; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#f9d7dc">
516
</td>
<td class="new_line diff-line-num old" data-linenumber="508" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #fac5cd; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#f9d7dc">
 
</td>
<td class="line_content old" style="padding-left: 0.5em; padding-right: 0.5em;" bgcolor="#fbe9eb">
<pre style="margin: 0;">-<span id="LC516" class="line" lang="c">    <span class="n" style="color: #333;">iov</span><span class="p">[</span><span class="mi" style="color: #099;">0</span><span class="p">].</span><span class="n" style="color: #333;">iov_base</span> <span class="o" style="font-weight: 600;">=</span> <span class="n" style="color: #333;">authtmp</span><span class="p">;</span></span>
</pre>
</td>
</tr>
<tr class="line_holder old" id="">
<td class="old_line diff-line-num old" data-linenumber="517" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #fac5cd; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#f9d7dc">
517
</td>
<td class="new_line diff-line-num old" data-linenumber="508" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #fac5cd; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#f9d7dc">
 
</td>
<td class="line_content old" style="padding-left: 0.5em; padding-right: 0.5em;" bgcolor="#fbe9eb">
<pre style="margin: 0;">-<span id="LC517" class="line" lang="c"></span>
</pre>
</td>
</tr>
<tr class="line_holder" id="">
<td class="old_line diff-line-num" data-linenumber="518" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #f0f0f0; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#fafafa">
518
</td>
<td class="new_line diff-line-num" data-linenumber="508" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #f0f0f0; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#fafafa">
508
</td>
<td class="line_content" style="padding-left: 0.5em; padding-right: 0.5em;">
<pre style="margin: 0;"> <span id="LC508" class="line" lang="c">    <span class="cm" style="color: #998; font-style: italic;">/* Set CT buffer to be filled by kernel */</span></span>
</pre>
</td>
</tr>
<tr class="line_holder old" id="">
<td class="old_line diff-line-num old" data-linenumber="519" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #fac5cd; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#f9d7dc">
519
</td>
<td class="new_line diff-line-num old" data-linenumber="509" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #fac5cd; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#f9d7dc">
 
</td>
<td class="line_content old" style="padding-left: 0.5em; padding-right: 0.5em;" bgcolor="#fbe9eb">
<pre style="margin: 0;">-<span id="LC519" class="line" lang="c">    <span class="n" style="color: #333;">iov</span><span class="p">[</span><span class="mi" style="color: #099;"><span class="idiff left right deletion">1</span></span><span class="p">].</span><span class="n" style="color: #333;">iov_base</span> <span class="o" style="font-weight: 600;">=</span> <span class="n" style="color: #333;">encr</span><span class="p">;</span></span>
</pre>
</td>
</tr>
<tr class="line_holder old" id="">
<td class="old_line diff-line-num old" data-linenumber="520" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #fac5cd; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#f9d7dc">
520
</td>
<td class="new_line diff-line-num old" data-linenumber="509" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #fac5cd; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#f9d7dc">
 
</td>
<td class="line_content old" style="padding-left: 0.5em; padding-right: 0.5em;" bgcolor="#fbe9eb">
<pre style="margin: 0;">-<span id="LC520" class="line" lang="c">    <span class="n" style="color: #333;">iov</span><span class="p">[</span><span class="mi" style="color: #099;"><span class="idiff left deletion">1</span></span><span class="p">].</span><span class="n" style="color: #333;">iov_len</span> <span class="o" style="font-weight: 600;">=</span> <span class="n" style="color: #333;"><span class="idiff deletion">plain</span>_size</span> <span class="o" style="font-weight: 600;"><span class="idiff deletion">+</span></span><span class="idiff deletion"> </span><span class="n" style="color: #333;"><span class="idiff right deletion">tag</span>_size</span><span class="p">;</span></span>
</pre>
</td>
</tr>
<tr class="line_holder new" id="">
<td class="old_line diff-line-num new" data-linenumber="521" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #c7f0d2; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#ddfbe6">
 
</td>
<td class="new_line diff-line-num new" data-linenumber="509" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #c7f0d2; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#ddfbe6">
509
</td>
<td class="line_content new" style="padding-left: 0.5em; padding-right: 0.5em;" bgcolor="#ecfdf0">
<pre style="margin: 0;">+<span id="LC509" class="line" lang="c">    <span class="n" style="color: #333;">iov</span><span class="p">[</span><span class="mi" style="color: #099;"><span class="idiff left right addition">0</span></span><span class="p">].</span><span class="n" style="color: #333;">iov_base</span> <span class="o" style="font-weight: 600;">=</span> <span class="n" style="color: #333;">encr</span><span class="p">;</span></span>
</pre>
</td>
</tr>
<tr class="line_holder new" id="">
<td class="old_line diff-line-num new" data-linenumber="521" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #c7f0d2; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#ddfbe6">
 
</td>
<td class="new_line diff-line-num new" data-linenumber="510" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #c7f0d2; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#ddfbe6">
510
</td>
<td class="line_content new" style="padding-left: 0.5em; padding-right: 0.5em;" bgcolor="#ecfdf0">
<pre style="margin: 0;">+<span id="LC510" class="line" lang="c">    <span class="n" style="color: #333;">iov</span><span class="p">[</span><span class="mi" style="color: #099;"><span class="idiff left addition">0</span></span><span class="p">].</span><span class="n" style="color: #333;">iov_len</span> <span class="o" style="font-weight: 600;">=</span> <span class="p"><span class="idiff addition">(</span></span><span class="n" style="color: #333;"><span class="idiff addition">encr</span>_size</span> <span class="o" style="font-weight: 600;"><span class="idiff addition">></span></span><span class="idiff addition"> </span><span class="n" style="color: #333;"><span class="idiff addition">outbuflen</span></span><span class="p"><span class="idiff addition">)</span></span><span class="idiff addition"> </span><span class="o" style="font-weight: 600;"><span class="idiff addition">?</span></span><span class="idiff addition"> </span><span class="n" style="color: #333;"><span class="idiff addition">outbuflen</span></span><span class="idiff addition"> </span><span class="o" style="font-weight: 600;"><span class="idiff addition">:</span></span><span class="idiff addition"> </span><span class="n" style="color: #333;"><span class="idiff right addition">encr</span>_size</span><span class="p">;</span></span>
</pre>
</td>
</tr>
<tr class="line_holder" id="">
<td class="old_line diff-line-num" data-linenumber="521" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #f0f0f0; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#fafafa">
521
</td>
<td class="new_line diff-line-num" data-linenumber="511" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #f0f0f0; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#fafafa">
511
</td>
<td class="line_content" style="padding-left: 0.5em; padding-right: 0.5em;">
<pre style="margin: 0;"> <span id="LC511" class="line" lang="c"></span>
</pre>
</td>
</tr>
<tr class="line_holder old" id="">
<td class="old_line diff-line-num old" data-linenumber="522" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #fac5cd; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#f9d7dc">
522
</td>
<td class="new_line diff-line-num old" data-linenumber="512" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #fac5cd; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#f9d7dc">
 
</td>
<td class="line_content old" style="padding-left: 0.5em; padding-right: 0.5em;" bgcolor="#fbe9eb">
<pre style="margin: 0;">-<span id="LC522" class="line" lang="c">    <span class="k" style="font-weight: 600;">if</span> <span class="p">(</span><span class="n" style="color: #333;">kcapi_aead_stream_op</span><span class="p">(</span><span class="n" style="color: #333;">ctx</span><span class="o" style="font-weight: 600;">-></span><span class="n" style="color: #333;">handle</span><span class="p">,</span> <span class="n" style="color: #333;">iov</span><span class="p">,</span> <span class="mi" style="color: #099;"><span class="idiff left right deletion">2</span></span><span class="p">)</span> <span class="o" style="font-weight: 600;"><</span> <span class="mi" style="color: #099;">0</span><span class="p">)</span> <span class="p">{</span></span>
</pre>
</td>
</tr>
<tr class="line_holder new" id="">
<td class="old_line diff-line-num new" data-linenumber="523" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #c7f0d2; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#ddfbe6">
 
</td>
<td class="new_line diff-line-num new" data-linenumber="512" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #c7f0d2; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#ddfbe6">
512
</td>
<td class="line_content new" style="padding-left: 0.5em; padding-right: 0.5em;" bgcolor="#ecfdf0">
<pre style="margin: 0;">+<span id="LC512" class="line" lang="c">    <span class="k" style="font-weight: 600;">if</span> <span class="p">(</span><span class="n" style="color: #333;">kcapi_aead_stream_op</span><span class="p">(</span><span class="n" style="color: #333;">ctx</span><span class="o" style="font-weight: 600;">-></span><span class="n" style="color: #333;">handle</span><span class="p">,</span> <span class="n" style="color: #333;">iov</span><span class="p">,</span> <span class="mi" style="color: #099;"><span class="idiff left right addition">1</span></span><span class="p">)</span> <span class="o" style="font-weight: 600;"><</span> <span class="mi" style="color: #099;">0</span><span class="p">)</span> <span class="p">{</span></span>
</pre>
</td>
</tr>

</table>
<div style="">
<p dir="auto">Apologies if I am not using gitlab right :-)</p>
<p dir="auto">But, I see that there is one IOVEC with the encryption buffer used for the _op operation. If I see that right, the encr buffer should be as large to hold the ciphertext || tag data. What I am trying to say is that the kernel, however returns the AAD first, followed by the ciphertext || tag. So, If I would understand it right, the encr buffer is filled with AAD concatenated with parts of the CT and potentially the tag depending on the size of the AAD.</p>
</div>


</div>
<div class="footer" style="margin-top: 10px;">
<p style="font-size: small; color: #666;">

<br>
Reply to this email directly or <a href="https://gitlab.com/gnutls/gnutls/-/merge_requests/1404#note_552438883">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/cdb48436622a01ae030221ced1805551/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 Merge request","url":"https://gitlab.com/gnutls/gnutls/-/merge_requests/1404#note_552438883"}}</script>


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