• This repository has been archived on 12/Oct/2023
  • Stars
    star
    277
  • Rank 143,878 (Top 3 %)
  • Language
    C
  • License
    GNU Affero Genera...
  • Created over 6 years ago
  • Updated 7 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Private Contact Discovery Service (Beta)

The private contact discovery micro-service allows clients to discover which of their contacts are registered users, but does not reveal their contacts to the service operator or any party that may have compromised the service.

Building the SGX enclave (optional)

Building reproducibly with Docker

Prerequisites:

  • GNU Make
  • Docker (able to run debian image)
$ make -C <repository_root>/enclave

The default docker-install target will create a reproducible build environment image using enclave/Dockerfile, build the enclave inside a container based on the image, and install the resulting enclave and jni libraries into service/src/main/resources/. The Dockerfile will download a stock debian Docker image and install exact versions of the build tools listed in enclave/docker/build-deps. Make will then be run inside the newly built Docker Debian image as in the Building with Debian section below:

If you need to update a package in the build environment, remove it from enclave/docker/build-deps, run make docker, and check in the resulting changes to the build-deps file.

If you need to add a package to the build environment, add it to enclave/debian/control and repeat the same steps.

Building with Debian

Prerequisites:

$ make debuild derebuild

debuild is a debian tool used to build debian packages after it sanitizes the environment and installs build dependences. The primary advantage of using debian packaging tools in this case is to leverage the Reproducible Builds project. While building a debian package, debuild will record the names and versions of all detected build dependencies into a *.buildinfo file. The Reproducible Builds Project's derebuild.pl script can then read the buildinfo file to drill down in the Debian Snapshot Archive to output the list of packages and generate an apt sources.list which should contain all of those packages. The list of packages should then be checked in as build-deps in the enclave/docker/ folder, along with sources.list and buildinfo, which will then be used to reproduce the build when running make docker again in the future.

The debuild target also builds parts needed from the Intel SGX SDK v2.17 after cloning it from github.

Building without Docker or Debian:

Prerequisites:

$ make -C <repository_root>/enclave all install

The all target will probably fail to reproduce the same binary as above, but doesn't require Docker or Debian Linux.

If SGX_SDK_DIR, or SGX_INCLUDEDIR and SGX_LIBDIR, are not specified, the Intel SGX SDK will be cloned from github and any required libraries will be built. The SDK build prerequisites should be present in this case.

The install target copies the enclave and jni libraries to service/src/resources/, which should potentially be checked in to be used with the service.

NB: the installed enclave will be signed with SGX_FLAGS_DEBUG enabled by an automatically generated signing key. Due to Intel SGX licensing requirements, a debug enclave can currently only be run with the SGX debug flag enabled, allowing inspection of its encrypted memory, and invalidating its security properties. To use an enclave in production, the generated libsabd-enclave.signdata file must be signed using a signing key whitelisted by Intel, which can then be saved as libsabd-enclave.sig with public key at libsabd-enclave.pub, and signed using make signed install.

Building the service

$ cd <repository_root>
$ make -C ./service/src/main/jni
$ mvn package

Running the service

Runtime requirements:

$ cd <repository_root>
$ java -jar service/target/contactdiscovery-<version>.jar server service/config/yourconfig.yml

Testing

Local Testing

Enclave Testing

You can locally run tests in enclave/ with cargo test in that directory.

Service Testing

For service/, run mvn test -pl ./service from the top level. (Note that those won't run tests that require working SGX hardware.) If you have a machine with the SGX dependencies installed and working SGX hardware, you can run mvn verify -pl ./service to run tests that depend on them.

Remote Azure Pipeline Testing

You can also use our Azure Pipelines set up to run the SGX-required tests with manual triggers.

You can see results of those manual runs on Azure's site.

Enclave Only Changes

If you have a change in enclave/, you can push to a branch that starts with either test- or test_ and the enclave will rebuild and service tests will be run on hardware with SGX enabled.

Service Only Changes

If you are only touching the service code without touching the enclave, then you can use the existing checked in enclave.

If you push to a branch that starts with test-svc- or test_svc_, the checked-in enclave will be used and service tests will be run on the SGX-enabled hardware.

CI

Azure Pipelines is what we currently use for CI. It has two separate Pipelines that run on PR and merges to main. You can see results for the PR and main runs on Azure's site or in GitHub's UI.

There are two pipelines configured. They currently (2020-05) are configured in service/ci/main.yml and service/ci/test_with_enclave_rebuild.yml. The former runs the service tests with the enclave library already checked-in to the repo. The latter runs the full enclave rebuild and test process, plus the service tests.

Both pipelines are run simultaneously to allow the quicker service tests to give developer's feedback sooner. (test_with_enclave_rebuild caches the LLVM BOLT binary smartly so it's comfortable to run on every PR. A build with a cached BOLT binary takes roughly 11 minutes.)

Manually triggering these can happen in the Azure UI or by pushing branches. See the "Local testing" section for the format of the branches.

Benchmarks

Enclave benchmarks

To run benchmarks for the enclave run this:

$ make -C ./enclave benchmark

Optionally configure more benchmark parameters by setting the Makefile variable BENCHMARK_ARGS. See enclave/Makefile for details.

Enclave benchmark perf tests

Running perf on the benchmark executable requires a few additional programs.

First install the perf tools:

$ sudo apt install linux-tools-common linux-tools-generic

Next install a cargo rust symbol demangler called rustfilt:

$ cargo install rustfilt

To run perf on the benchmarks:

$ make -C ./enclave benchmark-perf

This generates two useful files.

First, a perf data file:

enclave/build/target/benchmark/perf.data

The perf.data file can be fed into additional perf tools for analysis.

Second, a flamegraph:

enclave/build/target/benchmark/perf-flame.svg

Try opening this file with xdg-open enclave/build/target/benchmark/perf-flame.svg or other browser.

More Repositories

1

Signal-Android

A private messenger for Android.
Java
24,766
star
2

Signal-Desktop

A private messenger for Windows, macOS, and Linux.
TypeScript
13,934
star
3

Signal-iOS

A private messenger for iOS.
Swift
10,405
star
4

Signal-Server

Server supporting the Signal Private Messenger applications on Android, Desktop, and iOS
Java
8,781
star
5

libsignal

Home to the Signal Protocol as well as other cryptographic primitives which make Signal possible.
Rust
2,820
star
6

libsignal-protocol-javascript

This library is no longer maintained. libsignal-protocol-javascript was an implementation of the Signal Protocol, written in JavaScript. It has been replaced by libsignal-client’s typesafe TypeScript API.
JavaScript
1,963
star
7

libsignal-protocol-java

Java
1,814
star
8

libsignal-protocol-c

C
1,406
star
9

BitHub

BTC + BitHub = An experiment in funding privacy OSS.
Java
999
star
10

libsignal-service-java

A Java/Android library for communicating with the Signal messaging service.
Java
574
star
11

Signal-TLS-Proxy

Dockerfile
552
star
12

ringrtc

Rust
522
star
13

Signal-Calling-Service

Forwards media from 1 group call device to N group call devices.
Rust
409
star
14

Flock

Private contact and calendar sync for Android.
Java
359
star
15

SecureValueRecovery

Rust
276
star
16

gradle-witness

A gradle plugin that enables static verification for remote dependencies.
Groovy
228
star
17

curve25519-java

Pure Java and JNI backed Curve25519 implementation.
C
225
star
18

SignalProtocolKit

This library is no longer maintained. SignalProtocolKit was an implementation of the Signal Protocol, written in Objective-C. It has been replaced by libsignal-client’s type safe Swift API.
Objective-C
214
star
19

webrtc

C++
127
star
20

PushServer

A microservice for communicating with push gateways.
Java
115
star
21

WhisperYAFFS

Encrypted Filesystem Support For YAFFS2
C
103
star
22

jobmanager

Android library for executing tasks.
Java
103
star
23

WebSocket-Resources

A Dropwizard library that lets you use Jersey-style Resources over WebSockets
Java
91
star
24

better-sqlite3

C++
68
star
25

SignalServiceKit

SignalServiceKit has moved to Signal-iOS. See README.md for details.
Objective-C
68
star
26

libwebrtc-android

Android WebRTC Packages
Java
58
star
27

Signal-Pods

Pods dependency tracker for Signal-iOS
C
54
star
28

signal-ringrtc-node

TypeScript
48
star
29

gcm-sender-async

Asynchronous Google Cloud Messaging (GCM) Library
Java
48
star
30

zkgroup

41
star
31

libsignal-protocol-rust

Rust
38
star
32

Signal-Design

A place to archive design assets used by Signal.
35
star
33

curve25519-dalek

Rust
34
star
34

Argon2

Java
34
star
35

signal-webrtc-ios

Python
33
star
36

SignalCoreKit

Swift
31
star
37

storage-service

Java
28
star
38

libpastelog

Java
27
star
39

maven

26
star
40

Signal-FTS5-Extension

A FTS5 extension for signal_tokenizer.
Rust
26
star
41

ContactDiscoveryService-Icelake

C
25
star
42

SecureValueRecovery2

C++
23
star
43

dropwizard-simpleauth

Dropwizard library for simple @Auth annotations that support multiple types
Java
22
star
44

CLAServer

GitHub Integration for managing CLA signatures
Java
22
star
45

Mock-Signal-Server

TypeScript
21
star
46

mio

Rust
20
star
47

AES-GCM-Provider

A BoringSSL-backed AES-GCM provider for Android with support for "incremental" encryption/decryption
Java
19
star
48

registration-service

Registration Service for Signal
Java
17
star
49

libaxolotl-j2me

Axolotl J2ME
Java
17
star
50

signal-webrtc-ios-artifacts

Objective-C
17
star
51

tus-server

An implementation of the TUS server protocol for resumable uploads
TypeScript
15
star
52

SQLCipherVsSharedData

Demo Project to demonstrate a bug in SQLCipher
Objective-C
15
star
53

Signal-Art-Creator

Sticker Pack Creator Web App
TypeScript
15
star
54

dropwizard-wavefront

Dropwizard Metrics Reporter For Wavefront
Java
14
star
55

SignalMetadataKit

Swift
13
star
56

sgx_common

Rust
13
star
57

Signal-Carthage

Objective-C
12
star
58

emoji-search-index

Static assets used for to generate a search index for emoji within Signal.
11
star
59

libsignal-client-node

11
star
60

redis-dispatch

Java
11
star
61

libsignal-metadata-java

Java
10
star
62

libmobilecoin-ios-artifacts

Swift
10
star
63

signal-zkgroup-node

TypeScript
9
star
64

poksho

9
star
65

AccountStream

Java
7
star
66

jekyll-simple-i18n

Ruby
7
star
67

s3-upload-maven-plugin

Maven plugin to upload files to s3
Java
6
star
68

mp4san

A Rust MP4 format sanitizer
Rust
6
star
69

sqlcipher

C
5
star
70

libsignal-ffi

Rust
4
star
71

HsmEnclave

HSM-backed remote-attestable enclave.
C
4
star
72

signal-zkgroup-swift

Swift
4
star
73

sqlcipher-android

A light fork of https://github.com/sqlcipher/sqlcipher-android
C
4
star
74

partial-default

Provides PartialDefault, a Rust trait similar to Default but with fewer guarantees
Rust
2
star
75

libsignal-protocol-swift

Swift
2
star
76

storage-manager

Manage objects inside a cdn
TypeScript
1
star