diff options
author | tb <> | 2021-02-03 15:14:44 +0000 |
---|---|---|
committer | tb <> | 2021-02-03 15:14:44 +0000 |
commit | a5e93fc7b4feac54578a8c48f8eb98244e56fad6 (patch) | |
tree | 7a460e4bfe54e5106bfc673f7309653ac74fb3f9 /src | |
parent | c90f8c720a52664554ebc8ed8e69520cfb3cfe74 (diff) | |
download | openbsd-a5e93fc7b4feac54578a8c48f8eb98244e56fad6.tar.gz openbsd-a5e93fc7b4feac54578a8c48f8eb98244e56fad6.tar.bz2 openbsd-a5e93fc7b4feac54578a8c48f8eb98244e56fad6.zip |
Fail early in legacy exporter if master secret is not available
The exporter depends on having a master secret. If the handshake is
not completed, it is neither guaranteed that a shared ciphersuite was
selected (in which case tls1_PRF() will currently NULL deref) or that
a master secret was set up (in which case the exporter will succeed
with a predictable value). Neither outcome is desirable, so error out
early instead of entering the sausage factory unprepared. This aligns
the legacy exporter with the TLSv1.3 exporter in that regard.
with/ok jsing
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libssl/t1_enc.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/lib/libssl/t1_enc.c b/src/lib/libssl/t1_enc.c index b84a5347f1..8f3e9649b0 100644 --- a/src/lib/libssl/t1_enc.c +++ b/src/lib/libssl/t1_enc.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: t1_enc.c,v 1.131 2021/01/28 17:00:39 jsing Exp $ */ | 1 | /* $OpenBSD: t1_enc.c,v 1.132 2021/02/03 15:14:44 tb 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 | * |
@@ -619,6 +619,11 @@ tls1_export_keying_material(SSL *s, unsigned char *out, size_t olen, | |||
619 | size_t vallen, currentvalpos; | 619 | size_t vallen, currentvalpos; |
620 | int rv; | 620 | int rv; |
621 | 621 | ||
622 | if (!SSL_is_init_finished(s)) { | ||
623 | SSLerror(s, SSL_R_BAD_STATE); | ||
624 | return 0; | ||
625 | } | ||
626 | |||
622 | /* construct PRF arguments | 627 | /* construct PRF arguments |
623 | * we construct the PRF argument ourself rather than passing separate | 628 | * we construct the PRF argument ourself rather than passing separate |
624 | * values into the TLS PRF to ensure that the concatenation of values | 629 | * values into the TLS PRF to ensure that the concatenation of values |