From ecd3fb714d2b2c853610a5c667a0245cb7807e83 Mon Sep 17 00:00:00 2001 From: Steffen Jaeckel Date: Sat, 17 Feb 2018 17:26:30 +0100 Subject: [PATCH] add `do_compare_testvector()` --- tests/common.c | 9 +++++++++ tests/common.h | 2 ++ 2 files changed, 11 insertions(+) diff --git a/tests/common.c b/tests/common.c index 18a56148..2ee4689d 100644 --- a/tests/common.c +++ b/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$ */ diff --git a/tests/common.h b/tests/common.h index 410db1e8..1ba88207 100644 --- a/tests/common.h +++ b/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$ */