aboutsummaryrefslogtreecommitdiff
path: root/crypto
diff options
context:
space:
mode:
authorSteven Fackler <[email protected]>2014-03-20 19:09:39 -0700
committerSteven Fackler <[email protected]>2014-03-20 19:09:39 -0700
commit761901d0e409304450a49d784bae989d125c68b2 (patch)
treeaf3fc7d28f78c8245c851edda27737e057c037fb /crypto
parentClean up locking code a bit (diff)
downloadrust-openssl-761901d0e409304450a49d784bae989d125c68b2.tar.xz
rust-openssl-761901d0e409304450a49d784bae989d125c68b2.zip
Update for vec API changes
Diffstat (limited to 'crypto')
-rw-r--r--crypto/hash.rs4
-rw-r--r--crypto/hmac.rs4
-rw-r--r--crypto/pkcs5.rs4
-rw-r--r--crypto/pkey.rs10
-rw-r--r--crypto/rand.rs4
-rw-r--r--crypto/symm.rs6
6 files changed, 16 insertions, 16 deletions
diff --git a/crypto/hash.rs b/crypto/hash.rs
index 9a1a078a..c4d27a7a 100644
--- a/crypto/hash.rs
+++ b/crypto/hash.rs
@@ -1,7 +1,7 @@
use std::libc::c_uint;
use std::libc;
use std::ptr;
-use std::vec;
+use std::slice;
pub enum HashType {
MD5,
@@ -78,7 +78,7 @@ impl Hasher {
*/
pub fn final(&self) -> ~[u8] {
unsafe {
- let mut res = vec::from_elem(self.len, 0u8);
+ let mut res = slice::from_elem(self.len, 0u8);
EVP_DigestFinal(self.ctx, res.as_mut_ptr(), ptr::null());
res
}
diff --git a/crypto/hmac.rs b/crypto/hmac.rs
index d7a76e08..2056dc09 100644
--- a/crypto/hmac.rs
+++ b/crypto/hmac.rs
@@ -16,7 +16,7 @@
use std::libc::{c_uchar, c_int, c_uint};
use std::ptr;
-use std::vec;
+use std::slice;
use crypto::hash;
#[allow(non_camel_case_types)]
@@ -72,7 +72,7 @@ impl HMAC {
pub fn final(&mut self) -> ~[u8] {
unsafe {
- let mut res = vec::from_elem(self.len, 0u8);
+ let mut res = slice::from_elem(self.len, 0u8);
let mut outlen = 0;
HMAC_Final(&mut self.ctx, res.as_mut_ptr(), &mut outlen);
assert!(self.len == outlen as uint)
diff --git a/crypto/pkcs5.rs b/crypto/pkcs5.rs
index 4dec03f6..d50666a1 100644
--- a/crypto/pkcs5.rs
+++ b/crypto/pkcs5.rs
@@ -1,5 +1,5 @@
use std::libc::c_int;
-use std::vec;
+use std::slice;
#[link(name = "crypto")]
extern {
@@ -15,7 +15,7 @@ pub fn pbkdf2_hmac_sha1(pass: &str, salt: &[u8], iter: uint, keylen: uint) -> ~[
assert!(iter >= 1);
assert!(keylen >= 1);
- let mut out = vec::with_capacity(keylen);
+ let mut out = slice::with_capacity(keylen);
let r = PKCS5_PBKDF2_HMAC_SHA1(
pass.as_ptr(), pass.len() as c_int,
diff --git a/crypto/pkey.rs b/crypto/pkey.rs
index 8a2b06c1..b4b910bc 100644
--- a/crypto/pkey.rs
+++ b/crypto/pkey.rs
@@ -2,7 +2,7 @@ use std::cast;
use std::libc::{c_char, c_int, c_uint};
use std::libc;
use std::ptr;
-use std::vec;
+use std::slice;
use crypto::hash::{HashType, MD5, SHA1, SHA224, SHA256, SHA384, SHA512};
#[allow(non_camel_case_types)]
@@ -94,7 +94,7 @@ impl PKey {
unsafe {
let len = f(self.evp, ptr::null());
if len < 0 as c_int { return ~[]; }
- let mut s = vec::from_elem(len as uint, 0u8);
+ let mut s = slice::from_elem(len as uint, 0u8);
let r = f(self.evp, &s.as_mut_ptr());
@@ -219,7 +219,7 @@ impl PKey {
assert!(s.len() < self.max_data());
- let mut r = vec::from_elem(len as uint + 1u, 0u8);
+ let mut r = slice::from_elem(len as uint + 1u, 0u8);
let rv = RSA_public_encrypt(
s.len() as c_uint,
@@ -244,7 +244,7 @@ impl PKey {
assert_eq!(s.len() as c_uint, RSA_size(rsa));
- let mut r = vec::from_elem(len as uint + 1u, 0u8);
+ let mut r = slice::from_elem(len as uint + 1u, 0u8);
let rv = RSA_private_decrypt(
s.len() as c_uint,
@@ -289,7 +289,7 @@ impl PKey {
unsafe {
let rsa = EVP_PKEY_get1_RSA(self.evp);
let mut len = RSA_size(rsa);
- let mut r = vec::from_elem(len as uint + 1u, 0u8);
+ let mut r = slice::from_elem(len as uint + 1u, 0u8);
let rv = RSA_sign(
openssl_hash_nid(hash),
diff --git a/crypto/rand.rs b/crypto/rand.rs
index 4e95046b..9ded0a76 100644
--- a/crypto/rand.rs
+++ b/crypto/rand.rs
@@ -1,5 +1,5 @@
use std::libc::c_int;
-use std::vec;
+use std::slice;
#[link(name = "crypto")]
extern {
@@ -8,7 +8,7 @@ extern {
pub fn rand_bytes(len: uint) -> ~[u8] {
unsafe {
- let mut out = vec::with_capacity(len);
+ let mut out = slice::with_capacity(len);
let r = RAND_bytes(out.as_mut_ptr(), len as c_int);
if r != 1 as c_int { fail!() }
diff --git a/crypto/symm.rs b/crypto/symm.rs
index 84900447..949cb2da 100644
--- a/crypto/symm.rs
+++ b/crypto/symm.rs
@@ -1,6 +1,6 @@
use std::libc::{c_int, c_uint};
use std::libc;
-use std::vec;
+use std::slice;
#[allow(non_camel_case_types)]
pub type EVP_CIPHER_CTX = *libc::c_void;
@@ -126,7 +126,7 @@ impl Crypter {
*/
pub fn update(&self, data: &[u8]) -> ~[u8] {
unsafe {
- let mut res = vec::from_elem(data.len() + self.blocksize, 0u8);
+ let mut res = slice::from_elem(data.len() + self.blocksize, 0u8);
let mut reslen = (data.len() + self.blocksize) as u32;
EVP_CipherUpdate(
@@ -147,7 +147,7 @@ impl Crypter {
*/
pub fn final(&self) -> ~[u8] {
unsafe {
- let mut res = vec::from_elem(self.blocksize, 0u8);
+ let mut res = slice::from_elem(self.blocksize, 0u8);
let mut reslen = self.blocksize as c_int;
EVP_CipherFinal(self.ctx,