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.

runner.c 977 B

9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
123456789101112131415161718192021222324252627282930313233343536373839
  1. #include <assert.h>
  2. #include "utils/common.h"
  3. #include "utils/pkcs7.h"
  4. #include <stdio.h>
  5. #include <string.h>
  6. #include "cbc.h"
  7. FUNC(pkcs7_test)
  8. {
  9. // int pkcs7_pad(const char* i_buff, const size_t i_len, char* o_buff );
  10. const char text1[] = "Text1";
  11. const char text2[] = "Text2ToPad";
  12. int ret;
  13. char buff1[32];
  14. char buff2[10];
  15. ret = pkcs7_pad(text1, 5, buff1, 32);
  16. check(ret==0, (const unsigned char* const) "Padding operation failed");
  17. ret = memcmp(text1, buff1, 5);
  18. check(ret==0, (const unsigned char* const) "Content differs");
  19. for(int i=5; i<32; i++)
  20. {
  21. check(buff1[i] == 27, (const unsigned char* const) "Wrong padding");
  22. }
  23. }
  24. FUNC_E
  25. FUNC(cbc_decrypt)
  26. {
  27. uint8_t iv[16] = {0};
  28. char key[17] = "YELLOW SUBMARINE"; // 16+'\0' = 17
  29. size_t len = 0;
  30. uint8_t buff[4096] = {0};
  31. Result_t res = Result_Error;
  32. res = load_base64_to_hex("etc/set2_t2.txt", buff, &len);
  33. }
  34. FUNC_E