You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.0 KiB

  1. #define TEST_NAME "core1"
  2. #include "cmptest.h"
  3. unsigned char shared[32]
  4. = { 0x4a, 0x5d, 0x9d, 0x5b, 0xa4, 0xce, 0x2d, 0xe1, 0x72, 0x8e, 0x3b,
  5. 0xf4, 0x80, 0x35, 0x0f, 0x25, 0xe0, 0x7e, 0x21, 0xc9, 0x47, 0xd1,
  6. 0x9e, 0x33, 0x76, 0xf0, 0x9b, 0x3c, 0x1e, 0x16, 0x17, 0x42 };
  7. unsigned char zero[32] = { 0 };
  8. unsigned char c[16] = { 0x65, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x20, 0x33,
  9. 0x32, 0x2d, 0x62, 0x79, 0x74, 0x65, 0x20, 0x6b };
  10. unsigned char firstkey[32];
  11. int main(void)
  12. {
  13. int i;
  14. crypto_core_hsalsa20(firstkey, zero, shared, c);
  15. for (i = 0; i < 32; ++i) {
  16. if (i > 0) {
  17. printf(",");
  18. } else {
  19. printf(" ");
  20. }
  21. printf("0x%02x", (unsigned int)firstkey[i]);
  22. if (i % 8 == 7) {
  23. printf("\n");
  24. }
  25. }
  26. assert(crypto_core_hsalsa20_outputbytes() > 0U);
  27. assert(crypto_core_hsalsa20_inputbytes() > 0U);
  28. assert(crypto_core_hsalsa20_keybytes() > 0U);
  29. assert(crypto_core_hsalsa20_constbytes() > 0U);
  30. return 0;
  31. }