Skip to content

Commit

Permalink
Integrate everything
Browse files Browse the repository at this point in the history
  • Loading branch information
sfackler committed Dec 29, 2013
1 parent ec8d926 commit 9b37462
Show file tree
Hide file tree
Showing 13 changed files with 37 additions and 23 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
/.rust/
/doc/
/rust-openssl
/rust-openssl.dSYM/
15 changes: 15 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -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.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions crypto/hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down
2 changes: 1 addition & 1 deletion crypto/hmac.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 0 additions & 2 deletions crypto/lib.rs → crypto/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
* limitations under the License.
*/

#[crate_id = "crypto#0.3"];

pub mod hash;
pub mod hex;
pub mod hmac;
Expand Down
4 changes: 2 additions & 2 deletions crypto/pkey.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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() {
Expand Down
4 changes: 2 additions & 2 deletions crypto/symm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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());
Expand Down
6 changes: 6 additions & 0 deletions lib.rs
Original file line number Diff line number Diff line change
@@ -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;
9 changes: 3 additions & 6 deletions ssl/lib.rs → ssl/mod.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;
Expand Down
6 changes: 1 addition & 5 deletions ssl/test.rs → ssl/tests.rs
Original file line number Diff line number Diff line change
@@ -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() {
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 9b37462

Please sign in to comment.