boringssl/crypto/digest
David Benjamin 0375127606 Promise more accurate bounds than EVP_MD_MAX_SIZE.
A caller using EVP_Digest* which a priori knows tighter bounds on the
hash function used (perhaps because it is always a particular hash) can
assume the function will not write more bytes than the size of the hash.

The letter of the rules before vaguely[*] allowed for more than
EVP_MD_MAX_SIZE bytes written which made for some unreasonable code in
Chromium. Officially clarify this and add tests which, when paired with
valgrind and ASan prove it.

BUG=59

[*] Not really. I think it already promised the output length will be
both the number of bytes written and the size of the hash and the size
of the hash is given by what the function promises to compute. Meh.

Change-Id: I736d526e81cca30475c90897bca896293ff30278
Reviewed-on: https://boringssl-review.googlesource.com/9066
Reviewed-by: Eric Roman <ericroman@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
2016-08-01 23:24:04 +00:00
..
CMakeLists.txt Add a run_tests target to run all tests. 2015-10-26 20:33:44 +00:00
digest_test.cc Promise more accurate bounds than EVP_MD_MAX_SIZE. 2016-08-01 23:24:04 +00:00
digest.c Make EVP_MD_CTX size functions return size_t. 2016-04-19 15:12:41 +00:00
digests.c |EVP_get_digestbyname| and |EVP_get_digestbynid|: recognize MD4. 2015-08-18 22:23:44 +00:00
internal.h Remove EVP_PKEY_HMAC. 2015-06-25 00:03:02 +00:00
md32_common.h Revert md_len removal from SHA256_CTX and SHA512_CTX. 2016-04-27 19:01:23 +00:00