Skip to content
forked from Varad0612/SGX-LR

Privacy Preserving Logistic Regression Using Functional Encryption and Secure Hardware

Notifications You must be signed in to change notification settings

azaini49/SGX-LR

 
 

Repository files navigation

INSTALL LOCAL

wget https://download.01.org/intel-sgx/sgx-linux/2.13/distro/ubuntu20.04-server/sgx_linux_x64_sdk_2.13.100.4.bin
chmod a+x sgx_linux_x64_sdk_2.13.100.4.bin
./sgx_linux_x64_sdk_2.13.100.4.bin
  • Source environment variables according to instructions
  • Get modified SGX GMP
mkdir sgxgmp_build
git clone https://github.com/intel/sgx-gmp.git
cd sgx-gmp
./configure --enable-cxx --enable-sgx --enable-static --disable-shared --enable-assembly --prefix=../sgxgmp_build
make
make install
  • Clone SGX-LR
  • Change SGX-LR Makefile to reflect correct SDK and GMP build directories (should be correct already)

INSTALL NOTES FOR BIG MACHINE

In this order (Intel_SGX_Installation_Guide_Linux_2.13_Open_Source)

RUN

Source environment variables On big machine:

export SGX_SDK=/home/jess/sgxsdk
export PATH=$PATH:$SGX_SDK/bin:$SGX_SDK/bin/x64
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$SGX_SDK/pkgconfig
export LD_LIBRARY_PATH=$SGX_SDK/sdk_libs

Locally: source sgxsdk/environment

Compile and run:

cd SGX-LR
make
./sgx_lr_exec

DOCUMENTATION

App.h

launch_enclave()-> sets up secure SGX enclave, returns success/error

Context.h

Constructor -> instantiates N and g

Keygen.h

Constructor -> instantiates public and secret key vectors

public_key() -> Return pk

secret_key() -> Return sk

key_der(const Matrix y, mpz_t hky) -> Derives key from y and secret key

Encryptor.h

Constructor -> instantiates Encryptor using Context

encrypt(Matrix ciphertext, Matrix commitment, const Matrix plaintext) -> Encrypt Matrix of plaintexts, sets ciphertext Matrix and commitment Matrix

Evaluator.h

Constructor -> instantiates Evaluator using Context

compress(Matrix compression, const Matrix ciphertext, const Matrix inp) -> First part of decryption, sets compression and commitment Matrix

evaluate(Matrix dest, const Matrix compression, const Matrix cmt, const mpz_t &sfk) -> Second part of decryption, sets destination Matrix

Logistic_Regression.h

train(Matrix xtrain_enc, Matrix xtrain_trans_enc, Matrix ytrain, Matrix cmt_xtrain, Matrix cmt_xtrain_trans, int batchSize, float learning_rate, Matrix sk_2_data) -> Trains data and updates model weights

predict(Matrix ypred, Matrix xtest_enc, Matrix cmt, Evaluator &eval, Public_Key pk) -> Performs compression, applies sigmoid within enclave to create classification tag, sets ypred Matrix

compute_performance_metrics(const Matrix ypred, const Matrix ytrue) -> analyze output of ML model

About

Privacy Preserving Logistic Regression Using Functional Encryption and Secure Hardware

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 70.1%
  • C 25.1%
  • Jupyter Notebook 2.6%
  • Makefile 2.2%