Commit 2eba04e5 authored by Kevin Ballard's avatar Kevin Ballard
Browse files

Update for latest incoming (3a3bf8b)

parent 08cdf5fd
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -5,3 +5,5 @@ crypto: crypto.rc $(wildcard *.rs)

clean:
	rm -f crypto libcrypto-*.so
	rm libcrypto-*.dylib
	rm -rf *.dSYM
+3 −1
Original line number Diff line number Diff line
use std::libc::c_uint;
use std::{libc,vec,ptr};

pub enum HashType {
    MD5,
@@ -108,6 +109,7 @@ mod tests {
    use super::*;
    use hex::FromHex;
    use hex::ToHex;
    use std::vec;

    struct HashTest {
        input: ~[u8],
@@ -125,7 +127,7 @@ mod tests {
        let calced = calced_raw.to_hex();

        if calced != hashtest.expected_output {
            io::println(fmt!("Test failed - %s != %s", calced, hashtest.expected_output));
            println(fmt!("Test failed - %s != %s", calced, hashtest.expected_output));
        }

        assert!(calced == hashtest.expected_output);
+1 −1
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@
 * limitations under the License.
 */

extern mod std;
use std::{str,uint,vec};

pub trait ToHex {
    fn to_hex(&self) -> ~str;
+8 −7
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
 */

use hash::*;
use std::{libc,ptr,vec};

#[allow(non_camel_case_types)]
pub struct HMAC_CTX {
@@ -47,12 +48,12 @@ pub fn HMAC(ht: HashType, key: ~[u8]) -> HMAC {
        let (evp, mdlen) = evpmd(ht);

        let mut ctx : HMAC_CTX = HMAC_CTX {
            mut md: ptr::null(),
            mut md_ctx: ptr::null(),
            mut i_ctx: ptr::null(),
            mut o_ctx: ptr::null(),
            mut key_length: 0,
            mut key: [0u8, .. 128]
            md: ptr::null(),
            md_ctx: ptr::null(),
            i_ctx: ptr::null(),
            o_ctx: ptr::null(),
            key_length: 0,
            key: [0u8, .. 128]
        };

        HMAC_CTX_init(&mut ctx,
@@ -91,5 +92,5 @@ fn main() {

    h.update([00u8]);

    io::println(fmt!("%?", h.final()))
    println(fmt!("%?", h.final()))
}
+2 −0
Original line number Diff line number Diff line
use std::libc::c_int;
use std::{vec,str};

#[link_args = "-lcrypto"]
#[abi = "cdecl"]
@@ -43,6 +44,7 @@ pub fn pbkdf2_hmac_sha1(pass: &str, salt: &[u8], iter: uint,
#[cfg(test)]
mod tests {
    use super::*;
    use std::str;

    // Test vectors from
    // http://tools.ietf.org/html/draft-josefsson-pbkdf2-test-vectors-06
Loading