CLAUS is, cryptographically, a very simple form of the Diffie-Hellman secret-sharing system: it exponentiates modulo a fixed 1024-bit prime. CLAUS doesn't contain many lines of code: it relies on the popular OpenSSL cryptographic library to generate keys and to compute shared secrets. Other BAT implementors may find CLAUS useful as an illustration of the ease of writing BATs.
CLAUS++ is a similar BAT written in C++ rather than C.
#define SECRETKEY_BYTES 256 #define PUBLICKEY_BYTES 128 #define SHAREDSECRET_BYTES 128A single BAT can be parametrized and allow multiple key sizes; or it can be limited to a single key size, as illustrated by CLAUS.
Another file, claus-1/keypair.c, defines a keypair() function that generates a secret key and a public key:
int keypair( unsigned char sk[SECRETKEY_BYTES],unsigned long long *sklen, unsigned char pk[PUBLICKEY_BYTES],unsigned long long *pklen ) { ... }At a lower level, claus-1/keypair.c includes claus-1/prime.h for access to a prime number defined in claus-1/prime.c; and it uses various OpenSSL functions. OpenSSL is automatically made available to all BATs.
Another file, claus-1/sharedsecret.c, defines a sharedsecret() function that generates a shared secret:
int sharedsecret( unsigned char s[SHAREDSECRET_BYTES],unsigned long long *slen, const unsigned char sk[SECRETKEY_BYTES],const unsigned long long sklen, const unsigned char pk[PUBLICKEY_BYTES],const unsigned long long pklen ) { ... }
There's no special naming convention for the .c files and .h files other than sizes.h. All of the C functions could have been defined in one file or spread among any number of files. All of these files are automatically compiled together by the eBATS benchmarking tools.
double multiplekeycdhchance(double e,double s,double k) { return dlchance(1024,e,s,k); }The underlying dlchance function is part of eBATS and didn't require any work by the CLAUS programmer.
One last file, claus-1/documentation.pdf, contains references and other comments for cryptographers:
... CLAUS uses a very simple form of the Diffie-Hellman secret-sharing system. Each secret key a is used to generate a public key 2^a mod p ... Beware that the speed and security of CLAUS can be improved in many ways. ...This file isn't used in any way by the benchmarking tools but it's still an important part of a BAT.