Skip to content
Rasmus Winther Zakarias edited this page Jul 9, 2014 · 6 revisions

Welcome to the MiniTrix wiki!

The MiniTrix code breaks down into Linux AutoTools sub-projecs as follows:

  • OSAL - Operating System Abstraction Layer
  • DS - data structures, hashmap and concurrent blocking queue
  • MATH - Matrix and GF8
  • Encoding - DER, HEX and Integer encodings to and from bytes
  • Utils - Currently only a commandline argument parser
  • CArena - C Arena network squid
  • Cminimacs - The protocol layer
  • CAes - AES application of MiniMac
  • CInterp - A Fairplay circuit-like interpreter (syntax differ slightly)

OSAL - Operating System Abstraction Layer

Provides a struct type OE abstracting away a concise and minimal set of functions needed to implement MiniMac.

OSAL also provides a small and minimalistic Object Orientation library COO-lib for C.

See http://minitrix.bitlab.dk/osal and http://minitrix.bitlab.dk/coo for further details and examples.

CARENA - An arena of connected peers (written in C, hence CARENA)

CArena, set-up a Multi-Party server in six lines of code :)

int main(int argc, char **argv) {
 OE oe = OperatingEnvironment_LinuxNew();
 CArena arena = CArena_new(oe);
 uint N = 10;

 arena->listen_wait(N,2020); // blocks until N peers are connected

 // Do your MPC protocol...
 
 CArena_destroy(&arena);
 OperatingEnvironment_LinuxDestroy(&oe);
}

CARENA is a network squid. CARENA maintains an internal list of connected peers. When created its ready to connect out to other peers, upon successful connection an internal representation of the connected peer is created and added to its internal list. CArena monitors the state of the TCP connection and if it fails the peer is removed from the internal list and registered listeners (the observer pattern) are notified.

// Example client code
#include <osal.h>
#include <carena.h>

int main(int c, char a) {
 OE oe = OperatingEnvironment_LinuxNew();
 CArena arena = CArena_new(oe);
 Data buffer = Data_new(oe, 11);

  arena->connect(2020, "10.11.82.01"); // connect to llama01.cs.au.dk

  arena->get_peers->get(0)->send(Data_shallow("Hello world", 11));

  arena->get_peers->get(0)->receive(buffer);

  Data_destroy(oe, &buffer);
  CArena_destroy(arena); // shutdown and close connections gracefully
  OperatingEnvironment_LinuxDestroy(&oe);
  return 0;
}

At any time the arena can supply a list of connected peers. Each peer object in the list supports sending and receiving data.

See http://minitrix.bitlab.dk/carena