summaryrefslogtreecommitdiffstats
path: root/providers/fips/fipsindicator.c
diff options
context:
space:
mode:
authorPauli <ppzgs1@gmail.com>2024-07-18 04:53:22 +0200
committerTomas Mraz <tomas@openssl.org>2024-07-19 17:33:19 +0200
commit98afa01f3e02fba18f9203b2451113df8f247f7c (patch)
tree00e39adc9a8eb11212adad6b1335c79d1c55ff58 /providers/fips/fipsindicator.c
parentprov-compat-label.yml: Do not test fips provider from master (diff)
downloadopenssl-98afa01f3e02fba18f9203b2451113df8f247f7c.tar.xz
openssl-98afa01f3e02fba18f9203b2451113df8f247f7c.zip
fips: correctly initialise FIPS indicator settables
The `memset(3)` just happened to work because 2s complement. This is more robust. Also reduced the size of the indicator structure. Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/24923)
Diffstat (limited to '')
-rw-r--r--providers/fips/fipsindicator.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/providers/fips/fipsindicator.c b/providers/fips/fipsindicator.c
index 9956c19884..a1deebdd72 100644
--- a/providers/fips/fipsindicator.c
+++ b/providers/fips/fipsindicator.c
@@ -15,8 +15,11 @@
void ossl_FIPS_IND_init(OSSL_FIPS_IND *ind)
{
+ int i;
+
ossl_FIPS_IND_set_approved(ind); /* Assume we are approved by default */
- memset(ind->settable, OSSL_FIPS_IND_STATE_UNKNOWN, sizeof(ind->settable));
+ for (i = 0; i < OSSL_FIPS_IND_SETTABLE_MAX; i++)
+ ind->settable[i] = OSSL_FIPS_IND_STATE_UNKNOWN;
}
void ossl_FIPS_IND_set_approved(OSSL_FIPS_IND *ind)