Remove a/b parameters to send_change_cipher_spec.
They're not necessary.
Change-Id: Ifeb3fae73a8b22f88019e6ef9f9ba5e64ed3cfab
Reviewed-on: https://boringssl-review.googlesource.com/8543
Reviewed-by: David Benjamin <davidben@google.com>
diff --git a/include/openssl/ssl3.h b/include/openssl/ssl3.h
index 1da5de7..848d74a 100644
--- a/include/openssl/ssl3.h
+++ b/include/openssl/ssl3.h
@@ -328,8 +328,7 @@
#define SSL3_ST_CW_CERT_VRFY_A (0x190 | SSL_ST_CONNECT)
#define SSL3_ST_CW_CERT_VRFY_B (0x191 | SSL_ST_CONNECT)
#define SSL3_ST_CW_CERT_VRFY_C (0x192 | SSL_ST_CONNECT)
-#define SSL3_ST_CW_CHANGE_A (0x1A0 | SSL_ST_CONNECT)
-#define SSL3_ST_CW_CHANGE_B (0x1A1 | SSL_ST_CONNECT)
+#define SSL3_ST_CW_CHANGE (0x1A0 | SSL_ST_CONNECT)
#define SSL3_ST_CW_NEXT_PROTO_A (0x200 | SSL_ST_CONNECT)
#define SSL3_ST_CW_NEXT_PROTO_B (0x201 | SSL_ST_CONNECT)
#define SSL3_ST_CW_CHANNEL_ID_A (0x220 | SSL_ST_CONNECT)
@@ -381,8 +380,7 @@
#define SSL3_ST_SR_FINISHED_A (0x1C0 | SSL_ST_ACCEPT)
/* write to client */
-#define SSL3_ST_SW_CHANGE_A (0x1D0 | SSL_ST_ACCEPT)
-#define SSL3_ST_SW_CHANGE_B (0x1D1 | SSL_ST_ACCEPT)
+#define SSL3_ST_SW_CHANGE (0x1D0 | SSL_ST_ACCEPT)
#define SSL3_ST_SW_FINISHED_A (0x1E0 | SSL_ST_ACCEPT)
#define SSL3_ST_SW_FINISHED_B (0x1E1 | SSL_ST_ACCEPT)
#define SSL3_ST_SW_SESSION_TICKET_A (0x1F0 | SSL_ST_ACCEPT)
diff --git a/ssl/d1_both.c b/ssl/d1_both.c
index 2ad8fdd..6aa4cc6 100644
--- a/ssl/d1_both.c
+++ b/ssl/d1_both.c
@@ -828,13 +828,13 @@
return ret;
}
-int dtls1_send_change_cipher_spec(SSL *ssl, int a, int b) {
- if (ssl->state == a) {
- dtls1_add_change_cipher_spec(ssl);
- ssl->state = b;
+int dtls1_send_change_cipher_spec(SSL *ssl) {
+ int ret = dtls1_write_change_cipher_spec(ssl, dtls1_use_current_epoch);
+ if (ret <= 0) {
+ return ret;
}
-
- return dtls1_write_change_cipher_spec(ssl, dtls1_use_current_epoch);
+ dtls1_add_change_cipher_spec(ssl);
+ return 1;
}
unsigned int dtls1_min_mtu(void) {
diff --git a/ssl/handshake_client.c b/ssl/handshake_client.c
index 09f4d4f..229cf1a 100644
--- a/ssl/handshake_client.c
+++ b/ssl/handshake_client.c
@@ -364,13 +364,11 @@
} else {
skip = 1;
}
- ssl->state = SSL3_ST_CW_CHANGE_A;
+ ssl->state = SSL3_ST_CW_CHANGE;
break;
- case SSL3_ST_CW_CHANGE_A:
- case SSL3_ST_CW_CHANGE_B:
- ret = ssl->method->send_change_cipher_spec(ssl, SSL3_ST_CW_CHANGE_A,
- SSL3_ST_CW_CHANGE_B);
+ case SSL3_ST_CW_CHANGE:
+ ret = ssl->method->send_change_cipher_spec(ssl);
if (ret <= 0) {
goto end;
}
@@ -483,7 +481,7 @@
ssl->method->received_flight(ssl);
if (ssl->hit) {
- ssl->state = SSL3_ST_CW_CHANGE_A;
+ ssl->state = SSL3_ST_CW_CHANGE;
} else {
ssl->state = SSL_ST_OK;
}
diff --git a/ssl/handshake_server.c b/ssl/handshake_server.c
index 0356735..da13135 100644
--- a/ssl/handshake_server.c
+++ b/ssl/handshake_server.c
@@ -447,13 +447,11 @@
} else {
skip = 1;
}
- ssl->state = SSL3_ST_SW_CHANGE_A;
+ ssl->state = SSL3_ST_SW_CHANGE;
break;
- case SSL3_ST_SW_CHANGE_A:
- case SSL3_ST_SW_CHANGE_B:
- ret = ssl->method->send_change_cipher_spec(ssl, SSL3_ST_SW_CHANGE_A,
- SSL3_ST_SW_CHANGE_B);
+ case SSL3_ST_SW_CHANGE:
+ ret = ssl->method->send_change_cipher_spec(ssl);
if (ret <= 0) {
goto end;
}
diff --git a/ssl/internal.h b/ssl/internal.h
index fb8dd9d..1c87136 100644
--- a/ssl/internal.h
+++ b/ssl/internal.h
@@ -832,7 +832,7 @@
* success and <= 0 on error. */
int (*write_message)(SSL *ssl);
/* send_change_cipher_spec sends a ChangeCipherSpec message. */
- int (*send_change_cipher_spec)(SSL *ssl, int a, int b);
+ int (*send_change_cipher_spec)(SSL *ssl);
/* expect_flight is called when the handshake expects a flight of messages from
* the peer. */
void (*expect_flight)(SSL *ssl);
@@ -985,7 +985,7 @@
int ssl_fill_hello_random(uint8_t *out, size_t len, int is_server);
int ssl3_get_finished(SSL *ssl);
-int ssl3_send_change_cipher_spec(SSL *ssl, int state_a, int state_b);
+int ssl3_send_change_cipher_spec(SSL *ssl);
void ssl3_cleanup_key_block(SSL *ssl);
int ssl3_send_alert(SSL *ssl, int level, int desc);
long ssl3_get_message(SSL *ssl, int msg_type,
@@ -1050,7 +1050,7 @@
int dtls1_write_record(SSL *ssl, int type, const uint8_t *buf, size_t len,
enum dtls1_use_epoch_t use_epoch);
-int dtls1_send_change_cipher_spec(SSL *ssl, int a, int b);
+int dtls1_send_change_cipher_spec(SSL *ssl);
int dtls1_send_finished(SSL *ssl, int a, int b, const char *sender, int slen);
int dtls1_retransmit_outgoing_messages(SSL *ssl);
void dtls1_clear_record_buffer(SSL *ssl);
diff --git a/ssl/s3_both.c b/ssl/s3_both.c
index 1bdc2a2..1f6f2d3 100644
--- a/ssl/s3_both.c
+++ b/ssl/s3_both.c
@@ -319,10 +319,9 @@
return 0;
}
-int ssl3_send_change_cipher_spec(SSL *ssl, int a, int b) {
+int ssl3_send_change_cipher_spec(SSL *ssl) {
static const uint8_t kChangeCipherSpec[1] = {SSL3_MT_CCS};
- ssl->state = b;
return ssl3_do_write(ssl, SSL3_RT_CHANGE_CIPHER_SPEC, kChangeCipherSpec,
sizeof(kChangeCipherSpec));
}
diff --git a/ssl/ssl_stat.c b/ssl/ssl_stat.c
index 15d1270..0881b83 100644
--- a/ssl/ssl_stat.c
+++ b/ssl/ssl_stat.c
@@ -149,13 +149,9 @@
case SSL3_ST_CW_CERT_VRFY_B:
return "SSLv3 write certificate verify B";
- case SSL3_ST_CW_CHANGE_A:
- case SSL3_ST_SW_CHANGE_A:
- return "SSLv3 write change cipher spec A";
-
- case SSL3_ST_CW_CHANGE_B:
- case SSL3_ST_SW_CHANGE_B:
- return "SSLv3 write change cipher spec B";
+ case SSL3_ST_CW_CHANGE:
+ case SSL3_ST_SW_CHANGE:
+ return "SSLv3 write change cipher spec";
case SSL3_ST_CW_FINISHED_A:
case SSL3_ST_SW_FINISHED_A:
@@ -313,13 +309,9 @@
case SSL3_ST_CW_CERT_VRFY_B:
return "3WCV_B";
- case SSL3_ST_SW_CHANGE_A:
- case SSL3_ST_CW_CHANGE_A:
- return "3WCCSA";
-
- case SSL3_ST_SW_CHANGE_B:
- case SSL3_ST_CW_CHANGE_B:
- return "3WCCSB";
+ case SSL3_ST_SW_CHANGE:
+ case SSL3_ST_CW_CHANGE:
+ return "3WCCS_";
case SSL3_ST_SW_FINISHED_A:
case SSL3_ST_CW_FINISHED_A: