Fix various style issues following feedback
authorMatt Caswell <matt@openssl.org>
Fri, 6 Jan 2017 11:01:14 +0000 (11:01 +0000)
committerMatt Caswell <matt@openssl.org>
Fri, 6 Jan 2017 11:01:14 +0000 (11:01 +0000)
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2020)

ssl/statem/statem_clnt.c
ssl/statem/statem_lib.c
ssl/statem/statem_srvr.c
ssl/t1_trce.c

index 84dcf08bd46c1c50038549b63b9636a3802785cb..a3133adcef8ba323bff808b9d3bd9e757779f476 100644 (file)
@@ -1360,7 +1360,7 @@ MSG_PROCESS_RETURN tls_process_server_certificate(SSL *s, PACKET *pkt)
     const unsigned char *certstart, *certbytes;
     STACK_OF(X509) *sk = NULL;
     EVP_PKEY *pkey = NULL;
-    size_t chain;
+    size_t chainidx;
     unsigned int context = 0;
 
     if ((sk = sk_X509_new_null()) == NULL) {
@@ -1376,7 +1376,7 @@ MSG_PROCESS_RETURN tls_process_server_certificate(SSL *s, PACKET *pkt)
         SSLerr(SSL_F_TLS_PROCESS_SERVER_CERTIFICATE, SSL_R_LENGTH_MISMATCH);
         goto f_err;
     }
-    for (chain = 0; PACKET_remaining(pkt); chain++) {
+    for (chainidx = 0; PACKET_remaining(pkt); chainidx++) {
         if (!PACKET_get_net_3(pkt, &cert_len)
             || !PACKET_get_bytes(pkt, &certbytes, cert_len)) {
             al = SSL_AD_DECODE_ERROR;
@@ -1411,7 +1411,7 @@ MSG_PROCESS_RETURN tls_process_server_certificate(SSL *s, PACKET *pkt)
             if (!tls_collect_extensions(s, &extensions, EXT_TLS1_3_CERTIFICATE,
                                         &rawexts, &al)
                     || !tls_parse_all_extensions(s, EXT_TLS1_3_CERTIFICATE,
-                                                 rawexts, x, chain, &al))
+                                                 rawexts, x, chainidx, &al))
                 goto f_err;
         }
 
index cc5ca67b97d1ac0a117c1b23955640f65fb79aa2..4b64541cb950c75519b9f4b86cc3a526fcda81d2 100644 (file)
@@ -354,7 +354,7 @@ static int ssl_add_cert_chain(SSL *s, WPACKET *pkt, CERT_PKEY *cpk, int *al)
     /*
      * If we have a certificate specific chain use it, else use parent ctx.
      */
-    if (cpk->chain)
+    if (cpk->chain != NULL)
         extra_certs = cpk->chain;
     else
         extra_certs = s->ctx->extra_certs;
@@ -366,7 +366,7 @@ static int ssl_add_cert_chain(SSL *s, WPACKET *pkt, CERT_PKEY *cpk, int *al)
     else
         chain_store = s->ctx->cert_store;
 
-    if (chain_store) {
+    if (chain_store != NULL) {
         X509_STORE_CTX *xs_ctx = X509_STORE_CTX_new();
 
         if (xs_ctx == NULL) {
index 8b765a9aae43cde2eac2f8d8d625768165909af8..b3d64198082bbb119d6dca8a211e33978b2d7cce 100644 (file)
@@ -427,7 +427,7 @@ static WRITE_TRAN ossl_statem_server13_write_transition(SSL *s)
         return WRITE_TRAN_CONTINUE;
 
     case TLS_ST_SW_CERT:
-            st->hand_state = TLS_ST_SW_FINISHED;
+        st->hand_state = TLS_ST_SW_FINISHED;
         return WRITE_TRAN_CONTINUE;
 
     case TLS_ST_SW_FINISHED:
@@ -3139,7 +3139,7 @@ MSG_PROCESS_RETURN tls_process_client_certificate(SSL *s, PACKET *pkt)
     const unsigned char *certstart, *certbytes;
     STACK_OF(X509) *sk = NULL;
     PACKET spkt, context;
-    size_t chain;
+    size_t chainidx;
 
     if ((sk = sk_X509_new_null()) == NULL) {
         SSLerr(SSL_F_TLS_PROCESS_CLIENT_CERTIFICATE, ERR_R_MALLOC_FAILURE);
@@ -3156,7 +3156,7 @@ MSG_PROCESS_RETURN tls_process_client_certificate(SSL *s, PACKET *pkt)
         goto f_err;
     }
 
-    for (chain = 0; PACKET_remaining(&spkt) > 0; chain++) {
+    for (chainidx = 0; PACKET_remaining(&spkt) > 0; chainidx++) {
         if (!PACKET_get_net_3(&spkt, &l)
             || !PACKET_get_bytes(&spkt, &certbytes, l)) {
             al = SSL_AD_DECODE_ERROR;
@@ -3190,7 +3190,7 @@ MSG_PROCESS_RETURN tls_process_client_certificate(SSL *s, PACKET *pkt)
             if (!tls_collect_extensions(s, &extensions, EXT_TLS1_3_CERTIFICATE,
                                         &rawexts, &al)
                     || !tls_parse_all_extensions(s, EXT_TLS1_3_CERTIFICATE,
-                                                 rawexts, x, chain, &al))
+                                                 rawexts, x, chainidx, &al))
                 goto f_err;
         }
 
index 340cbd403de0f05f51d212d9724f29b8ccdabfc2..2b669e1e7c8d0d3b4f545623ede3076173e9708b 100644 (file)
@@ -766,9 +766,9 @@ static int ssl_print_extension(BIO *bio, int indent, int server, int extype,
 }
 
 static int ssl_print_extensions(BIO *bio, int indent, int server,
-                                const unsigned char **msgin, size_t *msglenin)
+                                const unsigned char **msgin, size_t *msginlen)
 {
-    size_t extslen, msglen = *msglenin;
+    size_t extslen, msglen = *msginlen;
     const unsigned char *msg = *msgin;
 
     BIO_indent(bio, indent, 80);
@@ -799,7 +799,7 @@ static int ssl_print_extensions(BIO *bio, int indent, int server,
     }
 
     *msgin = msg;
-    *msglenin = msglen;
+    *msginlen = msglen;
     return 1;
 }