Add conf module
This commit is contained in:
parent
b83edbad0d
commit
1939e6fd78
|
|
@ -24,6 +24,7 @@ pub enum ASN1_TYPE {}
|
||||||
pub enum BN_CTX {}
|
pub enum BN_CTX {}
|
||||||
pub enum BN_GENCB {}
|
pub enum BN_GENCB {}
|
||||||
pub enum CONF {}
|
pub enum CONF {}
|
||||||
|
pub enum CONF_METHOD {}
|
||||||
pub enum COMP_METHOD {}
|
pub enum COMP_METHOD {}
|
||||||
pub enum EC_KEY {}
|
pub enum EC_KEY {}
|
||||||
pub enum ENGINE {}
|
pub enum ENGINE {}
|
||||||
|
|
@ -1329,6 +1330,10 @@ extern {
|
||||||
pub fn BN_bn2hex(a: *const BIGNUM) -> *mut c_char;
|
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 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,
|
pub fn CRYPTO_memcmp(a: *const c_void, b: *const c_void,
|
||||||
len: size_t) -> c_int;
|
len: size_t) -> c_int;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
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) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -65,6 +65,7 @@ mod bio;
|
||||||
mod util;
|
mod util;
|
||||||
pub mod asn1;
|
pub mod asn1;
|
||||||
pub mod bn;
|
pub mod bn;
|
||||||
|
pub mod conf;
|
||||||
pub mod crypto;
|
pub mod crypto;
|
||||||
pub mod dh;
|
pub mod dh;
|
||||||
pub mod dsa;
|
pub mod dsa;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue