[strongSwan] Custom cipher

Martin Willi martin at strongswan.org
Tue Jul 24 11:43:19 CEST 2012


Hi Ali,

> Now I want to add my custom cipher to strongswan so I can use it in
> ike and esp.

strongSwan usually uses two crypto implementations: One for IKE in
userland, and one for ESP directly in the kernel.

For IKE, you might take a look at existing ciphers. First, define an
identifier in the private space at [1], then you'll have to implement
the crypter_t interface [2]. You can use an existing cipher such as AES
[3] as a template, and implement your cipher accordingly. Then you'll
have to define keywords at [4] to configure proposals with your cipher.

For ESP, this works completely different. You'll have to extend the
Linux Crypto API by your own cipher. Looking at existing cipher should
help, though. Once this is done, you'll have to extend our kernel
interface and the Linux XFRM framework, assign a string identifier to
configure your cipher.

Regards
Martin

[1]http://git.strongswan.org/?p=strongswan.git;a=blob;f=src/libstrongswan/crypto/crypters/crypter.h;h=4c273059b2c6b4c4674c8bef85afb494592b3b49;hb=HEAD#l33
[2]http://git.strongswan.org/?p=strongswan.git;a=blob;f=src/libstrongswan/crypto/crypters/crypter.h;h=4c273059b2c6b4c4674c8bef85afb494592b3b49;hb=HEAD#l81
[3]http://git.strongswan.org/?p=strongswan.git;a=tree;f=src/libstrongswan/plugins/aes
[4]http://git.strongswan.org/?p=strongswan.git;a=blob;f=src/libstrongswan/crypto/proposal/proposal_keywords.txt





More information about the Users mailing list