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/Manifest | 4 + dev-util/rizin/files/rizin-0.3.0-md4-openssl.patch | 100 ++++++++++++++++ .../rizin/files/rizin-0.3.0-typedb-prefix.patch | 132 +++++++++++++++++++++ dev-util/rizin/rizin-0.3.0.ebuild | 103 ++++++++++++++++ 4 files changed, 339 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 create mode 100644 dev-util/rizin/rizin-0.3.0.ebuild (limited to 'dev-util/rizin') diff --git a/dev-util/rizin/Manifest b/dev-util/rizin/Manifest index af3b46e97581..79421dbfb938 100644 --- a/dev-util/rizin/Manifest +++ b/dev-util/rizin/Manifest @@ -1,5 +1,9 @@ AUX rizin-0.2.1-no-rzpipe.patch 432 BLAKE2B 77e959797f22ea6d32e6742651710ecb042bfa6bf00efccaedcd3d60a6f75c0bdb42128261ffe068d8cfaeb6d7abacef6ea114ffb9061ca365533a1fe2120c34 SHA512 7a03664ed99ea7f9cb214b566e2a74a0aee1ebfa643552ce90f4e7fb60e779628ba75c4cf34ffc3cc45b65d1dd8959d400a9af16bc49d7cc26f1499670ddbaa6 +AUX rizin-0.3.0-md4-openssl.patch 3410 BLAKE2B 06f5f270abd2351b044c3d2178fe74a43a320d5fef1ee672762cb2ca31729786364953d412274b4064927f63f92e32202487ba523ea16160721fa4c1306f25a7 SHA512 d079f6ab1c1e4e4b0d50fb04cda3fecc64bddd14ae775a1b2e818d42b1199bed7ebae78e81a550608d1f976cc03e4b6262ffa08c145a27b7db4e2d8ff3f798eb +AUX rizin-0.3.0-typedb-prefix.patch 5175 BLAKE2B 08fea1ba6297f17d42f518c1739875c0964f6f00c1bcd01cba51a56e6626fe50c6ad2c36bece4db326f7b128d6ea5786970eb454832e32f9d837458f92f2a596 SHA512 241a72a7f1c3ec8ba831ca696faf0cfc09a58207c6d3db7005b09b9016a71ed9238bcb9441a389116083557538a0ff1a6adf55e78e1aa35d67aa206f30774391 DIST rizin-src-v0.2.1.tar.xz 51439132 BLAKE2B 3ce048c5e93afa43b33bb7c36e7f7a96734886a44a67339c18b36de84b6e3dd015aa49fd048815bc7cb26a39bd3c44ebd00227fdb0c3dc9d9f07ff2ff1f1948d SHA512 4d0a68971a8fe1de3860f8ee18197606f59c22d4c24f3fcce691c73b45c8fe8c356a9b411604e9c3d4e5bb01f695b6ead32cdc217134eb4ddfec76867c16c327 +DIST rizin-src-v0.3.0.tar.xz 64097204 BLAKE2B 308037ce60ec6523f337580221ea265c912ff92032fc5e1c2ab37430eae5a16cc2e8efa74447a79735c7814a35d3b08e5fc2f548612a1553c5edc2f314d22df5 SHA512 68f71e612bd4df90c79ebd4cb26c3e09bb370ccd9e51f574f2687f940b3934d9bf417108f3f7e678cabc6ddba7402e0420aab569c24316e07b2b56ed33153ed3 DIST rizin-testbins-a80fd0d56d538d07a05ef01e29c8cb430a4f9d72.tar.gz 119214206 BLAKE2B 33916d466d77aaa0aeb6b221529a570a2bd2ad07b59b45967d75a84e3efbbc8ca3b8fff9cd88d61598b4e785ead2f8bc58eb7c1cb31007c27e497d80f36e4d2d SHA512 9b01a63ff281ac19b427e715d669e6080c4afdfd777ae762c30537c59bd2cdc2865adc1b34ccb61430b172e54995375b48bb35fd88f098b6a9839e9f3669fde4 EBUILD rizin-0.2.1.ebuild 2009 BLAKE2B 335a2af33e2a4f4a503f1d5f07a692103e713c9196cd54063c6c2c2b247a160a14507bf681adf06055a87e79a699dedf37c717a042c10f98fbc65885c596e0b2 SHA512 e8c5d35259d78403b86414dce4c9fdf71112e908bb6a31ca1137d0a77b6789097be0b193fca18d5a7a2768c4d2125d85eeb697454dd3f110e478b73436afa6fc +EBUILD rizin-0.3.0.ebuild 2908 BLAKE2B ef7f12a5ca9813776c1ee6acae4cab4c36d7a9608cd2dedec81d09d5eabc5c9fd7c3603606380d1ea5fca51bdbb01c869abf0e8fbeeb34f04f48e650c91b03aa SHA512 ad810f425164ee8c82585a790154653e8f89a3c6aa5a38152e953ed079d0d299f1a715e45b80a570a3513ac2de7d58ac85bca9e4e1df9e03a248d6dcafb609fc MISC metadata.xml 348 BLAKE2B eea14d9f2e713f2f272a46bd754e500b28ec3958f0f4295e6fe6e73c9dcfa1e180fa62901bdb591fdb43ec8ead23a63f20416e52605e6ae186532e651e0eb1a3 SHA512 db41ccd0ce1493387c47eb707dd303c556ad784ffab2ffe03509a4ff7b0c1b650b0f0999edb5e4e040f95f1f550e9a11ead273ec74ebedb97e645e40c6ad37d5 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; diff --git a/dev-util/rizin/rizin-0.3.0.ebuild b/dev-util/rizin/rizin-0.3.0.ebuild new file mode 100644 index 000000000000..0ac6575d67e4 --- /dev/null +++ b/dev-util/rizin/rizin-0.3.0.ebuild @@ -0,0 +1,103 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +PYTHON_COMPAT=(python3_{8,9,10}) + +# This is the commit that the CI for the release commit used +BINS_COMMIT="d4cee85f3e94f1151dc9ff1681555ebcff7931f0" + +inherit meson python-any-r1 + +DESCRIPTION="reverse engineering framework for binary analysis" +HOMEPAGE="https://rizin.re/" + +SRC_URI="https://github.com/rizinorg/rizin/releases/download/v${PV}/rizin-src-v${PV}.tar.xz" + #test? ( https://github.com/rizinorg/rizin-testbins/archive/${BINS_COMMIT}.tar.gz -> rizin-testbins-${BINS_COMMIT}.tar.gz )" +KEYWORDS="~amd64 ~arm64 ~x86" + +LICENSE="Apache-2.0 BSD LGPL-3 MIT" +SLOT="0" +IUSE="test" + +# Need to audit licenses of the binaries used for testing +RESTRICT="test" + +RDEPEND=" + sys-apps/file + app-arch/lz4:0= + dev-libs/capstone:0= + dev-libs/libuv:0= + dev-libs/libzip:0= + dev-libs/openssl:0= + >=dev-libs/tree-sitter-0.19.0 + dev-libs/xxhash + sys-libs/zlib:0= +" +DEPEND="${RDEPEND}" +BDEPEND="${PYTHON_DEPS}" + +PATCHES=( + "${FILESDIR}/${PN}-${PV}-typedb-prefix.patch" + "${FILESDIR}/${PN}-${PV}-md4-openssl.patch" +) + +S="${WORKDIR}/${PN}-v${PV}" + +src_prepare() { + default + + local py_to_mangle=( + librz/core/cmd_descs/cmd_descs_generate.py + subprojects/lz4-1.9.3/contrib/meson/meson/GetLz4LibraryVersion.py + subprojects/lz4-1.9.3/contrib/meson/meson/InstallSymlink.py + subprojects/lz4-1.9.3/tests/test-lz4-list.py + subprojects/lz4-1.9.3/tests/test-lz4-speed.py + subprojects/lz4-1.9.3/tests/test-lz4-versions.py + sys/clang-format.py + test/fuzz/scripts/fuzz_rz_asm.py + test/scripts/gdbserver.py + ) + + python_fix_shebang "${py_to_mangle[@]}" + + if use test; then + cp -r "${WORKDIR}/rizin-testbins-${BINS_COMMIT}" "${S}/test/bins" || die + cp -r "${WORKDIR}/rizin-testbins-${BINS_COMMIT}" "${S}" || die + fi +} + +src_configure() { + local emesonargs=( + -Dcli=enabled + -Duse_sys_capstone=enabled + -Duse_sys_magic=enabled + -Duse_sys_libzip=enabled + -Duse_sys_zlib=enabled + -Duse_sys_lz4=enabled + -Duse_sys_xxhash=enabled + -Duse_sys_openssl=enabled + -Duse_sys_tree_sitter=enabled + + $(meson_use test enable_tests) + $(meson_use test enable_rz_test) + ) + meson_src_configure +} + +src_test() { + # Rizin uses data files that it expects to be installed on the + # system. To hack around this, we create a tree of what it expects + # in ${T}, and patch the tests to support a prefix from the + # environment. https://github.com/rizinorg/rizin/issues/1789 + mkdir -p "${T}/usr/share/${PN}/${PV}" || die + ln -sf "${BUILD_DIR}/librz/analysis/d" "${T}/usr/share/${PN}/${PV}/types" || die + ln -sf "${BUILD_DIR}/librz/syscall/d" "${T}/usr/share/${PN}/${PV}/syscall" || die + ln -sf "${BUILD_DIR}/librz/asm/d" "${T}/usr/share/${PN}/${PV}/opcodes" || die + # https://github.com/rizinorg/rizin/issues/1797 + ln -sf "${BUILD_DIR}/librz/flag/d" "${T}/usr/share/${PN}/${PV}/flag" || die + export RZ_PREFIX="${T}/usr" + + meson_src_test +} -- cgit v1.2.3