Reformulate the if condition in tls_process_new_session_ticket
authorMatt Caswell <matt@openssl.org>
Thu, 7 Jun 2018 09:00:44 +0000 (10:00 +0100)
committerMatt Caswell <matt@openssl.org>
Thu, 7 Jun 2018 09:58:35 +0000 (10:58 +0100)
Improves readability

Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6415)

ssl/statem/statem_clnt.c

index 754fedb1afa9f403ae19bcfcf762e8b307ff8eb3..ff353842f941aeecd8f0bce8ec6aaa0fdd29a3a6 100644 (file)
@@ -2566,9 +2566,8 @@ MSG_PROCESS_RETURN tls_process_new_session_ticket(SSL *s, PACKET *pkt)
             && (!PACKET_get_net_4(pkt, &age_add)
                 || !PACKET_get_length_prefixed_1(pkt, &nonce)))
         || !PACKET_get_net_2(pkt, &ticklen)
-        || (!SSL_IS_TLS13(s) && PACKET_remaining(pkt) != ticklen)
-        || (SSL_IS_TLS13(s)
-            && (ticklen == 0 || PACKET_remaining(pkt) < ticklen))) {
+        || (SSL_IS_TLS13(s) ? (ticklen == 0 || PACKET_remaining(pkt) < ticklen)
+                            : PACKET_remaining(pkt) != ticklen)) {
         SSLfatal(s, SSL_AD_DECODE_ERROR, SSL_F_TLS_PROCESS_NEW_SESSION_TICKET,
                  SSL_R_LENGTH_MISMATCH);
         goto err;