Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

p11-kit list-modules lists multiple URL entries for the same token with different query attributes #556

Closed
ueno opened this issue Sep 16, 2023 · 1 comment

Comments

@ueno
Copy link
Member

ueno commented Sep 16, 2023

Steps to reproduce:

$ cat softhsm2.conf
directories.tokendir = /tmp/softhsm/
$ mkdir /tmp/softhsm
$ export SOFTHSM2_CONF=$PWD/softhsm2.conf
$ softhsm2-util --init-token --free --label test
$ p11tool --list-tokens
Token 0:
	URL: pkcs11:model=p11-kit-trust;manufacturer=PKCS%2311%20Kit;serial=1;token=System%20Trust
	Label: System Trust
	Type: Trust module
	Flags: uPIN uninitialized
	Manufacturer: PKCS#11 Kit
	Model: p11-kit-trust
	Serial: 1
	Module: p11-kit-trust.so


Token 1:
	URL: pkcs11:model=p11-kit-trust;manufacturer=PKCS%2311%20Kit;serial=1;token=Default%20Trust
	Label: Default Trust
	Type: Trust module
	Flags: uPIN uninitialized
	Manufacturer: PKCS#11 Kit
	Model: p11-kit-trust
	Serial: 1
	Module: p11-kit-trust.so


Token 2:
	URL: pkcs11:model=SoftHSM%20v2;manufacturer=SoftHSM%20project;serial=bf507779ef856d30;token=test
	Label: test
	Type: Generic token
	Flags: RNG, Requires login
	Manufacturer: SoftHSM project
	Model: SoftHSM v2
	Serial: bf507779ef856d30
	Module: /usr/lib64/pkcs11/libsofthsm2.so
$ p11-kit list-modules | grep uri | grep -i softhsm
    uri: pkcs11:library-description=Implementation%20of%20PKCS11;library-manufacturer=SoftHSM?module-name=softhsm2&module-path=%2Fusr%2Flib64%2Fpkcs11%2Flibsofthsm2.so
        uri: pkcs11:model=SoftHSM%20v2;manufacturer=SoftHSM%20project;serial=bf507779ef856d30;token=test?module-name=softhsm2&module-path=%2Fusr%2Flib64%2Fpkcs11%2Flibsofthsm2.so
        uri: pkcs11:model=SoftHSM%20v2;manufacturer=SoftHSM%20project;serial=;token=?module-name=softhsm2&module-path=%2Fusr%2Flib64%2Fpkcs11%2Flibsofthsm2.so

As you see, the last coulple of URIs are only different in the presence of module-path, which is a query attribute (not a path attribute) and should be aggregated.

@ueno
Copy link
Member Author

ueno commented Sep 18, 2023

This might be actually an issue in p11tool (GnuTLS), as the second token (with empty label) exists but not initialized.

@ueno ueno closed this as completed Sep 18, 2023
@ueno ueno added invalid and removed bug labels Oct 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant