Unverified Commit 7d1d9a31 authored by Steven Fackler's avatar Steven Fackler Committed by GitHub
Browse files

Merge pull request #1899 from reaperhulk/cmac

add low level cmac bindings
parents 371e0c75 0dc14f7f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@ const INCLUDES: &str = "
#include <openssl/aes.h>
#include <openssl/asn1.h>
#include <openssl/bio.h>
#include <openssl/cmac.h>
#include <openssl/conf.h>
#include <openssl/crypto.h>
#include <openssl/dh.h>
+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")