X-Git-Url: http://wagner.pp.ru/gitweb/?a=blobdiff_plain;f=test_ciphers.c;h=a88c28154497d7c321e6cde547df705aee09573f;hb=7ca9b827135b90cfc2567058b56325a518a3d57a;hp=95e3e993afba9a3af19f582bac90a2f4277820a6;hpb=541bf464a0b5849e0823d075a2403eeb37f90ea9;p=openssl-gost%2Fengine.git diff --git a/test_ciphers.c b/test_ciphers.c index 95e3e99..a88c281 100644 --- a/test_ciphers.c +++ b/test_ciphers.c @@ -24,12 +24,13 @@ #define cGREEN "\033[1;32m" #define cDGREEN "\033[0;32m" #define cBLUE "\033[1;34m" +#define cMAGENT "\033[1;35m" #define cDBLUE "\033[0;34m" #define cNORM "\033[m" #define TEST_ASSERT(e) {if ((test = (e))) \ - printf(cRED "Test FAILED\n" cNORM); \ + printf(cRED "Test FAILED" cNORM "\n"); \ else \ - printf(cGREEN "Test passed\n" cNORM);} + printf(cGREEN "Test passed" cNORM "\n");} /* Pragma to allow commenting out some tests. */ #pragma GCC diagnostic ignored "-Wunused-const-variable" @@ -275,7 +276,6 @@ static struct testcase { .iv = iv_ctr, .iv_size = sizeof(iv_ctr) / 2, }, -#if 0 { .nid = NID_magma_cbc, .block = 8, @@ -286,7 +286,6 @@ static struct testcase { .iv = iv_cbc, .iv_size = sizeof(iv_cbc), }, -#endif { 0 } }; @@ -464,13 +463,7 @@ int main(int argc, char **argv) /* Trigger SIGBUS for unaligned access. */ sysmips(MIPS_FIXADE, 0); #endif - setenv("OPENSSL_ENGINES", ENGINE_DIR, 0); OPENSSL_add_all_algorithms_conf(); - ERR_load_crypto_strings(); - ENGINE *eng; - T(eng = ENGINE_by_id("gost")); - T(ENGINE_init(eng)); - T(ENGINE_set_default(eng, ENGINE_METHOD_ALL)); for (t = testcases; t->nid; t++) { int inplace; @@ -479,7 +472,7 @@ int main(int argc, char **argv) const EVP_CIPHER *type = EVP_get_cipherbynid(t->nid); const char *name = EVP_CIPHER_name(type); - printf(cBLUE "# Tests for %s [%s]\n" cNORM, name, standard); + printf(cBLUE "# Tests for %s [%s]" cNORM "\n", name, standard); for (inplace = 0; inplace <= 1; inplace++) ret |= test_block(type, name, t->block, t->plaintext, t->key, t->expected, t->size, @@ -490,12 +483,25 @@ int main(int argc, char **argv) t->iv, t->iv_size, t->acpkm); } - ENGINE_finish(eng); + ENGINE *eng; + ENGINE_CIPHERS_PTR fn_c; + T(eng = ENGINE_by_id("gost")); + T(fn_c = ENGINE_get_ciphers(eng)); + const int *nids; + int n, k; + n = fn_c(eng, NULL, &nids, 0); + for (k = 0; k < n; ++k) { + for (t = testcases; t->nid; t++) + if (t->nid == nids[k]) + break; + if (!t->nid) + printf(cMAGENT "Cipher %s is untested!" cNORM "\n", OBJ_nid2sn(nids[k])); + } ENGINE_free(eng); if (ret) - printf(cDRED "= Some tests FAILED!\n" cNORM); + printf(cDRED "= Some tests FAILED!" cNORM "\n"); else - printf(cDGREEN "= All tests passed!\n" cNORM); + printf(cDGREEN "= All tests passed!" cNORM "\n"); return ret; }