child-create: Add an option to set the DH group to be used

This commit is contained in:
Tobias Brunner
2018-02-09 10:20:05 +01:00
parent 727615ee05
commit f8e53003aa
2 changed files with 21 additions and 4 deletions
+10 -3
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2008-2017 Tobias Brunner
* Copyright (C) 2008-2018 Tobias Brunner
* Copyright (C) 2005-2008 Martin Willi
* Copyright (C) 2005 Jan Hutter
* HSR Hochschule fuer Technik Rapperswil
@@ -1006,8 +1006,8 @@ METHOD(task_t, build_i, status_t,
chunk_empty);
return SUCCESS;
}
if (!this->retry)
{
if (!this->retry && this->dh_group == MODP_NONE)
{ /* during a rekeying the group might already be set */
this->dh_group = this->config->get_dh_group(this->config);
}
break;
@@ -1615,6 +1615,12 @@ METHOD(child_create_t, use_marks, void,
this->mark_out = out;
}
METHOD(child_create_t, use_dh_group, void,
private_child_create_t *this, diffie_hellman_group_t dh_group)
{
this->dh_group = dh_group;
}
METHOD(child_create_t, get_child, child_sa_t*,
private_child_create_t *this)
{
@@ -1736,6 +1742,7 @@ child_create_t *child_create_create(ike_sa_t *ike_sa,
.get_lower_nonce = _get_lower_nonce,
.use_reqid = _use_reqid,
.use_marks = _use_marks,
.use_dh_group = _use_dh_group,
.task = {
.get_type = _get_type,
.migrate = _migrate,
+11 -1
View File
@@ -1,6 +1,7 @@
/*
* Copyright (C) 2018 Tobias Brunner
* Copyright (C) 2007 Martin Willi
* Hochschule fuer Technik Rapperswil
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -59,6 +60,15 @@ struct child_create_t {
*/
void (*use_marks)(child_create_t *this, u_int in, u_int out);
/**
* Initially propose a specific DH group to override configuration.
*
* This is used during rekeying to prefer the previously negotiated group.
*
* @param dh_group DH group to use
*/
void (*use_dh_group)(child_create_t *this, diffie_hellman_group_t dh_group);
/**
* Get the lower of the two nonces, used for rekey collisions.
*