Loading openssl-sys/src/lib.rs +24 −0 Original line number Diff line number Diff line Loading @@ -1465,6 +1465,30 @@ pub const GEN_RID: c_int = 8; pub const DTLS1_COOKIE_LENGTH: c_uint = 256; #[cfg(not(libressl))] pub const CMS_TEXT: c_uint = 0x1; pub const CMS_NOCERTS: c_uint = 0x2; pub const CMS_NO_CONTENT_VERIFY: c_uint = 0x4; pub const CMS_NO_ATTR_VERIFY: c_uint = 0x8; pub const CMS_NOSIGS: c_uint = 0x4 | 0x8; pub const CMS_NOINTERN: c_uint = 0x10; pub const CMS_NO_SIGNER_CERT_VERIFY: c_uint = 0x20; pub const CMS_NOVERIFY: c_uint = 0x20; pub const CMS_DETACHED: c_uint = 0x40; pub const CMS_BINARY: c_uint = 0x80; pub const CMS_NOATTR: c_uint = 0x100; pub const CMS_NOSMIMECAP: c_uint = 0x200; pub const CMS_NOOLDMIMETYPE: c_uint = 0x400; pub const CMS_CRLFEOL: c_uint = 0x800; pub const CMS_STREAM: c_uint = 0x1000; pub const CMS_NOCRL: c_uint = 0x2000; pub const CMS_PARTIAL: c_uint = 0x4000; pub const CMS_REUSE_DIGEST: c_uint = 0x8000; pub const CMS_USE_KEYID: c_uint = 0x10000; pub const CMS_DEBUG_DECRYPT: c_uint = 0x20000; pub const CMS_KEY_PARAM: c_uint = 0x40000; pub const CMS_ASCIICRLF: c_uint = 0x80000; // macros pub unsafe fn BIO_get_mem_data(b: *mut BIO, pp: *mut *mut c_char) -> c_long { BIO_ctrl(b, BIO_CTRL_INFO, 0, pp as *mut c_void) Loading openssl/src/cms.rs +31 −24 Original line number Diff line number Diff line Loading @@ -11,35 +11,36 @@ use std::ptr; use bio::{MemBio, MemBioSlice}; use error::ErrorStack; use libc::c_uint; use pkey::{HasPrivate, PKeyRef}; use stack::Stack; use x509::X509; use {cvt, cvt_p}; bitflags! { pub struct CMSOptions : u32 { const CMS_TEXT = 0x1; const CMS_NOCERTS = 0x2; const CMS_NO_CONTENT_VERIFY = 0x4; const CMS_NO_ATTR_VERIFY = 0x8; const CMS_NOSIGS = 0x4 | 0x8; const CMS_NOINTERN = 0x10; const CMS_NO_SIGNER_CERT_VERIFY = 0x20; const CMS_NOVERIFY = 0x20; const CMS_DETACHED = 0x40; const CMS_BINARY = 0x80; const CMS_NOATTR = 0x100; const CMS_NOSMIMECAP = 0x200; const CMS_NOOLDMIMETYPE = 0x400; const CMS_CRLFEOL = 0x800; const CMS_STREAM = 0x1000; const CMS_NOCRL = 0x2000; const CMS_PARTIAL = 0x4000; const CMS_REUSE_DIGEST = 0x8000; const CMS_USE_KEYID = 0x10000; const CMS_DEBUG_DECRYPT = 0x20000; const CMS_KEY_PARAM = 0x40000; const CMS_ASCIICRLF = 0x80000; pub struct CMSOptions : c_uint { const TEXT = ffi::CMS_TEXT; const CMS_NOCERTS = ffi::CMS_NOCERTS; const NO_CONTENT_VERIFY = ffi::CMS_NO_CONTENT_VERIFY; const NO_ATTR_VERIFY = ffi::CMS_NO_ATTR_VERIFY; const NOSIGS = ffi::CMS_NOSIGS; const NOINTERN = ffi::CMS_NOINTERN; const NO_SIGNER_CERT_VERIFY = ffi::CMS_NO_SIGNER_CERT_VERIFY; const NOVERIFY = ffi::CMS_NOVERIFY; const DETACHED = ffi::CMS_DETACHED; const BINARY = ffi::CMS_BINARY; const NOATTR = ffi::CMS_NOATTR; const NOSMIMECAP = ffi::CMS_NOSMIMECAP; const NOOLDMIMETYPE = ffi::CMS_NOOLDMIMETYPE; const CRLFEOL = ffi::CMS_CRLFEOL; const STREAM = ffi::CMS_STREAM; const NOCRL = ffi::CMS_NOCRL; const PARTIAL = ffi::CMS_PARTIAL; const REUSE_DIGEST = ffi::CMS_REUSE_DIGEST; const USE_KEYID = ffi::CMS_USE_KEYID; const DEBUG_DECRYPT = ffi::CMS_DEBUG_DECRYPT; const KEY_PARAM = ffi::CMS_KEY_PARAM; const ASCIICRLF = ffi::CMS_ASCIICRLF; } } Loading Loading @@ -152,7 +153,13 @@ impl CmsContentInfo { None => ptr::null_mut(), }; let cms = cvt_p(ffi::CMS_sign(signcert, pkey, certs, data_bio_ptr, flags.bits()))?; let cms = cvt_p(ffi::CMS_sign( signcert, pkey, certs, data_bio_ptr, flags.bits(), ))?; Ok(CmsContentInfo::from_ptr(cms)) } Loading Loading
openssl-sys/src/lib.rs +24 −0 Original line number Diff line number Diff line Loading @@ -1465,6 +1465,30 @@ pub const GEN_RID: c_int = 8; pub const DTLS1_COOKIE_LENGTH: c_uint = 256; #[cfg(not(libressl))] pub const CMS_TEXT: c_uint = 0x1; pub const CMS_NOCERTS: c_uint = 0x2; pub const CMS_NO_CONTENT_VERIFY: c_uint = 0x4; pub const CMS_NO_ATTR_VERIFY: c_uint = 0x8; pub const CMS_NOSIGS: c_uint = 0x4 | 0x8; pub const CMS_NOINTERN: c_uint = 0x10; pub const CMS_NO_SIGNER_CERT_VERIFY: c_uint = 0x20; pub const CMS_NOVERIFY: c_uint = 0x20; pub const CMS_DETACHED: c_uint = 0x40; pub const CMS_BINARY: c_uint = 0x80; pub const CMS_NOATTR: c_uint = 0x100; pub const CMS_NOSMIMECAP: c_uint = 0x200; pub const CMS_NOOLDMIMETYPE: c_uint = 0x400; pub const CMS_CRLFEOL: c_uint = 0x800; pub const CMS_STREAM: c_uint = 0x1000; pub const CMS_NOCRL: c_uint = 0x2000; pub const CMS_PARTIAL: c_uint = 0x4000; pub const CMS_REUSE_DIGEST: c_uint = 0x8000; pub const CMS_USE_KEYID: c_uint = 0x10000; pub const CMS_DEBUG_DECRYPT: c_uint = 0x20000; pub const CMS_KEY_PARAM: c_uint = 0x40000; pub const CMS_ASCIICRLF: c_uint = 0x80000; // macros pub unsafe fn BIO_get_mem_data(b: *mut BIO, pp: *mut *mut c_char) -> c_long { BIO_ctrl(b, BIO_CTRL_INFO, 0, pp as *mut c_void) Loading
openssl/src/cms.rs +31 −24 Original line number Diff line number Diff line Loading @@ -11,35 +11,36 @@ use std::ptr; use bio::{MemBio, MemBioSlice}; use error::ErrorStack; use libc::c_uint; use pkey::{HasPrivate, PKeyRef}; use stack::Stack; use x509::X509; use {cvt, cvt_p}; bitflags! { pub struct CMSOptions : u32 { const CMS_TEXT = 0x1; const CMS_NOCERTS = 0x2; const CMS_NO_CONTENT_VERIFY = 0x4; const CMS_NO_ATTR_VERIFY = 0x8; const CMS_NOSIGS = 0x4 | 0x8; const CMS_NOINTERN = 0x10; const CMS_NO_SIGNER_CERT_VERIFY = 0x20; const CMS_NOVERIFY = 0x20; const CMS_DETACHED = 0x40; const CMS_BINARY = 0x80; const CMS_NOATTR = 0x100; const CMS_NOSMIMECAP = 0x200; const CMS_NOOLDMIMETYPE = 0x400; const CMS_CRLFEOL = 0x800; const CMS_STREAM = 0x1000; const CMS_NOCRL = 0x2000; const CMS_PARTIAL = 0x4000; const CMS_REUSE_DIGEST = 0x8000; const CMS_USE_KEYID = 0x10000; const CMS_DEBUG_DECRYPT = 0x20000; const CMS_KEY_PARAM = 0x40000; const CMS_ASCIICRLF = 0x80000; pub struct CMSOptions : c_uint { const TEXT = ffi::CMS_TEXT; const CMS_NOCERTS = ffi::CMS_NOCERTS; const NO_CONTENT_VERIFY = ffi::CMS_NO_CONTENT_VERIFY; const NO_ATTR_VERIFY = ffi::CMS_NO_ATTR_VERIFY; const NOSIGS = ffi::CMS_NOSIGS; const NOINTERN = ffi::CMS_NOINTERN; const NO_SIGNER_CERT_VERIFY = ffi::CMS_NO_SIGNER_CERT_VERIFY; const NOVERIFY = ffi::CMS_NOVERIFY; const DETACHED = ffi::CMS_DETACHED; const BINARY = ffi::CMS_BINARY; const NOATTR = ffi::CMS_NOATTR; const NOSMIMECAP = ffi::CMS_NOSMIMECAP; const NOOLDMIMETYPE = ffi::CMS_NOOLDMIMETYPE; const CRLFEOL = ffi::CMS_CRLFEOL; const STREAM = ffi::CMS_STREAM; const NOCRL = ffi::CMS_NOCRL; const PARTIAL = ffi::CMS_PARTIAL; const REUSE_DIGEST = ffi::CMS_REUSE_DIGEST; const USE_KEYID = ffi::CMS_USE_KEYID; const DEBUG_DECRYPT = ffi::CMS_DEBUG_DECRYPT; const KEY_PARAM = ffi::CMS_KEY_PARAM; const ASCIICRLF = ffi::CMS_ASCIICRLF; } } Loading Loading @@ -152,7 +153,13 @@ impl CmsContentInfo { None => ptr::null_mut(), }; let cms = cvt_p(ffi::CMS_sign(signcert, pkey, certs, data_bio_ptr, flags.bits()))?; let cms = cvt_p(ffi::CMS_sign( signcert, pkey, certs, data_bio_ptr, flags.bits(), ))?; Ok(CmsContentInfo::from_ptr(cms)) } Loading