File tree 5 files changed +39
-4
lines changed
openssl-sys/src/handwritten
5 files changed +39
-4
lines changed Original file line number Diff line number Diff line change @@ -644,6 +644,8 @@ const_ptr_api! {
644
644
extern "C" {
645
645
#[ cfg( any( ossl110, libressl270) ) ]
646
646
pub fn X509_STORE_get0_objects ( ctx: #[ const_ptr_if( ossl300) ] X509_STORE ) -> * mut stack_st_X509_OBJECT;
647
+ #[ cfg( ossl300) ]
648
+ pub fn X509_STORE_get1_all_certs ( ctx: * mut X509_STORE ) -> * mut stack_st_X509;
647
649
}
648
650
}
649
651
Original file line number Diff line number Diff line change @@ -581,7 +581,8 @@ impl CipherCtxRef {
581
581
/// output size check removed. It can be used when the exact
582
582
/// buffer size control is maintained by the caller.
583
583
///
584
- /// SAFETY: The caller is expected to provide `output` buffer
584
+ /// # Safety
585
+ /// The caller is expected to provide `output` buffer
585
586
/// large enough to contain correct number of bytes. For streaming
586
587
/// ciphers the output buffer size should be at least as big as
587
588
/// the input buffer. For block ciphers the size of the output
@@ -693,7 +694,8 @@ impl CipherCtxRef {
693
694
/// This function is the same as [`Self::cipher_final`] but with
694
695
/// the output buffer size check removed.
695
696
///
696
- /// SAFETY: The caller is expected to provide `output` buffer
697
+ /// # Safety
698
+ /// The caller is expected to provide `output` buffer
697
699
/// large enough to contain correct number of bytes. For streaming
698
700
/// ciphers the output buffer can be empty, for block ciphers the
699
701
/// output buffer should be at least as big as the block.
Original file line number Diff line number Diff line change 119
119
//! ```
120
120
#![ doc( html_root_url = "https://docs.rs/openssl/0.10" ) ]
121
121
#![ warn( rust_2018_idioms) ]
122
- #![ allow( clippy:: uninlined_format_args) ]
122
+ #![ allow( clippy:: uninlined_format_args, clippy :: needless_doctest_main ) ]
123
123
124
124
#[ doc( inline) ]
125
125
pub use ffi:: init;
Original file line number Diff line number Diff line change 42
42
//! ```
43
43
44
44
use cfg_if:: cfg_if;
45
- use foreign_types:: ForeignTypeRef ;
45
+ use foreign_types:: { ForeignType , ForeignTypeRef } ;
46
46
use std:: mem;
47
47
48
48
use crate :: error:: ErrorStack ;
49
49
#[ cfg( not( boringssl) ) ]
50
50
use crate :: ssl:: SslFiletype ;
51
+ #[ cfg( ossl300) ]
52
+ use crate :: stack:: Stack ;
51
53
use crate :: stack:: StackRef ;
52
54
#[ cfg( any( ossl102, libressl261) ) ]
53
55
use crate :: x509:: verify:: { X509VerifyFlags , X509VerifyParamRef } ;
@@ -260,10 +262,24 @@ foreign_type_and_impl_send_sync! {
260
262
261
263
impl X509StoreRef {
262
264
/// Get a reference to the cache of certificates in this store.
265
+ ///
266
+ /// This method is deprecated. It is **unsound** and will be removed in a
267
+ /// future version of rust-openssl. `X509StoreRef::all_certificates`
268
+ /// should be used instead.
269
+ #[ deprecated(
270
+ note = "This method is unsound, and will be removed in a future version of rust-openssl. X509StoreRef::all_certificates should be used instead."
271
+ ) ]
263
272
#[ corresponds( X509_STORE_get0_objects ) ]
264
273
pub fn objects ( & self ) -> & StackRef < X509Object > {
265
274
unsafe { StackRef :: from_ptr ( X509_STORE_get0_objects ( self . as_ptr ( ) ) ) }
266
275
}
276
+
277
+ /// Returns a stack of all the certificates in this store.
278
+ #[ corresponds( X509_STORE_get1_all_certs ) ]
279
+ #[ cfg( ossl300) ]
280
+ pub fn all_certificates ( & self ) -> Stack < X509 > {
281
+ unsafe { Stack :: from_ptr ( ffi:: X509_STORE_get1_all_certs ( self . as_ptr ( ) ) ) }
282
+ }
267
283
}
268
284
269
285
cfg_if ! {
Original file line number Diff line number Diff line change @@ -1177,3 +1177,18 @@ fn test_dist_point_null() {
1177
1177
let cert = X509 :: from_pem ( cert) . unwrap ( ) ;
1178
1178
assert ! ( cert. crl_distribution_points( ) . is_none( ) ) ;
1179
1179
}
1180
+
1181
+ #[ test]
1182
+ #[ cfg( ossl300) ]
1183
+ fn test_store_all_certificates ( ) {
1184
+ let cert = include_bytes ! ( "../../test/cert.pem" ) ;
1185
+ let cert = X509 :: from_pem ( cert) . unwrap ( ) ;
1186
+
1187
+ let store = {
1188
+ let mut b = X509StoreBuilder :: new ( ) . unwrap ( ) ;
1189
+ b. add_cert ( cert) . unwrap ( ) ;
1190
+ b. build ( )
1191
+ } ;
1192
+
1193
+ assert_eq ! ( store. all_certificates( ) . len( ) , 1 ) ;
1194
+ }
You can’t perform that action at this time.
0 commit comments