diff options
author | Adrian-Ken Rueegsegger <ken@codelabs.ch> | 2012-05-02 17:49:41 +0200 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2012-05-18 08:15:41 +0200 |
commit | afaf1bdf5ee803f2320d2786a9b64be6deda2181 (patch) | |
tree | 8e255486eb0c06180b17e4cfcda8c7b1422aa7be /src/libcharon/sa/ikev1/phase1.c | |
parent | 5338fe5e79a6a2fe90691c579b237168c6b0f252 (diff) | |
download | strongswan-afaf1bdf5ee803f2320d2786a9b64be6deda2181.tar.bz2 strongswan-afaf1bdf5ee803f2320d2786a9b64be6deda2181.tar.xz |
Use nonce_gen instead of rng to generate nonces
Replace usage of rng plugin with nonce generator to create nonces in
IKE_INIT, CHILD_CREATE and QUICK_MODE tasks and the IKEv1 phase 1 helper.
Diffstat (limited to 'src/libcharon/sa/ikev1/phase1.c')
-rw-r--r-- | src/libcharon/sa/ikev1/phase1.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/libcharon/sa/ikev1/phase1.c b/src/libcharon/sa/ikev1/phase1.c index c29e5c783..ec55d533d 100644 --- a/src/libcharon/sa/ikev1/phase1.c +++ b/src/libcharon/sa/ikev1/phase1.c @@ -595,20 +595,20 @@ METHOD(phase1_t, add_nonce_ke, bool, { nonce_payload_t *nonce_payload; ke_payload_t *ke_payload; + nonce_gen_t *nonceg; chunk_t nonce; - rng_t *rng; ke_payload = ke_payload_create_from_diffie_hellman(KEY_EXCHANGE_V1, this->dh); message->add_payload(message, &ke_payload->payload_interface); - rng = lib->crypto->create_rng(lib->crypto, RNG_WEAK); - if (!rng) + nonceg = this->keymat->keymat.create_nonce_gen(&this->keymat->keymat); + if (!nonceg) { - DBG1(DBG_IKE, "no RNG found to create nonce"); + DBG1(DBG_IKE, "no nonce generator found to create nonce"); return FALSE; } - rng->allocate_bytes(rng, NONCE_SIZE, &nonce); - rng->destroy(rng); + nonceg->allocate_nonce(nonceg, NONCE_SIZE, &nonce); + nonceg->destroy(nonceg); nonce_payload = nonce_payload_create(NONCE_V1); nonce_payload->set_nonce(nonce_payload, nonce); |