You've already forked opencryptoki
mirror of
https://github.com/opencryptoki/opencryptoki.git
synced 2026-10-24 05:39:17 +03:00
Add check_unwrap_sensitive_extractable() to the common test code. It unwraps the same data with each combination of CKA_SENSITIVE and CKA_EXTRACTABLE, and with neither, and checks every new key: the attributes match the template (any value is accepted when the template does not set them, since the defaults are token specific); CKA_ALWAYS_SENSITIVE and CKA_NEVER_EXTRACTABLE are FALSE; and the key value cannot be read from a sensitive key. When the unwrapping key's CKA_UNWRAP_TEMPLATE sets one of the attributes, a key unwrapped without it gets that value, and a template asking for the other value must fail with CKR_TEMPLATE_INCONSISTENT. CKA_ALWAYS_SENSITIVE and CKA_NEVER_EXTRACTABLE are not checked on the ICSF token, which unwraps on the ICSF server and takes these attributes from it. Run it from do_WrapUnwrapAES() for secret keys, from do_WrapUnwrapRSA() for RSA private keys, and from both EC key transfer tests for EC private keys, whose transport key's CKA_UNWRAP_TEMPLATE sets CKA_EXTRACTABLE = FALSE. Add do_UnwrapTemplateAES(), which unwraps under a wrapping key whose CKA_UNWRAP_TEMPLATE sets CKA_SENSITIVE = TRUE and CKA_EXTRACTABLE = FALSE, for every AES wrap mechanism. Signed-off-by: Alexandre Laroche <larochealexandre@hotmail.com> Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>