From cb0de26db3ef83a900e6caa6949e4958b3c13726 Mon Sep 17 00:00:00 2001 From: Loup Vaillant Date: Mon, 4 Sep 2017 08:55:05 +0200 Subject: [PATCH] Properly initialise libsodium for the speed benchmarks Without this initialisation, libsodium can't select the fastest implementation for the platform, and has to revert to a portable, slower one. This leads to misleading benchmarks. --- tests/speed.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/speed.c b/tests/speed.c index 4fc506b..19d3ef4 100644 --- a/tests/speed.c +++ b/tests/speed.c @@ -480,6 +480,10 @@ static void d_ed25519(void) int main() { + if (sodium_init() == -1) { + printf("Libsodium init failed. Abort. No test performed\n"); + return 1; + } printf("\nComparing with Libsodium\n"); printf("------------------------\n"); print("Chacha20 ", chacha20(), "Libsodium"); -- 2.47.3