22
33This directory contains:
44
5- - A simple example that uses wolfCrypt LMS/HSS hooks to sign and verify a message
6- with configurable LMS/HSS parameters. Requires wolfssl with ` --enable-lms=yes `
7- and ` --with-liblms=<path to hash-sigs install> ` .
5+ - An example that uses wolfCrypt LMS/HSS to sign and verify a
6+ message with configurable LMS/HSS parameters. Requires wolfssl with
7+ ` --enable-lms ` .
88
9- - An example that uses wolfCrypt XMSS/XMSS^MT hooks to sign and verify a message
10- with a configurable XMSS/XMSS^MT parameter string. Requires wolfssl with ` --enable-xmss=yes `
11- and ` --with-libxmss=<path to patched xmss-reference install> ` , or wolfssl
12- with ` --enable-xmss=wolfssl ` .
9+ - An example that uses wolfCrypt XMSS/XMSS^MT to sign and verify a
10+ message with a configurable XMSS/XMSS^MT parameter string. Requires wolfssl
11+ with ` --enable-xmss ` .
1312
14- # Prerequisites
13+ By default these examples use the wolfCrypt LMS and XMSS implementations
14+ (` wc_lms.c ` , ` wc_lms_impl.c ` , ` wc_xmss.c ` , ` wc_xmss_impl.c ` ), which are more
15+ performant and configurable. Also, these implementations benefit significantly
16+ from ` --enable-intelasm ` and ` --enable-armasm ` .
1517
16- The LMS/HSS sign verify example requires that hash-sigs has been built, and
17- wolfSSL has been built with LMS/HSS support enabled. Please see Item 17
18- in the wolfSSL repo's INSTALL file.
19-
20- https://github.com/wolfSSL/wolfssl/blob/master/INSTALL
21-
22- If building with ` --with-libxmss=<path> ` , the XMSS/XMSS^MT example requires
23- that the xmss-reference repository has been cloned, patched, and built. Please
24- see item 20 in the wolfSSL repo's INSTALL file.
25-
26- The patch to use is ` 0001-Patch-to-support-wolfSSL-xmss-reference-integration.patch ` from this XMSS/XMSS^MT example.
27- This patch includes an addendum readme, ` patch_readme.md ` , that lists all changes made and explains their rationale.
28-
29- # Building the LMS/HSS example
30-
31- Configure the Makefile to point to your hash-sigs install:
32-
33- ```
34- HSS_INC = <path to hss install>
35- ```
36-
37- ```
38- HSS_LIB = <path to hss_lib_thread.a>
39- ```
40-
41- Then build:
42-
43- ```
44- $ make lms_example
45- ```
18+ If you want to use the old external integrations LMS/XMSS implementations
19+ (` ext_lms.c ` , ` ext_xmss.c ` ), see the section "Building the External Integration
20+ examples".
4621
4722## Signing and Verifying a Message with LMS/HSS
4823
@@ -78,31 +53,6 @@ examples:
7853description:
7954...
8055```
81-
82- # Building the XMSS/XMSS^MT example
83-
84- If building with ` --with-libxmss=<path> ` , configure the Makefile to point to
85- your xmss install:
86-
87- ```
88- XMSS_INC = <path to patched xmss install>
89- ```
90-
91- ```
92- XMSS_LIB = <path to xmss_lib.a or xmss_verify_lib.a>
93- ```
94-
95- Then build:
96-
97- ```
98- $ make xmss_example
99- ```
100-
101- Build the verify-only example with
102- ```
103- $ make xmss_example_verifyonly
104- ```
105-
10656## Signing and Verifying a Message with XMSS/XMSS^MT
10757
10858To see the help and usage, run the program without options:
@@ -144,64 +94,76 @@ number of levels in the hyper-tree. The number of signatures available
14494is ` N = 2 ** (h) ` .
14595
14696The main contributor to key generation time is the ratio ` h/d ` .
147- Not surprisingly, be aware that ` XMSS-SHA2_20_256 ` , and ` XMSSMT-SHA2_60/3_256 ` , are particularly
148- CPU intensive because of the large number of hash operations involved, and
149- may take a long time. E.g. on an Intel i7 linux system these examples took
150- approximately 24 min, and 1 hour, respectively.
97+ Not surprisingly, be aware that ` XMSS-SHA2_20_256 ` , and ` XMSSMT-SHA2_60/3_256 ` ,
98+ are particularly CPU intensive because of the large number of hash operations
99+ involved, and may take a long time.
151100
152101The other examples will be much faster.
153102
154103An interesting facet of XMSS/XMSS^MT is that the private key format
155- and size is implementation specific. The wolfSSL XMSS/XMSS^MT hooks
156- feature uses the "fast" implementation from xmss-reference, which
157- has larger private key sizes .
104+ and size is implementation specific. The wolfSSL XMSS/XMSS^MT default
105+ implementation has larger private key sizes for greater signing
106+ performance .
158107
159- For example:
108+ For example this is obtained with the default ` -enable-xmss ` with
109+ ` --enable-intelasm ` (on an Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz):
160110
161111```
162- $ ./xmss_example "XMSSMT-SHA2_20/2_256" 200
112+ $time ./xmss_example "XMSSMT-SHA2_20/2_256" 200
163113using parameters: XMSSMT-SHA2_20/2_256
164114signature length: 4963
165- priv key length: 6002
115+ priv key length: 5780
166116pub key length: 68
117+ making key with XMSSMT-SHA2_20/2_256 parameters...
167118...done!
168119signing and verifying 200 signatures...
169120...done!
170121finished
171122
123+ real 0m2.115s
124+ user 0m2.104s
125+ sys 0m0.007s
172126```
173127
128+ Versus the same with ` --enable-xmss=small ` instead:
129+
174130```
175- $ ./xmss_example "XMSSMT-SHA2_40/4_256 " 200
176- using parameters: XMSSMT-SHA2_40/4_256
177- signature length: 9893
178- priv key length: 15256
131+ $time ./xmss_example "XMSSMT-SHA2_20/2_256 " 200
132+ using parameters: XMSSMT-SHA2_20/2_256
133+ signature length: 4963
134+ priv key length: 135
179135pub key length: 68
136+ making key with XMSSMT-SHA2_20/2_256 parameters...
180137...done!
181138signing and verifying 200 signatures...
182139...done!
183140finished
141+
142+ real 6m57.413s
143+ user 6m56.337s
144+ sys 0m0.058s
184145```
185146
186147## Using the verify-only XMSS/XMSS^MT example
187148
188- The usage for the verify-only example is:
149+ The verify-only XMSS example requires that wolfSSL has been built with
150+ ` --enable-xmss=verify-only ` . The usage for the verify-only example is:
189151```
190- $ ./xmss_example_verifyonly
152+ $ ./xmss_example
191153usage:
192- ./xmss_example_verifyonly <param string> <pub file> <sig file> <msg file>
154+ ./xmss_example <param string> <pub file> <sig file> <msg file>
193155
194156For simplicity message is assumed to be 32 bytes in size.
195157
196158examples:
197- ./xmss_example_verifyonly XMSSMT-SHA2_20/4_256 xmss_pub.key xmss_sig.bin msg.bin
198- ./xmss_example_verifyonly XMSSMT-SHA2_60/6_256 xmss_pub.key xmss_sig.bin msg.bin
199- ./xmss_example_verifyonly XMSS-SHA2_10_256 xmss_pub.key xmss_sig.bin msg.bin
159+ ./xmss_example XMSSMT-SHA2_20/4_256 xmss_pub.key xmss_sig.bin msg.bin
160+ ./xmss_example XMSSMT-SHA2_60/6_256 xmss_pub.key xmss_sig.bin msg.bin
161+ ./xmss_example XMSS-SHA2_10_256 xmss_pub.key xmss_sig.bin msg.bin
200162```
201163
202164An example:
203165```
204- $./xmss_example_verifyonly XMSSMT-SHA2_20/2_256 pk.bin sig.bin msg.bin
166+ $./xmss_example XMSSMT-SHA2_20/2_256 pk.bin sig.bin msg.bin
205167using parameters: XMSSMT-SHA2_20/2_256
206168pub:
2071690x00 0x00 0x00 0x01 0x2B 0xC1 0xA4 0x8D
@@ -223,3 +185,60 @@ pub key length: 68
223185Verify good!
224186finished
225187```
188+
189+
190+ # Building the External Integration examples
191+
192+ By default wolfssl uses the wolfCrypt LMS/XMSS implementations. However
193+ the previous external integrations are still supported.
194+
195+ If building with ` --with-liblms=<path> ` , the LMS/HSS example requires
196+ that hash-sigs has been built. Please see Item 17 in the wolfSSL repo's INSTALL file.
197+
198+ https://github.com/wolfSSL/wolfssl/blob/master/INSTALL
199+
200+ If building with ` --with-libxmss=<path> ` , the XMSS/XMSS^MT example requires
201+ that the xmss-reference repository has been cloned, patched, and built. Please
202+ see item 20 in the wolfSSL repo's INSTALL file.
203+
204+ The patch to use is ` 0001-Patch-to-support-wolfSSL-xmss-reference-integration.patch `
205+ from this XMSS/XMSS^MT example. This patch includes an addendum readme,
206+ ` patch_readme.md ` , that lists all changes made and explains their rationale.
207+
208+ ## Building the external LMS/HSS example
209+
210+ If building with ` --with-liblms=<path> ` , configure the Makefile to point
211+ to your hash-sigs install:
212+
213+ ```
214+ HSS_INC = <path to hss install>
215+ ```
216+
217+ ```
218+ HSS_LIB = <path to hss_lib_thread.a>
219+ ```
220+
221+ Then build:
222+
223+ ```
224+ $ make lms_example
225+ ```
226+
227+ # Building the external XMSS/XMSS^MT example
228+
229+ If building with ` --with-libxmss=<path> ` , configure the Makefile to point to
230+ your xmss install:
231+
232+ ```
233+ XMSS_INC = <path to patched xmss install>
234+ ```
235+
236+ ```
237+ XMSS_LIB = <path to xmss_lib.a or xmss_verify_lib.a>
238+ ```
239+
240+ Then build:
241+
242+ ```
243+ $ make xmss_example
244+ ```
0 commit comments