Re-run clang-format with InsertBraces.

This CL runs the same command as in the preceding CL, but with
'IncludeBraces: true' added to .clang-format. I've split this out
separately because the documentation says:

> Setting this option to true could lead to incorrect code formatting
> due to clang-format’s lack of complete semantic information. As such,
> extra care should be taken to review code changes made by this option.

I've also kept InsertBraces out of .clang-format for now because it's a
fairly recent option, and clang-format fails when it sees unrecognized
options.

Change-Id: I305ea7bb2633704053a1f8de1e11b037b9fc8a76
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/53086
Commit-Queue: Bob Beck <bbe@google.com>
Reviewed-by: Bob Beck <bbe@google.com>
diff --git a/crypto/x509v3/v3_alt.c b/crypto/x509v3/v3_alt.c
index 93427ab..3f47901 100644
--- a/crypto/x509v3/v3_alt.c
+++ b/crypto/x509v3/v3_alt.c
@@ -108,8 +108,9 @@
     }
     ret = tmp;
   }
-  if (!ret)
+  if (!ret) {
     return sk_CONF_VALUE_new_null();
+  }
   return ret;
 }
 
@@ -124,69 +125,80 @@
   int i;
   switch (gen->type) {
     case GEN_OTHERNAME:
-      if (!X509V3_add_value("othername", "<unsupported>", &ret))
+      if (!X509V3_add_value("othername", "<unsupported>", &ret)) {
         return NULL;
+      }
       break;
 
     case GEN_X400:
-      if (!X509V3_add_value("X400Name", "<unsupported>", &ret))
+      if (!X509V3_add_value("X400Name", "<unsupported>", &ret)) {
         return NULL;
+      }
       break;
 
     case GEN_EDIPARTY:
-      if (!X509V3_add_value("EdiPartyName", "<unsupported>", &ret))
+      if (!X509V3_add_value("EdiPartyName", "<unsupported>", &ret)) {
         return NULL;
+      }
       break;
 
     case GEN_EMAIL:
-      if (!x509V3_add_value_asn1_string("email", gen->d.ia5, &ret))
+      if (!x509V3_add_value_asn1_string("email", gen->d.ia5, &ret)) {
         return NULL;
+      }
       break;
 
     case GEN_DNS:
-      if (!x509V3_add_value_asn1_string("DNS", gen->d.ia5, &ret))
+      if (!x509V3_add_value_asn1_string("DNS", gen->d.ia5, &ret)) {
         return NULL;
+      }
       break;
 
     case GEN_URI:
-      if (!x509V3_add_value_asn1_string("URI", gen->d.ia5, &ret))
+      if (!x509V3_add_value_asn1_string("URI", gen->d.ia5, &ret)) {
         return NULL;
+      }
       break;
 
     case GEN_DIRNAME:
       if (X509_NAME_oneline(gen->d.dirn, oline, 256) == NULL ||
-          !X509V3_add_value("DirName", oline, &ret))
+          !X509V3_add_value("DirName", oline, &ret)) {
         return NULL;
+      }
       break;
 
     case GEN_IPADD:
       p = gen->d.ip->data;
-      if (gen->d.ip->length == 4)
+      if (gen->d.ip->length == 4) {
         BIO_snprintf(oline, sizeof(oline), "%d.%d.%d.%d", p[0], p[1], p[2],
                      p[3]);
-      else if (gen->d.ip->length == 16) {
+      } else if (gen->d.ip->length == 16) {
         oline[0] = 0;
         for (i = 0; i < 8; i++) {
           uint16_t v = ((uint16_t)p[0] << 8) | p[1];
           BIO_snprintf(htmp, sizeof(htmp), "%X", v);
           p += 2;
           OPENSSL_strlcat(oline, htmp, sizeof(oline));
-          if (i != 7)
+          if (i != 7) {
             OPENSSL_strlcat(oline, ":", sizeof(oline));
+          }
         }
       } else {
-        if (!X509V3_add_value("IP Address", "<invalid>", &ret))
+        if (!X509V3_add_value("IP Address", "<invalid>", &ret)) {
           return NULL;
+        }
         break;
       }
-      if (!X509V3_add_value("IP Address", oline, &ret))
+      if (!X509V3_add_value("IP Address", oline, &ret)) {
         return NULL;
+      }
       break;
 
     case GEN_RID:
       i2t_ASN1_OBJECT(oline, 256, gen->d.rid);
-      if (!X509V3_add_value("Registered ID", oline, &ret))
+      if (!X509V3_add_value("Registered ID", oline, &ret)) {
         return NULL;
+      }
       break;
   }
   return ret;
@@ -231,9 +243,9 @@
 
     case GEN_IPADD:
       p = gen->d.ip->data;
-      if (gen->d.ip->length == 4)
+      if (gen->d.ip->length == 4) {
         BIO_printf(out, "IP Address:%d.%d.%d.%d", p[0], p[1], p[2], p[3]);
-      else if (gen->d.ip->length == 16) {
+      } else if (gen->d.ip->length == 16) {
         BIO_printf(out, "IP Address");
         for (i = 0; i < 8; i++) {
           uint16_t v = ((uint16_t)p[0] << 8) | p[1];
@@ -268,12 +280,14 @@
     cnf = sk_CONF_VALUE_value(nval, i);
     if (!x509v3_name_cmp(cnf->name, "issuer") && cnf->value &&
         !strcmp(cnf->value, "copy")) {
-      if (!copy_issuer(ctx, gens))
+      if (!copy_issuer(ctx, gens)) {
         goto err;
+      }
     } else {
       GENERAL_NAME *gen;
-      if (!(gen = v2i_GENERAL_NAME(method, ctx, cnf)))
+      if (!(gen = v2i_GENERAL_NAME(method, ctx, cnf))) {
         goto err;
+      }
       sk_GENERAL_NAME_push(gens, gen);
     }
   }
@@ -286,15 +300,17 @@
 /* Append subject altname of issuer to issuer alt name of subject */
 
 static int copy_issuer(X509V3_CTX *ctx, GENERAL_NAMES *gens) {
-  if (ctx && (ctx->flags == CTX_TEST))
+  if (ctx && (ctx->flags == CTX_TEST)) {
     return 1;
+  }
   if (!ctx || !ctx->issuer_cert) {
     OPENSSL_PUT_ERROR(X509V3, X509V3_R_NO_ISSUER_DETAILS);
     return 0;
   }
   int i = X509_get_ext_by_NID(ctx->issuer_cert, NID_subject_alt_name, -1);
-  if (i < 0)
+  if (i < 0) {
     return 1;
+  }
 
   int ret = 0;
   GENERAL_NAMES *ialt = NULL;
@@ -335,16 +351,19 @@
     cnf = sk_CONF_VALUE_value(nval, i);
     if (!x509v3_name_cmp(cnf->name, "email") && cnf->value &&
         !strcmp(cnf->value, "copy")) {
-      if (!copy_email(ctx, gens, 0))
+      if (!copy_email(ctx, gens, 0)) {
         goto err;
+      }
     } else if (!x509v3_name_cmp(cnf->name, "email") && cnf->value &&
                !strcmp(cnf->value, "move")) {
-      if (!copy_email(ctx, gens, 1))
+      if (!copy_email(ctx, gens, 1)) {
         goto err;
+      }
     } else {
       GENERAL_NAME *gen;
-      if (!(gen = v2i_GENERAL_NAME(method, ctx, cnf)))
+      if (!(gen = v2i_GENERAL_NAME(method, ctx, cnf))) {
         goto err;
+      }
       sk_GENERAL_NAME_push(gens, gen);
     }
   }
@@ -364,17 +383,19 @@
   X509_NAME_ENTRY *ne;
   GENERAL_NAME *gen = NULL;
   int i;
-  if (ctx != NULL && ctx->flags == CTX_TEST)
+  if (ctx != NULL && ctx->flags == CTX_TEST) {
     return 1;
+  }
   if (!ctx || (!ctx->subject_cert && !ctx->subject_req)) {
     OPENSSL_PUT_ERROR(X509V3, X509V3_R_NO_SUBJECT_DETAILS);
     goto err;
   }
   /* Find the subject name */
-  if (ctx->subject_cert)
+  if (ctx->subject_cert) {
     nm = X509_get_subject_name(ctx->subject_cert);
-  else
+  } else {
     nm = X509_REQ_get_subject_name(ctx->subject_req);
+  }
 
   /* Now add any email address(es) to STACK */
   i = -1;
@@ -420,8 +441,9 @@
   }
   for (i = 0; i < sk_CONF_VALUE_num(nval); i++) {
     cnf = sk_CONF_VALUE_value(nval, i);
-    if (!(gen = v2i_GENERAL_NAME(method, ctx, cnf)))
+    if (!(gen = v2i_GENERAL_NAME(method, ctx, cnf))) {
       goto err;
+    }
     sk_GENERAL_NAME_push(gens, gen);
   }
   return gens;
@@ -446,9 +468,9 @@
     return NULL;
   }
 
-  if (out)
+  if (out) {
     gen = out;
-  else {
+  } else {
     gen = GENERAL_NAME_new();
     if (gen == NULL) {
       OPENSSL_PUT_ERROR(X509V3, ERR_R_MALLOC_FAILURE);
@@ -474,10 +496,11 @@
     } break;
 
     case GEN_IPADD:
-      if (is_nc)
+      if (is_nc) {
         gen->d.ip = a2i_IPADDRESS_NC(value);
-      else
+      } else {
         gen->d.ip = a2i_IPADDRESS(value);
+      }
       if (gen->d.ip == NULL) {
         OPENSSL_PUT_ERROR(X509V3, X509V3_R_BAD_IP_ADDRESS);
         ERR_add_error_data(2, "value=", value);
@@ -516,8 +539,9 @@
   return gen;
 
 err:
-  if (!out)
+  if (!out) {
     GENERAL_NAME_free(gen);
+  }
   return NULL;
 }
 
@@ -536,21 +560,21 @@
     return NULL;
   }
 
-  if (!x509v3_name_cmp(name, "email"))
+  if (!x509v3_name_cmp(name, "email")) {
     type = GEN_EMAIL;
-  else if (!x509v3_name_cmp(name, "URI"))
+  } else if (!x509v3_name_cmp(name, "URI")) {
     type = GEN_URI;
-  else if (!x509v3_name_cmp(name, "DNS"))
+  } else if (!x509v3_name_cmp(name, "DNS")) {
     type = GEN_DNS;
-  else if (!x509v3_name_cmp(name, "RID"))
+  } else if (!x509v3_name_cmp(name, "RID")) {
     type = GEN_RID;
-  else if (!x509v3_name_cmp(name, "IP"))
+  } else if (!x509v3_name_cmp(name, "IP")) {
     type = GEN_IPADD;
-  else if (!x509v3_name_cmp(name, "dirName"))
+  } else if (!x509v3_name_cmp(name, "dirName")) {
     type = GEN_DIRNAME;
-  else if (!x509v3_name_cmp(name, "otherName"))
+  } else if (!x509v3_name_cmp(name, "otherName")) {
     type = GEN_OTHERNAME;
-  else {
+  } else {
     OPENSSL_PUT_ERROR(X509V3, X509V3_R_UNSUPPORTED_OPTION);
     ERR_add_error_data(2, "name=", name);
     return NULL;
@@ -563,26 +587,31 @@
   char *objtmp = NULL;
   const char *p;
   int objlen;
-  if (!(p = strchr(value, ';')))
+  if (!(p = strchr(value, ';'))) {
     return 0;
-  if (!(gen->d.otherName = OTHERNAME_new()))
+  }
+  if (!(gen->d.otherName = OTHERNAME_new())) {
     return 0;
+  }
   /*
    * Free this up because we will overwrite it. no need to free type_id
    * because it is static
    */
   ASN1_TYPE_free(gen->d.otherName->value);
-  if (!(gen->d.otherName->value = ASN1_generate_v3(p + 1, ctx)))
+  if (!(gen->d.otherName->value = ASN1_generate_v3(p + 1, ctx))) {
     return 0;
+  }
   objlen = p - value;
   objtmp = OPENSSL_malloc(objlen + 1);
-  if (objtmp == NULL)
+  if (objtmp == NULL) {
     return 0;
+  }
   OPENSSL_strlcpy(objtmp, value, objlen + 1);
   gen->d.otherName->type_id = OBJ_txt2obj(objtmp, 0);
   OPENSSL_free(objtmp);
-  if (!gen->d.otherName->type_id)
+  if (!gen->d.otherName->type_id) {
     return 0;
+  }
   return 1;
 }
 
@@ -590,8 +619,9 @@
   int ret = 0;
   STACK_OF(CONF_VALUE) *sk = NULL;
   X509_NAME *nm = X509_NAME_new();
-  if (nm == NULL)
+  if (nm == NULL) {
     goto err;
+  }
   sk = X509V3_get_section(ctx, value);
   if (sk == NULL) {
     OPENSSL_PUT_ERROR(X509V3, X509V3_R_SECTION_NOT_FOUND);
@@ -599,14 +629,16 @@
     goto err;
   }
   /* FIXME: should allow other character types... */
-  if (!X509V3_NAME_from_section(nm, sk, MBSTRING_ASC))
+  if (!X509V3_NAME_from_section(nm, sk, MBSTRING_ASC)) {
     goto err;
+  }
   gen->d.dirn = nm;
   ret = 1;
 
 err:
-  if (!ret)
+  if (!ret) {
     X509_NAME_free(nm);
+  }
   X509V3_section_free(ctx, sk);
   return ret;
 }