Add LMS key_update callback

This commit is contained in:
Zhi Guan
2026-01-18 12:12:45 +08:00
parent 47639a9e23
commit 9488128154
9 changed files with 355 additions and 374 deletions

View File

@@ -294,7 +294,7 @@ static int test_lms_key_generate(void)
error_print();
return -1;
}
//lms_key_print(stdout, 0, 0, "lms_key", &lms_key);
lms_private_key_print(stdout, 0, 0, "lms_private_key", &lms_key);
printf("%s() ok\n", __FUNCTION__);
return 1;
@@ -341,13 +341,13 @@ static int test_lms_key_to_bytes(void)
error_print();
return -1;
}
lms_key_print(stdout, 0, 4, "lms_public_key", &key);
lms_public_key_print(stdout, 0, 4, "lms_public_key", &key);
if (lms_private_key_from_bytes(&key, &cp, &len) != 1) {
error_print();
return -1;
}
lms_key_print(stdout, 0, 4, "lms_private_key", &key);
lms_private_key_print(stdout, 0, 4, "lms_private_key", &key);
if (len != 0) {
error_print();
return -1;
@@ -539,7 +539,7 @@ static int test_hss_key_generate(void)
}
hss_public_key_print(stdout, 0, 4, "hss_public_key", &key);
hss_key_print(stdout, 0, 4, "hss_key", &key);
hss_private_key_print(stdout, 0, 4, "hss_key", &key);
printf("%s() ok\n", __FUNCTION__);
return 1;
@@ -799,7 +799,7 @@ static int test_hss_key_to_bytes(void)
error_print();
return -1;
}
hss_key_print(stdout, 0, 4, "lms_private_key", &key);
hss_private_key_print(stdout, 0, 4, "lms_private_key", &key);
if (len != 0) {
error_print();
return -1;
@@ -868,7 +868,7 @@ static int test_hss_sign_level2(void)
error_print();
return -1;
}
hss_key_print(stderr, 0, 4, "hss_key", &key);
hss_private_key_print(stderr, 0, 4, "hss_key", &key);
if (hss_sign_init(&ctx, &key) != 1) {
@@ -916,7 +916,7 @@ static int test_hss_sign(void)
error_print();
return -1;
}
hss_key_print(stderr, 0, 4, "hss_key", &key);
hss_private_key_print(stderr, 0, 4, "hss_key", &key);
if (hss_sign_init(&ctx, &key) != 1) {
@@ -951,6 +951,7 @@ static int test_hss_sign(void)
return 1;
}
/*
static int test_hss_public_key_algor(void)
{
int lms_types[] = {
@@ -1025,7 +1026,7 @@ static int test_hss_public_key_algor(void)
return 1;
}
*/
int main(void)
{
@@ -1048,7 +1049,7 @@ int main(void)
if (test_hss_sign_level1() != 1) goto err;
if (test_hss_sign_level2() != 1) goto err;
if (test_hss_sign() != 1) goto err;
if (test_hss_public_key_algor() != 1) goto err;
// if (test_hss_public_key_algor() != 1) goto err;
printf("%s all tests passed\n", __FILE__);
return 0;