Browse Source

add `do_compare_testvector()`

Steffen Jaeckel 7 years ago
parent
commit
ecd3fb714d
2 changed files with 11 additions and 0 deletions
  1. 9 0
      tests/common.c
  2. 2 0
      tests/common.h

+ 9 - 0
tests/common.c

@@ -61,6 +61,15 @@ void print_hex(const char* what, const void* v, const unsigned long l)
   }
 }
 
+int do_compare_testvector(const void* is, const unsigned long is_len, const void* should, const unsigned long should_len, const char* what, int which)
+{
+   if (compare_testvector(is, is_len, should, should_len, what, which) == 0) {
+      return CRYPT_OK;
+   } else {
+      return CRYPT_FAIL_TESTVECTOR;
+   }
+}
+
 prng_state yarrow_prng;
 
 /* ref:         $Format:%D$ */

+ 2 - 0
tests/common.h

@@ -25,6 +25,8 @@ void run_cmd(int res, int line, const char *file, const char *cmd, const char *a
 
 void print_hex(const char* what, const void* v, const unsigned long l);
 
+int do_compare_testvector(const void* is, const unsigned long is_len, const void* should, const unsigned long should_len, const char* what, int which);
+
 #endif /* DEMOS_COMMON_H_ */
 
 /* ref:         $Format:%D$ */