summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorjsing <>2020-04-18 13:47:58 +0000
committerjsing <>2020-04-18 13:47:58 +0000
commit33d8c111a77ac681a8ecffcda0713ec96c6fe953 (patch)
tree931c5335b3f38c2165e5530c18367c675ce32851 /src/lib
parent1b8c0c0aa5c7daa58988de39987d35dd2edbca98 (diff)
downloadopenbsd-33d8c111a77ac681a8ecffcda0713ec96c6fe953.tar.gz
openbsd-33d8c111a77ac681a8ecffcda0713ec96c6fe953.tar.bz2
openbsd-33d8c111a77ac681a8ecffcda0713ec96c6fe953.zip
Tweak previous active cipher suite code.
Use a boolean value rather than using a counter, as suggested by tb@ during the previous review. ok tb@
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libssl/ssl_ciph.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/lib/libssl/ssl_ciph.c b/src/lib/libssl/ssl_ciph.c
index 08ddc86c3c..5952595c5d 100644
--- a/src/lib/libssl/ssl_ciph.c
+++ b/src/lib/libssl/ssl_ciph.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_ciph.c,v 1.114 2020/04/17 17:26:00 jsing Exp $ */ 1/* $OpenBSD: ssl_ciph.c,v 1.115 2020/04/18 13:47: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 *
@@ -1171,7 +1171,7 @@ ssl_create_cipher_list(const SSL_METHOD *ssl_method,
1171 CIPHER_ORDER *co_list = NULL, *head = NULL, *tail = NULL, *curr; 1171 CIPHER_ORDER *co_list = NULL, *head = NULL, *tail = NULL, *curr;
1172 const SSL_CIPHER **ca_list = NULL; 1172 const SSL_CIPHER **ca_list = NULL;
1173 int tls13_seen = 0; 1173 int tls13_seen = 0;
1174 int active; 1174 int any_active;
1175 1175
1176 /* 1176 /*
1177 * Return with error if nothing to do. 1177 * Return with error if nothing to do.
@@ -1324,15 +1324,14 @@ ssl_create_cipher_list(const SSL_METHOD *ssl_method,
1324 * TLSv1.3 cipher suites. If the rule string resulted in no active 1324 * TLSv1.3 cipher suites. If the rule string resulted in no active
1325 * cipher suites then we return an empty stack. 1325 * cipher suites then we return an empty stack.
1326 */ 1326 */
1327 active = 0; 1327 any_active = 0;
1328 for (curr = head; curr != NULL; curr = curr->next) { 1328 for (curr = head; curr != NULL; curr = curr->next) {
1329 if (curr->active || 1329 if (curr->active ||
1330 (!tls13_seen && curr->cipher->algorithm_ssl == SSL_TLSV1_3)) 1330 (!tls13_seen && curr->cipher->algorithm_ssl == SSL_TLSV1_3))
1331 sk_SSL_CIPHER_push(cipherstack, curr->cipher); 1331 sk_SSL_CIPHER_push(cipherstack, curr->cipher);
1332 if (curr->active) 1332 any_active |= curr->active;
1333 active++;
1334 } 1333 }
1335 if (active == 0) 1334 if (!any_active)
1336 sk_SSL_CIPHER_zero(cipherstack); 1335 sk_SSL_CIPHER_zero(cipherstack);
1337 1336
1338 free(co_list); /* Not needed any longer */ 1337 free(co_list); /* Not needed any longer */