Skip to content

Commit

Permalink
Template parsing: ignore unknown kinds
Browse files Browse the repository at this point in the history
When the template specifies a Kind that is unknown, ignore it rather than expecting Kind::Other

Without this change, FindObjects returns nothing in situation where it is expected to return certificates
by certutil
  • Loading branch information
sosthene-nitrokey committed Jan 30, 2024
1 parent 92f196c commit e210413
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkcs11/src/backend/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ fn parse_key_requirements(template: Option<CkRawAttrTemplate>) -> Result<KeyRequ
debug!("attr {:?}: {:?}", attr.type_(), attr.val_bytes());

if attr.type_() == CKA_CLASS {
kind = unsafe { attr.read_value::<CK_OBJECT_CLASS>() }.map(ObjectKind::from)
kind = unsafe { attr.read_value::<CK_OBJECT_CLASS>() }
.map(ObjectKind::from)
.filter(|k| *k != ObjectKind::Other);
}

if attr.type_() == CKA_ID {
Expand Down

0 comments on commit e210413

Please sign in to comment.