summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/kdf
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/kdf')
-rw-r--r--src/lib/libcrypto/kdf/hkdf_evp.c8
-rw-r--r--src/lib/libcrypto/kdf/tls1_prf.c7
2 files changed, 10 insertions, 5 deletions
diff --git a/src/lib/libcrypto/kdf/hkdf_evp.c b/src/lib/libcrypto/kdf/hkdf_evp.c
index b33e2e0a26..dee6e35d82 100644
--- a/src/lib/libcrypto/kdf/hkdf_evp.c
+++ b/src/lib/libcrypto/kdf/hkdf_evp.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: hkdf_evp.c,v 1.20 2023/06/26 08:57:17 tb Exp $ */ 1/* $OpenBSD: hkdf_evp.c,v 1.22 2025/05/21 03:53:20 kenjiro Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 2016-2018 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 2016-2018 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -50,12 +50,11 @@
50#include <stdlib.h> 50#include <stdlib.h>
51#include <string.h> 51#include <string.h>
52 52
53#include <openssl/err.h>
54#include <openssl/evp.h>
55#include <openssl/hmac.h> 53#include <openssl/hmac.h>
56#include <openssl/hkdf.h> 54#include <openssl/hkdf.h>
57#include <openssl/kdf.h> 55#include <openssl/kdf.h>
58 56
57#include "err_local.h"
59#include "evp_local.h" 58#include "evp_local.h"
60 59
61#define HKDF_MAXBUF 1024 60#define HKDF_MAXBUF 1024
@@ -91,6 +90,9 @@ pkey_hkdf_cleanup(EVP_PKEY_CTX *ctx)
91{ 90{
92 HKDF_PKEY_CTX *kctx = ctx->data; 91 HKDF_PKEY_CTX *kctx = ctx->data;
93 92
93 if (kctx == NULL)
94 return;
95
94 freezero(kctx->salt, kctx->salt_len); 96 freezero(kctx->salt, kctx->salt_len);
95 freezero(kctx->key, kctx->key_len); 97 freezero(kctx->key, kctx->key_len);
96 freezero(kctx, sizeof(*kctx)); 98 freezero(kctx, sizeof(*kctx));
diff --git a/src/lib/libcrypto/kdf/tls1_prf.c b/src/lib/libcrypto/kdf/tls1_prf.c
index 7d6231e3c7..2b86ff744f 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.40 2024/07/10 06:53:27 tb Exp $ */ 1/* $OpenBSD: tls1_prf.c,v 1.42 2025/05/21 03:53:20 kenjiro 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.
@@ -61,10 +61,10 @@
61#include <stdio.h> 61#include <stdio.h>
62#include <string.h> 62#include <string.h>
63 63
64#include <openssl/err.h>
65#include <openssl/evp.h> 64#include <openssl/evp.h>
66#include <openssl/kdf.h> 65#include <openssl/kdf.h>
67 66
67#include "err_local.h"
68#include "evp_local.h" 68#include "evp_local.h"
69 69
70#define TLS1_PRF_MAXBUF 1024 70#define TLS1_PRF_MAXBUF 1024
@@ -96,6 +96,9 @@ pkey_tls1_prf_cleanup(EVP_PKEY_CTX *ctx)
96{ 96{
97 struct tls1_prf_ctx *kctx = ctx->data; 97 struct tls1_prf_ctx *kctx = ctx->data;
98 98
99 if (kctx == NULL)
100 return;
101
99 freezero(kctx->secret, kctx->secret_len); 102 freezero(kctx->secret, kctx->secret_len);
100 freezero(kctx, sizeof(*kctx)); 103 freezero(kctx, sizeof(*kctx));
101} 104}