aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/pluto/Makefile.am4
-rw-r--r--src/pluto/alg/ike_alg_3des.c34
-rw-r--r--src/pluto/alg/ike_alg_aes.c37
-rw-r--r--src/pluto/alg/ike_alg_blowfish.c36
-rw-r--r--src/pluto/alg/ike_alg_dh_groups.c124
-rw-r--r--src/pluto/alg/ike_alg_md5_sha1.c37
-rw-r--r--src/pluto/alg/ike_alg_serpent.c37
-rw-r--r--src/pluto/alg/ike_alg_sha2.c42
-rw-r--r--src/pluto/alg/ike_alg_twofish.c49
-rw-r--r--src/pluto/crypto.c241
10 files changed, 214 insertions, 427 deletions
diff --git a/src/pluto/Makefile.am b/src/pluto/Makefile.am
index cfbd6c77b..01237305b 100644
--- a/src/pluto/Makefile.am
+++ b/src/pluto/Makefile.am
@@ -50,10 +50,6 @@ vendor.c vendor.h \
virtual.c virtual.h \
xauth.c xauth.h \
x509.c x509.h \
-alg/ike_alg_3des.c alg/ike_alg_aes.c \
-alg/ike_alg_blowfish.c alg/ike_alg_twofish.c alg/ike_alg_serpent.c\
-alg/ike_alg_md5_sha1.c alg/ike_alg_sha2.c \
-alg/ike_alg_dh_groups.c \
rsaref/pkcs11t.h rsaref/pkcs11.h rsaref/unix.h rsaref/pkcs11f.h
_pluto_adns_SOURCES = adns.c adns.h
diff --git a/src/pluto/alg/ike_alg_3des.c b/src/pluto/alg/ike_alg_3des.c
deleted file mode 100644
index 1fab8c3e0..000000000
--- a/src/pluto/alg/ike_alg_3des.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* IKE 3DES encryption algorithm description
- * Copyright (C) 1998-2001 D. Hugh Redelmeier
- * Copyright (C) 2009 Andreas Steffen
- *
- * 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
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- */
-
-#include <crypto/crypters/crypter.h>
-
-#include "ike_alg.h"
-
-struct encrypt_desc encrypt_desc_3des =
-{
- algo_type: IKE_ALG_ENCRYPT,
- algo_id: OAKLEY_3DES_CBC,
- algo_next: NULL,
-
- enc_blocksize: DES_BLOCK_SIZE,
- keydeflen: DES_BLOCK_SIZE * 3 * BITS_PER_BYTE,
- keyminlen: DES_BLOCK_SIZE * 3 * BITS_PER_BYTE,
- keymaxlen: DES_BLOCK_SIZE * 3 * BITS_PER_BYTE,
-};
-
-
diff --git a/src/pluto/alg/ike_alg_aes.c b/src/pluto/alg/ike_alg_aes.c
deleted file mode 100644
index ed14afe86..000000000
--- a/src/pluto/alg/ike_alg_aes.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* IKE AES encryption algorithm description
- * Copyright (C) JuanJo Ciarlante <jjo-ipsec@mendoza.gov.ar>
- * Copyright (C) 2009 Andreas Steffen
- *
- * 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
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- */
-
-#include <crypto/crypters/crypter.h>
-
-#include "ike_alg.h"
-
-#define AES_KEY_MIN_LEN 128
-#define AES_KEY_DEF_LEN 128
-#define AES_KEY_MAX_LEN 256
-
-struct encrypt_desc encrypt_desc_aes =
-{
- algo_type: IKE_ALG_ENCRYPT,
- algo_id: OAKLEY_AES_CBC,
- algo_next: NULL,
-
- enc_blocksize: AES_BLOCK_SIZE,
- keyminlen: AES_KEY_MIN_LEN,
- keydeflen: AES_KEY_DEF_LEN,
- keymaxlen: AES_KEY_MAX_LEN,
-};
-
diff --git a/src/pluto/alg/ike_alg_blowfish.c b/src/pluto/alg/ike_alg_blowfish.c
deleted file mode 100644
index d1121e1a5..000000000
--- a/src/pluto/alg/ike_alg_blowfish.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* IKE Blowfish encryption algorithm description
- * Copyright (C) JuanJo Ciarlante <jjo-ipsec@mendoza.gov.ar>
- * Copyright (C) 2009 Andreas Steffen
- *
- * 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
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- */
-
-#include <crypto/crypters/crypter.h>
-
-#include "ike_alg.h"
-
-#define BLOWFISH_KEY_MIN_LEN 128
-#define BLOWFISH_KEY_MAX_LEN 448
-
-struct encrypt_desc encrypt_desc_blowfish =
-{
- algo_type: IKE_ALG_ENCRYPT,
- algo_id: OAKLEY_BLOWFISH_CBC,
- algo_next: NULL,
-
- enc_blocksize: BLOWFISH_BLOCK_SIZE,
- keyminlen: BLOWFISH_KEY_MIN_LEN,
- keydeflen: BLOWFISH_KEY_MIN_LEN,
- keymaxlen: BLOWFISH_KEY_MAX_LEN,
-};
-
diff --git a/src/pluto/alg/ike_alg_dh_groups.c b/src/pluto/alg/ike_alg_dh_groups.c
deleted file mode 100644
index 7d9aea5ea..000000000
--- a/src/pluto/alg/ike_alg_dh_groups.c
+++ /dev/null
@@ -1,124 +0,0 @@
-/* IKE Diffie-Hellman group description
- * Copyright (C) 2009 Andreas Steffen
- *
- * 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
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- */
-
-#include <crypto/diffie_hellman.h>
-
-#include "ike_alg.h"
-
-struct dh_desc unset_group = {
- algo_type: IKE_ALG_DH_GROUP,
- algo_id: MODP_NONE,
- algo_next: NULL,
-
- ke_size: 0
-};
-
-struct dh_desc dh_desc_modp_1024 = {
- algo_type: IKE_ALG_DH_GROUP,
- algo_id: MODP_1024_BIT,
- algo_next: NULL,
-
- ke_size: 1024 / BITS_PER_BYTE
-};
-
-struct dh_desc dh_desc_modp_1536 = {
- algo_type: IKE_ALG_DH_GROUP,
- algo_id: MODP_1536_BIT,
- algo_next: NULL,
-
- ke_size: 1536 / BITS_PER_BYTE
-};
-
-struct dh_desc dh_desc_modp_2048 = {
- algo_type: IKE_ALG_DH_GROUP,
- algo_id: MODP_2048_BIT,
- algo_next: NULL,
-
- ke_size: 2048 / BITS_PER_BYTE
-};
-
-struct dh_desc dh_desc_modp_3072 = {
- algo_type: IKE_ALG_DH_GROUP,
- algo_id: MODP_3072_BIT,
- algo_next: NULL,
-
- ke_size: 3072 / BITS_PER_BYTE
-};
-
-struct dh_desc dh_desc_modp_4096 = {
- algo_type: IKE_ALG_DH_GROUP,
- algo_id: MODP_4096_BIT,
- algo_next: NULL,
-
- ke_size: 4096 / BITS_PER_BYTE
-};
-
-struct dh_desc dh_desc_modp_6144 = {
- algo_type: IKE_ALG_DH_GROUP,
- algo_id: MODP_6144_BIT,
- algo_next: NULL,
-
- ke_size: 6144 / BITS_PER_BYTE
-};
-
-struct dh_desc dh_desc_modp_8192 = {
- algo_type: IKE_ALG_DH_GROUP,
- algo_id: MODP_8192_BIT,
- algo_next: NULL,
-
- ke_size: 8192 / BITS_PER_BYTE
-};
-
-struct dh_desc dh_desc_ecp_256 = {
- algo_type: IKE_ALG_DH_GROUP,
- algo_id: ECP_256_BIT,
- algo_next: NULL,
-
- ke_size: 2*256 / BITS_PER_BYTE
-};
-
-struct dh_desc dh_desc_ecp_384 = {
- algo_type: IKE_ALG_DH_GROUP,
- algo_id: ECP_384_BIT,
- algo_next: NULL,
-
- ke_size: 2*384 / BITS_PER_BYTE
-};
-
-struct dh_desc dh_desc_ecp_521 = {
- algo_type: IKE_ALG_DH_GROUP,
- algo_id: ECP_521_BIT,
- algo_next: NULL,
-
- ke_size: 2*528 / BITS_PER_BYTE
-};
-
-struct dh_desc dh_desc_ecp_192 = {
- algo_type: IKE_ALG_DH_GROUP,
- algo_id: ECP_192_BIT,
- algo_next: NULL,
-
- ke_size: 2*192 / BITS_PER_BYTE
-};
-
-struct dh_desc dh_desc_ecp_224 = {
- algo_type: IKE_ALG_DH_GROUP,
- algo_id: ECP_224_BIT,
- algo_next: NULL,
-
- ke_size: 2*224 / BITS_PER_BYTE
-};
-
diff --git a/src/pluto/alg/ike_alg_md5_sha1.c b/src/pluto/alg/ike_alg_md5_sha1.c
deleted file mode 100644
index b70e1d5a3..000000000
--- a/src/pluto/alg/ike_alg_md5_sha1.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* IKE MD5 and SHA-1 hash algorithm descriptions
- * Copyright (C) 1998-2001 D. Hugh Redelmeier
- * Copyright (C) 2009 Andreas Steffen
- *
- * 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
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- */
-
-#include <crypto/hashers/hasher.h>
-
-#include "ike_alg.h"
-
-struct hash_desc hash_desc_md5 =
-{
- algo_type: IKE_ALG_HASH,
- algo_id: OAKLEY_MD5,
- algo_next: NULL,
- hash_digest_size: HASH_SIZE_MD5,
-};
-
-struct hash_desc hash_desc_sha1 =
-{
- algo_type: IKE_ALG_HASH,
- algo_id: OAKLEY_SHA,
- algo_next: NULL,
- hash_digest_size: HASH_SIZE_SHA1,
-};
-
diff --git a/src/pluto/alg/ike_alg_serpent.c b/src/pluto/alg/ike_alg_serpent.c
deleted file mode 100644
index baeca57e9..000000000
--- a/src/pluto/alg/ike_alg_serpent.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* IKE Serpent encryption algorithm description
- * Copyright (C) JuanJo Ciarlante <jjo-ipsec@mendoza.gov.ar>
- * Copyright (C) 2009 Andreas Steffen
- *
- * 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
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- */
-
-#include <crypto/crypters/crypter.h>
-
-#include "ike_alg.h"
-
-#define SERPENT_KEY_MIN_LEN 128
-#define SERPENT_KEY_DEF_LEN 128
-#define SERPENT_KEY_MAX_LEN 256
-
-struct encrypt_desc encrypt_desc_serpent =
-{
- algo_type: IKE_ALG_ENCRYPT,
- algo_id: OAKLEY_SERPENT_CBC,
- algo_next: NULL,
-
- enc_blocksize: SERPENT_BLOCK_SIZE,
- keyminlen: SERPENT_KEY_MIN_LEN,
- keydeflen: SERPENT_KEY_DEF_LEN,
- keymaxlen: SERPENT_KEY_MAX_LEN,
-};
-
diff --git a/src/pluto/alg/ike_alg_sha2.c b/src/pluto/alg/ike_alg_sha2.c
deleted file mode 100644
index 455e2e342..000000000
--- a/src/pluto/alg/ike_alg_sha2.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/* IKE SHA-2 hash algorithm description
- * Copyright (C) JuanJo Ciarlante <jjo-ipsec@mendoza.gov.ar>
- * Copyright (C) 2009 Andreas Steffen
- *
- * 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
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- */
-
-#include <crypto/hashers/hasher.h>
-
-#include "ike_alg.h"
-
-struct hash_desc hash_desc_sha2_256 = {
- algo_type: IKE_ALG_HASH,
- algo_id: OAKLEY_SHA2_256,
- algo_next: NULL,
- hash_digest_size: HASH_SIZE_SHA256,
-};
-
-struct hash_desc hash_desc_sha2_384 = {
- algo_type: IKE_ALG_HASH,
- algo_id: OAKLEY_SHA2_384,
- algo_next: NULL,
- hash_digest_size: HASH_SIZE_SHA384,
-};
-
-struct hash_desc hash_desc_sha2_512 = {
- algo_type: IKE_ALG_HASH,
- algo_id: OAKLEY_SHA2_512,
- algo_next: NULL,
- hash_digest_size: HASH_SIZE_SHA512,
-};
-
diff --git a/src/pluto/alg/ike_alg_twofish.c b/src/pluto/alg/ike_alg_twofish.c
deleted file mode 100644
index 2d805a3e3..000000000
--- a/src/pluto/alg/ike_alg_twofish.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/* IKE Twofish encryption algorithm description
- * Copyright (C) JuanJo Ciarlante <jjo-ipsec@mendoza.gov.ar>
- * Copyright (C) 2009 Andreas Steffen
- *
- * 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
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- */
-
-#include <crypto/crypters/crypter.h>
-
-#include "ike_alg.h"
-
-#define TWOFISH_KEY_MIN_LEN 128
-#define TWOFISH_KEY_DEF_LEN 128
-#define TWOFISH_KEY_MAX_LEN 256
-
-struct encrypt_desc encrypt_desc_twofish =
-{
- algo_type: IKE_ALG_ENCRYPT,
- algo_id: OAKLEY_TWOFISH_CBC,
- algo_next: NULL,
-
- enc_blocksize: TWOFISH_BLOCK_SIZE,
- keydeflen: TWOFISH_KEY_MIN_LEN,
- keyminlen: TWOFISH_KEY_DEF_LEN,
- keymaxlen: TWOFISH_KEY_MAX_LEN,
-};
-
-struct encrypt_desc encrypt_desc_twofish_ssh =
-{
- algo_type: IKE_ALG_ENCRYPT,
- algo_id: OAKLEY_TWOFISH_CBC_SSH,
- algo_next: NULL,
-
- enc_blocksize: TWOFISH_BLOCK_SIZE,
- keydeflen: TWOFISH_KEY_MIN_LEN,
- keyminlen: TWOFISH_KEY_DEF_LEN,
- keymaxlen: TWOFISH_KEY_MAX_LEN,
-};
-
diff --git a/src/pluto/crypto.c b/src/pluto/crypto.c
index d46347373..1adccc74e 100644
--- a/src/pluto/crypto.c
+++ b/src/pluto/crypto.c
@@ -18,35 +18,222 @@
#include "constants.h"
#include "defs.h"
#include "crypto.h"
-#include "ike_alg.h"
#include "log.h"
-extern struct encrypt_desc encrypt_desc_3des;
-extern struct encrypt_desc encrypt_desc_blowfish;
-extern struct encrypt_desc encrypt_desc_aes;
-extern struct encrypt_desc encrypt_desc_twofish;
-extern struct encrypt_desc encrypt_desc_twofish_ssh;
-extern struct encrypt_desc encrypt_desc_serpent;
-
-extern struct hash_desc hash_desc_md5;
-extern struct hash_desc hash_desc_sha1;
-extern struct hash_desc hash_desc_sha2_256;
-extern struct hash_desc hash_desc_sha2_384;
-extern struct hash_desc hash_desc_sha2_512;
-
-extern struct dh_desc dh_desc_modp_1024;
-extern struct dh_desc dh_desc_modp_1536;
-extern struct dh_desc dh_desc_modp_2048;
-extern struct dh_desc dh_desc_modp_3072;
-extern struct dh_desc dh_desc_modp_4096;
-extern struct dh_desc dh_desc_modp_6144;
-extern struct dh_desc dh_desc_modp_8192;
-
-extern struct dh_desc dh_desc_ecp_256;
-extern struct dh_desc dh_desc_ecp_384;
-extern struct dh_desc dh_desc_ecp_521;
-extern struct dh_desc dh_desc_ecp_192;
-extern struct dh_desc dh_desc_ecp_224;
+static struct encrypt_desc encrypt_desc_3des =
+{
+ algo_type: IKE_ALG_ENCRYPT,
+ algo_id: OAKLEY_3DES_CBC,
+ algo_next: NULL,
+
+ enc_blocksize: DES_BLOCK_SIZE,
+ keydeflen: DES_BLOCK_SIZE * 3 * BITS_PER_BYTE,
+ keyminlen: DES_BLOCK_SIZE * 3 * BITS_PER_BYTE,
+ keymaxlen: DES_BLOCK_SIZE * 3 * BITS_PER_BYTE,
+};
+
+#define AES_KEY_MIN_LEN 128
+#define AES_KEY_DEF_LEN 128
+#define AES_KEY_MAX_LEN 256
+
+static struct encrypt_desc encrypt_desc_aes =
+{
+ algo_type: IKE_ALG_ENCRYPT,
+ algo_id: OAKLEY_AES_CBC,
+ algo_next: NULL,
+
+ enc_blocksize: AES_BLOCK_SIZE,
+ keyminlen: AES_KEY_MIN_LEN,
+ keydeflen: AES_KEY_DEF_LEN,
+ keymaxlen: AES_KEY_MAX_LEN,
+};
+
+#define BLOWFISH_KEY_MIN_LEN 128
+#define BLOWFISH_KEY_MAX_LEN 448
+
+static struct encrypt_desc encrypt_desc_blowfish =
+{
+ algo_type: IKE_ALG_ENCRYPT,
+ algo_id: OAKLEY_BLOWFISH_CBC,
+ algo_next: NULL,
+
+ enc_blocksize: BLOWFISH_BLOCK_SIZE,
+ keyminlen: BLOWFISH_KEY_MIN_LEN,
+ keydeflen: BLOWFISH_KEY_MIN_LEN,
+ keymaxlen: BLOWFISH_KEY_MAX_LEN,
+};
+
+#define SERPENT_KEY_MIN_LEN 128
+#define SERPENT_KEY_DEF_LEN 128
+#define SERPENT_KEY_MAX_LEN 256
+
+static struct encrypt_desc encrypt_desc_serpent =
+{
+ algo_type: IKE_ALG_ENCRYPT,
+ algo_id: OAKLEY_SERPENT_CBC,
+ algo_next: NULL,
+
+ enc_blocksize: SERPENT_BLOCK_SIZE,
+ keyminlen: SERPENT_KEY_MIN_LEN,
+ keydeflen: SERPENT_KEY_DEF_LEN,
+ keymaxlen: SERPENT_KEY_MAX_LEN,
+};
+
+#define TWOFISH_KEY_MIN_LEN 128
+#define TWOFISH_KEY_DEF_LEN 128
+#define TWOFISH_KEY_MAX_LEN 256
+
+static struct encrypt_desc encrypt_desc_twofish =
+{
+ algo_type: IKE_ALG_ENCRYPT,
+ algo_id: OAKLEY_TWOFISH_CBC,
+ algo_next: NULL,
+
+ enc_blocksize: TWOFISH_BLOCK_SIZE,
+ keydeflen: TWOFISH_KEY_MIN_LEN,
+ keyminlen: TWOFISH_KEY_DEF_LEN,
+ keymaxlen: TWOFISH_KEY_MAX_LEN,
+};
+
+static struct encrypt_desc encrypt_desc_twofish_ssh =
+{
+ algo_type: IKE_ALG_ENCRYPT,
+ algo_id: OAKLEY_TWOFISH_CBC_SSH,
+ algo_next: NULL,
+
+ enc_blocksize: TWOFISH_BLOCK_SIZE,
+ keydeflen: TWOFISH_KEY_MIN_LEN,
+ keyminlen: TWOFISH_KEY_DEF_LEN,
+ keymaxlen: TWOFISH_KEY_MAX_LEN,
+};
+
+static struct hash_desc hash_desc_md5 =
+{
+ algo_type: IKE_ALG_HASH,
+ algo_id: OAKLEY_MD5,
+ algo_next: NULL,
+ hash_digest_size: HASH_SIZE_MD5,
+};
+
+static struct hash_desc hash_desc_sha1 =
+{
+ algo_type: IKE_ALG_HASH,
+ algo_id: OAKLEY_SHA,
+ algo_next: NULL,
+ hash_digest_size: HASH_SIZE_SHA1,
+};
+
+static struct hash_desc hash_desc_sha2_256 = {
+ algo_type: IKE_ALG_HASH,
+ algo_id: OAKLEY_SHA2_256,
+ algo_next: NULL,
+ hash_digest_size: HASH_SIZE_SHA256,
+};
+
+static struct hash_desc hash_desc_sha2_384 = {
+ algo_type: IKE_ALG_HASH,
+ algo_id: OAKLEY_SHA2_384,
+ algo_next: NULL,
+ hash_digest_size: HASH_SIZE_SHA384,
+};
+
+static struct hash_desc hash_desc_sha2_512 = {
+ algo_type: IKE_ALG_HASH,
+ algo_id: OAKLEY_SHA2_512,
+ algo_next: NULL,
+ hash_digest_size: HASH_SIZE_SHA512,
+};
+
+const struct dh_desc unset_group = {
+ algo_type: IKE_ALG_DH_GROUP,
+ algo_id: MODP_NONE,
+ algo_next: NULL,
+ ke_size: 0
+};
+
+static struct dh_desc dh_desc_modp_1024 = {
+ algo_type: IKE_ALG_DH_GROUP,
+ algo_id: MODP_1024_BIT,
+ algo_next: NULL,
+ ke_size: 1024 / BITS_PER_BYTE
+};
+
+static struct dh_desc dh_desc_modp_1536 = {
+ algo_type: IKE_ALG_DH_GROUP,
+ algo_id: MODP_1536_BIT,
+ algo_next: NULL,
+ ke_size: 1536 / BITS_PER_BYTE
+};
+
+static struct dh_desc dh_desc_modp_2048 = {
+ algo_type: IKE_ALG_DH_GROUP,
+ algo_id: MODP_2048_BIT,
+ algo_next: NULL,
+ ke_size: 2048 / BITS_PER_BYTE
+};
+
+static struct dh_desc dh_desc_modp_3072 = {
+ algo_type: IKE_ALG_DH_GROUP,
+ algo_id: MODP_3072_BIT,
+ algo_next: NULL,
+ ke_size: 3072 / BITS_PER_BYTE
+};
+
+static struct dh_desc dh_desc_modp_4096 = {
+ algo_type: IKE_ALG_DH_GROUP,
+ algo_id: MODP_4096_BIT,
+ algo_next: NULL,
+ ke_size: 4096 / BITS_PER_BYTE
+};
+
+static struct dh_desc dh_desc_modp_6144 = {
+ algo_type: IKE_ALG_DH_GROUP,
+ algo_id: MODP_6144_BIT,
+ algo_next: NULL,
+ ke_size: 6144 / BITS_PER_BYTE
+};
+
+static struct dh_desc dh_desc_modp_8192 = {
+ algo_type: IKE_ALG_DH_GROUP,
+ algo_id: MODP_8192_BIT,
+ algo_next: NULL,
+ ke_size: 8192 / BITS_PER_BYTE
+};
+
+static struct dh_desc dh_desc_ecp_256 = {
+ algo_type: IKE_ALG_DH_GROUP,
+ algo_id: ECP_256_BIT,
+ algo_next: NULL,
+ ke_size: 2*256 / BITS_PER_BYTE
+};
+
+static struct dh_desc dh_desc_ecp_384 = {
+ algo_type: IKE_ALG_DH_GROUP,
+ algo_id: ECP_384_BIT,
+ algo_next: NULL,
+ ke_size: 2*384 / BITS_PER_BYTE
+};
+
+static struct dh_desc dh_desc_ecp_521 = {
+ algo_type: IKE_ALG_DH_GROUP,
+ algo_id: ECP_521_BIT,
+ algo_next: NULL,
+ ke_size: 2*528 / BITS_PER_BYTE
+};
+
+static struct dh_desc dh_desc_ecp_192 = {
+ algo_type: IKE_ALG_DH_GROUP,
+ algo_id: ECP_192_BIT,
+ algo_next: NULL,
+ ke_size: 2*192 / BITS_PER_BYTE
+};
+
+static struct dh_desc dh_desc_ecp_224 = {
+ algo_type: IKE_ALG_DH_GROUP,
+ algo_id: ECP_224_BIT,
+ algo_next: NULL,
+ ke_size: 2*224 / BITS_PER_BYTE
+};
void init_crypto(void)
{