summaryrefslogtreecommitdiff
path: root/src/lib/libssl/ssl_pkt.c
diff options
context:
space:
mode:
authorjsing <>2021-05-02 17:46:58 +0000
committerjsing <>2021-05-02 17:46:58 +0000
commit138d879b1616ace5c1ae9d93e2d734b08892691d (patch)
tree50c9893a25ead9ba252f8ac28a27688e77d6f79d /src/lib/libssl/ssl_pkt.c
parent9f7bc5899b5335b444e8b9f837aee040b51730e7 (diff)
downloadopenbsd-138d879b1616ace5c1ae9d93e2d734b08892691d.tar.gz
openbsd-138d879b1616ace5c1ae9d93e2d734b08892691d.tar.bz2
openbsd-138d879b1616ace5c1ae9d93e2d734b08892691d.zip
Clean up tls1_change_cipher_state().
Replace flag gymnastics at call sites with separate read and write, functions which call the common code. Condition on s->server instead of using SSL_ST_ACCEPT, for consistency and more readable code. ok inoguchi@ tb@
Diffstat (limited to 'src/lib/libssl/ssl_pkt.c')
-rw-r--r--src/lib/libssl/ssl_pkt.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/lib/libssl/ssl_pkt.c b/src/lib/libssl/ssl_pkt.c
index 6e0cfe2102..ba59aa3237 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.41 2021/04/25 13:15:22 jsing Exp $ */ 1/* $OpenBSD: ssl_pkt.c,v 1.42 2021/05/02 17:46:58 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 *
@@ -1154,8 +1154,6 @@ ssl3_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek)
1154int 1154int
1155ssl3_do_change_cipher_spec(SSL *s) 1155ssl3_do_change_cipher_spec(SSL *s)
1156{ 1156{
1157 int i;
1158
1159 if (S3I(s)->hs.tls12.key_block == NULL) { 1157 if (S3I(s)->hs.tls12.key_block == NULL) {
1160 if (s->session == NULL || s->session->master_key_length == 0) { 1158 if (s->session == NULL || s->session->master_key_length == 0) {
1161 /* might happen if dtls1_read_bytes() calls this */ 1159 /* might happen if dtls1_read_bytes() calls this */
@@ -1168,12 +1166,7 @@ ssl3_do_change_cipher_spec(SSL *s)
1168 return (0); 1166 return (0);
1169 } 1167 }
1170 1168
1171 if (S3I(s)->hs.state & SSL_ST_ACCEPT) 1169 if (!tls1_change_read_cipher_state(s))
1172 i = SSL3_CHANGE_CIPHER_SERVER_READ;
1173 else
1174 i = SSL3_CHANGE_CIPHER_CLIENT_READ;
1175
1176 if (!tls1_change_cipher_state(s, i))
1177 return (0); 1170 return (0);
1178 1171
1179 /* 1172 /*