summaryrefslogtreecommitdiff
path: root/src/lib/crypt_ops/include.am
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2019-02-05 12:49:04 -0500
committerNick Mathewson <nickm@torproject.org>2019-02-14 09:26:40 -0500
commitf3cbd6426cbb27b9ab4e5492a50a785cce77f805 (patch)
treefe986b31fcf87010db296fa38fed759ed4aeb66d /src/lib/crypt_ops/include.am
parent3d3578ab41c9be602fad5c4172a880668994c8c3 (diff)
downloadtor-f3cbd6426cbb27b9ab4e5492a50a785cce77f805.tar.gz
tor-f3cbd6426cbb27b9ab4e5492a50a785cce77f805.zip
Implement a fast aes-ctr prng
This module is currently implemented to use the same technique as libottery (later used by the bsds' arc4random replacement), using AES-CTR-256 as its underlying stream cipher. It's backtracking- resistant immediately after each call, and prediction-resistant after a while. Here's how it works: We generate psuedorandom bytes using AES-CTR-256. We generate BUFLEN bytes at a time. When we do this, we keep the first SEED_LEN bytes as the key and the IV for our next invocation of AES_CTR, and yield the remaining BUFLEN - SEED_LEN bytes to the user as they invoke the PRNG. As we yield bytes to the user, we clear them from the buffer. Every RESEED_AFTER times we refill the buffer, we mix in an additional SEED_LEN bytes from our strong PRNG into the seed. If the user ever asks for a huge number of bytes at once, we pull SEED_LEN bytes from the PRNG and use them with our stream cipher to fill the user's request.
Diffstat (limited to 'src/lib/crypt_ops/include.am')
-rw-r--r--src/lib/crypt_ops/include.am1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/lib/crypt_ops/include.am b/src/lib/crypt_ops/include.am
index 19cfee1355..4730440143 100644
--- a/src/lib/crypt_ops/include.am
+++ b/src/lib/crypt_ops/include.am
@@ -17,6 +17,7 @@ src_lib_libtor_crypt_ops_a_SOURCES = \
src/lib/crypt_ops/crypto_ope.c \
src/lib/crypt_ops/crypto_pwbox.c \
src/lib/crypt_ops/crypto_rand.c \
+ src/lib/crypt_ops/crypto_rand_fast.c \
src/lib/crypt_ops/crypto_rand_numeric.c \
src/lib/crypt_ops/crypto_rsa.c \
src/lib/crypt_ops/crypto_s2k.c \