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

cms get_type #2172

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
13 changes: 13 additions & 0 deletions openssl-sys/src/handwritten/cms.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,17 @@ extern "C" {
out: *mut BIO,
flags: c_uint,
) -> c_int;

}

cfg_if! {
if #[cfg(ossl111)] {
extern "C" {
pub fn CMS_get0_type(cms: *const CMS_ContentInfo) -> *const ASN1_OBJECT;
}
} else {
extern "C" {
pub fn CMS_get0_type(cms: *mut CMS_ContentInfo) -> *const ASN1_OBJECT;
}
}
}
11 changes: 11 additions & 0 deletions openssl/src/cms.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ use foreign_types::{ForeignType, ForeignTypeRef};
use libc::c_uint;
use std::ptr;

use crate::asn1::Asn1ObjectRef;
use crate::bio::{MemBio, MemBioSlice};
use crate::error::ErrorStack;
use crate::pkey::{HasPrivate, PKeyRef};
use crate::stack::StackRef;
use crate::symm::Cipher;
use crate::util::ForeignTypeRefExt;
use crate::x509::{store::X509StoreRef, X509Ref, X509};
use crate::{cvt, cvt_p};
use openssl_macros::corresponds;
Expand Down Expand Up @@ -275,6 +277,15 @@ impl CmsContentInfo {
Ok(())
}
}

#[corresponds(CMS_get0_type)]
pub fn get_type(&self) -> &Asn1ObjectRef {
unsafe {
let asn1_type = ffi::CMS_get0_type(self.as_ptr());

Asn1ObjectRef::from_const_ptr(asn1_type)
}
}
}

#[cfg(test)]
Expand Down
Loading