summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libcrypto/ecdh/ech_key.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/lib/libcrypto/ecdh/ech_key.c b/src/lib/libcrypto/ecdh/ech_key.c
index d93e95b239..bac5b6e28d 100644
--- a/src/lib/libcrypto/ecdh/ech_key.c
+++ b/src/lib/libcrypto/ecdh/ech_key.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ech_key.c,v 1.31 2023/07/02 03:11:51 tb Exp $ */ 1/* $OpenBSD: ech_key.c,v 1.32 2023/07/02 11:29:36 tb Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. 3 * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
4 * 4 *
@@ -68,7 +68,6 @@
68 */ 68 */
69 69
70#include <limits.h> 70#include <limits.h>
71#include <stdint.h>
72#include <stdlib.h> 71#include <stdlib.h>
73#include <string.h> 72#include <string.h>
74 73
@@ -163,11 +162,9 @@ ossl_ecdh_compute_key(void *out, size_t outlen, const EC_POINT *pub_key,
163 goto err; 162 goto err;
164 } 163 }
165 } else { 164 } else {
166 /* No KDF, just copy out the key and zero the rest. */ 165 memset(out, 0, outlen);
167 if (outlen > buflen) { 166 if (outlen > buflen)
168 memset((void *)((uintptr_t)out + buflen), 0, outlen - buflen);
169 outlen = buflen; 167 outlen = buflen;
170 }
171 memcpy(out, buf, outlen); 168 memcpy(out, buf, outlen);
172 } 169 }
173 170