Sanity check the return from final_finish_mac
authorMatt Caswell <matt@openssl.org>
Tue, 28 Apr 2015 14:19:50 +0000 (15:19 +0100)
committerMatt Caswell <matt@openssl.org>
Thu, 30 Apr 2015 22:21:53 +0000 (23:21 +0100)
The return value is checked for 0. This is currently safe but we should
really check for <= 0 since -1 is frequently used for error conditions.
Thanks to Kevin Wojtysiak (Int3 Solutions) and Paramjot Oberoi (Int3
Solutions) for reporting this issue.

Reviewed-by: Andy Polyakov <appro@openssl.org>
(cherry picked from commit c427570e5098e120cbcb66e799f85c317aac7b91)

Conflicts:
ssl/ssl_locl.h

ssl/s3_both.c
ssl/ssl_locl.h

index c92fd721e2aad608d3eb40d4699356c9d6626f8d..019e21cd02741ccc70c1a81b11cffe9be535fd3a 100644 (file)
@@ -168,7 +168,7 @@ int ssl3_send_finished(SSL *s, int a, int b, const char *sender, int slen)
         i = s->method->ssl3_enc->final_finish_mac(s,
                                                   sender, slen,
                                                   s->s3->tmp.finish_md);
-        if (i == 0)
+        if (i <= 0)
             return 0;
         s->s3->tmp.finish_md_len = i;
         memcpy(p, s->s3->tmp.finish_md, i);
index 79b85b9ed947de2c59b285c36e5d573032c328f3..fb65fed8c8f056f22730e4e9c87ec69a4ae13431 100644 (file)
@@ -1230,7 +1230,6 @@ int dtls1_write_app_data_bytes(SSL *s, int type, const void *buf, int len);
 int dtls1_write_bytes(SSL *s, int type, const void *buf, int len);
 
 int dtls1_send_change_cipher_spec(SSL *s, int a, int b);
-int dtls1_send_finished(SSL *s, int a, int b, const char *sender, int slen);
 int dtls1_read_failed(SSL *s, int code);
 int dtls1_buffer_message(SSL *s, int ccs);
 int dtls1_retransmit_message(SSL *s, unsigned short seq,