mirror of
https://github.com/ipmitool/ipmitool.git
synced 2025-05-10 10:37:22 +00:00
ID:480 - ipmitool coredumps in EVP_CIPHER_CTX_init
IPMI tool coredumps due to changes introduced in ID:461. This shouldn't be surprise as a NULL pointer is passed to init. Commit addresses this issue by calling EVP_CIPHER_CTX_new() instead of EVP_CIPHER_CTX_init(), which is deprecated, and by checking return value of call to former function.
This commit is contained in:
parent
ba01dc84b4
commit
f004b4b719
@ -165,10 +165,13 @@ lanplus_encrypt_aes_cbc_128(const uint8_t * iv,
|
||||
uint32_t * bytes_written)
|
||||
{
|
||||
EVP_CIPHER_CTX *ctx = NULL;
|
||||
EVP_CIPHER_CTX_init(ctx);
|
||||
ctx = EVP_CIPHER_CTX_new();
|
||||
if (ctx == NULL) {
|
||||
*bytes_written = 0;
|
||||
return;
|
||||
}
|
||||
EVP_EncryptInit_ex(ctx, EVP_aes_128_cbc(), NULL, key, iv);
|
||||
EVP_CIPHER_CTX_set_padding(ctx, 0);
|
||||
|
||||
|
||||
*bytes_written = 0;
|
||||
|
||||
@ -240,11 +243,14 @@ lanplus_decrypt_aes_cbc_128(const uint8_t * iv,
|
||||
uint32_t * bytes_written)
|
||||
{
|
||||
EVP_CIPHER_CTX *ctx = NULL;
|
||||
EVP_CIPHER_CTX_init(ctx);
|
||||
ctx = EVP_CIPHER_CTX_new();
|
||||
if (ctx == NULL) {
|
||||
*bytes_written = 0;
|
||||
return;
|
||||
}
|
||||
EVP_DecryptInit_ex(ctx, EVP_aes_128_cbc(), NULL, key, iv);
|
||||
EVP_CIPHER_CTX_set_padding(ctx, 0);
|
||||
|
||||
|
||||
if (verbose >= 5)
|
||||
{
|
||||
printbuf(iv, 16, "decrypting with this IV");
|
||||
|
Loading…
x
Reference in New Issue
Block a user