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.

36 lines
958 B

  1. #define TEST_NAME "verify1"
  2. #include "cmptest.h"
  3. unsigned char v16[16], v16x[16];
  4. unsigned char v32[32], v32x[32];
  5. unsigned char v64[64], v64x[64];
  6. int main(void)
  7. {
  8. randombytes_buf(v16, sizeof v16);
  9. randombytes_buf(v32, sizeof v32);
  10. randombytes_buf(v64, sizeof v64);
  11. memcpy(v16x, v16, sizeof v16);
  12. memcpy(v32x, v32, sizeof v32);
  13. memcpy(v64x, v64, sizeof v64);
  14. printf("%d\n", crypto_verify_16(v16, v16x));
  15. printf("%d\n", crypto_verify_32(v32, v32x));
  16. printf("%d\n", crypto_verify_64(v64, v64x));
  17. v16x[randombytes_random() & 15U]++;
  18. v32x[randombytes_random() & 31U]++;
  19. v64x[randombytes_random() & 63U]++;
  20. printf("%d\n", crypto_verify_16(v16, v16x));
  21. printf("%d\n", crypto_verify_32(v32, v32x));
  22. printf("%d\n", crypto_verify_64(v64, v64x));
  23. assert(crypto_verify_16_bytes() == 16U);
  24. assert(crypto_verify_32_bytes() == 32U);
  25. assert(crypto_verify_64_bytes() == 64U);
  26. return 0;
  27. }