summaryrefslogtreecommitdiffstats
path: root/src/vnet/ipsec/ikev2_crypto.c
diff options
context:
space:
mode:
authorPing Yu <ping.yu@intel.com>2019-01-28 03:27:51 -0500
committerFlorin Coras <florin.coras@gmail.com>2019-01-28 15:21:11 +0000
commit31dd6090e882158a57dc02dead99c4577d59cd20 (patch)
treed8861047b3969b013b704e609928217255883719 /src/vnet/ipsec/ikev2_crypto.c
parent29c0b334010a9f8f85212ab55a5f4cf8c8ce3195 (diff)
Add Ipsec IKE support to openssl 3.0.0 master branch
Change-Id: I7bd43f57d23b1ecf031530c4a7508f949ddf616f Signed-off-by: Ping Yu <ping.yu@intel.com>
Diffstat (limited to 'src/vnet/ipsec/ikev2_crypto.c')
-rw-r--r--src/vnet/ipsec/ikev2_crypto.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/vnet/ipsec/ikev2_crypto.c b/src/vnet/ipsec/ikev2_crypto.c
index 037a3f5777e..ffe15891b75 100644
--- a/src/vnet/ipsec/ikev2_crypto.c
+++ b/src/vnet/ipsec/ikev2_crypto.c
@@ -533,7 +533,11 @@ ikev2_generate_dh (ikev2_sa_t * sa, ikev2_sa_transform_t * t)
y = BN_new ();
len = t->key_len / 2;
+#if OPENSSL_VERSION_NUMBER >= 0x30000000L
+ EC_POINT_get_affine_coordinates (group, r_point, x, y, bn_ctx);
+#else
EC_POINT_get_affine_coordinates_GFp (group, r_point, x, y, bn_ctx);
+#endif
if (sa->is_initiator)
{
@@ -562,12 +566,20 @@ ikev2_generate_dh (ikev2_sa_t * sa, ikev2_sa_transform_t * t)
x = BN_bin2bn (sa->i_dh_data, len, x);
y = BN_bin2bn (sa->i_dh_data + len, len, y);
+#if OPENSSL_VERSION_NUMBER >= 0x30000000L
+ EC_POINT_set_affine_coordinates (group, i_point, x, y, bn_ctx);
+#else
EC_POINT_set_affine_coordinates_GFp (group, i_point, x, y, bn_ctx);
+#endif
sa->dh_shared_key = vec_new (u8, t->key_len);
EC_POINT_mul (group, shared_point, NULL, i_point,
EC_KEY_get0_private_key (ec), NULL);
+#if OPENSSL_VERSION_NUMBER >= 0x30000000L
+ EC_POINT_get_affine_coordinates (group, shared_point, x, y, bn_ctx);
+#else
EC_POINT_get_affine_coordinates_GFp (group, shared_point, x, y,
bn_ctx);
+#endif
x_off = len - BN_num_bytes (x);
clib_memset (sa->dh_shared_key, 0, x_off);
BN_bn2bin (x, sa->dh_shared_key + x_off);
@@ -644,7 +656,11 @@ ikev2_complete_dh (ikev2_sa_t * sa, ikev2_sa_transform_t * t)
x = BN_bin2bn (sa->r_dh_data, len, x);
y = BN_bin2bn (sa->r_dh_data + len, len, y);
EC_POINT *r_point = EC_POINT_new (group);
+#if OPENSSL_VERSION_NUMBER >= 0x30000000L
+ EC_POINT_set_affine_coordinates (group, r_point, x, y, bn_ctx);
+#else
EC_POINT_set_affine_coordinates_GFp (group, r_point, x, y, bn_ctx);
+#endif
EC_KEY_set_public_key (ec, r_point);
EC_POINT *i_point = EC_POINT_new (group);
@@ -652,10 +668,18 @@ ikev2_complete_dh (ikev2_sa_t * sa, ikev2_sa_transform_t * t)
x = BN_bin2bn (sa->i_dh_data, len, x);
y = BN_bin2bn (sa->i_dh_data + len, len, y);
+#if OPENSSL_VERSION_NUMBER >= 0x30000000L
+ EC_POINT_set_affine_coordinates (group, i_point, x, y, bn_ctx);
+#else
EC_POINT_set_affine_coordinates_GFp (group, i_point, x, y, bn_ctx);
+#endif
EC_POINT_mul (group, shared_point, NULL, r_point,
EC_KEY_get0_private_key (ec), NULL);
+#if OPENSSL_VERSION_NUMBER >= 0x30000000L
+ EC_POINT_get_affine_coordinates (group, shared_point, x, y, bn_ctx);
+#else
EC_POINT_get_affine_coordinates_GFp (group, shared_point, x, y, bn_ctx);
+#endif
sa->dh_shared_key = vec_new (u8, t->key_len);
x_off = len - BN_num_bytes (x);
clib_memset (sa->dh_shared_key, 0, x_off);