Commit graph

465 commits

Author SHA1 Message Date
Giovanni
5789f6557e
Threaded analysis matching (#3090) 2022-10-24 00:40:42 +02:00
wargio
7685bfe90e remove rz_mem_swaporcopy 2022-10-20 23:12:58 +02:00
wargio
ab5c0cb869 Fix endianness in px command 2022-10-20 23:12:58 +02:00
Giovanni
e7be5c5f1d
Cleanup endianness on rz_buf_fread/_at (#3109) 2022-10-19 11:04:21 +08:00
Anton Kochkov
24503df48b
Convert pF commands to the rzshell (#3071)
* Convert `pF` commands to the rzshell
* Add json output for PKCS7 and x509 and rename test due FS issues

Co-authored-by: wargio <wargio@libero.it>
2022-10-09 19:18:05 +02:00
wargio
e68c2cf882 Ownership and doxygen for rz_protobuf_decode 2022-10-09 08:09:00 +08:00
wargio
dd92bc3d05 Refactoring and rename RASN1 to RzASN1 2022-10-09 08:09:00 +08:00
wargio
563c70057b Rename RPKCS7/RCMS/Spc to RzPKCS7/RzCMS/RzSpc 2022-10-09 08:09:00 +08:00
wargio
6e5fbe4eef Refactoring names and usages of pkcs7 2022-10-09 08:09:00 +08:00
wargio
a63f07b6c1 Rename RX509* to RzX509* 2022-10-09 08:09:00 +08:00
wargio
4e4565d6aa Refactoring names and usages of x509 2022-10-09 08:09:00 +08:00
wargio
3f74be7266 Removed commented code from pkcs7.c 2022-10-09 08:09:00 +08:00
Giovanni
4bd9d19473
RzFloat: Fix endianness conversion (#3079) 2022-10-09 08:05:20 +08:00
Giovanni
001b65942f
Refactoring RzList to remove unused methods and bad naming (#3074) 2022-10-08 08:09:42 +08:00
wargio
fbad0b4859 Remove agd and add rz_analysis_similarity/match + refactoring
- Introduce the following new methods:
  * `rz_analysis_similarity_basic_block()`
  * `rz_analysis_similarity_function()`
  * `rz_analysis_similarity_basic_block_2()`
  * `rz_analysis_similarity_function_2()`
  * `rz_analysis_match_basic_blocks()`
  * `rz_analysis_match_functions()`
  * `rz_analysis_match_basic_blocks_2()`
  * `rz_analysis_match_functions_2()`
- Remove `RzAnalysisDiff` and its usages
- Remove `librz/analysis/diff.c` entirely to and adds `librz/analysis/similarity.c`
- Remove a lot of unused structures and simplified the code by a lot
- Fix typo in levenshtein
- Remove `librz/core/gdiff.c` and `gdiff` functions since they were unused or only used in rz-diff
- Remove `difftype` (or "color") from `RzANode` which lead to dead code
- Decrease serialized data in projects.
- Add `RzAnalysisVarKind` and `RzAnalysisVarType` and replaces all the hardcoded values
- Remove command `agd`
- Remove all `rz_core_gdiff` usages from `rz_core.h`
- Refactor `rz_analysis_var_list` and `rz_analysis_var_count` due unused argument (`RzAnalysis` was not used)
- Add new method `rz_analysis_var_count_total` to simplify some usages
- Remove `rz_core_graph_diff`
- Add `typedef RzAnalysisFcnType` on `enum``used for function types
- Remove unused `RZ_ANALYSIS_FCN_VARKIND_LOCAL`
- Remove from `RzAnalysisFunction` the following variables:
  * `fingerprint`
  * `fingerprint_size`
  * `diff`
  * `diff_ops`
  * `diff_thbb`
  * `diff_thfcn`
- Remove from `RzAnalysisBlock` the following variables:
  * `fingerprint`
  * `diff`
- Remove `RZ_ANALYSIS_THRESHOLDBB` and `RZ_ANALYSIS_THRESHOLDFCN`
- Remove the following callbacks from `RzAnalysisPlugin`
  * `RzAnalysisDiffBBCallback`
  * `RzAnalysisDiffFcnCallback`
  * `RzAnalysisDiffEvalCallback`
- Fix fancy table columns/rows when a color string is in a cell
- Bumped project version to 9
2022-10-04 20:02:35 +02:00
Giovanni
69d7c7225a
Added apple ASN1 OIDs (#3048)
Based on:
- C++ opensource Apple code
- Apple_WWDR_CPS_v1.14.pdf
2022-09-28 01:52:14 +02:00
Giovanni
6654fa7a58
Allow RzThreadQueue to be initialized with a list (#3039) 2022-09-20 07:05:57 +08:00
wargio
19beda6c66 Refactor softfloat error messages. 2022-09-16 21:55:58 +08:00
wargio
8f40517990 Refactor rz_float_new_from_utXX_as_fXX 2022-09-16 21:55:58 +08:00
Heersin
b13202b934
RzUtil: softfloat support based on bitvector (#2784) 2022-09-14 14:38:22 +02:00
Dean
59b38e6efa
Add /*<type>*/ comments everywhere (#2986)
Adds /*<type>*/ comments and a linter check from rz-bindgen to enforce
their existence and consistency

Also includes the following fixes made when adding the annotations:
* removed unused intern_table arguments in pyc_dis.c, pyc_dis.h, asm_pyc.c
* removed unused classes argument from place_nodes in agraph.c
* removed unused recurse and recurse_bb functions in canalysis.c
* removed unused vars field from RzPrint struct
* removed unused RzAnalysisType* structs from rz_analysis.h
* removed unused list field from RzEgg struct
* fixed bug in bp_plugin.c where duplication-checking logic iterates over the wrong list
* removed unused q_regs field from RzDebug struct
* removed unused backtrace field from RzDebugPlugin struct
* removed unused classes_list field from RzBinNXOObj struct
* removed unused methods_list and classes_list fields from RzBinZimgObj struct
2022-09-11 13:04:53 +08:00
Khairul Azhar Kasmiran
9b2e6bb2de
Remove multibyte conversion functions (#3000) 2022-09-02 16:51:32 +02:00
Khairul Azhar Kasmiran
da374939eb
Remove rz_str_mb_to_wc_l() (#2998) 2022-09-01 23:27:17 +08:00
billow
46a1929397
Refactor rz_core_analysis_graph*() functions (#2949)
- fix `ags` and `agl` commands
- add more tests for the `ag` commands
- move graph related code to cgraph.c
- remove APIs `rz_core_print_bb_custom` `rz_core_print_bb_gml`
- exports
    - `rz_graph_drawable_to_json_str`
    - `rz_graph_drawable_to_cmd`
    - `rz_graph_drawable_to_gml`
    - `rz_core_graph`
    - `rz_core_graph_diff`
    - `rz_core_graph_format_from_string`
    - `rz_core_graph_type_from_string`
    - `rz_core_graph_write`
    - `create_agraph_from_graph_at`
- add unit/integration tests for the graph API
2022-08-29 22:48:23 +08:00
Anton Kochkov
106a1049dc
Make all visual functions private (RZ_IPI) (#2985) 2022-08-27 22:13:12 +08:00
wargio
924cb9ea3a fix #2966 #2967 #2974 - oob read in asn1.c 2022-08-24 08:26:37 +08:00
Florian Märkl
4e5857cacf
Meson refactor: collect modules in dict and centralize config (#2945)
Duplicated code for pkg-config and cmake configuration is avoided by
letting every rizin module register itself in a global dictionary
called "modules" which is then iterated in one place to perform any
shared logic, inspired by how qemu handles multiple targets in its meson
build system.

This is an almost pure refactor, so the resulting .pc/.cmake files
should be identical with the following exceptions:
- rz_reg.pc does not have plugindir anymore as rz_reg has no plugins.
- Some other modules have their dependencies in .pc files altered to be
  consistent with cmake.
2022-08-20 19:59:27 +02:00
GustavoLCR
29b485bd8e Remove dup rz_windows.h include 2022-08-18 20:11:47 +08:00
wargio
d4134cb58c Add extra check on RzBitmap. 2022-08-17 21:20:37 +02:00
wargio
0e86b74b1d Fix RzBitmap length type and added ownership and checks. 2022-08-17 21:20:37 +02:00
wargio
eb7e0efe38 Fix oob read on rz_pkcs7_parse_spcdata 2022-08-17 21:20:37 +02:00
wargio
6b118bf673 Fix oob read on rz_x509_parse_tbscertificate 2022-08-17 21:20:37 +02:00
Khairul Azhar Kasmiran
801567c0b7
Move gittip to share/rizin (#2907) 2022-08-11 23:13:38 +08:00
Rot127
b46e7bd4f2
PPC uplifting to RzIL (#2823)
* Print a warning if config for VM was NULL.
* Add warning if register is not added to VM due to overlap.
* Update PPC register profile.
* Add vector and float registers. As well as some control and system registers.
* Enable to write values 4bit registers.
* PPC: Uplift most common instructions.
* Print warning if reserved SPR instruction is encountered.
* Update PC/LR addresses and add ca32 writes.
* Write cache needs to get flushed so load and store tests don't share the same memory.
* Add missing T/F branch mnemonics.
* Add Move to/from CR/CR0-7
* Fix TA address calculation for branch instructions.
* Add branch tests for branch mnemonics.
* Add XNOP
* NOP cache touch instructions.
* Add undocumented ATTN instruction to the not_implemented group.
* Add isel instruction.
* Implement CRCLR, CRSET, CROR.
* Add CNTLZ instructions.
* Add mcrf instructions.
* Add inacive test for cmpb.
* Add Load bytes reverse instructions.
* Add test and add address alignment to dcbz.
* Add eqv test
* Correct DIV and MUL operations
* Add div tests.
* Add tests and correct MT/MFXER
* Remove register ca32, ov32
* Remove explici setting of cr register because QEMU does not do it. Otherwise we get a mismatch in the trace
* Simplify carry set for add and sub. Sub instructions are exclusivly defined with addition. Hence no sub case needed.
* Unify BD and fix branch instructions. Fix: Check the single bit not the cr reg
* Document Conditional branches and replace NOPs with EMPTY
* Add mulli instruction to double word instructions.
* Fix ca set for shift instructions:
* ca value had to be determined before the shift happened. The wrong ca value was calculated if the src and target reg were the same.
* Replace NOP wit EMPTY.
* Use MSB isntead of SLT.
* Brought fixup of ADD and SUB instructions: The add and sub instructions had several issues which let to incorrect execution.
* The carry was incorrectly if three add operations happened (only the last add were checked, not both).
* The carry was incorrectly set if the src and target register matched.
* Same applies for the CR bit.
* It was too complex. Several local variables were introduced for this.
* Set result in local var, since it would change if src and target reg are the same.
* Remove MTMSR and MFMSR since it is too complex and untestable currently.
* Use unsigned int for shift. Otherwise the 0x1c shift produces a runtime error since 0xf is int as default.
* Fix mtxer: Only write flag bits.
* Let NOT_IMPLEMENTED macro return NULL.
* Mark st[wd]cx and l[wd]cx as not implemented.
* Increase dcache_line_size to 128 bytes.
* Fix cntlz for ppc32. m was set incorrectly, since it is 0 not 32 for 32bit cpus.
* Fix isel: Use op.crx reg instead of imm.
* Unify helper function names: Prependnig `ppc_` mark as IPI
* Add more "Move to SPR" cases.
* MULLI opeartes only on double word on 64bit CPUs.
* Most registers are now assigned the control register type and no longer show up in the ar command.
* Fix xor if dest and src registers match by saving result in local var.
* Fix BE/LE issue for Load BRX instructions.
* Fix shifts: Use only lower 6bits of n.
* User Pure local variables for ROT macros.
* Fix rldimi instructions.
* n was not inverted.
* more than 6 bits of n could be used
* Add 32bit emulateme tests.
* Add 64bit emulateme tests.
* Determine lg(v) in inline function.
* Calculate CR bit in C not in the VM.
* Check if `~mask = 0` and skip mask calculation if yes.
* Check for `sh == 0` and skip rotations where possible.
* Remove `la` instruction. `la` is a mnemonic for `addi`.
* Remove SPR instructions which are not supported by QEMU or not traced yet. For most set/read SPR instructions QEMU segfaults.


In case of SPR 1 (xer), 8 (lr) and 9 (ctr) the assembler resolves them to their mnemonics (mtxer, mtlr etc.). This means the code here is never reached.
To test the get_xer code MFXER was added again. The rz-tracetests will fail for this instructions (due to missing ca32, ov32). But this case is covert in an issue.
2022-08-11 08:41:15 +08:00
Khairul Azhar Kasmiran
4abd2028da
strbuf.c: Fix some assert return values (#2898) 2022-08-10 22:39:44 +08:00
GustavoLCR
c40744eba4
Fix Windows cross build (#2897)
* Fix build without ZLIB
* Fix cyclic include when cross-compiling
* Fixes `rz_util/rz_version.h`->`rz_types.h`->`rz_userconf.h`->`rz_util/rz_version.h`
2022-08-10 21:49:17 +08:00
Heersin
a9c59ce1dd
Add rz_bv_range_set and rz_bv_is_all_one to bitvector lib (#2891) 2022-08-10 08:20:16 +08:00
Khairul Azhar Kasmiran
d1f9006b8f
Add documentation to rz_version_str() (#2893) 2022-08-09 22:11:40 +08:00
billow
215e49253d
Fix windows and cpp compatibility (#2887) 2022-08-08 17:57:30 +02:00
Khairul Azhar Kasmiran
1c9f93f7ef
Move rz_str version funcs into version.c (#2890)
* Move rz_str version funcs into `version.c`
* Move func prototypes into `rz_util/rz_version.h`
* Use `rz_version_` prefix instead of `rz_str_`
2022-08-08 22:30:28 +08:00
Khairul Azhar Kasmiran
44e94af8a9
Add new API function rz_str_gittip() (#2884) 2022-08-07 13:33:59 +02:00
Khairul Azhar Kasmiran
dc8cd44db4
gittip: Use subprocess.PIPE instead for Python 3.6 compatibility (#2873) 2022-08-06 21:21:07 +08:00
Florian Märkl
b85636317c Drop libuv dependency
libuv was only ever used for the tcp server for almost 4 years. Since
the non-libuv implementation of that is working now, it can be dropped
entirely without sacrificing functionality.
2022-08-06 13:20:52 +02:00
Khairul Azhar Kasmiran
2588aa8a1a
gittip: Use Meson's capture: true for Python 3.6 compatibility (#2869) 2022-08-04 22:37:58 +08:00
billow
0908b65bc3
Convert px[ dDhHwWqQol] to rzshell
* `pxd` -> `pxd 4`
* `pxd<N> [len]` -> `pxd <N> [len]`
* expose APIs:
- `rz_core_print_cmp`
- `rz_core_print_dump`
- `rz_core_print_hexdump_`
- `rz_core_print_hexdump_byline`
* test for `pxW` `pxH`
* move `void rz_print_section` -> `const char *rz_print_section`
* `pxd` -> `pxd[ hwq]`
* `pxc`
* `pxAv` -> `pxAl`
* `pxt.` -> removed ?
* `px/` -> keep
* `pxf` -> TODO: not found old code ?
2022-08-04 09:11:22 +08:00
wingdeans
a6a7a5f530 Fix annotation inconsistencies 2022-08-03 00:29:56 -04:00
Dhruv Maroo
d44b5748eb
[RzIL] IL lifting of SuperH ISA (#2518)
* Add an assembler for the SuperH ISA
	* Rewrite GPL GNU disassembler code
2022-08-02 02:37:03 +05:30
Khairul Azhar Kasmiran
fc24887c5c
Update on every build the git hash shown by rizin -v (#2863) 2022-08-01 23:28:34 +08:00
Florian Märkl
f47ab1bc26
Skip including lzma.h if not available (#2858)
This fixes compilation with -Duse_lzma=false
2022-07-31 18:32:23 +02:00
Rot127
b9fa2be193
Asm tokens fixes (#2855)
* Replace on s390x failing tms320 c55x test with c55x+ test.

* Fix resource leaks of parse paramters.

* Revive unreachable code.

* Raplace test with one which has not a different asm string in Capstone v3.

* Rename `new` to `newt` since `new` is a keyword and should not be used as var name.
2022-07-30 21:24:49 +08:00