File 0681-crypto-Handle-FIPS_mode-that-are-not-0-nor-1.patch of Package erlang
From fbf9d6e9695552f2ff47ef46840f7c0a2e3a12f4 Mon Sep 17 00:00:00 2001
From: Hans Nilsson <hans@erlang.org>
Date: Fri, 1 Oct 2021 16:01:23 +0200
Subject: [PATCH 1/2] crypto: Handle FIPS_mode() that are not 0 nor 1
SOme cryptolibs seem to need this.
---
lib/crypto/c_src/algorithms.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/lib/crypto/c_src/algorithms.c b/lib/crypto/c_src/algorithms.c
index aaad836869..dcd95f1099 100644
--- a/lib/crypto/c_src/algorithms.c
+++ b/lib/crypto/c_src/algorithms.c
@@ -200,9 +200,10 @@ ERL_NIF_TERM curve_algorithms(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[
int fips_mode = 0;
int algo_curve_cnt = 0;
-#ifdef FIPS_SUPPORT
- fips_mode = FIPS_mode();
-#endif
+# ifdef FIPS_SUPPORT
+ if (FIPS_mode()) fips_mode = 1;
+# endif
+
algo_curve_cnt = get_curve_cnt(env, fips_mode);
return enif_make_list_from_array(env, algo_curve[fips_mode], algo_curve_cnt);
}
--
2.31.1