diff options
Diffstat (limited to 'test_grasshopper.c')
-rw-r--r-- | test_grasshopper.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/test_grasshopper.c b/test_grasshopper.c index 4ea195c..14252bc 100644 --- a/test_grasshopper.c +++ b/test_grasshopper.c @@ -23,7 +23,9 @@ } #define cRED "\033[1;31m" +#define cDRED "\033[0;31m" #define cGREEN "\033[1;32m" +#define cDGREEN "\033[0;32m" #define cNORM "\033[m" #define TEST_ASSERT(e) {if ((test = (e))) \ printf(cRED "Test FAILED\n" cNORM); \ @@ -240,10 +242,11 @@ static int test_omac() /* preload cbc cipher for omac set key */ EVP_add_cipher(cipher_gost_grasshopper_cbc()); T(EVP_DigestInit_ex(ctx, grasshopper_omac(), NULL)); - if (EVP_MD_CTX_size(ctx) != 8) { + if (EVP_MD_CTX_size(ctx) != sizeof(mac)) { /* strip const out of EVP_MD_CTX_md() to * overwrite output size, as test vector is 8 bytes */ - T(EVP_MD_meth_set_result_size((EVP_MD *)EVP_MD_CTX_md(ctx), 8)); + printf("Resize result size from %d to %zu\n", EVP_MD_CTX_size(ctx), sizeof(mac)); + T(EVP_MD_meth_set_result_size((EVP_MD *)EVP_MD_CTX_md(ctx), sizeof(mac))); } T(EVP_MD_meth_get_ctrl(EVP_MD_CTX_md(ctx))(ctx, EVP_MD_CTRL_SET_KEY, sizeof(K), (void *)K)); T(EVP_DigestUpdate(ctx, P, sizeof(P))); @@ -283,8 +286,8 @@ int main(int argc, char **argv) ret |= test_omac(); if (ret) - printf(cRED "= Some tests FAILED!\n" cNORM); + printf(cDRED "= Some tests FAILED!\n" cNORM); else - printf(cGREEN "= All tests passed!\n" cNORM); + printf(cDGREEN "= All tests passed!\n" cNORM); return ret; } |