Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added pkcs7 support (this PR was split, do not merge) #1598

Draft
wants to merge 128 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
128 commits
Select commit Hold shift + click to select a range
81e0866
Add support for retrieving SignerInfo structures from PKCS7 signatures
chenxiaolong Apr 14, 2021
b5900d4
Attribute support for certificates and CSRs.
bkstein Nov 22, 2021
1a2e409
Added function bodies required for SCEP PKCS7 outer message.
bkstein Dec 7, 2021
6f23f8b
Implemented function bodies.
bkstein Dec 7, 2021
e7e20b7
Changes for creating SCEP (PKCS7) requests implemented.
bkstein Dec 22, 2021
9f5f1fd
Merge branch 'master' into kletterstein/x509Attributes
bkstein Dec 22, 2021
09cf0d4
Fixed deprecated use statement.
bkstein Dec 22, 2021
e663851
Fixed merge problems
bkstein Dec 22, 2021
3cca7e5
Updated version numbers
bkstein Jan 21, 2022
68cec6a
Fixed ownership problems for adding certs and signer info to ossl
bkstein Jan 21, 2022
68b1282
Added function for reading certificates from pkcs7.
bkstein Jan 24, 2022
ed884ee
Merge branch 'master' into kletterstein/x509Attributes
bkstein Jan 24, 2022
3af3c20
Fixed version number in Cargo.toml
bkstein Jan 24, 2022
3178f9c
Cleaned up TODOs.
bkstein Feb 3, 2022
e6c145e
Fixed tests and "[corresponds()]" macros.
bkstein Feb 4, 2022
fee9dc9
Cleaned up comments.
bkstein Feb 4, 2022
0b44cd8
Fixed comments.
bkstein Feb 4, 2022
d2358ae
passed cargo fmt --all -- --check
bkstein Feb 4, 2022
49365a7
Passed cargo clippy --all --all-targets
bkstein Feb 4, 2022
c065011
Fixed compiler problems with other toolchains.
bkstein Feb 4, 2022
67a1dc6
Swapped use:: sequence
bkstein Feb 4, 2022
e93b045
More clippy issues fixed.
bkstein Feb 4, 2022
1f614f8
Fixing const correctness for other openssl versions.
bkstein Feb 4, 2022
81e2999
Fixed openssl and libressl version issues in declarations.
bkstein Feb 7, 2022
0bfd643
More openssl and libressl version issues fixed.
bkstein Feb 7, 2022
9b29afb
Fixed missing const* declaration.
bkstein Feb 7, 2022
754e733
Hopefully fixed systest problem with struct size calcluation and PKCS…
bkstein Feb 7, 2022
b09b304
Merge branch 'master' into kletterstein/pkcs7
bkstein Feb 7, 2022
3377e50
Fixed issues from review.
bkstein Feb 17, 2022
f7cbac4
Fixed rustfmt issues.
bkstein Feb 17, 2022
ab56078
Merge branch 'master' into kletterstein/pkcs7
bkstein Feb 17, 2022
94d54e8
Fixed duplicated line from last merge.
bkstein Feb 17, 2022
c0072d8
Fixed clippy issues.
bkstein Feb 17, 2022
344aa7e
Check double free problem in CI
bkstein Feb 17, 2022
f4acbdc
Fixed clippy error.
bkstein Feb 17, 2022
9909937
Removed Pkcs7Ref::get_content(), as it duplicates part of Pkcs7Ref::v…
bkstein Feb 21, 2022
4ded26c
Refactored creation of `X509Attribute`s with `Asn1String`s.
bkstein Feb 24, 2022
4f6b64e
Prohibit creation of `Asn1String`s of type `V_ASN1_OBJECT`.
bkstein Feb 28, 2022
8c6effa
Fixed rustfmt issue.
bkstein Feb 28, 2022
40155d5
Fixed clippy and const_ptr_api issues.
bkstein Feb 28, 2022
a2b00e0
Fixing `use crate::...` in test depending on #cfg(ossl111)
bkstein Mar 1, 2022
2de0add
Fixed [allow(clippy::single_char_pattern)] in tests.
bkstein Mar 1, 2022
2b0711f
Fixed const_ptr for older ossl versions
bkstein Mar 1, 2022
da2dc57
Fixed ossl version dep in doc example
bkstein Mar 1, 2022
f3e7b8a
`ASN1_TYPE`'s can be read from OpenSSL and converted to Asn1StringRef.
bkstein Mar 14, 2022
afcefb3
Beautified FromAsn1Type.
bkstein Mar 14, 2022
ad0f657
Merge branch 'kletterstein/asn1type' into kletterstein/pre-main
bkstein Mar 14, 2022
36d0edb
Merge remote-tracking branch 'remotes/chen/pkcs7' into kletterstein/p…
bkstein Mar 15, 2022
a3fb25c
Fixed test.
bkstein Mar 15, 2022
e89fa69
Merge branch 'kletterstein/pkcs7-signerinfo' into kletterstein/pre-main
bkstein Mar 16, 2022
e26fe7d
Added constants for compatibility.
bkstein Mar 16, 2022
a1fe594
Backward compatibility for Asn1Type constants.
bkstein Mar 16, 2022
439d919
Merge branch 'kletterstein/asn1type' into 'kletterstein/pre-main'
bkstein Mar 16, 2022
f0a3b86
Added Asn1OctetString.
bkstein Mar 17, 2022
947d312
Rustfmt issues fixed.
bkstein Mar 17, 2022
2476d10
Fixed some clippy's.
bkstein Mar 17, 2022
93cf4e3
Fixed more clippy's.
bkstein Mar 17, 2022
d5d236b
Fixed const ptr in ASN1_generate_v3().
bkstein Mar 17, 2022
f71d748
Merge branch 'kletterstein/asn1type' into kletterstein/pre-main
bkstein Mar 17, 2022
4c2e705
Merge branch 'kletterstein/pkcs7-signerinfo' into kletterstein/pre-main
bkstein Mar 17, 2022
89052a4
Merge branch 'kletterstein/pre-main' of http://code.rsint.net/krieten…
bkstein Mar 17, 2022
a177f0f
Removed unused `use`
bkstein Mar 17, 2022
ace7b9d
Fixed ossl version dependent issues.
bkstein Mar 17, 2022
7d8420d
Added getting of attributes.
bkstein Mar 18, 2022
0785fd9
Fixed const pointer issue in asn1 tests.
bkstein Mar 18, 2022
7a92c23
Merge branch 'kletterstein/asn1type' into kletterstein/pre-main
bkstein Mar 18, 2022
f0f0f86
`FromAsn1Type` now works on `Asn1TypeRef` instead on `Asn1Type`.
bkstein Mar 19, 2022
98ee5d6
Merge branch 'kletterstein/asn1type' into kletterstein/pre-main
bkstein Mar 19, 2022
236ad08
Removed deprecated `description()` from `Asn1Error`.
bkstein Mar 19, 2022
b195f6b
Fixed clippy and rustfmt issues.
bkstein Mar 19, 2022
d426e0c
Merge branch 'kletterstein/asn1type' into kletterstein/pre-main
bkstein Mar 19, 2022
663ef66
Implemented creating X509Attribute from Asn1Object.
bkstein Mar 24, 2022
2e98d10
Removed clippy exceptions from tests.
bkstein Apr 5, 2022
88ccef2
Refactored Asn1TagValue from `enum` to `struct`.
bkstein Apr 5, 2022
dadb2f3
Removed *.tmp
bkstein Apr 5, 2022
a76fd75
Hopefully fixed clippy-error. CI will reveal it...
bkstein Apr 5, 2022
c58dd78
Merge branch 'kletterstein/asn1type' into kletterstein/pre-main
bkstein Apr 5, 2022
414057c
Merge branch 'master' into kletterstein/asn1type
bkstein Apr 12, 2022
a86f0c4
Merge branch 'kletterstein/asn1type' into kletterstein/pre-main
bkstein Apr 12, 2022
bbe64cc
Fixed clippy and rustfmt after merge.
bkstein Apr 12, 2022
e7d7080
Trigger build
bkstein Apr 12, 2022
28db059
Updated to Asn1TagValue
bkstein Apr 14, 2022
62f5dba
Fixed missing#`[cfg(ossl111)]` in test.
bkstein Apr 14, 2022
0b51a6c
Fixed Open-/LibreSSL version `cfg[]` issues.
bkstein Apr 14, 2022
61b2f0b
Yet another missing cfg![] fixed.
bkstein Apr 14, 2022
5e7b8cf
Moved certificates() from `Pkcs7` to `Pkcs7Ref`.
bkstein Apr 14, 2022
4cd71c3
Made `Asn1StringRef::from_asn1type` public.
bkstein Apr 14, 2022
5272360
Merge branch 'kletterstein/asn1type' into kletterstein/pkcs7
bkstein Apr 14, 2022
e718b25
Added type queries for Pkcs7Ref.
bkstein Apr 26, 2022
2bc5525
Added Asn1OctetStringRef::from_asn1type() plus test
bkstein Apr 26, 2022
b658ff1
Supporting reading extension information from a X509
bkstein May 6, 2022
6752d0e
Fxied ossl version issues.
bkstein May 9, 2022
20a32a6
Removed call of `Option::unwrap_unchecked()` due to min-version requi…
bkstein May 9, 2022
9275dc6
Fixed lissl version issue.
bkstein May 9, 2022
79a4cbe
Implemented support for setting of purpose for cert verification.
bkstein May 9, 2022
4c6c321
Fixed missing conversion to `CString`.
bkstein May 9, 2022
c4d7608
Fixed return value check for X509Purpose::get_by_sname().
bkstein May 9, 2022
14eaac0
X509_PURPOSE preliminary.
bkstein May 10, 2022
c3ab73e
Finished adding X509_PURPOSE.
bkstein May 12, 2022
1549eac
Added null-ptr check in Pkcs7Ref::certificates()
bkstein May 13, 2022
980164b
Added X509_PURPOSE constants to openssl.
bkstein May 23, 2022
aaf4071
Triggering a build
bkstein Jul 21, 2022
43d1327
Merge branch 'master' into kletterstein/pkcs7
bkstein Jul 21, 2022
04191db
Fixed openssl version dependent issues.
bkstein Jul 21, 2022
7907d8b
Added extension create functions
bkstein Jul 21, 2022
b9c3df9
Modified extension creation
bkstein Jul 21, 2022
5072e34
Fixed more openssl version issues.
bkstein Jul 22, 2022
e2aadd8
rustfmt hit me again from behind
bkstein Jul 22, 2022
eda4721
Merge branch 'master' into kletterstein/pkcs7
bkstein Jul 25, 2022
aa54383
Merge branch 'master' into kletterstein/pkcs7
bkstein Nov 7, 2022
3ea57df
Fixed merge problems.
bkstein Nov 7, 2022
21f6a7c
Fixed boringssl issues.
bkstein Nov 8, 2022
afe55f8
Fixed clippy warning.
bkstein Nov 9, 2022
170ca80
bool-to-int idiomatically.
bkstein Nov 9, 2022
5950001
Fixed boringssl issue
bkstein Nov 9, 2022
54092a5
Trigger build due to instable CI
bkstein Nov 9, 2022
26e006f
Try to fix creation of PKCS7 with empty content.
bkstein Nov 16, 2022
03725a3
Merge branch 'master' of https://github.com/sfackler/rust-openssl int…
bkstein Jan 11, 2023
ca11874
Merged master.
bkstein Jan 11, 2023
b4a20bc
Fixed use statement for `X509PurposeId`
bkstein Jan 11, 2023
29cc751
Fixed openssl version issues.
bkstein Jan 11, 2023
87490c6
Fix clippy issue.
bkstein Jan 11, 2023
02a6010
Fixed openssl version issue.
bkstein Jan 12, 2023
b7e70d8
rustfmt
bkstein Jan 12, 2023
dbee193
Fixed clippy allow rules
bkstein Jan 12, 2023
89feb86
Merge branch 'master' into kletterstein/pkcs7
bkstein Jan 13, 2023
02f7d0c
Trigger build
bkstein Jan 13, 2023
834fcce
Retry build due to connection problems in CI
bkstein Jan 13, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ Cargo.lock
.idea/
*.iml
.vscode/
*.tmp
3 changes: 3 additions & 0 deletions openssl-sys/build/cfgs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ pub fn get(openssl_version: Option<u64>, libressl_version: Option<u64>) -> Vec<&
if libressl_version >= 0x2_09_01_00_0 {
cfgs.push("libressl291");
}
if libressl_version >= 0x3_01_00_00_0 {
cfgs.push("libressl310");
}
if libressl_version >= 0x3_02_01_00_0 {
cfgs.push("libressl321");
}
Expand Down
49 changes: 45 additions & 4 deletions openssl-sys/src/handwritten/asn1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,60 @@ pub struct ASN1_ENCODING {

extern "C" {
pub fn ASN1_OBJECT_free(x: *mut ASN1_OBJECT);
pub fn OBJ_cmp(a: *const ASN1_OBJECT, b: *const ASN1_OBJECT) -> c_int;
}

pub enum ASN1_OBJECT {}

stack!(stack_st_ASN1_OBJECT);

#[repr(C)]
pub struct ASN1_TYPE {
pub type_: c_int,
pub value: ASN1_TYPE_value,
}
#[repr(C)]
pub union ASN1_TYPE_value {
pub ptr: *mut c_char,
pub boolean: ASN1_BOOLEAN,
pub asn1_string: *mut ASN1_STRING,
pub object: *mut ASN1_OBJECT,
pub integer: *mut ASN1_INTEGER,
pub enumerated: *mut ASN1_ENUMERATED,
pub bit_string: *mut ASN1_BIT_STRING,
pub octet_string: *mut ASN1_OCTET_STRING,
pub printablestring: *mut ASN1_PRINTABLESTRING,
pub t61string: *mut ASN1_T61STRING,
pub ia5string: *mut ASN1_IA5STRING,
pub generalstring: *mut ASN1_GENERALSTRING,
pub bmpstring: *mut ASN1_BMPSTRING,
pub universalstring: *mut ASN1_UNIVERSALSTRING,
pub utctime: *mut ASN1_UTCTIME,
pub generalizedtime: *mut ASN1_GENERALIZEDTIME,
pub visiblestring: *mut ASN1_VISIBLESTRING,
pub utf8string: *mut ASN1_UTF8STRING,
/*
* set and sequence are left complete and still contain the set or
* sequence bytes
*/
pub set: *mut ASN1_STRING,
pub sequence: *mut ASN1_STRING,
pub asn1_value: *mut ASN1_VALUE,
}

extern "C" {
pub fn ASN1_STRING_type_new(ty: c_int) -> *mut ASN1_STRING;
#[cfg(any(ossl110, libressl273))]
pub fn ASN1_STRING_get0_data(x: *const ASN1_STRING) -> *const c_uchar;
#[cfg(any(all(ossl101, not(ossl110)), libressl))]
pub fn ASN1_STRING_data(x: *mut ASN1_STRING) -> *mut c_uchar;

pub fn ASN1_BIT_STRING_free(x: *mut ASN1_BIT_STRING);

pub fn ASN1_STRING_new() -> *mut ASN1_STRING;
pub fn ASN1_STRING_free(x: *mut ASN1_STRING);
pub fn ASN1_STRING_length(x: *const ASN1_STRING) -> c_int;
pub fn ASN1_STRING_set(x: *mut ASN1_STRING, data: *const c_void, len_in: c_int) -> c_int;

pub fn ASN1_STRING_set(x: *mut ASN1_STRING, data: *const c_void, len: c_int) -> c_int;
pub fn ASN1_BIT_STRING_free(x: *mut ASN1_BIT_STRING);
pub fn ASN1_OCTET_STRING_free(x: *mut ASN1_OCTET_STRING);

pub fn ASN1_GENERALIZEDTIME_free(tm: *mut ASN1_GENERALIZEDTIME);
pub fn ASN1_GENERALIZEDTIME_print(b: *mut BIO, tm: *const ASN1_GENERALIZEDTIME) -> c_int;
Expand All @@ -51,10 +88,14 @@ extern "C" {
pub fn ASN1_TIME_set_string(s: *mut ASN1_TIME, str: *const c_char) -> c_int;
#[cfg(ossl111)]
pub fn ASN1_TIME_set_string_X509(s: *mut ASN1_TIME, str: *const c_char) -> c_int;

pub fn ASN1_TYPE_free(x: *mut ASN1_TYPE);
}

const_ptr_api! {
extern "C" {
pub fn ASN1_STRING_to_UTF8(out: *mut *mut c_uchar, s: #[const_ptr_if(any(ossl110, libressl280))] ASN1_STRING) -> c_int;
pub fn ASN1_STRING_type(x: #[const_ptr_if(any(ossl110, libressl280))] ASN1_STRING) -> c_int;
pub fn ASN1_generate_v3(str: #[const_ptr_if(any(ossl110, libressl280))] c_char, cnf: *mut X509V3_CTX) -> *mut ASN1_TYPE;
}
}
2 changes: 2 additions & 0 deletions openssl-sys/src/handwritten/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ pub use self::stack::*;
pub use self::tls1::*;
pub use self::types::*;
pub use self::x509::*;
pub use self::x509_attr::*;
pub use self::x509_vfy::*;
pub use self::x509v3::*;

Expand Down Expand Up @@ -61,5 +62,6 @@ mod stack;
mod tls1;
mod types;
mod x509;
mod x509_attr;
mod x509_vfy;
mod x509v3;
245 changes: 239 additions & 6 deletions openssl-sys/src/handwritten/pkcs7.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,195 @@
use libc::*;
use *;

pub enum PKCS7_SIGNED {}
pub enum PKCS7_ENVELOPE {}
pub enum PKCS7_SIGN_ENVELOPE {}
pub enum PKCS7_DIGEST {}
pub enum PKCS7_ENCRYPT {}
pub enum PKCS7 {}
// use x509::stack_st_X509;
// use x509_attr::stack_st_X509_ATTRIBUTE;

#[cfg(ossl300)]
#[repr(C)]
pub struct PKCS7_CTX {
libctx: *mut OSSL_LIB_CTX,
propq: *mut c_char,
}

cfg_if! {
if #[cfg(any(ossl101, libressl251))] {
#[repr(C)]
pub struct PKCS7_SIGNED {
pub version: *mut ASN1_INTEGER, /* version 1 */
pub md_algs: *mut stack_st_X509_ALGOR, /* md used */
pub cert: *mut stack_st_X509, /* [ 0 ] */
pub crl: *mut stack_st_X509_CRL, /* [ 1 ] */
pub signer_info: *mut stack_st_PKCS7_SIGNER_INFO,
pub contents: *mut PKCS7,
}
} else {
pub enum PKCS7_SIGNED {}
}
}

cfg_if! {
if #[cfg(any(ossl101, libressl251))] {
#[repr(C)]
pub struct PKCS7_ENC_CONTENT {
pub content_type: *mut ASN1_OBJECT,
pub algorithm: *mut X509_ALGOR,
pub enc_data: *mut ASN1_OCTET_STRING, /* [ 0 ] */
pub cipher: *const EVP_CIPHER,
#[cfg(ossl300)]
pub ctx: *const PKCS7_CTX,
}
} else {
pub enum PKCS7_ENC_CONTENT {}
}
}

cfg_if! {
if #[cfg(any(ossl101, libressl251))] {
#[repr(C)]
pub struct PKCS7_ENVELOPE {
pub version: *mut ASN1_INTEGER, /* version 0 */
pub recipientinfo: *mut stack_st_PKCS7_RECIP_INFO,
pub enc_data: *mut PKCS7_ENC_CONTENT,
}
} else {
pub enum PKCS7_ENVELOPE {}
}
}

cfg_if! {
if #[cfg(any(ossl101, libressl251))] {
#[repr(C)]
pub struct PKCS7_SIGN_ENVELOPE {
pub version: *mut ASN1_INTEGER, /* version 1 */
pub md_algs: *mut stack_st_X509_ALGOR, /* md used */
pub cert: *mut stack_st_X509, /* [ 0 ] */
pub crl: *mut stack_st_X509_CRL, /* [ 1 ] */
pub signer_info: *mut stack_st_PKCS7_SIGNER_INFO,
pub enc_data: *mut PKCS7_ENC_CONTENT,
pub recipientinfo: *mut stack_st_PKCS7_RECIP_INFO
}
} else {
pub enum PKCS7_SIGN_ENVELOPE {}
}
}

cfg_if! {
if #[cfg(any(ossl101, libressl251))] {
#[repr(C)]
pub struct PKCS7_DIGEST {
pub version: *mut ASN1_INTEGER, /* version 0 */
pub md: *mut X509_ALGOR, /* md used */
pub contents: *mut PKCS7,
pub digest: *mut ASN1_OCTET_STRING,
}
} else {
pub enum PKCS7_DIGEST {}
}
}

cfg_if! {
if #[cfg(any(ossl101, libressl251))] {
#[repr(C)]
pub struct PKCS7_ENCRYPT {
pub version: *mut ASN1_INTEGER, /* version 0 */
pub enc_data: *mut PKCS7_ENC_CONTENT,
}
} else {
pub enum PKCS7_ENCRYPT {}
}
}

extern "C" {
pub fn PKCS7_SIGNED_free(info: *mut PKCS7_SIGNED);
pub fn PKCS7_ENC_CONTENT_free(info: *mut PKCS7_ENC_CONTENT);
pub fn PKCS7_ENVELOPE_free(info: *mut PKCS7_ENVELOPE);
pub fn PKCS7_SIGN_ENVELOPE_free(info: *mut PKCS7_SIGN_ENVELOPE);
pub fn PKCS7_DIGEST_free(info: *mut PKCS7_DIGEST);
pub fn PKCS7_SIGNER_INFO_free(info: *mut PKCS7_SIGNER_INFO);
}

cfg_if! {
if #[cfg(any(ossl101, libressl251))] {
#[repr(C)]
pub struct PKCS7 {
/*
* The following is non NULL if it contains ASN1 encoding of this
* structure
*/
pub asn1: *mut c_uchar,
pub length: c_long,
// # define PKCS7_S_HEADER 0
// # define PKCS7_S_BODY 1
// # define PKCS7_S_TAIL 2
pub state: c_int, /* used during processing */
pub detached: c_int,
pub type_: *mut ASN1_OBJECT,
/* content as defined by the type */
/*
* all encryption/message digests are applied to the 'contents', leaving
* out the 'type' field.
*/
pub d: PKCS7_data,
#[cfg(ossl300)]
pub ctx: PKCS7_CTX,
}
#[repr(C)]
pub union PKCS7_data {
pub ptr: *mut c_char,
/* NID_pkcs7_data */
pub data: *mut ASN1_OCTET_STRING,
/* NID_pkcs7_signed */
pub sign: *mut PKCS7_SIGNED,
/* NID_pkcs7_enveloped */
pub enveloped: *mut PKCS7_ENVELOPE,
/* NID_pkcs7_signedAndEnveloped */
pub signed_and_enveloped: *mut PKCS7_SIGN_ENVELOPE,
/* NID_pkcs7_digest */
pub digest: *mut PKCS7_DIGEST,
/* NID_pkcs7_encrypted */
pub encrypted: *mut PKCS7_ENCRYPT,
/* Anything else */
pub other: *mut ASN1_TYPE,
}
} else {
pub enum PKCS7 {}
}
}

cfg_if! {
if #[cfg(any(ossl101, libressl))] {
#[repr(C)]
pub struct PKCS7_ISSUER_AND_SERIAL {
pub issuer: *mut X509_NAME,
pub serial: *mut ASN1_INTEGER,
}
} else {
pub enum PKCS7_ISSUER_AND_SERIAL {}
}
}

cfg_if! {
if #[cfg(any(ossl101, libressl))] {
#[repr(C)]
pub struct PKCS7_SIGNER_INFO {
pub version: *mut ASN1_INTEGER, /* version 1 */
pub issuer_and_serial: *mut PKCS7_ISSUER_AND_SERIAL,
pub digest_alg: *mut X509_ALGOR,
pub auth_attr: *mut stack_st_X509_ATTRIBUTE, /* [ 0 ] */
pub digest_enc_alg: *mut X509_ALGOR,
pub enc_digest: *mut ASN1_OCTET_STRING,
pub unauth_attr: *mut stack_st_X509_ATTRIBUTE, /* [ 1 ] */
pub pkey: *mut EVP_PKEY, /* The private key to sign with */
#[cfg(ossl300)]
pub ctx: *const PKCS7_CTX,
}
} else {
pub enum PKCS7_SIGNER_INFO {}
}
}

stack!(stack_st_PKCS7_SIGNER_INFO);
stack!(stack_st_PKCS7_RECIP_INFO);

extern "C" {
pub fn d2i_PKCS7(a: *mut *mut PKCS7, pp: *mut *const c_uchar, length: c_long) -> *mut PKCS7;
Expand All @@ -15,6 +198,7 @@ extern "C" {
const_ptr_api! {
extern "C" {
pub fn i2d_PKCS7(a: #[const_ptr_if(ossl300)] PKCS7, buf: *mut *mut u8) -> c_int;
pub fn i2d_PKCS7_bio(bio: *mut BIO, p7: #[const_ptr_if(ossl300)] PKCS7) -> c_int;
}
}

Expand Down Expand Up @@ -67,4 +251,53 @@ extern "C" {
) -> c_int;

pub fn SMIME_read_PKCS7(bio: *mut BIO, bcont: *mut *mut BIO) -> *mut PKCS7;

pub fn PKCS7_new() -> *mut PKCS7;

pub fn PKCS7_set_type(p7: *mut PKCS7, nid_pkcs7: c_int) -> c_int;

pub fn PKCS7_add_certificate(p7: *mut PKCS7, x509: *mut X509) -> c_int;

pub fn PKCS7_add_signature(
p7: *mut PKCS7,
x509: *mut X509,
pkey: *mut EVP_PKEY,
digest: *const EVP_MD,
) -> *mut PKCS7_SIGNER_INFO;

pub fn PKCS7_set_signed_attributes(
p7si: *mut PKCS7_SIGNER_INFO,
attributes: *mut stack_st_X509_ATTRIBUTE,
) -> c_int;

pub fn PKCS7_add_signed_attribute(
p7si: *mut PKCS7_SIGNER_INFO,
nid: c_int,
attrtype: c_int,
data: *mut c_void,
) -> c_int;

pub fn PKCS7_content_new(p7: *mut PKCS7, nid_pkcs7: c_int) -> c_int;

pub fn PKCS7_dataInit(p7: *mut PKCS7, bio: *mut BIO) -> *mut BIO;

pub fn PKCS7_dataFinal(p7: *mut PKCS7, bio: *mut BIO) -> c_int;

pub fn PKCS7_get_signer_info(p7: *mut PKCS7) -> *mut stack_st_PKCS7_SIGNER_INFO;

pub fn PKCS7_SIGNER_INFO_get0_algs(
si: *mut PKCS7_SIGNER_INFO,
pk: *mut *mut EVP_PKEY,
pdig: *mut *mut X509_ALGOR,
psig: *mut *mut X509_ALGOR,
);
}

const_ptr_api! {
extern "C" {
pub fn PKCS7_get_signed_attribute(
si: #[const_ptr_if(ossl300)] PKCS7_SIGNER_INFO,
nid: c_int
) -> *mut ASN1_TYPE;
}
}
Loading