@@ -14,8 +14,6 @@ use std::fmt::Formatter;
1414use std:: mem:: size_of;
1515use std:: ops:: Deref ;
1616
17- const MAX_CU_ULONG : CK_ULONG = !0 ;
18-
1917#[ derive( Debug , Copy , Clone , Ord , PartialOrd , Eq , PartialEq , Hash ) ]
2018#[ non_exhaustive]
2119/// Type of an attribute
@@ -261,7 +259,7 @@ impl AttributeType {
261259 CKA_DERIVE_TEMPLATE => String :: from ( stringify ! ( CKA_DERIVE_TEMPLATE ) ) ,
262260 CKA_ALLOWED_MECHANISMS => String :: from ( stringify ! ( CKA_ALLOWED_MECHANISMS ) ) ,
263261 CKA_UNIQUE_ID => String :: from ( stringify ! ( CKA_UNIQUE_ID ) ) ,
264- CKA_VENDOR_DEFINED ..=MAX_CU_ULONG => {
262+ CKA_VENDOR_DEFINED ..=CK_ULONG :: MAX => {
265263 format ! ( "{}_{}" , stringify!( CKA_VENDOR_DEFINED ) , val)
266264 }
267265 _ => format ! ( "unknown ({val:08x})" ) ,
@@ -409,7 +407,7 @@ impl TryFrom<CK_ATTRIBUTE_TYPE> for AttributeType {
409407 CKA_VERIFY_RECOVER => Ok ( AttributeType :: VerifyRecover ) ,
410408 CKA_WRAP => Ok ( AttributeType :: Wrap ) ,
411409 CKA_WRAP_WITH_TRUSTED => Ok ( AttributeType :: WrapWithTrusted ) ,
412- CKA_VENDOR_DEFINED ..=MAX_CU_ULONG => Ok ( AttributeType :: VendorDefined ( attribute_type) ) ,
410+ CKA_VENDOR_DEFINED ..=CK_ULONG :: MAX => Ok ( AttributeType :: VendorDefined ( attribute_type) ) ,
413411 attr_type => {
414412 error ! ( "Attribute type {} not supported." , attr_type) ;
415413 Err ( Error :: NotSupported )
@@ -1296,7 +1294,7 @@ impl KeyType {
12961294 CKK_EC_EDWARDS => String :: from ( stringify ! ( CKK_EC_EDWARDS ) ) ,
12971295 CKK_EC_MONTGOMERY => String :: from ( stringify ! ( CKK_EC_MONTGOMERY ) ) ,
12981296 CKK_HKDF => String :: from ( stringify ! ( CKK_HKDF ) ) ,
1299- CKK_VENDOR_DEFINED ..=MAX_CU_ULONG => String :: from ( stringify ! ( key_type) ) ,
1297+ CKK_VENDOR_DEFINED ..=CK_ULONG :: MAX => String :: from ( stringify ! ( key_type) ) ,
13001298 _ => format ! ( "unknown ({key_type:08x})" ) ,
13011299 }
13021300 }
@@ -1371,7 +1369,7 @@ impl TryFrom<CK_KEY_TYPE> for KeyType {
13711369 CKK_EC_EDWARDS => Ok ( KeyType :: EC_EDWARDS ) ,
13721370 CKK_EC_MONTGOMERY => Ok ( KeyType :: EC_MONTGOMERY ) ,
13731371 CKK_HKDF => Ok ( KeyType :: HKDF ) ,
1374- CKK_VENDOR_DEFINED ..=MAX_CU_ULONG => KeyType :: new_vendor_defined ( key_type) ,
1372+ CKK_VENDOR_DEFINED ..=CK_ULONG :: MAX => KeyType :: new_vendor_defined ( key_type) ,
13751373 _ => {
13761374 error ! ( "Key type {} is not supported." , key_type) ;
13771375 Err ( Error :: NotSupported )
0 commit comments