boringssl/crypto
Adam Langley 6b35262272 Maintain EVP_MD_CTX invariants.
Thanks to Lennart Beringer for pointing that that malloc failures could
lead to invalid EVP_MD_CTX states. This change cleans up the code in
general so that fallible operations are all performed before mutating
objects. Thus failures should leave objects in a valid state.

Also, |ctx_size| is never zero and a hash with no context is not
sensible, so stop handling that case and simply assert that it doesn't
occur.

Change-Id: Ia60c3796dcf2f772f55e12e49431af6475f64d52
Reviewed-on: https://boringssl-review.googlesource.com/20544
Reviewed-by: Adam Langley <agl@google.com>
Commit-Queue: Adam Langley <agl@google.com>
2017-09-20 18:43:21 +00:00
..
asn1 Remove redundant calls to |OPENSSL_cleanse| and |OPENSSL_realloc_clean|. 2017-09-18 19:16:51 +00:00
base64 Run the comment converter on libcrypto. 2017-08-18 21:49:04 +00:00
bio Run the comment converter on libcrypto. 2017-08-18 21:49:04 +00:00
bn_extra Run the comment converter on libcrypto. 2017-08-18 21:49:04 +00:00
buf Remove redundant calls to |OPENSSL_cleanse| and |OPENSSL_realloc_clean|. 2017-09-18 19:16:51 +00:00
bytestring Run the comment converter on libcrypto. 2017-08-18 21:49:04 +00:00
chacha Run the comment converter on libcrypto. 2017-08-18 21:49:04 +00:00
cipher_extra Remove redundant calls to |OPENSSL_cleanse| and |OPENSSL_realloc_clean|. 2017-09-18 19:16:51 +00:00
cmac Run the comment converter on libcrypto. 2017-08-18 21:49:04 +00:00
conf Run the comment converter on libcrypto. 2017-08-18 21:49:04 +00:00
curve25519 Run the comment converter on libcrypto. 2017-08-18 21:49:04 +00:00
dh Run the comment converter on libcrypto. 2017-08-18 21:49:04 +00:00
digest_extra Run the comment converter on libcrypto. 2017-08-18 21:49:04 +00:00
dsa Run the comment converter on libcrypto. 2017-08-18 21:49:04 +00:00
ec_extra Run the comment converter on libcrypto. 2017-08-18 21:49:04 +00:00
ecdh Run the comment converter on libcrypto. 2017-08-18 21:49:04 +00:00
ecdsa_extra Run the comment converter on libcrypto. 2017-08-18 21:49:04 +00:00
engine Run the comment converter on libcrypto. 2017-08-18 21:49:04 +00:00
err Run the comment converter on libcrypto. 2017-08-18 21:49:04 +00:00
evp Switch the buggy RSA parser off by default. 2017-09-18 19:42:51 +00:00
fipsmodule Maintain EVP_MD_CTX invariants. 2017-09-20 18:43:21 +00:00
hkdf Run the comment converter on libcrypto. 2017-08-18 21:49:04 +00:00
hmac_extra Convert a number of tests to GTest. 2017-06-01 17:02:13 +00:00
lhash Use OPENSSL_hash32 in lh_strhash. 2017-08-21 21:10:22 +00:00
obj Run the comment converter on libcrypto. 2017-08-18 21:49:04 +00:00
pem Remove redundant calls to |OPENSSL_cleanse| and |OPENSSL_realloc_clean|. 2017-09-18 19:16:51 +00:00
perlasm Sync ARM assembly up to 609b0852e4d50251857dbbac3141ba042e35a9ae. 2017-06-13 17:47:20 +00:00
pkcs7 Run the comment converter on libcrypto. 2017-08-18 21:49:04 +00:00
pkcs8 Remove redundant calls to |OPENSSL_cleanse| and |OPENSSL_realloc_clean|. 2017-09-18 19:16:51 +00:00
poly1305 Run the comment converter on libcrypto. 2017-08-18 21:49:04 +00:00
pool Run the comment converter on libcrypto. 2017-08-18 21:49:04 +00:00
rand_extra Remove CHROMIUM_ROLLING_MAGENTA_TO_ZIRCON scaffolding. 2017-09-18 21:34:32 +00:00
rc4 Simplify RC4 code and remove assembly. 2016-08-30 15:32:31 +00:00
rsa_extra Run the comment converter on libcrypto. 2017-08-18 21:49:04 +00:00
stack Run the comment converter on libcrypto. 2017-08-18 21:49:04 +00:00
test Clarify ERR_print_errors_* clear the error queue. 2017-09-05 17:31:25 +00:00
x509 Remove redundant calls to |OPENSSL_cleanse| and |OPENSSL_realloc_clean|. 2017-09-18 19:16:51 +00:00
x509v3 Guard against DoS in name constraints handling. 2017-09-06 22:00:46 +00:00
CMakeLists.txt Tidy up some Windows compiler assumptions. 2017-08-16 19:57:06 +00:00
compiler_test.cc Test that nullptr has the obvious memory representation. 2017-07-28 17:39:28 +00:00
constant_time_test.cc Switch constant-time functions to using |crypto_word_t|. 2017-04-21 22:06:05 +00:00
cpu-aarch64-linux.c Run the comment converter on libcrypto. 2017-08-18 21:49:04 +00:00
cpu-arm-linux.c Add CRYPTO_needs_hwcap2_workaround. 2017-09-18 14:05:46 +00:00
cpu-arm.c
cpu-intel.c Run the comment converter on libcrypto. 2017-08-18 21:49:04 +00:00
cpu-ppc64le.c Run the comment converter on libcrypto. 2017-08-18 21:49:04 +00:00
crypto.c Run the comment converter on libcrypto. 2017-08-18 21:49:04 +00:00
ex_data.c Run the comment converter on libcrypto. 2017-08-18 21:49:04 +00:00
internal.h Run the comment converter on libcrypto. 2017-08-18 21:49:04 +00:00
mem.c Remove redundant calls to |OPENSSL_cleanse| and |OPENSSL_realloc_clean|. 2017-09-18 19:16:51 +00:00
refcount_c11.c Run the comment converter on libcrypto. 2017-08-18 21:49:04 +00:00
refcount_lock.c Run the comment converter on libcrypto. 2017-08-18 21:49:04 +00:00
refcount_test.cc Convert various tests to GTest. 2017-05-23 22:34:09 +00:00
thread_none.c Run the comment converter on libcrypto. 2017-08-18 21:49:04 +00:00
thread_pthread.c Run the comment converter on libcrypto. 2017-08-18 21:49:04 +00:00
thread_test.cc Run the comment converter on libcrypto. 2017-08-18 21:49:04 +00:00
thread_win.c Run the comment converter on libcrypto. 2017-08-18 21:49:04 +00:00
thread.c