diff options
-rw-r--r-- | src/libcharon/sa/ikev1/keymat_v1.c | 7 | ||||
-rw-r--r-- | src/libcharon/sa/ikev2/keymat_v2.c | 7 | ||||
-rw-r--r-- | src/libcharon/sa/keymat.h | 7 |
3 files changed, 21 insertions, 0 deletions
diff --git a/src/libcharon/sa/ikev1/keymat_v1.c b/src/libcharon/sa/ikev1/keymat_v1.c index 100c9526a..a0dbd5296 100644 --- a/src/libcharon/sa/ikev1/keymat_v1.c +++ b/src/libcharon/sa/ikev1/keymat_v1.c @@ -946,6 +946,12 @@ METHOD(keymat_v1_t, confirm_iv, void, } } +METHOD(keymat_t, get_version, ike_version_t, + private_keymat_v1_t *this) +{ + return IKEV1; +} + METHOD(keymat_t, create_dh, diffie_hellman_t*, private_keymat_v1_t *this, diffie_hellman_group_t group) { @@ -984,6 +990,7 @@ keymat_v1_t *keymat_v1_create(bool initiator) INIT(this, .public = { .keymat = { + .get_version = _get_version, .create_dh = _create_dh, .get_aead = _get_aead, .destroy = _destroy, diff --git a/src/libcharon/sa/ikev2/keymat_v2.c b/src/libcharon/sa/ikev2/keymat_v2.c index aacff0a99..3adceeec4 100644 --- a/src/libcharon/sa/ikev2/keymat_v2.c +++ b/src/libcharon/sa/ikev2/keymat_v2.c @@ -71,6 +71,12 @@ struct private_keymat_v2_t { chunk_t skp_verify; }; +METHOD(keymat_t, get_version, ike_version_t, + private_keymat_v2_t *this) +{ + return IKEV2; +} + METHOD(keymat_t, create_dh, diffie_hellman_t*, private_keymat_v2_t *this, diffie_hellman_group_t group) { @@ -563,6 +569,7 @@ keymat_v2_t *keymat_v2_create(bool initiator) INIT(this, .public = { .keymat = { + .get_version = _get_version, .create_dh = _create_dh, .get_aead = _get_aead, .destroy = _destroy, diff --git a/src/libcharon/sa/keymat.h b/src/libcharon/sa/keymat.h index 4a551a8f5..9de2574e1 100644 --- a/src/libcharon/sa/keymat.h +++ b/src/libcharon/sa/keymat.h @@ -37,6 +37,13 @@ typedef struct keymat_t keymat_t; struct keymat_t { /** + * Get IKE version of this keymat. + * + * @return IKEV1 for keymat_v1_t, IKEV2 for keymat_v2_t + */ + ike_version_t (*get_version)(keymat_t *this); + + /** * Create a diffie hellman object for key agreement. * * The diffie hellman is either for IKE negotiation/rekeying or |