<!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">
<div></div>
<h2 dir="auto">
<a id="user-content-description-of-problem" class="anchor" href="#description-of-problem" aria-hidden="true"></a>Description of problem:</h2>
<p dir="auto">p11tool tries to use a R/O session when the user requests SO login. This is not allowed by PKCS#11 specification.
The SO can only log in using R/W sessions.</p>
<p dir="auto">This was originally reported in:
<a href="https://bugzilla.redhat.com/show_bug.cgi?id=1685434" rel="nofollow noreferrer noopener" target="_blank">https://bugzilla.redhat.com/show_bug.cgi?id=1685434</a></p>
<p dir="auto">See also the discussion in:
<a href="https://github.com/opendnssec/SoftHSMv2/issues/451" rel="nofollow noreferrer noopener" target="_blank">https://github.com/opendnssec/SoftHSMv2/issues/451</a></p>
<h2 dir="auto">
<a id="user-content-version-of-gnutls-used" class="anchor" href="#version-of-gnutls-used" aria-hidden="true"></a>Version of gnutls used:</h2>
<p dir="auto">In the original report were used the following versions:</p>
<ul dir="auto">
<li>gnutls-utils-3.6.5-2.fc29.x86_64</li>
<li>softhsm-2.5.0-2.fc29.x86_64</li>
</ul>
<p dir="auto">I reproduced the issue using the current master (<a href="https://gitlab.com/gnutls/gnutls/commit/c7c01872b92678c637762064ed3c9da159d33c86" data-original="c7c01872b" data-link="false" data-link-reference="false" data-project="179611" data-commit="c7c01872b92678c637762064ed3c9da159d33c86" data-reference-type="commit" data-container="body" data-placement="bottom" title="Merge branch 'tmp-doc-update-iv' into 'master'" class="gfm gfm-commit has-tooltip">c7c01872</a>).</p>
<h2 dir="auto">
<a id="user-content-distributor-of-gnutls-eg-ubuntu-fedora-rhel" class="anchor" href="#distributor-of-gnutls-eg-ubuntu-fedora-rhel" aria-hidden="true"></a>Distributor of gnutls (e.g., Ubuntu, Fedora, RHEL)</h2>
<p dir="auto">Fedora 29</p>
<h2 dir="auto">
<a id="user-content-how-reproducible" class="anchor" href="#how-reproducible" aria-hidden="true"></a>How reproducible:</h2>
<p dir="auto">always</p>
<p dir="auto">Steps to Reproduce:</p>
<ul dir="auto">
<li>Initialize a new token using SoftHSM:</li>
</ul>
<pre class="code highlight js-syntax-highlight plaintext" lang="plaintext" v-pre="true"><code><span id="LC1" class="line" lang="plaintext">$ softhsm2-util --init-token --label softhsm --free --pin 1234 --so-pin 1234</span></code></pre>
<ul dir="auto">
<li>Generate a key pair (to have an object to be listed):</li>
</ul>
<pre class="code highlight js-syntax-highlight plaintext" lang="plaintext" v-pre="true"><code><span id="LC1" class="line" lang="plaintext">$ p11tool --generate-privkey=RSA --bits=2048 --label=pkey --login --set-pin=1234 pkcs11:token=softhsm</span></code></pre>
<ul dir="auto">
<li>Try to list the objects using SO login:</li>
</ul>
<pre class="code highlight js-syntax-highlight plaintext" lang="plaintext" v-pre="true"><code><span id="LC1" class="line" lang="plaintext">p11tool --list-all --so-login --set-so-pin=1234 pkcs11:token=softhsm</span></code></pre>
<h2 dir="auto">
<a id="user-content-actual-results" class="anchor" href="#actual-results" aria-hidden="true"></a>Actual results:</h2>
<pre class="code highlight js-syntax-highlight plaintext" lang="plaintext" v-pre="true"><code><span id="LC1" class="line" lang="plaintext">$ p11tool -d9 --list-all --so-login --set-so-pin=1234 pkcs11:token=softhsm</span>
<span id="LC2" class="line" lang="plaintext">Setting log level to 9</span>
<span id="LC3" class="line" lang="plaintext">|<2>| p11: Initializing module: p11-kit-trust</span>
<span id="LC4" class="line" lang="plaintext">|<2>| p11: Initializing module: opensc</span>
<span id="LC5" class="line" lang="plaintext">|<2>| p11: Initializing module: softhsm2</span>
<span id="LC6" class="line" lang="plaintext">|<3>| ASSERT: pkcs11.c[compat_load]:894</span>
<span id="LC7" class="line" lang="plaintext">|<2>| p11: No login requested.</span>
<span id="LC8" class="line" lang="plaintext">|<2>| p11: Login result = A read-only session exists (183)</span>
<span id="LC9" class="line" lang="plaintext">|<3>| ASSERT: pkcs11.c[_pkcs11_traverse_tokens]:1620</span>
<span id="LC10" class="line" lang="plaintext">|<3>| ASSERT: pkcs11.c[gnutls_pkcs11_obj_list_import_url4]:3510</span>
<span id="LC11" class="line" lang="plaintext">Error in crt_list_import (1): PKCS #11 error in session</span></code></pre>
<h2 dir="auto">
<a id="user-content-expected-results" class="anchor" href="#expected-results" aria-hidden="true"></a>Expected results:</h2>
<p dir="auto">Objects listed (only public).</p>

</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/issues/721">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/12097312c9b2cd97d81d58927e7ff26d/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/721"}}</script>
</p>
</div>
</body>
</html>