Give a benchmark point for each operation to compare different transforms
authorMartin Willi <martin@revosec.ch>
Thu, 19 Aug 2010 10:17:03 +0000 (12:17 +0200)
committerMartin Willi <martin@revosec.ch>
Thu, 19 Aug 2010 17:05:14 +0000 (19:05 +0200)
src/libstrongswan/crypto/crypto_tester.c

index 7970383..d17485f 100644 (file)
@@ -151,6 +151,7 @@ static u_int bench_crypter(private_crypto_tester_t *this,
                while (end_timing(&start) < this->bench_time)
                {
                        crypter->encrypt(crypter, buf, chunk_from_thing(iv), NULL);
+                       runs++;
                        crypter->decrypt(crypter, buf, chunk_from_thing(iv), NULL);
                        runs++;
                }
@@ -295,9 +296,10 @@ static u_int bench_aead(private_crypto_tester_t *this,
                {
                        aead->encrypt(aead, buf, chunk_from_thing(assoc),
                                                  chunk_from_thing(iv), NULL);
+                       runs += 2;
                        aead->decrypt(aead, chunk_create(buf.ptr, buf.len + icv),
                                                  chunk_from_thing(assoc), chunk_from_thing(iv), NULL);
-                       runs++;
+                       runs += 2;
                }
                free(buf.ptr);
                aead->destroy(aead);
@@ -444,6 +446,7 @@ static u_int bench_signer(private_crypto_tester_t *this,
                while (end_timing(&start) < this->bench_time)
                {
                        signer->get_signature(signer, buf, mac);
+                       runs++;
                        signer->verify_signature(signer, buf, chunk_from_thing(mac));
                        runs++;
                }