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 (` ext_lms.c ` , ` ext_xmss.c ` ),
19+ see the section "Building the External Integration examples".
4620
4721## Signing and Verifying a Message with LMS/HSS
4822
@@ -78,31 +52,6 @@ examples:
7852description:
7953...
8054```
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-
10655## Signing and Verifying a Message with XMSS/XMSS^MT
10756
10857To see the help and usage, run the program without options:
@@ -144,64 +93,76 @@ number of levels in the hyper-tree. The number of signatures available
14493is ` N = 2 ** (h) ` .
14594
14695The 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.
96+ Not surprisingly, be aware that ` XMSS-SHA2_20_256 ` , and ` XMSSMT-SHA2_60/3_256 ` ,
97+ are particularly CPU intensive because of the large number of hash operations
98+ involved, and may take a long time.
15199
152100The other examples will be much faster.
153101
154102An 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 .
103+ and size is implementation specific. The wolfSSL XMSS/XMSS^MT default
104+ implementation has larger private key sizes for greater signing
105+ performance .
158106
159- For example:
107+ For example this is obtained with the default ` -enable-xmss ` with
108+ ` --enable-intelasm ` (on an Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz):
160109
161110```
162- $ ./xmss_example "XMSSMT-SHA2_20/2_256" 200
111+ $time ./xmss_example "XMSSMT-SHA2_20/2_256" 200
163112using parameters: XMSSMT-SHA2_20/2_256
164113signature length: 4963
165- priv key length: 6002
114+ priv key length: 5780
166115pub key length: 68
116+ making key with XMSSMT-SHA2_20/2_256 parameters...
167117...done!
168118signing and verifying 200 signatures...
169119...done!
170120finished
171121
122+ real 0m2.115s
123+ user 0m2.104s
124+ sys 0m0.007s
172125```
173126
127+ Versus the same with ` --enable-xmss=small ` instead:
128+
174129```
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
130+ $time ./xmss_example "XMSSMT-SHA2_20/2_256 " 200
131+ using parameters: XMSSMT-SHA2_20/2_256
132+ signature length: 4963
133+ priv key length: 135
179134pub key length: 68
135+ making key with XMSSMT-SHA2_20/2_256 parameters...
180136...done!
181137signing and verifying 200 signatures...
182138...done!
183139finished
140+
141+ real 6m57.413s
142+ user 6m56.337s
143+ sys 0m0.058s
184144```
185145
186146## Using the verify-only XMSS/XMSS^MT example
187147
188- The usage for the verify-only example is:
148+ The verify-only XMSS example requires that wolfSSL has been built with
149+ ` --enable-xmss=verify-only ` . The usage for the verify-only example is:
189150```
190- $ ./xmss_example_verifyonly
151+ $ ./xmss_example
191152usage:
192- ./xmss_example_verifyonly <param string> <pub file> <sig file> <msg file>
153+ ./xmss_example <param string> <pub file> <sig file> <msg file>
193154
194155For simplicity message is assumed to be 32 bytes in size.
195156
196157examples:
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
158+ ./xmss_example XMSSMT-SHA2_20/4_256 xmss_pub.key xmss_sig.bin msg.bin
159+ ./xmss_example XMSSMT-SHA2_60/6_256 xmss_pub.key xmss_sig.bin msg.bin
160+ ./xmss_example XMSS-SHA2_10_256 xmss_pub.key xmss_sig.bin msg.bin
200161```
201162
202163An example:
203164```
204- $./xmss_example_verifyonly XMSSMT-SHA2_20/2_256 pk.bin sig.bin msg.bin
165+ $./xmss_example XMSSMT-SHA2_20/2_256 pk.bin sig.bin msg.bin
205166using parameters: XMSSMT-SHA2_20/2_256
206167pub:
2071680x00 0x00 0x00 0x01 0x2B 0xC1 0xA4 0x8D
@@ -223,3 +184,60 @@ pub key length: 68
223184Verify good!
224185finished
225186```
187+
188+
189+ # Building the External Integration examples
190+
191+ By default wolfssl uses the wolfCrypt LMS/XMSS implementations. However
192+ the previous external integrations are still supported.
193+
194+ If building with ` --with-liblms=<path> ` , the LMS/HSS example requires
195+ that hash-sigs has been built. Please see Item 17 in the wolfSSL repo's INSTALL file.
196+
197+ https://github.com/wolfSSL/wolfssl/blob/master/INSTALL
198+
199+ If building with ` --with-libxmss=<path> ` , the XMSS/XMSS^MT example requires
200+ that the xmss-reference repository has been cloned, patched, and built. Please
201+ see item 20 in the wolfSSL repo's INSTALL file.
202+
203+ The patch to use is ` 0001-Patch-to-support-wolfSSL-xmss-reference-integration.patch `
204+ from this XMSS/XMSS^MT example. This patch includes an addendum readme,
205+ ` patch_readme.md ` , that lists all changes made and explains their rationale.
206+
207+ ## Building the external LMS/HSS example
208+
209+ If building with ` --with-liblms=<path> ` , configure the Makefile to point
210+ to your hash-sigs install:
211+
212+ ```
213+ HSS_INC = <path to hss install>
214+ ```
215+
216+ ```
217+ HSS_LIB = <path to hss_lib_thread.a>
218+ ```
219+
220+ Then build:
221+
222+ ```
223+ $ make lms_example
224+ ```
225+
226+ ## Building the external XMSS/XMSS^MT example
227+
228+ If building with ` --with-libxmss=<path> ` , configure the Makefile to point to
229+ your xmss install:
230+
231+ ```
232+ XMSS_INC = <path to patched xmss install>
233+ ```
234+
235+ ```
236+ XMSS_LIB = <path to xmss_lib.a or xmss_verify_lib.a>
237+ ```
238+
239+ Then build:
240+
241+ ```
242+ $ make xmss_example
243+ ```
0 commit comments