diff options
author | David Benjamin <davidben@google.com> | 2016-06-02 03:16:03 +0300 |
---|---|---|
committer | David Benjamin <davidben@google.com> | 2016-06-08 21:13:53 +0300 |
commit | 4e9cc71a27234d8506c5b5987122188e34ece951 (patch) | |
tree | d0a31f92e64751e24433646b0c62d332a0270a11 /ssl/d1_both.c | |
parent | 15aa895a0b6bb6d8f409cff8f1d6f47a069cd4b9 (diff) |
Add helper functions for info_callback and msg_callback.
This is getting a little repetitive.
Change-Id: Ib0fa8ab10149557c2d728b88648381b9368221d9
Reviewed-on: https://boringssl-review.googlesource.com/8126
Reviewed-by: Steven Valdez <svaldez@google.com>
Reviewed-by: Adam Langley <agl@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
Diffstat (limited to 'ssl/d1_both.c')
-rw-r--r-- | ssl/d1_both.c | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/ssl/d1_both.c b/ssl/d1_both.c index e101a4fb..11c9b655 100644 --- a/ssl/d1_both.c +++ b/ssl/d1_both.c @@ -305,12 +305,9 @@ static int dtls1_write_change_cipher_spec(SSL *ssl, return ret; } - if (ssl->msg_callback != NULL) { - ssl->msg_callback(1 /* write */, ssl->version, SSL3_RT_CHANGE_CIPHER_SPEC, - kChangeCipherSpec, sizeof(kChangeCipherSpec), ssl, - ssl->msg_callback_arg); - } - + ssl_do_msg_callback(ssl, 1 /* write */, ssl->version, + SSL3_RT_CHANGE_CIPHER_SPEC, kChangeCipherSpec, + sizeof(kChangeCipherSpec)); return 1; } @@ -388,11 +385,9 @@ int dtls1_do_handshake_write(SSL *ssl, enum dtls1_use_epoch_t use_epoch) { ssl->init_num -= todo; } while (ssl->init_num > 0); - if (ssl->msg_callback != NULL) { - ssl->msg_callback( - 1 /* write */, ssl->version, SSL3_RT_HANDSHAKE, ssl->init_buf->data, - (size_t)(ssl->init_off + ssl->init_num), ssl, ssl->msg_callback_arg); - } + ssl_do_msg_callback(ssl, 1 /* write */, ssl->version, SSL3_RT_HANDSHAKE, + ssl->init_buf->data, + (size_t)(ssl->init_off + ssl->init_num)); ssl->init_off = 0; ssl->init_num = 0; @@ -637,11 +632,10 @@ long dtls1_get_message(SSL *ssl, int msg_type, if (hash_message == ssl_hash_message && !ssl3_hash_current_message(ssl)) { goto err; } - if (ssl->msg_callback) { - ssl->msg_callback(0, ssl->version, SSL3_RT_HANDSHAKE, ssl->init_buf->data, - ssl->init_num + DTLS1_HM_HEADER_LENGTH, ssl, - ssl->msg_callback_arg); - } + + ssl_do_msg_callback(ssl, 0 /* read */, ssl->version, SSL3_RT_HANDSHAKE, + ssl->init_buf->data, + ssl->init_num + DTLS1_HM_HEADER_LENGTH); pitem_free(item); dtls1_hm_fragment_free(frag); |