aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan/crypto/crypto_tester.c
diff options
context:
space:
mode:
authorMartin Willi <martin@revosec.ch>2012-07-06 15:54:03 +0200
committerMartin Willi <martin@revosec.ch>2012-07-16 14:53:37 +0200
commite35abbe588636c5ca73d8aaa9082314289346bd9 (patch)
treeeece22634e08ca1ada844d640bb8d8c2d086e61a /src/libstrongswan/crypto/crypto_tester.c
parentc3858662d2d1d431bdb453f2b50e63d9c2c5bfad (diff)
downloadstrongswan-e35abbe588636c5ca73d8aaa9082314289346bd9.tar.bz2
strongswan-e35abbe588636c5ca73d8aaa9082314289346bd9.tar.xz
Add a return value to crypter_t.encrypt
Diffstat (limited to 'src/libstrongswan/crypto/crypto_tester.c')
-rw-r--r--src/libstrongswan/crypto/crypto_tester.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/libstrongswan/crypto/crypto_tester.c b/src/libstrongswan/crypto/crypto_tester.c
index 868128dcd..287c12ced 100644
--- a/src/libstrongswan/crypto/crypto_tester.c
+++ b/src/libstrongswan/crypto/crypto_tester.c
@@ -160,8 +160,10 @@ static u_int bench_crypter(private_crypto_tester_t *this,
start_timing(&start);
while (end_timing(&start) < this->bench_time)
{
- crypter->encrypt(crypter, buf, chunk_from_thing(iv), NULL);
- runs++;
+ if (crypter->encrypt(crypter, buf, chunk_from_thing(iv), NULL))
+ {
+ runs++;
+ }
crypter->decrypt(crypter, buf, chunk_from_thing(iv), NULL);
runs++;
}
@@ -215,7 +217,10 @@ METHOD(crypto_tester_t, test_crypter, bool,
/* allocated encryption */
plain = chunk_create(vector->plain, vector->len);
- crypter->encrypt(crypter, plain, iv, &cipher);
+ if (!crypter->encrypt(crypter, plain, iv, &cipher))
+ {
+ failed = TRUE;
+ }
if (!memeq(vector->cipher, cipher.ptr, cipher.len))
{
failed = TRUE;
@@ -235,7 +240,10 @@ METHOD(crypto_tester_t, test_crypter, bool,
failed = TRUE;
}
/* inline encryption */
- crypter->encrypt(crypter, plain, iv, NULL);
+ if (!crypter->encrypt(crypter, plain, iv, NULL))
+ {
+ failed = TRUE;
+ }
if (!memeq(vector->cipher, plain.ptr, plain.len))
{
failed = TRUE;