Commit 1edb6f68 authored by Steven Fackler's avatar Steven Fackler
Browse files

Support client CA advertisement

parent a4e0581e
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1580,6 +1580,7 @@ extern {
    pub fn SSL_get_privatekey(ssl: *mut SSL) -> *mut EVP_PKEY;
    #[cfg(not(ossl101))]
    pub fn SSL_get_privatekey(ssl: *const SSL) -> *mut EVP_PKEY;
    pub fn SSL_load_client_CA_file(file: *const c_char) -> *mut stack_st_X509_NAME;

    #[cfg(not(osslconf = "OPENSSL_NO_COMP"))]
    pub fn SSL_COMP_get_name(comp: *const COMP_METHOD) -> *const c_char;
@@ -1610,6 +1611,7 @@ extern {
    pub fn SSL_CTX_use_PrivateKey_file(ctx: *mut SSL_CTX, key_file: *const c_char, file_type: c_int) -> c_int;
    pub fn SSL_CTX_use_PrivateKey(ctx: *mut SSL_CTX, key: *mut EVP_PKEY) -> c_int;
    pub fn SSL_CTX_check_private_key(ctx: *const SSL_CTX) -> c_int;
    pub fn SSL_CTX_set_client_CA_list(ctx: *mut SSL_CTX, list: *mut stack_st_X509_NAME);

    #[cfg(not(ossl101))]
    pub fn SSL_CTX_get0_certificate(ctx: *const SSL_CTX) -> *mut X509;
+5 −0
Original line number Diff line number Diff line
@@ -16,6 +16,11 @@ pub struct stack_st_X509 {
    pub stack: _STACK,
}

#[repr(C)]
pub struct stack_st_X509_NAME {
    pub stack: _STACK,
}

#[repr(C)]
pub struct stack_st_X509_ATTRIBUTE {
    pub stack: _STACK,
+1 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ pub enum stack_st_GENERAL_NAME {}
pub enum stack_st_OPENSSL_STRING {}
pub enum stack_st_void {}
pub enum stack_st_X509 {}
pub enum stack_st_X509_NAME {}
pub enum stack_st_X509_ATTRIBUTE {}
pub enum stack_st_X509_EXTENSION {}
pub enum X509 {}
+0 −1
Original line number Diff line number Diff line
@@ -277,7 +277,6 @@ mod verify {
    use nid;
    use x509::{X509StoreContextRef, X509Ref, X509NameRef, GeneralName};
    use stack::Stack;
    use types::OpenSslTypeRef;

    pub fn verify_callback(domain: &str,
                           preverify_ok: bool,
+12 −1
Original line number Diff line number Diff line
@@ -93,13 +93,14 @@ use std::sync::Mutex;
use {init, cvt, cvt_p};
use dh::DhRef;
use ec_key::EcKeyRef;
use x509::{X509StoreContextRef, X509FileType, X509, X509Ref, X509VerifyError};
use x509::{X509StoreContextRef, X509FileType, X509, X509Ref, X509VerifyError, X509Name};
#[cfg(any(ossl102, ossl110))]
use verify::X509VerifyParamRef;
use pkey::PKeyRef;
use error::ErrorStack;
use types::{OpenSslType, OpenSslTypeRef};
use util::Opaque;
use stack::Stack;

mod error;
mod connector;
@@ -542,6 +543,16 @@ impl SslContextBuilder {
        }
    }

    /// Sets the list of CAs sent to the client.
    ///
    /// The CA certificates must still be added to the trust root.
    pub fn set_client_ca_list(&mut self, list: Stack<X509Name>) {
        unsafe {
            ffi::SSL_CTX_set_client_CA_list(self.as_ptr(), list.as_ptr());
            mem::forget(list);
        }
    }

    /// Set the context identifier for sessions
    ///
    /// This value identifies the server's session cache to a clients, telling them when they're
Loading