+ goto failed;
+ }
+ this->aead = aead_create(crypter, signer);
+ return TRUE;
+
+failed:
+ DESTROY_IF(crypter);
+ DESTROY_IF(signer);
+ return FALSE;
+}
+
+/**
+ * Described in header.
+ */
+esp_context_t *esp_context_create(int enc_alg, chunk_t enc_key,
+ int int_alg, chunk_t int_key, bool inbound)
+{
+ private_esp_context_t *this;
+
+ INIT(this,
+ .public = {
+ .get_aead = _get_aead,
+ .get_seqno = _get_seqno,
+ .next_seqno = _next_seqno,
+ .verify_seqno = _verify_seqno,
+ .set_authenticated_seqno = _set_authenticated_seqno,
+ .destroy = _destroy,
+ },
+ .inbound = inbound,
+ .window_size = ESP_DEFAULT_WINDOW_SIZE,
+ );
+
+ if (!create_traditional(this, enc_alg, enc_key, int_alg, int_key))
+ {