mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-15 04:40:05 +01:00
Fix error path after conversion to OpenSSL 1.1.0.
This commit is contained in:
@@ -134,11 +134,13 @@ int crypt_hash_init(struct crypt_hash **ctx, const char *name)
|
|||||||
|
|
||||||
h->hash_id = EVP_get_digestbyname(name);
|
h->hash_id = EVP_get_digestbyname(name);
|
||||||
if (!h->hash_id) {
|
if (!h->hash_id) {
|
||||||
|
EVP_MD_CTX_free(h->md);
|
||||||
free(h);
|
free(h);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EVP_DigestInit_ex(h->md, h->hash_id, NULL) != 1) {
|
if (EVP_DigestInit_ex(h->md, h->hash_id, NULL) != 1) {
|
||||||
|
EVP_MD_CTX_free(h->md);
|
||||||
free(h);
|
free(h);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
@@ -218,6 +220,7 @@ int crypt_hmac_init(struct crypt_hmac **ctx, const char *name,
|
|||||||
|
|
||||||
h->hash_id = EVP_get_digestbyname(name);
|
h->hash_id = EVP_get_digestbyname(name);
|
||||||
if (!h->hash_id) {
|
if (!h->hash_id) {
|
||||||
|
HMAC_CTX_free(h->md);
|
||||||
free(h);
|
free(h);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
@@ -298,7 +301,7 @@ int crypt_pbkdf(const char *kdf, const char *hash,
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (!PKCS5_PBKDF2_HMAC(password, (int)password_length,
|
if (!PKCS5_PBKDF2_HMAC(password, (int)password_length,
|
||||||
(unsigned char *)salt, (int)salt_length,
|
(const unsigned char *)salt, (int)salt_length,
|
||||||
(int)iterations, hash_id, (int)key_length, (unsigned char *)key))
|
(int)iterations, hash_id, (int)key_length, (unsigned char *)key))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user