Comments (9)
This definitely looks broken to me.
It is impossible to determine whether C_FindObjects
would have returned more values than max
without calling it again. Only when C_FindObjects
returns zero can you be sure the token has no more objects to return.
I think a breaking change is required to remove this boolean response value. It is misleading and I can't see how it can ever be accurate. It's already tripped me up on some code I wrote to work with SoftHSM2.
In a pathological case, you cannot even be sure the token has run out of objects if ulCount < maz
. The token is under no obligation to always fill the available space. Its only obligation is to return 0
if no more objects exist.
The workaround for now is to ignore this boolean value and keep calling until no objects are returned.
from pkcs11.
@miekg Can we reopen this?
from pkcs11.
Your interpretation of the spec seems correct to me. It's unclear whether changing the code would be a good idea since implementations may be depending on it never returning true (see this example in the pkcs11 tree: https://github.com/miekg/pkcs11/blob/master/p11/session.go#L75)
The safest fix would be updating the comment to mark it as deprecated and describing what the correct use should be.
from pkcs11.
from pkcs11.
The existing signature is sufficient to use the function correctly, you just ignore the boolean and stop searching when the result is empty. So there's not really any benefit to changing it until there are other breaking changes to bundle it with. I opened a pull request to update the docs and fix the p11 version of the function to not use it.
from pkcs11.
I'd opt for a breaking change. Removing a return value will break builds, so people won't miss this happening. People who are ignoring the return value are minimally inconvenienced. People with broken code that assumes it works correctly will have more work to do, but they had buggy code anyway.
I fear people will miss documentation changes.
from pkcs11.
from pkcs11.
Should #55 be addressed at the same time then?
Ideally there should be a tag before the breaking change so that people using dependency management can pin it until they can update their code.
from pkcs11.
If we're going to break things, its better to group those, so yes?
releases is a separate issues: now with vgo we should actually start doing this.
from pkcs11.
Related Issues (20)
- Is it possible to integrate this with GCloud KMS - HSM system?
- Panic in NewAttribute when use u/int16/32/64 as Attribute value
- Replace p11.Slot struct with interface HOT 4
- use v3? HOT 3
- Two constants no longer exit HOT 2
- Add CK_RSA_AES_KEY_WRAP_PARAMS to params.go HOT 6
- license issue related to the OASIS IPR Policy HOT 1
- p11.Slot.Mechanisms seems inadequate substitute for pkcs11.Ctx.GetMechanismList
- Cumbersome cryptographic operations for speed tests
- Error running in Ubuntu 18.04 I386 HOT 1
- Using AWS CloudHSM to sign ethereum transactions HOT 1
- RFE: RFC7512 URI support HOT 2
- RFE: Load p11-kit-proxy.so as default provider HOT 4
- Can't access functions of pkg HOT 1
- Error running the PKCS11 package on Windows HOT 4
- Returning attributes through GetAttributeValue in certain error scenarios
- Problem with "pkcs11.h" when running with "go build", "go run ." or "go run main.go"
- Non symetric AES keys
- Static build binary contained the pkcs11 package dlopen HOT 2
- no rsa verify test in pkcs11_test HOT 1
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.