MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / compare_testvector

Function compare_testvector

extern/libtomcrypt/src/misc/compare_testvector.c:63–83  ·  view source on GitHub ↗

Compare two test-vectors @param is The data as it is @param is_len The length of is @param should The data as it should @param should_len The length of should @param what The type of the data @param which The iteration count @return 0 on equality, -1 or 1 on difference */

Source from the content-addressed store, hash-verified

61 @return 0 on equality, -1 or 1 on difference
62*/
63int compare_testvector(const void* is, const unsigned long is_len, const void* should, const unsigned long should_len, const char* what, int which)
64{
65 int res = 0;
66 if(is_len != should_len)
67 res = is_len > should_len ? -1 : 1;
68 else
69 res = XMEMCMP(is, should, is_len);
70
71#if defined(LTC_TEST) && defined(LTC_TEST_DBG)
72 if (res != 0) {
73 fprintf(stderr, "Testvector #%i of %s failed:\n", which, what);
74 _print_hex("SHOULD", should, should_len);
75 _print_hex("IS ", is, is_len);
76 }
77#else
78 LTC_UNUSED_PARAM(which);
79 LTC_UNUSED_PARAM(what);
80#endif
81
82 return res;
83}
84
85/* ref: $Format:%D$ */
86/* git commit: $Format:%H$ */

Callers 15

md5_testFunction · 0.85
rmd160_testFunction · 0.85
rmd128_testFunction · 0.85
rmd320_testFunction · 0.85
rmd256_testFunction · 0.85
sha3_224_testFunction · 0.85
sha3_256_testFunction · 0.85
sha3_384_testFunction · 0.85
sha3_512_testFunction · 0.85
sha3_shake_testFunction · 0.85
tiger_testFunction · 0.85
blake2s_256_testFunction · 0.85

Calls 1

_print_hexFunction · 0.85

Tested by

no test coverage detected