-
Notifications
You must be signed in to change notification settings - Fork 85
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
All enum types with an associated VENDOR_DEFINED constant describe that value in roughly the same way in the standard. Using key types as an example: "Key types CKK_VENDOR_DEFINED and above are permanently reserved for token vendors. For interoperability, vendors should register their key types through the PKCS process."
The intent is that vendors who aren't concerned with interoperability or standardization are permitted to safely use that entire range of values. This crate largely omits these values, but not consistently. The two places where it does use them, they aren't treated properly:
CKM_VENDOR_DEFINED
is recognized for the Display trait, but only as a single value. All other in-range values are treated as errors.CKR_VENDOR_DEFINED
is reported as an error return value. All other in-range values are converted toGeneralError
.
In both cases, the underlying value is made visible in printed strings but lost within the type system and to the user.
Proposed changes:
- All enums documented to support vendor extensions should at least recognize them properly, even if full support isn't provided.
- Where defined, all values x that satisfy
VENDOR_DEFINED <= x <= ULONG::MAX
should be propagated back up to the user to respond to. ForRv
, this would likely be a sibling type toOk
andError(RvError)
. For all others it would be an additional discriminant containing the non-standard value (i.e.,VendorDefined(Ulong)
) - All stringification sites should include the value associated with vendor-defined values (e,g.
"CKM_VENDOR_DEFINED(0x{%08x})"
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working