summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjsing <>2020-08-02 07:33:15 +0000
committerjsing <>2020-08-02 07:33:15 +0000
commit2bc9beff4e7e4404b48e98e8c4bccfe464a47b90 (patch)
tree648614eca61abf8dd8fd8cdfff2634a209e3f694 /src
parent6e5d9da264e1017a10d374a9ba566f293528170e (diff)
downloadopenbsd-2bc9beff4e7e4404b48e98e8c4bccfe464a47b90.tar.gz
openbsd-2bc9beff4e7e4404b48e98e8c4bccfe464a47b90.tar.bz2
openbsd-2bc9beff4e7e4404b48e98e8c4bccfe464a47b90.zip
Check the return value of tls1_enc() in the write path.
The write path can return a failure in the AEAD path and there is no reason not to check a return value. Spotted by tb@ during another review. ok tb@
Diffstat (limited to 'src')
-rw-r--r--src/lib/libssl/d1_pkt.c6
-rw-r--r--src/lib/libssl/ssl_pkt.c6
2 files changed, 6 insertions, 6 deletions
diff --git a/src/lib/libssl/d1_pkt.c b/src/lib/libssl/d1_pkt.c
index f888592223..0caf2a5965 100644
--- a/src/lib/libssl/d1_pkt.c
+++ b/src/lib/libssl/d1_pkt.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: d1_pkt.c,v 1.75 2020/08/01 16:50:16 jsing Exp $ */ 1/* $OpenBSD: d1_pkt.c,v 1.76 2020/08/02 07:33:15 jsing 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.
@@ -1254,8 +1254,8 @@ do_dtls1_write(SSL *s, int type, const unsigned char *buf, unsigned int len)
1254 wr->input = p; 1254 wr->input = p;
1255 wr->length += eivlen; 1255 wr->length += eivlen;
1256 1256
1257 /* tls1_enc can only have an error on read */ 1257 if (tls1_enc(s, 1) != 1)
1258 tls1_enc(s, 1); 1258 goto err;
1259 1259
1260 if (!CBB_add_u16(&cbb, wr->length)) 1260 if (!CBB_add_u16(&cbb, wr->length))
1261 goto err; 1261 goto err;
diff --git a/src/lib/libssl/ssl_pkt.c b/src/lib/libssl/ssl_pkt.c
index 6bb722098a..39ce46381d 100644
--- a/src/lib/libssl/ssl_pkt.c
+++ b/src/lib/libssl/ssl_pkt.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_pkt.c,v 1.27 2020/08/01 16:50:16 jsing Exp $ */ 1/* $OpenBSD: ssl_pkt.c,v 1.28 2020/08/02 07:33:15 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -674,8 +674,8 @@ ssl3_create_record(SSL *s, unsigned char *p, uint16_t version, uint8_t type,
674 wr->input = p; 674 wr->input = p;
675 wr->length += eivlen; 675 wr->length += eivlen;
676 676
677 /* tls1_enc can only have an error on read */ 677 if (tls1_enc(s, 1) != 1)
678 tls1_enc(s, 1); 678 goto err;
679 679
680 /* record length after mac and block padding */ 680 /* record length after mac and block padding */
681 if (!CBB_add_u16(&cbb, wr->length)) 681 if (!CBB_add_u16(&cbb, wr->length))