cryptosense / pkcs11

OCaml bindings for the PKCS#11 cryptographic API
BSD 2-Clause "Simplified" License
22 stars 6 forks source link

Assertion error related to CKA_CS_UNKNOWN #42

Open emillon opened 7 years ago

emillon commented 7 years ago

The following program fails with an assertion error:

let a = Pkcs11.CK_ATTRIBUTE_TYPE.CKA_CS_UNKNOWN Unsigned.ULong.zero in
let b = Pkcs11.CK_ATTRIBUTE_TYPE.CKA_CLASS in
Pkcs11.CK_ATTRIBUTE_TYPE.compare' a b
Fatal error: exception "Assert_failure src/pkcs11_CK_ATTRIBUTE_TYPE.ml:509:27"

This is understandable of course, but this should not be an assertion error. Either the exception should be different, or the subcase with CKA_CS_UNKNOWN should try harder with the comparison.

emillon commented 7 years ago

N.B. there might be similar code paths with: