#include "onionsalt.h" #include #include #include #include void randombytes(unsigned char * ptr,unsigned int length); /* This test only verifies that we can call onion_box without causing a segfault or crash. */ int main() { unsigned char sk[crypto_box_SECRETKEYBYTES]; unsigned char pk[crypto_box_PUBLICKEYBYTES]; assert(!crypto_box_keypair(pk, sk)); const int secret_length = 137; unsigned char *secret = malloc(secret_length); randombytes(secret, secret_length); const int num_layers = 5; const int address_length = 30; unsigned char *addresses = malloc(address_length*(num_layers-1)); randombytes(addresses, address_length*(num_layers-1)); unsigned char *public_keys = malloc(num_layers*crypto_box_PUBLICKEYBYTES); unsigned char *secret_keys = malloc(num_layers*crypto_box_SECRETKEYBYTES); for (int i=0;i