diff options
| author | Steven Fackler <[email protected]> | 2015-11-10 21:32:19 -0800 |
|---|---|---|
| committer | Steven Fackler <[email protected]> | 2015-11-16 20:16:01 -0800 |
| commit | a8a10e64ad21fe900dbeef220493cc31cbeda48e (patch) | |
| tree | 22677ed06cdb8956fac3a017639ee52e8baf07a5 /openssl/src/crypto | |
| parent | Bump ws2_32-sys version (diff) | |
| download | rust-openssl-a8a10e64ad21fe900dbeef220493cc31cbeda48e.tar.xz rust-openssl-a8a10e64ad21fe900dbeef220493cc31cbeda48e.zip | |
Split stuff requiring a shim out to a separate crate
Diffstat (limited to 'openssl/src/crypto')
| -rw-r--r-- | openssl/src/crypto/hmac.rs | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/openssl/src/crypto/hmac.rs b/openssl/src/crypto/hmac.rs index 5c9f7576..474cbc8a 100644 --- a/openssl/src/crypto/hmac.rs +++ b/openssl/src/crypto/hmac.rs @@ -21,6 +21,7 @@ use std::io::prelude::*; use crypto::hash::Type; use ffi; +use ffi_extras; #[derive(PartialEq, Copy, Clone)] enum State { @@ -88,9 +89,10 @@ impl HMAC { #[inline] fn init_once(&mut self, md: *const ffi::EVP_MD, key: &[u8]) { unsafe { - let r = ffi::HMAC_Init_ex(&mut self.ctx, - key.as_ptr(), key.len() as c_int, - md, 0 as *const _); + let r = ffi_extras::HMAC_Init_ex(&mut self.ctx, + key.as_ptr(), + key.len() as c_int, + md, 0 as *const _); assert_eq!(r, 1); } self.state = Reset; @@ -106,9 +108,9 @@ impl HMAC { // If the key and/or md is not supplied it's reused from the last time // avoiding redundant initializations unsafe { - let r = ffi::HMAC_Init_ex(&mut self.ctx, - 0 as *const _, 0, - 0 as *const _, 0 as *const _); + let r = ffi_extras::HMAC_Init_ex(&mut self.ctx, + 0 as *const _, 0, + 0 as *const _, 0 as *const _); assert_eq!(r, 1); } self.state = Reset; @@ -120,7 +122,7 @@ impl HMAC { self.init(); } unsafe { - let r = ffi::HMAC_Update(&mut self.ctx, data.as_ptr(), data.len() as c_uint); + let r = ffi_extras::HMAC_Update(&mut self.ctx, data.as_ptr(), data.len() as c_uint); assert_eq!(r, 1); } self.state = Updated; @@ -135,7 +137,7 @@ impl HMAC { let mut res: Vec<u8> = repeat(0).take(md_len).collect(); unsafe { let mut len = 0; - let r = ffi::HMAC_Final(&mut self.ctx, res.as_mut_ptr(), &mut len); + let r = ffi_extras::HMAC_Final(&mut self.ctx, res.as_mut_ptr(), &mut len); self.state = Finalized; assert_eq!(len as usize, md_len); assert_eq!(r, 1); @@ -181,7 +183,7 @@ impl Drop for HMAC { if self.state != Finalized { let mut buf: Vec<u8> = repeat(0).take(self.type_.md_len()).collect(); let mut len = 0; - ffi::HMAC_Final(&mut self.ctx, buf.as_mut_ptr(), &mut len); + ffi_extras::HMAC_Final(&mut self.ctx, buf.as_mut_ptr(), &mut len); } ffi::HMAC_CTX_cleanup(&mut self.ctx); } |