diff options
Diffstat (limited to 'dev-util/rizin/files/rizin-0.3.0-md4-openssl.patch')
-rw-r--r-- | dev-util/rizin/files/rizin-0.3.0-md4-openssl.patch | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/dev-util/rizin/files/rizin-0.3.0-md4-openssl.patch b/dev-util/rizin/files/rizin-0.3.0-md4-openssl.patch new file mode 100644 index 000000000000..d2c3135d1c72 --- /dev/null +++ b/dev-util/rizin/files/rizin-0.3.0-md4-openssl.patch @@ -0,0 +1,100 @@ +From 6a1edf5fb6967d57d1dcc8cf21ea3a6bbdf8a5b8 Mon Sep 17 00:00:00 2001 +From: wargio <wargio@libero.it> +Date: Sat, 2 Oct 2021 22:36:32 +0200 +Subject: [PATCH 1/2] Fix nullptr due missing small_block method when openssl + is used. + +--- + librz/hash/algorithms/openssl_common.h | 42 ++++++++++++++++++++++++++ + 1 file changed, 42 insertions(+) + +diff --git a/librz/hash/algorithms/openssl_common.h b/librz/hash/algorithms/openssl_common.h +index b29a1ae1221..e2399cff68d 100644 +--- a/librz/hash/algorithms/openssl_common.h ++++ b/librz/hash/algorithms/openssl_common.h +@@ -76,6 +76,46 @@ EVP_sha512 + return true; \ + } + ++#define rz_openssl_plugin_small_block(pluginname, evpmd) \ ++ static bool openssl_plugin_##pluginname##_small_block(const ut8 *data, ut64 size, ut8 **digest, RzMsgDigestSize *digest_size) { \ ++ rz_return_val_if_fail(data &&digest, false); \ ++ const EVP_MD *evp_md = evpmd(); \ ++ if (!evp_md) { \ ++ return false; \ ++ } \ ++ RzMsgDigestSize dgst_size = EVP_MD_size(evp_md); \ ++ ut8 *dgst = malloc(dgst_size); \ ++ if (!dgst) { \ ++ return false; \ ++ } \ ++ EVP_MD_CTX *context = EVP_MD_CTX_new(); \ ++ if (!context) { \ ++ free(dgst); \ ++ return false; \ ++ } \ ++ if (EVP_DigestInit_ex(context, evp_md, NULL) != 1) { \ ++ EVP_MD_CTX_free(context); \ ++ free(dgst); \ ++ return false; \ ++ } \ ++ if (EVP_DigestUpdate(context, data, size) != 1) { \ ++ EVP_MD_CTX_free(context); \ ++ free(dgst); \ ++ return false; \ ++ } \ ++ if (EVP_DigestFinal_ex(context, dgst, NULL) != 1) { \ ++ EVP_MD_CTX_free(context); \ ++ free(dgst); \ ++ return false; \ ++ } \ ++ *digest = dgst; \ ++ if (digest_size) { \ ++ *digest_size = dgst_size; \ ++ } \ ++ EVP_MD_CTX_free(context); \ ++ return true; \ ++ } ++ + #define rz_openssl_plugin_define_msg_digest(pluginname, evpmd, canhmac) \ + rz_openssl_plugin_context_new(pluginname); \ + rz_openssl_plugin_context_free(pluginname); \ +@@ -84,6 +124,7 @@ EVP_sha512 + rz_openssl_plugin_init(pluginname, evpmd); \ + rz_openssl_plugin_update(pluginname); \ + rz_openssl_plugin_final(pluginname); \ ++ rz_openssl_plugin_small_block(pluginname, evpmd); \ + RzMsgDigestPlugin rz_msg_digest_plugin_##pluginname = { \ + .name = #pluginname, \ + .license = "Apache 2.0", \ +@@ -96,6 +137,7 @@ EVP_sha512 + .init = openssl_plugin_##pluginname##_init, \ + .update = openssl_plugin_##pluginname##_update, \ + .final = openssl_plugin_##pluginname##_final, \ ++ .small_block = openssl_plugin_##pluginname##_small_block, \ + } + + #endif /* RZ_OPENSSL_COMMON_H */ + +From f4a8e2c86be861f33327c2a8f1d181b42232069e Mon Sep 17 00:00:00 2001 +From: wargio <wargio@libero.it> +Date: Sat, 2 Oct 2021 23:07:54 +0200 +Subject: [PATCH 2/2] Fix style + +--- + librz/hash/algorithms/openssl_common.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/librz/hash/algorithms/openssl_common.h b/librz/hash/algorithms/openssl_common.h +index e2399cff68d..0091fef2fa3 100644 +--- a/librz/hash/algorithms/openssl_common.h ++++ b/librz/hash/algorithms/openssl_common.h +@@ -78,7 +78,7 @@ EVP_sha512 + + #define rz_openssl_plugin_small_block(pluginname, evpmd) \ + static bool openssl_plugin_##pluginname##_small_block(const ut8 *data, ut64 size, ut8 **digest, RzMsgDigestSize *digest_size) { \ +- rz_return_val_if_fail(data &&digest, false); \ ++ rz_return_val_if_fail((data) && (digest), false); \ + const EVP_MD *evp_md = evpmd(); \ + if (!evp_md) { \ + return false; \ |