Switch the ssl_write_bytes hook to ssl_write_app_data.
The SSL_PROTOCOL_METHOD table needs work, but this makes it clearer
exactly what the shared interface between the upper later and TLS/DTLS
is.
BUG=468889
Change-Id: I38931c484aa4ab3f77964d708d38bfd349fac293
Reviewed-on: https://boringssl-review.googlesource.com/4955
Reviewed-by: Adam Langley <agl@google.com>
diff --git a/ssl/d1_meth.c b/ssl/d1_meth.c
index 5d75d02..276290d 100644
--- a/ssl/d1_meth.c
+++ b/ssl/d1_meth.c
@@ -70,7 +70,7 @@
dtls1_shutdown,
dtls1_get_message,
dtls1_read_bytes,
- dtls1_write_app_data_bytes,
+ dtls1_write_app_data,
dtls1_dispatch_alert,
ssl3_ctrl,
ssl3_ctx_ctrl,
diff --git a/ssl/d1_pkt.c b/ssl/d1_pkt.c
index da2e414..b0fd0dc 100644
--- a/ssl/d1_pkt.c
+++ b/ssl/d1_pkt.c
@@ -669,7 +669,7 @@
return -1;
}
-int dtls1_write_app_data_bytes(SSL *s, int type, const void *buf_, int len) {
+int dtls1_write_app_data(SSL *s, const void *buf_, int len) {
int i;
if (SSL_in_init(s) && !s->in_handshake) {
@@ -678,19 +678,18 @@
return i;
}
if (i == 0) {
- OPENSSL_PUT_ERROR(SSL, dtls1_write_app_data_bytes,
- SSL_R_SSL_HANDSHAKE_FAILURE);
+ OPENSSL_PUT_ERROR(SSL, dtls1_write_app_data, SSL_R_SSL_HANDSHAKE_FAILURE);
return -1;
}
}
if (len > SSL3_RT_MAX_PLAIN_LENGTH) {
- OPENSSL_PUT_ERROR(SSL, dtls1_write_app_data_bytes,
- SSL_R_DTLS_MESSAGE_TOO_BIG);
+ OPENSSL_PUT_ERROR(SSL, dtls1_write_app_data, SSL_R_DTLS_MESSAGE_TOO_BIG);
return -1;
}
- i = dtls1_write_bytes(s, type, buf_, len, dtls1_use_current_epoch);
+ i = dtls1_write_bytes(s, SSL3_RT_APPLICATION_DATA, buf_, len,
+ dtls1_use_current_epoch);
return i;
}
diff --git a/ssl/internal.h b/ssl/internal.h
index 4ca36f3..2c7c1b1 100644
--- a/ssl/internal.h
+++ b/ssl/internal.h
@@ -645,7 +645,7 @@
int msg_type, long max,
enum ssl_hash_message_t hash_message, int *ok);
int (*ssl_read_bytes)(SSL *s, int type, uint8_t *buf, int len, int peek);
- int (*ssl_write_bytes)(SSL *s, int type, const void *buf_, int len);
+ int (*ssl_write_app_data)(SSL *s, const void *buf_, int len);
int (*ssl_dispatch_alert)(SSL *s);
long (*ssl_ctrl)(SSL *s, int cmd, long larg, void *parg);
long (*ssl_ctx_ctrl)(SSL_CTX *ctx, int cmd, long larg, void *parg);
@@ -898,6 +898,7 @@
int ssl3_dispatch_alert(SSL *s);
int ssl3_expect_change_cipher_spec(SSL *s);
int ssl3_read_bytes(SSL *s, int type, uint8_t *buf, int len, int peek);
+int ssl3_write_app_data(SSL *ssl, const void *buf, int len);
int ssl3_write_bytes(SSL *s, int type, const void *buf, int len);
int ssl3_final_finish_mac(SSL *s, const char *sender, int slen, uint8_t *p);
int ssl3_cert_verify_mac(SSL *s, int md_nid, uint8_t *p);
@@ -952,7 +953,7 @@
unsigned short seq_num, unsigned long frag_off,
unsigned long frag_len);
-int dtls1_write_app_data_bytes(SSL *s, int type, const void *buf, int len);
+int dtls1_write_app_data(SSL *s, const void *buf, int len);
int dtls1_write_bytes(SSL *s, int type, const void *buf, int len,
enum dtls1_use_epoch_t use_epoch);
diff --git a/ssl/s3_lib.c b/ssl/s3_lib.c
index b4c4d2e..092f21b 100644
--- a/ssl/s3_lib.c
+++ b/ssl/s3_lib.c
@@ -1163,7 +1163,7 @@
int ssl3_write(SSL *s, const void *buf, int len) {
ERR_clear_system_error();
- return s->method->ssl_write_bytes(s, SSL3_RT_APPLICATION_DATA, buf, len);
+ return s->method->ssl_write_app_data(s, buf, len);
}
static int ssl3_read_internal(SSL *s, void *buf, int len, int peek) {
diff --git a/ssl/s3_meth.c b/ssl/s3_meth.c
index 9652444..308c942 100644
--- a/ssl/s3_meth.c
+++ b/ssl/s3_meth.c
@@ -69,7 +69,7 @@
ssl3_shutdown,
ssl3_get_message,
ssl3_read_bytes,
- ssl3_write_bytes,
+ ssl3_write_app_data,
ssl3_dispatch_alert,
ssl3_ctrl,
ssl3_ctx_ctrl,
diff --git a/ssl/s3_pkt.c b/ssl/s3_pkt.c
index c08455a..d898cf2 100644
--- a/ssl/s3_pkt.c
+++ b/ssl/s3_pkt.c
@@ -398,6 +398,10 @@
return ret;
}
+int ssl3_write_app_data(SSL *ssl, const void *buf, int len) {
+ return ssl3_write_bytes(ssl, SSL3_RT_APPLICATION_DATA, buf, len);
+}
+
/* Call this to write data in records of type |type|. It will return <= 0 if
* not all data has been sent or non-blocking IO. */
int ssl3_write_bytes(SSL *s, int type, const void *buf_, int len) {