@@ -1140,47 +1140,3 @@ fn make_mechanism<T>(mechanism: CK_MECHANISM_TYPE, param: &T) -> CK_MECHANISM {
1140
1140
. expect ( "usize can not fit in CK_ULONG" ) ,
1141
1141
}
1142
1142
}
1143
-
1144
- #[ cfg( feature = "psa-crypto-conversions" ) ]
1145
- #[ allow( deprecated) ]
1146
- impl TryFrom < psa_crypto:: types:: algorithm:: Algorithm > for Mechanism < ' _ > {
1147
- type Error = Error ;
1148
-
1149
- fn try_from ( alg : psa_crypto:: types:: algorithm:: Algorithm ) -> Result < Self , Self :: Error > {
1150
- use psa_crypto:: types:: algorithm:: {
1151
- Algorithm , AsymmetricEncryption , AsymmetricSignature , Hash , SignHash ,
1152
- } ;
1153
-
1154
- match alg {
1155
- Algorithm :: Hash ( Hash :: Sha1 ) => Ok ( Mechanism :: Sha1 ) ,
1156
- Algorithm :: Hash ( Hash :: Sha256 ) => Ok ( Mechanism :: Sha256 ) ,
1157
- Algorithm :: Hash ( Hash :: Sha384 ) => Ok ( Mechanism :: Sha384 ) ,
1158
- Algorithm :: Hash ( Hash :: Sha512 ) => Ok ( Mechanism :: Sha512 ) ,
1159
- Algorithm :: AsymmetricSignature ( AsymmetricSignature :: RsaPkcs1v15Sign { .. } )
1160
- | Algorithm :: AsymmetricEncryption ( AsymmetricEncryption :: RsaPkcs1v15Crypt { .. } ) => {
1161
- Ok ( Mechanism :: RsaPkcs )
1162
- }
1163
- Algorithm :: AsymmetricSignature ( AsymmetricSignature :: RsaPss {
1164
- hash_alg : SignHash :: Specific ( hash_alg) ,
1165
- } ) => Ok ( Mechanism :: RsaPkcsPss ( rsa:: PkcsPssParams {
1166
- hash_alg : Mechanism :: try_from ( Algorithm :: from ( hash_alg) ) ?. mechanism_type ( ) ,
1167
- mgf : rsa:: PkcsMgfType :: from_psa_crypto_hash ( hash_alg) ?,
1168
- s_len : hash_alg. hash_length ( ) . try_into ( ) ?,
1169
- } ) ) ,
1170
- Algorithm :: AsymmetricSignature ( AsymmetricSignature :: Ecdsa { .. } ) => {
1171
- Ok ( Mechanism :: Ecdsa )
1172
- }
1173
- Algorithm :: AsymmetricEncryption ( AsymmetricEncryption :: RsaOaep { hash_alg } ) => {
1174
- Ok ( Mechanism :: RsaPkcsOaep ( PkcsOaepParams :: new (
1175
- Mechanism :: try_from ( Algorithm :: from ( hash_alg) ) ?. mechanism_type ( ) ,
1176
- rsa:: PkcsMgfType :: from_psa_crypto_hash ( hash_alg) ?,
1177
- rsa:: PkcsOaepSource :: empty ( ) ,
1178
- ) ) )
1179
- }
1180
- alg => {
1181
- error ! ( "{:?} is not a supported algorithm" , alg) ;
1182
- Err ( Error :: NotSupported )
1183
- }
1184
- }
1185
- }
1186
- }
0 commit comments