Do not use bit fields for context data flag variables
authorTomas Mraz <tomas@openssl.org>
Wed, 1 May 2024 16:42:57 +0000 (18:42 +0200)
committerTomas Mraz <tomas@openssl.org>
Thu, 9 May 2024 07:20:58 +0000 (09:20 +0200)
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/24275)

crypto/context.c
include/openssl/crypto.h.in

index fa46abab6b2b63305407a5d077088ca4839dac51..2fbb2fbf60ef40dfce3cd65bb20ed0c013fb7dbe 100644 (file)
@@ -49,8 +49,8 @@ struct ossl_lib_ctx_st {
     void *fips_prov;
 #endif
 
-    unsigned int ischild:1;
-    unsigned int conf_diagnostics:1;
+    int ischild;
+    int conf_diagnostics;
 };
 
 int ossl_lib_ctx_write_lock(OSSL_LIB_CTX *ctx)
@@ -676,10 +676,10 @@ int OSSL_LIB_CTX_get_conf_diagnostics(OSSL_LIB_CTX *libctx)
     return libctx->conf_diagnostics;
 }
 
-void OSSL_LIB_CTX_set_conf_diagnostics(OSSL_LIB_CTX *libctx, unsigned int value)
+void OSSL_LIB_CTX_set_conf_diagnostics(OSSL_LIB_CTX *libctx, int value)
 {
     libctx = ossl_lib_ctx_get_concrete(libctx);
     if (libctx == NULL)
         return;
-    libctx->conf_diagnostics = value != 0;
+    libctx->conf_diagnostics = value;
 }
index 04d99e2092387ca451d438aa2ca84ec332964a4d..034f150cb65cecaf5381d63aad6c517189a78f41 100644 (file)
@@ -537,7 +537,7 @@ void OSSL_LIB_CTX_free(OSSL_LIB_CTX *);
 OSSL_LIB_CTX *OSSL_LIB_CTX_get0_global_default(void);
 OSSL_LIB_CTX *OSSL_LIB_CTX_set0_default(OSSL_LIB_CTX *libctx);
 int OSSL_LIB_CTX_get_conf_diagnostics(OSSL_LIB_CTX *ctx);
-void OSSL_LIB_CTX_set_conf_diagnostics(OSSL_LIB_CTX *ctx, unsigned int value);
+void OSSL_LIB_CTX_set_conf_diagnostics(OSSL_LIB_CTX *ctx, int value);
 
 void OSSL_sleep(uint64_t millis);