diff options
author | tb <> | 2024-07-09 17:04:50 +0000 |
---|---|---|
committer | tb <> | 2024-07-09 17:04:50 +0000 |
commit | 742faccd995fcad87d0ff5969502585c8af47c8e (patch) | |
tree | 599cca9f56b659bfb33ac5bdf3e8ddc70cd13b8d /src | |
parent | 4f8bcfe2a17edc71f8da97e242d45dde4681bdff (diff) | |
download | openbsd-742faccd995fcad87d0ff5969502585c8af47c8e.tar.gz openbsd-742faccd995fcad87d0ff5969502585c8af47c8e.tar.bz2 openbsd-742faccd995fcad87d0ff5969502585c8af47c8e.zip |
Use better order in EVP_PKEY_CTRL_TLS_SECRET
Also avoid an unnecessary NULL check.
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libcrypto/kdf/tls1_prf.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/lib/libcrypto/kdf/tls1_prf.c b/src/lib/libcrypto/kdf/tls1_prf.c index cefb3e2cad..594537ca3f 100644 --- a/src/lib/libcrypto/kdf/tls1_prf.c +++ b/src/lib/libcrypto/kdf/tls1_prf.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: tls1_prf.c,v 1.30 2024/07/09 17:01:40 tb Exp $ */ | 1 | /* $OpenBSD: tls1_prf.c,v 1.31 2024/07/09 17:04:50 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project | 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project |
4 | * 2016. | 4 | * 2016. |
@@ -119,15 +119,14 @@ pkey_tls1_prf_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2) | |||
119 | case EVP_PKEY_CTRL_TLS_SECRET: | 119 | case EVP_PKEY_CTRL_TLS_SECRET: |
120 | if (p1 < 0) | 120 | if (p1 < 0) |
121 | return 0; | 121 | return 0; |
122 | if (kctx->secret != NULL) | ||
123 | freezero(kctx->secret, kctx->secret_len); | ||
124 | |||
125 | explicit_bzero(kctx->seed, kctx->seed_len); | ||
126 | kctx->seed_len = 0; | ||
127 | 122 | ||
123 | freezero(kctx->secret, kctx->secret_len); | ||
128 | kctx->secret = NULL; | 124 | kctx->secret = NULL; |
129 | kctx->secret_len = 0; | 125 | kctx->secret_len = 0; |
130 | 126 | ||
127 | explicit_bzero(kctx->seed, kctx->seed_len); | ||
128 | kctx->seed_len = 0; | ||
129 | |||
131 | if (p1 == 0 || p2 == NULL) | 130 | if (p1 == 0 || p2 == NULL) |
132 | return 0; | 131 | return 0; |
133 | 132 | ||