Update some enum scope issues regarding the OpenSSL lib.
authorUmmon <greg.burri@gmail.com>
Wed, 3 Dec 2014 20:51:03 +0000 (21:51 +0100)
committerUmmon <greg.burri@gmail.com>
Wed, 3 Dec 2014 20:51:03 +0000 (21:51 +0100)
lab1_rust/Cargo.lock
lab1_rust/src/crypto.rs

index 2efcda0..9dcb782 100644 (file)
@@ -2,21 +2,21 @@
 name = "lab1_rust"
 version = "0.0.2"
 dependencies = [
 name = "lab1_rust"
 version = "0.0.2"
 dependencies = [
- "openssl 0.2.1 (git+https://github.com/sfackler/rust-openssl.git)",
+ "openssl 0.2.2 (git+https://github.com/sfackler/rust-openssl.git)",
 ]
 
 [[package]]
 name = "openssl"
 ]
 
 [[package]]
 name = "openssl"
-version = "0.2.1"
-source = "git+https://github.com/sfackler/rust-openssl.git#c3603b0db00d044c8332d39dd9d49e3c76a2a978"
+version = "0.2.2"
+source = "git+https://github.com/sfackler/rust-openssl.git#2901c279ab154933385fda86c620f87d3392a36d"
 dependencies = [
 dependencies = [
- "openssl-sys 0.2.1 (git+https://github.com/sfackler/rust-openssl.git)",
+ "openssl-sys 0.2.2 (git+https://github.com/sfackler/rust-openssl.git)",
 ]
 
 [[package]]
 name = "openssl-sys"
 ]
 
 [[package]]
 name = "openssl-sys"
-version = "0.2.1"
-source = "git+https://github.com/sfackler/rust-openssl.git#c3603b0db00d044c8332d39dd9d49e3c76a2a978"
+version = "0.2.2"
+source = "git+https://github.com/sfackler/rust-openssl.git#2901c279ab154933385fda86c620f87d3392a36d"
 dependencies = [
  "pkg-config 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 dependencies = [
  "pkg-config 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
index cc217a6..ad7e6fa 100644 (file)
@@ -1,7 +1,7 @@
 use std::rand::{ OsRng, Rng };
 use std::io::IoResult;
 use std::slice::bytes::copy_memory;
 use std::rand::{ OsRng, Rng };
 use std::io::IoResult;
 use std::slice::bytes::copy_memory;
-use openssl::crypto::hash::SHA256;
+use openssl::crypto::hash::HashType::SHA256;
 use openssl::crypto::hmac::HMAC;
 use openssl::crypto::symm;
 
 use openssl::crypto::hmac::HMAC;
 use openssl::crypto::symm;
 
@@ -20,8 +20,8 @@ pub fn compute_mac(data: &[u8]) -> [u8, ..10] {
 
 /// Encrypt may fail if the provided data size isn't a multiple of 16, no padding will be automatically added.
 pub fn encrypt(plaindata: &[u8], iv: &[u8]) -> Option<Vec<u8>> {
 
 /// Encrypt may fail if the provided data size isn't a multiple of 16, no padding will be automatically added.
 pub fn encrypt(plaindata: &[u8], iv: &[u8]) -> Option<Vec<u8>> {
-   let c = symm::Crypter::new(symm::AES_256_CBC);
-   c.init(symm::Encrypt, KEY_C, iv.to_vec());
+   let c = symm::Crypter::new(symm::Type::AES_256_CBC);
+   c.init(symm::Mode::Encrypt, KEY_C, iv.to_vec());
    c.pad(false); // Padding disabled!
    let r = c.update(plaindata);
    let rest = c.finalize();
    c.pad(false); // Padding disabled!
    let r = c.update(plaindata);
    let rest = c.finalize();
@@ -34,8 +34,8 @@ pub fn encrypt(plaindata: &[u8], iv: &[u8]) -> Option<Vec<u8>> {
 
 /// Decrypt may fail if the provided data size isn't a multiple of 16, no padding will be automatically added.
 pub fn decrypt(cipherdata: &[u8], iv: &[u8]) -> Option<Vec<u8>> {
 
 /// Decrypt may fail if the provided data size isn't a multiple of 16, no padding will be automatically added.
 pub fn decrypt(cipherdata: &[u8], iv: &[u8]) -> Option<Vec<u8>> {
-   let c = symm::Crypter::new(symm::AES_256_CBC);
-   c.init(symm::Decrypt, KEY_C, iv.to_vec());
+   let c = symm::Crypter::new(symm::Type::AES_256_CBC);
+   c.init(symm::Mode::Decrypt, KEY_C, iv.to_vec());
    c.pad(false); // Padding disabled!
    let r = c.update(cipherdata);
    let rest = c.finalize();
    c.pad(false); // Padding disabled!
    let r = c.update(cipherdata);
    let rest = c.finalize();