Skip to content
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
2 changes: 2 additions & 0 deletions openssl-sys/build/run_bindgen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ const INCLUDES: &str = "
#endif

#if OPENSSL_VERSION_NUMBER >= 0x30000000
#include <openssl/decoder.h>
#include <openssl/encoder.h>
#include <openssl/provider.h>
#include <openssl/params.h>
#include <openssl/param_build.h>
Expand Down
52 changes: 52 additions & 0 deletions openssl-sys/src/handwritten/decoder.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
use super::super::*;
use libc::*;

extern "C" {
pub fn OSSL_DECODER_CTX_new() -> *mut OSSL_DECODER_CTX;
pub fn OSSL_DECODER_CTX_free(ctx: *mut OSSL_DECODER_CTX);

pub fn OSSL_DECODER_CTX_new_for_pkey(
pkey: *mut *mut EVP_PKEY,
input_type: *const c_char,
input_struct: *const c_char,
keytype: *const c_char,
selection: c_int,
libctx: *mut OSSL_LIB_CTX,
propquery: *const c_char,
) -> *mut OSSL_DECODER_CTX;

pub fn OSSL_DECODER_CTX_set_selection(ctx: *mut OSSL_DECODER_CTX, selection: c_int) -> c_int;
pub fn OSSL_DECODER_CTX_set_input_type(
ctx: *mut OSSL_DECODER_CTX,
input_type: *const c_char,
) -> c_int;
pub fn OSSL_DECODER_CTX_set_input_structure(
ctx: *mut OSSL_DECODER_CTX,
input_structure: *const c_char,
) -> c_int;

pub fn OSSL_DECODER_CTX_set_passphrase(
ctx: *mut OSSL_DECODER_CTX,
kstr: *const c_uchar,
klen: size_t,
) -> c_int;
pub fn OSSL_DECODER_CTX_set_pem_password_cb(
ctx: *mut OSSL_DECODER_CTX,
cb: pem_password_cb,
cbarg: *mut c_void,
) -> c_int;
pub fn OSSL_DECODER_CTX_set_passphrase_cb(
ctx: *mut OSSL_DECODER_CTX,
cb: OSSL_PASSPHRASE_CALLBACK,
cbarg: *mut c_void,
) -> c_int;

pub fn OSSL_DECODER_from_bio(ctx: *mut OSSL_DECODER_CTX, b_in: *mut BIO) -> c_int;
#[cfg(not(osslconf = "OPENSSL_NO_STDIO"))]
pub fn OSSL_DECODER_from_fp(ctx: *mut OSSL_DECODER_CTX, fp: *mut FILE) -> c_int;
pub fn OSSL_DECODER_from_data(
ctx: *mut OSSL_DECODER_CTX,
pdata: *mut *const c_uchar,
pdata_len: *mut size_t,
) -> c_int;
}
56 changes: 56 additions & 0 deletions openssl-sys/src/handwritten/encoder.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
use super::super::*;
use libc::*;

#[cfg(ossl300)]
extern "C" {
pub fn OSSL_ENCODER_CTX_new() -> *mut OSSL_ENCODER_CTX;
pub fn OSSL_ENCODER_CTX_free(ctx: *mut OSSL_ENCODER_CTX);

pub fn OSSL_ENCODER_CTX_new_for_pkey(
pkey: *const EVP_PKEY,
selection: c_int,
output_type: *const c_char,
output_structure: *const c_char,
propquery: *const c_char,
) -> *mut OSSL_ENCODER_CTX;

pub fn OSSL_ENCODER_CTX_set_selection(ctx: *mut OSSL_ENCODER_CTX, selection: c_int) -> c_int;
pub fn OSSL_ENCODER_CTX_set_output_type(
ctx: *mut OSSL_ENCODER_CTX,
output_type: *const c_char,
) -> c_int;
pub fn OSSL_ENCODER_CTX_set_output_structure(
ctx: *mut OSSL_ENCODER_CTX,
output_structure: *const c_char,
) -> c_int;

pub fn OSSL_ENCODER_CTX_set_cipher(
ctx: *mut OSSL_ENCODER_CTX,
cipher_name: *const c_char,
propquery: *const c_char,
) -> c_int;
pub fn OSSL_ENCODER_CTX_set_passphrase(
ctx: *mut OSSL_ENCODER_CTX,
kstr: *const c_uchar,
klen: size_t,
) -> c_int;
pub fn OSSL_ENCODER_CTX_set_pem_password_cb(
ctx: *mut OSSL_ENCODER_CTX,
cb: pem_password_cb,
cbarg: *mut c_void,
) -> c_int;
pub fn OSSL_ENCODER_CTX_set_passphrase_cb(
ctx: *mut OSSL_ENCODER_CTX,
cb: OSSL_PASSPHRASE_CALLBACK,
cbarg: *mut c_void,
) -> c_int;

pub fn OSSL_ENCODER_to_data(
ctx: *mut OSSL_ENCODER_CTX,
pdata: *mut *mut c_uchar,
pdata_len: *mut size_t,
) -> c_int;
pub fn OSSL_ENCODER_to_bio(ctx: *mut OSSL_ENCODER_CTX, out: *mut BIO) -> c_int;
#[cfg(not(osslconf = "OPENSSL_NO_STDIO"))]
pub fn OSSL_ENCODER_to_fp(ctx: *mut OSSL_ENCODER_CTX, fp: *mut FILE) -> c_int;
}
8 changes: 8 additions & 0 deletions openssl-sys/src/handwritten/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@ pub use self::cmac::*;
pub use self::cms::*;
pub use self::conf::*;
pub use self::crypto::*;
#[cfg(ossl300)]
pub use self::decoder::*;
pub use self::dh::*;
pub use self::dsa::*;
pub use self::ec::*;
#[cfg(ossl300)]
pub use self::encoder::*;
pub use self::err::*;
pub use self::evp::*;
pub use self::hmac::*;
Expand Down Expand Up @@ -46,9 +50,13 @@ mod cmac;
mod cms;
mod conf;
mod crypto;
#[cfg(ossl300)]
mod decoder;
mod dh;
mod dsa;
mod ec;
#[cfg(ossl300)]
mod encoder;
mod err;
mod evp;
mod hmac;
Expand Down
16 changes: 16 additions & 0 deletions openssl-sys/src/handwritten/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1147,3 +1147,19 @@ pub enum OSSL_PARAM_BLD {}
pub enum EVP_KDF {}
#[cfg(ossl300)]
pub enum EVP_KDF_CTX {}

#[cfg(ossl300)]
pub enum OSSL_ENCODER_CTX {}
#[cfg(ossl300)]
pub enum OSSL_DECODER_CTX {}

#[cfg(ossl300)]
pub type OSSL_PASSPHRASE_CALLBACK = Option<
unsafe extern "C" fn(
pass: *mut c_char,
pass_size: size_t,
pass_len: *mut size_t,
params: *const OSSL_PARAM,
arg: *mut c_void,
) -> c_int,
>;
Loading
Loading