Skip to content

Commit

Permalink
initial HAWKEYE commit
Browse files Browse the repository at this point in the history
  • Loading branch information
SJulianS committed May 13, 2024
1 parent 7c5f200 commit 3439f4b
Show file tree
Hide file tree
Showing 6 changed files with 204 additions and 4 deletions.
10 changes: 6 additions & 4 deletions plugins/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,16 @@
!gui/**/*
!gui_extension_demo*
!gui_extension_demo/**/*
!liberty_parser*
!liberty_parser/**/*
!netlist_preprocessing*
!netlist_preprocessing/**/*
!hawkeye*
!hawkeye/**/*
!hgl_parser*
!hgl_parser/**/*
!hgl_writer*
!hgl_writer/**/*
!liberty_parser*
!liberty_parser/**/*
!netlist_preprocessing*
!netlist_preprocessing/**/*
!python_shell*
!python_shell/**/*
!simulator
Expand Down
18 changes: 18 additions & 0 deletions plugins/hawkeye/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
option(PL_HAWKEYE "PL_HAWKEYE" ON)

if(PL_HAWKEYE OR BUILD_ALL_PLUGINS)

file(GLOB_RECURSE HAWKEYE_INC ${CMAKE_CURRENT_SOURCE_DIR}/include/*.h)
file(GLOB_RECURSE HAWKEYE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp)
file(GLOB_RECURSE HAWKEYE_PYTHON_SRC ${CMAKE_CURRENT_SOURCE_DIR}/python/*.cpp)

hal_add_plugin(hawkeye
SHARED
HEADER ${HAWKEYE_INC}
SOURCES ${HAWKEYE_SRC} ${HAWKEYE_PYTHON_SRC}
PYDOC SPHINX_DOC_INDEX_FILE ${CMAKE_CURRENT_SOURCE_DIR}/documentation/hawkeye.rst
LINK_LIBRARIES graph_algorithm
COMPILE_OPTIONS "-march=native"
)

endif()
2 changes: 2 additions & 0 deletions plugins/hawkeye/documentation/hawkeye.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
HAWKEYE
==========================
72 changes: 72 additions & 0 deletions plugins/hawkeye/include/hawkeye/plugin_hawkeye.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
// MIT License
//
// Copyright (c) 2019 Ruhr University Bochum, Chair for Embedded Security. All Rights reserved.
// Copyright (c) 2019 Marc Fyrbiak, Sebastian Wallat, Max Hoffmann ("ORIGINAL AUTHORS"). All rights reserved.
// Copyright (c) 2021 Max Planck Institute for Security and Privacy. All Rights reserved.
// Copyright (c) 2021 Jörn Langheinrich, Julian Speith, Nils Albartus, René Walendy, Simon Klix ("ORIGINAL AUTHORS"). All Rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

#pragma once

#include "hal_core/plugin_system/plugin_interface_base.h"

namespace hal
{
class Gate;
class Netlist;

class PLUGIN_API HawkeyePlugin : public BasePluginInterface
{
public:
/*
* interface implementations
*/

HawkeyePlugin();
~HawkeyePlugin() = default;

/**
* Get the name of the plugin.
*
* @returns The name of the plugin.
*/
std::string get_name() const override;

/**
* Get short description for plugin.
*
* @return The short description.
*/
std::string get_description() const override;

/**
* Get the version of the plugin.
*
* @returns The version of the plugin.
*/
std::string get_version() const override;

/**
* Get plugin dependencies.
* @return Set of plugins that this plugin depends on.
*/
std::set<std::string> get_dependencies() const override;
};
} // namespace hal
71 changes: 71 additions & 0 deletions plugins/hawkeye/python/python_bindings.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#include "hal_core/python_bindings/python_bindings.h"

#include "hawkeye/plugin_hawkeye.h"
#include "pybind11/operators.h"
#include "pybind11/pybind11.h"
#include "pybind11/stl.h"
#include "pybind11/stl_bind.h"

namespace py = pybind11;

namespace hal
{

// the name in PYBIND11_MODULE/PYBIND11_PLUGIN *MUST* match the filename of the output library (without extension),
// otherwise you will get "ImportError: dynamic module does not define module export function" when importing the module

#ifdef PYBIND11_MODULE
PYBIND11_MODULE(hawkeye, m)
{
m.doc() = "hal HawkeyePlugin python bindings";
#else
PYBIND11_PLUGIN(hawkeye)
{
py::module m("hawkeye", "hal HawkeyePlugin python bindings");
#endif // ifdef PYBIND11_MODULE

py::class_<HawkeyePlugin, RawPtrWrapper<HawkeyePlugin>, BasePluginInterface> py_hawkeye_plugin(m, "HawkeyePlugin");
py_hawkeye_plugin.def_property_readonly("name", &HawkeyePlugin::get_name, R"(
The name of the plugin.
:type: str
)");

py_hawkeye_plugin.def("get_name", &HawkeyePlugin::get_name, R"(
Get the name of the plugin.
:returns: Plugin name.
:rtype: str
)");

py_hawkeye_plugin.def_property_readonly("description", &HawkeyePlugin::get_description, R"(
The description of the plugin.
:type: str
)");

py_hawkeye_plugin.def("get_description", &HawkeyePlugin::get_description, R"(
Get the description of the plugin.
:returns: The description of the plugin.
:rtype: str
)");

py_hawkeye_plugin.def_property_readonly("version", &HawkeyePlugin::get_version, R"(
The version of the plugin.
:type: str
)");

py_hawkeye_plugin.def("get_version", &HawkeyePlugin::get_version, R"(
Get the version of the plugin.
:returns: Plugin version.
:rtype: str
)");

#ifndef PYBIND11_MODULE
return m.ptr();
#endif // PYBIND11_MODULE
}
} // namespace hal
35 changes: 35 additions & 0 deletions plugins/hawkeye/src/plugin_hawkeye.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#include "hawkeye/plugin_hawkeye.h"

namespace hal
{
extern std::unique_ptr<BasePluginInterface> create_plugin_instance()
{
return std::make_unique<HawkeyePlugin>();
}

std::string HawkeyePlugin::get_name() const
{
return std::string("hawkeye");
}

std::string HawkeyePlugin::get_description() const
{
return "Attempts to locate arbitrary symmetric cryptographic implementations.";
}

std::string HawkeyePlugin::get_version() const
{
return std::string("0.1");
}

std::set<std::string> HawkeyePlugin::get_dependencies() const
{
std::set<std::string> retval;
retval.insert("graph_algorithm");
return retval;
}

HawkeyePlugin::HawkeyePlugin()
{
}
} // namespace hal

0 comments on commit 3439f4b

Please sign in to comment.