Reference implementations of PQC
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.
 
 
 
 

34 line
818 B

  1. #include <stdint.h>
  2. #include <stddef.h>
  3. #include <string.h>
  4. #include <stdio.h>
  5. #include "nistseedexpander.h"
  6. const uint8_t seed[32] = {0};
  7. const uint8_t expected_result[27] = { 0x55, 0x98, 0x87, 0xae, 0x24, 0x28, 0x5d, 0x7e, 0x42, 0x02, 0x74, 0x27, 0x73, 0x31, 0x03, 0xf6, 0xaf, 0x2e, 0xb6, 0xf1, 0xec, 0xfe, 0xdf, 0xfb, 0xd3, 0x50, 0x31, };
  8. int test_seedexpander() {
  9. AES_XOF_struct state;
  10. uint8_t result[27] = {0};
  11. seedexpander_init(&state, seed, seed, 28);
  12. seedexpander(&state, result, 27);
  13. if (memcmp(expected_result, result, 27) != 0) {
  14. printf("Got\tExpected\n");
  15. for(size_t i = 0; i < 27; i++) {
  16. printf("0x%02x\t0x%02x\n", result[i], expected_result[i]);
  17. }
  18. return 1;
  19. }
  20. return 0;
  21. }
  22. int main(void) {
  23. return test_seedexpander();
  24. }