diff options
author | Nick Mathewson <nickm@torproject.org> | 2016-01-27 13:10:17 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2016-01-27 13:10:17 -0500 |
commit | 39b597c2fd8b45ff61573c70c36e8a4846cf3a0e (patch) | |
tree | 3cdee49e030a2cf683a2e117472538987d9d76f9 /src/common/crypto.h | |
parent | 4770db8e992365c12c652f53a7d3fd84bae25bcb (diff) | |
download | tor-39b597c2fd8b45ff61573c70c36e8a4846cf3a0e.tar.gz tor-39b597c2fd8b45ff61573c70c36e8a4846cf3a0e.zip |
Restrict the meaning of digests_t to sha1+sha256.
This saves CPU and RAM when handling consensuses and x509 certs.
Closes ticket 17795; bug not in any released tor.
Diffstat (limited to 'src/common/crypto.h')
-rw-r--r-- | src/common/crypto.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/common/crypto.h b/src/common/crypto.h index fa2ed610c7..73b94b77db 100644 --- a/src/common/crypto.h +++ b/src/common/crypto.h @@ -100,8 +100,10 @@ typedef enum { DIGEST_SHA3_512 = 4, } digest_algorithm_t; #define N_DIGEST_ALGORITHMS (DIGEST_SHA3_512+1) +#define N_COMMON_DIGEST_ALGORITHMS (DIGEST_SHA256+1) -/** A set of all the digests we know how to compute, taken on a single + +/** A set of all the digests we commonly compute, taken on a single * string. Any digests that are shorter than 512 bits are right-padded * with 0 bits. * @@ -110,7 +112,7 @@ typedef enum { * once. **/ typedef struct { - char d[N_DIGEST_ALGORITHMS][DIGEST512_LEN]; + char d[N_COMMON_DIGEST_ALGORITHMS][DIGEST256_LEN]; } digests_t; typedef struct crypto_pk_t crypto_pk_t; |