mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2025-02-24 14:51:11 +01:00
Merge remote-tracking branch 'teor/check-crypto-errors-v2'
This commit is contained in:
commit
c875265bbb
2 changed files with 10 additions and 2 deletions
5
changes/check-crypto-errors
Normal file
5
changes/check-crypto-errors
Normal file
|
@ -0,0 +1,5 @@
|
|||
o Minor bugfix (crypto):
|
||||
- Check the return value of HMAC and assert on failure.
|
||||
Fixes bug #17658; bugfix on commit in fdbb9cdf746b (11 Oct 2011)
|
||||
in tor version 0.2.3.5-alpha-dev.
|
||||
Patch by "teor".
|
|
@ -1906,11 +1906,14 @@ crypto_hmac_sha256(char *hmac_out,
|
|||
const char *key, size_t key_len,
|
||||
const char *msg, size_t msg_len)
|
||||
{
|
||||
unsigned char *rv = NULL;
|
||||
/* If we've got OpenSSL >=0.9.8 we can use its hmac implementation. */
|
||||
tor_assert(key_len < INT_MAX);
|
||||
tor_assert(msg_len < INT_MAX);
|
||||
HMAC(EVP_sha256(), key, (int)key_len, (unsigned char*)msg, (int)msg_len,
|
||||
(unsigned char*)hmac_out, NULL);
|
||||
tor_assert(hmac_out);
|
||||
rv = HMAC(EVP_sha256(), key, (int)key_len, (unsigned char*)msg, (int)msg_len,
|
||||
(unsigned char*)hmac_out, NULL);
|
||||
tor_assert(rv);
|
||||
}
|
||||
|
||||
/* DH */
|
||||
|
|
Loading…
Add table
Reference in a new issue