@@ -11,12 +11,12 @@ use openssl_macros::corresponds;
11
11
use std:: convert:: TryFrom ;
12
12
use std:: ptr;
13
13
14
- use crate :: asn1:: { Asn1IntegerRef , Asn1ObjectRef , Asn1OctetString } ;
14
+ use crate :: asn1:: { Asn1IntegerRef , Asn1ObjectRef , Asn1OctetString , Asn1StringRef } ;
15
15
use crate :: bio:: MemBioSlice ;
16
16
use crate :: error:: ErrorStack ;
17
17
use crate :: hash:: { Hasher , MessageDigest } ;
18
18
use crate :: pkey:: { HasPrivate , PKeyRef } ;
19
- use crate :: util:: ForeignTypeExt ;
19
+ use crate :: util:: { ForeignTypeExt , ForeignTypeRefExt } ;
20
20
use crate :: x509:: { X509Algorithm , X509AlgorithmRef , X509Ref } ;
21
21
use crate :: { cvt, cvt_p} ;
22
22
@@ -243,6 +243,19 @@ impl TsRespRef {
243
243
. map ( |_| ( ) )
244
244
}
245
245
}
246
+
247
+ // idk what the null-ness guarantees of this function is as it's not documented in openssl
248
+ #[ corresponds( TS_RESP_get_tst_info ) ]
249
+ pub fn get_tst ( & self ) -> Option < & TsTstInfoRef > {
250
+ unsafe {
251
+ let info = ffi:: TS_RESP_get_tst_info ( self . as_ptr ( ) ) ;
252
+ if info. is_null ( ) {
253
+ None
254
+ } else {
255
+ Some ( TsTstInfoRef :: from_const_ptr ( info) )
256
+ }
257
+ }
258
+ }
246
259
}
247
260
248
261
bitflags ! {
@@ -397,6 +410,28 @@ impl TsRespContext {
397
410
}
398
411
}
399
412
413
+ foreign_type_and_impl_send_sync ! {
414
+ type CType = ffi:: TS_TST_INFO ;
415
+ fn drop = ffi:: TS_TST_INFO_free ;
416
+ pub struct TsTstInfo ;
417
+ pub struct TsTstInfoRef ;
418
+ }
419
+
420
+ impl TsTstInfoRef {
421
+ // idk what the null-ness guarantees of this function is as it's not documented in openssl
422
+ #[ corresponds( TS_TST_INFO_get_time ) ]
423
+ pub fn get_time ( & self ) -> Option < & Asn1StringRef > {
424
+ unsafe {
425
+ let ptr = ffi:: TS_TST_INFO_get_time ( self . as_ptr ( ) ) ;
426
+ if ptr. is_null ( ) {
427
+ None
428
+ } else {
429
+ Some ( Asn1StringRef :: from_const_ptr ( ptr) )
430
+ }
431
+ }
432
+ }
433
+ }
434
+
400
435
#[ cfg( test) ]
401
436
mod tests {
402
437
use super :: * ;
0 commit comments