Comments (4)
Hi @JSchy65 , thank you for using the pkcs11 tools, and for reporting an issue along with comprehensive information. I've never been hit by optimization issues so far, so that's an interesting one.
I would need to reproduce the issue. Can you give me more information about the PKCS#11 library you are using? Also, (out of curiosity), why is your token label longer than the limit imposed by CK_TOKEN_INFO
?
For the resolution, I would like to find a way that doesn't add compiler-specific syntax, as this code currently compiles on other compilers than LLVM or GCC, and might not like the attribute()
directive. Could the issue be caused by the ternary operator ? Have you tried changing rtrim()
to use a simple if() {} else {}
directive instead?
from pkcs11-tools.
Hi @JSchy65 , the way how the comparison was made had several shortcomings, one of them being that it modified the CK_TOKEN_INFO
structure, possibly making it unusable for further use.
I have rewritten that section completely:
- trailing spaces at the end of
CK_TOKEN_INFO.label
are stripped - if the token label to compare is longer than what allows
CK_TOKEN_INFO.label
, a warning is printed and the comparison fails - In the end, both strings are compared, but limited to the max capacity of
CK_TOKEN_INFO.label
.
I tested with several token label sizes, including labels filling entirely the label array, and these seemed to work.
Before I merge this back to the master branch, I would appreciate if you could try it out and confirm it fixes your specific issue. Just checkout branch fix_issue_7
, commit 34aa8ae.
Thanks!
from pkcs11-tools.
Hi Eric,
I have tested your fix now and yes I confirm that it fixes the issue I have reported above. I tested with labels of various sizes (1, 10, 31, 32, 33) and also with the gcc compiler with various optimisation leves (-O0, -O1, -O2, -O3). In each case the fix behaved as expected -> Ok from my side :-)
I like the way very much that you have replaced that original implementation of the rtrim() with the new tokenlabelcmp(). In my opinion that makes the source easier to understand and is a more clear approach.
Thank you very much.
from pkcs11-tools.
Issue solved, will be published in v1.0.3 release.
from pkcs11-tools.
Related Issues (20)
- "configure.ac:47: error: possibly undefined macro: AC_MSG_WARN" on CentOS 7.8 HOT 5
- Compilation failed HOT 5
- rpmbuild: fails because of missing pkcs11_ossl.h in the tar.gz and INSTALL.md has a typo HOT 2
- Issue when autoreconf -vfi is run from bootstrap.sh HOT 1
- C_WrapKey using AES key to wrap ED448 and ED25519 fails for CKM_AES_KEY_WRAP_PAD with CKR_KEY_NOT_WRAPPABLE HOT 2
- p11mkcert Make failed HOT 3
- bootstrapping failed. HOT 2
- Some wrong names for hashes and MGF in the manual HOT 4
- (Help, please) no way to build the source code on Ubuntu 20... HOT 7
- issues with eddsa after keygen HOT 9
- p11keygen ignores some of unknown argument HOT 2
- build failure on Linux HOT 9
- ubuntu 22.04 Compilation error HOT 2
- bootstrap error Ubuntu 22.04 HOT 3
- AES support HOT 1
- p11req -X option results in malloc failure HOT 4
- Failing compilation on Ubuntu 22.04 HOT 3
- memory leak found with commands p11req and p11mkcert
- invalid mechanisms reported by p11slotinfo, on MIPS/Linux platform
- Support for more MACing options with `p11kcv`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pkcs11-tools.