*/
chunk_t other_nonce;
+ /**
+ * nonce generator
+ */
+ nonce_gen_t *nonceg;
+
/**
* config to create the CHILD_SA from
*/
*/
static status_t generate_nonce(private_child_create_t *this)
{
- nonce_gen_t *nonceg;
-
- nonceg = this->keymat->keymat.create_nonce_gen(&this->keymat->keymat);
- if (!nonceg)
- {
- DBG1(DBG_IKE, "no nonce generator found to create nonce");
- return FAILED;
- }
- if (!nonceg->allocate_nonce(nonceg, NONCE_SIZE, &this->my_nonce))
+ if (!this->nonceg->allocate_nonce(this->nonceg, NONCE_SIZE,
+ &this->my_nonce))
{
DBG1(DBG_IKE, "nonce allocation failed");
- nonceg->destroy(nonceg);
return FAILED;
}
- nonceg->destroy(nonceg);
-
return SUCCESS;
}
}
DESTROY_IF(this->config);
+ DESTROY_IF(this->nonceg);
free(this);
}
.retry = FALSE,
);
+ this->nonceg = this->keymat->keymat.create_nonce_gen(&this->keymat->keymat);
+ if (!this->nonceg)
+ {
+ DBG1(DBG_IKE, "no nonce generator found to create nonce");
+ free(this);
+ return NULL;
+ }
+
if (config)
{
this->public.task.build = _build_i;