From e23a08d0c97a0cc415aaa165da840b056f93c997 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Fri, 8 Oct 2021 23:06:07 +0100 Subject: gentoo resync : 08.10.2021 --- dev-util/rizin/files/rizin-0.3.0-md4-openssl.patch | 100 ++++++++++++++++ .../rizin/files/rizin-0.3.0-typedb-prefix.patch | 132 +++++++++++++++++++++ 2 files changed, 232 insertions(+) create mode 100644 dev-util/rizin/files/rizin-0.3.0-md4-openssl.patch create mode 100644 dev-util/rizin/files/rizin-0.3.0-typedb-prefix.patch (limited to 'dev-util/rizin/files') 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 +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 +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; \ diff --git a/dev-util/rizin/files/rizin-0.3.0-typedb-prefix.patch b/dev-util/rizin/files/rizin-0.3.0-typedb-prefix.patch new file mode 100644 index 000000000000..dfb86447df71 --- /dev/null +++ b/dev-util/rizin/files/rizin-0.3.0-typedb-prefix.patch @@ -0,0 +1,132 @@ +https://github.com/rizinorg/rizin/issues/1789 + +Signed-off-by: Florian Märkl + +diff --git a/test/unit/test_serialize_analysis.c b/test/unit/test_serialize_analysis.c +index 51092c067..0d714ba90 100644 +--- a/test/unit/test_serialize_analysis.c ++++ b/test/unit/test_serialize_analysis.c +@@ -546,7 +546,10 @@ Sdb *vars_ref_db() { + } + + bool test_analysis_var_save() { +- const char *dir_prefix = rz_sys_prefix(NULL); ++ const char *dir_prefix = getenv("RZ_PREFIX"); ++ if (!dir_prefix) { ++ dir_prefix = rz_sys_prefix(NULL); ++ } + RzAnalysis *analysis = rz_analysis_new(); + rz_analysis_use(analysis, "x86"); + rz_analysis_set_bits(analysis, 64); +diff --git a/test/unit/test_type.c b/test/unit/test_type.c +index d8a3d9c5f..3956a800b 100644 +--- a/test/unit/test_type.c ++++ b/test/unit/test_type.c +@@ -379,7 +379,10 @@ static bool test_enum_types(void) { + RzTypeDB *typedb = rz_type_db_new(); + mu_assert_notnull(typedb, "Couldn't create new RzTypeDB"); + mu_assert_notnull(typedb->types, "Couldn't create new types hashtable"); +- const char *dir_prefix = rz_sys_prefix(NULL); ++ const char *dir_prefix = getenv("RZ_PREFIX"); ++ if (!dir_prefix) { ++ dir_prefix = rz_sys_prefix(NULL); ++ } + rz_type_db_init(typedb, dir_prefix, "x86", 64, "linux"); + + char *error_msg = NULL; +@@ -417,7 +420,10 @@ static bool test_const_types(void) { + RzTypeDB *typedb = rz_type_db_new(); + mu_assert_notnull(typedb, "Couldn't create new RzTypeDB"); + mu_assert_notnull(typedb->types, "Couldn't create new types hashtable"); +- const char *dir_prefix = rz_sys_prefix(NULL); ++ const char *dir_prefix = getenv("RZ_PREFIX"); ++ if (!dir_prefix) { ++ dir_prefix = rz_sys_prefix(NULL); ++ } + rz_type_db_init(typedb, dir_prefix, "x86", 64, "linux"); + + char *error_msg = NULL; +@@ -469,7 +475,10 @@ static bool test_type_as_string(void) { + RzTypeDB *typedb = rz_type_db_new(); + mu_assert_notnull(typedb, "Couldn't create new RzTypeDB"); + mu_assert_notnull(typedb->types, "Couldn't create new types hashtable"); +- const char *dir_prefix = rz_sys_prefix(NULL); ++ const char *dir_prefix = getenv("RZ_PREFIX"); ++ if (!dir_prefix) { ++ dir_prefix = rz_sys_prefix(NULL); ++ } + rz_type_db_init(typedb, dir_prefix, "x86", 64, "linux"); + + char *error_msg = NULL; +@@ -516,7 +525,10 @@ static bool test_array_types(void) { + RzTypeDB *typedb = rz_type_db_new(); + mu_assert_notnull(typedb, "Couldn't create new RzTypeDB"); + mu_assert_notnull(typedb->types, "Couldn't create new types hashtable"); +- const char *dir_prefix = rz_sys_prefix(NULL); ++ const char *dir_prefix = getenv("RZ_PREFIX"); ++ if (!dir_prefix) { ++ dir_prefix = rz_sys_prefix(NULL); ++ } + rz_type_db_init(typedb, dir_prefix, "x86", 64, "linux"); + + char *error_msg = NULL; +@@ -569,7 +581,10 @@ static bool test_struct_func_types(void) { + RzTypeDB *typedb = rz_type_db_new(); + mu_assert_notnull(typedb, "Couldn't create new RzTypeDB"); + mu_assert_notnull(typedb->types, "Couldn't create new types hashtable"); +- const char *dir_prefix = rz_sys_prefix(NULL); ++ const char *dir_prefix = getenv("RZ_PREFIX"); ++ if (!dir_prefix) { ++ dir_prefix = rz_sys_prefix(NULL); ++ } + rz_type_db_init(typedb, dir_prefix, "x86", 64, "linux"); + + char *error_msg = NULL; +@@ -659,7 +674,10 @@ static bool test_struct_array_types(void) { + RzTypeDB *typedb = rz_type_db_new(); + mu_assert_notnull(typedb, "Couldn't create new RzTypeDB"); + mu_assert_notnull(typedb->types, "Couldn't create new types hashtable"); +- const char *dir_prefix = rz_sys_prefix(NULL); ++ const char *dir_prefix = getenv("RZ_PREFIX"); ++ if (!dir_prefix) { ++ dir_prefix = rz_sys_prefix(NULL); ++ } + rz_type_db_init(typedb, dir_prefix, "x86", 64, "linux"); + + char *error_msg = NULL; +@@ -707,7 +725,10 @@ static bool test_struct_identifier_without_specifier(void) { + RzTypeDB *typedb = rz_type_db_new(); + mu_assert_notnull(typedb, "Couldn't create new RzTypeDB"); + mu_assert_notnull(typedb->types, "Couldn't create new types hashtable"); +- const char *dir_prefix = rz_sys_prefix(NULL); ++ const char *dir_prefix = getenv("RZ_PREFIX"); ++ if (!dir_prefix) { ++ dir_prefix = rz_sys_prefix(NULL); ++ } + rz_type_db_init(typedb, dir_prefix, "x86", 64, "linux"); + + char *error_msg = NULL; +@@ -735,7 +756,10 @@ static bool test_union_identifier_without_specifier(void) { + RzTypeDB *typedb = rz_type_db_new(); + mu_assert_notnull(typedb, "Couldn't create new RzTypeDB"); + mu_assert_notnull(typedb->types, "Couldn't create new types hashtable"); +- const char *dir_prefix = rz_sys_prefix(NULL); ++ const char *dir_prefix = getenv("RZ_PREFIX"); ++ if (!dir_prefix) { ++ dir_prefix = rz_sys_prefix(NULL); ++ } + rz_type_db_init(typedb, dir_prefix, "x86", 64, "linux"); + + char *error_msg = NULL; +@@ -767,7 +791,10 @@ static bool test_edit_types(void) { + RzTypeDB *typedb = rz_type_db_new(); + mu_assert_notnull(typedb, "Couldn't create new RzTypeDB"); + mu_assert_notnull(typedb->types, "Couldn't create new types hashtable"); +- const char *dir_prefix = rz_sys_prefix(NULL); ++ const char *dir_prefix = getenv("RZ_PREFIX"); ++ if (!dir_prefix) { ++ dir_prefix = rz_sys_prefix(NULL); ++ } + rz_type_db_init(typedb, dir_prefix, "x86", 64, "linux"); + + char *error_msg = NULL; -- cgit v1.2.3