Skip to content

Commit

Permalink
Support vendor extensions for CK_USER_TYPE
Browse files Browse the repository at this point in the history
Some HSM vendors have more user types than the standard CKU_SO and
CKU_USER. For example a Thales Luna uses the value 0x80000001 to
represent the unprivileged Crypto User.

Signed-off-by: Lars Persson <[email protected]>
  • Loading branch information
larper2axis committed Sep 3, 2024
1 parent e0a9e17 commit e59bf7e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cryptoki/src/session/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ pub enum UserType {
User,
/// Context Specific
ContextSpecific,
/// Vendor extension
VendorExtension(u32)
}

impl From<UserType> for CK_USER_TYPE {
Expand All @@ -98,6 +100,7 @@ impl From<UserType> for CK_USER_TYPE {
UserType::So => CKU_SO,
UserType::User => CKU_USER,
UserType::ContextSpecific => CKU_CONTEXT_SPECIFIC,
UserType::VendorExtension(n) => n as CK_USER_TYPE
}
}
}

0 comments on commit e59bf7e

Please sign in to comment.