Sfoglia il codice sorgente

Initial binfhe bindings

Rener Oliveira (Ubuntu WSL) 1 anno fa
parent
commit
f902121bec
4 ha cambiato i file con 37 aggiunte e 1 eliminazioni
  1. 8 1
      CMakeLists.txt
  2. 9 0
      include/binfhe_bindings.h
  3. 2 0
      src/bindings.cpp
  4. 18 0
      src/binfhe_bindings.cpp

+ 8 - 1
CMakeLists.txt

@@ -16,6 +16,7 @@ include_directories( ${OpenFHE_INCLUDE} )
 include_directories( ${OpenFHE_INCLUDE}/third-party/include )
 include_directories( ${OpenFHE_INCLUDE}/core )
 include_directories( ${OpenFHE_INCLUDE}/pke )
+include_directories( ${OpenFHE_INCLUDE}/binfhe )
 # include_directories( ${OpenFHE_Py_SOURCES} )
 include_directories( ${OpenFHE_Py_INCLUDES}/pke )
 include_directories( ${OpenFHE_Py_INCLUDES} )
@@ -38,7 +39,13 @@ endif()
 ### add_executable( test demo-simple-example.cpp )
 
 ### Pybind Modules
-pybind11_add_module(openfhe src/bindings.cpp src/pke/decryption.cpp src/pke/serialization.cpp src/pke/cryptocontext_wrapper.cpp)
+pybind11_add_module(openfhe 
+                    src/bindings.cpp 
+                    src/binfhe_bindings.cpp
+                    src/pke/decryption.cpp 
+                    src/pke/serialization.cpp 
+                    src/pke/cryptocontext_wrapper.cpp
+                    )
 ### Python installation 
 find_package(Python REQUIRED COMPONENTS Interpreter Development)
 

+ 9 - 0
include/binfhe_bindings.h

@@ -0,0 +1,9 @@
+#ifndef BINFHE_BINDINGS_H
+#define BINFHE_BINDINGS_H
+
+#include <pybind11/pybind11.h>
+
+void bind_binfhe_enums(pybind11::module &m);
+void bind_binfhe_context(pybind11::module &m);
+
+#endif // BINFHE_BINDINGS_H

+ 2 - 0
src/bindings.cpp

@@ -7,6 +7,7 @@
 #include "key/key-ser.h"
 #include "bindings.h"
 #include "cryptocontext_wrapper.h"
+#include "binfhe_bindings.h"
 
 using namespace lbcrypto;
 namespace py = pybind11;
@@ -289,4 +290,5 @@ PYBIND11_MODULE(openfhe, m)
     bind_decryption(m);
     bind_serialization(m);
     bind_schemes(m);
+    bind_binfhe_context(m);
 }

+ 18 - 0
src/binfhe_bindings.cpp

@@ -0,0 +1,18 @@
+#include <pybind11/pybind11.h>
+#include <iostream>
+#include "openfhe.h"
+#include "binfhe_bindings.h"
+#include "binfhecontext.h"
+
+using namespace lbcrypto;
+namespace py = pybind11;
+
+void bind_binfhe_enums(py::module &m) {
+    //just print hello world
+    std::cout << "Hello World!" << std::endl;
+}
+
+void bind_binfhe_context(py::module &m) {
+    py::class_<BinFHEContext>(m,"BinFHEContext")
+        .def(py::init<>());
+}