You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.7 KiB

  1. From f004b4b7197fc83e7d47ec8cbcaefffa9a922717 Mon Sep 17 00:00:00 2001
  2. From: Zdenek Styblik <stybla@turnovfree.net>
  3. Date: Sun, 12 Mar 2017 14:00:35 +0100
  4. Subject: [PATCH 3/4] ID:480 - ipmitool coredumps in EVP_CIPHER_CTX_init
  5. IPMI tool coredumps due to changes introduced in ID:461. This shouldn't be
  6. surprise as a NULL pointer is passed to init. Commit addresses this issue by
  7. calling EVP_CIPHER_CTX_new() instead of EVP_CIPHER_CTX_init(), which is
  8. deprecated, and by checking return value of call to former function.
  9. ---
  10. src/plugins/lanplus/lanplus_crypt_impl.c | 14 ++++++++++----
  11. 1 file changed, 10 insertions(+), 4 deletions(-)
  12. diff --git a/src/plugins/lanplus/lanplus_crypt_impl.c b/src/plugins/lanplus/lanplus_crypt_impl.c
  13. index d12d0e3..0e330c1 100644
  14. --- a/src/plugins/lanplus/lanplus_crypt_impl.c
  15. +++ b/src/plugins/lanplus/lanplus_crypt_impl.c
  16. @@ -165,10 +165,13 @@ lanplus_encrypt_aes_cbc_128(const uint8_t * iv,
  17. uint32_t * bytes_written)
  18. {
  19. EVP_CIPHER_CTX *ctx = NULL;
  20. - EVP_CIPHER_CTX_init(ctx);
  21. + ctx = EVP_CIPHER_CTX_new();
  22. + if (ctx == NULL) {
  23. + *bytes_written = 0;
  24. + return;
  25. + }
  26. EVP_EncryptInit_ex(ctx, EVP_aes_128_cbc(), NULL, key, iv);
  27. EVP_CIPHER_CTX_set_padding(ctx, 0);
  28. -
  29. *bytes_written = 0;
  30. @@ -240,11 +243,14 @@ lanplus_decrypt_aes_cbc_128(const uint8_t * iv,
  31. uint32_t * bytes_written)
  32. {
  33. EVP_CIPHER_CTX *ctx = NULL;
  34. - EVP_CIPHER_CTX_init(ctx);
  35. + ctx = EVP_CIPHER_CTX_new();
  36. + if (ctx == NULL) {
  37. + *bytes_written = 0;
  38. + return;
  39. + }
  40. EVP_DecryptInit_ex(ctx, EVP_aes_128_cbc(), NULL, key, iv);
  41. EVP_CIPHER_CTX_set_padding(ctx, 0);
  42. -
  43. if (verbose >= 5)
  44. {
  45. printbuf(iv, 16, "decrypting with this IV");
  46. --
  47. 2.16.1