Fix missing global initialization in fips_is_operational
authorJussi Kivilinna <jussi.kivilinna@iki.fi>
Sat, 27 Oct 2018 12:48:29 +0000 (15:48 +0300)
committerJussi Kivilinna <jussi.kivilinna@iki.fi>
Sat, 27 Oct 2018 12:57:22 +0000 (15:57 +0300)
commit6e669e09603e5a98b59dcf35f77f346db6c81eac
treed85847eb79bb09e7f9bc5180fd5656175536f7e7
parentf1fe145a2958ba7a51113d35a83cfc676a920a86
Fix missing global initialization in fips_is_operational

* src/g10lib.h (_gcry_global_any_init_done): New extern.
(fips_is_operational): Check for _gcry_global_any_init_done and call
_gcry_global_is_operational.
* src/global.c (any_init_done): Rename to ...
(_gcry_global_any_init_done): ... this and make externally available.
--

Commit b6e6ace324440f564df664e27f8276ef01f76795 "Add fast path for
_gcry_fips_is_operational" inadvertently replaced function call to
_gcry_global_is_operational with call to _gcry_fips_is_operational
in fips_is_operational macro. This can cause libgcrypt to miss
initialization. This patch restores _gcry_global_is_operational
functionality to fips_is_operational macro while keeping fast-path
to reduce call-overhead to gcry_* functions.

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
src/g10lib.h
src/global.c