Skip to content

Commit 5a3ed95

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 <2160185+jacobprudhomme@users.noreply.github.com>
1 parent 3f1568e commit 5a3ed95

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
@@ -1465,20 +1465,8 @@ impl From<&Mechanism<'_>> for CK_MECHANISM {
14651465
| Mechanism::Des3Cbc(params)
14661466
| Mechanism::DesCbcPad(params)
14671467
| Mechanism::Des3CbcPad(params) => make_mechanism(mechanism, params),
1468-
Mechanism::AesGcm(params) => CK_MECHANISM {
1469-
mechanism,
1470-
pParameter: params as *const _ as *mut c_void,
1471-
ulParameterLen: size_of::<CK_GCM_PARAMS>()
1472-
.try_into()
1473-
.expect("usize can not fit in CK_ULONG"),
1474-
},
1475-
Mechanism::AesGcmMessage(params) => CK_MECHANISM {
1476-
mechanism,
1477-
pParameter: params as *const _ as *mut c_void,
1478-
ulParameterLen: size_of::<CK_GCM_MESSAGE_PARAMS>()
1479-
.try_into()
1480-
.expect("usize can not fit in CK_ULONG"),
1481-
},
1468+
Mechanism::AesGcm(params) => make_mechanism(mechanism, params),
1469+
Mechanism::AesGcmMessage(params) => make_mechanism(mechanism, params),
14821470
Mechanism::RsaPkcsPss(params)
14831471
| Mechanism::Sha1RsaPkcsPss(params)
14841472
| Mechanism::Sha256RsaPkcsPss(params)

0 commit comments

Comments
 (0)