Add SSL_is_dtls.
OpenSSL 1.1.0 added a function to tell if an SSL* is DTLS or not. This
is probably a good idea, especially since SSL_version returns
non-normalized versions.
BUG=91
Change-Id: I25c6cf08b2ebabf0c610c74691de103399f729bc
Reviewed-on: https://boringssl-review.googlesource.com/9077
Reviewed-by: Steven Valdez <svaldez@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
diff --git a/ssl/handshake_client.c b/ssl/handshake_client.c
index d434487..396a66d 100644
--- a/ssl/handshake_client.c
+++ b/ssl/handshake_client.c
@@ -221,7 +221,7 @@
goto end;
}
- if (!SSL_IS_DTLS(ssl) || ssl->d1->send_cookie) {
+ if (!SSL_is_dtls(ssl) || ssl->d1->send_cookie) {
ssl->s3->tmp.next_state = SSL3_ST_CR_SRVR_HELLO_A;
} else {
ssl->s3->tmp.next_state = DTLS1_ST_CR_HELLO_VERIFY_REQUEST_A;
@@ -230,7 +230,7 @@
break;
case DTLS1_ST_CR_HELLO_VERIFY_REQUEST_A:
- assert(SSL_IS_DTLS(ssl));
+ assert(SSL_is_dtls(ssl));
ret = dtls1_get_hello_verify(ssl);
if (ret <= 0) {
goto end;
@@ -655,7 +655,7 @@
return 0;
}
- if (SSL_IS_DTLS(ssl)) {
+ if (SSL_is_dtls(ssl)) {
if (!CBB_add_u8_length_prefixed(body, &child) ||
!CBB_add_bytes(&child, ssl->d1->cookie, ssl->d1->cookie_len)) {
return 0;
@@ -663,7 +663,7 @@
}
size_t header_len =
- SSL_IS_DTLS(ssl) ? DTLS1_HM_HEADER_LENGTH : SSL3_HM_HEADER_LENGTH;
+ SSL_is_dtls(ssl) ? DTLS1_HM_HEADER_LENGTH : SSL3_HM_HEADER_LENGTH;
if (!ssl_write_client_cipher_list(ssl, body, min_version, max_version,
real_max_version) ||
!CBB_add_u8(body, 1 /* one compression method */) ||
@@ -719,7 +719,7 @@
/* If resending the ClientHello in DTLS after a HelloVerifyRequest, don't
* renegerate the client_random. The random must be reused. */
- if ((!SSL_IS_DTLS(ssl) || !ssl->d1->send_cookie) &&
+ if ((!SSL_is_dtls(ssl) || !ssl->d1->send_cookie) &&
!RAND_bytes(ssl->s3->client_random, sizeof(ssl->s3->client_random))) {
goto err;
}