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