proposal: Use an additional "default" constructor specific to AEAD algorithms

This allows a caller to create a separated proposal for supported AEAD
algorithms, as required by RFC 5996.
This commit is contained in:
Martin Willi
2014-05-16 16:01:21 +02:00
parent 0fc4dd429d
commit 8642f8bdb7
2 changed files with 31 additions and 0 deletions
+23
View File
@@ -809,6 +809,29 @@ proposal_t *proposal_create_default(protocol_id_t protocol)
return &this->public;
}
/*
* Describtion in header-file
*/
proposal_t *proposal_create_default_aead(protocol_id_t protocol)
{
private_proposal_t *this;
switch (protocol)
{
case PROTO_IKE:
this = (private_proposal_t*)proposal_create(protocol, 0);
proposal_add_supported_ike(this, TRUE);
return &this->public;
case PROTO_ESP:
/* we currently don't include any AEAD proposal for ESP, as we
* don't know if our kernel backend actually supports it. */
return NULL;
case PROTO_AH:
default:
return NULL;
}
}
/*
* Describtion in header-file
*/
+8
View File
@@ -195,6 +195,14 @@ proposal_t *proposal_create(protocol_id_t protocol, u_int number);
*/
proposal_t *proposal_create_default(protocol_id_t protocol);
/**
* Create a default proposal for supported AEAD algorithms
*
* @param protocol protocol, such as PROTO_ESP
* @return proposal_t object, NULL if none supported
*/
proposal_t *proposal_create_default_aead(protocol_id_t protocol);
/**
* Create a proposal from a string identifying the algorithms.
*