aboutsummaryrefslogtreecommitdiff
path: root/hash.rs
diff options
context:
space:
mode:
authorKevin Ballard <[email protected]>2013-08-22 20:31:02 -0700
committerKevin Ballard <[email protected]>2013-08-22 20:31:02 -0700
commitec7474c895f967ed67a33fd69708af68745fe078 (patch)
treeb2ecf0bc44e5d6ee5e31b69850c25ebfa9c6674f /hash.rs
parentMerge pull request #2 from erickt/master (diff)
downloadrust-openssl-ec7474c895f967ed67a33fd69708af68745fe078.tar.xz
rust-openssl-ec7474c895f967ed67a33fd69708af68745fe078.zip
Update to latest rust master (0.8-pre 063a005)
Diffstat (limited to 'hash.rs')
-rw-r--r--hash.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/hash.rs b/hash.rs
index 2a43cbd2..61f9c80f 100644
--- a/hash.rs
+++ b/hash.rs
@@ -41,6 +41,7 @@ mod libcrypto {
}
pub fn evpmd(t: HashType) -> (EVP_MD, uint) {
+ #[fixed_stack_segment]; #[inline(never)];
unsafe {
match t {
MD5 => (libcrypto::EVP_md5(), 16u),
@@ -61,6 +62,7 @@ pub struct Hasher {
impl Hasher {
pub fn new(ht: HashType) -> Hasher {
+ #[fixed_stack_segment]; #[inline(never)];
let ctx = unsafe { libcrypto::EVP_MD_CTX_create() };
let (evp, mdlen) = evpmd(ht);
unsafe {
@@ -72,6 +74,7 @@ impl Hasher {
/// Update this hasher with more input bytes
pub fn update(&self, data: &[u8]) {
+ #[fixed_stack_segment]; #[inline(never)];
do data.as_imm_buf |pdata, len| {
unsafe {
libcrypto::EVP_DigestUpdate(self.ctx, pdata, len as c_uint)
@@ -84,6 +87,7 @@ impl Hasher {
* initialization
*/
pub fn final(&self) -> ~[u8] {
+ #[fixed_stack_segment]; #[inline(never)];
let mut res = vec::from_elem(self.len, 0u8);
do res.as_mut_buf |pres, _len| {
unsafe {
@@ -96,6 +100,7 @@ impl Hasher {
impl Drop for Hasher {
fn drop(&self) {
+ #[fixed_stack_segment]; #[inline(never)];
unsafe {
libcrypto::EVP_MD_CTX_destroy(self.ctx);
}