Use more bytes of seed for gmp_randseed, do not use gmp_randseed_ui because it is always only 32-bits of entropy#5
Open
blackle wants to merge 1 commit intoLeoniels:developfrom
Open
Conversation
…ecause it is always only 32-bits of entropy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
hello!
gmp_randseed_ui takes a 32-bit random number. This means the entropy of the generated modulus/base will be at most 32-bits. An attacker could iterate through all of these seed values in parallel to find the primes that produce a modulus generated by etlp. This takes some time (about three days on 8 cores, according to some experiments I did), but its possible an attacker could create a table of every modulus/base generated by every seed, together with the prime factors, so lookups would be faster
ENTROPY_BYTES = (PRIME_LEN/2)because gen_modulos and gen_gen_base together query the random number generator forPRIME_LEN*4bits. Because ENTROPY_BYTES is in bytes and PRIME_LEN is in bits, we divide by 8 to getPRIME_LEN*4/8=PRIME_LEN/2