1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-12-08 03:42:12 +03:00

libcrypto: Check return values in KDF handling

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
Jakub Jelen
2024-04-25 15:35:17 +02:00
parent 455d26a479
commit 164ca9ae93

View File

@@ -169,13 +169,25 @@ int ssh_kdf(struct ssh_crypto_struct *crypto,
#if OPENSSL_VERSION_NUMBER < 0x30000000L
EVP_KDF_CTX *ctx = EVP_KDF_CTX_new_id(EVP_KDF_SSHKDF);
#else
EVP_KDF *kdf = EVP_KDF_fetch(NULL, "SSHKDF", NULL);
EVP_KDF_CTX *ctx = EVP_KDF_CTX_new(kdf);
OSSL_PARAM_BLD *param_bld = OSSL_PARAM_BLD_new();
EVP_KDF_CTX *ctx = NULL;
OSSL_PARAM_BLD *param_bld = NULL;
OSSL_PARAM *params = NULL;
const char *md = sshkdf_digest_to_md(crypto->digest_type);
const char *md = NULL;
EVP_KDF *kdf = NULL;
md = sshkdf_digest_to_md(crypto->digest_type);
if (md == NULL) {
return -1;
}
kdf = EVP_KDF_fetch(NULL, "SSHKDF", NULL);
if (kdf == NULL) {
return -1;
}
ctx = EVP_KDF_CTX_new(kdf);
EVP_KDF_free(kdf);
param_bld = OSSL_PARAM_BLD_new();
if (param_bld == NULL) {
EVP_KDF_CTX_free(ctx);
return -1;