Code style: space after 'if' Reviewed-by: Matt Caswell <matt@openssl.org>
diff --git a/ssl/bio_ssl.c b/ssl/bio_ssl.c index 7cf941d..473b3ff 100644 --- a/ssl/bio_ssl.c +++ b/ssl/bio_ssl.c
@@ -292,7 +292,7 @@ else if (ssl->handshake_func == ssl->method->ssl_accept) SSL_set_accept_state(ssl); - if(!SSL_clear(ssl)) { + if (!SSL_clear(ssl)) { ret = 0; break; } @@ -555,7 +555,7 @@ if ((((BIO_SSL *)t->ptr)->ssl == NULL) || (((BIO_SSL *)f->ptr)->ssl == NULL)) return (0); - if(!SSL_copy_session_id(((BIO_SSL *)t->ptr)->ssl, ((BIO_SSL *)f->ptr)->ssl)) + if (!SSL_copy_session_id(((BIO_SSL *)t->ptr)->ssl, ((BIO_SSL *)f->ptr)->ssl)) return 0; return (1); }
diff --git a/ssl/d1_both.c b/ssl/d1_both.c index 094b337..c3552e9 100644 --- a/ssl/d1_both.c +++ b/ssl/d1_both.c
@@ -989,7 +989,7 @@ s->d1->handshake_write_seq, 0, 0); /* buffer the message to handle re-xmits */ - if(!dtls1_buffer_message(s, 1)) { + if (!dtls1_buffer_message(s, 1)) { SSLerr(SSL_F_DTLS1_SEND_CHANGE_CIPHER_SPEC, ERR_R_INTERNAL_ERROR); return -1; }
diff --git a/ssl/d1_clnt.c b/ssl/d1_clnt.c index c5831cd..0f4373e 100644 --- a/ssl/d1_clnt.c +++ b/ssl/d1_clnt.c
@@ -182,7 +182,7 @@ s->in_handshake++; if (!SSL_in_init(s) || SSL_in_before(s)) { - if(!SSL_clear(s)) + if (!SSL_clear(s)) return -1; }
diff --git a/ssl/d1_lib.c b/ssl/d1_lib.c index eac271d..a1d2032 100644 --- a/ssl/d1_lib.c +++ b/ssl/d1_lib.c
@@ -124,7 +124,7 @@ { DTLS1_STATE *d1; - if(!DTLS_RECORD_LAYER_new(&s->rlayer)) { + if (!DTLS_RECORD_LAYER_new(&s->rlayer)) { return 0; } @@ -502,7 +502,7 @@ int ret; /* Ensure there is no state left over from a previous invocation */ - if(!SSL_clear(s)) + if (!SSL_clear(s)) return -1; SSL_set_options(s, SSL_OP_COOKIE_EXCHANGE); @@ -524,7 +524,7 @@ s->init_off = 0; /* Buffer the message to handle re-xmits */ - if(!dtls1_buffer_message(s, 0)) + if (!dtls1_buffer_message(s, 0)) return 0; return 1;
diff --git a/ssl/d1_srvr.c b/ssl/d1_srvr.c index 5ddfeac..663f118 100644 --- a/ssl/d1_srvr.c +++ b/ssl/d1_srvr.c
@@ -185,7 +185,7 @@ /* init things to blank */ s->in_handshake++; if (!SSL_in_init(s) || SSL_in_before(s)) { - if(!SSL_clear(s)) + if (!SSL_clear(s)) return -1; }
diff --git a/ssl/record/rec_layer_d1.c b/ssl/record/rec_layer_d1.c index c58af7f..3183bcf 100644 --- a/ssl/record/rec_layer_d1.c +++ b/ssl/record/rec_layer_d1.c
@@ -638,7 +638,7 @@ #ifndef OPENSSL_NO_HEARTBEATS else if (SSL3_RECORD_get_type(rr) == TLS1_RT_HEARTBEAT) { /* We allow a 0 return */ - if(dtls1_process_heartbeat(s, SSL3_RECORD_get_data(rr), + if (dtls1_process_heartbeat(s, SSL3_RECORD_get_data(rr), SSL3_RECORD_get_length(rr)) < 0) { return -1; }
diff --git a/ssl/record/rec_layer_s3.c b/ssl/record/rec_layer_s3.c index 0ec1d2c..b7d43f3 100644 --- a/ssl/record/rec_layer_s3.c +++ b/ssl/record/rec_layer_s3.c
@@ -170,7 +170,7 @@ rl->s = s; rl->d = d; - if(d) + if (d) DTLS_RECORD_LAYER_clear(rl); } @@ -196,7 +196,7 @@ int RECORD_LAYER_set_data(RECORD_LAYER *rl, const unsigned char *buf, int len) { rl->packet_length = len; - if(len != 0) { + if (len != 0) { rl->rstate = SSL_ST_READ_HEADER; if (!SSL3_BUFFER_is_initialised(&rl->rbuf)) if (!ssl3_setup_read_buffer(rl->s)) @@ -531,7 +531,7 @@ packlen *= 4; wb->buf = OPENSSL_malloc(packlen); - if(!wb->buf) { + if (!wb->buf) { SSLerr(SSL_F_SSL3_WRITE_BYTES, ERR_R_MALLOC_FAILURE); return -1; } @@ -1130,7 +1130,7 @@ #ifndef OPENSSL_NO_HEARTBEATS else if (SSL3_RECORD_get_type(rr)== TLS1_RT_HEARTBEAT) { /* We can ignore 0 return values */ - if(tls1_process_heartbeat(s, SSL3_RECORD_get_data(rr), + if (tls1_process_heartbeat(s, SSL3_RECORD_get_data(rr), SSL3_RECORD_get_length(rr)) < 0) { return -1; }
diff --git a/ssl/record/ssl3_buffer.c b/ssl/record/ssl3_buffer.c index 79a7636..732420e 100644 --- a/ssl/record/ssl3_buffer.c +++ b/ssl/record/ssl3_buffer.c
@@ -114,7 +114,7 @@ void SSL3_BUFFER_set_data(SSL3_BUFFER *b, const unsigned char *d, int n) { - if(d != NULL) + if (d != NULL) memcpy(b->buf, d, n); b->left = n; b->offset = 0;
diff --git a/ssl/s23_clnt.c b/ssl/s23_clnt.c index 76ad876..4196eac 100644 --- a/ssl/s23_clnt.c +++ b/ssl/s23_clnt.c
@@ -158,7 +158,7 @@ s->in_handshake++; if (!SSL_in_init(s) || SSL_in_before(s)) { - if(!SSL_clear(s)) + if (!SSL_clear(s)) return -1; } @@ -573,7 +573,7 @@ /* * put the 7 bytes we have read into the input buffer for SSLv3 */ - if(!RECORD_LAYER_set_data(&s->rlayer, buf, n)) + if (!RECORD_LAYER_set_data(&s->rlayer, buf, n)) goto err; s->handshake_func = s->method->ssl_connect;
diff --git a/ssl/s23_srvr.c b/ssl/s23_srvr.c index 7287022..50d634e 100644 --- a/ssl/s23_srvr.c +++ b/ssl/s23_srvr.c
@@ -157,7 +157,7 @@ s->in_handshake++; if (!SSL_in_init(s) || SSL_in_before(s)) { - if(!SSL_clear(s)) + if (!SSL_clear(s)) return -1; } @@ -561,10 +561,10 @@ /* * put the 'n' bytes we have read into the input buffer for SSLv3 */ - if(!RECORD_LAYER_set_data(&s->rlayer, buf, n)) + if (!RECORD_LAYER_set_data(&s->rlayer, buf, n)) goto err; } else { - if(!RECORD_LAYER_set_data(&s->rlayer, NULL, 0)) + if (!RECORD_LAYER_set_data(&s->rlayer, NULL, 0)) goto err; } s->handshake_func = s->method->ssl_accept;
diff --git a/ssl/s3_both.c b/ssl/s3_both.c index ed6ae12..d0cb763 100644 --- a/ssl/s3_both.c +++ b/ssl/s3_both.c
@@ -187,7 +187,7 @@ s->s3->previous_server_finished_len = i; } - if(!ssl_set_handshake_header(s, SSL3_MT_FINISHED, l)) { + if (!ssl_set_handshake_header(s, SSL3_MT_FINISHED, l)) { SSLerr(SSL_F_SSL3_SEND_FINISHED, ERR_R_INTERNAL_ERROR); return -1; } @@ -328,7 +328,7 @@ l2n3(l, p); l += 3; - if(!ssl_set_handshake_header(s, SSL3_MT_CERTIFICATE, l)) { + if (!ssl_set_handshake_header(s, SSL3_MT_CERTIFICATE, l)) { SSLerr(SSL_F_SSL3_OUTPUT_CERT_CHAIN, ERR_R_INTERNAL_ERROR); return 0; }
diff --git a/ssl/s3_clnt.c b/ssl/s3_clnt.c index 404f7f9..697a3b4 100644 --- a/ssl/s3_clnt.c +++ b/ssl/s3_clnt.c
@@ -198,7 +198,7 @@ s->in_handshake++; if (!SSL_in_init(s) || SSL_in_before(s)) { - if(!SSL_clear(s)) + if (!SSL_clear(s)) return -1; } @@ -843,7 +843,7 @@ #endif l = p - d; - if(!ssl_set_handshake_header(s, SSL3_MT_CLIENT_HELLO, l)) { + if (!ssl_set_handshake_header(s, SSL3_MT_CLIENT_HELLO, l)) { ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_HANDSHAKE_FAILURE); SSLerr(SSL_F_SSL3_CLIENT_HELLO, ERR_R_INTERNAL_ERROR); goto err; @@ -2991,7 +2991,7 @@ goto err; } - if(!ssl_set_handshake_header(s, SSL3_MT_CLIENT_KEY_EXCHANGE, n)) { + if (!ssl_set_handshake_header(s, SSL3_MT_CLIENT_KEY_EXCHANGE, n)) { ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_HANDSHAKE_FAILURE); SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR); goto err; @@ -3044,7 +3044,7 @@ OPENSSL_cleanse(pms, pmslen); OPENSSL_free(pms); s->cert->pms = NULL; - if(s->session->master_key_length < 0) { + if (s->session->master_key_length < 0) { ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_INTERNAL_ERROR); SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR); goto err; @@ -3194,7 +3194,7 @@ SSLerr(SSL_F_SSL3_SEND_CLIENT_VERIFY, ERR_R_INTERNAL_ERROR); goto err; } - if(!ssl_set_handshake_header(s, SSL3_MT_CERTIFICATE_VERIFY, n)) { + if (!ssl_set_handshake_header(s, SSL3_MT_CERTIFICATE_VERIFY, n)) { SSLerr(SSL_F_SSL3_SEND_CLIENT_VERIFY, ERR_R_INTERNAL_ERROR); goto err; }
diff --git a/ssl/s3_enc.c b/ssl/s3_enc.c index 1db2f77..8fc5bc4 100644 --- a/ssl/s3_enc.c +++ b/ssl/s3_enc.c
@@ -253,7 +253,7 @@ EVP_CIPHER_CTX_init(s->enc_read_ctx); dd = s->enc_read_ctx; - if(!ssl_replace_hash(&s->read_hash, m)) { + if (!ssl_replace_hash(&s->read_hash, m)) { SSLerr(SSL_F_SSL3_CHANGE_CIPHER_STATE, ERR_R_INTERNAL_ERROR); goto err2; } @@ -270,7 +270,7 @@ SSL_R_COMPRESSION_LIBRARY_ERROR); goto err2; } - if(!RECORD_LAYER_setup_comp_buffer(&s->rlayer)) + if (!RECORD_LAYER_setup_comp_buffer(&s->rlayer)) goto err; } #endif @@ -288,7 +288,7 @@ */ EVP_CIPHER_CTX_init(s->enc_write_ctx); dd = s->enc_write_ctx; - if(!ssl_replace_hash(&s->write_hash, m)) { + if (!ssl_replace_hash(&s->write_hash, m)) { SSLerr(SSL_F_SSL3_CHANGE_CIPHER_STATE, ERR_R_INTERNAL_ERROR); goto err2; }
diff --git a/ssl/s3_lib.c b/ssl/s3_lib.c index a7dbbf6..7bb3a92 100644 --- a/ssl/s3_lib.c +++ b/ssl/s3_lib.c
@@ -3104,7 +3104,7 @@ s->s3 = s3; #ifndef OPENSSL_NO_SRP - if(!SSL_SRP_CTX_init(s)) + if (!SSL_SRP_CTX_init(s)) goto err; #endif s->method->ssl_clear(s);
diff --git a/ssl/s3_srvr.c b/ssl/s3_srvr.c index 7376fe6..223a764 100644 --- a/ssl/s3_srvr.c +++ b/ssl/s3_srvr.c
@@ -227,7 +227,7 @@ /* init things to blank */ s->in_handshake++; if (!SSL_in_init(s) || SSL_in_before(s)) { - if(!SSL_clear(s)) + if (!SSL_clear(s)) return -1; } @@ -882,7 +882,7 @@ { if (s->state == SSL3_ST_SW_HELLO_REQ_A) { - if(!ssl_set_handshake_header(s, SSL3_MT_HELLO_REQUEST, 0)) { + if (!ssl_set_handshake_header(s, SSL3_MT_HELLO_REQUEST, 0)) { SSLerr(SSL_F_SSL3_SEND_HELLO_REQUEST, ERR_R_INTERNAL_ERROR); return -1; } @@ -1541,7 +1541,7 @@ #endif /* do the header */ l = (p - d); - if(!ssl_set_handshake_header(s, SSL3_MT_SERVER_HELLO, l)) { + if (!ssl_set_handshake_header(s, SSL3_MT_SERVER_HELLO, l)) { SSLerr(SSL_F_SSL3_SEND_SERVER_HELLO, ERR_R_INTERNAL_ERROR); return -1; } @@ -1556,7 +1556,7 @@ { if (s->state == SSL3_ST_SW_SRVR_DONE_A) { - if(!ssl_set_handshake_header(s, SSL3_MT_SERVER_DONE, 0)) { + if (!ssl_set_handshake_header(s, SSL3_MT_SERVER_DONE, 0)) { SSLerr(SSL_F_SSL3_SEND_SERVER_DONE, ERR_R_INTERNAL_ERROR); return -1; } @@ -2006,7 +2006,7 @@ } } - if(!ssl_set_handshake_header(s, SSL3_MT_SERVER_KEY_EXCHANGE, n)) { + if (!ssl_set_handshake_header(s, SSL3_MT_SERVER_KEY_EXCHANGE, n)) { al = SSL_AD_HANDSHAKE_FAILURE; SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR); goto f_err; @@ -2088,7 +2088,7 @@ p = ssl_handshake_start(s) + off; s2n(nl, p); - if(!ssl_set_handshake_header(s, SSL3_MT_CERTIFICATE_REQUEST, n)) { + if (!ssl_set_handshake_header(s, SSL3_MT_CERTIFICATE_REQUEST, n)) { SSLerr(SSL_F_SSL3_SEND_CERTIFICATE_REQUEST, ERR_R_INTERNAL_ERROR); return -1; } @@ -2278,7 +2278,7 @@ sizeof (rand_premaster_secret)); OPENSSL_cleanse(p, sizeof(rand_premaster_secret)); - if(s->session->master_key_length < 0) { + if (s->session->master_key_length < 0) { al = SSL_AD_INTERNAL_ERROR; SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR); goto f_err; @@ -2375,7 +2375,7 @@ session->master_key, p, i); OPENSSL_cleanse(p, i); - if(s->session->master_key_length < 0) { + if (s->session->master_key_length < 0) { al = SSL_AD_INTERNAL_ERROR; SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR); goto f_err; @@ -2545,7 +2545,7 @@ s-> session->master_key, pms, outl); - if(s->session->master_key_length < 0) { + if (s->session->master_key_length < 0) { al = SSL_INTERNAL_ERROR; SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR); goto f_err; @@ -2698,7 +2698,7 @@ p, i); OPENSSL_cleanse(p, i); - if(s->session->master_key_length < 0) { + if (s->session->master_key_length < 0) { al = SSL_AD_INTERNAL_ERROR; SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR); goto f_err; @@ -2787,7 +2787,7 @@ session->master_key, psk_or_pre_ms, pre_ms_len); - if(s->session->master_key_length < 0) { + if (s->session->master_key_length < 0) { al = SSL_AD_INTERNAL_ERROR; SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR); goto psk_err; @@ -2893,7 +2893,7 @@ s-> session->master_key, premaster_secret, 32); - if(s->session->master_key_length < 0) { + if (s->session->master_key_length < 0) { al = SSL_AD_INTERNAL_ERROR; SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR); goto f_err; @@ -3469,7 +3469,7 @@ /* Skip ticket lifetime hint */ p = ssl_handshake_start(s) + 4; s2n(len - 6, p); - if(!ssl_set_handshake_header(s, SSL3_MT_NEWSESSION_TICKET, len)) + if (!ssl_set_handshake_header(s, SSL3_MT_NEWSESSION_TICKET, len)) goto err; s->state = SSL3_ST_SW_SESSION_TICKET_B; OPENSSL_free(senc);
diff --git a/ssl/ssl_ciph.c b/ssl/ssl_ciph.c index 0f6758b..cd86fcc 100644 --- a/ssl/ssl_ciph.c +++ b/ssl/ssl_ciph.c
@@ -533,7 +533,7 @@ *comp = NULL; } /* If were only interested in comp then return success */ - if((enc == NULL) && (md == NULL)) + if ((enc == NULL) && (md == NULL)) return 1; }
diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c index 42ee3a9..35a3c9d 100644 --- a/ssl/ssl_lib.c +++ b/ssl/ssl_lib.c
@@ -381,7 +381,7 @@ s->references = 1; s->server = (ctx->method->ssl_accept == ssl_undefined_function) ? 0 : 1; - if(!SSL_clear(s)) + if (!SSL_clear(s)) goto err; CRYPTO_new_ex_data(CRYPTO_EX_INDEX_SSL, s, &s->ex_data); @@ -884,7 +884,7 @@ int SSL_copy_session_id(SSL *t, const SSL *f) { /* Do we need to to SSL locking? */ - if(!SSL_set_session(t, SSL_get_session(f))) { + if (!SSL_set_session(t, SSL_get_session(f))) { return 0; } @@ -900,7 +900,7 @@ CRYPTO_add(&f->cert->references, 1, CRYPTO_LOCK_SSL_CERT); ssl_cert_free(t->cert); t->cert = f->cert; - if(!SSL_set_session_id_context(t, f->sid_ctx, f->sid_ctx_length)) { + if (!SSL_set_session_id_context(t, f->sid_ctx, f->sid_ctx_length)) { return 0; } @@ -1920,7 +1920,7 @@ if (ret->cert_store == NULL) goto err; - if(!ssl_create_cipher_list(ret->method, + if (!ssl_create_cipher_list(ret->method, &ret->cipher_list, &ret->cipher_list_by_id, SSL_DEFAULT_CIPHER_LIST, ret->cert) || sk_SSL_CIPHER_num(ret->cipher_list) <= 0) { @@ -1976,7 +1976,7 @@ ret->psk_server_callback = NULL; #endif #ifndef OPENSSL_NO_SRP - if(!SSL_CTX_SRP_CTX_init(ret)) + if (!SSL_CTX_SRP_CTX_init(ret)) goto err; #endif #ifndef OPENSSL_NO_ENGINE @@ -2756,7 +2756,7 @@ if (s->session != NULL) { /* This copies session-id, SSL_METHOD, sid_ctx, and 'cert' */ - if(!SSL_copy_session_id(ret, s)) + if (!SSL_copy_session_id(ret, s)) goto err; } else { /* @@ -2777,7 +2777,7 @@ goto err; } - if(!SSL_set_session_id_context(ret, s->sid_ctx, s->sid_ctx_length)) + if (!SSL_set_session_id_context(ret, s->sid_ctx, s->sid_ctx_length)) goto err; }
diff --git a/ssl/ssl_rsa.c b/ssl/ssl_rsa.c index 90fe8c8..b5d457a 100644 --- a/ssl/ssl_rsa.c +++ b/ssl/ssl_rsa.c
@@ -687,7 +687,7 @@ int r; unsigned long err; - if(!SSL_CTX_clear_chain_certs(ctx)) { + if (!SSL_CTX_clear_chain_certs(ctx)) { ret = 0; goto end; }
diff --git a/ssl/ssl_sess.c b/ssl/ssl_sess.c index 3d0f950..483c778 100644 --- a/ssl/ssl_sess.c +++ b/ssl/ssl_sess.c
@@ -518,7 +518,7 @@ * The following should not return 1, otherwise, things are * very strange */ - if(SSL_CTX_add_session(s->session_ctx, ret)) + if (SSL_CTX_add_session(s->session_ctx, ret)) goto err; } } @@ -861,7 +861,7 @@ size_t *len) { *len = s->tlsext_ticklen; - if(tick != NULL) + if (tick != NULL) *tick = s->tlsext_tick; }
diff --git a/ssl/ssl_txt.c b/ssl/ssl_txt.c index ccdf8ec..9277d2c 100644 --- a/ssl/ssl_txt.c +++ b/ssl/ssl_txt.c
@@ -214,7 +214,7 @@ if (x->compress_meth != 0) { SSL_COMP *comp = NULL; - if(!ssl_cipher_get_evp(x, NULL, NULL, NULL, NULL, &comp, 0)) + if (!ssl_cipher_get_evp(x, NULL, NULL, NULL, NULL, &comp, 0)) goto err; if (comp == NULL) { if (BIO_printf(bp, "\n Compression: %d", x->compress_meth) <=
diff --git a/ssl/t1_enc.c b/ssl/t1_enc.c index 19b79e9..6e926d4 100644 --- a/ssl/t1_enc.c +++ b/ssl/t1_enc.c
@@ -260,7 +260,7 @@ if ((m << TLS1_PRF_DGST_SHIFT) & digest_mask) count++; } - if(!count) { + if (!count) { /* Should never happen */ SSLerr(SSL_F_TLS1_PRF, ERR_R_INTERNAL_ERROR); goto err; @@ -801,7 +801,7 @@ * exchange and before certificate verify) */ s->s3->flags |= TLS1_FLAGS_KEEP_HANDSHAKE; - if(!ssl3_digest_cached_records(s)) + if (!ssl3_digest_cached_records(s)) return -1; } hashlen = ssl_handshake_hash(s, hash, sizeof(hash));
diff --git a/ssl/t1_lib.c b/ssl/t1_lib.c index aef0ef6..985c357 100644 --- a/ssl/t1_lib.c +++ b/ssl/t1_lib.c
@@ -1606,7 +1606,7 @@ int el; /* Returns 0 on success!! */ - if(ssl_add_serverhello_use_srtp_ext(s, 0, &el, 0)) { + if (ssl_add_serverhello_use_srtp_ext(s, 0, &el, 0)) { SSLerr(SSL_F_SSL_ADD_SERVERHELLO_TLSEXT, ERR_R_INTERNAL_ERROR); return NULL; }