mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2026-10-24 04:09:07 +03:00
wc_LmsKey_SigsLeft() checked only for a NULL key and then passed key->params to wc_hss_sigsleft(), which dereferences it. A key that was only initialized has no parameters, so the call crashed. A verify-only key (after wc_LmsKey_ImportPubRaw()) reported 1 although wc_LmsKey_Sign() refuses it. Return 0 for both, as wc_LmsKey_Sign() rejects such keys before it calls the device. The check is on the verify-only state and not on WC_LMS_STATE_OK, because wc_LmsKey_MakeKey() and wc_LmsKey_Reload() call wc_LmsKey_SigsLeft() while the key is still in WC_LMS_STATE_PARMSET. The doxygen for wc_LmsKey_SigsLeft() and wc_XmssKey_SigsLeft() said they return the number of signatures left or a negative error code; both return 1 or 0. Fix that in English and Japanese, and in the LMS and XMSS group descriptions.
The wolfSSL manual is available at: http://www.wolfssl.com/documentation/wolfSSL-Manual.pdf The wolfSSL API guide is available at: https://www.wolfssl.com/doxygen/wolfssl_API.html The wolfCrypt API guide is available at: https://www.wolfssl.com/doxygen/wolfcrypt_API.html