Skip to content

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
blackle:develop
Open

Use more bytes of seed for gmp_randseed, do not use gmp_randseed_ui because it is always only 32-bits of entropy#5
blackle wants to merge 1 commit intoLeoniels:developfrom
blackle:develop

Conversation

@blackle
Copy link
Copy Markdown

@blackle blackle commented Nov 11, 2021

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 for PRIME_LEN*4 bits. Because ENTROPY_BYTES is in bytes and PRIME_LEN is in bits, we divide by 8 to get PRIME_LEN*4/8 = PRIME_LEN/2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant