Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into bug/GateLibraryManager
Browse files Browse the repository at this point in the history
  • Loading branch information
neoneela committed Jan 11, 2025
2 parents 19f2703 + d248b0a commit ff88740
Show file tree
Hide file tree
Showing 1,083 changed files with 2,662,909 additions and 210,727 deletions.
3 changes: 2 additions & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ BraceWrapping:
BeforeCatch: true
BeforeElse: true
IndentBraces: false
InsertBraces: true
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeBraces: Custom
# BreakBeforeInheritanceComma: false
Expand Down Expand Up @@ -90,7 +91,7 @@ SpacesInContainerLiterals: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
Standard: c++17
TabWidth: 4
UseTab: Never
...
Binary file added .github/email-address-image.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 16 additions & 10 deletions .github/workflows/macOS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,18 @@ jobs:
run: |
mkdir -p build
cd build
export PATH="/usr/local/opt/qt@5/bin:$PATH"
ls ..
cmake -G Ninja .. -DQt5_DIR=/usr/local/opt/qt@5/lib/cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_ALL_PLUGINS=ON -DBUILD_TESTS=ON -DPL_GUI=ON -DCMAKE_C_COMPILER=/usr/local/opt/llvm@14/bin/clang -DCMAKE_CXX_COMPILER=/usr/local/opt/llvm@14/bin/clang++
export PATH="$(brew --prefix qt@5)/bin:$PATH"
brew ls llvm@14
brew --prefix llvm@14
ls -l /usr/local
ls -l /opt/homebrew/opt
ls -l /opt/homebrew/opt/llvm@14
ls -l /opt/homebrew/opt/llvm@14/bin
ls -l /opt/homebrew/opt/llvm@14/bin/clang
cmake -G Ninja .. -DQt5_DIR="$(brew --prefix qt@5)/lib/cmake" -DCMAKE_BUILD_TYPE=Debug -DBUILD_ALL_PLUGINS=ON -DBUILD_TESTS=ON -DPL_GUI=ON -DCMAKE_C_COMPILER=$(brew --prefix llvm@14)/bin/clang -DCMAKE_CXX_COMPILER=$(brew --prefix llvm@14)/bin/clang++
env:
LDFLAGS: "-L/usr/local/opt/qt@5/lib -L/usr/local/opt/llvm@14/lib -Wl,-rpath,/usr/local/opt/llvm@14/lib"
CPPFLAGS: "-I/usr/local/opt/llvm@14/include"
LDFLAGS: "-L$(brew --prefix qt@5)/lib -L$(brew --prefix llvm@14)/lib -Wl,-rpath,$(brew --prefix llvm@14)/lib"
CPPFLAGS: "-I$(brew --prefix llvm@14)/include"
HAL_BASE_PATH: ${{runner.workspace}}/hal/build
CCACHE_DIR: ${{runner.workspace}}/.ccache
CCACHE_COMPRESS: true
Expand All @@ -107,12 +113,12 @@ jobs:
# Execute the build. You can specify a specific target with "--target <NAME>"
run: |
cd build
export PATH="/usr/local/opt/qt/bin:$PATH"
export PATH="$(brew --prefix qt@5)/bin:$PATH"
export BUILD_TYPE=Debug
cmake --build . --target all --clean-first --config $BUILD_TYPE
env:
LDFLAGS: "-L/usr/local/opt/qt@5/lib -L/usr/local/opt/llvm@14/lib -Wl,-rpath,/usr/local/opt/llvm@14/lib"
CPPFLAGS: "-I/usr/local/opt/llvm@14/include"
LDFLAGS: "-L$(brew --prefix qt@5)/lib -L$(brew --prefix llvm@14)/lib -Wl,-rpath,$(brew --prefix llvm@14)/lib"
CPPFLAGS: "-I$(brew --prefix llvm@14)/include"
HAL_BASE_PATH: ${{runner.workspace}}/hal/build
CCACHE_DIR: ${{runner.workspace}}/.ccache
CCACHE_COMPRESS: true
Expand All @@ -133,8 +139,8 @@ jobs:
# ninja -v hal_coverage
# bash <(curl -s https://codecov.io/bash) -f hal_coverage.info.cleaned || echo "Codecov did not collect coverage reports"
env:
LDFLAGS: "-L/usr/local/opt/qt@5/lib -L/usr/local/opt/llvm@14/lib -Wl,-rpath,/usr/local/opt/llvm@14/lib"
CPPFLAGS: "-I/usr/local/opt/llvm@14/include"
LDFLAGS: "-L$(brew --prefix qt@5)/lib -L$(brew --prefix llvm@14)/lib -Wl,-rpath,$(brew --prefix llvm@14)/lib"
CPPFLAGS: "-I$(brew --prefix llvm@14)/include"
HAL_BASE_PATH: ${{runner.workspace}}/hal/build
CCACHE_DIR: ${{runner.workspace}}/.ccache
CCACHE_COMPRESS: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/releaseDoc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
matrix:
# runs-on: [ ubuntu-20.04, macOS-latest]
runs-on: [ ubuntu-20.04 ]
runs-on: [ ubuntu-22.04 ]
fail-fast: false

runs-on: ${{ matrix.runs-on }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Ubuntu 20.04
name: Ubuntu 24.04

on:
push:
Expand All @@ -7,13 +7,13 @@ on:
# - v*

jobs:
build_ubuntu_20_04:
name: Build and Test on Ubuntu 20.04
build_ubuntu_24_04:
name: Build and Test on Ubuntu 24.04

strategy:
matrix:
# runs-on: [ ubuntu-20.04, macOS-latest]
runs-on: [ ubuntu-20.04 ]
# runs-on: [ ubuntu-22.04, macOS-latest]
runs-on: [ ubuntu-24.04 ]
fail-fast: false

runs-on: ${{ matrix.runs-on }}
Expand Down
334 changes: 324 additions & 10 deletions CHANGELOG.md

Large diffs are not rendered by default.

15 changes: 13 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ option(HAL_VERSION_MAJOR "Pass major version via cmake options" "")
option(HAL_VERSION_MINOR "Pass minor version via cmake options" "")
option(HAL_VERSION_PATCH "Pass patch version via cmake options" "")
option(USE_LIBCXX "Force the use of LIBCXX for e.g. gcc" FALSE)
option(USE_VENDORED_PYBIND11 "Use vendored 'pybind11' Python library" ON)
option(USE_VENDORED_SPDLOG "Use vendored 'spdlog' library" ON)
option(USE_VENDORED_QUAZIP "Use vendored 'quazip' library" ON)
option(USE_VENDORED_IGRAPH "Use vendored 'igraph' library" ON)
option(USE_VENDORED_NLOHMANN_JSON "Use vendored 'nlohmann_json' library" ON)
option(BUILD_ALL_PLUGINS "Build all available plugins" OFF)
option(BUILD_TESTS "Enable test builds" OFF)
option(BUILD_COVERAGE "Enable code coverage build" OFF)
Expand Down Expand Up @@ -325,8 +330,14 @@ install(FILES tools/genversion.py
GROUP_EXECUTE
WORLD_READ
WORLD_EXECUTE)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/deps/pybind11 DESTINATION ${HAL_CMAKECONFIG_INSTALL_DIR})
install(DIRECTORY ${CMAKE_SOURCE_DIR}/deps/spdlog-1.5.0 DESTINATION ${HAL_CMAKECONFIG_INSTALL_DIR})
if(USE_VENDORED_PYBIND11)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/deps/pybind11 DESTINATION ${HAL_CMAKECONFIG_INSTALL_DIR})
endif()
if(USE_VENDORED_SPDLOG)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/deps/spdlog-${spdlog_VERSION} DESTINATION ${HAL_CMAKECONFIG_INSTALL_DIR})
endif()
install(DIRECTORY ${CMAKE_SOURCE_DIR}/deps/subprocess DESTINATION ${HAL_CMAKECONFIG_INSTALL_DIR})


if(NOT(CMAKE_VERSION VERSION_LESS 3.0))
install(EXPORT hal
Expand Down
2 changes: 1 addition & 1 deletion CURRENT_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.0.1
4.4.1
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ RUN apt-get update -y && \
apt-get install -y lsb-release

COPY . .
RUN ./install_dependencies.sh
RUN HAL_DOCKER=1 ./install_dependencies.sh

RUN mkdir build
WORKDIR ${hal_path}/build/
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Welcome to HAL!
[![Ubuntu 20.04](https://github.com/emsec/hal/actions/workflows/ubuntu20.04.yml/badge.svg)](https://github.com/emsec/hal/actions/workflows/ubuntu20.04.yml) [![Ubuntu 22.04](https://github.com/emsec/hal/actions/workflows/ubuntu22.04.yml/badge.svg)](https://github.com/emsec/hal/actions/workflows/ubuntu22.04.yml) [![macOS](https://github.com/emsec/hal/actions/workflows/macOS.yml/badge.svg)](https://github.com/emsec/hal/actions/workflows/macOS.yml) [![Deploy Documentation](https://github.com/emsec/hal/actions/workflows/releaseDoc.yml/badge.svg)](https://github.com/emsec/hal/actions/workflows/releaseDoc.yml) [![Doc: C++](https://img.shields.io/badge/doc-c%2B%2B-orange)](https://emsec.github.io/hal/doc/) [![Doc: Python](https://img.shields.io/badge/doc-python-red)](https://emsec.github.io/hal/pydoc/)
[![Ubuntu 22.04](https://github.com/emsec/hal/actions/workflows/ubuntu22.04.yml/badge.svg)](https://github.com/emsec/hal/actions/workflows/ubuntu22.04.yml) [![Ubuntu 24.04](https://github.com/emsec/hal/actions/workflows/ubuntu24.04.yml/badge.svg)](https://github.com/emsec/hal/actions/workflows/ubuntu24.04.yml) [![macOS](https://github.com/emsec/hal/actions/workflows/macOS.yml/badge.svg)](https://github.com/emsec/hal/actions/workflows/macOS.yml) [![Deploy Documentation](https://github.com/emsec/hal/actions/workflows/releaseDoc.yml/badge.svg)](https://github.com/emsec/hal/actions/workflows/releaseDoc.yml) [![Doc: C++](https://img.shields.io/badge/doc-c%2B%2B-orange)](https://emsec.github.io/hal/doc/) [![Doc: Python](https://img.shields.io/badge/doc-python-red)](https://emsec.github.io/hal/pydoc/)


HAL \[/hel/\] is a comprehensive netlist reverse engineering and manipulation framework.
Expand All @@ -15,6 +15,9 @@ HAL \[/hel/\] is a comprehensive netlist reverse engineering and manipulation fr
3. [Quickstart Guide](#quickstart)
4. [Academic Context](#academic-context)

<a name="introduction"></a>
# Introduction

## What the hell is HAL?
Virtually all available research on netlist analysis operates on a graph-based representation of the netlist under inspection.
At its core, HAL provides exactly that: A framework to parse netlists of arbitrary sources, e.g., FPGAs or ASICs, into a graph-based netlist representation and to provide the necessary built-in tools for traversal and analysis of the included gates and nets.
Expand All @@ -27,7 +30,7 @@ We want HAL to enable a common baseline for researchers and analysts to improve
- **Stability** is ensured via a rich test suite

HAL is actively developed by the Embedded Security group of the [Max Planck Institute for Security and Privacy](https://www.mpi-sp.org).
Apart from multiple research projects, it is also used in our university lecture [Introduction to Hardware Reverse Engineering](https://www.ei.ruhr-uni-bochum.de/studium/lehrveranstaltungen/832/).
Apart from multiple research projects, it is also used in our university lecture "Einführung ins Hardware Reverse Engineering" (Introduction to Hardware Reverse Engineering) at Ruhr University Bochum (RUB).

Note that we also have a set of **modern** state-of-the-art benchmark circuits for the evaluation of netlist reverse engineering techniques available in a seperate [repository](https://github.com/emsec/hal-benchmarks).

Expand All @@ -51,9 +54,6 @@ This repository contains a selection of curated plugins:
## Documentation
A comprehensive documentation of HAL's features from a user perspective is available in our [Wiki](https://github.com/emsec/hal/wiki). In addition, we provide a full [C++ API](https://emsec.github.io/hal/doc/) and [Python API](https://emsec.github.io/hal/pydoc/) documentation.

## Slack, Contact and Support
For all kinds of inquiries, please contact us using our dedicated e-mail address: [[email protected]](mailto:[email protected]). To receive an invite to our dedicated hal-support Slack workspace, please write us an e-mail as well.

<a name="build-instructions"></a>
# Build Instructions

Expand Down
38 changes: 31 additions & 7 deletions app/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
#include "hal_core/netlist/persistent/netlist_serializer.h"
#include "hal_core/netlist/project_manager.h"
#include "hal_core/plugin_system/plugin_interface_base.h"
#include "hal_core/plugin_system/plugin_interface_cli.h"
#include "hal_core/plugin_system/plugin_interface_ui.h"
#include "hal_core/plugin_system/cli_extension_interface.h"
#include "hal_core/plugin_system/plugin_manager.h"
#include "hal_core/utilities/log.h"
#include "hal_core/utilities/program_arguments.h"
Expand Down Expand Up @@ -102,8 +102,24 @@ int main(int argc, const char* argv[])
lm->deactivate_all_channels();
}

if (!plugin_manager::load_all_plugins())
plugin_manager::load("hal_gui");
// We need to check at an early stage (before CLI options are parsed) whether GUI will take control over HAL.
// if yes : User determines which plugins get loaded
// if no : Need to load all plugins to have full range of CLI options available
bool guictrl = false;
auto ui_plugin_flags = plugin_manager::get_ui_plugin_flags();
for (int i=1; i<argc; i++)
{
std::string option(argv[i]);
auto it = ui_plugin_flags.find(option);
if (it != ui_plugin_flags.end()) {
guictrl = true;
break;
}
}
if (!guictrl && !plugin_manager::load_all_plugins())
{
// error loading all plugins
return cleanup(ERROR);
}

Expand Down Expand Up @@ -176,7 +192,9 @@ int main(int argc, const char* argv[])

ProgramArguments plugin_args;

for (const auto& option : plugin->get_cli_options().get_options())
CliExtensionInterface* ceif = plugin->get_first_extension<CliExtensionInterface>();
if (ceif)
for (const auto& option : ceif->get_cli_options().get_options())
{
auto flags = std::get<0>(option);
auto first_flag = *flags.begin();
Expand Down Expand Up @@ -333,15 +351,21 @@ int main(int argc, const char* argv[])
bool plugins_successful = true;
for (const auto& plugin_name : plugins_to_execute)
{
auto plugin = plugin_manager::get_plugin_instance<CLIPluginInterface>(plugin_name);
if (plugin == nullptr)
BasePluginInterface* plugin = plugin_manager::get_plugin_instance(plugin_name);
if (!plugin)
{
return cleanup(ERROR);
}

CliExtensionInterface* ceif = plugin_manager::get_first_extension<CliExtensionInterface>(plugin_name);
if (!ceif)
{
return cleanup(ERROR);
}

ProgramArguments plugin_args;

for (const auto& option : plugin->get_cli_options().get_options())
for (const auto& option : ceif->get_cli_options().get_options())
{
auto flags = std::get<0>(option);
auto first_flag = *flags.begin();
Expand All @@ -357,7 +381,7 @@ int main(int argc, const char* argv[])
log_info("core", " '{}': {}", option, utils::join(",", plugin_args.get_parameters(option)));
}

if (!plugin->handle_cli_call(netlist.get(), plugin_args))
if (!ceif->handle_cli_call(netlist.get(), plugin_args))
{
plugins_successful = false;
break;
Expand Down
75 changes: 0 additions & 75 deletions cmake/FindIGraph.cmake

This file was deleted.

Loading

0 comments on commit ff88740

Please sign in to comment.