<!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/dueno">Daiki Ueno</a>
commented on a
<a href="https://gitlab.com/gnutls/gnutls/-/merge_requests/1465#note_738647227">discussion</a>:
</p>
<div style="">
<p dir="auto">OK, we have <code>GNUTLS_FIPS140_OPERATION_STATE_ERROR</code> for that purpose. So, I'm going to add those calls like:</p>
<pre class="code highlight js-syntax-highlight language-c" lang="c" v-pre="true"><code><span id="LC1" class="line" lang="c"><span class="kt">void</span> <span class="nf">some_crypto_op</span><span class="p">(...)</span> <span class="p">{</span></span>
<span id="LC2" class="line" lang="c"> <span class="kt">int</span> <span class="n">ret</span><span class="p">;</span></span>
<span id="LC3" class="line" lang="c"> <span class="n">bool</span> <span class="n">approved</span> <span class="o">=</span> <span class="nb">true</span><span class="p">;</span></span>
<span id="LC4" class="line" lang="c"></span>
<span id="LC5" class="line" lang="c"> <span class="k">switch</span> <span class="p">(...)</span> <span class="p">{</span></span>
<span id="LC6" class="line" lang="c"> <span class="k">case</span> <span class="n">APPROVED_ALGO1</span><span class="p">:</span></span>
<span id="LC7" class="line" lang="c"> <span class="k">break</span><span class="p">;</span></span>
<span id="LC8" class="line" lang="c"> <span class="k">case</span> <span class="n">APPROVED_ALGO2</span><span class="p">:</span></span>
<span id="LC9" class="line" lang="c"> <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">approved_mode</span><span class="p">)</span></span>
<span id="LC10" class="line" lang="c"> <span class="n">approved</span> <span class="o">=</span> <span class="nb">false</span><span class="p">;</span></span>
<span id="LC11" class="line" lang="c"> <span class="k">break</span><span class="p">;</span></span>
<span id="LC12" class="line" lang="c"> <span class="k">case</span> <span class="n">NON_APPROVED_ALGO</span><span class="p">:</span></span>
<span id="LC13" class="line" lang="c"> <span class="n">approved</span> <span class="o">=</span> <span class="nb">false</span><span class="p">;</span></span>
<span id="LC14" class="line" lang="c"> <span class="k">break</span><span class="p">;</span></span>
<span id="LC15" class="line" lang="c"> <span class="p">}</span></span>
<span id="LC16" class="line" lang="c"> <span class="p">...</span></span>
<span id="LC17" class="line" lang="c"><span class="nl">cleanup:</span></span>
<span id="LC18" class="line" lang="c"> <span class="k">if</span> <span class="p">(</span><span class="n">ret</span> <span class="o"><</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span></span>
<span id="LC19" class="line" lang="c"> <span class="cm">/* state transition to GNUTLS_FIPS140_OPERATION_STATE_ERROR */</span></span>
<span id="LC20" class="line" lang="c"> <span class="p">}</span> <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="n">approved</span><span class="p">)</span> <span class="p">{</span></span>
<span id="LC21" class="line" lang="c"> <span class="cm">/* state transition to GNUTLS_FIPS140_OPERATION_STATE_APPROVED */</span></span>
<span id="LC22" class="line" lang="c"> <span class="p">}</span> <span class="k">else</span> <span class="p">{</span></span>
<span id="LC23" class="line" lang="c"> <span class="cm">/* state transition to GNUTLS_FIPS140_OPERATION_STATE_NOT_APPROVED */</span></span>
<span id="LC24" class="line" lang="c"> <span class="p">}</span></span>
<span id="LC25" class="line" lang="c"><span class="p">}</span></span></code></pre>
</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/1465#note_738647227">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/b6cc8cdac833b5b3af0735d697841001/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/1465#note_738647227"}}</script>
</p>
</div>
</body>
</html>