### Changes between 3.5 and 3.6 [xx XXX xxxx]
+ * Introduces use of `<stdbool.h>` when handling JSON encoding in
+ the OpenSSL codebase, replacing the previous use of `int` for
+ these boolean values.
+
+ *Alexis Goodfellow*
+
* An ANSI-C toolchain is no longer sufficient for building OpenSSL. The code
should build on compilers supporting C-99 features.
/*
- * Copyright 2023-2024 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2023-2025 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
#ifndef OSSL_JSON_ENC_H
# define OSSL_JSON_ENC_H
+# include <stdbool.h>
# include <openssl/bio.h>
/*
void ossl_json_null(OSSL_JSON_ENC *json);
/* Encode a JSON boolean value. */
-void ossl_json_bool(OSSL_JSON_ENC *json, int value);
+void ossl_json_bool(OSSL_JSON_ENC *json, bool value);
/* Encode a JSON integer from a uint64_t. */
void ossl_json_u64(OSSL_JSON_ENC *json, uint64_t value);
/*
- * Copyright 2023-2024 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2023-2025 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
# define OSSL_QLOG_H
# include <openssl/ssl.h>
+# include <stdbool.h>
# include "internal/quic_types.h"
# include "internal/time.h"
const char *value, size_t value_len);
void ossl_qlog_u64(QLOG *qlog, const char *name, uint64_t value);
void ossl_qlog_i64(QLOG *qlog, const char *name, int64_t value);
-void ossl_qlog_bool(QLOG *qlog, const char *name, int value);
+void ossl_qlog_bool(QLOG *qlog, const char *name, bool value);
void ossl_qlog_bin(QLOG *qlog, const char *name,
const void *value, size_t value_len);
/*
- * Copyright 2023-2024 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2023-2025 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
#include "internal/nelem.h"
#include "internal/numbers.h"
#include <string.h>
+#include <stdbool.h>
/*
* wbuf
json_post_item(json);
}
-void ossl_json_bool(OSSL_JSON_ENC *json, int v)
+void ossl_json_bool(OSSL_JSON_ENC *json, bool v)
{
if (!json_pre_item(json))
return;
- json_write_str(json, v > 0 ? "true" : "false");
+ json_write_str(json, v ? "true" : "false");
json_post_item(json);
}
/*
- * Copyright 2023-2024 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2023-2025 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* https://www.openssl.org/source/license.html
*/
+#include <stdbool.h>
#include "internal/qlog.h"
#include "internal/json_enc.h"
#include "internal/common.h"
ossl_json_i64(&qlog->json, value);
}
-void ossl_qlog_bool(QLOG *qlog, const char *name, int value)
+void ossl_qlog_bool(QLOG *qlog, const char *name, bool value)
{
if (name != NULL)
ossl_json_key(&qlog->json, name);
/*
- * Copyright 2022-2024 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2022-2025 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
*/
#include <stdio.h>
+#include <stdbool.h>
#include <string.h>
#include "testutil.h"
END_SCRIPT_EXPECTING_Q([])
BEGIN_SCRIPT(bool_false, "serialize false", 0)
- OPJ_BOOL(0)
+ OPJ_BOOL(false)
END_SCRIPT_EXPECTING_Q(false)
BEGIN_SCRIPT(bool_true, "serialize true", 0)
- OPJ_BOOL(1)
+ OPJ_BOOL(true)
END_SCRIPT_EXPECTING_Q(true)
BEGIN_SCRIPT(u64_0, "serialize u64(0)", 0)