jedisct1 / libhydrogen

A lightweight, secure, easy-to-use crypto library suitable for constrained environments.
https://libhydrogen.org
Other
594 stars 88 forks source link

hydro_random_init() get called twice #111

Closed DeeFuse closed 2 years ago

DeeFuse commented 2 years ago

I noticed hydro_random_init() get called from hydro_init() as well as in the first call to a random number function through hydro_random_check_initialized()

hydro_init() does not set hydro_random_context.initialized to 1 but hydro_random_check_initialized() is calling hydro_random_init() again and sets the necessary bits afterwards.

One possible solution would be to set hydro_random_context.initialized to 1 hydro_random_init() or even in hydro_init()

jedisct1 commented 2 years ago

Good catch, thank you!

One possible solution would be to set hydro_random_context.initialized to 1 hydro_random_init() or even in hydro_init()

Done!