Commit 3f2e02bb authored by Paul Kehrer's avatar Paul Kehrer
Browse files

add low level cmac bindings

these are deprecated in ossl3, but the only common interface across openssl,
libressl, and boring
parent 371e0c75
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
use libc::*;

use super::super::*;

extern "C" {
    pub fn CMAC_CTX_new() -> *mut CMAC_CTX;
    pub fn CMAC_CTX_free(ctx: *mut CMAC_CTX);
    pub fn CMAC_Init(
        ctx: *mut CMAC_CTX,
        key: *const c_void,
        len: size_t,
        cipher: *const EVP_CIPHER,
        impl_: *mut ENGINE,
    ) -> c_int;
    pub fn CMAC_Update(ctx: *mut CMAC_CTX, data: *const c_void, len: size_t) -> c_int;
    pub fn CMAC_Final(ctx: *mut CMAC_CTX, out: *mut c_uchar, len: *mut size_t) -> c_int;
    pub fn CMAC_CTX_copy(dst: *mut CMAC_CTX, src: *const CMAC_CTX) -> c_int;
}
+2 −0
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@ pub use self::aes::*;
pub use self::asn1::*;
pub use self::bio::*;
pub use self::bn::*;
pub use self::cmac::*;
pub use self::cms::*;
pub use self::conf::*;
pub use self::crypto::*;
@@ -35,6 +36,7 @@ mod aes;
mod asn1;
mod bio;
mod bn;
mod cmac;
mod cms;
mod conf;
mod crypto;
+2 −0
Original line number Diff line number Diff line
@@ -125,6 +125,8 @@ pub enum EVP_PKEY_ASN1_METHOD {}

pub enum EVP_PKEY_CTX {}

pub enum CMAC_CTX {}

cfg_if! {
    if #[cfg(any(ossl110, libressl280))] {
        pub enum HMAC_CTX {}
+1 −0
Original line number Diff line number Diff line
@@ -56,6 +56,7 @@ fn main() {
        .header("openssl/bio.h")
        .header("openssl/x509v3.h")
        .header("openssl/safestack.h")
        .header("openssl/cmac.h")
        .header("openssl/hmac.h")
        .header("openssl/obj_mac.h")
        .header("openssl/ssl.h")