Skip to content

Commit b32fc0a

Browse files
author
Jonas Maier
committed
corresponds
1 parent 151b5dc commit b32fc0a

File tree

1 file changed

+15
-38
lines changed

1 file changed

+15
-38
lines changed

openssl/src/ts.rs

Lines changed: 15 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ foreign_type_and_impl_send_sync! {
3333

3434
impl TsMsgImprint {
3535
/// Creates a new message imprint.
36-
///
37-
/// This corresponds to `TS_MSG_IMPRINT_new`.
36+
#[corresponds(TS_MSG_IMPRINT_new)]
3837
pub fn new() -> Result<TsMsgImprint, ErrorStack> {
3938
ffi::init();
4039
unsafe {
@@ -106,10 +105,7 @@ foreign_type_and_impl_send_sync! {
106105
impl TsReq {
107106
from_der! {
108107
/// Deserializes a DER-encoded TimeStampReq structure.
109-
///
110-
/// This corresponds to [`d2i_TS_REQ`].
111-
///
112-
/// [`d2i_TS_REQ`]: https://www.openssl.org/docs/man1.1.0/man3/d2i_TS_REQ.html
108+
#[corresponds(d2i_TS_REQ)]
113109
from_der,
114110
TsReq,
115111
ffi::d2i_TS_REQ
@@ -119,19 +115,15 @@ impl TsReq {
119115
impl TsReqRef {
120116
to_der! {
121117
/// Serializes the timestamp request into a DER-encoded TimeStampReq structure.
122-
///
123-
/// This corresponds to [`i2d_TS_REQ`].
124-
///
125-
/// [`i2d_TS_REQ`]: https://www.openssl.org/docs/man1.1.0/man3/i2d_TS_REQ.html
118+
#[corresponds(i2d_TS_REQ)]
126119
to_der,
127120
ffi::i2d_TS_REQ
128121
}
129122
}
130123

131124
impl TsReq {
132125
/// Creates a new timestamp request.
133-
///
134-
/// This corresponds to `TS_REQ_new`.
126+
#[corresponds(TS_REQ_new)]
135127
pub fn new() -> Result<TsReq, ErrorStack> {
136128
unsafe {
137129
ffi::init();
@@ -143,15 +135,13 @@ impl TsReq {
143135
/// Set the version of the timestamp request.
144136
///
145137
/// RFC 3161 requires this to be 1.
146-
///
147-
/// This corresponds to `TS_REQ_set_version`.
138+
#[corresponds(TS_REQ_set_version)]
148139
pub fn set_version(&mut self, version: c_long) -> Result<(), ErrorStack> {
149140
unsafe { cvt(ffi::TS_REQ_set_version(self.as_ptr(), version)).map(|_| ()) }
150141
}
151142

152143
/// Set the message imprint.
153-
///
154-
/// This corresponds to `TS_REQ_set_msg_imprint`.
144+
#[corresponds(TS_REQ_set_msg_imprint)]
155145
pub fn set_msg_imprint(&mut self, imprint: &TsMsgImprintRef) -> Result<(), ErrorStack> {
156146
unsafe { cvt(ffi::TS_REQ_set_msg_imprint(self.as_ptr(), imprint.as_ptr())).map(|_| ()) }
157147
}
@@ -166,22 +156,19 @@ impl TsReq {
166156
}
167157

168158
/// Sets the OID of the policy under which we're requesting the timestamp.
169-
///
170-
/// This corresponds to `TS_REQ_set_policy_id`.
159+
#[corresponds(TS_REQ_set_policy_id)]
171160
pub fn set_policy_id(&mut self, policy: &Asn1ObjectRef) -> Result<(), ErrorStack> {
172161
unsafe { cvt(ffi::TS_REQ_set_policy_id(self.as_ptr(), policy.as_ptr())).map(|_| ()) }
173162
}
174163

175164
/// Sets the nonce.
176-
///
177-
/// This corresopnds to `TS_REQ_set_nonce`.
165+
#[corresponds(TS_REQ_set_nonce)]
178166
pub fn set_nonce(&mut self, nonce: &Asn1IntegerRef) -> Result<(), ErrorStack> {
179167
unsafe { cvt(ffi::TS_REQ_set_nonce(self.as_ptr(), nonce.as_ptr())).map(|_| ()) }
180168
}
181169

182170
/// Sets whether to request the public key certificate in the response.
183-
///
184-
/// This corresponds to `TS_REQ_set_cert_req`.
171+
#[corresponds(TS_REQ_set_cert_req)]
185172
pub fn set_cert_req(&mut self, cert_req: bool) -> Result<(), ErrorStack> {
186173
unsafe { cvt(ffi::TS_REQ_set_cert_req(self.as_ptr(), cert_req as c_int)).map(|_| ()) }
187174
}
@@ -201,10 +188,7 @@ foreign_type_and_impl_send_sync! {
201188
impl TsResp {
202189
from_der! {
203190
/// Deserializes a DER-encoded TimeStampResp structure.
204-
///
205-
/// This corresponds to [`d2i_TS_RESP`].
206-
///
207-
/// [`d2i_TS_RESP`]: https://www.openssl.org/docs/man1.1.0/man3/d2i_TS_RESP.html
191+
#[corresponds(d2i_TS_RESP)]
208192
from_der,
209193
TsResp,
210194
ffi::d2i_TS_RESP
@@ -214,17 +198,13 @@ impl TsResp {
214198
impl TsRespRef {
215199
to_der! {
216200
/// Serializes the timestamp request into a DER-encoded TimeStampResp structure.
217-
///
218-
/// This corresponds to [`i2d_TS_RESP`].
219-
///
220-
/// [`i2d_TS_RESP`]: https://www.openssl.org/docs/man1.1.0/man3/i2d_TS_RESP.html
201+
#[corresponds(i2d_TS_RESP)]
221202
to_der,
222203
ffi::i2d_TS_RESP
223204
}
224205

225206
/// Verifies a timestamp response.
226-
///
227-
/// This corresponds to `TS_RESP_verify_response`.
207+
#[corresponds(TS_RESP_verify_response)]
228208
pub fn verify(&self, context: &TsVerifyContext) -> Result<(), ErrorStack> {
229209
unsafe {
230210
cvt(ffi::TS_RESP_verify_response(
@@ -300,8 +280,7 @@ foreign_type_and_impl_send_sync! {
300280

301281
impl TsRespContextRef {
302282
/// Creates a signed timestamp response for the request.
303-
///
304-
/// This corresponds to `TS_RESP_create_response`.
283+
#[corresponds(TS_RESP_create_response)]
305284
pub fn create_response(&mut self, request: &TsReqRef) -> Result<TsResp, ErrorStack> {
306285
unsafe {
307286
let der = request.to_der()?;
@@ -314,8 +293,7 @@ impl TsRespContextRef {
314293

315294
impl TsRespContext {
316295
/// Creates a new response context.
317-
///
318-
/// This corresponds to `TS_RESP_CTX_new`.
296+
#[corresponds(TS_RESP_CTX_new)]
319297
pub fn new() -> Result<TsRespContext, ErrorStack> {
320298
unsafe {
321299
ffi::init();
@@ -325,8 +303,7 @@ impl TsRespContext {
325303
}
326304

327305
/// Sets the OID of the default policy used by the TSA.
328-
///
329-
/// This corresponds to `TS_RESP_CTX_set_def_policy`.
306+
#[corresponds(TS_RESP_CTX_set_def_policy)]
330307
pub fn set_default_policy(&mut self, policy: &Asn1ObjectRef) -> Result<(), ErrorStack> {
331308
unsafe {
332309
cvt(ffi::TS_RESP_CTX_set_def_policy(

0 commit comments

Comments
 (0)