mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-12-11 03:42:35 +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:
@@ -169,13 +169,25 @@ int ssh_kdf(struct ssh_crypto_struct *crypto,
|
|||||||
#if OPENSSL_VERSION_NUMBER < 0x30000000L
|
#if OPENSSL_VERSION_NUMBER < 0x30000000L
|
||||||
EVP_KDF_CTX *ctx = EVP_KDF_CTX_new_id(EVP_KDF_SSHKDF);
|
EVP_KDF_CTX *ctx = EVP_KDF_CTX_new_id(EVP_KDF_SSHKDF);
|
||||||
#else
|
#else
|
||||||
EVP_KDF *kdf = EVP_KDF_fetch(NULL, "SSHKDF", NULL);
|
EVP_KDF_CTX *ctx = NULL;
|
||||||
EVP_KDF_CTX *ctx = EVP_KDF_CTX_new(kdf);
|
OSSL_PARAM_BLD *param_bld = NULL;
|
||||||
OSSL_PARAM_BLD *param_bld = OSSL_PARAM_BLD_new();
|
|
||||||
OSSL_PARAM *params = 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);
|
EVP_KDF_free(kdf);
|
||||||
|
|
||||||
|
param_bld = OSSL_PARAM_BLD_new();
|
||||||
if (param_bld == NULL) {
|
if (param_bld == NULL) {
|
||||||
EVP_KDF_CTX_free(ctx);
|
EVP_KDF_CTX_free(ctx);
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
Reference in New Issue
Block a user