diff options
author | Martin Willi <martin@revosec.ch> | 2015-03-27 15:46:24 +0100 |
---|---|---|
committer | Martin Willi <martin@revosec.ch> | 2015-03-27 15:53:47 +0100 |
commit | 58dda5d6abbe99420e71089e68042333bb429e9d (patch) | |
tree | c4c96b1670bb6b5dc8706e6f18df6329d789d663 /src/libstrongswan/crypto/crypto_tester.c | |
parent | c063b9cfe9594de010bf8b31a660b0140e73af33 (diff) | |
download | strongswan-58dda5d6.tar.bz2 strongswan-58dda5d6.tar.xz |
crypto-tester: Test set_key() after a doing a partial append on prf/signers
While that use is uncommon in real-world use, nonetheless should HMAC set a
correct key and reset any underlying hasher.
Diffstat (limited to 'src/libstrongswan/crypto/crypto_tester.c')
-rw-r--r-- | src/libstrongswan/crypto/crypto_tester.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/libstrongswan/crypto/crypto_tester.c b/src/libstrongswan/crypto/crypto_tester.c index d09844bfa..1047030cf 100644 --- a/src/libstrongswan/crypto/crypto_tester.c +++ b/src/libstrongswan/crypto/crypto_tester.c @@ -580,13 +580,22 @@ METHOD(crypto_tester_t, test_signer, bool, break; } + data = chunk_create(vector->data, vector->len); key = chunk_create(vector->key, signer->get_key_size(signer)); if (!signer->set_key(signer, key)) { goto failure; } + /* do partial append mode and check if key gets set correctly */ + if (!signer->get_signature(signer, data, NULL)) + { + goto failure; + } + if (!signer->set_key(signer, key)) + { + goto failure; + } /* allocated signature */ - data = chunk_create(vector->data, vector->len); if (!signer->allocate_signature(signer, data, &mac)) { goto failure; @@ -905,13 +914,22 @@ METHOD(crypto_tester_t, test_prf, bool, break; } + seed = chunk_create(vector->seed, vector->len); key = chunk_create(vector->key, vector->key_size); if (!prf->set_key(prf, key)) { goto failure; } + /* do partial append mode and check if key gets set correctly */ + if (!prf->get_bytes(prf, seed, NULL)) + { + goto failure; + } + if (!prf->set_key(prf, key)) + { + goto failure; + } /* allocated bytes */ - seed = chunk_create(vector->seed, vector->len); if (!prf->allocate_bytes(prf, seed, &out)) { goto failure; |