summaryrefslogtreecommitdiff
path: root/src/lib/libssl/d1_both.c
diff options
context:
space:
mode:
authorbeck <>2017-02-07 02:08:38 +0000
committerbeck <>2017-02-07 02:08:38 +0000
commit91c389f89015a024212e73f5ec6e24166955ab6e (patch)
treea4e6a6d2d23329b576b63c8698e62a87e7388b69 /src/lib/libssl/d1_both.c
parent8a1ec4c748b269fba0669ee71234ec9a0f128613 (diff)
downloadopenbsd-91c389f89015a024212e73f5ec6e24166955ab6e.tar.gz
openbsd-91c389f89015a024212e73f5ec6e24166955ab6e.tar.bz2
openbsd-91c389f89015a024212e73f5ec6e24166955ab6e.zip
Change SSLerror() back to taking two args, with the first one being an SSL *.
Make a table of "function codes" which maps the internal state of the SSL * to something like a useful name so in a typical error in the connection you know in what sort of place in the handshake things happened. (instead of by arcane function name). Add SSLerrorx() for when we don't have an SSL * ok jsing@ after us both being prodded by bluhm@ to make it not terrible
Diffstat (limited to '')
-rw-r--r--src/lib/libssl/d1_both.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/lib/libssl/d1_both.c b/src/lib/libssl/d1_both.c
index 0e4317653d..9aba4b85f8 100644
--- a/src/lib/libssl/d1_both.c
+++ b/src/lib/libssl/d1_both.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: d1_both.c,v 1.48 2017/01/26 12:16:13 beck Exp $ */ 1/* $OpenBSD: d1_both.c,v 1.49 2017/02/07 02:08:38 beck Exp $ */
2/* 2/*
3 * DTLS implementation written by Nagendra Modadugu 3 * DTLS implementation written by Nagendra Modadugu
4 * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. 4 * (nagendra@cs.stanford.edu) for the OpenSSL project 2005.
@@ -410,7 +410,7 @@ dtls1_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok)
410 S3I(s)->tmp.reuse_message = 0; 410 S3I(s)->tmp.reuse_message = 0;
411 if ((mt >= 0) && (S3I(s)->tmp.message_type != mt)) { 411 if ((mt >= 0) && (S3I(s)->tmp.message_type != mt)) {
412 al = SSL_AD_UNEXPECTED_MESSAGE; 412 al = SSL_AD_UNEXPECTED_MESSAGE;
413 SSLerror(SSL_R_UNEXPECTED_MESSAGE); 413 SSLerror(s, SSL_R_UNEXPECTED_MESSAGE);
414 goto f_err; 414 goto f_err;
415 } 415 }
416 *ok = 1; 416 *ok = 1;
@@ -475,12 +475,12 @@ dtls1_preprocess_fragment(SSL *s, struct hm_header_st *msg_hdr, int max)
475 475
476 /* sanity checking */ 476 /* sanity checking */
477 if ((frag_off + frag_len) > msg_len) { 477 if ((frag_off + frag_len) > msg_len) {
478 SSLerror(SSL_R_EXCESSIVE_MESSAGE_SIZE); 478 SSLerror(s, SSL_R_EXCESSIVE_MESSAGE_SIZE);
479 return SSL_AD_ILLEGAL_PARAMETER; 479 return SSL_AD_ILLEGAL_PARAMETER;
480 } 480 }
481 481
482 if ((frag_off + frag_len) > (unsigned long)max) { 482 if ((frag_off + frag_len) > (unsigned long)max) {
483 SSLerror(SSL_R_EXCESSIVE_MESSAGE_SIZE); 483 SSLerror(s, SSL_R_EXCESSIVE_MESSAGE_SIZE);
484 return SSL_AD_ILLEGAL_PARAMETER; 484 return SSL_AD_ILLEGAL_PARAMETER;
485 } 485 }
486 486
@@ -492,7 +492,7 @@ dtls1_preprocess_fragment(SSL *s, struct hm_header_st *msg_hdr, int max)
492 */ 492 */
493 if (!BUF_MEM_grow_clean(s->internal->init_buf, 493 if (!BUF_MEM_grow_clean(s->internal->init_buf,
494 msg_len + DTLS1_HM_HEADER_LENGTH)) { 494 msg_len + DTLS1_HM_HEADER_LENGTH)) {
495 SSLerror(ERR_R_BUF_LIB); 495 SSLerror(s, ERR_R_BUF_LIB);
496 return SSL_AD_INTERNAL_ERROR; 496 return SSL_AD_INTERNAL_ERROR;
497 } 497 }
498 498
@@ -506,7 +506,7 @@ dtls1_preprocess_fragment(SSL *s, struct hm_header_st *msg_hdr, int max)
506 * They must be playing with us! BTW, failure to enforce 506 * They must be playing with us! BTW, failure to enforce
507 * upper limit would open possibility for buffer overrun. 507 * upper limit would open possibility for buffer overrun.
508 */ 508 */
509 SSLerror(SSL_R_EXCESSIVE_MESSAGE_SIZE); 509 SSLerror(s, SSL_R_EXCESSIVE_MESSAGE_SIZE);
510 return SSL_AD_ILLEGAL_PARAMETER; 510 return SSL_AD_ILLEGAL_PARAMETER;
511 } 511 }
512 512
@@ -799,7 +799,7 @@ again:
799 /* parse the message fragment header */ 799 /* parse the message fragment header */
800 dtls1_get_message_header(wire, &msg_hdr) == 0) { 800 dtls1_get_message_header(wire, &msg_hdr) == 0) {
801 al = SSL_AD_UNEXPECTED_MESSAGE; 801 al = SSL_AD_UNEXPECTED_MESSAGE;
802 SSLerror(SSL_R_UNEXPECTED_MESSAGE); 802 SSLerror(s, SSL_R_UNEXPECTED_MESSAGE);
803 goto f_err; 803 goto f_err;
804 } 804 }
805 805
@@ -841,7 +841,7 @@ again:
841 else /* Incorrectly formated Hello request */ 841 else /* Incorrectly formated Hello request */
842 { 842 {
843 al = SSL_AD_UNEXPECTED_MESSAGE; 843 al = SSL_AD_UNEXPECTED_MESSAGE;
844 SSLerror(SSL_R_UNEXPECTED_MESSAGE); 844 SSLerror(s, SSL_R_UNEXPECTED_MESSAGE);
845 goto f_err; 845 goto f_err;
846 } 846 }
847 } 847 }
@@ -872,7 +872,7 @@ again:
872 */ 872 */
873 if (i != (int)frag_len) { 873 if (i != (int)frag_len) {
874 al = SSL3_AD_ILLEGAL_PARAMETER; 874 al = SSL3_AD_ILLEGAL_PARAMETER;
875 SSLerror(SSL3_AD_ILLEGAL_PARAMETER); 875 SSLerror(s, SSL3_AD_ILLEGAL_PARAMETER);
876 goto f_err; 876 goto f_err;
877 } 877 }
878 878