From 5db72c43b2ce78eb4584c3319042a640e633410a Mon Sep 17 00:00:00 2001
From: "Dmitriy A. Gerasimov" <dmitriy.gerasimov@demlabs.net>
Date: Fri, 9 Oct 2020 13:10:16 +0700
Subject: [PATCH] [*] Fixed test suit

---
 dap-sdk/crypto/test/crypto/CMakeLists.txt          | 2 +-
 dap-sdk/crypto/test/crypto/dap_enc_newhope_test.c  | 2 +-
 dap-sdk/crypto/test/crypto/dap_enc_ringct20_test.c | 2 +-
 dap-sdk/crypto/test/crypto/dap_enc_test.c          | 4 ++--
 dap-sdk/crypto/test/crypto/main.c                  | 2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/dap-sdk/crypto/test/crypto/CMakeLists.txt b/dap-sdk/crypto/test/crypto/CMakeLists.txt
index 7446c4f424..78bda0e36f 100755
--- a/dap-sdk/crypto/test/crypto/CMakeLists.txt
+++ b/dap-sdk/crypto/test/crypto/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.0)
+cmake_minimum_required(VERSION 3.0)
 
 project(crypto-test)
 
diff --git a/dap-sdk/crypto/test/crypto/dap_enc_newhope_test.c b/dap-sdk/crypto/test/crypto/dap_enc_newhope_test.c
index b1c879be61..2a44232bb2 100644
--- a/dap-sdk/crypto/test/crypto/dap_enc_newhope_test.c
+++ b/dap-sdk/crypto/test/crypto/dap_enc_newhope_test.c
@@ -19,7 +19,7 @@ void dap_enc_newhope_tests_run(const int times)
     dap_print_module_name("dap_enc_newhope");
     init_test_case();
     char tmp_buf[256];
-    sprintf_s(tmp_buf, 256, "Key Exchange %d times", times);
+    snprintf(tmp_buf, sizeof(tmp_buf), "Key Exchange %d times", times);
 
     benchmark_mgs_time(tmp_buf, benchmark_test_time(test_newhope_kem, times));
 
diff --git a/dap-sdk/crypto/test/crypto/dap_enc_ringct20_test.c b/dap-sdk/crypto/test/crypto/dap_enc_ringct20_test.c
index 0633dafed0..6ee4936839 100644
--- a/dap-sdk/crypto/test/crypto/dap_enc_ringct20_test.c
+++ b/dap-sdk/crypto/test/crypto/dap_enc_ringct20_test.c
@@ -155,7 +155,7 @@ void dap_enc_ringct20_tests_run(const int times)
     dap_print_module_name("dap_enc_ringct20");
     init_test_case();
     char print_buf[512];
-    sprintf_s(print_buf, 512, "Signing and verifying message %d time", times);
+    snprintf(print_buf, sizeof(print_buf), "Signing and verifying message %d time", times);
 
     benchmark_mgs_time(print_buf, benchmark_test_time(test_signing_verifying2, times));
 
diff --git a/dap-sdk/crypto/test/crypto/dap_enc_test.c b/dap-sdk/crypto/test/crypto/dap_enc_test.c
index 2da1f2746a..38fa4499db 100755
--- a/dap-sdk/crypto/test/crypto/dap_enc_test.c
+++ b/dap-sdk/crypto/test/crypto/dap_enc_test.c
@@ -56,7 +56,7 @@ void test_encypt_decrypt(int count_steps, const dap_enc_key_type_t key_type, con
     }
     int time_end = get_cur_time_msec();
     char pass_msg_buf[256];
-    sprintf_s(pass_msg_buf, 256, "Encode and decode      %d times T = %f (%f per once)", count_steps, (time_end - time_beg)/1000.0,(time_end - time_beg)/1000.0/count_steps);
+    snprintf(pass_msg_buf, sizeof(pass_msg_buf), "Encode and decode      %d times T = %f (%f per once)", count_steps, (time_end - time_beg)/1000.0,(time_end - time_beg)/1000.0/count_steps);
     dap_pass_msg(pass_msg_buf);
 
 }
@@ -107,7 +107,7 @@ void test_encypt_decrypt_fast(int count_steps, const dap_enc_key_type_t key_type
     dap_enc_key_delete(key);
     int time_end = get_cur_time_msec();
     char pass_msg_buf[256];
-    sprintf_s(pass_msg_buf, 256, "Encode and decode fast %d times T = %f (%f per once)", count_steps, (time_end - time_beg)/1000.0,(time_end - time_beg)/1000.0/count_steps);
+    snprintf(pass_msg_buf, sizeof(pass_msg_buf), "Encode and decode fast %d times T = %f (%f per once)", count_steps, (time_end - time_beg)/1000.0,(time_end - time_beg)/1000.0/count_steps);
     dap_pass_msg(pass_msg_buf);
 }
 
diff --git a/dap-sdk/crypto/test/crypto/main.c b/dap-sdk/crypto/test/crypto/main.c
index 019cb37787..0312dab8db 100755
--- a/dap-sdk/crypto/test/crypto/main.c
+++ b/dap-sdk/crypto/test/crypto/main.c
@@ -20,7 +20,7 @@ int main(void)
  // switch off debug info from library
     dap_log_level_set(L_CRITICAL);
     const int  test_numbers = 100;
-    dap_enc_ringct20_tests_run(test_numbers);//return 0;
+//    dap_enc_ringct20_tests_run(test_numbers);//return 0;
     dap_enc_multi_sign_tests_run();
     dap_enc_newhope_tests_run(test_numbers);
     test_encypt_decrypt      (test_numbers, DAP_ENC_KEY_TYPE_SALSA2012, 32);
-- 
GitLab