Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
43f8cdd
Update README
sfluhrer Jan 3, 2020
464bfa1
Add support for SHA256/192 hash
sfluhrer Jan 3, 2020
4587ec0
Added support for SHA256/192
sfluhrer Jan 3, 2020
2fe3676
Added support for SHA256/192
sfluhrer Jan 3, 2020
fe448db
Support SHA256/192
sfluhrer Jan 3, 2020
caef278
Support SHA256/192
sfluhrer Jan 3, 2020
9567f94
Support SHA256/192
sfluhrer Jan 3, 2020
ca1570e
Support SHA256/192
sfluhrer Jan 3, 2020
ab75f88
Add test vectors from 'more parameter sets' draft
sfluhrer Apr 12, 2021
3f55cbb
Remove SHAKE test vectors
sfluhrer Apr 12, 2021
b05c538
Add support for SHAKE
sfluhrer Apr 15, 2021
b411488
Update README
sfluhrer Apr 15, 2021
33e9768
Correct the shake block size
sfluhrer Apr 15, 2021
846bc77
Corrected read.me
sfluhrer Apr 16, 2021
0334800
Update LM and LM-OTS codepoints
sfluhrer Jun 2, 2021
deef02b
Use IANA-assigned code points
sfluhrer Jan 11, 2022
15bb12c
Remove SHAKE tests
sfluhrer Jan 12, 2022
333cecd
Merge branch 'master' into 192
sfluhrer Jan 14, 2022
73310fd
Fix compile errors caused by sync
sfluhrer Dec 14, 2022
d4cb7cf
When N=24, this memcpy() call produces an out-of-bounds memory read b…
alexloney Mar 12, 2024
3fa928d
Updating comment to reflect that it is now dynamic
alexloney Mar 12, 2024
5e928aa
Merge pull request #30 from cisco/master
sfluhrer Nov 25, 2024
1a86f19
Merge branch '192' into shake-support
sfluhrer Jul 28, 2025
69f6ad0
Merge pull request #10 from cisco/shake-support
sfluhrer Jul 28, 2025
a55e692
Changed how manual reserve works
sfluhrer Aug 5, 2025
4601461
Merge pull request #24 from alexloney/192
sfluhrer Aug 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 35 additions & 32 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ hss_lib.a: hss.o hss_alloc.o hss_aux.o hss_common.o \
hss_verify.o hss_verify_inc.o hss_derive.o \
hss_derive.o hss_zeroize.o lm_common.o \
lm_ots_common.o lm_ots_sign.o lm_ots_verify.o lm_verify.o endian.o \
hash.o sha256.o
hash.o sha256.o fips202.o
$(AR) rcs $@ $^

hss_lib_thread.a: hss.o hss_alloc.o hss_aux.o hss_common.o \
Expand All @@ -23,98 +23,101 @@ hss_lib_thread.a: hss.o hss_alloc.o hss_aux.o hss_common.o \
hss_verify.o hss_verify_inc.o \
hss_derive.o hss_zeroize.o lm_common.o \
lm_ots_common.o lm_ots_sign.o lm_ots_verify.o lm_verify.o endian.o \
hash.o sha256.o
hash.o sha256.o fips202.o
$(AR) rcs $@ $^

hss_verify.a: hss_verify.o hss_verify_inc.o hss_common.o hss_thread_single.o \
hss_zeroize.o lm_common.o lm_ots_common.o lm_ots_verify.o lm_verify.o \
endian.o hash.o sha256.o
endian.o hash.o sha256.o fips202.o
$(AR) rcs $@ $^

demo: demo.c hss_lib_thread.a
$(CC) $(CFLAGS) demo.c hss_lib_thread.a -lcrypto -lpthread -o demo

test_1: test_1.c lm_ots_common.o lm_ots_sign.o lm_ots_verify.o endian.o hash.o sha256.o hss_zeroize.o
$(CC) $(CFLAGS) -o test_1 test_1.c lm_ots_common.o lm_ots_sign.o lm_ots_verify.o endian.o hash.o sha256.o hss_zeroize.o -lcrypto
test_1: test_1.c lm_ots_common.o lm_ots_sign.o lm_ots_verify.o endian.o hash.o sha256.o h fips202.o ss_zeroize.o
$(CC) $(CFLAGS) -o test_1 test_1.c lm_ots_common.o lm_ots_sign.o lm_ots_verify.o endian.o hash.o sha256.o fips202.o hss_zeroize.o -lcrypto

test_hss: test_hss.c test_hss.h test_testvector.c test_stat.c test_keygen.c test_load.c test_sign.c test_sign_inc.c test_verify.c test_verify_inc.c test_keyload.c test_reserve.c test_thread.c test_h25.c hss.h hss_lib_thread.a
$(CC) $(CFLAGS) test_hss.c test_testvector.c test_stat.c test_keygen.c test_sign.c test_sign_inc.c test_load.c test_verify.c test_verify_inc.c test_keyload.c test_reserve.c test_thread.c test_h25.c hss_lib_thread.a -lcrypto -lpthread -o test_hss
test_hss: test_hss.c test_hss.h test_testvector.c test_shake.c test_stat.c test_keygen.c test_load.c test_sign.c test_sign_inc.c test_verify.c test_verify_inc.c test_keyload.c test_reserve.c test_thread.c test_h25.c hss.h hss_lib_thread.a
$(CC) $(CFLAGS) test_hss.c test_testvector.c test_shake.c test_stat.c test_keygen.c test_sign.c test_sign_inc.c test_load.c test_verify.c test_verify_inc.c test_keyload.c test_reserve.c test_thread.c test_h25.c hss_lib_thread.a -lcrypto -lpthread -o test_hss

hss.o: hss.c hss.h common_defs.h hash.h endian.h hss_internal.h hss_aux.h hss_derive.h
hss.o: hss.c hss.h common_defs.h hash.h endian.h hss_internal.h hss_aux.h hss_derive.h config.h
$(CC) $(CFLAGS) -c hss.c -o $@

hss_alloc.o: hss_alloc.c hss.h hss_internal.h lm_common.h
hss_alloc.o: hss_alloc.c hss.h hss_internal.h lm_common.h config.h
$(CC) $(CFLAGS) -c hss_alloc.c -o $@

hss_aux.o: hss_aux.c hss_aux.h hss_internal.h common_defs.h lm_common.h endian.h hash.h
hss_aux.o: hss_aux.c hss_aux.h hss_internal.h common_defs.h lm_common.h endian.h hash.h config.h
$(CC) $(CFLAGS) -c hss_aux.c -o $@

hss_common.o: hss_common.c common_defs.h hss_common.h lm_common.h
hss_common.o: hss_common.c common_defs.h hss_common.h lm_common.h config.h
$(CC) $(CFLAGS) -c hss_common.c -o $@

hss_compute.o: hss_compute.c hss_internal.h hash.h hss_thread.h lm_ots_common.h lm_ots.h endian.h hss_derive.h
hss_compute.o: hss_compute.c hss_internal.h hash.h hss_thread.h lm_ots_common.h lm_ots.h endian.h hss_derive.h config.h
$(CC) $(CFLAGS) -c hss_compute.c -o $@

hss_derive.o: hss_derive.c hss_derive.h hss_internal.h hash.h endian.h
hss_derive.o: hss_derive.c hss_derive.h hss_internal.h hash.h endian.h config.h
$(CC) $(CFLAGS) -c hss_derive.c -o $@

hss_generate.o: hss_generate.c hss.h hss_internal.h hss_aux.h hash.h hss_thread.h hss_reserve.h lm_ots_common.h endian.h
hss_generate.o: hss_generate.c hss.h hss_internal.h hss_aux.h hash.h hss_thread.h hss_reserve.h lm_ots_common.h endian.h config.h
$(CC) $(CFLAGS) -c hss_generate.c -o $@

hss_keygen.o: hss_keygen.c hss.h common_defs.h hss_internal.h hss_aux.h endian.h hash.h hss_thread.h lm_common.h lm_ots_common.h
hss_keygen.o: hss_keygen.c hss.h common_defs.h hss_internal.h hss_aux.h endian.h hash.h hss_thread.h lm_common.h lm_ots_common.h config.h
$(CC) $(CFLAGS) -c hss_keygen.c -o $@

hss_param.o: hss_param.c hss.h hss_internal.h endian.h hss_zeroize.h
hss_param.o: hss_param.c hss.h hss_internal.h endian.h hss_zeroize.h config.h
$(CC) $(CFLAGS) -c hss_param.c -o $@

hss_reserve.o: hss_reserve.c common_defs.h hss_internal.h hss_reserve.h endian.h
hss_reserve.o: hss_reserve.c common_defs.h hss_internal.h hss_reserve.h endian.h config.h
$(CC) $(CFLAGS) -c hss_reserve.c -o $@

hss_sign.o: hss_sign.c common_defs.h hss.h hash.h endian.h hss_internal.h hss_aux.h hss_thread.h hss_reserve.h lm_ots.h lm_ots_common.h hss_derive.h
hss_sign.o: hss_sign.c common_defs.h hss.h hash.h endian.h hss_internal.h hss_aux.h hss_thread.h hss_reserve.h lm_ots.h lm_ots_common.h hss_derive.h config.h
$(CC) $(CFLAGS) -c hss_sign.c -o $@

hss_sign_inc.o: hss_sign_inc.c hss.h common_defs.h hss.h hash.h endian.h hss_internal.h hss_aux.h hss_reserve.h hss_derive.h lm_ots.h lm_ots_common.h hss_sign_inc.h
hss_sign_inc.o: hss_sign_inc.c hss.h common_defs.h hss.h hash.h endian.h hss_internal.h hss_aux.h hss_reserve.h hss_derive.h lm_ots.h lm_ots_common.h hss_sign_inc.h config.h
$(CC) $(CFLAGS) -c hss_sign_inc.c -o $@

hss_thread_single.o: hss_thread_single.c hss_thread.h
hss_thread_single.o: hss_thread_single.c hss_thread.h config.h
$(CC) $(CFLAGS) -c hss_thread_single.c -o $@

hss_thread_pthread.o: hss_thread_pthread.c hss_thread.h
hss_thread_pthread.o: hss_thread_pthread.c hss_thread.h config.h
$(CC) $(CFLAGS) -c hss_thread_pthread.c -o $@

hss_verify.o: hss_verify.c hss_verify.h common_defs.h lm_verify.h lm_common.h lm_ots_verify.h hash.h endian.h hss_thread.h
hss_verify.o: hss_verify.c hss_verify.h common_defs.h lm_verify.h lm_common.h lm_ots_verify.h hash.h endian.h hss_thread.h config.h
$(CC) $(CFLAGS) -c hss_verify.c -o $@

hss_verify_inc.o: hss_verify_inc.c hss_verify_inc.h common_defs.h lm_verify.h lm_common.h lm_ots_verify.h hash.h endian.h hss_thread.h
hss_verify_inc.o: hss_verify_inc.c hss_verify_inc.h common_defs.h lm_verify.h lm_common.h lm_ots_verify.h hash.h endian.h hss_thread.h config.h
$(CC) $(CFLAGS) -c hss_verify_inc.c -o $@

hss_zeroize.o: hss_zeroize.c hss_zeroize.h
hss_zeroize.o: hss_zeroize.c hss_zeroize.h config.h
$(CC) $(CFLAGS) -c hss_zeroize.c -o $@

lm_common.o: lm_common.c lm_common.h hash.h common_defs.h lm_ots_common.h
lm_common.o: lm_common.c lm_common.h hash.h common_defs.h lm_ots_common.h config.h
$(CC) $(CFLAGS) -c lm_common.c -o $@

lm_ots_common.o: lm_ots_common.c common_defs.h hash.h
lm_ots_common.o: lm_ots_common.c common_defs.h hash.h config.h
$(CC) $(CFLAGS) -c lm_ots_common.c -o $@

lm_ots_sign.o: lm_ots_sign.c common_defs.h lm_ots.h lm_ots_common.h hash.h endian.h hss_zeroize.h hss_derive.h
lm_ots_sign.o: lm_ots_sign.c common_defs.h lm_ots.h lm_ots_common.h hash.h endian.h hss_zeroize.h hss_derive.h config.h
$(CC) $(CFLAGS) -c lm_ots_sign.c -o $@

lm_ots_verify.o: lm_ots_verify.c lm_ots_verify.h lm_ots_common.h hash.h endian.h common_defs.h
lm_ots_verify.o: lm_ots_verify.c lm_ots_verify.h lm_ots_common.h hash.h endian.h common_defs.h config.h
$(CC) $(CFLAGS) -c lm_ots_verify.c -o $@

lm_verify.o: lm_verify.c lm_verify.h lm_common.h lm_ots_common.h lm_ots_verify.h hash.h endian.h common_defs.h
lm_verify.o: lm_verify.c lm_verify.h lm_common.h lm_ots_common.h lm_ots_verify.h hash.h endian.h common_defs.h config.h
$(CC) $(CFLAGS) -c lm_verify.c -o $@

endian.o: endian.c endian.h
endian.o: endian.c endian.h config.h
$(CC) $(CFLAGS) -c endian.c -o $@

hash.o: hash.c hash.h sha256.h hss_zeroize.h
hash.o: hash.c hash.h sha256.h fips202.h hss_zeroize.h config.h
$(CC) $(CFLAGS) -c hash.c -o $@

sha256.o: sha256.c sha256.h endian.h
sha256.o: sha256.c sha256.h endian.h config.h
$(CC) $(CFLAGS) -c sha256.c -o $@

fips202.o: fips202.c fips202.h
$(CC) $(CFLAGS) -c fips202.c -o $@

clean:
-rm *.o *.a demo test_hss

Expand Down
5 changes: 2 additions & 3 deletions README
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
This code attempts to be a usable implementation of the LMS Hash Based
Signature Scheme from RFC 8554.

See read.me for documentation how to use it.
This branch includes the parameter sets from draft-fluhrer-lms-more-parm-sets.

This is the ACVP branch - designed to be (optionally) compatible with the
public ACVP server
See read.me for documentation how to use it.
31 changes: 30 additions & 1 deletion common_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#define MAX_HSS_LEVELS 8 /* Maximum levels we allow */

/* This is the length of our internal seed values */
#define SEED_LEN 32 /* Enough to make Grover's infeasible */
#define MAX_SEED_LEN 32 /* Enough to make Grover's infeasible */

/* Here are some internal types used within the code. They are listed more */
/* for documentation ("this is what this variable is expected to be") rather */
Expand Down Expand Up @@ -60,12 +60,41 @@ typedef uint_fast64_t sequence_t;
#define LMS_SHA256_N32_H15 0x00000007
#define LMS_SHA256_N32_H20 0x00000008
#define LMS_SHA256_N32_H25 0x00000009
#define LMS_SHA256_N24_H5 0x0000000a
#define LMS_SHA256_N24_H10 0x0000000b
#define LMS_SHA256_N24_H15 0x0000000c
#define LMS_SHA256_N24_H20 0x0000000d
#define LMS_SHA256_N24_H25 0x0000000e
#define LMS_SHAKE256_N32_H5 0x0000000f
#define LMS_SHAKE256_N32_H10 0x00000010
#define LMS_SHAKE256_N32_H15 0x00000011
#define LMS_SHAKE256_N32_H20 0x00000012
#define LMS_SHAKE256_N32_H25 0x00000013
#define LMS_SHAKE256_N24_H5 0x00000014
#define LMS_SHAKE256_N24_H10 0x00000015
#define LMS_SHAKE256_N24_H15 0x00000016
#define LMS_SHAKE256_N24_H20 0x00000017
#define LMS_SHAKE256_N24_H25 0x00000018


/* LM-OTS registry */
#define LMOTS_SHA256_N32_W1 0x00000001
#define LMOTS_SHA256_N32_W2 0x00000002
#define LMOTS_SHA256_N32_W4 0x00000003
#define LMOTS_SHA256_N32_W8 0x00000004
#define LMOTS_SHA256_N24_W1 0x00000005
#define LMOTS_SHA256_N24_W2 0x00000006
#define LMOTS_SHA256_N24_W4 0x00000007
#define LMOTS_SHA256_N24_W8 0x00000008
#define LMOTS_SHAKE256_N32_W1 0x00000009
#define LMOTS_SHAKE256_N32_W2 0x0000000a
#define LMOTS_SHAKE256_N32_W4 0x0000000b
#define LMOTS_SHAKE256_N32_W8 0x0000000c
#define LMOTS_SHAKE256_N24_W1 0x0000000d
#define LMOTS_SHAKE256_N24_W2 0x0000000e
#define LMOTS_SHAKE256_N24_W4 0x0000000f
#define LMOTS_SHAKE256_N24_W8 0x00000010


/*
* Internal formats of various hashes
Expand Down
Loading