Skip to content

Commit b5499ea

Browse files
authored
Merge pull request #334 from testingapisname/main
Fix #256: docs: Fix documentation references in MechanismInfo
2 parents 81aac81 + 11db4e0 commit b5499ea

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

cryptoki/src/mechanism/mechanism_info.rs

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
// SPDX-License-Identifier: Apache-2.0
33
//! Mechanism info and associated flags
44
5+
#[cfg(doc)]
6+
use crate::session::Session;
7+
58
use bitflags::bitflags;
69
use cryptoki_sys::*;
710
use std::fmt::{Debug, Formatter};
@@ -91,7 +94,8 @@ impl MechanismInfo {
9194
}
9295

9396
/// True if the mechanism can be used to digest a message
94-
// TODO See [`Session::digest`](crate::session::Session::digest)
97+
///
98+
/// See [`Session::digest`]
9599
pub fn digest(&self) -> bool {
96100
self.flags.contains(MechanismInfoFlags::DIGEST)
97101
}
@@ -103,10 +107,10 @@ impl MechanismInfo {
103107
self.flags.contains(MechanismInfoFlags::SIGN)
104108
}
105109

106-
/// True if the mechanism can be used to digitally data which can be
110+
/// True if the mechanism can be used to digitally sign data which can be
107111
/// recovered from the signature
108112
///
109-
// TODO See [`Session::sign_recover`](crate::session::Session::sign_recover)
113+
/// Note: `sign_recover` is not yet implemented in the Session API
110114
pub fn sign_recover(&self) -> bool {
111115
self.flags.contains(MechanismInfoFlags::SIGN_RECOVER)
112116
}
@@ -121,42 +125,42 @@ impl MechanismInfo {
121125
/// True if the mechanism can be used to verify a digital signature and
122126
/// recover the signed data
123127
///
124-
// TODO See [`Session::verify_recover`](crate::session::Session::verify_recover)
128+
/// Note: `verify_recover` is not yet implemented in the Session API
125129
pub fn verify_recover(&self) -> bool {
126130
self.flags.contains(MechanismInfoFlags::VERIFY_RECOVER)
127131
}
128132

129133
/// True if the mechanism can be used to generate a secret key
130134
///
131-
// TODO See [`Session::generate`](crate::session::Session::generate)
135+
/// See [`Session::generate_key`]
132136
pub fn generate(&self) -> bool {
133137
self.flags.contains(MechanismInfoFlags::GENERATE)
134138
}
135139

136140
/// True if the mechanism can be used to generate a public/private key pair
137141
///
138-
/// See [`Session::generate_key_pair`](crate::session::Session::generate_key_pair))
142+
/// See [`Session::generate_key_pair`]
139143
pub fn generate_key_pair(&self) -> bool {
140144
self.flags.contains(MechanismInfoFlags::GENERATE_KEY_PAIR)
141145
}
142146

143147
/// True if the mechanism can be used to wrap (encrypt) a key
144148
///
145-
// TODO See [`Session::wrap`](crate::session::Session::wrap))
149+
/// See [`Session::wrap_key`]
146150
pub fn wrap(&self) -> bool {
147151
self.flags.contains(MechanismInfoFlags::WRAP)
148152
}
149153

150154
/// True if the mechanism can be used to unwrap (decrypt) a key
151155
///
152-
// TODO See [`Session::unwrap`](crate::session::Session::unwrap))
156+
/// See [`Session::unwrap_key`]
153157
pub fn unwrap(&self) -> bool {
154158
self.flags.contains(MechanismInfoFlags::UNWRAP)
155159
}
156160

157161
/// True if the mechanism can be used to derive a key from a base key
158162
///
159-
// TODO See [`Session::derive`](crate::session::Session::derive))
163+
/// See [`Session::derive_key`]
160164
pub fn derive(&self) -> bool {
161165
self.flags.contains(MechanismInfoFlags::DERIVE)
162166
}

0 commit comments

Comments
 (0)