From d805a57be266ba68ae40f7177aeea69cba2dfe47 Mon Sep 17 00:00:00 2001 From: Matt Caswell Date: Fri, 6 Jan 2017 11:01:14 +0000 Subject: [PATCH] Fix various style issues following feedback Reviewed-by: Rich Salz (Merged from https://github.com/openssl/openssl/pull/2020) --- ssl/statem/statem_clnt.c | 6 +++--- ssl/statem/statem_lib.c | 4 ++-- ssl/statem/statem_srvr.c | 8 ++++---- ssl/t1_trce.c | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/ssl/statem/statem_clnt.c b/ssl/statem/statem_clnt.c index 84dcf08bd4..a3133adcef 100644 --- a/ssl/statem/statem_clnt.c +++ b/ssl/statem/statem_clnt.c @@ -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; } diff --git a/ssl/statem/statem_lib.c b/ssl/statem/statem_lib.c index cc5ca67b97..4b64541cb9 100644 --- a/ssl/statem/statem_lib.c +++ b/ssl/statem/statem_lib.c @@ -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) { diff --git a/ssl/statem/statem_srvr.c b/ssl/statem/statem_srvr.c index 8b765a9aae..b3d6419808 100644 --- a/ssl/statem/statem_srvr.c +++ b/ssl/statem/statem_srvr.c @@ -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; } diff --git a/ssl/t1_trce.c b/ssl/t1_trce.c index 340cbd403d..2b669e1e7c 100644 --- a/ssl/t1_trce.c +++ b/ssl/t1_trce.c @@ -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; } -- 2.25.1