Skip to content

Commit e59bf7e

Browse files
committed
Support vendor extensions for CK_USER_TYPE
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 <larper@axis.com>
1 parent e0a9e17 commit e59bf7e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

cryptoki/src/session/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ pub enum UserType {
9090
User,
9191
/// Context Specific
9292
ContextSpecific,
93+
/// Vendor extension
94+
VendorExtension(u32)
9395
}
9496

9597
impl From<UserType> for CK_USER_TYPE {
@@ -98,6 +100,7 @@ impl From<UserType> for CK_USER_TYPE {
98100
UserType::So => CKU_SO,
99101
UserType::User => CKU_USER,
100102
UserType::ContextSpecific => CKU_CONTEXT_SPECIFIC,
103+
UserType::VendorExtension(n) => n as CK_USER_TYPE
101104
}
102105
}
103106
}

0 commit comments

Comments
 (0)