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.

104 lines
3.3 KiB

  1. From b57487e360916ab3eaa50aa6d021c73b6337a4a0 Mon Sep 17 00:00:00 2001
  2. From: Dennis Schridde <dennis.schridde@uni-heidelberg.de>
  3. Date: Wed, 30 Nov 2016 17:33:00 +0100
  4. Subject: [PATCH 1/4] ID:461 - OpenSSL 1.1 compatibility - "error: storage size
  5. of 'ctx' isn't known"
  6. In OpenSSL 1.1 EVP_CIPHER_CTX became opaque, cf. `man 3ssl EVP_EncryptInit`
  7. Fixes: ID:461
  8. ---
  9. src/plugins/lanplus/lanplus_crypt_impl.c | 28 ++++++++++++++--------------
  10. 1 file changed, 14 insertions(+), 14 deletions(-)
  11. diff --git a/src/plugins/lanplus/lanplus_crypt_impl.c b/src/plugins/lanplus/lanplus_crypt_impl.c
  12. index d5fac37..3c0df23 100644
  13. --- a/src/plugins/lanplus/lanplus_crypt_impl.c
  14. +++ b/src/plugins/lanplus/lanplus_crypt_impl.c
  15. @@ -164,10 +164,10 @@ lanplus_encrypt_aes_cbc_128(const uint8_t * iv,
  16. uint8_t * output,
  17. uint32_t * bytes_written)
  18. {
  19. - EVP_CIPHER_CTX ctx;
  20. - EVP_CIPHER_CTX_init(&ctx);
  21. - EVP_EncryptInit_ex(&ctx, EVP_aes_128_cbc(), NULL, key, iv);
  22. - EVP_CIPHER_CTX_set_padding(&ctx, 0);
  23. + EVP_CIPHER_CTX* ctx;
  24. + EVP_CIPHER_CTX_init(ctx);
  25. + EVP_EncryptInit_ex(ctx, EVP_aes_128_cbc(), NULL, key, iv);
  26. + EVP_CIPHER_CTX_set_padding(ctx, 0);
  27. *bytes_written = 0;
  28. @@ -191,7 +191,7 @@ lanplus_encrypt_aes_cbc_128(const uint8_t * iv,
  29. assert((input_length % IPMI_CRYPT_AES_CBC_128_BLOCK_SIZE) == 0);
  30. - if(!EVP_EncryptUpdate(&ctx, output, (int *)bytes_written, input, input_length))
  31. + if(!EVP_EncryptUpdate(ctx, output, (int *)bytes_written, input, input_length))
  32. {
  33. /* Error */
  34. *bytes_written = 0;
  35. @@ -201,7 +201,7 @@ lanplus_encrypt_aes_cbc_128(const uint8_t * iv,
  36. {
  37. uint32_t tmplen;
  38. - if(!EVP_EncryptFinal_ex(&ctx, output + *bytes_written, (int *)&tmplen))
  39. + if(!EVP_EncryptFinal_ex(ctx, output + *bytes_written, (int *)&tmplen))
  40. {
  41. *bytes_written = 0;
  42. return; /* Error */
  43. @@ -210,7 +210,7 @@ lanplus_encrypt_aes_cbc_128(const uint8_t * iv,
  44. {
  45. /* Success */
  46. *bytes_written += tmplen;
  47. - EVP_CIPHER_CTX_cleanup(&ctx);
  48. + EVP_CIPHER_CTX_cleanup(ctx);
  49. }
  50. }
  51. }
  52. @@ -239,10 +239,10 @@ lanplus_decrypt_aes_cbc_128(const uint8_t * iv,
  53. uint8_t * output,
  54. uint32_t * bytes_written)
  55. {
  56. - EVP_CIPHER_CTX ctx;
  57. - EVP_CIPHER_CTX_init(&ctx);
  58. - EVP_DecryptInit_ex(&ctx, EVP_aes_128_cbc(), NULL, key, iv);
  59. - EVP_CIPHER_CTX_set_padding(&ctx, 0);
  60. + EVP_CIPHER_CTX* ctx;
  61. + EVP_CIPHER_CTX_init(ctx);
  62. + EVP_DecryptInit_ex(ctx, EVP_aes_128_cbc(), NULL, key, iv);
  63. + EVP_CIPHER_CTX_set_padding(ctx, 0);
  64. if (verbose >= 5)
  65. @@ -266,7 +266,7 @@ lanplus_decrypt_aes_cbc_128(const uint8_t * iv,
  66. assert((input_length % IPMI_CRYPT_AES_CBC_128_BLOCK_SIZE) == 0);
  67. - if (!EVP_DecryptUpdate(&ctx, output, (int *)bytes_written, input, input_length))
  68. + if (!EVP_DecryptUpdate(ctx, output, (int *)bytes_written, input, input_length))
  69. {
  70. /* Error */
  71. lprintf(LOG_DEBUG, "ERROR: decrypt update failed");
  72. @@ -277,7 +277,7 @@ lanplus_decrypt_aes_cbc_128(const uint8_t * iv,
  73. {
  74. uint32_t tmplen;
  75. - if (!EVP_DecryptFinal_ex(&ctx, output + *bytes_written, (int *)&tmplen))
  76. + if (!EVP_DecryptFinal_ex(ctx, output + *bytes_written, (int *)&tmplen))
  77. {
  78. char buffer[1000];
  79. ERR_error_string(ERR_get_error(), buffer);
  80. @@ -290,7 +290,7 @@ lanplus_decrypt_aes_cbc_128(const uint8_t * iv,
  81. {
  82. /* Success */
  83. *bytes_written += tmplen;
  84. - EVP_CIPHER_CTX_cleanup(&ctx);
  85. + EVP_CIPHER_CTX_cleanup(ctx);
  86. }
  87. }
  88. --
  89. 2.16.1