aboutsummaryrefslogtreecommitdiffstats
path: root/Source/charon/encoding/payloads/transform_substructure.c
diff options
context:
space:
mode:
authorJan Hutter <jhutter@hsr.ch>2005-12-01 08:48:57 +0000
committerJan Hutter <jhutter@hsr.ch>2005-12-01 08:48:57 +0000
commitb737e9d9e8e44b360509cfab36d22170f54af334 (patch)
treec2ba421ea4619d8f5c28bbf948b0bda1156722b0 /Source/charon/encoding/payloads/transform_substructure.c
parentd45ec1dedfa06155c344f5cce0ac7b2ec331c825 (diff)
downloadstrongswan-b737e9d9e8e44b360509cfab36d22170f54af334.tar.bz2
strongswan-b737e9d9e8e44b360509cfab36d22170f54af334.tar.xz
implemented and tested functionality to create sa_payload from
ike_proposal_t's and also generate ike_proposal_t's from sa_payload
Diffstat (limited to 'Source/charon/encoding/payloads/transform_substructure.c')
-rw-r--r--Source/charon/encoding/payloads/transform_substructure.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/Source/charon/encoding/payloads/transform_substructure.c b/Source/charon/encoding/payloads/transform_substructure.c
index 3c91b257c..99af36c8d 100644
--- a/Source/charon/encoding/payloads/transform_substructure.c
+++ b/Source/charon/encoding/payloads/transform_substructure.c
@@ -448,7 +448,7 @@ static void destroy(private_transform_substructure_t *this)
}
/*
- * Described in header
+ * Described in header.
*/
transform_substructure_t *transform_substructure_create()
{
@@ -488,3 +488,31 @@ transform_substructure_t *transform_substructure_create()
return (&(this->public));
}
+
+/*
+ * Described in header
+ */
+transform_substructure_t *transform_substructure_create_type(transform_type_t transform_type, u_int16_t transform_id, u_int16_t key_length)
+{
+ transform_substructure_t *transform = transform_substructure_create();
+
+ transform->set_transform_type(transform,transform_type);
+ transform->set_transform_id(transform,transform_id);
+
+ switch (transform_type)
+ {
+ case ENCRYPTION_ALGORITHM:
+ case PSEUDO_RANDOM_FUNCTION:
+ case INTEGRITY_ALGORITHM:
+ {
+ transform_attribute_t *attribute = transform_attribute_create_key_length(key_length);
+ transform->add_transform_attribute(transform,attribute);
+ break;
+ }
+ default:
+ {
+ /* no keylength attribute is created */
+ }
+ }
+ return transform;
+}