Created SILC Crypto Toolkit git repository.
[crypto.git] / lib / silcacc / tests / test_softacc.c
index 066fd2a4001ce7e0459b5b628190d8142abff35c..14b44d571137070707c0f14bcce8d794beaa4fb1 100644 (file)
@@ -1,6 +1,6 @@
 /* Software accelerator tests */
 
-#include "silc.h"
+#include "silccrypto.h"
 
 SilcSchedule schedule;
 SilcPublicKey public_key, accpub;
@@ -8,7 +8,7 @@ SilcPrivateKey private_key, accprv;
 SilcHash hash;
 unsigned char data[] = "Single block msg";
 int data_len = 16;
-int s = 100;
+int s = 200;
 
 void sign_compl(SilcBool success, const unsigned char *signature,
                SilcUInt32 signature_len, void *context)
@@ -16,6 +16,12 @@ void sign_compl(SilcBool success, const unsigned char *signature,
   SILC_LOG_DEBUG(("Sign compl %s", success ? "Ok" : "failed"));
 }
 
+SILC_TASK_CALLBACK(stats)
+{
+  silc_stack_stats(silc_crypto_stack());
+  silc_schedule_task_add_timeout(schedule, stats, NULL, 1, 1);
+}
+
 SILC_TASK_CALLBACK(quit)
 {
   silc_schedule_stop(schedule);
@@ -23,9 +29,9 @@ SILC_TASK_CALLBACK(quit)
 
 SILC_TASK_CALLBACK(sign)
 {
-  silc_pkcs_sign(accprv, data, data_len, TRUE, hash, sign_compl, NULL);
+  silc_pkcs_sign(accprv, data, data_len, TRUE, hash, NULL, sign_compl, NULL);
   if (--s > 0)
-    silc_schedule_task_add_timeout(schedule, sign, NULL, 0, 70000);
+    silc_schedule_task_add_timeout(schedule, sign, NULL, 0, 60000);
 }
 
 int main(int argc, char **argv)
@@ -54,7 +60,7 @@ int main(int argc, char **argv)
   if (!softacc)
     goto err;
 
-  if (!silc_acc_init(softacc, schedule, "min_threads", 2, "max_threads", 
+  if (!silc_acc_init(softacc, schedule, "min_threads", 2, "max_threads",
                     8, NULL))
     goto err;
 
@@ -71,7 +77,8 @@ int main(int argc, char **argv)
     goto err;
 
   silc_schedule_task_add_timeout(schedule, sign, NULL, 0, 1);
-  silc_schedule_task_add_timeout(schedule, quit, NULL, 15, 0);
+  silc_schedule_task_add_timeout(schedule, stats, NULL, 1, 1);
+  silc_schedule_task_add_timeout(schedule, quit, NULL, 19, 0);
   silc_schedule(schedule);
 
   silc_acc_uninit(softacc);