200-eng_devcrypto-don-t-leak-methods-tables.patch 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. From be5cf61caa425070ec4f3e925d4e9aa484c8315b Mon Sep 17 00:00:00 2001
  2. From: Eneas U de Queiroz <[email protected]>
  3. Date: Mon, 5 Nov 2018 17:59:42 -0200
  4. Subject: [PATCH 1/7] eng_devcrypto: don't leak methods tables
  5. Call functions to prepare methods after confirming that /dev/crytpo was
  6. sucessfully open and that the destroy function has been set.
  7. Signed-off-by: Eneas U de Queiroz <[email protected]>
  8. Reviewed-by: Matthias St. Pierre <[email protected]>
  9. Reviewed-by: Richard Levitte <[email protected]>
  10. (Merged from https://github.com/openssl/openssl/pull/7585)
  11. (cherry picked from commit d9d4dff5c640990d45af115353fc9f88a497a56c)
  12. --- a/crypto/engine/eng_devcrypto.c
  13. +++ b/crypto/engine/eng_devcrypto.c
  14. @@ -619,11 +619,6 @@ void engine_load_devcrypto_int()
  15. return;
  16. }
  17. - prepare_cipher_methods();
  18. -#ifdef IMPLEMENT_DIGEST
  19. - prepare_digest_methods();
  20. -#endif
  21. -
  22. if ((e = ENGINE_new()) == NULL
  23. || !ENGINE_set_destroy_function(e, devcrypto_unload)) {
  24. ENGINE_free(e);
  25. @@ -636,6 +631,11 @@ void engine_load_devcrypto_int()
  26. return;
  27. }
  28. + prepare_cipher_methods();
  29. +#ifdef IMPLEMENT_DIGEST
  30. + prepare_digest_methods();
  31. +#endif
  32. +
  33. if (!ENGINE_set_id(e, "devcrypto")
  34. || !ENGINE_set_name(e, "/dev/crypto engine")