Run `cargo fix --edition
This commit is contained in:
parent
03dda42d1a
commit
46787b7b69
|
|
@ -37,7 +37,7 @@
|
||||||
//! assert_eq!(&orig_key[..], &key_to_wrap[..]);
|
//! assert_eq!(&orig_key[..], &key_to_wrap[..]);
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
use ffi;
|
use crate::ffi;
|
||||||
use libc::{c_int, c_uint, size_t};
|
use libc::{c_int, c_uint, size_t};
|
||||||
use std::{mem, ptr};
|
use std::{mem, ptr};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
//! use boring::asn1::Asn1Time;
|
//! use boring::asn1::Asn1Time;
|
||||||
//! let tomorrow = Asn1Time::days_from_now(1);
|
//! let tomorrow = Asn1Time::days_from_now(1);
|
||||||
//! ```
|
//! ```
|
||||||
use ffi;
|
use crate::ffi;
|
||||||
use foreign_types::{ForeignType, ForeignTypeRef};
|
use foreign_types::{ForeignType, ForeignTypeRef};
|
||||||
use libc::{c_char, c_int, c_long, time_t};
|
use libc::{c_char, c_int, c_long, time_t};
|
||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
|
|
@ -34,12 +34,12 @@ use std::ptr;
|
||||||
use std::slice;
|
use std::slice;
|
||||||
use std::str;
|
use std::str;
|
||||||
|
|
||||||
use bio::MemBio;
|
use crate::bio::MemBio;
|
||||||
use bn::{BigNum, BigNumRef};
|
use crate::bn::{BigNum, BigNumRef};
|
||||||
use error::ErrorStack;
|
use crate::error::ErrorStack;
|
||||||
use nid::Nid;
|
use crate::nid::Nid;
|
||||||
use string::OpensslString;
|
use crate::string::OpensslString;
|
||||||
use {cvt, cvt_p};
|
use crate::{cvt, cvt_p};
|
||||||
|
|
||||||
foreign_type_and_impl_send_sync! {
|
foreign_type_and_impl_send_sync! {
|
||||||
type CType = ffi::ASN1_GENERALIZEDTIME;
|
type CType = ffi::ASN1_GENERALIZEDTIME;
|
||||||
|
|
@ -418,7 +418,7 @@ impl Asn1IntegerRef {
|
||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)]
|
||||||
#[deprecated(since = "0.10.6", note = "use to_bn instead")]
|
#[deprecated(since = "0.10.6", note = "use to_bn instead")]
|
||||||
pub fn get(&self) -> i64 {
|
pub fn get(&self) -> i64 {
|
||||||
unsafe { ::ffi::ASN1_INTEGER_get(self.as_ptr()) as i64 }
|
unsafe { crate::ffi::ASN1_INTEGER_get(self.as_ptr()) as i64 }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Converts the integer to a `BigNum`.
|
/// Converts the integer to a `BigNum`.
|
||||||
|
|
@ -428,7 +428,10 @@ impl Asn1IntegerRef {
|
||||||
/// [`ASN1_INTEGER_to_BN`]: https://www.openssl.org/docs/man1.1.0/crypto/ASN1_INTEGER_get.html
|
/// [`ASN1_INTEGER_to_BN`]: https://www.openssl.org/docs/man1.1.0/crypto/ASN1_INTEGER_get.html
|
||||||
pub fn to_bn(&self) -> Result<BigNum, ErrorStack> {
|
pub fn to_bn(&self) -> Result<BigNum, ErrorStack> {
|
||||||
unsafe {
|
unsafe {
|
||||||
cvt_p(::ffi::ASN1_INTEGER_to_BN(self.as_ptr(), ptr::null_mut()))
|
cvt_p(crate::ffi::ASN1_INTEGER_to_BN(
|
||||||
|
self.as_ptr(),
|
||||||
|
ptr::null_mut(),
|
||||||
|
))
|
||||||
.map(|p| BigNum::from_ptr(p))
|
.map(|p| BigNum::from_ptr(p))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -441,7 +444,7 @@ impl Asn1IntegerRef {
|
||||||
/// [`bn`]: ../bn/struct.BigNumRef.html#method.to_asn1_integer
|
/// [`bn`]: ../bn/struct.BigNumRef.html#method.to_asn1_integer
|
||||||
/// [`ASN1_INTEGER_set`]: https://www.openssl.org/docs/man1.1.0/crypto/ASN1_INTEGER_set.html
|
/// [`ASN1_INTEGER_set`]: https://www.openssl.org/docs/man1.1.0/crypto/ASN1_INTEGER_set.html
|
||||||
pub fn set(&mut self, value: i32) -> Result<(), ErrorStack> {
|
pub fn set(&mut self, value: i32) -> Result<(), ErrorStack> {
|
||||||
unsafe { cvt(::ffi::ASN1_INTEGER_set(self.as_ptr(), value as c_long)).map(|_| ()) }
|
unsafe { cvt(crate::ffi::ASN1_INTEGER_set(self.as_ptr(), value as c_long)).map(|_| ()) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -551,14 +554,14 @@ impl fmt::Debug for Asn1ObjectRef {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
use ffi::ASN1_STRING_get0_data;
|
use crate::ffi::ASN1_STRING_get0_data;
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
use bn::BigNum;
|
use crate::bn::BigNum;
|
||||||
use nid::Nid;
|
use crate::nid::Nid;
|
||||||
|
|
||||||
/// Tests conversion between BigNum and Asn1Integer.
|
/// Tests conversion between BigNum and Asn1Integer.
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
//! Base64 encoding support.
|
//! Base64 encoding support.
|
||||||
use cvt_n;
|
use crate::cvt_n;
|
||||||
use error::ErrorStack;
|
use crate::error::ErrorStack;
|
||||||
use ffi;
|
use crate::ffi;
|
||||||
use libc::c_int;
|
use libc::c_int;
|
||||||
|
|
||||||
/// Encodes a slice of bytes to a base64 string.
|
/// Encodes a slice of bytes to a base64 string.
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
use ffi;
|
use crate::ffi;
|
||||||
use ffi::BIO_new_mem_buf;
|
use crate::ffi::BIO_new_mem_buf;
|
||||||
use libc::c_int;
|
use libc::c_int;
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
use std::slice;
|
use std::slice;
|
||||||
|
|
||||||
use cvt_p;
|
use crate::cvt_p;
|
||||||
use error::ErrorStack;
|
use crate::error::ErrorStack;
|
||||||
|
|
||||||
pub struct MemBioSlice<'a>(*mut ffi::BIO, PhantomData<&'a [u8]>);
|
pub struct MemBioSlice<'a>(*mut ffi::BIO, PhantomData<&'a [u8]>);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
//! [`BIGNUM`]: https://wiki.openssl.org/index.php/Manual:Bn_internal(3)
|
//! [`BIGNUM`]: https://wiki.openssl.org/index.php/Manual:Bn_internal(3)
|
||||||
use ffi;
|
use crate::ffi;
|
||||||
use foreign_types::{ForeignType, ForeignTypeRef};
|
use foreign_types::{ForeignType, ForeignTypeRef};
|
||||||
use libc::{c_int, size_t};
|
use libc::{c_int, size_t};
|
||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
|
|
@ -30,11 +30,11 @@ use std::ffi::CString;
|
||||||
use std::ops::{Add, Deref, Div, Mul, Neg, Rem, Shl, Shr, Sub};
|
use std::ops::{Add, Deref, Div, Mul, Neg, Rem, Shl, Shr, Sub};
|
||||||
use std::{fmt, ptr};
|
use std::{fmt, ptr};
|
||||||
|
|
||||||
use asn1::Asn1Integer;
|
use crate::asn1::Asn1Integer;
|
||||||
use error::ErrorStack;
|
use crate::error::ErrorStack;
|
||||||
use ffi::BN_is_negative;
|
use crate::ffi::BN_is_negative;
|
||||||
use string::OpensslString;
|
use crate::string::OpensslString;
|
||||||
use {cvt, cvt_n, cvt_p};
|
use crate::{cvt, cvt_n, cvt_p};
|
||||||
|
|
||||||
/// Options for the most significant bits of a randomly generated `BigNum`.
|
/// Options for the most significant bits of a randomly generated `BigNum`.
|
||||||
pub struct MsbOption(c_int);
|
pub struct MsbOption(c_int);
|
||||||
|
|
@ -1231,7 +1231,7 @@ impl Neg for BigNum {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use bn::{BigNum, BigNumContext};
|
use crate::bn::{BigNum, BigNumContext};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_to_from_slice() {
|
fn test_to_from_slice() {
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
//! Interface for processing OpenSSL configuration files.
|
//! Interface for processing OpenSSL configuration files.
|
||||||
use ffi;
|
use crate::ffi;
|
||||||
use libc::c_void;
|
use libc::c_void;
|
||||||
|
|
||||||
use cvt_p;
|
use crate::cvt_p;
|
||||||
use error::ErrorStack;
|
use crate::error::ErrorStack;
|
||||||
|
|
||||||
pub struct ConfMethod(*mut c_void);
|
pub struct ConfMethod(*mut c_void);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
//! Shared secret derivation.
|
//! Shared secret derivation.
|
||||||
use ffi;
|
use crate::ffi;
|
||||||
use foreign_types::ForeignTypeRef;
|
use foreign_types::ForeignTypeRef;
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
use error::ErrorStack;
|
use crate::error::ErrorStack;
|
||||||
use pkey::{HasPrivate, HasPublic, PKeyRef};
|
use crate::pkey::{HasPrivate, HasPublic, PKeyRef};
|
||||||
use {cvt, cvt_p};
|
use crate::{cvt, cvt_p};
|
||||||
|
|
||||||
/// A type used to derive a shared secret between two keys.
|
/// A type used to derive a shared secret between two keys.
|
||||||
pub struct Deriver<'a>(*mut ffi::EVP_PKEY_CTX, PhantomData<&'a ()>);
|
pub struct Deriver<'a>(*mut ffi::EVP_PKEY_CTX, PhantomData<&'a ()>);
|
||||||
|
|
@ -97,9 +97,9 @@ impl<'a> Deriver<'a> {
|
||||||
mod test {
|
mod test {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
use ec::{EcGroup, EcKey};
|
use crate::ec::{EcGroup, EcKey};
|
||||||
use nid::Nid;
|
use crate::nid::Nid;
|
||||||
use pkey::PKey;
|
use crate::pkey::PKey;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn derive_without_peer() {
|
fn derive_without_peer() {
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
use error::ErrorStack;
|
use crate::error::ErrorStack;
|
||||||
use ffi;
|
use crate::ffi;
|
||||||
use foreign_types::{ForeignType, ForeignTypeRef};
|
use foreign_types::{ForeignType, ForeignTypeRef};
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
use bn::BigNum;
|
use crate::bn::BigNum;
|
||||||
use pkey::{HasParams, Params};
|
use crate::pkey::{HasParams, Params};
|
||||||
use {cvt, cvt_p};
|
use crate::{cvt, cvt_p};
|
||||||
|
|
||||||
generic_foreign_type_and_impl_send_sync! {
|
generic_foreign_type_and_impl_send_sync! {
|
||||||
type CType = ffi::DH;
|
type CType = ffi::DH;
|
||||||
|
|
@ -80,13 +80,13 @@ impl Dh<Params> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
use ffi::DH_set0_pqg;
|
use crate::ffi::DH_set0_pqg;
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use bn::BigNum;
|
use crate::bn::BigNum;
|
||||||
use dh::Dh;
|
use crate::dh::Dh;
|
||||||
use ssl::{SslContext, SslMethod};
|
use crate::ssl::{SslContext, SslMethod};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_dh() {
|
fn test_dh() {
|
||||||
|
|
|
||||||
|
|
@ -5,17 +5,17 @@
|
||||||
//! using the private key that can be validated with the public key but not be generated
|
//! using the private key that can be validated with the public key but not be generated
|
||||||
//! without the private key.
|
//! without the private key.
|
||||||
|
|
||||||
use ffi;
|
use crate::ffi;
|
||||||
use foreign_types::{ForeignType, ForeignTypeRef};
|
use foreign_types::{ForeignType, ForeignTypeRef};
|
||||||
use libc::c_uint;
|
use libc::c_uint;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
use bn::{BigNum, BigNumRef};
|
use crate::bn::{BigNum, BigNumRef};
|
||||||
use error::ErrorStack;
|
use crate::error::ErrorStack;
|
||||||
use pkey::{HasParams, HasPrivate, HasPublic, Private, Public};
|
use crate::pkey::{HasParams, HasPrivate, HasPublic, Private, Public};
|
||||||
use {cvt, cvt_p};
|
use crate::{cvt, cvt_p};
|
||||||
|
|
||||||
generic_foreign_type_and_impl_send_sync! {
|
generic_foreign_type_and_impl_send_sync! {
|
||||||
type CType = ffi::DSA;
|
type CType = ffi::DSA;
|
||||||
|
|
@ -293,12 +293,12 @@ impl<T> fmt::Debug for Dsa<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
use ffi::{DSA_get0_key, DSA_get0_pqg, DSA_set0_key, DSA_set0_pqg};
|
use crate::ffi::{DSA_get0_key, DSA_get0_pqg, DSA_set0_key, DSA_set0_pqg};
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use super::*;
|
use super::*;
|
||||||
use bn::BigNumContext;
|
use crate::bn::BigNumContext;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn test_generate() {
|
pub fn test_generate() {
|
||||||
|
|
|
||||||
|
|
@ -15,17 +15,17 @@
|
||||||
//! [`EcGroup`]: struct.EcGroup.html
|
//! [`EcGroup`]: struct.EcGroup.html
|
||||||
//! [`Nid`]: ../nid/struct.Nid.html
|
//! [`Nid`]: ../nid/struct.Nid.html
|
||||||
//! [Eliptic Curve Cryptography]: https://wiki.openssl.org/index.php/Elliptic_Curve_Cryptography
|
//! [Eliptic Curve Cryptography]: https://wiki.openssl.org/index.php/Elliptic_Curve_Cryptography
|
||||||
use ffi;
|
use crate::ffi;
|
||||||
use foreign_types::{ForeignType, ForeignTypeRef};
|
use foreign_types::{ForeignType, ForeignTypeRef};
|
||||||
use libc::c_int;
|
use libc::c_int;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
use bn::{BigNumContextRef, BigNumRef};
|
use crate::bn::{BigNumContextRef, BigNumRef};
|
||||||
use error::ErrorStack;
|
use crate::error::ErrorStack;
|
||||||
use nid::Nid;
|
use crate::nid::Nid;
|
||||||
use pkey::{HasParams, HasPrivate, HasPublic, Params, Private, Public};
|
use crate::pkey::{HasParams, HasPrivate, HasPublic, Params, Private, Public};
|
||||||
use {cvt, cvt_n, cvt_p, init};
|
use crate::{cvt, cvt_n, cvt_p, init};
|
||||||
|
|
||||||
/// Compressed or Uncompressed conversion
|
/// Compressed or Uncompressed conversion
|
||||||
///
|
///
|
||||||
|
|
@ -869,8 +869,8 @@ mod test {
|
||||||
use hex::FromHex;
|
use hex::FromHex;
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
use bn::{BigNum, BigNumContext};
|
use crate::bn::{BigNum, BigNumContext};
|
||||||
use nid::Nid;
|
use crate::nid::Nid;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn key_new_by_curve_name() {
|
fn key_new_by_curve_name() {
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,16 @@
|
||||||
//! Low level Elliptic Curve Digital Signature Algorithm (ECDSA) functions.
|
//! Low level Elliptic Curve Digital Signature Algorithm (ECDSA) functions.
|
||||||
|
|
||||||
use ffi;
|
use crate::ffi;
|
||||||
use foreign_types::{ForeignType, ForeignTypeRef};
|
use foreign_types::{ForeignType, ForeignTypeRef};
|
||||||
use libc::{c_int, size_t};
|
use libc::{c_int, size_t};
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
use bn::{BigNum, BigNumRef};
|
use crate::bn::{BigNum, BigNumRef};
|
||||||
use ec::EcKeyRef;
|
use crate::ec::EcKeyRef;
|
||||||
use error::ErrorStack;
|
use crate::error::ErrorStack;
|
||||||
use pkey::{HasPrivate, HasPublic};
|
use crate::pkey::{HasPrivate, HasPublic};
|
||||||
use {cvt_n, cvt_p};
|
use crate::{cvt_n, cvt_p};
|
||||||
|
|
||||||
foreign_type_and_impl_send_sync! {
|
foreign_type_and_impl_send_sync! {
|
||||||
type CType = ffi::ECDSA_SIG;
|
type CType = ffi::ECDSA_SIG;
|
||||||
|
|
@ -136,4 +136,4 @@ impl EcdsaSigRef {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
use ffi::{ECDSA_SIG_get0, ECDSA_SIG_set0};
|
use crate::ffi::{ECDSA_SIG_get0, ECDSA_SIG_set0};
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ use std::io;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
use std::str;
|
use std::str;
|
||||||
|
|
||||||
use ffi;
|
use crate::ffi;
|
||||||
|
|
||||||
/// Collection of [`Error`]s from OpenSSL.
|
/// Collection of [`Error`]s from OpenSSL.
|
||||||
///
|
///
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,9 @@
|
||||||
//! See [OpenSSL's documentation] for details.
|
//! See [OpenSSL's documentation] for details.
|
||||||
//!
|
//!
|
||||||
//! [OpenSSL's documentation]: https://www.openssl.org/docs/fips/UserGuide-2.0.pdf
|
//! [OpenSSL's documentation]: https://www.openssl.org/docs/fips/UserGuide-2.0.pdf
|
||||||
use cvt;
|
use crate::cvt;
|
||||||
use error::ErrorStack;
|
use crate::error::ErrorStack;
|
||||||
use ffi;
|
use crate::ffi;
|
||||||
|
|
||||||
/// Moves the library into or out of the FIPS 140-2 mode of operation.
|
/// Moves the library into or out of the FIPS 140-2 mode of operation.
|
||||||
///
|
///
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
use ffi;
|
use crate::ffi;
|
||||||
use std::convert::TryInto;
|
use std::convert::TryInto;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::io;
|
use std::io;
|
||||||
|
|
@ -6,10 +6,10 @@ use std::io::prelude::*;
|
||||||
use std::ops::{Deref, DerefMut};
|
use std::ops::{Deref, DerefMut};
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
use error::ErrorStack;
|
use crate::error::ErrorStack;
|
||||||
use ffi::{EVP_MD_CTX_free, EVP_MD_CTX_new};
|
use crate::ffi::{EVP_MD_CTX_free, EVP_MD_CTX_new};
|
||||||
use nid::Nid;
|
use crate::nid::Nid;
|
||||||
use {cvt, cvt_p};
|
use crate::{cvt, cvt_p};
|
||||||
|
|
||||||
#[derive(Copy, Clone, PartialEq, Eq)]
|
#[derive(Copy, Clone, PartialEq, Eq)]
|
||||||
pub struct MessageDigest(*const ffi::EVP_MD);
|
pub struct MessageDigest(*const ffi::EVP_MD);
|
||||||
|
|
|
||||||
|
|
@ -17,11 +17,11 @@ extern crate hex;
|
||||||
extern crate tempdir;
|
extern crate tempdir;
|
||||||
|
|
||||||
#[doc(inline)]
|
#[doc(inline)]
|
||||||
pub use ffi::init;
|
pub use crate::ffi::init;
|
||||||
|
|
||||||
use libc::{c_int, size_t};
|
use libc::{c_int, size_t};
|
||||||
|
|
||||||
use error::ErrorStack;
|
use crate::error::ErrorStack;
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
mod macros;
|
mod macros;
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,10 @@ macro_rules! private_key_from_pem {
|
||||||
from_pem!($(#[$m])* $n, $t, $f);
|
from_pem!($(#[$m])* $n, $t, $f);
|
||||||
|
|
||||||
$(#[$m2])*
|
$(#[$m2])*
|
||||||
pub fn $n2(pem: &[u8], passphrase: &[u8]) -> Result<$t, ::error::ErrorStack> {
|
pub fn $n2(pem: &[u8], passphrase: &[u8]) -> Result<$t, crate::error::ErrorStack> {
|
||||||
unsafe {
|
unsafe {
|
||||||
ffi::init();
|
ffi::init();
|
||||||
let bio = ::bio::MemBioSlice::new(pem)?;
|
let bio = crate::bio::MemBioSlice::new(pem)?;
|
||||||
let passphrase = ::std::ffi::CString::new(passphrase).unwrap();
|
let passphrase = ::std::ffi::CString::new(passphrase).unwrap();
|
||||||
cvt_p($f(bio.as_ptr(),
|
cvt_p($f(bio.as_ptr(),
|
||||||
ptr::null_mut(),
|
ptr::null_mut(),
|
||||||
|
|
@ -17,16 +17,16 @@ macro_rules! private_key_from_pem {
|
||||||
}
|
}
|
||||||
|
|
||||||
$(#[$m3])*
|
$(#[$m3])*
|
||||||
pub fn $n3<F>(pem: &[u8], callback: F) -> Result<$t, ::error::ErrorStack>
|
pub fn $n3<F>(pem: &[u8], callback: F) -> Result<$t, crate::error::ErrorStack>
|
||||||
where F: FnOnce(&mut [u8]) -> Result<usize, ::error::ErrorStack>
|
where F: FnOnce(&mut [u8]) -> Result<usize, crate::error::ErrorStack>
|
||||||
{
|
{
|
||||||
unsafe {
|
unsafe {
|
||||||
ffi::init();
|
ffi::init();
|
||||||
let mut cb = ::util::CallbackState::new(callback);
|
let mut cb = crate::util::CallbackState::new(callback);
|
||||||
let bio = ::bio::MemBioSlice::new(pem)?;
|
let bio = crate::bio::MemBioSlice::new(pem)?;
|
||||||
cvt_p($f(bio.as_ptr(),
|
cvt_p($f(bio.as_ptr(),
|
||||||
ptr::null_mut(),
|
ptr::null_mut(),
|
||||||
Some(::util::invoke_passwd_cb::<F>),
|
Some(crate::util::invoke_passwd_cb::<F>),
|
||||||
&mut cb as *mut _ as *mut _))
|
&mut cb as *mut _ as *mut _))
|
||||||
.map(|p| ::foreign_types::ForeignType::from_ptr(p))
|
.map(|p| ::foreign_types::ForeignType::from_ptr(p))
|
||||||
}
|
}
|
||||||
|
|
@ -37,9 +37,9 @@ macro_rules! private_key_from_pem {
|
||||||
macro_rules! private_key_to_pem {
|
macro_rules! private_key_to_pem {
|
||||||
($(#[$m:meta])* $n:ident, $(#[$m2:meta])* $n2:ident, $f:path) => {
|
($(#[$m:meta])* $n:ident, $(#[$m2:meta])* $n2:ident, $f:path) => {
|
||||||
$(#[$m])*
|
$(#[$m])*
|
||||||
pub fn $n(&self) -> Result<Vec<u8>, ::error::ErrorStack> {
|
pub fn $n(&self) -> Result<Vec<u8>, crate::error::ErrorStack> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let bio = ::bio::MemBio::new()?;
|
let bio = crate::bio::MemBio::new()?;
|
||||||
cvt($f(bio.as_ptr(),
|
cvt($f(bio.as_ptr(),
|
||||||
self.as_ptr(),
|
self.as_ptr(),
|
||||||
ptr::null(),
|
ptr::null(),
|
||||||
|
|
@ -54,11 +54,11 @@ macro_rules! private_key_to_pem {
|
||||||
$(#[$m2])*
|
$(#[$m2])*
|
||||||
pub fn $n2(
|
pub fn $n2(
|
||||||
&self,
|
&self,
|
||||||
cipher: ::symm::Cipher,
|
cipher: crate::symm::Cipher,
|
||||||
passphrase: &[u8]
|
passphrase: &[u8]
|
||||||
) -> Result<Vec<u8>, ::error::ErrorStack> {
|
) -> Result<Vec<u8>, crate::error::ErrorStack> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let bio = ::bio::MemBio::new()?;
|
let bio = crate::bio::MemBio::new()?;
|
||||||
assert!(passphrase.len() <= ::libc::c_int::max_value() as usize);
|
assert!(passphrase.len() <= ::libc::c_int::max_value() as usize);
|
||||||
cvt($f(bio.as_ptr(),
|
cvt($f(bio.as_ptr(),
|
||||||
self.as_ptr(),
|
self.as_ptr(),
|
||||||
|
|
@ -76,9 +76,9 @@ macro_rules! private_key_to_pem {
|
||||||
macro_rules! to_pem {
|
macro_rules! to_pem {
|
||||||
($(#[$m:meta])* $n:ident, $f:path) => {
|
($(#[$m:meta])* $n:ident, $f:path) => {
|
||||||
$(#[$m])*
|
$(#[$m])*
|
||||||
pub fn $n(&self) -> Result<Vec<u8>, ::error::ErrorStack> {
|
pub fn $n(&self) -> Result<Vec<u8>, crate::error::ErrorStack> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let bio = ::bio::MemBio::new()?;
|
let bio = crate::bio::MemBio::new()?;
|
||||||
cvt($f(bio.as_ptr(), self.as_ptr()))?;
|
cvt($f(bio.as_ptr(), self.as_ptr()))?;
|
||||||
Ok(bio.get_buf().to_owned())
|
Ok(bio.get_buf().to_owned())
|
||||||
}
|
}
|
||||||
|
|
@ -89,12 +89,12 @@ macro_rules! to_pem {
|
||||||
macro_rules! to_der {
|
macro_rules! to_der {
|
||||||
($(#[$m:meta])* $n:ident, $f:path) => {
|
($(#[$m:meta])* $n:ident, $f:path) => {
|
||||||
$(#[$m])*
|
$(#[$m])*
|
||||||
pub fn $n(&self) -> Result<Vec<u8>, ::error::ErrorStack> {
|
pub fn $n(&self) -> Result<Vec<u8>, crate::error::ErrorStack> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let len = ::cvt($f(::foreign_types::ForeignTypeRef::as_ptr(self),
|
let len = crate::cvt($f(::foreign_types::ForeignTypeRef::as_ptr(self),
|
||||||
ptr::null_mut()))?;
|
ptr::null_mut()))?;
|
||||||
let mut buf = vec![0; len as usize];
|
let mut buf = vec![0; len as usize];
|
||||||
::cvt($f(::foreign_types::ForeignTypeRef::as_ptr(self),
|
crate::cvt($f(::foreign_types::ForeignTypeRef::as_ptr(self),
|
||||||
&mut buf.as_mut_ptr()))?;
|
&mut buf.as_mut_ptr()))?;
|
||||||
Ok(buf)
|
Ok(buf)
|
||||||
}
|
}
|
||||||
|
|
@ -105,11 +105,11 @@ macro_rules! to_der {
|
||||||
macro_rules! from_der {
|
macro_rules! from_der {
|
||||||
($(#[$m:meta])* $n:ident, $t:ty, $f:path, $len_ty:ty) => {
|
($(#[$m:meta])* $n:ident, $t:ty, $f:path, $len_ty:ty) => {
|
||||||
$(#[$m])*
|
$(#[$m])*
|
||||||
pub fn $n(der: &[u8]) -> Result<$t, ::error::ErrorStack> {
|
pub fn $n(der: &[u8]) -> Result<$t, crate::error::ErrorStack> {
|
||||||
unsafe {
|
unsafe {
|
||||||
::ffi::init();
|
crate::ffi::init();
|
||||||
let len = ::std::cmp::min(der.len(), <$len_ty>::max_value() as usize) as $len_ty;
|
let len = ::std::cmp::min(der.len(), <$len_ty>::max_value() as usize) as $len_ty;
|
||||||
::cvt_p($f(::std::ptr::null_mut(), &mut der.as_ptr(), len))
|
crate::cvt_p($f(::std::ptr::null_mut(), &mut der.as_ptr(), len))
|
||||||
.map(|p| ::foreign_types::ForeignType::from_ptr(p))
|
.map(|p| ::foreign_types::ForeignType::from_ptr(p))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -119,10 +119,10 @@ macro_rules! from_der {
|
||||||
macro_rules! from_pem {
|
macro_rules! from_pem {
|
||||||
($(#[$m:meta])* $n:ident, $t:ty, $f:path) => {
|
($(#[$m:meta])* $n:ident, $t:ty, $f:path) => {
|
||||||
$(#[$m])*
|
$(#[$m])*
|
||||||
pub fn $n(pem: &[u8]) -> Result<$t, ::error::ErrorStack> {
|
pub fn $n(pem: &[u8]) -> Result<$t, crate::error::ErrorStack> {
|
||||||
unsafe {
|
unsafe {
|
||||||
::init();
|
crate::init();
|
||||||
let bio = ::bio::MemBioSlice::new(pem)?;
|
let bio = crate::bio::MemBioSlice::new(pem)?;
|
||||||
cvt_p($f(bio.as_ptr(), ::std::ptr::null_mut(), None, ::std::ptr::null_mut()))
|
cvt_p($f(bio.as_ptr(), ::std::ptr::null_mut(), None, ::std::ptr::null_mut()))
|
||||||
.map(|p| ::foreign_types::ForeignType::from_ptr(p))
|
.map(|p| ::foreign_types::ForeignType::from_ptr(p))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@
|
||||||
//! assert!(!eq(&a, &b));
|
//! assert!(!eq(&a, &b));
|
||||||
//! assert!(!eq(&a, &c));
|
//! assert!(!eq(&a, &c));
|
||||||
//! ```
|
//! ```
|
||||||
use ffi;
|
use crate::ffi;
|
||||||
use libc::size_t;
|
use libc::size_t;
|
||||||
|
|
||||||
/// Returns `true` iff `a` and `b` contain the same bytes.
|
/// Returns `true` iff `a` and `b` contain the same bytes.
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
//! A collection of numerical identifiers for OpenSSL objects.
|
//! A collection of numerical identifiers for OpenSSL objects.
|
||||||
use ffi;
|
use crate::ffi;
|
||||||
use libc::{c_char, c_int};
|
use libc::{c_char, c_int};
|
||||||
|
|
||||||
use std::ffi::CStr;
|
use std::ffi::CStr;
|
||||||
use std::str;
|
use std::str;
|
||||||
|
|
||||||
use cvt_p;
|
use crate::cvt_p;
|
||||||
use error::ErrorStack;
|
use crate::error::ErrorStack;
|
||||||
|
|
||||||
/// The digest and public-key algorithms associated with a signature.
|
/// The digest and public-key algorithms associated with a signature.
|
||||||
pub struct SignatureAlgorithms {
|
pub struct SignatureAlgorithms {
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,17 @@
|
||||||
//! PKCS #12 archives.
|
//! PKCS #12 archives.
|
||||||
|
|
||||||
use ffi;
|
use crate::ffi;
|
||||||
use foreign_types::{ForeignType, ForeignTypeRef};
|
use foreign_types::{ForeignType, ForeignTypeRef};
|
||||||
use libc::c_int;
|
use libc::c_int;
|
||||||
use std::ffi::CString;
|
use std::ffi::CString;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
use error::ErrorStack;
|
use crate::error::ErrorStack;
|
||||||
use nid::Nid;
|
use crate::nid::Nid;
|
||||||
use pkey::{HasPrivate, PKey, PKeyRef, Private};
|
use crate::pkey::{HasPrivate, PKey, PKeyRef, Private};
|
||||||
use stack::Stack;
|
use crate::stack::Stack;
|
||||||
use x509::{X509Ref, X509};
|
use crate::x509::{X509Ref, X509};
|
||||||
use {cvt_0i, cvt_p};
|
use crate::{cvt_0i, cvt_p};
|
||||||
|
|
||||||
pub const PKCS12_DEFAULT_ITER: c_int = 2048;
|
pub const PKCS12_DEFAULT_ITER: c_int = 2048;
|
||||||
|
|
||||||
|
|
@ -203,15 +203,15 @@ impl Pkcs12Builder {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use hash::MessageDigest;
|
use crate::hash::MessageDigest;
|
||||||
use hex;
|
use hex;
|
||||||
|
|
||||||
use asn1::Asn1Time;
|
use crate::asn1::Asn1Time;
|
||||||
use nid::Nid;
|
use crate::nid::Nid;
|
||||||
use pkey::PKey;
|
use crate::pkey::PKey;
|
||||||
use rsa::Rsa;
|
use crate::rsa::Rsa;
|
||||||
use x509::extension::KeyUsage;
|
use crate::x509::extension::KeyUsage;
|
||||||
use x509::{X509Name, X509};
|
use crate::x509::{X509Name, X509};
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
use ffi;
|
use crate::ffi;
|
||||||
use libc::{c_int, c_uint};
|
use libc::{c_int, c_uint};
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
use cvt;
|
use crate::cvt;
|
||||||
use error::ErrorStack;
|
use crate::error::ErrorStack;
|
||||||
use hash::MessageDigest;
|
use crate::hash::MessageDigest;
|
||||||
use symm::Cipher;
|
use crate::symm::Cipher;
|
||||||
|
|
||||||
#[derive(Clone, Eq, PartialEq, Hash, Debug)]
|
#[derive(Clone, Eq, PartialEq, Hash, Debug)]
|
||||||
pub struct KeyIvPair {
|
pub struct KeyIvPair {
|
||||||
|
|
@ -139,8 +139,8 @@ pub fn scrypt(
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use hash::MessageDigest;
|
use crate::hash::MessageDigest;
|
||||||
use symm::Cipher;
|
use crate::symm::Cipher;
|
||||||
|
|
||||||
// Test vectors from
|
// Test vectors from
|
||||||
// https://git.lysator.liu.se/nettle/nettle/blob/nettle_3.1.1_release_20150424/testsuite/pbkdf2-test.c
|
// https://git.lysator.liu.se/nettle/nettle/blob/nettle_3.1.1_release_20150424/testsuite/pbkdf2-test.c
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@
|
||||||
//! println!("{:?}", str::from_utf8(pub_key.as_slice()).unwrap());
|
//! println!("{:?}", str::from_utf8(pub_key.as_slice()).unwrap());
|
||||||
//! ```
|
//! ```
|
||||||
|
|
||||||
use ffi;
|
use crate::ffi;
|
||||||
use foreign_types::{ForeignType, ForeignTypeRef};
|
use foreign_types::{ForeignType, ForeignTypeRef};
|
||||||
use libc::{c_int, c_long};
|
use libc::{c_int, c_long};
|
||||||
use std::ffi::CString;
|
use std::ffi::CString;
|
||||||
|
|
@ -48,14 +48,14 @@ use std::fmt;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
use bio::MemBioSlice;
|
use crate::bio::MemBioSlice;
|
||||||
use dh::Dh;
|
use crate::dh::Dh;
|
||||||
use dsa::Dsa;
|
use crate::dsa::Dsa;
|
||||||
use ec::EcKey;
|
use crate::ec::EcKey;
|
||||||
use error::ErrorStack;
|
use crate::error::ErrorStack;
|
||||||
use rsa::Rsa;
|
use crate::rsa::Rsa;
|
||||||
use util::{invoke_passwd_cb, CallbackState};
|
use crate::util::{invoke_passwd_cb, CallbackState};
|
||||||
use {cvt, cvt_p};
|
use crate::{cvt, cvt_p};
|
||||||
|
|
||||||
/// A tag type indicating that a key only has parameters.
|
/// A tag type indicating that a key only has parameters.
|
||||||
pub enum Params {}
|
pub enum Params {}
|
||||||
|
|
@ -480,14 +480,14 @@ impl PKey<Public> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
use ffi::EVP_PKEY_up_ref;
|
use crate::ffi::EVP_PKEY_up_ref;
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use ec::EcKey;
|
use crate::ec::EcKey;
|
||||||
use nid::Nid;
|
use crate::nid::Nid;
|
||||||
use rsa::Rsa;
|
use crate::rsa::Rsa;
|
||||||
use symm::Cipher;
|
use crate::symm::Cipher;
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,11 +10,11 @@
|
||||||
//! let mut buf = [0; 256];
|
//! let mut buf = [0; 256];
|
||||||
//! rand_bytes(&mut buf).unwrap();
|
//! rand_bytes(&mut buf).unwrap();
|
||||||
//! ```
|
//! ```
|
||||||
use ffi;
|
use crate::ffi;
|
||||||
use libc::c_int;
|
use libc::c_int;
|
||||||
|
|
||||||
use cvt;
|
use crate::cvt;
|
||||||
use error::ErrorStack;
|
use crate::error::ErrorStack;
|
||||||
|
|
||||||
/// Fill buffer with cryptographically strong pseudo-random bytes.
|
/// Fill buffer with cryptographically strong pseudo-random bytes.
|
||||||
///
|
///
|
||||||
|
|
|
||||||
|
|
@ -23,17 +23,17 @@
|
||||||
//! let mut buf = vec![0; rsa.size() as usize];
|
//! let mut buf = vec![0; rsa.size() as usize];
|
||||||
//! let encrypted_len = rsa.public_encrypt(data, &mut buf, Padding::PKCS1).unwrap();
|
//! let encrypted_len = rsa.public_encrypt(data, &mut buf, Padding::PKCS1).unwrap();
|
||||||
//! ```
|
//! ```
|
||||||
use ffi;
|
use crate::ffi;
|
||||||
use foreign_types::{ForeignType, ForeignTypeRef};
|
use foreign_types::{ForeignType, ForeignTypeRef};
|
||||||
use libc::c_int;
|
use libc::c_int;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
use bn::{BigNum, BigNumRef};
|
use crate::bn::{BigNum, BigNumRef};
|
||||||
use error::ErrorStack;
|
use crate::error::ErrorStack;
|
||||||
use pkey::{HasPrivate, HasPublic, Private, Public};
|
use crate::pkey::{HasPrivate, HasPublic, Private, Public};
|
||||||
use {cvt, cvt_n, cvt_p};
|
use crate::{cvt, cvt_n, cvt_p};
|
||||||
|
|
||||||
pub const EVP_PKEY_OP_SIGN: c_int = 1 << 3;
|
pub const EVP_PKEY_OP_SIGN: c_int = 1 << 3;
|
||||||
pub const EVP_PKEY_OP_VERIFY: c_int = 1 << 4;
|
pub const EVP_PKEY_OP_VERIFY: c_int = 1 << 4;
|
||||||
|
|
@ -689,14 +689,14 @@ impl<T> fmt::Debug for Rsa<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
use ffi::{
|
use crate::ffi::{
|
||||||
RSA_get0_crt_params, RSA_get0_factors, RSA_get0_key, RSA_set0_crt_params, RSA_set0_factors,
|
RSA_get0_crt_params, RSA_get0_factors, RSA_get0_key, RSA_set0_crt_params, RSA_set0_factors,
|
||||||
RSA_set0_key,
|
RSA_set0_key,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use symm::Cipher;
|
use crate::symm::Cipher;
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@
|
||||||
//! println!("Hash = {}", hex::encode(hash));
|
//! println!("Hash = {}", hex::encode(hash));
|
||||||
//! }
|
//! }
|
||||||
//! ```
|
//! ```
|
||||||
use ffi;
|
use crate::ffi;
|
||||||
use libc::c_void;
|
use libc::c_void;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,20 +34,20 @@
|
||||||
//! verifier.update(data2).unwrap();
|
//! verifier.update(data2).unwrap();
|
||||||
//! assert!(verifier.verify(&signature).unwrap());
|
//! assert!(verifier.verify(&signature).unwrap());
|
||||||
//! ```
|
//! ```
|
||||||
use ffi;
|
use crate::ffi;
|
||||||
use foreign_types::ForeignTypeRef;
|
use foreign_types::ForeignTypeRef;
|
||||||
use libc::c_int;
|
use libc::c_int;
|
||||||
use std::io::{self, Write};
|
use std::io::{self, Write};
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
use error::ErrorStack;
|
use crate::error::ErrorStack;
|
||||||
use hash::MessageDigest;
|
use crate::hash::MessageDigest;
|
||||||
use pkey::{HasPrivate, HasPublic, PKeyRef};
|
use crate::pkey::{HasPrivate, HasPublic, PKeyRef};
|
||||||
use rsa::Padding;
|
use crate::rsa::Padding;
|
||||||
use {cvt, cvt_p};
|
use crate::{cvt, cvt_p};
|
||||||
|
|
||||||
use ffi::{EVP_MD_CTX_free, EVP_MD_CTX_new};
|
use crate::ffi::{EVP_MD_CTX_free, EVP_MD_CTX_new};
|
||||||
|
|
||||||
/// Salt lengths that must be used with `set_rsa_pss_saltlen`.
|
/// Salt lengths that must be used with `set_rsa_pss_saltlen`.
|
||||||
pub struct RsaPssSaltlen(c_int);
|
pub struct RsaPssSaltlen(c_int);
|
||||||
|
|
@ -571,19 +571,19 @@ impl<'a> Write for Verifier<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
use ffi::EVP_DigestVerifyFinal;
|
use crate::ffi::EVP_DigestVerifyFinal;
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use super::RsaPssSaltlen;
|
use super::RsaPssSaltlen;
|
||||||
use hex::{self, FromHex};
|
use hex::{self, FromHex};
|
||||||
|
|
||||||
use ec::{EcGroup, EcKey};
|
use crate::ec::{EcGroup, EcKey};
|
||||||
use hash::MessageDigest;
|
use crate::hash::MessageDigest;
|
||||||
use nid::Nid;
|
use crate::nid::Nid;
|
||||||
use pkey::PKey;
|
use crate::pkey::PKey;
|
||||||
use rsa::{Padding, Rsa};
|
use crate::rsa::{Padding, Rsa};
|
||||||
use sign::{Signer, Verifier};
|
use crate::sign::{Signer, Verifier};
|
||||||
|
|
||||||
const INPUT: &str =
|
const INPUT: &str =
|
||||||
"65794a68624763694f694a53557a49314e694a392e65794a7063334d694f694a71623255694c41304b49434a6c\
|
"65794a68624763694f694a53557a49314e694a392e65794a7063334d694f694a71623255694c41304b49434a6c\
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
use ffi;
|
use crate::ffi;
|
||||||
|
use crate::stack::Stackable;
|
||||||
use foreign_types::ForeignTypeRef;
|
use foreign_types::ForeignTypeRef;
|
||||||
use libc::c_ulong;
|
use libc::c_ulong;
|
||||||
use stack::Stackable;
|
|
||||||
use std::ffi::CStr;
|
use std::ffi::CStr;
|
||||||
use std::str;
|
use std::str;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
use ffi::{
|
use crate::ffi::{
|
||||||
self, BIO_clear_retry_flags, BIO_new, BIO_set_retry_read, BIO_set_retry_write, BIO,
|
self, BIO_clear_retry_flags, BIO_new, BIO_set_retry_read, BIO_set_retry_write, BIO,
|
||||||
BIO_CTRL_DGRAM_QUERY_MTU, BIO_CTRL_FLUSH,
|
BIO_CTRL_DGRAM_QUERY_MTU, BIO_CTRL_FLUSH,
|
||||||
};
|
};
|
||||||
|
|
@ -10,8 +10,8 @@ use std::panic::{catch_unwind, AssertUnwindSafe};
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
use std::slice;
|
use std::slice;
|
||||||
|
|
||||||
use cvt_p;
|
use crate::cvt_p;
|
||||||
use error::ErrorStack;
|
use crate::error::ErrorStack;
|
||||||
|
|
||||||
pub struct StreamState<S> {
|
pub struct StreamState<S> {
|
||||||
pub stream: S,
|
pub stream: S,
|
||||||
|
|
@ -208,7 +208,7 @@ unsafe extern "C" fn destroy<S>(bio: *mut BIO) -> c_int {
|
||||||
1
|
1
|
||||||
}
|
}
|
||||||
|
|
||||||
use ffi::{BIO_get_data, BIO_set_data, BIO_set_flags, BIO_set_init};
|
use crate::ffi::{BIO_get_data, BIO_set_data, BIO_set_flags, BIO_set_init};
|
||||||
|
|
||||||
#[allow(bad_style)]
|
#[allow(bad_style)]
|
||||||
unsafe fn BIO_set_num(_bio: *mut ffi::BIO, _num: c_int) {}
|
unsafe fn BIO_set_num(_bio: *mut ffi::BIO, _num: c_int) {}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
use ffi;
|
use crate::ffi;
|
||||||
use foreign_types::ForeignType;
|
use foreign_types::ForeignType;
|
||||||
use foreign_types::ForeignTypeRef;
|
use foreign_types::ForeignTypeRef;
|
||||||
use libc::c_char;
|
use libc::c_char;
|
||||||
|
|
@ -10,14 +10,14 @@ use std::slice;
|
||||||
use std::str;
|
use std::str;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use error::ErrorStack;
|
use crate::error::ErrorStack;
|
||||||
use ssl::AlpnError;
|
use crate::ssl::AlpnError;
|
||||||
use ssl::{ClientHello, SelectCertError};
|
use crate::ssl::{ClientHello, SelectCertError};
|
||||||
use ssl::{
|
use crate::ssl::{
|
||||||
SniError, Ssl, SslAlert, SslContext, SslContextRef, SslRef, SslSession, SslSessionRef,
|
SniError, Ssl, SslAlert, SslContext, SslContextRef, SslRef, SslSession, SslSessionRef,
|
||||||
SESSION_CTX_INDEX,
|
SESSION_CTX_INDEX,
|
||||||
};
|
};
|
||||||
use x509::{X509StoreContext, X509StoreContextRef};
|
use crate::x509::{X509StoreContext, X509StoreContextRef};
|
||||||
|
|
||||||
pub extern "C" fn raw_verify<F>(preverify_ok: c_int, x509_ctx: *mut ffi::X509_STORE_CTX) -> c_int
|
pub extern "C" fn raw_verify<F>(preverify_ok: c_int, x509_ctx: *mut ffi::X509_STORE_CTX) -> c_int
|
||||||
where
|
where
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
use std::io::{Read, Write};
|
use std::io::{Read, Write};
|
||||||
use std::ops::{Deref, DerefMut};
|
use std::ops::{Deref, DerefMut};
|
||||||
|
|
||||||
use dh::Dh;
|
use crate::dh::Dh;
|
||||||
use error::ErrorStack;
|
use crate::error::ErrorStack;
|
||||||
use ssl::{
|
use crate::ssl::{
|
||||||
HandshakeError, Ssl, SslContext, SslContextBuilder, SslContextRef, SslMethod, SslMode,
|
HandshakeError, Ssl, SslContext, SslContextBuilder, SslContextRef, SslMethod, SslMode,
|
||||||
SslOptions, SslRef, SslStream, SslVerifyMode,
|
SslOptions, SslRef, SslStream, SslVerifyMode,
|
||||||
};
|
};
|
||||||
use version;
|
use crate::version;
|
||||||
|
|
||||||
const FFDHE_2048: &str = "
|
const FFDHE_2048: &str = "
|
||||||
-----BEGIN DH PARAMETERS-----
|
-----BEGIN DH PARAMETERS-----
|
||||||
|
|
@ -326,7 +326,7 @@ fn setup_verify(ctx: &mut SslContextBuilder) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn setup_verify_hostname(ssl: &mut SslRef, domain: &str) -> Result<(), ErrorStack> {
|
fn setup_verify_hostname(ssl: &mut SslRef, domain: &str) -> Result<(), ErrorStack> {
|
||||||
use x509::verify::X509CheckFlags;
|
use crate::x509::verify::X509CheckFlags;
|
||||||
|
|
||||||
let param = ssl.param_mut();
|
let param = ssl.param_mut();
|
||||||
param.set_hostflags(X509CheckFlags::NO_PARTIAL_WILDCARDS);
|
param.set_hostflags(X509CheckFlags::NO_PARTIAL_WILDCARDS);
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
use ffi;
|
use crate::ffi;
|
||||||
use libc::c_int;
|
use libc::c_int;
|
||||||
use std::error;
|
use std::error;
|
||||||
use std::error::Error as StdError;
|
use std::error::Error as StdError;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::io;
|
use std::io;
|
||||||
|
|
||||||
use error::ErrorStack;
|
use crate::error::ErrorStack;
|
||||||
use ssl::MidHandshakeSslStream;
|
use crate::ssl::MidHandshakeSslStream;
|
||||||
use x509::X509VerifyResult;
|
use crate::x509::X509VerifyResult;
|
||||||
|
|
||||||
/// An error code returned from SSL functions.
|
/// An error code returned from SSL functions.
|
||||||
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
|
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@
|
||||||
//! }
|
//! }
|
||||||
//! }
|
//! }
|
||||||
//! ```
|
//! ```
|
||||||
use ffi;
|
use crate::ffi;
|
||||||
use foreign_types::{ForeignType, ForeignTypeRef, Opaque};
|
use foreign_types::{ForeignType, ForeignTypeRef, Opaque};
|
||||||
use libc::{c_char, c_int, c_long, c_uchar, c_uint, c_void};
|
use libc::{c_char, c_int, c_long, c_uchar, c_uint, c_void};
|
||||||
use std::any::TypeId;
|
use std::any::TypeId;
|
||||||
|
|
@ -78,26 +78,26 @@ use std::slice;
|
||||||
use std::str;
|
use std::str;
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
|
|
||||||
use dh::DhRef;
|
use crate::dh::DhRef;
|
||||||
use ec::EcKeyRef;
|
use crate::ec::EcKeyRef;
|
||||||
use error::ErrorStack;
|
use crate::error::ErrorStack;
|
||||||
use ex_data::Index;
|
use crate::ex_data::Index;
|
||||||
use nid::Nid;
|
use crate::nid::Nid;
|
||||||
use pkey::{HasPrivate, PKeyRef, Params, Private};
|
use crate::pkey::{HasPrivate, PKeyRef, Params, Private};
|
||||||
use srtp::{SrtpProtectionProfile, SrtpProtectionProfileRef};
|
use crate::srtp::{SrtpProtectionProfile, SrtpProtectionProfileRef};
|
||||||
use ssl::bio::BioMethod;
|
use crate::ssl::bio::BioMethod;
|
||||||
use ssl::callbacks::*;
|
use crate::ssl::callbacks::*;
|
||||||
use ssl::error::InnerError;
|
use crate::ssl::error::InnerError;
|
||||||
use stack::{Stack, StackRef};
|
use crate::stack::{Stack, StackRef};
|
||||||
use x509::store::{X509Store, X509StoreBuilderRef, X509StoreRef};
|
use crate::x509::store::{X509Store, X509StoreBuilderRef, X509StoreRef};
|
||||||
use x509::verify::X509VerifyParamRef;
|
use crate::x509::verify::X509VerifyParamRef;
|
||||||
use x509::{X509Name, X509Ref, X509StoreContextRef, X509VerifyResult, X509};
|
use crate::x509::{X509Name, X509Ref, X509StoreContextRef, X509VerifyResult, X509};
|
||||||
use {cvt, cvt_0i, cvt_n, cvt_p, init};
|
use crate::{cvt, cvt_0i, cvt_n, cvt_p, init};
|
||||||
|
|
||||||
pub use ssl::connector::{
|
pub use crate::ssl::connector::{
|
||||||
ConnectConfiguration, SslAcceptor, SslAcceptorBuilder, SslConnector, SslConnectorBuilder,
|
ConnectConfiguration, SslAcceptor, SslAcceptorBuilder, SslConnector, SslConnectorBuilder,
|
||||||
};
|
};
|
||||||
pub use ssl::error::{Error, ErrorCode, HandshakeError};
|
pub use crate::ssl::error::{Error, ErrorCode, HandshakeError};
|
||||||
|
|
||||||
mod bio;
|
mod bio;
|
||||||
mod callbacks;
|
mod callbacks;
|
||||||
|
|
@ -3377,9 +3377,9 @@ bitflags! {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
use ffi::{SSL_CTX_up_ref, SSL_SESSION_get_master_key, SSL_SESSION_up_ref, SSL_is_server};
|
use crate::ffi::{SSL_CTX_up_ref, SSL_SESSION_get_master_key, SSL_SESSION_up_ref, SSL_is_server};
|
||||||
|
|
||||||
use ffi::{DTLS_method, TLS_client_method, TLS_method, TLS_server_method};
|
use crate::ffi::{DTLS_method, TLS_client_method, TLS_method, TLS_server_method};
|
||||||
|
|
||||||
use std::sync::Once;
|
use std::sync::Once;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,23 +16,23 @@ use std::thread;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use tempdir::TempDir;
|
use tempdir::TempDir;
|
||||||
|
|
||||||
use dh::Dh;
|
use crate::dh::Dh;
|
||||||
use error::ErrorStack;
|
use crate::error::ErrorStack;
|
||||||
use hash::MessageDigest;
|
use crate::hash::MessageDigest;
|
||||||
use pkey::PKey;
|
use crate::pkey::PKey;
|
||||||
use srtp::SrtpProfileId;
|
use crate::srtp::SrtpProfileId;
|
||||||
use ssl;
|
use crate::ssl;
|
||||||
use ssl::test::server::Server;
|
use crate::ssl::test::server::Server;
|
||||||
use ssl::SslVersion;
|
use crate::ssl::SslVersion;
|
||||||
use ssl::{
|
use crate::ssl::{
|
||||||
Error, ExtensionType, HandshakeError, MidHandshakeSslStream, ShutdownResult, ShutdownState,
|
Error, ExtensionType, HandshakeError, MidHandshakeSslStream, ShutdownResult, ShutdownState,
|
||||||
Ssl, SslAcceptor, SslAcceptorBuilder, SslConnector, SslContext, SslContextBuilder, SslFiletype,
|
Ssl, SslAcceptor, SslAcceptorBuilder, SslConnector, SslContext, SslContextBuilder, SslFiletype,
|
||||||
SslMethod, SslOptions, SslSessionCacheMode, SslStream, SslStreamBuilder, SslVerifyMode,
|
SslMethod, SslOptions, SslSessionCacheMode, SslStream, SslStreamBuilder, SslVerifyMode,
|
||||||
StatusType,
|
StatusType,
|
||||||
};
|
};
|
||||||
use x509::store::X509StoreBuilder;
|
use crate::x509::store::X509StoreBuilder;
|
||||||
use x509::verify::X509CheckFlags;
|
use crate::x509::verify::X509CheckFlags;
|
||||||
use x509::{X509Name, X509StoreContext, X509VerifyResult, X509};
|
use crate::x509::{X509Name, X509StoreContext, X509VerifyResult, X509};
|
||||||
|
|
||||||
mod server;
|
mod server;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ use std::io::{Read, Write};
|
||||||
use std::net::{SocketAddr, TcpListener, TcpStream};
|
use std::net::{SocketAddr, TcpListener, TcpStream};
|
||||||
use std::thread::{self, JoinHandle};
|
use std::thread::{self, JoinHandle};
|
||||||
|
|
||||||
use ssl::{Ssl, SslContext, SslContextBuilder, SslFiletype, SslMethod, SslRef, SslStream};
|
use crate::ssl::{Ssl, SslContext, SslContextBuilder, SslFiletype, SslMethod, SslRef, SslStream};
|
||||||
|
|
||||||
pub struct Server {
|
pub struct Server {
|
||||||
handle: Option<JoinHandle<()>>,
|
handle: Option<JoinHandle<()>>,
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
use ffi;
|
use crate::ffi;
|
||||||
use foreign_types::{ForeignType, ForeignTypeRef, Opaque};
|
use foreign_types::{ForeignType, ForeignTypeRef, Opaque};
|
||||||
use libc::size_t;
|
use libc::size_t;
|
||||||
use std::borrow::Borrow;
|
use std::borrow::Borrow;
|
||||||
|
|
@ -9,10 +9,10 @@ use std::marker::PhantomData;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::ops::{Deref, DerefMut, Index, IndexMut, Range};
|
use std::ops::{Deref, DerefMut, Index, IndexMut, Range};
|
||||||
|
|
||||||
use error::ErrorStack;
|
use crate::error::ErrorStack;
|
||||||
use {cvt_0, cvt_p};
|
use crate::{cvt_0, cvt_p};
|
||||||
|
|
||||||
use ffi::{
|
use crate::ffi::{
|
||||||
sk_free as OPENSSL_sk_free, sk_new_null as OPENSSL_sk_new_null, sk_num as OPENSSL_sk_num,
|
sk_free as OPENSSL_sk_free, sk_new_null as OPENSSL_sk_new_null, sk_num as OPENSSL_sk_num,
|
||||||
sk_pop as OPENSSL_sk_pop, sk_push as OPENSSL_sk_push, sk_value as OPENSSL_sk_value,
|
sk_pop as OPENSSL_sk_pop, sk_push as OPENSSL_sk_push, sk_value as OPENSSL_sk_value,
|
||||||
_STACK as OPENSSL_STACK,
|
_STACK as OPENSSL_STACK,
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
use ffi;
|
use crate::ffi;
|
||||||
use foreign_types::ForeignTypeRef;
|
use foreign_types::ForeignTypeRef;
|
||||||
use libc::{c_char, c_void};
|
use libc::{c_char, c_void};
|
||||||
use std::convert::AsRef;
|
use std::convert::AsRef;
|
||||||
|
|
@ -7,7 +7,7 @@ use std::fmt;
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
use std::str;
|
use std::str;
|
||||||
|
|
||||||
use stack::Stackable;
|
use crate::stack::Stackable;
|
||||||
|
|
||||||
foreign_type_and_impl_send_sync! {
|
foreign_type_and_impl_send_sync! {
|
||||||
type CType = c_char;
|
type CType = c_char;
|
||||||
|
|
@ -81,5 +81,5 @@ impl fmt::Debug for OpensslStringRef {
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe fn free(buf: *mut c_char) {
|
unsafe fn free(buf: *mut c_char) {
|
||||||
::ffi::OPENSSL_free(buf as *mut c_void);
|
crate::ffi::OPENSSL_free(buf as *mut c_void);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,14 +52,14 @@
|
||||||
//! println!("Decrypted: '{}'", output_string);
|
//! println!("Decrypted: '{}'", output_string);
|
||||||
//! ```
|
//! ```
|
||||||
|
|
||||||
use ffi;
|
use crate::ffi;
|
||||||
use libc::{c_int, c_uint};
|
use libc::{c_int, c_uint};
|
||||||
use std::cmp;
|
use std::cmp;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
use error::ErrorStack;
|
use crate::error::ErrorStack;
|
||||||
use nid::Nid;
|
use crate::nid::Nid;
|
||||||
use {cvt, cvt_p};
|
use crate::{cvt, cvt_p};
|
||||||
|
|
||||||
#[derive(Copy, Clone)]
|
#[derive(Copy, Clone)]
|
||||||
pub enum Mode {
|
pub enum Mode {
|
||||||
|
|
@ -684,7 +684,7 @@ pub fn decrypt_aead(
|
||||||
Ok(out)
|
Ok(out)
|
||||||
}
|
}
|
||||||
|
|
||||||
use ffi::{EVP_CIPHER_block_size, EVP_CIPHER_iv_length, EVP_CIPHER_key_length};
|
use crate::ffi::{EVP_CIPHER_block_size, EVP_CIPHER_iv_length, EVP_CIPHER_key_length};
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ use std::any::Any;
|
||||||
use std::panic::{self, AssertUnwindSafe};
|
use std::panic::{self, AssertUnwindSafe};
|
||||||
use std::slice;
|
use std::slice;
|
||||||
|
|
||||||
use error::ErrorStack;
|
use crate::error::ErrorStack;
|
||||||
|
|
||||||
/// Wraps a user-supplied callback and a slot for panics thrown inside the callback (while FFI
|
/// Wraps a user-supplied callback and a slot for panics thrown inside the callback (while FFI
|
||||||
/// frames are on the stack).
|
/// frames are on the stack).
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
use std::ffi::CStr;
|
use std::ffi::CStr;
|
||||||
|
|
||||||
use ffi::{
|
use crate::ffi::{
|
||||||
OpenSSL_version, OpenSSL_version_num, OPENSSL_BUILT_ON, OPENSSL_CFLAGS, OPENSSL_DIR,
|
OpenSSL_version, OpenSSL_version_num, OPENSSL_BUILT_ON, OPENSSL_CFLAGS, OPENSSL_DIR,
|
||||||
OPENSSL_PLATFORM, OPENSSL_VERSION,
|
OPENSSL_PLATFORM, OPENSSL_VERSION,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -17,9 +17,9 @@
|
||||||
//! ```
|
//! ```
|
||||||
use std::fmt::Write;
|
use std::fmt::Write;
|
||||||
|
|
||||||
use error::ErrorStack;
|
use crate::error::ErrorStack;
|
||||||
use nid::Nid;
|
use crate::nid::Nid;
|
||||||
use x509::{X509Extension, X509v3Context};
|
use crate::x509::{X509Extension, X509v3Context};
|
||||||
|
|
||||||
/// An extension which indicates whether a certificate is a CA certificate.
|
/// An extension which indicates whether a certificate is a CA certificate.
|
||||||
pub struct BasicConstraints {
|
pub struct BasicConstraints {
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
//! Internet protocols, including SSL/TLS, which is the basis for HTTPS,
|
//! Internet protocols, including SSL/TLS, which is the basis for HTTPS,
|
||||||
//! the secure protocol for browsing the web.
|
//! the secure protocol for browsing the web.
|
||||||
|
|
||||||
use ffi;
|
use crate::ffi;
|
||||||
use foreign_types::{ForeignType, ForeignTypeRef};
|
use foreign_types::{ForeignType, ForeignTypeRef};
|
||||||
use libc::{c_int, c_long};
|
use libc::{c_int, c_long};
|
||||||
use std::convert::TryInto;
|
use std::convert::TryInto;
|
||||||
|
|
@ -21,18 +21,18 @@ use std::ptr;
|
||||||
use std::slice;
|
use std::slice;
|
||||||
use std::str;
|
use std::str;
|
||||||
|
|
||||||
use asn1::{Asn1BitStringRef, Asn1IntegerRef, Asn1ObjectRef, Asn1StringRef, Asn1TimeRef};
|
use crate::asn1::{Asn1BitStringRef, Asn1IntegerRef, Asn1ObjectRef, Asn1StringRef, Asn1TimeRef};
|
||||||
use bio::MemBioSlice;
|
use crate::bio::MemBioSlice;
|
||||||
use conf::ConfRef;
|
use crate::conf::ConfRef;
|
||||||
use error::ErrorStack;
|
use crate::error::ErrorStack;
|
||||||
use ex_data::Index;
|
use crate::ex_data::Index;
|
||||||
use hash::{DigestBytes, MessageDigest};
|
use crate::hash::{DigestBytes, MessageDigest};
|
||||||
use nid::Nid;
|
use crate::nid::Nid;
|
||||||
use pkey::{HasPrivate, HasPublic, PKey, PKeyRef, Public};
|
use crate::pkey::{HasPrivate, HasPublic, PKey, PKeyRef, Public};
|
||||||
use ssl::SslRef;
|
use crate::ssl::SslRef;
|
||||||
use stack::{Stack, StackRef, Stackable};
|
use crate::stack::{Stack, StackRef, Stackable};
|
||||||
use string::OpensslString;
|
use crate::string::OpensslString;
|
||||||
use {cvt, cvt_n, cvt_p};
|
use crate::{cvt, cvt_n, cvt_p};
|
||||||
|
|
||||||
pub mod extension;
|
pub mod extension;
|
||||||
pub mod store;
|
pub mod store;
|
||||||
|
|
@ -1418,14 +1418,14 @@ impl Stackable for X509Object {
|
||||||
type StackType = ffi::stack_st_X509_OBJECT;
|
type StackType = ffi::stack_st_X509_OBJECT;
|
||||||
}
|
}
|
||||||
|
|
||||||
use ffi::{X509_get0_signature, X509_getm_notAfter, X509_getm_notBefore, X509_up_ref};
|
use crate::ffi::{X509_get0_signature, X509_getm_notAfter, X509_getm_notBefore, X509_up_ref};
|
||||||
|
|
||||||
use ffi::{
|
use crate::ffi::{
|
||||||
ASN1_STRING_get0_data, X509_ALGOR_get0, X509_REQ_get_subject_name, X509_REQ_get_version,
|
ASN1_STRING_get0_data, X509_ALGOR_get0, X509_REQ_get_subject_name, X509_REQ_get_version,
|
||||||
X509_STORE_CTX_get0_chain, X509_set1_notAfter, X509_set1_notBefore,
|
X509_STORE_CTX_get0_chain, X509_set1_notAfter, X509_set1_notBefore,
|
||||||
};
|
};
|
||||||
|
|
||||||
use ffi::X509_OBJECT_get0_X509;
|
use crate::ffi::X509_OBJECT_get0_X509;
|
||||||
|
|
||||||
#[allow(bad_style)]
|
#[allow(bad_style)]
|
||||||
unsafe fn X509_OBJECT_free(x: *mut ffi::X509_OBJECT) {
|
unsafe fn X509_OBJECT_free(x: *mut ffi::X509_OBJECT) {
|
||||||
|
|
|
||||||
|
|
@ -34,14 +34,14 @@
|
||||||
//! let store: X509Store = builder.build();
|
//! let store: X509Store = builder.build();
|
||||||
//! ```
|
//! ```
|
||||||
|
|
||||||
use ffi;
|
use crate::ffi;
|
||||||
use foreign_types::ForeignTypeRef;
|
use foreign_types::ForeignTypeRef;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
|
|
||||||
use error::ErrorStack;
|
use crate::error::ErrorStack;
|
||||||
use stack::StackRef;
|
use crate::stack::StackRef;
|
||||||
use x509::{X509Object, X509};
|
use crate::x509::{X509Object, X509};
|
||||||
use {cvt, cvt_p};
|
use crate::{cvt, cvt_p};
|
||||||
|
|
||||||
foreign_type_and_impl_send_sync! {
|
foreign_type_and_impl_send_sync! {
|
||||||
type CType = ffi::X509_STORE;
|
type CType = ffi::X509_STORE;
|
||||||
|
|
@ -107,4 +107,4 @@ impl X509StoreRef {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
use ffi::X509_STORE_get0_objects;
|
use crate::ffi::X509_STORE_get0_objects;
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,18 @@
|
||||||
use hex::{self, FromHex};
|
use hex::{self, FromHex};
|
||||||
|
|
||||||
use asn1::Asn1Time;
|
use crate::asn1::Asn1Time;
|
||||||
use bn::{BigNum, MsbOption};
|
use crate::bn::{BigNum, MsbOption};
|
||||||
use hash::MessageDigest;
|
use crate::hash::MessageDigest;
|
||||||
use nid::Nid;
|
use crate::nid::Nid;
|
||||||
use pkey::{PKey, Private};
|
use crate::pkey::{PKey, Private};
|
||||||
use rsa::Rsa;
|
use crate::rsa::Rsa;
|
||||||
use stack::Stack;
|
use crate::stack::Stack;
|
||||||
use x509::extension::{
|
use crate::x509::extension::{
|
||||||
AuthorityKeyIdentifier, BasicConstraints, ExtendedKeyUsage, KeyUsage, SubjectAlternativeName,
|
AuthorityKeyIdentifier, BasicConstraints, ExtendedKeyUsage, KeyUsage, SubjectAlternativeName,
|
||||||
SubjectKeyIdentifier,
|
SubjectKeyIdentifier,
|
||||||
};
|
};
|
||||||
use x509::store::X509StoreBuilder;
|
use crate::x509::store::X509StoreBuilder;
|
||||||
use x509::{X509Name, X509Req, X509StoreContext, X509VerifyResult, X509};
|
use crate::x509::{X509Name, X509Req, X509StoreContext, X509VerifyResult, X509};
|
||||||
|
|
||||||
fn pkey() -> PKey<Private> {
|
fn pkey() -> PKey<Private> {
|
||||||
let rsa = Rsa::generate(2048).unwrap();
|
let rsa = Rsa::generate(2048).unwrap();
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
use ffi;
|
use crate::ffi;
|
||||||
use foreign_types::ForeignTypeRef;
|
use foreign_types::ForeignTypeRef;
|
||||||
use libc::c_uint;
|
use libc::c_uint;
|
||||||
use std::net::IpAddr;
|
use std::net::IpAddr;
|
||||||
|
|
||||||
use cvt;
|
use crate::cvt;
|
||||||
use error::ErrorStack;
|
use crate::error::ErrorStack;
|
||||||
|
|
||||||
bitflags! {
|
bitflags! {
|
||||||
/// Flags used to check an `X509` certificate.
|
/// Flags used to check an `X509` certificate.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue