#include "onionsalt.h" #include #include #include #include void randombytes(unsigned char * ptr,unsigned int length); /* This test checks that we can unpeel an onion and get back the original messages. */ int main() { unsigned char sk[crypto_box_SECRETKEYBYTES]; unsigned char pk[crypto_box_PUBLICKEYBYTES]; assert(!crypto_box_keypair(pk, sk)); const int secret_length = 17; unsigned char *secret = malloc(secret_length); randombytes(secret, secret_length); const int num_layers = 5; const int address_length = 51; 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