@@ -14,8 +14,6 @@ use std::fmt::Formatter;
14
14
use std:: mem:: size_of;
15
15
use std:: ops:: Deref ;
16
16
17
- const MAX_CU_ULONG : CK_ULONG = !0 ;
18
-
19
17
#[ derive( Debug , Copy , Clone , Ord , PartialOrd , Eq , PartialEq , Hash ) ]
20
18
#[ non_exhaustive]
21
19
/// Type of an attribute
@@ -261,7 +259,7 @@ impl AttributeType {
261
259
CKA_DERIVE_TEMPLATE => String :: from ( stringify ! ( CKA_DERIVE_TEMPLATE ) ) ,
262
260
CKA_ALLOWED_MECHANISMS => String :: from ( stringify ! ( CKA_ALLOWED_MECHANISMS ) ) ,
263
261
CKA_UNIQUE_ID => String :: from ( stringify ! ( CKA_UNIQUE_ID ) ) ,
264
- CKA_VENDOR_DEFINED ..=MAX_CU_ULONG => {
262
+ CKA_VENDOR_DEFINED ..=CK_ULONG :: MAX => {
265
263
format ! ( "{}_{}" , stringify!( CKA_VENDOR_DEFINED ) , val)
266
264
}
267
265
_ => format ! ( "unknown ({val:08x})" ) ,
@@ -409,7 +407,7 @@ impl TryFrom<CK_ATTRIBUTE_TYPE> for AttributeType {
409
407
CKA_VERIFY_RECOVER => Ok ( AttributeType :: VerifyRecover ) ,
410
408
CKA_WRAP => Ok ( AttributeType :: Wrap ) ,
411
409
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) ) ,
413
411
attr_type => {
414
412
error ! ( "Attribute type {} not supported." , attr_type) ;
415
413
Err ( Error :: NotSupported )
@@ -1296,7 +1294,7 @@ impl KeyType {
1296
1294
CKK_EC_EDWARDS => String :: from ( stringify ! ( CKK_EC_EDWARDS ) ) ,
1297
1295
CKK_EC_MONTGOMERY => String :: from ( stringify ! ( CKK_EC_MONTGOMERY ) ) ,
1298
1296
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) ) ,
1300
1298
_ => format ! ( "unknown ({key_type:08x})" ) ,
1301
1299
}
1302
1300
}
@@ -1371,7 +1369,7 @@ impl TryFrom<CK_KEY_TYPE> for KeyType {
1371
1369
CKK_EC_EDWARDS => Ok ( KeyType :: EC_EDWARDS ) ,
1372
1370
CKK_EC_MONTGOMERY => Ok ( KeyType :: EC_MONTGOMERY ) ,
1373
1371
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) ,
1375
1373
_ => {
1376
1374
error ! ( "Key type {} is not supported." , key_type) ;
1377
1375
Err ( Error :: NotSupported )
0 commit comments