aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Ballard <[email protected]>2013-05-29 23:42:07 -0700
committerKevin Ballard <[email protected]>2013-05-29 23:42:07 -0700
commit2eba04e579048bb33a7a99cb738d5d9118909026 (patch)
tree624777ef967533e7fcb40575a55de4058a37ee68
parentUpdate for current incoming (diff)
downloadrust-openssl-2eba04e579048bb33a7a99cb738d5d9118909026.tar.xz
rust-openssl-2eba04e579048bb33a7a99cb738d5d9118909026.zip
Update for latest incoming (3a3bf8b)
-rw-r--r--Makefile2
-rw-r--r--hash.rs4
-rw-r--r--hex.rs2
-rw-r--r--hmac.rs15
-rw-r--r--pkcs5.rs2
-rw-r--r--pkey.rs5
-rw-r--r--rand.rs3
-rw-r--r--symm.rs9
8 files changed, 26 insertions, 16 deletions
diff --git a/Makefile b/Makefile
index 2d55d237..62f080fe 100644
--- a/Makefile
+++ b/Makefile
@@ -5,3 +5,5 @@ crypto: crypto.rc $(wildcard *.rs)
clean:
rm -f crypto libcrypto-*.so
+ rm libcrypto-*.dylib
+ rm -rf *.dSYM
diff --git a/hash.rs b/hash.rs
index bd19f333..be8fb9a6 100644
--- a/hash.rs
+++ b/hash.rs
@@ -1,4 +1,5 @@
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);
diff --git a/hex.rs b/hex.rs
index 380369f4..e838080a 100644
--- a/hex.rs
+++ b/hex.rs
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-extern mod std;
+use std::{str,uint,vec};
pub trait ToHex {
fn to_hex(&self) -> ~str;
diff --git a/hmac.rs b/hmac.rs
index 1c9e145d..025c1dfe 100644
--- a/hmac.rs
+++ b/hmac.rs
@@ -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()))
}
diff --git a/pkcs5.rs b/pkcs5.rs
index c43999ee..bd122c43 100644
--- a/pkcs5.rs
+++ b/pkcs5.rs
@@ -1,4 +1,5 @@
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
diff --git a/pkey.rs b/pkey.rs
index 3d8ba5f9..30f48938 100644
--- a/pkey.rs
+++ b/pkey.rs
@@ -1,4 +1,5 @@
use std::libc::{c_int, c_uint};
+use std::{libc,cast,ptr,vec};
use hash::{HashType, MD5, SHA1, SHA224, SHA256, SHA384, SHA512};
#[allow(non_camel_case_types)]
@@ -99,7 +100,7 @@ pub fn PKey() -> PKey {
///Represents a public key, optionally with a private key attached.
priv impl PKey {
- priv fn _tostr(&self, f: extern "C" unsafe fn(*EVP_PKEY, &*mut u8) -> c_int) -> ~[u8] {
+ priv unsafe fn _tostr(&self, f: extern "C" unsafe fn(*EVP_PKEY, &*mut u8) -> c_int) -> ~[u8] {
let buf = ptr::mut_null();
let len = f(self.evp, &buf);
if len < 0 as c_int { return ~[]; }
@@ -112,7 +113,7 @@ priv impl PKey {
vec::slice(s, 0u, r as uint).to_owned()
}
- priv fn _fromstr(
+ priv unsafe fn _fromstr(
&mut self,
s: &[u8],
f: extern "C" unsafe fn(c_int, &*EVP_PKEY, &*u8, c_uint) -> *EVP_PKEY
diff --git a/rand.rs b/rand.rs
index e4cf2d1a..74d88952 100644
--- a/rand.rs
+++ b/rand.rs
@@ -1,4 +1,5 @@
use std::libc::c_int;
+use std::vec;
#[link_args = "-lcrypto"]
#[abi = "cdecl"]
@@ -28,6 +29,6 @@ mod tests {
#[test]
fn test_rand_bytes() {
let bytes = rand_bytes(32u);
- io::println(fmt!("%?", bytes));
+ println(fmt!("%?", bytes));
}
}
diff --git a/symm.rs b/symm.rs
index 1cb8ed44..e483a079 100644
--- a/symm.rs
+++ b/symm.rs
@@ -1,4 +1,5 @@
use std::libc::{c_int, c_uint};
+use std::{libc,vec};
#[allow(non_camel_case_types)]
type EVP_CIPHER_CTX = *libc::c_void;
@@ -236,11 +237,11 @@ mod tests {
let computed = cipher.update(pt.from_hex()) + cipher.final();
if computed != expected {
- io::println(fmt!("Computed: %s", computed.to_hex()));
- io::println(fmt!("Expected: %s", expected.to_hex()));
+ println(fmt!("Computed: %s", computed.to_hex()));
+ println(fmt!("Expected: %s", expected.to_hex()));
if computed.len() != expected.len() {
- io::println(fmt!("Lengths differ: %u in computed vs %u expected",
- computed.len(), expected.len()));
+ println(fmt!("Lengths differ: %u in computed vs %u expected",
+ computed.len(), expected.len()));
}
fail!(~"test failure");
}