Commit Graph

26 Commits

Author SHA1 Message Date
Gleb Kozyrev 4bd7ed8a39 Avoid duplicate calls to *_Final when dropping Hasher and HMAC
An assertion triggered in finalize() would lead to drop() erroneously redoing the finalization. Set the state to Finalized unconditionally to prevent this.
2015-01-29 17:50:10 +02:00
Gleb Kozyrev 71f8420205 Rename crypto:#️⃣:HashType -> Type
s/HashType/Type/ to follow the current Rust style. Import Type as HashType in modules where the name might be ambiguous.
[breaking change]
2015-01-28 21:51:12 +02:00
Gleb Kozyrev eb7b7bf847 Change Hasher and HMAC APIs closer to std::hash model
- Implement Clone and std::io::Writer.
- Reduce the API to write() and finish(). Contrary to std::hash, finish() resets the hasher immediately.
- Add hmac::hmac() convenience fn.
- Replace hash::evpmd() with HashType methods.
- Add assertions as a crude check for failed calls into openssl.
- Add examples and some tests.

[breaking-change]
2015-01-28 21:51:12 +02:00
Steven Fackler 030cf5fe88 Fix for IO changes 2015-01-28 08:47:16 -08:00
Gleb Kozyrev cb0898df37 Bring ffi definitions closer to the originals
Add missing return types and fix imprecise type translations.
Repair the fallout in the openssl crate.
2015-01-21 21:56:56 +02:00
Alex Crichton 9dfeea6ca9 Update to rust master 2015-01-09 08:12:39 -08:00
Steven Fackler 2f24d8e771 Fix deprecation warnings 2015-01-03 08:31:57 -08:00
Valerii Hiora cf028e971a Updated to master:
- library stab issues
- deriving -> derive
- {mod} -> {self}
2015-01-03 16:42:58 +02:00
Alex Crichton 7774e672a2 Update to rust master 2014-12-23 08:14:42 -08:00
Valerii Hiora c922090075 Update to nightly: explicit Copy trait 2014-12-11 13:44:37 +02:00
Gleb Kozyrev 5fafe4fc60 Hasher: static contract checking, context reuse
- Store EVP_MD_CTX in a separate struct.
- Add with_context() constructor that uses an existing context.
- Switch to EVP_Digest(Init|Final)_ex for efficient context reuse.
- Make update() borrow &mut self.
- Make finalize() consume self. Add finalize_reuse() that also returns the
context which can be passed to from_context() constructor for reuse.

These changes let the type system prevent illegal calls to update() and
finalize().
2014-11-26 21:38:06 +02:00
James Hurst f02d8c22ec Fixed compilation errors related to namedspaced enums 2014-11-17 19:16:51 -05:00
Steven Fackler 5258ce6ece Move AES XTS support to a feature 2014-11-16 14:01:24 -08:00
Cody P Schafer 3cbc518249 Hasher::write(): add basic test 2014-11-07 16:58:30 -05:00
Cody P Schafer b9f95b4ce4 crypto/hash: impl Writer for Hasher to allow use of Reader-Writer convenience functions 2014-11-07 16:56:18 -05:00
Valerii Hiora dd46d1922e Correct init mutexes and locking function
`libcrypto` uses locks quite intensively even without SSL. 
So they should be initialized before everything else to 
function properly in multi-threaded apps in which SSL 
operations are absent or delayed.

Finishes #79
2014-10-14 08:31:42 +03:00
Samuel Fredrickson 95b9cf39c9 "final" is now a reserved word, so change occurrences to "finalize". 2014-10-09 01:05:41 -07:00
Valerii Hiora 02637ec7d4 single `ffi` module 2014-09-30 08:21:31 +03:00
Michael Gehring 6802216f79 Update for rust rfc 52 changes 2014-09-17 17:21:17 +02:00
Andrew Dunham 1579173a10 Fix lints for non snake-case functions 2014-09-04 17:55:35 -07:00
Michael Gehring c4a275dc37 Add repr(C) to C structs 2014-08-22 17:16:16 +02:00
Jeremy Ruten 9f2a9c8524 Add new HashType RIPEMD160 2014-08-04 15:20:49 -06:00
Steven Fackler 203bdd076e Shift directory structure 2014-08-03 19:16:09 -07:00
Steven Fackler 53e11b08f5 Prepare rustcrypto to merge into rust-openssl 2013-12-28 17:09:18 -07:00
Erick Tryzelaar 85e6d1db12 update to rust 0.9-pre (a5fa1d9) 2013-12-27 22:02:38 -05:00
Erick Tryzelaar a9ce2a36d5 Switch over to rustpkg 2013-12-18 08:51:10 -08:00