Commit 25e18fab authored by Kevin Ballard's avatar Kevin Ballard
Browse files

Update to latest rust master (0.9-pre 69e46f3)

parent 76a3b83d
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -20,6 +20,8 @@
       uuid = "38297409-b4c2-4499-8131-a99a7e44dad3")];
#[crate_type = "lib"];

#[feature(globs)];

pub mod hash;
pub mod hex;
pub mod hmac;
+14 −14
Original line number Diff line number Diff line
@@ -24,19 +24,19 @@ mod libcrypto {

    #[link_args = "-lcrypto"]
    extern {
        fn EVP_MD_CTX_create() -> EVP_MD_CTX;
        fn EVP_MD_CTX_destroy(ctx: EVP_MD_CTX);
        pub fn EVP_MD_CTX_create() -> EVP_MD_CTX;
        pub fn EVP_MD_CTX_destroy(ctx: EVP_MD_CTX);

        fn EVP_md5() -> EVP_MD;
        fn EVP_sha1() -> EVP_MD;
        fn EVP_sha224() -> EVP_MD;
        fn EVP_sha256() -> EVP_MD;
        fn EVP_sha384() -> EVP_MD;
        fn EVP_sha512() -> EVP_MD;
        pub fn EVP_md5() -> EVP_MD;
        pub fn EVP_sha1() -> EVP_MD;
        pub fn EVP_sha224() -> EVP_MD;
        pub fn EVP_sha256() -> EVP_MD;
        pub fn EVP_sha384() -> EVP_MD;
        pub fn EVP_sha512() -> EVP_MD;

        fn EVP_DigestInit(ctx: EVP_MD_CTX, typ: EVP_MD);
        fn EVP_DigestUpdate(ctx: EVP_MD_CTX, data: *u8, n: c_uint);
        fn EVP_DigestFinal(ctx: EVP_MD_CTX, res: *mut u8, n: *u32);
        pub fn EVP_DigestInit(ctx: EVP_MD_CTX, typ: EVP_MD);
        pub fn EVP_DigestUpdate(ctx: EVP_MD_CTX, data: *u8, n: c_uint);
        pub fn EVP_DigestFinal(ctx: EVP_MD_CTX, res: *mut u8, n: *u32);
    }
}

@@ -139,7 +139,7 @@ mod tests {
        let calced = calced_raw.to_hex();

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

        assert!(calced == hashtest.expected_output);
+1 −1
Original line number Diff line number Diff line
@@ -95,5 +95,5 @@ fn main() {

    h.update([00u8]);

    println(fmt!("%?", h.final()))
    println!("{:?}", h.final())
}
+4 −4
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@ mod libcrypto {

    #[link_args = "-lcrypto"]
    extern {
        fn PKCS5_PBKDF2_HMAC_SHA1(pass: *u8, passlen: c_int,
        pub fn PKCS5_PBKDF2_HMAC_SHA1(pass: *u8, passlen: c_int,
                                      salt: *u8, saltlen: c_int,
                                      iter: c_int, keylen: c_int,
                                      out: *mut u8) -> c_int;
+21 −21
Original line number Diff line number Diff line
@@ -17,26 +17,26 @@ mod libcrypto {

    #[link_args = "-lcrypto"]
    extern {
        fn EVP_PKEY_new() -> *EVP_PKEY;
        fn EVP_PKEY_free(k: *EVP_PKEY);
        fn EVP_PKEY_assign(pkey: *EVP_PKEY, typ: c_int, key: *c_char) -> c_int;
        fn EVP_PKEY_get1_RSA(k: *EVP_PKEY) -> *RSA;
        pub fn EVP_PKEY_new() -> *EVP_PKEY;
        pub fn EVP_PKEY_free(k: *EVP_PKEY);
        pub fn EVP_PKEY_assign(pkey: *EVP_PKEY, typ: c_int, key: *c_char) -> c_int;
        pub fn EVP_PKEY_get1_RSA(k: *EVP_PKEY) -> *RSA;

        fn i2d_PublicKey(k: *EVP_PKEY, buf: **mut u8) -> c_int;
        fn d2i_PublicKey(t: c_int, k: **EVP_PKEY, buf: **u8, len: c_uint) -> *EVP_PKEY;
        fn i2d_PrivateKey(k: *EVP_PKEY, buf: **mut u8) -> c_int;
        fn d2i_PrivateKey(t: c_int, k: **EVP_PKEY, buf: **u8, len: c_uint) -> *EVP_PKEY;
        pub fn i2d_PublicKey(k: *EVP_PKEY, buf: **mut u8) -> c_int;
        pub fn d2i_PublicKey(t: c_int, k: **EVP_PKEY, buf: **u8, len: c_uint) -> *EVP_PKEY;
        pub fn i2d_PrivateKey(k: *EVP_PKEY, buf: **mut u8) -> c_int;
        pub fn d2i_PrivateKey(t: c_int, k: **EVP_PKEY, buf: **u8, len: c_uint) -> *EVP_PKEY;

        fn RSA_generate_key(modsz: c_uint, e: c_uint, cb: *u8, cbarg: *u8) -> *RSA;
        fn RSA_size(k: *RSA) -> c_uint;
        pub fn RSA_generate_key(modsz: c_uint, e: c_uint, cb: *u8, cbarg: *u8) -> *RSA;
        pub fn RSA_size(k: *RSA) -> c_uint;

        fn RSA_public_encrypt(flen: c_uint, from: *u8, to: *mut u8, k: *RSA,
        pub fn RSA_public_encrypt(flen: c_uint, from: *u8, to: *mut u8, k: *RSA,
                                  pad: c_int) -> c_int;
        fn RSA_private_decrypt(flen: c_uint, from: *u8, to: *mut u8, k: *RSA,
        pub fn RSA_private_decrypt(flen: c_uint, from: *u8, to: *mut u8, k: *RSA,
                                   pad: c_int) -> c_int;
        fn RSA_sign(t: c_int, m: *u8, mlen: c_uint, sig: *mut u8, siglen: *mut c_uint,
        pub fn RSA_sign(t: c_int, m: *u8, mlen: c_uint, sig: *mut u8, siglen: *mut c_uint,
                        k: *RSA) -> c_int;
        fn RSA_verify(t: c_int, m: *u8, mlen: c_uint, sig: *u8, siglen: c_uint,
        pub fn RSA_verify(t: c_int, m: *u8, mlen: c_uint, sig: *u8, siglen: c_uint,
                          k: *RSA) -> c_int;
    }
}
Loading