2424#include <wolfssl/options.h>
2525#include <wolfssl/wolfcrypt/error-crypt.h>
2626
27- #ifdef HAVE_LIBXMSS
27+ #ifdef WOLFSSL_HAVE_XMSS
2828
2929#include <wolfssl/wolfcrypt/xmss.h>
30- #include <wolfssl/wolfcrypt/ext_xmss.h>
30+ #ifdef HAVE_LIBXMSS
31+ #include <wolfssl/wolfcrypt/ext_xmss.h>
32+ #else
33+ #include <wolfssl/wolfcrypt/wc_xmss.h>
34+ #endif
3135
32- static void dump_hex (const char * what , const uint8_t * buf , size_t len );
36+ static void dump_hex (const char * what , const byte * buf , size_t len );
3337static void print_usage (void );
3438#if !defined WOLFSSL_XMSS_VERIFY_ONLY
3539static int do_xmss_example (const char * params , size_t sigs_to_do );
@@ -304,6 +308,13 @@ do_xmss_example(const char * params,
304308
305309 printf ("signing and verifying %zu signatures...\n" , sigs_to_do );
306310 for (size_t i = 0 ; i < sigs_to_do ; ++ i ) {
311+ ret = wc_XmssKey_SigsLeft (& signingKey );
312+
313+ if (ret <= 0 ) {
314+ fprintf (stderr , "info: %zu: wc_XmssKey_SigsLeft returned %d\n" , i , ret );
315+ break ;
316+ }
317+
307318 ret = wc_XmssKey_Sign (& signingKey , sig , & sigSz ,(byte * ) msg ,
308319 strlen (msg ));
309320 if (ret ) {
@@ -524,9 +535,9 @@ read_file(byte * data,
524535#endif /* if !defined WOLFSSL_XMSS_VERIFY_ONLY */
525536
526537static void
527- dump_hex (const char * what ,
528- const uint8_t * buf ,
529- size_t len )
538+ dump_hex (const char * what ,
539+ const byte * buf ,
540+ size_t len )
530541{
531542 printf ("%s\n" , what );
532543 for (size_t i = 0 ; i < len ; ++ i ) {
@@ -547,7 +558,7 @@ dump_hex(const char * what,
547558#else
548559
549560int main (int argc , char * * argv ) {
550- printf ("This requires the --with-libxmss flag .\n" );
561+ printf ("This requires --enable-xmss .\n" );
551562 return 0 ;
552563}
553564#endif /* WITH_LIBXMSS */
0 commit comments