LSC: Apply clang-tidy's modernize-use-bool-literals to boringssl

The check finds implicit conversions of integer literals to bools:
  bool b1 = 1;
  bool b2 = static_cast<bool>(1);
and transforms them to:
  bool b1 = true;
  bool b2 = true;

Bug: chromium:1290142
Change-Id: I15579e28f544d07b331a230b70a8278e0651150d
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/51085
Reviewed-by: David Benjamin <davidben@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
fips-20220613
Anton Bikineev 3 years ago committed by Boringssl LUCI CQ
parent 960ddfee4e
commit 50e7ea5f09
  1. 2
      ssl/dtls_method.cc
  2. 2
      ssl/extensions.cc
  3. 10
      ssl/handshake.cc
  4. 2
      ssl/handshake_server.cc
  5. 4
      ssl/ssl_asn1.cc
  6. 2
      ssl/ssl_file.cc
  7. 4
      ssl/ssl_test.cc
  8. 2
      ssl/tls13_both.cc
  9. 4
      ssl/tls13_enc.cc

@ -94,7 +94,7 @@ static bool dtls1_set_read_state(SSL *ssl, ssl_encryption_level_t level,
ssl->s3->aead_read_ctx = std::move(aead_ctx);
ssl->s3->read_level = level;
ssl->d1->has_change_cipher_spec = 0;
ssl->d1->has_change_cipher_spec = false;
return true;
}

@ -2581,7 +2581,7 @@ static bool parse_u16_array(const CBS *cbs, Array<uint16_t> *out) {
assert(CBS_len(&copy) == 0);
*out = std::move(ret);
return 1;
return true;
}
static bool ext_supported_groups_parse_clienthello(SSL_HANDSHAKE *hs,

@ -528,20 +528,20 @@ bool ssl_send_finished(SSL_HANDSHAKE *hs) {
size_t finished_len;
if (!hs->transcript.GetFinishedMAC(finished, &finished_len, session,
ssl->server)) {
return 0;
return false;
}
// Log the master secret, if logging is enabled.
if (!ssl_log_secret(ssl, "CLIENT_RANDOM",
MakeConstSpan(session->secret, session->secret_length))) {
return 0;
return false;
}
// Copy the Finished so we can use it for renegotiation checks.
if (finished_len > sizeof(ssl->s3->previous_client_finished) ||
finished_len > sizeof(ssl->s3->previous_server_finished)) {
OPENSSL_PUT_ERROR(SSL, ERR_R_INTERNAL_ERROR);
return 0;
return false;
}
if (ssl->server) {
@ -558,10 +558,10 @@ bool ssl_send_finished(SSL_HANDSHAKE *hs) {
!CBB_add_bytes(&body, finished, finished_len) ||
!ssl_add_message_cbb(ssl, cbb.get())) {
OPENSSL_PUT_ERROR(SSL, ERR_R_INTERNAL_ERROR);
return 0;
return false;
}
return 1;
return true;
}
bool ssl_output_cert_chain(SSL_HANDSHAKE *hs) {

@ -1311,7 +1311,7 @@ static enum ssl_hs_wait_t do_read_client_certificate(SSL_HANDSHAKE *hs) {
hs->new_session->verify_result = X509_V_OK;
} else if (hs->config->retain_only_sha256_of_client_certs) {
// The hash will have been filled in.
hs->new_session->peer_sha256_valid = 1;
hs->new_session->peer_sha256_valid = true;
}
ssl->method->next_message(ssl);

@ -662,9 +662,9 @@ UniquePtr<SSL_SESSION> SSL_SESSION_parse(CBS *cbs,
}
OPENSSL_memcpy(ret->peer_sha256, CBS_data(&peer_sha256),
sizeof(ret->peer_sha256));
ret->peer_sha256_valid = 1;
ret->peer_sha256_valid = true;
} else {
ret->peer_sha256_valid = 0;
ret->peer_sha256_valid = false;
}
if (!SSL_SESSION_parse_bounded_octet_string(

@ -179,7 +179,7 @@ STACK_OF(X509_NAME) *SSL_load_client_CA_file(const char *file) {
}
}
if (0) {
if (false) {
err:
sk_X509_NAME_pop_free(ret, X509_NAME_free);
ret = NULL;

@ -5146,7 +5146,7 @@ TEST(SSLTest, Handoff) {
SSL_CTX_set_session_cache_mode(client_ctx.get(), SSL_SESS_CACHE_CLIENT);
SSL_CTX_sess_set_new_cb(client_ctx.get(), SaveLastSession);
SSL_CTX_set_handoff_mode(server_ctx.get(), 1);
SSL_CTX_set_handoff_mode(server_ctx.get(), true);
uint8_t keys[48];
SSL_CTX_get_tlsext_ticket_keys(server_ctx.get(), &keys, sizeof(keys));
SSL_CTX_set_tlsext_ticket_keys(handshaker_ctx.get(), &keys, sizeof(keys));
@ -5251,7 +5251,7 @@ TEST(SSLTest, HandoffDeclined) {
ASSERT_TRUE(client_ctx);
ASSERT_TRUE(server_ctx);
SSL_CTX_set_handoff_mode(server_ctx.get(), 1);
SSL_CTX_set_handoff_mode(server_ctx.get(), true);
ASSERT_TRUE(SSL_CTX_set_max_proto_version(server_ctx.get(), TLS1_2_VERSION));
bssl::UniquePtr<SSL> client, server;

@ -475,7 +475,7 @@ bool tls13_add_certificate(SSL_HANDSHAKE *hs) {
CRYPTO_BUFFER_len(raw)) ||
!CBB_flush(&extensions)) {
OPENSSL_PUT_ERROR(SSL, ERR_R_INTERNAL_ERROR);
return 0;
return false;
}
ssl->s3->delegated_credential_used = true;
}

@ -364,9 +364,9 @@ bool tls13_finished_mac(SSL_HANDSHAKE *hs, uint8_t *out, size_t *out_len,
!tls13_verify_data(out, out_len, hs->transcript.Digest(),
hs->ssl->version, traffic_secret,
MakeConstSpan(context_hash, context_hash_len))) {
return 0;
return false;
}
return 1;
return true;
}
static const char kTLS13LabelResumptionPSK[] = "resumption";

Loading…
Cancel
Save