X-Git-Url: http://wagner.pp.ru/gitweb/?a=blobdiff_plain;f=test_curves.c;h=865ee8d2d4e3c2bb0bc3eb24f66229c04917e83a;hb=HEAD;hp=27617673dea7ddd0f654ec1369b9434d089e5842;hpb=7e6ed644cf97385a95544fcc889e2eb16bcc93ed;p=openssl-gost%2Fengine.git diff --git a/test_curves.c b/test_curves.c index 2761767..865ee8d 100644 --- a/test_curves.c +++ b/test_curves.c @@ -5,7 +5,11 @@ * See https://www.openssl.org/source/license.html for details */ -#include "e_gost_err.h" +#ifdef _MSC_VER +# pragma warning(push, 3) +# include +# pragma warning(pop) +#endif #include "gost_lcl.h" #include #include @@ -16,11 +20,11 @@ #include #include -#define T(e) ({ if (!(e)) { \ - ERR_print_errors_fp(stderr); \ - OpenSSLDie(__FILE__, __LINE__, #e); \ - } \ - }) +#define T(e) \ + if (!(e)) { \ + ERR_print_errors_fp(stderr); \ + OpenSSLDie(__FILE__, __LINE__, #e); \ + } #define cRED "\033[1;31m" #define cDRED "\033[0;31m" @@ -32,9 +36,9 @@ #define TEST_ASSERT(e) { \ test = e; \ if (test) \ - 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"); \ } struct test_curve { @@ -93,7 +97,7 @@ static int parameter_test(struct test_curve *tc) printf("\n"); if (!OBJ_nid2obj(nid)) { - printf(cRED "NID %d not found\n" cNORM, nid); + printf(cRED "NID %d not found" cNORM "\n", nid); return 1; } @@ -109,7 +113,7 @@ static int parameter_test(struct test_curve *tc) EC_KEY *ec; T(ec = EC_KEY_new()); if (!fill_GOST_EC_params(ec, nid)) { - printf(cRED "fill_GOST_EC_params FAIL\n" cNORM); + printf(cRED "fill_GOST_EC_params FAIL" cNORM "\n"); ERR_print_errors_fp(stderr); return 1; } @@ -225,25 +229,14 @@ int main(int argc, char **argv) { int ret = 0; - 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)); - struct test_curve *tc; for (tc = test_curves; tc->nid; tc++) { ret |= parameter_test(tc); } - ENGINE_finish(eng); - 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; }