Path: blob/main/sys/contrib/libsodium/test/default/core1.c
48375 views
1#define TEST_NAME "core1"2#include "cmptest.h"34static unsigned char shared[32] = { 0x4a, 0x5d, 0x9d, 0x5b, 0xa4, 0xce, 0x2d,50xe1, 0x72, 0x8e, 0x3b, 0xf4, 0x80, 0x35,60x0f, 0x25, 0xe0, 0x7e, 0x21, 0xc9, 0x47,70xd1, 0x9e, 0x33, 0x76, 0xf0, 0x9b, 0x3c,80x1e, 0x16, 0x17, 0x42 };910static unsigned char zero[32];1112static unsigned char c[16] = { 0x65, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x20, 0x33,130x32, 0x2d, 0x62, 0x79, 0x74, 0x65, 0x20, 0x6b };1415static unsigned char firstkey[32];1617int18main(void)19{20int i;2122crypto_core_hsalsa20(firstkey, zero, shared, c);23for (i = 0; i < 32; ++i) {24if (i > 0) {25printf(",");26} else {27printf(" ");28}29printf("0x%02x", (unsigned int) firstkey[i]);30if (i % 8 == 7) {31printf("\n");32}33}34assert(crypto_core_hsalsa20_outputbytes() > 0U);35assert(crypto_core_hsalsa20_inputbytes() > 0U);36assert(crypto_core_hsalsa20_keybytes() > 0U);37assert(crypto_core_hsalsa20_constbytes() > 0U);3839return 0;40}414243