1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-22 13:33:56 +03:00

gcrypt: switch to system rng before gcry_check_version (#24162)

Current docs claim this must be done before gcry_check_version.

(cherry picked from commit 91375fb9cf)
This commit is contained in:
Cristian Rodríguez 2022-08-01 01:04:27 -04:00 committed by Zbigniew Jędrzejewski-Szmek
parent 79de67e2df
commit 695eb67322

View File

@ -9,6 +9,7 @@ void initialize_libgcrypt(bool secmem) {
if (gcry_control(GCRYCTL_INITIALIZATION_FINISHED_P))
return;
gcry_control(GCRYCTL_SET_PREFERRED_RNG_TYPE, GCRY_RNG_TYPE_SYSTEM);
assert_se(gcry_check_version("1.4.5"));
/* Turn off "secmem". Clients which wish to make use of this
@ -16,7 +17,6 @@ void initialize_libgcrypt(bool secmem) {
if (!secmem)
gcry_control(GCRYCTL_DISABLE_SECMEM);
gcry_control(GCRYCTL_SET_PREFERRED_RNG_TYPE, GCRY_RNG_TYPE_SYSTEM);
gcry_control(GCRYCTL_INITIALIZATION_FINISHED, 0);
}