From 8ce5dee00d1f7658e0790b60dfcb86d4b2f81621 Mon Sep 17 00:00:00 2001 From: Umang Raghuvanshi Date: Fri, 20 Apr 2018 17:15:04 +0530 Subject: Add the CMS_sign and i2d_CMS_ContentInfo function bindings This adds the CMS_sign and i2d_CMS_ContentInfo bindings in the openssl-sys crate and Rusty wrappers in the openssl crate. --- openssl-sys/src/lib.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'openssl-sys/src') diff --git a/openssl-sys/src/lib.rs b/openssl-sys/src/lib.rs index 85527f8f..42bd8268 100644 --- a/openssl-sys/src/lib.rs +++ b/openssl-sys/src/lib.rs @@ -5,8 +5,8 @@ extern crate libc; use libc::{c_char, c_int, c_long, c_uchar, c_uint, c_ulong, c_void, size_t, FILE}; -use std::ptr; use std::mem; +use std::ptr; #[cfg(any(ossl101, ossl102))] mod ossl10x; @@ -2846,6 +2846,16 @@ extern "C" { pub fn SMIME_read_CMS(bio: *mut BIO, bcont: *mut *mut BIO) -> *mut CMS_ContentInfo; #[cfg(not(libressl))] pub fn CMS_ContentInfo_free(cms: *mut CMS_ContentInfo); + #[cfg(not(libressl))] + pub fn CMS_sign( + signcert: *const X509, + pkey: *const EVP_PKEY, + certs: *const stack_st_X509, + data: *mut BIO, + flags: c_uint, + ) -> *mut CMS_ContentInfo; + #[cfg(not(libressl))] + pub fn i2d_CMS_ContentInfo(a: *mut CMS_ContentInfo, pp: *mut *mut c_uchar) -> c_int; #[cfg(not(libressl))] pub fn FIPS_mode_set(onoff: c_int) -> c_int; -- cgit v1.2.3 From 5360f5ad04ff879cce1c4bbd32b076841324dcd3 Mon Sep 17 00:00:00 2001 From: Umang Raghuvanshi Date: Fri, 20 Apr 2018 17:30:20 +0530 Subject: Fix mutability issues with CMS_sign --- openssl-sys/src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'openssl-sys/src') diff --git a/openssl-sys/src/lib.rs b/openssl-sys/src/lib.rs index 42bd8268..e5330b93 100644 --- a/openssl-sys/src/lib.rs +++ b/openssl-sys/src/lib.rs @@ -2848,9 +2848,9 @@ extern "C" { pub fn CMS_ContentInfo_free(cms: *mut CMS_ContentInfo); #[cfg(not(libressl))] pub fn CMS_sign( - signcert: *const X509, - pkey: *const EVP_PKEY, - certs: *const stack_st_X509, + signcert: *mut X509, + pkey: *mut EVP_PKEY, + certs: *mut stack_st_X509, data: *mut BIO, flags: c_uint, ) -> *mut CMS_ContentInfo; -- cgit v1.2.3 From 90898e99c996bc661daa16d8640479101906cc73 Mon Sep 17 00:00:00 2001 From: Umang Raghuvanshi Date: Thu, 10 May 2018 20:26:57 +0530 Subject: Move CMS_* flags to the openssl-sys package Also renames attributes in the bitflags struct. --- openssl-sys/src/lib.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'openssl-sys/src') diff --git a/openssl-sys/src/lib.rs b/openssl-sys/src/lib.rs index e5330b93..4b9c4cb8 100644 --- a/openssl-sys/src/lib.rs +++ b/openssl-sys/src/lib.rs @@ -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) -- cgit v1.2.3 From 541458c1c165ef1bbc6f9b949f9956fcf3c37ae6 Mon Sep 17 00:00:00 2001 From: Umang Raghuvanshi Date: Thu, 10 May 2018 20:48:38 +0530 Subject: Properly version-gate CMS constants --- openssl-sys/src/lib.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'openssl-sys/src') diff --git a/openssl-sys/src/lib.rs b/openssl-sys/src/lib.rs index 4b9c4cb8..b07d5ab6 100644 --- a/openssl-sys/src/lib.rs +++ b/openssl-sys/src/lib.rs @@ -1467,26 +1467,47 @@ pub const DTLS1_COOKIE_LENGTH: c_uint = 256; #[cfg(not(libressl))] pub const CMS_TEXT: c_uint = 0x1; +#[cfg(not(libressl))] pub const CMS_NOCERTS: c_uint = 0x2; +#[cfg(not(libressl))] pub const CMS_NO_CONTENT_VERIFY: c_uint = 0x4; +#[cfg(not(libressl))] pub const CMS_NO_ATTR_VERIFY: c_uint = 0x8; +#[cfg(not(libressl))] pub const CMS_NOSIGS: c_uint = 0x4 | 0x8; +#[cfg(not(libressl))] pub const CMS_NOINTERN: c_uint = 0x10; +#[cfg(not(libressl))] pub const CMS_NO_SIGNER_CERT_VERIFY: c_uint = 0x20; +#[cfg(not(libressl))] pub const CMS_NOVERIFY: c_uint = 0x20; +#[cfg(not(libressl))] pub const CMS_DETACHED: c_uint = 0x40; +#[cfg(not(libressl))] pub const CMS_BINARY: c_uint = 0x80; +#[cfg(not(libressl))] pub const CMS_NOATTR: c_uint = 0x100; +#[cfg(not(libressl))] pub const CMS_NOSMIMECAP: c_uint = 0x200; +#[cfg(not(libressl))] pub const CMS_NOOLDMIMETYPE: c_uint = 0x400; +#[cfg(not(libressl))] pub const CMS_CRLFEOL: c_uint = 0x800; +#[cfg(not(libressl))] pub const CMS_STREAM: c_uint = 0x1000; +#[cfg(not(libressl))] pub const CMS_NOCRL: c_uint = 0x2000; +#[cfg(not(libressl))] pub const CMS_PARTIAL: c_uint = 0x4000; +#[cfg(not(libressl))] pub const CMS_REUSE_DIGEST: c_uint = 0x8000; +#[cfg(not(libressl))] pub const CMS_USE_KEYID: c_uint = 0x10000; +#[cfg(not(libressl))] pub const CMS_DEBUG_DECRYPT: c_uint = 0x20000; +#[cfg(not(libressl))] pub const CMS_KEY_PARAM: c_uint = 0x40000; +#[cfg(all(not(libressl), not(ossl101), not(ossl102)))] pub const CMS_ASCIICRLF: c_uint = 0x80000; // macros -- cgit v1.2.3 From afaa2387c89a6e7d2d8c2ee05d4ecb605b5188e1 Mon Sep 17 00:00:00 2001 From: Umang Raghuvanshi Date: Thu, 10 May 2018 21:33:51 +0530 Subject: Gate away CMS_KEY_PARAM from OpenSSL 1.0.1 --- openssl-sys/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'openssl-sys/src') diff --git a/openssl-sys/src/lib.rs b/openssl-sys/src/lib.rs index b07d5ab6..de24d94e 100644 --- a/openssl-sys/src/lib.rs +++ b/openssl-sys/src/lib.rs @@ -1505,7 +1505,7 @@ pub const CMS_REUSE_DIGEST: c_uint = 0x8000; pub const CMS_USE_KEYID: c_uint = 0x10000; #[cfg(not(libressl))] pub const CMS_DEBUG_DECRYPT: c_uint = 0x20000; -#[cfg(not(libressl))] +#[cfg(all(not(libressl), not(ossl101)))] pub const CMS_KEY_PARAM: c_uint = 0x40000; #[cfg(all(not(libressl), not(ossl101), not(ossl102)))] pub const CMS_ASCIICRLF: c_uint = 0x80000; -- cgit v1.2.3