<!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>
<p dir="auto">I think I found the problem. <code>p11_kit_config_option(module, "module")</code> returns the value of the <code>module</code> option in the p11-kit configuration file. When autoloading is enabled, the module gains its name from the configuration file:</p>
<pre class="code highlight js-syntax-highlight plaintext" lang="plaintext" v-pre="true"><code><span id="LC1" class="line" lang="plaintext"># /usr/share/p11-kit/modules/p11-kit-trust.module</span>
<span id="LC2" class="line" lang="plaintext">module: p11-kit-trust.so</span>
<span id="LC3" class="line" lang="plaintext"># /usr/share/p11-kit/modules/softhsm2.module</span>
<span id="LC4" class="line" lang="plaintext">module: /usr/lib/softhsm/libsofthsm2.so</span></code></pre>
<p dir="auto">When loading from file, of course no module configuration file is available. Proposal:</p>
<ul dir="auto">
<li>Add a new <code>GNUTLS_PKCS11_TOKEN_MODULE_NAME</code> type that returns the value of <a href="https://p11-glue.github.io/p11-glue/p11-kit/manual/p11-kit-Modules.html#p11-kit-module-get-name" rel="nofollow noreferrer noopener" target="_blank">p11_kit_module_get_name</a>. Examples: <code>p11-kit-trust</code> or <code>softhsm2</code>
</li>
<li>Add a new <code>GNUTLS_PKCS11_TOKEN_MODULE_FILENAME</code> type that returns the value of <a href="https://p11-glue.github.io/p11-glue/p11-kit/manual/p11-kit-Modules.html#p11-kit-module-get-filename" rel="nofollow noreferrer noopener" target="_blank">p11_kit_module_get_filename</a>. Examples: <code>/usr/lib/x86_64-linux-gnu/pkcs11/p11-kit-trust.so</code> or <code>/usr/lib/softhsm/libsofthsm2.so</code>
</li>
<li>Deprecate the <code>GNUTLS_PKCS11_TOKEN_MODNAME</code> (and make it an alias of <code>GNUTLS_PKCS11_TOKEN_MODULE_NAME</code>). Reason for deprecation is because it has bugs (this one and the truncation and NULL crash issue fixed by <a href="https://gitlab.com/gnutls/gnutls/merge_requests/827" data-original="!827" data-link="false" data-link-reference="false" data-project="179611" data-merge-request="20107866" data-reference-type="merge_request" data-container="body" data-placement="bottom" title="Fix gnutls_pkcs11_token_get_info for short output buffers and fix a memleak" class="gfm gfm-merge_request has-tooltip">!827</a>).</li>
<li>(Add tests that check that all fields are NULL)</li>
</ul>
<p dir="auto">Alternatively:</p>
<ul dir="auto">
<li>Keep the <code>GNUTLS_PKCS11_TOKEN_MODNAME</code> type which uses <a href="https://p11-glue.github.io/p11-glue/p11-kit/manual/p11-kit-Modules.html#p11-kit-module-get-name" rel="nofollow noreferrer noopener" target="_blank">p11_kit_module_get_name</a>.</li>
<li>Add a new <code>GNUTLS_PKCS11_TOKEN_MODPATH</code> type which uses <a href="https://p11-glue.github.io/p11-glue/p11-kit/manual/p11-kit-Modules.html#p11-kit-module-get-filename" rel="nofollow noreferrer noopener" target="_blank">p11_kit_module_get_filename</a>.</li>
</ul>
<p dir="auto">What do you think? This would likely be a continuation of <a href="https://gitlab.com/gnutls/gnutls/merge_requests/827" data-original="!827" data-link="false" data-link-reference="false" data-project="179611" data-merge-request="20107866" data-reference-type="merge_request" data-container="body" data-placement="bottom" title="Fix gnutls_pkcs11_token_get_info for short output buffers and fix a memleak" class="gfm gfm-merge_request has-tooltip">!827</a> (it touches similar code). Should I add these changes to that PR?</p>
</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/issues/633#note_121461229">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/68d6f32363cf470d3dd3c733d5723a4d/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/633#note_121461229"}}</script>
</p>
</div>
</body>
</html>