diff options
| author | Steven Fackler <[email protected]> | 2014-06-29 13:36:02 -0700 |
|---|---|---|
| committer | Steven Fackler <[email protected]> | 2014-06-29 13:36:02 -0700 |
| commit | 8c40c2ef3527fbcf22f11a517422b371b4626852 (patch) | |
| tree | 03fd71358fd3790628331932a77fd4adf9e55baa /ssl | |
| parent | Drop to version 0.0.0 (diff) | |
| download | rust-openssl-8c40c2ef3527fbcf22f11a517422b371b4626852.tar.xz rust-openssl-8c40c2ef3527fbcf22f11a517422b371b4626852.zip | |
Update for * -> *const change
Diffstat (limited to 'ssl')
| -rw-r--r-- | ssl/ffi.rs | 94 | ||||
| -rw-r--r-- | ssl/mod.rs | 38 |
2 files changed, 66 insertions, 66 deletions
@@ -12,16 +12,16 @@ pub type X509 = c_void; pub type X509_NAME = c_void; pub type CRYPTO_EX_DATA = c_void; -pub type CRYPTO_EX_new = extern "C" fn(parent: *c_void, ptr: *c_void, - ad: *CRYPTO_EX_DATA, idx: c_int, - argl: c_long, argp: *c_void) -> c_int; -pub type CRYPTO_EX_dup = extern "C" fn(to: *CRYPTO_EX_DATA, - from: *CRYPTO_EX_DATA, from_d: *c_void, - idx: c_int, argl: c_long, argp: *c_void) +pub type CRYPTO_EX_new = extern "C" fn(parent: *mut c_void, ptr: *mut c_void, + ad: *const CRYPTO_EX_DATA, idx: c_int, + argl: c_long, argp: *const c_void) -> c_int; +pub type CRYPTO_EX_dup = extern "C" fn(to: *mut CRYPTO_EX_DATA, + from: *mut CRYPTO_EX_DATA, from_d: *mut c_void, + idx: c_int, argl: c_long, argp: *mut c_void) -> c_int; -pub type CRYPTO_EX_free = extern "C" fn(parent: *c_void, ptr: *c_void, - ad: *CRYPTO_EX_DATA, idx: c_int, - argl: c_long, argp: *c_void); +pub type CRYPTO_EX_free = extern "C" fn(parent: *mut c_void, ptr: *mut c_void, + ad: *mut CRYPTO_EX_DATA, idx: c_int, + argl: c_long, argp: *mut c_void); pub static CRYPTO_LOCK: c_int = 1; @@ -103,7 +103,7 @@ extern "C" { pub fn CRYPTO_num_locks() -> c_int; pub fn CRYPTO_set_locking_callback(func: extern "C" fn(mode: c_int, n: c_int, - file: *c_char, + file: *const c_char, line: c_int)); pub fn ERR_get_error() -> c_ulong; @@ -111,50 +111,50 @@ extern "C" { pub fn SSL_library_init() -> c_int; #[cfg(sslv2)] - pub fn SSLv2_method() -> *SSL_METHOD; - pub fn SSLv3_method() -> *SSL_METHOD; - pub fn TLSv1_method() -> *SSL_METHOD; - pub fn SSLv23_method() -> *SSL_METHOD; - - pub fn SSL_CTX_new(method: *SSL_METHOD) -> *SSL_CTX; - pub fn SSL_CTX_free(ctx: *SSL_CTX); - pub fn SSL_CTX_set_verify(ctx: *SSL_CTX, mode: c_int, - verify_callback: Option<extern fn(c_int, *X509_STORE_CTX) -> c_int>); - pub fn SSL_CTX_load_verify_locations(ctx: *SSL_CTX, CAfile: *c_char, - CApath: *c_char) -> c_int; - pub fn SSL_CTX_get_ex_new_index(argl: c_long, argp: *c_void, + pub fn SSLv2_method() -> *const SSL_METHOD; + pub fn SSLv3_method() -> *const SSL_METHOD; + pub fn TLSv1_method() -> *const SSL_METHOD; + pub fn SSLv23_method() -> *const SSL_METHOD; + + pub fn SSL_CTX_new(method: *const SSL_METHOD) -> *mut SSL_CTX; + pub fn SSL_CTX_free(ctx: *mut SSL_CTX); + pub fn SSL_CTX_set_verify(ctx: *mut SSL_CTX, mode: c_int, + verify_callback: Option<extern fn(c_int, *mut X509_STORE_CTX) -> c_int>); + pub fn SSL_CTX_load_verify_locations(ctx: *mut SSL_CTX, CAfile: *const c_char, + CApath: *const c_char) -> c_int; + pub fn SSL_CTX_get_ex_new_index(argl: c_long, argp: *const c_void, new_func: Option<CRYPTO_EX_new>, dup_func: Option<CRYPTO_EX_dup>, free_func: Option<CRYPTO_EX_free>) -> c_int; - pub fn SSL_CTX_set_ex_data(ctx: *SSL_CTX, idx: c_int, data: *c_void) + pub fn SSL_CTX_set_ex_data(ctx: *mut SSL_CTX, idx: c_int, data: *mut c_void) -> c_int; - pub fn SSL_CTX_get_ex_data(ctx: *SSL_CTX, idx: c_int) -> *c_void; - - pub fn X509_STORE_CTX_get_ex_data(ctx: *X509_STORE_CTX, idx: c_int) - -> *c_void; - pub fn X509_STORE_CTX_get_current_cert(ct: *X509_STORE_CTX) -> *X509; - pub fn X509_STORE_CTX_get_error(ctx: *X509_STORE_CTX) -> c_int; - - pub fn X509_get_subject_name(x: *X509) -> *X509_NAME; - - pub fn SSL_new(ctx: *SSL_CTX) -> *SSL; - pub fn SSL_free(ssl: *SSL); - pub fn SSL_set_bio(ssl: *SSL, rbio: *BIO, wbio: *BIO); - pub fn SSL_get_rbio(ssl: *SSL) -> *BIO; - pub fn SSL_get_wbio(ssl: *SSL) -> *BIO; - pub fn SSL_connect(ssl: *SSL) -> c_int; - pub fn SSL_get_error(ssl: *SSL, ret: c_int) -> c_int; - pub fn SSL_read(ssl: *SSL, buf: *c_void, num: c_int) -> c_int; - pub fn SSL_write(ssl: *SSL, buf: *c_void, num: c_int) -> c_int; + pub fn SSL_CTX_get_ex_data(ctx: *mut SSL_CTX, idx: c_int) -> *mut c_void; + + pub fn X509_STORE_CTX_get_ex_data(ctx: *mut X509_STORE_CTX, idx: c_int) + -> *mut c_void; + pub fn X509_STORE_CTX_get_current_cert(ct: *mut X509_STORE_CTX) -> *mut X509; + pub fn X509_STORE_CTX_get_error(ctx: *mut X509_STORE_CTX) -> c_int; + + pub fn X509_get_subject_name(x: *mut X509) -> *mut X509_NAME; + + pub fn SSL_new(ctx: *mut SSL_CTX) -> *mut SSL; + pub fn SSL_free(ssl: *mut SSL); + pub fn SSL_set_bio(ssl: *mut SSL, rbio: *mut BIO, wbio: *mut BIO); + pub fn SSL_get_rbio(ssl: *mut SSL) -> *mut BIO; + pub fn SSL_get_wbio(ssl: *mut SSL) -> *mut BIO; + pub fn SSL_connect(ssl: *mut SSL) -> c_int; + pub fn SSL_get_error(ssl: *mut SSL, ret: c_int) -> c_int; + pub fn SSL_read(ssl: *mut SSL, buf: *mut c_void, num: c_int) -> c_int; + pub fn SSL_write(ssl: *mut SSL, buf: *const c_void, num: c_int) -> c_int; pub fn SSL_get_ex_data_X509_STORE_CTX_idx() -> c_int; - pub fn SSL_get_SSL_CTX(ssl: *SSL) -> *SSL_CTX; + pub fn SSL_get_SSL_CTX(ssl: *mut SSL) -> *mut SSL_CTX; - pub fn BIO_s_mem() -> *BIO_METHOD; - pub fn BIO_new(type_: *BIO_METHOD) -> *BIO; - pub fn BIO_free_all(a: *BIO); - pub fn BIO_read(b: *BIO, buf: *c_void, len: c_int) -> c_int; - pub fn BIO_write(b: *BIO, buf: *c_void, len: c_int) -> c_int; + pub fn BIO_s_mem() -> *const BIO_METHOD; + pub fn BIO_new(type_: *const BIO_METHOD) -> *mut BIO; + pub fn BIO_free_all(a: *mut BIO); + pub fn BIO_read(b: *mut BIO, buf: *mut c_void, len: c_int) -> c_int; + pub fn BIO_write(b: *mut BIO, buf: *const c_void, len: c_int) -> c_int; } #[cfg(target_os = "win32")] @@ -58,7 +58,7 @@ pub enum SslMethod { } impl SslMethod { - unsafe fn to_raw(&self) -> *ffi::SSL_METHOD { + unsafe fn to_raw(&self) -> *const ffi::SSL_METHOD { match *self { #[cfg(sslv2)] Sslv2 => ffi::SSLv2_method(), @@ -77,7 +77,7 @@ pub enum SslVerifyMode { SslVerifyNone = ffi::SSL_VERIFY_NONE } -extern fn locking_function(mode: c_int, n: c_int, _file: *c_char, +extern fn locking_function(mode: c_int, n: c_int, _file: *const c_char, _line: c_int) { unsafe { let mutex = (*MUTEXES).get_mut(n as uint); @@ -90,7 +90,7 @@ extern fn locking_function(mode: c_int, n: c_int, _file: *c_char, } } -extern fn raw_verify(preverify_ok: c_int, x509_ctx: *ffi::X509_STORE_CTX) +extern fn raw_verify(preverify_ok: c_int, x509_ctx: *mut ffi::X509_STORE_CTX) -> c_int { unsafe { let idx = ffi::SSL_get_ex_data_X509_STORE_CTX_idx(); @@ -114,7 +114,7 @@ pub type VerifyCallback = fn(preverify_ok: bool, /// An SSL context object pub struct SslContext { - ctx: *ffi::SSL_CTX + ctx: *mut ffi::SSL_CTX } impl Drop for SslContext { @@ -129,7 +129,7 @@ impl SslContext { init(); let ctx = unsafe { ffi::SSL_CTX_new(method.to_raw()) }; - if ctx == ptr::null() { + if ctx == ptr::mut_null() { return Err(SslError::get()); } @@ -172,7 +172,7 @@ impl SslContext { } pub struct X509StoreContext { - ctx: *ffi::X509_STORE_CTX + ctx: *mut ffi::X509_STORE_CTX } impl X509StoreContext { @@ -196,7 +196,7 @@ impl X509StoreContext { /// A public key certificate pub struct X509<'ctx> { ctx: &'ctx X509StoreContext, - x509: *ffi::X509 + x509: *mut ffi::X509 } impl<'ctx> X509<'ctx> { @@ -209,7 +209,7 @@ impl<'ctx> X509<'ctx> { #[allow(dead_code)] pub struct X509Name<'x> { x509: &'x X509<'x>, - name: *ffi::X509_NAME + name: *mut ffi::X509_NAME } pub enum X509NameFormat { @@ -295,7 +295,7 @@ make_validation_error!(X509_V_OK, ) struct Ssl { - ssl: *ffi::SSL + ssl: *mut ffi::SSL } impl Drop for Ssl { @@ -307,18 +307,18 @@ impl Drop for Ssl { impl Ssl { fn try_new(ctx: &SslContext) -> Result<Ssl, SslError> { let ssl = unsafe { ffi::SSL_new(ctx.ctx) }; - if ssl == ptr::null() { + if ssl == ptr::mut_null() { return Err(SslError::get()); } let ssl = Ssl { ssl: ssl }; let rbio = unsafe { ffi::BIO_new(ffi::BIO_s_mem()) }; - if rbio == ptr::null() { + if rbio == ptr::mut_null() { return Err(SslError::get()); } let wbio = unsafe { ffi::BIO_new(ffi::BIO_s_mem()) }; - if wbio == ptr::null() { + if wbio == ptr::mut_null() { unsafe { ffi::BIO_free_all(rbio) } return Err(SslError::get()); } @@ -335,8 +335,8 @@ impl Ssl { unsafe { self.wrap_bio(ffi::SSL_get_wbio(self.ssl)) } } - fn wrap_bio<'a>(&'a self, bio: *ffi::BIO) -> MemBioRef<'a> { - assert!(bio != ptr::null()); + fn wrap_bio<'a>(&'a self, bio: *mut ffi::BIO) -> MemBioRef<'a> { + assert!(bio != ptr::mut_null()); MemBioRef { ssl: self, bio: MemBio { @@ -351,12 +351,12 @@ impl Ssl { } fn read(&self, buf: &mut [u8]) -> c_int { - unsafe { ffi::SSL_read(self.ssl, buf.as_ptr() as *c_void, + unsafe { ffi::SSL_read(self.ssl, buf.as_ptr() as *mut c_void, buf.len() as c_int) } } fn write(&self, buf: &[u8]) -> c_int { - unsafe { ffi::SSL_write(self.ssl, buf.as_ptr() as *c_void, + unsafe { ffi::SSL_write(self.ssl, buf.as_ptr() as *const c_void, buf.len() as c_int) } } @@ -399,7 +399,7 @@ impl<'ssl> MemBioRef<'ssl> { } struct MemBio { - bio: *ffi::BIO, + bio: *mut ffi::BIO, owned: bool } @@ -416,7 +416,7 @@ impl Drop for MemBio { impl MemBio { fn read(&self, buf: &mut [u8]) -> Option<uint> { let ret = unsafe { - ffi::BIO_read(self.bio, buf.as_ptr() as *c_void, + ffi::BIO_read(self.bio, buf.as_ptr() as *mut c_void, buf.len() as c_int) }; @@ -429,7 +429,7 @@ impl MemBio { fn write(&self, buf: &[u8]) { let ret = unsafe { - ffi::BIO_write(self.bio, buf.as_ptr() as *c_void, + ffi::BIO_write(self.bio, buf.as_ptr() as *const c_void, buf.len() as c_int) }; assert_eq!(buf.len(), ret as uint); |