summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorjsing <>2022-03-17 17:24:37 +0000
committerjsing <>2022-03-17 17:24:37 +0000
commit296c22446a2c3bd5088375546bc4afc9b6fda98b (patch)
treea918efb89a1fe66c8bea0838f5223f86a6a68002 /src/lib
parentb05e2fdda8cb3d474091e2b6308d2a5f65f4fd26 (diff)
downloadopenbsd-296c22446a2c3bd5088375546bc4afc9b6fda98b.tar.gz
openbsd-296c22446a2c3bd5088375546bc4afc9b6fda98b.tar.bz2
openbsd-296c22446a2c3bd5088375546bc4afc9b6fda98b.zip
Clean up and simplify ssl3_renegotiate{,_check}()
ok inoguchi@ tb@
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libssl/s3_lib.c37
1 files changed, 15 insertions, 22 deletions
diff --git a/src/lib/libssl/s3_lib.c b/src/lib/libssl/s3_lib.c
index 683a550ad8..624841a7a4 100644
--- a/src/lib/libssl/s3_lib.c
+++ b/src/lib/libssl/s3_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: s3_lib.c,v 1.227 2022/02/05 18:18:18 tb Exp $ */ 1/* $OpenBSD: s3_lib.c,v 1.228 2022/03/17 17:24:37 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 *
@@ -2698,35 +2698,28 @@ int
2698ssl3_renegotiate(SSL *s) 2698ssl3_renegotiate(SSL *s)
2699{ 2699{
2700 if (s->internal->handshake_func == NULL) 2700 if (s->internal->handshake_func == NULL)
2701 return (1); 2701 return 1;
2702 2702
2703 if (s->s3->flags & SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS) 2703 if (s->s3->flags & SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS)
2704 return (0); 2704 return 0;
2705 2705
2706 s->s3->renegotiate = 1; 2706 s->s3->renegotiate = 1;
2707 return (1); 2707
2708 return 1;
2708} 2709}
2709 2710
2710int 2711int
2711ssl3_renegotiate_check(SSL *s) 2712ssl3_renegotiate_check(SSL *s)
2712{ 2713{
2713 int ret = 0; 2714 if (!s->s3->renegotiate)
2715 return 0;
2716 if (SSL_in_init(s) || s->s3->rbuf.left != 0 || s->s3->wbuf.left != 0)
2717 return 0;
2714 2718
2715 if (s->s3->renegotiate) { 2719 s->s3->hs.state = SSL_ST_RENEGOTIATE;
2716 if ((s->s3->rbuf.left == 0) && (s->s3->wbuf.left == 0) && 2720 s->s3->renegotiate = 0;
2717 !SSL_in_init(s)) { 2721 s->s3->num_renegotiations++;
2718 /* 2722 s->s3->total_renegotiations++;
2719 * If we are the server, and we have sent 2723
2720 * a 'RENEGOTIATE' message, we need to go 2724 return 1;
2721 * to SSL_ST_ACCEPT.
2722 */
2723 /* SSL_ST_ACCEPT */
2724 s->s3->hs.state = SSL_ST_RENEGOTIATE;
2725 s->s3->renegotiate = 0;
2726 s->s3->num_renegotiations++;
2727 s->s3->total_renegotiations++;
2728 ret = 1;
2729 }
2730 }
2731 return (ret);
2732} 2725}