File tree 4 files changed +55
-1
lines changed
openssl-sys/src/handwritten
4 files changed +55
-1
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 @@ -696,6 +696,27 @@ impl Crypter {
696
696
self . ctx . cipher_update ( input, Some ( output) )
697
697
}
698
698
699
+ /// Feeds data from `input` through the cipher, writing encrypted/decrypted
700
+ /// bytes into `output`.
701
+ ///
702
+ /// The number of bytes written to `output` is returned. Note that this may
703
+ /// not be equal to the length of `input`.
704
+ ///
705
+ /// # Safety
706
+ ///
707
+ /// The caller must provide an `output` buffer large enough to contain
708
+ /// correct number of bytes. For streaming ciphers the output buffer size
709
+ /// should be at least as big as the input buffer. For block ciphers the
710
+ /// size of the output buffer depends on the state of partially updated
711
+ /// blocks.
712
+ pub unsafe fn update_unchecked (
713
+ & mut self ,
714
+ input : & [ u8 ] ,
715
+ output : & mut [ u8 ] ,
716
+ ) -> Result < usize , ErrorStack > {
717
+ self . ctx . cipher_update_unchecked ( input, Some ( output) )
718
+ }
719
+
699
720
/// Finishes the encryption/decryption process, writing any remaining data
700
721
/// to `output`.
701
722
///
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