Skip to content

Commit f8bb949

Browse files
Normalize making a CK_MECHANISM object from params for AEAD
Despite the fact that we can use `make_mechanism()` to create a `CK_MECHANISM` object from the GcmParams and GcmMessageParams, we were not doing so. This fixes this Signed-off-by: Jacob Prud'homme <[email protected]>
1 parent 1bebfae commit f8bb949

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

cryptoki/src/mechanism/mod.rs

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1346,20 +1346,8 @@ impl From<&Mechanism<'_>> for CK_MECHANISM {
13461346
| Mechanism::Des3Cbc(params)
13471347
| Mechanism::DesCbcPad(params)
13481348
| Mechanism::Des3CbcPad(params) => make_mechanism(mechanism, params),
1349-
Mechanism::AesGcm(params) => CK_MECHANISM {
1350-
mechanism,
1351-
pParameter: params as *const _ as *mut c_void,
1352-
ulParameterLen: size_of::<CK_GCM_PARAMS>()
1353-
.try_into()
1354-
.expect("usize can not fit in CK_ULONG"),
1355-
},
1356-
Mechanism::AesGcmMessage(params) => CK_MECHANISM {
1357-
mechanism,
1358-
pParameter: params as *const _ as *mut c_void,
1359-
ulParameterLen: size_of::<CK_GCM_MESSAGE_PARAMS>()
1360-
.try_into()
1361-
.expect("usize can not fit in CK_ULONG"),
1362-
},
1349+
Mechanism::AesGcm(params) => make_mechanism(mechanism, params),
1350+
Mechanism::AesGcmMessage(params) => make_mechanism(mechanism, params),
13631351
Mechanism::RsaPkcsPss(params)
13641352
| Mechanism::Sha1RsaPkcsPss(params)
13651353
| Mechanism::Sha256RsaPkcsPss(params)

0 commit comments

Comments
 (0)