]> www.wagner.pp.ru Git - openssl-gost/engine.git/blobdiff - test_digest.c
MSVC: No support for GCC's compound statement expressions
[openssl-gost/engine.git] / test_digest.c
index 9d3019a9cc8363848bd63d5194038177b3b35bdb..f3d4169555daecc61b420800df6fe35fb5a98960 100644 (file)
 #endif
 
 /* Helpers to test OpenSSL API calls. */
-#define T(e) ({ if (!(e)) { \
-               ERR_print_errors_fp(stderr); \
-               OpenSSLDie(__FILE__, __LINE__, #e); \
-           } \
-        })
-#define TE(e) ({ if (!(e)) { \
-               ERR_print_errors_fp(stderr); \
-               fprintf(stderr, "Error at %s:%d %s\n", __FILE__, __LINE__, #e); \
-               return -1; \
-           } \
-        })
+#define T(e) \
+    if (!(e)) { \
+        ERR_print_errors_fp(stderr); \
+        OpenSSLDie(__FILE__, __LINE__, #e); \
+    }
+#define TE(e) \
+    if (!(e)) { \
+        ERR_print_errors_fp(stderr); \
+        fprintf(stderr, "Error at %s:%d %s\n", __FILE__, __LINE__, #e); \
+        return -1; \
+    }
 
 #define cRED   "\033[1;31m"
 #define cDRED  "\033[0;31m"
             else \
                 printf(cGREEN "  Test passed" cNORM "\n");}
 
+#ifdef __GNUC__
 /* To test older APIs. */
-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
 
 /*
  * Test keys from both GOST R 34.12-2015 and GOST R 34.13-2015,
@@ -637,7 +639,7 @@ static int do_mac(int iter, EVP_MAC *mac, const char *plaintext,
 
     size_t acpkm = (size_t)t->acpkm;
     size_t acpkm_t = (size_t)t->acpkm_t;
-    OSSL_PARAM params[] = { OSSL_PARAM_END, OSSL_PARAM_END, OSSL_PARAM_END };
+    OSSL_PARAM params[] = { OSSL_PARAM_END, OSSL_PARAM_END, OSSL_PARAM_END, OSSL_PARAM_END };
     OSSL_PARAM *p = params;
     if (acpkm) {
         *p++ = OSSL_PARAM_construct_size_t("key-mesh", &acpkm);
@@ -650,8 +652,10 @@ static int do_mac(int iter, EVP_MAC *mac, const char *plaintext,
     if (t->outsize)
         T(EVP_MAC_CTX_get_mac_size(ctx) == t->outsize);
     size_t outsize;
-    if (t->truncate)
+    if (t->truncate) {
         outsize = t->truncate;
+       *p++ = OSSL_PARAM_construct_size_t("size", &outsize);
+    }
     else
         outsize = EVP_MAC_CTX_get_mac_size(ctx);