/GPQHE

A C library doing fully homomorphic encryption under the license of LGPL.

Primary LanguageCGNU Lesser General Public License v2.1LGPL-2.1

GPQHE

GPQHE is a reference implementation of CKKS homomorphic encryption scheme. It is a free software under the terms of LGNU v2.1, and its architecture is designed analog to CKKS’s HEAAN and two NIST PQC submissions NewHope & Crystal-Kyber.

Description

The virtues of GPQHE includes

  • Except using Libgcrypt (the cryptographic library in Linux kernel) for multi-precision integer (MPI) management, it does not rely on any existing HE libraries;
  • Support NTT and MPI-RNS (residual number system) conversion in polynomial multiplication;
  • Support basic HE primitives, linear transformation, digits extraction, nonlinear functions and ciphertext comparison;
  • Purely written in C, and utilize linked-list for context parameters management;
  • Valgrind is used to guarantee that no memory leakage is possible.

The architecture of a typical RLWE (that utilizing RNS in polynomial arithmetics)

RLWE architecture

The standard HE workflow:

HE workflow

The supported algorithms in GPQHE:

Supported algorithms in GPQHE

Package dependency

libgcrypt 1.10. This library is used in Linux kernel, and we utilize its mpi (multi-precision integer) module in GPQHE. If your system does not have it, do sudo apt install libgcrypt11-dev.

How to use

# step 1: get GPQHE and build
git clone https://github.com/OChicken/GPQHE.git
cd GPQHE
git submodule init
git submodule update
mkdir -p lib
make

# step 2: run tests
cd tests
LD_LIBRARY_PATH=$PWD/../lib:$LD_LIBRARY_PATH
make test-gpqhe
./test-gpqhe enc sk
./test-gpqhe mul pk

Remarks

  1. For KAT (known answer tests), we use compiler option -DSUPERCOP in src/Makefile to deterministic generate random numbers. To fully support true rng, change it to -DRANDOM.

  2. tests/polymul.gp is a PARI/GP script file to verify correctness of polynomial multiplication.

Acknowledgement

This library is developed upon HEAAN, NewHope and Kyber. We show gratefulness to the developers.