Skip to content

Commit eb7b7bf

Browse files
committed
Change Hasher and HMAC APIs closer to std::hash model
- Implement Clone and std::io::Writer. - Reduce the API to write() and finish(). Contrary to std::hash, finish() resets the hasher immediately. - Add hmac::hmac() convenience fn. - Replace hash::evpmd() with HashType methods. - Add assertions as a crude check for failed calls into openssl. - Add examples and some tests. [breaking-change]
1 parent 8fe0633 commit eb7b7bf

File tree

4 files changed

+501
-176
lines changed

4 files changed

+501
-176
lines changed

openssl-sys/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,7 @@ extern "C" {
370370
pub fn EVP_DigestFinal_ex(ctx: *mut EVP_MD_CTX, res: *mut u8, n: *mut u32) -> c_int;
371371

372372
pub fn EVP_MD_CTX_create() -> *mut EVP_MD_CTX;
373+
pub fn EVP_MD_CTX_copy_ex(dst: *mut EVP_MD_CTX, src: *const EVP_MD_CTX) -> c_int;
373374
pub fn EVP_MD_CTX_destroy(ctx: *mut EVP_MD_CTX);
374375

375376
pub fn EVP_PKEY_new() -> *mut EVP_PKEY;
@@ -383,6 +384,7 @@ extern "C" {
383384
pub fn HMAC_Final(ctx: *mut HMAC_CTX, output: *mut u8, len: *mut c_uint) -> c_int;
384385
pub fn HMAC_Update(ctx: *mut HMAC_CTX, input: *const u8, len: c_uint) -> c_int;
385386
pub fn HMAC_CTX_cleanup(ctx: *mut HMAC_CTX);
387+
pub fn HMAC_CTX_copy(dst: *mut HMAC_CTX, src: *const HMAC_CTX) -> c_int;
386388

387389

388390
pub fn PEM_read_bio_X509(bio: *mut BIO, out: *mut *mut X509, callback: Option<PasswordCallback>,

0 commit comments

Comments
 (0)