commit
129f6c236b
|
|
@ -50,6 +50,9 @@ pub struct EVP_MD_CTX {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for EVP_MD_CTX {}
|
impl Copy for EVP_MD_CTX {}
|
||||||
|
impl Clone for EVP_MD_CTX {
|
||||||
|
fn clone(&self) -> EVP_MD_CTX { *self }
|
||||||
|
}
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub struct HMAC_CTX {
|
pub struct HMAC_CTX {
|
||||||
|
|
@ -62,6 +65,9 @@ pub struct HMAC_CTX {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for HMAC_CTX {}
|
impl Copy for HMAC_CTX {}
|
||||||
|
impl Clone for HMAC_CTX {
|
||||||
|
fn clone(&self) -> HMAC_CTX { *self }
|
||||||
|
}
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub struct X509V3_CTX {
|
pub struct X509V3_CTX {
|
||||||
|
|
@ -77,6 +83,9 @@ pub struct X509V3_CTX {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for X509V3_CTX {}
|
impl Copy for X509V3_CTX {}
|
||||||
|
impl Clone for X509V3_CTX {
|
||||||
|
fn clone(&self) -> X509V3_CTX { *self }
|
||||||
|
}
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub struct BIGNUM {
|
pub struct BIGNUM {
|
||||||
|
|
@ -88,6 +97,9 @@ pub struct BIGNUM {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copy for BIGNUM {}
|
impl Copy for BIGNUM {}
|
||||||
|
impl Clone for BIGNUM {
|
||||||
|
fn clone(&self) -> BIGNUM { *self }
|
||||||
|
}
|
||||||
|
|
||||||
pub type CRYPTO_EX_new = extern "C" fn(parent: *mut c_void, ptr: *mut c_void,
|
pub type CRYPTO_EX_new = extern "C" fn(parent: *mut c_void, ptr: *mut c_void,
|
||||||
ad: *const CRYPTO_EX_DATA, idx: c_int,
|
ad: *const CRYPTO_EX_DATA, idx: c_int,
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ use ssl::error::SslError;
|
||||||
|
|
||||||
pub struct BigNum(*mut ffi::BIGNUM);
|
pub struct BigNum(*mut ffi::BIGNUM);
|
||||||
|
|
||||||
#[derive(Copy)]
|
#[derive(Copy, Clone)]
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub enum RNGProperty {
|
pub enum RNGProperty {
|
||||||
MsbMaybeZero = -1,
|
MsbMaybeZero = -1,
|
||||||
|
|
@ -196,7 +196,7 @@ impl BigNum {
|
||||||
pub fn div_word(&mut self, w: c_ulong) -> Result<c_ulong, SslError> {
|
pub fn div_word(&mut self, w: c_ulong) -> Result<c_ulong, SslError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let result = ffi::BN_div_word(self.raw(), w);
|
let result = ffi::BN_div_word(self.raw(), w);
|
||||||
if result != -1 as c_ulong {
|
if result != !0 as c_ulong {
|
||||||
Ok(result)
|
Ok(result)
|
||||||
} else {
|
} else {
|
||||||
Err(SslError::get())
|
Err(SslError::get())
|
||||||
|
|
@ -207,7 +207,7 @@ impl BigNum {
|
||||||
pub fn mod_word(&self, w: c_ulong) -> Result<c_ulong, SslError> {
|
pub fn mod_word(&self, w: c_ulong) -> Result<c_ulong, SslError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let result = ffi::BN_mod_word(self.raw(), w);
|
let result = ffi::BN_mod_word(self.raw(), w);
|
||||||
if result != -1 as c_ulong {
|
if result != !0 as c_ulong {
|
||||||
Ok(result)
|
Ok(result)
|
||||||
} else {
|
} else {
|
||||||
Err(SslError::get())
|
Err(SslError::get())
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ use std::io;
|
||||||
use ffi;
|
use ffi;
|
||||||
|
|
||||||
/// Message digest (hash) type.
|
/// Message digest (hash) type.
|
||||||
#[derive(Copy)]
|
#[derive(Copy, Clone)]
|
||||||
pub enum Type {
|
pub enum Type {
|
||||||
MD5,
|
MD5,
|
||||||
SHA1,
|
SHA1,
|
||||||
|
|
@ -51,7 +51,7 @@ impl Type {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(PartialEq, Copy)]
|
#[derive(PartialEq, Copy, Clone)]
|
||||||
enum State {
|
enum State {
|
||||||
Reset,
|
Reset,
|
||||||
Updated,
|
Updated,
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ use std::io::prelude::*;
|
||||||
use crypto::hash::Type;
|
use crypto::hash::Type;
|
||||||
use ffi;
|
use ffi;
|
||||||
|
|
||||||
#[derive(PartialEq, Copy)]
|
#[derive(PartialEq, Copy, Clone)]
|
||||||
enum State {
|
enum State {
|
||||||
Reset,
|
Reset,
|
||||||
Updated,
|
Updated,
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ use crypto::hash::Type as HashType;
|
||||||
use ffi;
|
use ffi;
|
||||||
use ssl::error::{SslError, StreamError};
|
use ssl::error::{SslError, StreamError};
|
||||||
|
|
||||||
#[derive(Copy)]
|
#[derive(Copy, Clone)]
|
||||||
enum Parts {
|
enum Parts {
|
||||||
Neither,
|
Neither,
|
||||||
Public,
|
Public,
|
||||||
|
|
@ -17,7 +17,7 @@ enum Parts {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Represents a role an asymmetric key might be appropriate for.
|
/// Represents a role an asymmetric key might be appropriate for.
|
||||||
#[derive(Copy)]
|
#[derive(Copy, Clone)]
|
||||||
pub enum Role {
|
pub enum Role {
|
||||||
Encrypt,
|
Encrypt,
|
||||||
Decrypt,
|
Decrypt,
|
||||||
|
|
@ -26,7 +26,7 @@ pub enum Role {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Type of encryption padding to use.
|
/// Type of encryption padding to use.
|
||||||
#[derive(Copy)]
|
#[derive(Copy, Clone)]
|
||||||
pub enum EncryptionPadding {
|
pub enum EncryptionPadding {
|
||||||
OAEP,
|
OAEP,
|
||||||
PKCS1v15
|
PKCS1v15
|
||||||
|
|
|
||||||
|
|
@ -3,14 +3,14 @@ use libc::{c_int};
|
||||||
|
|
||||||
use ffi;
|
use ffi;
|
||||||
|
|
||||||
#[derive(Copy)]
|
#[derive(Copy, Clone)]
|
||||||
pub enum Mode {
|
pub enum Mode {
|
||||||
Encrypt,
|
Encrypt,
|
||||||
Decrypt,
|
Decrypt,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(non_camel_case_types)]
|
#[allow(non_camel_case_types)]
|
||||||
#[derive(Copy)]
|
#[derive(Copy, Clone)]
|
||||||
pub enum Type {
|
pub enum Type {
|
||||||
AES_128_ECB,
|
AES_128_ECB,
|
||||||
AES_128_CBC,
|
AES_128_CBC,
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ use ssl::error::{SslError, StreamError};
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests;
|
mod tests;
|
||||||
|
|
||||||
#[derive(Copy)]
|
#[derive(Copy, Clone)]
|
||||||
#[repr(i32)]
|
#[repr(i32)]
|
||||||
pub enum X509FileType {
|
pub enum X509FileType {
|
||||||
PEM = ffi::X509_FILETYPE_PEM,
|
PEM = ffi::X509_FILETYPE_PEM,
|
||||||
|
|
@ -449,7 +449,7 @@ pub struct X509Name<'x> {
|
||||||
|
|
||||||
macro_rules! make_validation_error(
|
macro_rules! make_validation_error(
|
||||||
($ok_val:ident, $($name:ident = $val:ident,)+) => (
|
($ok_val:ident, $($name:ident = $val:ident,)+) => (
|
||||||
#[derive(Copy)]
|
#[derive(Copy, Clone)]
|
||||||
pub enum X509ValidationError {
|
pub enum X509ValidationError {
|
||||||
$($name,)+
|
$($name,)+
|
||||||
X509UnknownError(c_int)
|
X509UnknownError(c_int)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue