Integrate everything

This commit is contained in:
Steven Fackler 2013-12-28 18:39:07 -07:00
parent ec8d926e56
commit 9b3746260c
13 changed files with 37 additions and 23 deletions

2
.gitignore vendored
View File

@ -1,2 +1,4 @@
/.rust/
/doc/
/rust-openssl
/rust-openssl.dSYM/

15
LICENSE Normal file
View File

@ -0,0 +1,15 @@
Copyright 2011 Google Inc.
2013 Jack Lloyd
2013 Steven Fackler
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -3,11 +3,11 @@ RUSTC ?= rustc
RUST_FLAGS ?= -Z debug-info -O
all:
$(RUSTPKG) $(RUST_FLAGS) install crypto
$(RUSTPKG) $(RUST_FLAGS) install
test:
$(RUSTC) $(RUST_FLAGS) --test src/crypto/lib.rs
./src/crypto/crypto
$(RUSTC) $(RUST_FLAGS) --test lib.rs
./rust-openssl
clean:
rm -rf bin/ lib/ build/ src/crypto/lib

View File

@ -105,8 +105,8 @@ pub fn hash(t: HashType, data: &[u8]) -> ~[u8] {
#[cfg(test)]
mod tests {
use hex::FromHex;
use hex::ToHex;
use crypto::hex::FromHex;
use crypto::hex::ToHex;
struct HashTest {
input: ~[u8],

View File

@ -17,7 +17,7 @@
use std::libc::{c_uchar, c_int, c_uint};
use std::ptr;
use std::vec;
use hash;
use crypto::hash;
#[allow(non_camel_case_types)]
pub struct HMAC_CTX {

View File

@ -15,8 +15,6 @@
* limitations under the License.
*/
#[crate_id = "crypto#0.3"];
pub mod hash;
pub mod hex;
pub mod hmac;

View File

@ -3,7 +3,7 @@ use std::libc::{c_char, c_int, c_uint};
use std::libc;
use std::ptr;
use std::vec;
use hash::{HashType, MD5, SHA1, SHA224, SHA256, SHA384, SHA512};
use crypto::hash::{HashType, MD5, SHA1, SHA224, SHA256, SHA384, SHA512};
#[allow(non_camel_case_types)]
pub type EVP_PKEY = *libc::c_void;
@ -336,7 +336,7 @@ impl Drop for PKey {
#[cfg(test)]
mod tests {
use hash::{MD5, SHA1};
use crypto::hash::{MD5, SHA1};
#[test]
fn test_gen_pub() {

View File

@ -194,7 +194,7 @@ pub fn decrypt(t: Type, key: &[u8], iv: ~[u8], data: &[u8]) -> ~[u8] {
#[cfg(test)]
mod tests {
use hex::FromHex;
use crypto::hex::FromHex;
// Test vectors from FIPS-197:
// http://csrc.nist.gov/publications/fips/fips197/fips-197.pdf
@ -223,7 +223,7 @@ mod tests {
}
fn cipher_test(ciphertype: super::Type, pt: ~str, ct: ~str, key: ~str, iv: ~str) {
use hex::ToHex;
use crypto::hex::ToHex;
let cipher = super::Crypter::new(ciphertype);
cipher.init(super::Encrypt, key.from_hex(), iv.from_hex());

6
lib.rs Normal file
View File

@ -0,0 +1,6 @@
#[feature(struct_variant, macro_rules)];
#[crate_id="github.com/sfackler/rust-openssl"];
#[doc(html_root_url="http://sfackler.github.io/rust-openssl/doc")];
pub mod ssl;
pub mod crypto;

View File

@ -1,7 +1,3 @@
#[feature(struct_variant, macro_rules)];
#[crate_id="github.com/sfackler/rust-ssl"];
#[doc(html_root_url="http://sfackler.github.io/rust-ssl/doc/")];
use std::cast;
use std::libc::{c_int, c_void, c_char};
use std::ptr;
@ -12,11 +8,12 @@ use std::unstable::mutex::Mutex;
use std::io::{Stream, Reader, Writer, Decorator};
use std::vec;
use self::error::{SslError, SslSessionClosed, StreamEof};
use ssl::error::{SslError, SslSessionClosed, StreamEof};
pub mod error;
mod ffi;
#[cfg(test)]
mod tests;
static mut STARTED_INIT: AtomicBool = INIT_ATOMIC_BOOL;
static mut FINISHED_INIT: AtomicBool = INIT_ATOMIC_BOOL;

View File

@ -1,12 +1,8 @@
#[feature(struct_variant, macro_rules)];
use std::io::Writer;
use std::io::net::tcp::TcpStream;
use std::str;
use lib::{Sslv23, SslContext, SslStream, SslVerifyPeer, X509StoreContext};
mod lib;
use ssl::{Sslv23, SslContext, SslStream, SslVerifyPeer, X509StoreContext};
#[test]
fn test_new_ctx() {