<!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=utf-8" 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: #777777;">
<a href="https://gitlab.com/stefanberger">Stefan Berger</a>
commented on a discussion
on <a href="https://gitlab.com/gnutls/gnutls/merge_requests/796#note_118304979">lib/includes/gnutls/gnutls.h.in</a>:
</p>
<table>
<tr class="line_holder" id="">
<td class="diff-line-num old_line" data-linenumber="2788" 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">
2788
</td>
<td class="diff-line-num new_line" data-linenumber="2788" 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">
2788
</td>
<td class="line_content noteable_line" style="padding-left: 0.5em; padding-right: 0.5em;">
<pre style="margin: 0;"> <span id="LC2788" class="line" lang="c"><span class="cm" style="color: #998; font-style: italic;"> * @GNUTLS_PIN_FINAL_TRY: This is the final try before blocking.</span></span>
</pre>
</td>
</tr>
<tr class="line_holder" id="">
<td class="diff-line-num old_line" data-linenumber="2789" 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">
2789
</td>
<td class="diff-line-num new_line" data-linenumber="2789" 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">
2789
</td>
<td class="line_content noteable_line" style="padding-left: 0.5em; padding-right: 0.5em;">
<pre style="margin: 0;"> <span id="LC2789" class="line" lang="c"><span class="cm" style="color: #998; font-style: italic;"> * @GNUTLS_PIN_COUNT_LOW: Few tries remain before token blocks.</span></span>
</pre>
</td>
</tr>
<tr class="line_holder" id="">
<td class="diff-line-num old_line" data-linenumber="2790" 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">
2790
</td>
<td class="diff-line-num new_line" data-linenumber="2790" 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">
2790
</td>
<td class="line_content noteable_line" style="padding-left: 0.5em; padding-right: 0.5em;">
<pre style="margin: 0;"> <span id="LC2790" class="line" lang="c"><span class="cm" style="color: #998; font-style: italic;"> * @GNUTLS_PIN_WRONG: Last given PIN was not correct.</span></span>
</pre>
</td>
</tr>
<tr class="line_holder new" id="">
<td class="diff-line-num new old_line" data-linenumber="2791" 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="diff-line-num new new_line" data-linenumber="2791" 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">
2791
</td>
<td class="line_content new noteable_line" style="padding-left: 0.5em; padding-right: 0.5em;" bgcolor="#ecfdf0">
<pre style="margin: 0;">+<span id="LC2791" class="line" lang="c"><span class="cm" style="color: #998; font-style: italic;"> * @GNUTLS_PIN_MAY_BE_MISSING:  It is fine if the PIN is missing.</span></span>
</pre>
</td>
</tr>

</table>
<div>
<p dir="auto">Not quite. I introduced this flag to prevent the existing PIN callback from exiting (<code>exit(1)</code>), which was ok before when the first attempt was made to use the srk_password = NULL, which could then fail if the TPM 1.2 had a real password. I turned this around now, asking the PIN callback first, which may not not have a PIN, which is fine, and we try the srk_password = NULL then instead.</p>
<pre class="code highlight js-syntax-highlight plaintext" lang="plaintext" v-pre="true" style="background-color: #fff; font-family: monospace; font-size: 90%; -premailer-cellpadding: 0; -premailer-cellspacing: 0; -premailer-width: 100%; margin: 0;"><code><span id="LC1" class="line" lang="plaintext">        if (password[0] == 0 || password[0] == '\n') {</span>
<span id="LC2" class="line" lang="plaintext">                if (flags & GNUTLS_PIN_MAY_BE_MISSING)</span>
<span id="LC3" class="line" lang="plaintext">                        return -1;</span>
<span id="LC4" class="line" lang="plaintext">                fprintf(stderr, "No PIN given.\n");</span>
<span id="LC5" class="line" lang="plaintext">                if (info != NULL && info->batch != 0) {</span>
<span id="LC6" class="line" lang="plaintext">                        fprintf(stderr, "note: when operating in batch mode, set the GNUTLS_PIN or GNUTLS_SO_PIN environment variables\n")</span>
<span id="LC7" class="line" lang="plaintext">                }</span>
<span id="LC8" class="line" lang="plaintext">                exit(1);</span>
<span id="LC9" class="line" lang="plaintext">        }</span></code></pre>
</div>


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

<br>
Reply to this email directly or <a href="https://gitlab.com/gnutls/gnutls/merge_requests/796#note_118304979">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/c6840600d91efca19d51be7a6000c6b4/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/796#note_118304979"}}</script>
</p>
</div>
</body>
</html>