Skip to content

LMS: add more examples - #498

Open
SparkiDev wants to merge 1 commit into
wolfSSL:masterfrom
SparkiDev:lms_examples
Open

LMS: add more examples#498
SparkiDev wants to merge 1 commit into
wolfSSL:masterfrom
SparkiDev:lms_examples

Conversation

@SparkiDev

Copy link
Copy Markdown
Contributor

lms-kg: Generates key pair and stores to file.
lms-sign: Signs multiple files using private key file.
lms-verify: Verifies a file against the signature using public key file.

@SparkiDev SparkiDev self-assigned this Apr 1, 2025
@padelsbach

Copy link
Copy Markdown
Contributor

@SparkiDev, I made some updates to the pre-existing lms/xmss examples to work with current wolfssl. Can you please rebase this PR? Alternatively, I can pick up this PR and take it from here.

lms-kg: Generates key pair and stores to file.
lms-sign: Signs multiple files using private key file.
lms-verify: Verifies a file against the signature using public key file.
@SparkiDev

Copy link
Copy Markdown
Contributor Author

Rebased and fixed to work with latest wolfSSL.

This comment was marked as low quality.

@philljj philljj left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks and tests good overall, just a few minor things.

/* Get the public key length. */
ret = wc_LmsKey_GetPubLen(key, &pubSz);
if (ret != 0) {
print_wolfssl_error("Failed to get public key size", ret);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pub will be uninitialized here when routing to cleanup code.

/* Open file. */
f = fopen(filename, "rb");
if (f == NULL) {
printf(" unable to open public key\n");

@philljj philljj Aug 1, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will fclose() on null.

Also read_file is used for multiple different files, not just public key.

/* Open file. */
f = fopen(filename, "rb");
if (f == NULL) {
printf(" unable to open public key\n");

@philljj philljj Aug 1, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will fclose() on null.

Also this read file is used for multiple files, not just public keys.

/* Get public key length. */
ret = wc_LmsKey_GetPubLen(key, &pubSz);
if (ret != 0) {
print_wolfssl_error("Failed to import publc key", ret);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

publc -> public

/* Import public key into LMS key. */
ret = wc_LmsKey_ImportPubRaw(key, pub, pubSz);
if (ret != 0) {
print_wolfssl_error("Failed to import publc key", ret);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

public

*/

/* Example to demonstrate LMS Key Generation */
/*

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trailing whitespace

@philljj philljj assigned SparkiDev and unassigned wolfSSL-Bot Aug 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants