Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
e01d7d6
add google* to .gitignore
hpdic Jul 30, 2023
a8d01fa
Merge branch 'openfheorg:main' into main
Jun 15, 2024
c9c76d0
simple hpdic mark on examples
Jun 15, 2024
24c2973
test "make -j 16"
Jun 15, 2024
889a910
fix chameleoncloud .h error
Jul 7, 2024
98191e5
Merge branch 'openfheorg:main' into main
Dec 3, 2024
2ea04df
get rid of 3rd-party libs
Dec 4, 2024
48cc598
add cnpy lib; update cmake files; starting Nemesis
Dec 5, 2024
99441ab
ready to encrypt local models
Dec 14, 2024
f141177
we can do pair-wise multiplication...
Dec 15, 2024
b2b604f
found the key file to edit
Dec 15, 2024
47d8773
found the place for const-multiplication
Dec 15, 2024
c2f0f9f
so hard to get it work
Dec 15, 2024
610e86e
nemesis works for a single slot!
Dec 15, 2024
11f08b4
implementation done; ready for experiments
Dec 15, 2024
05648b7
ok batch caching is fine
Dec 15, 2024
296c1f8
started working on CKKS
Dec 16, 2024
ba78e24
nemesis CKKS also works
Dec 17, 2024
d711398
load ML model weights; expand base length
Dec 17, 2024
e30b6fc
nemesis mnist works
Dec 17, 2024
86854cc
baseline comparison is done
Dec 17, 2024
8e1997a
overhead experiment done
Dec 17, 2024
0ded0b0
working on reconstruction and randomization
Dec 17, 2024
28d3fb3
I think we are done, aren't we?
Dec 18, 2024
805ac7e
remove debug message
Dec 24, 2024
1d160da
Merge branch 'openfheorg:main' into main
May 8, 2025
ae97b3b
add ChameleonCloud instruction
May 16, 2025
938b616
minimal hermes compiled!
May 22, 2025
012fb12
0-parameter OpenFHE works fine for MySQL
May 22, 2025
99e814e
0-parameter fully tested for BFV
May 23, 2025
84b3164
update cmakelists to compile all UDFs
May 23, 2025
c7291d5
single cell encryption is done
May 24, 2025
77561f4
create employee_enc table
May 24, 2025
a1e8d5f
persist encrypted salary into another table
May 24, 2025
84d8afc
singular decryption is done
May 24, 2025
3190121
singular BFV is done
May 24, 2025
d1c4e9e
start cloudlab dev
hpdic Nov 3, 2025
eb107eb
update readme
hpdic Nov 3, 2025
7d78676
remove mysql plugin
hpdic Nov 4, 2025
53bc160
cloudlab readme done
hpdic Nov 4, 2025
5f77ac1
update vscode debugger
hpdic Nov 7, 2025
f235c1c
minor update of make cores
hpdic Nov 9, 2025
469c7e8
update readme
hpdic Nov 9, 2025
15fd2e6
Fix directory path for openFHE installation
hpdic Nov 10, 2025
f7b4368
minor
hpdic Nov 10, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ _build/
api/
doxyoutput/

third-party/

.ipynb_checkpoints

Expand All @@ -20,6 +21,7 @@ test/bin
output.txt
Doxyfile
apidoc_warning_logfile.txt
third-party
third-party/distros/gmp-6.1.1
third-party/distros/gmp-6.1.2
third-party/distros/ntl-10.3.0
Expand All @@ -42,6 +44,7 @@ gmon.out
*.class

## for the moment
.cache
.cproject
.metadata/
.project
Expand Down
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ endif()

project (OpenFHE C CXX)

# 添加 cnpy 和 zlib 的路径
include_directories(/usr/local/include/)
link_directories(/usr/local/lib/)
# 定义公共的链接库变量
set(GLOBAL_LIBS cnpy z)

set(OPENFHE_VERSION_MAJOR 1)
set(OPENFHE_VERSION_MINOR 2)
set(OPENFHE_VERSION_PATCH 4)
Expand Down
76 changes: 76 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,79 @@
HPDIC MOD
=========
* Setup on CloudLab, Ubuntu-24 (11/3/2025):
* Prepare the system
```bash
cd
sudo apt update
sudo apt install cmake -y
sudo apt install zlib1g-dev
sudo apt install gdb -y
git config --global user.name "Dongfang Zhao"
git config --global user.email "dongfang.zhao@gmail.com"
ssh-keygen
```
Upload the public key to Github
* Install cnpy
```bash
cd
git clone https://github.com/hpdic/cnpy.git
cd ~/cnpy
mkdir build && cd build
cmake ..
make -j$(nproc)
sudo make install
```
* Install openFHE
```bash
cd
git clone git@github.com:hpdic/openfhe-development.git
cd ~/openfhe-development
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS_DEBUG="-g -O0" -DBUILD_UNITTESTS=OFF ..
make -j$(nproc)
sudo make install
```
* Test OpenFHE
```bash
cd ~/openfhe-development/build
./bin/examples/pke/simple-integers
```
* Debug OpenFHE on VSCode
```bash
cp -r ~/openfhe-development/vscode_setup ~/.vscode
```
* Steup on ChameleonCloud (5/16/2025):
* Update system
```
sudo apt update
sudo apt install cmake
```
* Install cnpy
```
cd
git clone https://github.com/hpdic/cnpy.git
cd cnpy
mkdir build && cd build
cmake ..
make -j 16
sudo make install
```
* Install OpenFHE
```
cd ~/github/openfhe-development
mkdir build && cd build
cmake ..
make -j 16
sudo make install
```
* Test OpenFHE
```
cd ~/github/openfhe-development/build
./bin/examples/pke/simple-integers
```
* VS Code setup:
* On ChameleonCloud, if VS Code complains about missing header files, then open C/C++ configuration and set the compiler to '/usr/bin/g++-11'

OpenFHE - Open-Source Fully Homomorphic Encryption Library
=====================================

Expand Down
1,568 changes: 1,568 additions & 0 deletions compile_commands.json

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions src/binfhe/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,23 +45,23 @@ add_custom_target( allbinfhe )

if( BUILD_SHARED )
set (BINFHELIBS PUBLIC OPENFHEbinfhe PUBLIC OPENFHEcore ${THIRDPARTYLIBS} ${OpenMP_CXX_FLAGS})
target_link_libraries (OPENFHEbinfhe PUBLIC OPENFHEcore ${THIRDPARTYLIBS} ${OpenMP_CXX_FLAGS} ${ADDITIONAL_LIBS})
target_link_libraries (OPENFHEbinfhe PUBLIC OPENFHEcore ${THIRDPARTYLIBS} ${OpenMP_CXX_FLAGS} ${ADDITIONAL_LIBS} ${GLOBAL_LIBS})
add_dependencies( allbinfhe OPENFHEbinfhe )
endif()

if( BUILD_STATIC )
set (BINFHELIBS ${BINFHELIBS} PUBLIC OPENFHEbinfhe_static PUBLIC OPENFHEcore_static ${THIRDPARTYSTATICLIBS} ${OpenMP_CXX_FLAGS})
target_link_libraries (OPENFHEbinfhe_static PUBLIC OPENFHEcore_static ${THIRDPARTYSTATICLIBS} ${OpenMP_CXX_FLAGS} ${ADDITIONAL_LIBS})
target_link_libraries (OPENFHEbinfhe_static PUBLIC OPENFHEcore_static ${THIRDPARTYSTATICLIBS} ${OpenMP_CXX_FLAGS} ${ADDITIONAL_LIBS} ${GLOBAL_LIBS})
add_dependencies( allbinfhe OPENFHEbinfhe_static )
endif()

if( BUILD_UNITTESTS )
file (GLOB BINFHE_TEST_SRC_FILES CONFIGURE_DEPENDS unittest/*.cpp)
add_executable (binfhe_tests ${BINFHE_TEST_SRC_FILES} ${UNITTESTMAIN})
set_property(TARGET binfhe_tests PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/unittest)
target_link_libraries ( binfhe_tests ${BINFHELIBS} ${ADDITIONAL_LIBS})
target_link_libraries ( binfhe_tests ${BINFHELIBS} ${ADDITIONAL_LIBS} ${GLOBAL_LIBS})
if (NOT ${WITH_OPENMP})
target_link_libraries ( binfhe_tests PRIVATE Threads::Threads)
target_link_libraries ( binfhe_tests PRIVATE Threads::Threads ${GLOBAL_LIBS})
endif()

add_dependencies( allbinfhe binfhe_tests )
Expand All @@ -78,7 +78,7 @@ if( BUILD_EXAMPLES)
add_executable ( ${exe} ${app} )
set_property(TARGET ${exe} PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/examples/binfhe)
set( BINFHEAPPS ${BINFHEAPPS} ${exe} )
target_link_libraries ( ${exe} ${BINFHELIBS} ${ADDITIONAL_LIBS})
target_link_libraries ( ${exe} ${BINFHELIBS} ${ADDITIONAL_LIBS} ${GLOBAL_LIBS})
endforeach()

file (GLOB BINFHE_EXAMPLES_SRC_FILES CONFIGURE_DEPENDS examples/pke/*.cpp)
Expand All @@ -87,7 +87,7 @@ if( BUILD_EXAMPLES)
add_executable ( ${exe} ${app} )
set_property(TARGET ${exe} PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/examples/binfhe/pke)
set( BINFHEAPPS ${BINFHEAPPS} ${exe} )
target_link_libraries ( ${exe} ${BINFHELIBS} ${ADDITIONAL_LIBS})
target_link_libraries ( ${exe} ${BINFHELIBS} ${ADDITIONAL_LIBS} ${GLOBAL_LIBS})
endforeach()

add_custom_target( allbinfheexamples )
Expand Down
12 changes: 6 additions & 6 deletions src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ add_custom_target( allcore )

if( BUILD_SHARED )
set (CORELIBS PUBLIC OPENFHEcore ${THIRDPARTYLIBS} ${OpenMP_CXX_FLAGS})
target_link_libraries (OPENFHEcore ${THIRDPARTYLIBS} ${OpenMP_CXX_FLAGS} ${ADDITIONAL_LIBS})
target_link_libraries (OPENFHEcore ${THIRDPARTYLIBS} ${OpenMP_CXX_FLAGS} ${ADDITIONAL_LIBS} ${GLOBAL_LIBS})
add_dependencies( allcore OPENFHEcore)
endif()

if( BUILD_STATIC )
set (CORELIBS ${CORELIBS} PUBLIC OPENFHEcore_static ${THIRDPARTYSTATICLIBS} ${OpenMP_CXX_FLAGS})
target_link_libraries (OPENFHEcore_static ${THIRDPARTYSTATICLIBS} ${OpenMP_CXX_FLAGS} ${ADDITIONAL_LIBS})
target_link_libraries (OPENFHEcore_static ${THIRDPARTYSTATICLIBS} ${OpenMP_CXX_FLAGS} ${ADDITIONAL_LIBS} ${GLOBAL_LIBS})
add_dependencies( allcore OPENFHEcore_static)
endif()

Expand All @@ -66,9 +66,9 @@ if( BUILD_UNITTESTS )
set (CORE_TEST_SRC_FILES ${CORE_TEST_SRC_FILES})
add_executable( core_tests ${CORE_TEST_SRC_FILES} ${UNITTESTMAIN} )
set_property(TARGET core_tests PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/unittest)
target_link_libraries ( core_tests ${CORELIBS} ${ADDITIONAL_LIBS})
target_link_libraries ( core_tests ${CORELIBS} ${ADDITIONAL_LIBS} ${GLOBAL_LIBS})
if (NOT ${WITH_OPENMP})
target_link_libraries ( core_tests PRIVATE Threads::Threads)
target_link_libraries ( core_tests PRIVATE Threads::Threads ${GLOBAL_LIBS})
endif()

add_dependencies( allcore core_tests )
Expand All @@ -89,7 +89,7 @@ if ( BUILD_EXAMPLES )
add_executable ( ${exe} ${app} )
set_property(TARGET ${exe} PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/examples/core)
set( COREAPPS ${COREAPPS} ${exe} )
target_link_libraries ( ${exe} ${CORELIBS} ${ADDITIONAL_LIBS})
target_link_libraries ( ${exe} ${CORELIBS} ${ADDITIONAL_LIBS} ${GLOBAL_LIBS})
endforeach()

add_custom_target( allcoreexamples )
Expand All @@ -105,7 +105,7 @@ if (BUILD_EXTRAS)
add_executable ( ${exe} ${app} )
set_property(TARGET ${exe} PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/extras/core)
set( COREEXTRAS ${COREEXTRAS} ${exe} )
target_link_libraries ( ${exe} ${CORELIBS} ${ADDITIONAL_LIBS})
target_link_libraries ( ${exe} ${CORELIBS} ${ADDITIONAL_LIBS} ${GLOBAL_LIBS})
endforeach()

add_custom_target( allcoreextras )
Expand Down
65 changes: 59 additions & 6 deletions src/pke/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ add_custom_target( allpke )

if( BUILD_SHARED )
set (PKELIBS PUBLIC OPENFHEpke PUBLIC OPENFHEcore PUBLIC OPENFHEbinfhe ${THIRDPARTYLIBS} ${OpenMP_CXX_FLAGS})
target_link_libraries (OPENFHEpke PUBLIC OPENFHEcore PUBLIC OPENFHEbinfhe ${THIRDPARTYLIBS} ${OpenMP_CXX_FLAGS} ${ADDITIONAL_LIBS})
target_link_libraries (OPENFHEpke PUBLIC OPENFHEcore PUBLIC OPENFHEbinfhe ${THIRDPARTYLIBS} ${OpenMP_CXX_FLAGS} ${ADDITIONAL_LIBS} ${GLOBAL_LIBS})
add_dependencies( allpke OPENFHEpke)
endif()

if( BUILD_STATIC )
set (PKELIBS ${PKELIBS} PUBLIC OPENFHEpke_static PUBLIC OPENFHEcore_static PUBLIC OPENFHEbinfhe_static ${THIRDPARTYLIBS} ${OpenMP_CXX_FLAGS})
target_link_libraries (OPENFHEpke_static PUBLIC OPENFHEcore_static PUBLIC OPENFHEbinfhe_static ${THIRDPARTYSTATICLIBS} ${OpenMP_CXX_FLAGS} ${ADDITIONAL_LIBS})
target_link_libraries (OPENFHEpke_static PUBLIC OPENFHEcore_static PUBLIC OPENFHEbinfhe_static ${THIRDPARTYSTATICLIBS} ${OpenMP_CXX_FLAGS} ${ADDITIONAL_LIBS} ${GLOBAL_LIBS})
add_dependencies( allpke OPENFHEpke_static)
endif()

Expand All @@ -65,9 +65,9 @@ if( BUILD_UNITTESTS )
set_property(TARGET pke_tests PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/unittest)
target_include_directories(pke_tests PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/unittest")
target_include_directories(pke_tests PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/unittest/utils")
target_link_libraries ( pke_tests ${PKELIBS} ${ADDITIONAL_LIBS})
target_link_libraries ( pke_tests ${PKELIBS} ${ADDITIONAL_LIBS} ${GLOBAL_LIBS})
if (NOT ${WITH_OPENMP} )
target_link_libraries ( pke_tests PRIVATE Threads::Threads)
target_link_libraries ( pke_tests PRIVATE Threads::Threads ${GLOBAL_LIBS})
endif()
add_dependencies( allpke pke_tests )

Expand All @@ -83,7 +83,7 @@ if ( BUILD_EXAMPLES)
add_executable ( ${exe} ${app} )
set_property(TARGET ${exe} PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/examples/pke)
set( PKEAPPS ${PKEAPPS} ${exe} )
target_link_libraries ( ${exe} ${PKELIBS} ${ADDITIONAL_LIBS})
target_link_libraries ( ${exe} ${PKELIBS} ${ADDITIONAL_LIBS} ${GLOBAL_LIBS})
endforeach()

add_custom_target( allpkeexamples )
Expand All @@ -99,7 +99,7 @@ if (BUILD_EXTRAS)
add_executable (${exe} ${app} )
set_property(TARGET ${exe} PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/extras/pke)
set( PKEEXTRAS ${PKEEXTRAS} ${exe} )
target_link_libraries ( ${exe} ${PKELIBS} ${ADDITIONAL_LIBS})
target_link_libraries ( ${exe} ${PKELIBS} ${ADDITIONAL_LIBS} ${GLOBAL_LIBS})
endforeach()

add_custom_target( allpkeextras )
Expand All @@ -120,3 +120,56 @@ if( BUILD_STATIC )
get_target_property(_compile_defs_static OPENFHEpke_static COMPILE_DEFINITIONS)
set(_pal_pke_compile_defs_static ${_compile_defs_static} PARENT_SCOPE)
endif()

# === HPDIC MOD: MySQL UDF Plugin ===
# add_library(hpdic_hermes SHARED udf/hpdic_hermes.cpp)

# target_include_directories(hpdic_hermes PRIVATE
# ${PKE_INCLUDE_DIRS}
# ${CORE_INCLUDE_DIRS}
# /usr/include/mysql
# )

# target_link_libraries(hpdic_hermes
# PUBLIC OPENFHEpke
# PUBLIC OPENFHEcore
# PUBLIC OPENFHEbinfhe
# ${THIRDPARTYLIBS}
# ${OpenMP_CXX_FLAGS}
# )

# set_target_properties(hpdic_hermes PROPERTIES
# LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib/mysqlplugin
# )
file(GLOB UDF_SOURCES "udf/*.cpp")
set(FORCE_SERIALIZATION_SRC udf/force_serialization_link.cpp)

foreach(udf_src ${UDF_SOURCES})
# 跳过 force_serialization_link.cpp 自身(它不是主插件)
if(udf_src STREQUAL ${FORCE_SERIALIZATION_SRC})
continue()
endif()

get_filename_component(udf_name ${udf_src} NAME_WE)

# 👇 关键:每个插件 .so 都加上这个 cpp 作为链接输入
add_library(${udf_name} SHARED ${udf_src} ${FORCE_SERIALIZATION_SRC})

target_include_directories(${udf_name} PRIVATE
${PKE_INCLUDE_DIRS}
${CORE_INCLUDE_DIRS}
/usr/include/mysql
)

target_link_libraries(${udf_name}
PUBLIC OPENFHEpke
PUBLIC OPENFHEcore
PUBLIC OPENFHEbinfhe
${THIRDPARTYLIBS}
${OpenMP_CXX_FLAGS}
)

set_target_properties(${udf_name} PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib/mysqlplugin
)
endforeach()
2 changes: 2 additions & 0 deletions src/pke/examples/depth-bfvrns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,5 +310,7 @@ int main(int argc, char* argv[]) {
std::cout << "\nResult of 3 homomorphic multiplications: \n";
std::cout << plaintextDecMult123 << std::endl;

std::cout << "===HPDIC MOD===" << std::endl;

return 0;
}
Loading