Add Asn1BitString
This commit is contained in:
parent
e62847dae7
commit
a1d7956f82
|
|
@ -26,6 +26,7 @@ pub use libressl::*;
|
|||
pub enum ASN1_INTEGER {}
|
||||
pub enum ASN1_GENERALIZEDTIME {}
|
||||
pub enum ASN1_STRING {}
|
||||
pub enum ASN1_BIT_STRING {}
|
||||
pub enum ASN1_TIME {}
|
||||
pub enum ASN1_TYPE {}
|
||||
pub enum BN_CTX {}
|
||||
|
|
@ -1408,6 +1409,7 @@ extern {
|
|||
pub fn ASN1_STRING_type_new(ty: c_int) -> *mut ASN1_STRING;
|
||||
pub fn ASN1_TIME_free(tm: *mut ASN1_TIME);
|
||||
pub fn ASN1_TIME_print(b: *mut BIO, tm: *const ASN1_TIME) -> c_int;
|
||||
pub fn ASN1_BIT_STRING_free(x: *mut ASN1_BIT_STRING);
|
||||
|
||||
pub fn BIO_ctrl(b: *mut BIO, cmd: c_int, larg: c_long, parg: *mut c_void) -> c_long;
|
||||
pub fn BIO_free_all(b: *mut BIO);
|
||||
|
|
|
|||
|
|
@ -93,6 +93,24 @@ impl Asn1StringRef {
|
|||
}
|
||||
}
|
||||
|
||||
foreign_type! {
|
||||
type CType = ffi::ASN1_BIT_STRING;
|
||||
fn drop = ffi::ASN1_BIT_STRING_free;
|
||||
|
||||
pub struct Asn1BitString;
|
||||
pub struct Asn1BitStringRef;
|
||||
}
|
||||
|
||||
impl Asn1BitStringRef {
|
||||
pub fn as_slice(&self) -> &[u8] {
|
||||
unsafe { slice::from_raw_parts(ASN1_STRING_data(self.as_ptr() as *mut _), self.len()) }
|
||||
}
|
||||
|
||||
pub fn len(&self) -> usize {
|
||||
unsafe { ffi::ASN1_STRING_length(self.as_ptr() as *mut _) as usize }
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(ossl101, ossl102))]
|
||||
use ffi::ASN1_STRING_data;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue