Skip to content

[Bug]: The default type of the LmsParams.sig_len field is word16, which will overflow when using LMS_SHA256_M32_H5 and LMOTS_SHA256_N32_W1, level:8. #9602

@feedline

Description

@feedline

Contact Details

No response

Version

WolfSSL version: 5.8.4

Description

When I cross-tested the signature generated by my self-implemented LMS_SHA256_M32_H5 LMOTS_SHA256_N32_W1 algorithm with wolfssl, I encountered a BUFF_E error. The test results for levels 1-7 were all PASS, with the error only occurring in level 8. I checked and found that my sig_len was actually 69868, and wolfssl's LmsParams was 4332. Therefore, I believe this is a bug caused by type overflow.

Reproduction steps

./configure --enable-lms --enable-xmss --enable-mlkem --enable-mldsa --enable-dsa --enable-all --enable-static

Relevant log output

Testing HSS *generate private key case#0, lms: MBEDTLS_LMS_SHA256_M32_H5, lmots: MBEDTLS_LMOTS_SHA256_N32_W1, level:5............................{*Wolfssl*}My sig_len:43648Wolfssl sig_len:43648[PASSED]
Testing HSS *generate private key case#0, lms: MBEDTLS_LMS_SHA256_M32_H5, lmots: MBEDTLS_LMOTS_SHA256_N32_W1, level:6............................{*Wolfssl*}My sig_len:52388Wolfssl sig_len:52388[PASSED]
Testing HSS *generate private key case#0, lms: MBEDTLS_LMS_SHA256_M32_H5, lmots: MBEDTLS_LMOTS_SHA256_N32_W1, level:7............................{*Wolfssl*}My sig_len:61128Wolfssl sig_len:61128[PASSED]
Testing HSS *generate private key case#0, lms: MBEDTLS_LMS_SHA256_M32_H5, lmots: MBEDTLS_LMOTS_SHA256_N32_W1, level:8............................{*Wolfssl*}My sig_len:69868Wolfssl sig_len:4332[FAILED]

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions