Project

General

Profile

NTRU » History » Version 14

Andreas Steffen, 04.03.2014 07:00

1 1 Andreas Steffen
h1. NTRU
2 1 Andreas Steffen
3 12 Andreas Steffen
{{>toc}}
4 12 Andreas Steffen
5 3 Andreas Steffen
NTRU is a lattice-based post-quantum encryption algorithm owned by "Security Innovation":https://www.securityinnovation.com/products/encryption-libraries/ntru-cryptography.html. Our implementation of the ntru plugin has been derived from the "ntru-crypto":https://github.com/NTRUOpenSourceProject/ntru-crypto C source code made available by Security Innovations under the GNU GPLv2 open source license. NTRU has been standardized by *IEEE Std 1363.1-2008* and *ANSI X9.98-2010*.
6 1 Andreas Steffen
7 12 Andreas Steffen
h2. NTRU Encryption as an IKE Key Exchange Mechanism
8 1 Andreas Steffen
9 6 Andreas Steffen
The strongSwan *ntru* plugin uses NTRU encryption as an IKE key exchange algorithm in the following way:
10 6 Andreas Steffen
11 3 Andreas Steffen
 * The IKE initiator generates a random NTRU public/private key pair for the specified security strength.
12 3 Andreas Steffen
13 3 Andreas Steffen
 * The IKE initiator sends the NTRU public key in the KEi payload to the IKE responder.
14 3 Andreas Steffen
15 4 Andreas Steffen
 * The IKE responder generates a random secret _s_ with a size of twice the security strength and encrypts it with the NTRU public key.
16 3 Andreas Steffen
17 3 Andreas Steffen
 * The IKE responder sends the encrypted secret in the KEr payload to the IKE initiator
18 3 Andreas Steffen
19 4 Andreas Steffen
 * The IKE initiator decrypts the KEr payload using the NTRU private key and extracts the secret _s_.
20 1 Andreas Steffen
21 4 Andreas Steffen
 * With IKEv2 both initiator and responder use the secret _s_ to compute
22 4 Andreas Steffen
<pre>
23 4 Andreas Steffen
SKEYSEED = prf(Ni | Nr, s)
24 4 Andreas Steffen
</pre>
25 4 Andreas Steffen
26 5 Andreas Steffen
 * With IKEv1 both initiator and responder use the secret _s_ to compute
27 4 Andreas Steffen
<pre>
28 4 Andreas Steffen
SKEYID = prf(Ni_b | Nr_b, s)               # for authby=pubkey i.e. public key signatures
29 4 Andreas Steffen
SKEYID = prf(pre-shared-key, Ni_b | Nr_b)  # for authby=psk, i.e. pre-shared keys
30 4 Andreas Steffen
31 4 Andreas Steffen
SKEYID_d = prf(SKEYID, s | CKY-I | CKY-R | 0)
32 1 Andreas Steffen
SKEYID_a = prf(SKEYID, SKEYID_d | s | CKY-I | CKY-R | 1)
33 1 Andreas Steffen
SKEYID_e = prf(SKEYID, SKEYID_a | s | CKY-I | CKY-R | 2)
34 6 Andreas Steffen
</pre> 
35 6 Andreas Steffen
36 6 Andreas Steffen
h2. Configuration Options
37 6 Andreas Steffen
38 7 Andreas Steffen
NTRU parameter sets are defined for security strengths of 112, 128, 192 and 256 bits for which strongSwan assigns the following key exchange algorithm keywords:
39 6 Andreas Steffen
40 6 Andreas Steffen
|Keyword    |DH Group |Strength   |
41 6 Andreas Steffen
|*ntru112*  |=. 1030  |>.112 bits |
42 6 Andreas Steffen
|*ntru128*  |=. 1031  |>.128 bits |
43 6 Andreas Steffen
|*ntru192*  |=. 1032  |>.192 bits |
44 6 Andreas Steffen
|*ntru256*  |=. 1033  |>.256 bits |
45 6 Andreas Steffen
46 6 Andreas Steffen
Thus an example IKE algorithm definition in _/etc/ipsec.conf_ for a security strength of 128 bits is
47 6 Andreas Steffen
<pre>
48 6 Andreas Steffen
ike=aes128-sha256-ntru128
49 1 Andreas Steffen
</pre>
50 6 Andreas Steffen
or for a security strength of 192 bits
51 6 Andreas Steffen
<pre>
52 6 Andreas Steffen
ike=aes192-sha384-ntru192
53 6 Andreas Steffen
</pre>
54 6 Andreas Steffen
and for a security strength of 256 bits
55 6 Andreas Steffen
<pre>
56 6 Andreas Steffen
ike=aes256-sha512-ntru256
57 6 Andreas Steffen
</pre>
58 6 Andreas Steffen
59 6 Andreas Steffen
Since the Diffie-Hellman Group Transform IDs 1030..1033 selected by the strongSwan project to designate the four NTRU key exchange strengths are taken from the private-use range, the strongSwan vendor ID *must* be sent by the charon daemon. This can be enabled by the following statement in /etc/strongswan.conf:
60 6 Andreas Steffen
<pre>
61 6 Andreas Steffen
charon {
62 6 Andreas Steffen
  send_vendor_id = yes
63 6 Andreas Steffen
}
64 6 Andreas Steffen
</pre> 
65 8 Andreas Steffen
66 11 Andreas Steffen
By default strongSwan uses NTRU parameters optimized for both size and speed by "Security Innovations":https://www.securityinnovation.com/products/encryption-libraries/ntru-cryptography.html. If compatibility with the *ANSI X9.98-2010* standard is needed than the following NTRU parameter sets can be configured in _strongswan.conf_ 
67 9 Andreas Steffen
<pre>
68 9 Andreas Steffen
charon {
69 9 Andreas Steffen
  plugins {
70 9 Andreas Steffen
    ntru {
71 9 Andreas Steffen
      parameter_set = x9_98_speed|x9_98_bandwidth|x9_98_balance|optimum
72 9 Andreas Steffen
    }
73 9 Andreas Steffen
  }
74 9 Andreas Steffen
}
75 9 Andreas Steffen
</pre>
76 10 Andreas Steffen
where *x9_98_speed* optimizes the NTRU parameters for processing speed, *x9_98_bandwidth* for network bandwidth, i.e. IKE key exchange size which helps to prevent IKE datagram fragmentation, *x9_98_balance* is a mix of the two previous options, and *optimum* being the default and based on a product form of trinary polynomials is both the fastest and most compact option. Details on the NTRU parameters can be found "here":https://github.com/NTRUOpenSourceProject/ntru-crypto/blob/master/reference-code/C/Encrypt/doc/UserNotes-NTRUEncrypt.pdf.
77 9 Andreas Steffen
      
78 8 Andreas Steffen
h2. Building the NTRU Plugin
79 8 Andreas Steffen
80 8 Andreas Steffen
The compilation of the NTRU plugin is enabled with the option
81 8 Andreas Steffen
<pre>
82 8 Andreas Steffen
./configure --enable-ntru ... 
83 1 Andreas Steffen
</pre>
84 12 Andreas Steffen
85 12 Andreas Steffen
h2. NTRU Example Scenarios
86 12 Andreas Steffen
87 14 Andreas Steffen
 * "IKEv2 Net-to-Net with 256 bit strength and certificate-based authentication":http://www.strongswan.org/uml/testresults/ikev2/net2net-ntru-cert/
88 14 Andreas Steffen
 * "IKEv2 Remote Access with 128/192 bit strength and PSK-based authentication":http://www.strongswan.org/uml/testresults/ikev2/rw-ntru-psk/
89 12 Andreas Steffen
90 14 Andreas Steffen
 * "IKEv1 Net-to-Net with 256 bit strength and certificate-based authentication":http://www.strongswan.org/uml/testresults/ikev1/net2net-ntru-cert/
91 14 Andreas Steffen
 * "IKEv1 Remote Access with 128/192 bit strength and PSK-based authentication":http://www.strongswan.org/uml/testresults/ikev1/rw-ntru-psk/