X-Git-Url: https://www.tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fsptps_speed.c;h=c7c6e5463928e6a4dc0985705460f5c8dd4d29dc;hb=0fe69908838248c28624beb540257892db6bdcbd;hp=53cff4df3193020f77d8d3d8c6c48e48ed5b35cd;hpb=56621be326497d56db0c4c372ae3cc497018cfcf;p=tinc diff --git a/src/sptps_speed.c b/src/sptps_speed.c index 53cff4df..c7c6e546 100644 --- a/src/sptps_speed.c +++ b/src/sptps_speed.c @@ -29,6 +29,7 @@ #include "meta.h" #include "protocol.h" #include "sptps.h" +#include "random.h" // Symbols necessary to link with logger.o bool send_request(struct connection_t *c, const char *msg, ...) { @@ -104,15 +105,13 @@ static bool clock_countto(double seconds) { return false; } -int main(int argc, char *argv[]) { +static int run_benchmark(int argc, char *argv[]) { ecdsa_t *key1, *key2; ecdh_t *ecdh1, *ecdh2; sptps_t sptps1, sptps2; uint8_t buf1[4096], buf2[4096], buf3[4096]; double duration = argc > 1 ? atof(argv[1]) : 10; - crypto_init(); - randomize(buf1, sizeof(buf1)); randomize(buf2, sizeof(buf2)); randomize(buf3, sizeof(buf3)); @@ -316,7 +315,17 @@ int main(int argc, char *argv[]) { close(fd[1]); ecdsa_free(key1); ecdsa_free(key2); - crypto_exit(); return 0; } + +int main(int argc, char *argv[]) { + random_init(); + crypto_init(); + + int result = run_benchmark(argc, argv); + + random_exit(); + + return result; +}