Commit d081c2b5 authored by Steven Fackler's avatar Steven Fackler
Browse files

Update to 3.0.0-alpha5

parent 17ef4bb1
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -121,9 +121,9 @@ cfg_if! {
}

extern "C" {
    #[cfg(ossl101)]
    #[cfg(all(ossl101, not(ossl300)))]
    pub fn FIPS_mode() -> c_int;
    #[cfg(ossl101)]
    #[cfg(all(ossl101, not(ossl300)))]
    pub fn FIPS_mode_set(onoff: c_int) -> c_int;

    pub fn CRYPTO_memcmp(a: *const c_void, b: *const c_void, len: size_t) -> c_int;
+7 −1
Original line number Diff line number Diff line
use libc::*;

cfg_if! {
    if #[cfg(ossl300)] {
        pub const DTLS1_COOKIE_LENGTH: c_uint = 255;
    } else {
        pub const DTLS1_COOKIE_LENGTH: c_uint = 256;
    }
}
+57 −14
Original line number Diff line number Diff line
@@ -3,8 +3,49 @@ use libc::*;
pub const ERR_TXT_MALLOCED: c_int = 0x01;
pub const ERR_TXT_STRING: c_int = 0x02;

pub const ERR_LIB_SYS: c_int = 2;
pub const ERR_LIB_PEM: c_int = 9;

cfg_if! {
    if #[cfg(ossl300)] {
        pub const ERR_SYSTEM_FLAG: c_ulong = c_int::max_value() as c_ulong + 1;
        pub const ERR_SYSTEM_MASK: c_ulong = c_int::max_value() as c_ulong;

        pub const ERR_LIB_OFFSET: c_ulong = 23;
        pub const ERR_LIB_MASK: c_ulong = 0xff;
        pub const ERR_RFLAGS_OFFSET: c_ulong = 19;
        pub const ERR_RFLAGS_MASK: c_ulong = 0xf;
        pub const ERR_REASON_MASK: c_ulong = 0x7FFFFF;

        pub const ERR_RFLAG_FATAL: c_ulong = 0x1 << ERR_RFLAGS_OFFSET;

        const_fn! {
            pub const fn ERR_SYSTEM_ERROR(errcode: c_ulong) -> bool {
                errcode & ERR_SYSTEM_FLAG != 0
            }

            pub const fn ERR_GET_LIB(errcode: c_ulong) -> c_int {
                // hacks since `if` isn't yet stable in const functions :(
                ((ERR_LIB_SYS as c_ulong * (ERR_SYSTEM_ERROR(errcode) as c_ulong)) |
                (((errcode >> ERR_LIB_OFFSET) & ERR_LIB_MASK)) * (!ERR_SYSTEM_ERROR(errcode) as c_ulong)) as c_int
            }

            pub const fn ERR_GET_FUNC(_errcode: c_ulong) -> c_int {
                0
            }

            pub const fn ERR_GET_REASON(errcode: c_ulong) -> c_int {
                // hacks since `if` isn't yet stable in const functions :(
                ((ERR_LIB_SYS as c_ulong * (ERR_SYSTEM_ERROR(errcode) as c_ulong)) |
                ((errcode & ERR_REASON_MASK)) * (!ERR_SYSTEM_ERROR(errcode) as c_ulong)) as c_int
            }

            pub const fn ERR_PACK(lib: c_int, _func: c_int, reason: c_int) -> c_ulong {
                ((lib as c_ulong & ERR_LIB_MASK) << ERR_LIB_OFFSET) |
                ((reason as c_ulong & ERR_REASON_MASK))
            }
        }
    } else {
        const_fn! {
            pub const fn ERR_PACK(l: c_int, f: c_int, r: c_int) -> c_ulong {
                ((l as c_ulong & 0x0FF) << 24) |
@@ -24,6 +65,8 @@ const_fn! {
                (l & 0xFFF) as c_int
            }
        }
    }
}

#[repr(C)]
pub struct ERR_STRING_DATA {
+3 −0
Original line number Diff line number Diff line
@@ -1000,7 +1000,10 @@ extern "C" {
        len: c_long,
    ) -> *mut SSL_SESSION;

    #[cfg(not(ossl300))]
    pub fn SSL_get_peer_certificate(ssl: *const SSL) -> *mut X509;
    #[cfg(ossl300)]
    pub fn SSL_get1_peer_certificate(ssl: *const SSL) -> *mut X509;

    pub fn SSL_get_peer_cert_chain(ssl: *const SSL) -> *mut stack_st_X509;

+1 −1
Original line number Diff line number Diff line
@@ -154,7 +154,7 @@ pub mod ecdsa;
pub mod envelope;
pub mod error;
pub mod ex_data;
#[cfg(not(libressl))]
#[cfg(not(any(libressl, ossl300)))]
pub mod fips;
pub mod hash;
pub mod memcmp;
Loading