aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorValerii Hiora <[email protected]>2015-01-03 16:42:58 +0200
committerValerii Hiora <[email protected]>2015-01-03 16:42:58 +0200
commitcf028e971a11f7ab0a5ab2c01daa03d559db1322 (patch)
tree7d7d52e3e7542c7cea656ea69e7a05d10c4ab7b4 /src
parentMerge pull request #134 from DiamondLovesYou/master (diff)
downloadrust-openssl-cf028e971a11f7ab0a5ab2c01daa03d559db1322.tar.xz
rust-openssl-cf028e971a11f7ab0a5ab2c01daa03d559db1322.zip
Updated to master:
- library stab issues - deriving -> derive - {mod} -> {self}
Diffstat (limited to 'src')
-rw-r--r--src/bn/mod.rs18
-rw-r--r--src/crypto/hash.rs2
-rw-r--r--src/crypto/hmac.rs2
-rw-r--r--src/crypto/pkey.rs6
-rw-r--r--src/crypto/symm.rs4
-rw-r--r--src/ssl/error.rs4
-rw-r--r--src/ssl/mod.rs12
-rw-r--r--src/x509/mod.rs16
8 files changed, 35 insertions, 29 deletions
diff --git a/src/bn/mod.rs b/src/bn/mod.rs
index bcf6c104..0bc79a8f 100644
--- a/src/bn/mod.rs
+++ b/src/bn/mod.rs
@@ -1,13 +1,14 @@
use libc::{c_int, c_ulong, c_void};
-use std::{fmt, ptr};
use std::c_str::CString;
+use std::cmp::Ordering;
+use std::{fmt, ptr};
use ffi;
use ssl::error::SslError;
pub struct BigNum(*mut ffi::BIGNUM);
-#[deriving(Copy)]
+#[derive(Copy)]
#[repr(C)]
pub enum RNGProperty {
MsbMaybeZero = -1,
@@ -303,11 +304,11 @@ impl BigNum {
unsafe {
let res = ffi::BN_ucmp(self.raw(), oth.raw()) as i32;
if res < 0 {
- Less
+ Ordering::Less
} else if res > 0 {
- Greater
+ Ordering::Greater
} else {
- Equal
+ Ordering::Equal
}
}
}
@@ -382,11 +383,11 @@ impl PartialOrd for BigNum {
let v = ffi::BN_cmp(self.raw(), oth.raw());
let ret =
if v == 0 {
- Equal
+ Ordering::Equal
} else if v < 0 {
- Less
+ Ordering::Less
} else {
- Greater
+ Ordering::Greater
};
Some(ret)
}
@@ -404,6 +405,7 @@ impl Drop for BigNum {
}
pub mod unchecked {
+ use std::ops::{Add, Div, Mul, Neg, Rem, Shl, Shr, Sub};
use ffi;
use super::{BigNum};
diff --git a/src/crypto/hash.rs b/src/crypto/hash.rs
index 2a181526..a9711e92 100644
--- a/src/crypto/hash.rs
+++ b/src/crypto/hash.rs
@@ -4,7 +4,7 @@ use std::io;
use ffi;
-#[deriving(Copy)]
+#[derive(Copy)]
pub enum HashType {
MD5,
SHA1,
diff --git a/src/crypto/hmac.rs b/src/crypto/hmac.rs
index 9e8b6361..03e59c6f 100644
--- a/src/crypto/hmac.rs
+++ b/src/crypto/hmac.rs
@@ -72,7 +72,7 @@ impl Drop for HMAC {
#[cfg(test)]
mod tests {
use serialize::hex::FromHex;
- use crypto::hash::HashType::{mod, MD5, SHA1, SHA224, SHA256, SHA384, SHA512};
+ use crypto::hash::HashType::{self, MD5, SHA1, SHA224, SHA256, SHA384, SHA512};
use super::HMAC;
#[test]
diff --git a/src/crypto/pkey.rs b/src/crypto/pkey.rs
index bab7addc..ac3a407e 100644
--- a/src/crypto/pkey.rs
+++ b/src/crypto/pkey.rs
@@ -6,7 +6,7 @@ use crypto::hash::HashType;
use ffi;
use ssl::error::{SslError, StreamError};
-#[deriving(Copy)]
+#[derive(Copy)]
enum Parts {
Neither,
Public,
@@ -14,7 +14,7 @@ enum Parts {
}
/// Represents a role an asymmetric key might be appropriate for.
-#[deriving(Copy)]
+#[derive(Copy)]
pub enum Role {
Encrypt,
Decrypt,
@@ -23,7 +23,7 @@ pub enum Role {
}
/// Type of encryption padding to use.
-#[deriving(Copy)]
+#[derive(Copy)]
pub enum EncryptionPadding {
OAEP,
PKCS1v15
diff --git a/src/crypto/symm.rs b/src/crypto/symm.rs
index 61365f2e..d1021b37 100644
--- a/src/crypto/symm.rs
+++ b/src/crypto/symm.rs
@@ -2,14 +2,14 @@ use libc::{c_int};
use ffi;
-#[deriving(Copy)]
+#[derive(Copy)]
pub enum Mode {
Encrypt,
Decrypt,
}
#[allow(non_camel_case_types)]
-#[deriving(Copy)]
+#[derive(Copy)]
pub enum Type {
AES_128_ECB,
AES_128_CBC,
diff --git a/src/ssl/error.rs b/src/ssl/error.rs
index 7e8daef1..888a9cdc 100644
--- a/src/ssl/error.rs
+++ b/src/ssl/error.rs
@@ -9,7 +9,7 @@ use std::c_str::CString;
use ffi;
/// An SSL error
-#[deriving(Show, Clone, PartialEq, Eq)]
+#[derive(Show, Clone, PartialEq, Eq)]
pub enum SslError {
/// The underlying stream reported an error
StreamError(IoError),
@@ -37,7 +37,7 @@ impl error::Error for SslError {
}
/// An error from the OpenSSL library
-#[deriving(Show, Clone, PartialEq, Eq)]
+#[derive(Show, Clone, PartialEq, Eq)]
pub enum OpensslError {
/// An unknown error
UnknownError {
diff --git a/src/ssl/mod.rs b/src/ssl/mod.rs
index 1bd36147..3a19f643 100644
--- a/src/ssl/mod.rs
+++ b/src/ssl/mod.rs
@@ -1,6 +1,8 @@
use libc::{c_int, c_void, c_long};
+use std::c_str::ToCStr;
use std::io::{IoResult, IoError, EndOfFile, Stream, Reader, Writer};
use std::mem;
+use std::num::FromPrimitive;
use std::ptr;
use std::sync::{Once, ONCE_INIT, Arc};
@@ -31,9 +33,9 @@ fn init() {
}
/// Determines the SSL method supported
-#[deriving(Show, Hash, PartialEq, Eq)]
+#[derive(Show, Hash, PartialEq, Eq)]
#[allow(non_camel_case_types)]
-#[deriving(Copy)]
+#[derive(Copy)]
pub enum SslMethod {
#[cfg(feature = "sslv2")]
/// Only support the SSLv2 protocol, requires `feature="sslv2"`
@@ -69,7 +71,7 @@ impl SslMethod {
}
/// Determines the type of certificate verification used
-#[deriving(Copy)]
+#[derive(Copy)]
#[repr(i32)]
pub enum SslVerifyMode {
/// Verify that the server's certificate is trusted
@@ -389,7 +391,7 @@ impl Ssl {
}
-#[deriving(FromPrimitive, Show)]
+#[derive(FromPrimitive, Show)]
#[repr(i32)]
enum LibSslError {
ErrorNone = ffi::SSL_ERROR_NONE,
@@ -404,7 +406,7 @@ enum LibSslError {
}
/// A stream wrapper which handles SSL encryption for an underlying stream.
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct SslStream<S> {
stream: S,
ssl: Arc<Ssl>,
diff --git a/src/x509/mod.rs b/src/x509/mod.rs
index c82eab11..ed8fb77d 100644
--- a/src/x509/mod.rs
+++ b/src/x509/mod.rs
@@ -1,4 +1,6 @@
use libc::{c_int, c_long, c_uint};
+use std::c_str::ToCStr;
+use std::cmp::Ordering;
use std::mem;
use std::num::SignedInt;
use std::ptr;
@@ -15,7 +17,7 @@ use ssl::error::{SslError, StreamError};
#[cfg(test)]
mod tests;
-#[deriving(Copy)]
+#[derive(Copy)]
#[repr(i32)]
pub enum X509FileType {
PEM = ffi::X509_FILETYPE_PEM,
@@ -56,7 +58,7 @@ trait AsStr<'a> {
fn as_str(&self) -> &'a str;
}
-#[deriving(Clone, Copy)]
+#[derive(Clone, Copy)]
pub enum KeyUsage {
DigitalSignature,
NonRepudiation,
@@ -86,7 +88,7 @@ impl AsStr<'static> for KeyUsage {
}
-#[deriving(Clone, Copy)]
+#[derive(Clone, Copy)]
pub enum ExtKeyUsage {
ServerAuth,
ClientAuth,
@@ -395,9 +397,9 @@ impl<'ctx> X509<'ctx> {
_ => {
let act_len = act_len as uint;
match len.cmp(&act_len) {
- Greater => None,
- Equal => Some(v),
- Less => panic!("Fingerprint buffer was corrupted!")
+ Ordering::Greater => None,
+ Ordering::Equal => Some(v),
+ Ordering::Less => panic!("Fingerprint buffer was corrupted!")
}
}
}
@@ -432,7 +434,7 @@ pub struct X509Name<'x> {
macro_rules! make_validation_error(
($ok_val:ident, $($name:ident = $val:ident,)+) => (
- #[deriving(Copy)]
+ #[derive(Copy)]
pub enum X509ValidationError {
$($name,)+
X509UnknownError(c_int)