summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortb <>2024-07-09 17:04:50 +0000
committertb <>2024-07-09 17:04:50 +0000
commit8b8939877a0acbcc6724657618b6f026f70e373a (patch)
tree599cca9f56b659bfb33ac5bdf3e8ddc70cd13b8d /src
parent03464fb728517030f7dc3db7b482bff8f083c3a9 (diff)
downloadopenbsd-8b8939877a0acbcc6724657618b6f026f70e373a.tar.gz
openbsd-8b8939877a0acbcc6724657618b6f026f70e373a.tar.bz2
openbsd-8b8939877a0acbcc6724657618b6f026f70e373a.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.c11
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