Commit 1939e6fd authored by Steven Fackler's avatar Steven Fackler
Browse files

Add conf module

parent b83edbad
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ pub enum ASN1_TYPE {}
pub enum BN_CTX {}
pub enum BN_GENCB {}
pub enum CONF {}
pub enum CONF_METHOD {}
pub enum COMP_METHOD {}
pub enum EC_KEY {}
pub enum ENGINE {}
@@ -1329,6 +1330,10 @@ extern {
    pub fn BN_bn2hex(a: *const BIGNUM) -> *mut c_char;
    pub fn BN_to_ASN1_INTEGER(bn: *const BIGNUM, ai: *mut ASN1_INTEGER) -> *mut ASN1_INTEGER;

    pub fn NCONF_default() -> *mut CONF_METHOD;
    pub fn NCONF_new(meth: *mut CONF_METHOD) -> *mut CONF;
    pub fn NCONF_free(conf: *mut CONF);

    pub fn CRYPTO_memcmp(a: *const c_void, b: *const c_void,
                         len: size_t) -> c_int;

openssl/src/conf.rs

0 → 100644
+28 −0
Original line number Diff line number Diff line
use ffi;

use cvt_p;
use error::ErrorStack;

pub struct ConfMethod(*mut ffi::CONF_METHOD);

impl ConfMethod {
    pub fn default() -> ConfMethod {
        unsafe { ConfMethod(ffi::NCONF_default()) }
    }

    pub unsafe fn from_ptr(ptr: *mut ffi::CONF_METHOD) -> ConfMethod {
        ConfMethod(ptr)
    }

    pub fn as_ptr(&self) -> *mut ffi::CONF_METHOD {
        self.0
    }
}

type_!(Conf, ConfRef, ffi::CONF, ffi::NCONF_free);

impl Conf {
    pub fn new(method: ConfMethod) -> Result<Conf, ErrorStack> {
        unsafe { cvt_p(ffi::NCONF_new(method.as_ptr())).map(Conf) }
    }
}
+1 −0
Original line number Diff line number Diff line
@@ -65,6 +65,7 @@ mod bio;
mod util;
pub mod asn1;
pub mod bn;
pub mod conf;
pub mod crypto;
pub mod dh;
pub mod dsa;