mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-14 07:03:44 +01:00
f3cbd6426c
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.
74 lines
2.4 KiB
Plaintext
74 lines
2.4 KiB
Plaintext
|
|
noinst_LIBRARIES += src/lib/libtor-crypt-ops.a
|
|
|
|
if UNITTESTS_ENABLED
|
|
noinst_LIBRARIES += src/lib/libtor-crypt-ops-testing.a
|
|
endif
|
|
|
|
src_lib_libtor_crypt_ops_a_SOURCES = \
|
|
src/lib/crypt_ops/crypto_cipher.c \
|
|
src/lib/crypt_ops/crypto_curve25519.c \
|
|
src/lib/crypt_ops/crypto_dh.c \
|
|
src/lib/crypt_ops/crypto_digest.c \
|
|
src/lib/crypt_ops/crypto_ed25519.c \
|
|
src/lib/crypt_ops/crypto_format.c \
|
|
src/lib/crypt_ops/crypto_hkdf.c \
|
|
src/lib/crypt_ops/crypto_init.c \
|
|
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 \
|
|
src/lib/crypt_ops/crypto_util.c \
|
|
src/lib/crypt_ops/digestset.c
|
|
|
|
if USE_NSS
|
|
src_lib_libtor_crypt_ops_a_SOURCES += \
|
|
src/lib/crypt_ops/aes_nss.c \
|
|
src/lib/crypt_ops/crypto_dh_nss.c \
|
|
src/lib/crypt_ops/crypto_nss_mgt.c \
|
|
src/lib/crypt_ops/crypto_rsa_nss.c
|
|
else
|
|
src_lib_libtor_crypt_ops_a_SOURCES += \
|
|
src/lib/crypt_ops/aes_openssl.c \
|
|
src/lib/crypt_ops/crypto_rsa_openssl.c
|
|
endif
|
|
|
|
if USE_OPENSSL
|
|
src_lib_libtor_crypt_ops_a_SOURCES += \
|
|
src/lib/crypt_ops/crypto_dh_openssl.c \
|
|
src/lib/crypt_ops/crypto_openssl_mgt.c
|
|
endif
|
|
|
|
src_lib_libtor_crypt_ops_a_CFLAGS = $(AM_CFLAGS) $(TOR_CFLAGS_CRYPTLIB)
|
|
|
|
src_lib_libtor_crypt_ops_testing_a_SOURCES = \
|
|
$(src_lib_libtor_crypt_ops_a_SOURCES)
|
|
src_lib_libtor_crypt_ops_testing_a_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_CPPFLAGS)
|
|
src_lib_libtor_crypt_ops_testing_a_CFLAGS = \
|
|
$(AM_CFLAGS) $(TOR_CFLAGS_CRYPTLIB) $(TEST_CFLAGS)
|
|
|
|
noinst_HEADERS += \
|
|
src/lib/crypt_ops/aes.h \
|
|
src/lib/crypt_ops/compat_openssl.h \
|
|
src/lib/crypt_ops/crypto_curve25519.h \
|
|
src/lib/crypt_ops/crypto_dh.h \
|
|
src/lib/crypt_ops/crypto_digest.h \
|
|
src/lib/crypt_ops/crypto_ed25519.h \
|
|
src/lib/crypt_ops/crypto_format.h \
|
|
src/lib/crypt_ops/crypto_cipher.h \
|
|
src/lib/crypt_ops/crypto_hkdf.h \
|
|
src/lib/crypt_ops/crypto_init.h \
|
|
src/lib/crypt_ops/crypto_nss_mgt.h \
|
|
src/lib/crypt_ops/crypto_openssl_mgt.h \
|
|
src/lib/crypt_ops/crypto_ope.h \
|
|
src/lib/crypt_ops/crypto_pwbox.h \
|
|
src/lib/crypt_ops/crypto_rand.h \
|
|
src/lib/crypt_ops/crypto_rsa.h \
|
|
src/lib/crypt_ops/crypto_s2k.h \
|
|
src/lib/crypt_ops/crypto_sys.h \
|
|
src/lib/crypt_ops/crypto_util.h \
|
|
src/lib/crypt_ops/digestset.h
|