diff options
author | tb <> | 2024-06-25 05:46:48 +0000 |
---|---|---|
committer | tb <> | 2024-06-25 05:46:48 +0000 |
commit | 7e17989e1f3f79c8497ce57ca420783bb5efba53 (patch) | |
tree | 92bb41980139df437df74af34cd4f6fc878c1778 /src | |
parent | 97a5d1f748d0178d5d587b7cdf9c39cafddadd3d (diff) | |
download | openbsd-7e17989e1f3f79c8497ce57ca420783bb5efba53.tar.gz openbsd-7e17989e1f3f79c8497ce57ca420783bb5efba53.tar.bz2 openbsd-7e17989e1f3f79c8497ce57ca420783bb5efba53.zip |
Fix TLS extension shuffling
The diff decoupling the shuffle from the table order still relied on PSK
being last because it failed to adjust the upper bound in the for loop.
ok jsing
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libssl/ssl_tlsext.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/libssl/ssl_tlsext.c b/src/lib/libssl/ssl_tlsext.c index 62bb3d737a..64f82b7dfb 100644 --- a/src/lib/libssl/ssl_tlsext.c +++ b/src/lib/libssl/ssl_tlsext.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssl_tlsext.c,v 1.150 2024/06/06 16:13:12 tb Exp $ */ | 1 | /* $OpenBSD: ssl_tlsext.c,v 1.151 2024/06/25 05:46:48 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2016, 2017, 2019 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2016, 2017, 2019 Joel Sing <jsing@openbsd.org> |
4 | * Copyright (c) 2017 Doug Hogan <doug@openbsd.org> | 4 | * Copyright (c) 2017 Doug Hogan <doug@openbsd.org> |
@@ -2427,7 +2427,7 @@ tlsext_randomize_build_order(SSL *s) | |||
2427 | s->tlsext_build_order[N_TLS_EXTENSIONS - 1] = psk_ext; | 2427 | s->tlsext_build_order[N_TLS_EXTENSIONS - 1] = psk_ext; |
2428 | 2428 | ||
2429 | /* Fisher-Yates shuffle with PSK fixed. */ | 2429 | /* Fisher-Yates shuffle with PSK fixed. */ |
2430 | for (idx = 0; idx < psk_idx; idx++) { | 2430 | for (idx = 0; idx < N_TLS_EXTENSIONS - 1; idx++) { |
2431 | new_idx = arc4random_uniform(idx + 1); | 2431 | new_idx = arc4random_uniform(idx + 1); |
2432 | s->tlsext_build_order[idx] = s->tlsext_build_order[new_idx]; | 2432 | s->tlsext_build_order[idx] = s->tlsext_build_order[new_idx]; |
2433 | s->tlsext_build_order[new_idx] = &tls_extensions[idx]; | 2433 | s->tlsext_build_order[new_idx] = &tls_extensions[idx]; |