File tree Expand file tree Collapse file tree 4 files changed +55
-1
lines changed
openssl-sys/src/handwritten Expand file tree Collapse file tree 4 files changed +55
-1
lines changed Original file line number Diff line number Diff line change @@ -644,6 +644,8 @@ const_ptr_api! {
644644 extern "C" {
645645 #[ cfg( any( ossl110, libressl270) ) ]
646646 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;
647649 }
648650}
649651
Original file line number Diff line number Diff line change @@ -696,6 +696,27 @@ impl Crypter {
696696 self . ctx . cipher_update ( input, Some ( output) )
697697 }
698698
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+
699720 /// Finishes the encryption/decryption process, writing any remaining data
700721 /// to `output`.
701722 ///
Original file line number Diff line number Diff line change 4242//! ```
4343
4444use cfg_if:: cfg_if;
45- use foreign_types:: ForeignTypeRef ;
45+ use foreign_types:: { ForeignType , ForeignTypeRef } ;
4646use std:: mem;
4747
4848use crate :: error:: ErrorStack ;
4949#[ cfg( not( boringssl) ) ]
5050use crate :: ssl:: SslFiletype ;
51+ #[ cfg( ossl300) ]
52+ use crate :: stack:: Stack ;
5153use crate :: stack:: StackRef ;
5254#[ cfg( any( ossl102, libressl261) ) ]
5355use crate :: x509:: verify:: { X509VerifyFlags , X509VerifyParamRef } ;
@@ -260,10 +262,24 @@ foreign_type_and_impl_send_sync! {
260262
261263impl X509StoreRef {
262264 /// 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+ ) ]
263272 #[ corresponds( X509_STORE_get0_objects ) ]
264273 pub fn objects ( & self ) -> & StackRef < X509Object > {
265274 unsafe { StackRef :: from_ptr ( X509_STORE_get0_objects ( self . as_ptr ( ) ) ) }
266275 }
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+ }
267283}
268284
269285cfg_if ! {
Original file line number Diff line number Diff line change @@ -1177,3 +1177,18 @@ fn test_dist_point_null() {
11771177 let cert = X509 :: from_pem ( cert) . unwrap ( ) ;
11781178 assert ! ( cert. crl_distribution_points( ) . is_none( ) ) ;
11791179}
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