Skip to contentSkip to conversation

IPsec: add support for Twofish and Serpent

PATCH In review Kyle McMartin 4 participants 7 messages Aug 14, 2003 – Aug 15, 2003

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 IPsec: add support for Twofish and Serpent

This patch adds support for the use of twofish and serpent as ESP algorithms. The ESP index numbers given are in accordance with RFC2407, draft-ietf-ipsec-ciph-aes-cbc-00 (before Rijndael was selected), and KAME which assigns 253 to twofishcbc.

Support for using twofish was requested on linux-kernel, and since I noticed serpent was missing too, included that as well.

Regards,

Signature · 3 lines
Kyle McMartin <[email protected]>
1024D/191FCD8A - 331A 9468 C04D 3A76 5C56  BA68 7EB7 92DF 191F CD8A
2048R/F515317D -   68 A9 0D 28 1B DF 8D 42  0F CC AF 98 A8 D5 A4 04
include/linux/pfkeyv2.h renamed from include/linux/pfkeyv2.h.old +4 -1
@@ -284,7 +284,10 @@
 #define SADB_X_EALG_BLOWFISHCBC		7
 #define SADB_EALG_NULL			11
 #define SADB_X_EALG_AESCBC		12
-#define SADB_EALG_MAX			12
+#define SADB_EALG_MAX                   253 /* last EALG */
+/* private allocations should use 249-255 (RFC2407) */
+#define SADB_X_EALG_SERPENTCBC  252     /* draft-ietf-ipsec-ciph-aes-cbc-00 */
+#define SADB_X_EALG_TWOFISHCBC  253     /* draft-ietf-ipsec-ciph-aes-cbc-00 */
 
 /* Compression algorithms */
 #define SADB_X_CALG_NONE		0
net/xfrm/xfrm_algo.c renamed from net/xfrm/xfrm_algo.c.old +34 -0
@@ -217,6 +217,40 @@
 		.sadb_alg_maxbits = 256
 	}
 },
+{
+        .name = "serpent",
+
+        .uinfo = {
+                .encr = {
+                        .blockbits = 128,
+                        .defkeybits = 128,
+                }
+        },
+
+        .desc = {
+                .sadb_alg_id = SADB_X_EALG_SERPENTCBC,
+                .sadb_alg_ivlen = 8,
+                .sadb_alg_minbits = 128,
+                .sadb_alg_maxbits = 256,
+        }
+},
+{
+        .name = "twofish",
+                 
+        .uinfo = {
+                .encr = {
+                        .blockbits = 128,
+                        .defkeybits = 128,
+                }
+        },
+
+        .desc = {
+                .sadb_alg_id = SADB_X_EALG_TWOFISHCBC,
+                .sadb_alg_ivlen = 8,
+                .sadb_alg_minbits = 128,
+                .sadb_alg_maxbits = 256
+        }
+},
 };
 
 static struct xfrm_algo_desc calg_list[] = {
#1 lore raw
Quoted 8 lines · Kyle McMartin

This patch adds support for the use of twofish and serpent as ESP algorithms. The ESP index numbers given are in accordance with RFC2407, draft-ietf-ipsec-ciph-aes-cbc-00 (before Rijndael was selected), and KAME which assigns 253 to twofishcbc.

Support for using twofish was requested on linux-kernel, and since I noticed serpent was missing too, included that as well.

Hi

Nothing against twofish or serpent per se, but I have this feeling that supporting every possible crypto algoritm known to man
is not necessarily wise (see eg. Practical Cryptography for the rationale).

There's absolutely no need to add complexity unless there are some technical arguments for doing so, say compatibility with legacy implementations which justifies bothering with DES/3DES/MD5 although they're inferior to AES and SHA1 in just about every aspect.

Signature · 1 line
Pekka Pietikainen
#2 lore raw
Quoted 11 lines · Pekka Pietikainen
Quoted 8 lines · Kyle McMartin

This patch adds support for the use of twofish and serpent as ESP algorithms. The ESP index numbers given are in accordance with RFC2407, draft-ietf-ipsec-ciph-aes-cbc-00 (before Rijndael was selected), and KAME which assigns 253 to twofishcbc.

Support for using twofish was requested on linux-kernel, and since I noticed serpent was missing too, included that as well.

Hi

Quoted 8 lines

Nothing against twofish or serpent per se, but I have this feeling that supporting every possible crypto algoritm known to man
is not necessarily wise (see eg. Practical Cryptography for the rationale).

There's absolutely no need to add complexity unless there are some technical arguments for doing so, say compatibility with legacy implementations which justifies bothering with DES/3DES/MD5 although they're inferior to AES and SHA1 in just about every aspect.

Very much agree.

Also, I could be missing something, but I think it takes much more to add an encryption algorithm than what the patch does?!?!

Signature · 3 lines
Pekka Savola                 "You each name yourselves king, yet the
Netcore Oy                    kingdom bleeds."
Systems. Networks. Security. -- George R.R. Martin: A Clash of Kings
#3 lore raw
Quoted 1 line · On Thu, 14 Aug 2003 23:25:11 +0300 (EEST) Pekka Savola <[email protected]>…

Very much agree.

I totally disagree, choice is everything.

That's why we allow NULL crypto algorithms. Not doing so turns this into a political thing, which I decidedly do not want our IPSEC implementation to be all about.

And therefore I will add the patch.

Quoted 2 lines

Also, I could be missing something, but I think it takes much more to add an encryption algorithm than what the patch does?!?!

If you use the netlink based IPSEC implementation, any crypto algorithm is supported fully the moment it is added to crypto/.

When using pfkeyv2 sockets, yes you have to assign a number and then the APP has to be aware of it. This just shows how bogus it is to use fixed numbers instead of strings to select crypto algorithms.

#5 lore raw
In reply to Pekka Savola
Quoted 5 lines · Pekka Savola

Very much agree.

Also, I could be missing something, but I think it takes much more to add an encryption algorithm than what the patch does?!?!

The algorithms were already part of the CryptoAPI. All the patch did was simply make them accessible to IPsec, by adding numerical IDs for ESP.

Regards,

Signature · 3 lines
Kyle McMartin <[email protected]>
1024D/191FCD8A - 331A 9468 C04D 3A76 5C56  BA68 7EB7 92DF 191F CD8A
2048R/F515317D -   68 A9 0D 28 1B DF 8D 42  0F CC AF 98 A8 D5 A4 04
#6 lore raw
In reply to Pekka Pietikainen
Quoted 5 lines · Pekka Pietikainen

There's absolutely no need to add complexity unless there are some technical arguments for doing so, say compatibility with legacy implementations which justifies bothering with DES/3DES/MD5 although they're inferior to AES and SHA1 in just about every aspect.

There are simple technical arguments for doing so, SERPENT and Twofish are both either as secure, or more secure than rijndael, as it stood with the amount of cryptanalysis the three received as part of the AES selection process. (Serpent, as it stood, was more secure, since it had more rounds, and more proven sboxes).

Adding more *secure* algorithms does no harm.

Regards,

Signature · 3 lines
Kyle McMartin <[email protected]>
1024D/191FCD8A - 331A 9468 C04D 3A76 5C56  BA68 7EB7 92DF 191F CD8A
2048R/F515317D -   68 A9 0D 28 1B DF 8D 42  0F CC AF 98 A8 D5 A4 04
#4 lore raw
In reply to David S. Miller
Quoted 8 lines · David S. Miller

I totally disagree, choice is everything.

That's why we allow NULL crypto algorithms. Not doing so turns this into a political thing, which I decidedly do not want our IPSEC implementation to be all about.

And therefore I will add the patch.

Thank you, David. I completely agree with allowing users to choose which algorithms they wish to deploy.

Quoted 4 lines

When using pfkeyv2 sockets, yes you have to assign a number and then the APP has to be aware of it. This just shows how bogus it is to use fixed numbers instead of strings to select crypto algorithms.

Again, I agree. Especially given the limitations of using the private ESP id space, since there is no new RFC delegating additions yet.

Regards,

Signature · 3 lines
Kyle McMartin <[email protected]>
1024D/191FCD8A - 331A 9468 C04D 3A76 5C56  BA68 7EB7 92DF 191F CD8A
2048R/F515317D -   68 A9 0D 28 1B DF 8D 42  0F CC AF 98 A8 D5 A4 04