@@ -26,7 +26,6 @@ bitflags! {
2626 const EC_F_P = CKF_EC_F_P ;
2727 const EC_F_2M = CKF_EC_F_2M ;
2828 const EC_ECPARAMETERS = CKF_EC_ECPARAMETERS ;
29- const EC_NAMEDCURVE = CKF_EC_NAMEDCURVE ;
3029 const EC_OID = CKF_EC_OID ;
3130 const EC_UNCOMPRESS = CKF_EC_UNCOMPRESS ;
3231 const EC_COMPRESS = CKF_EC_COMPRESS ;
@@ -38,6 +37,12 @@ bitflags! {
3837 }
3938}
4039
40+ impl MechanismInfoFlags {
41+ /// `CKF_EC_NAMEDCURVE` is deprecated with `PKCS#11 3.00`. It is replaced by [`CKF_EC_OID`](MechanismInfoFlags::EC_OID).
42+ #[ deprecated = "use `EC_OID` instead" ]
43+ pub const EC_NAMEDCURVE : Self = Self :: from_bits_retain ( CKF_EC_NAMEDCURVE ) ;
44+ }
45+
4146/// Information about a particular mechanism
4247#[ derive( Debug , Clone , Copy ) ]
4348pub struct MechanismInfo {
@@ -202,6 +207,7 @@ impl MechanismInfo {
202207 /// [`ec_from_named_curve`](Self::ec_from_named_curve) must be `true`
203208 #[ deprecated = "use `ec_from_oid` instead" ]
204209 pub fn ec_from_named_curve ( & self ) -> bool {
210+ #[ allow( deprecated) ]
205211 self . flags . contains ( MechanismInfoFlags :: EC_NAMEDCURVE )
206212 }
207213
@@ -303,6 +309,15 @@ impl From<CK_MECHANISM_INFO> for MechanismInfo {
303309#[ cfg( test) ]
304310mod test {
305311 use super :: { MechanismInfo , MechanismInfoFlags } ;
312+ use cryptoki_sys:: CK_FLAGS ;
313+
314+ #[ test]
315+ fn deprecated_flags ( ) {
316+ let ec_oid_bits: CK_FLAGS = MechanismInfoFlags :: EC_OID . bits ( ) ;
317+ #[ allow( deprecated) ]
318+ let ec_namedcurve_bits: CK_FLAGS = MechanismInfoFlags :: EC_NAMEDCURVE . bits ( ) ;
319+ assert_eq ! ( ec_oid_bits, ec_namedcurve_bits) ;
320+ }
306321
307322 #[ test]
308323 fn debug_flags_all ( ) {
0 commit comments