Переглянути джерело

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>
kris/onging/CECPQ3_patch15
David Benjamin 9 роки тому
committed by Adam Langley
джерело
коміт
c933a47e6f
8 змінених файлів з 17 додано та 13 видалено
  1. +1
    -1
      crypto/err/ssl.errordata
  2. +1
    -1
      include/openssl/ssl.h
  3. +1
    -1
      ssl/d1_meth.c
  4. +5
    -6
      ssl/d1_pkt.c
  5. +3
    -2
      ssl/internal.h
  6. +1
    -1
      ssl/s3_lib.c
  7. +1
    -1
      ssl/s3_meth.c
  8. +4
    -0
      ssl/s3_pkt.c

+ 1
- 1
crypto/err/ssl.errordata Переглянути файл

@@ -77,7 +77,7 @@ SSL,function,162,dtls1_process_record
SSL,function,163,dtls1_read_bytes
SSL,function,279,dtls1_seal_record
SSL,function,164,dtls1_send_hello_verify_request
SSL,function,165,dtls1_write_app_data_bytes
SSL,function,165,dtls1_write_app_data
SSL,function,166,i2d_SSL_SESSION
SSL,function,167,ssl3_accept
SSL,function,169,ssl3_cert_verify_hash


+ 1
- 1
include/openssl/ssl.h Переглянути файл

@@ -2613,7 +2613,7 @@ OPENSSL_EXPORT const char *SSLeay_version(int unused);
#define SSL_F_dtls1_process_record 162
#define SSL_F_dtls1_read_bytes 163
#define SSL_F_dtls1_send_hello_verify_request 164
#define SSL_F_dtls1_write_app_data_bytes 165
#define SSL_F_dtls1_write_app_data 165
#define SSL_F_i2d_SSL_SESSION 166
#define SSL_F_ssl3_accept 167
#define SSL_F_ssl3_cert_verify_hash 169


+ 1
- 1
ssl/d1_meth.c Переглянути файл

@@ -70,7 +70,7 @@ static const SSL_PROTOCOL_METHOD DTLS_protocol_method = {
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,


+ 5
- 6
ssl/d1_pkt.c Переглянути файл

@@ -669,7 +669,7 @@ err:
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 @@ int dtls1_write_app_data_bytes(SSL *s, int type, const void *buf_, int len) {
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;
}



+ 3
- 2
ssl/internal.h Переглянути файл

@@ -645,7 +645,7 @@ struct ssl_protocol_method_st {
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 @@ const SSL_CIPHER *ssl3_get_cipher(size_t i);
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 @@ void dtls1_set_message_header(SSL *s, uint8_t mt, unsigned long len,
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);



+ 1
- 1
ssl/s3_lib.c Переглянути файл

@@ -1163,7 +1163,7 @@ int ssl3_shutdown(SSL *s) {
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) {


+ 1
- 1
ssl/s3_meth.c Переглянути файл

@@ -69,7 +69,7 @@ static const SSL_PROTOCOL_METHOD TLS_protocol_method = {
ssl3_shutdown,
ssl3_get_message,
ssl3_read_bytes,
ssl3_write_bytes,
ssl3_write_app_data,
ssl3_dispatch_alert,
ssl3_ctrl,
ssl3_ctx_ctrl,


+ 4
- 0
ssl/s3_pkt.c Переглянути файл

@@ -398,6 +398,10 @@ err:
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) {


Завантаження…
Відмінити
Зберегти