Norman Ashley 971173ad82
Add Stateful Signature (XMSS and LMS) (#1650)
Add support for LMS and XMSS. Key generation and signing are disabled behind a feature flag labelled "hazardous experimental."

---------

Signed-off-by: Duc Tri Nguyen <dnguye69@gmu.edu>
Signed-off-by: Spencer Wilson <spencer.wilson@uwaterloo.ca>
Signed-off-by: Norman Ashley <nashley@cisco.com>
Signed-off-by: Douglas Stebila <dstebila@uwaterloo.ca>
Co-authored-by: Duc Tri Nguyen <dnguye69@gmu.edu>
Co-authored-by: Douglas Stebila <dstebila@uwaterloo.ca>
Co-authored-by: Duc Nguyen <106774416+ducnguyen-sb@users.noreply.github.com>
Co-authored-by: Douglas Stebila <dstebila@users.noreply.github.com>
Co-authored-by: Duc Nguyen <ductri.nguyen@sandboxquantum.com>
Co-authored-by: Spencer Wilson <spencer.wilson@uwaterloo.ca>
Co-authored-by: Jason Goertzen <133878263+jgoertzen-sb@users.noreply.github.com>
2024-06-05 15:59:40 -04:00

1.8 KiB

Stateful Hash Based Signatures

The security of hash based signatures (HBS) is based on the underlying hash functions on which they are built. NIST recommendation is that they are suitable for near term use to mitigate against attacks mounted by quantum computers. While not a general purpose solution, they are useful means to authenticate boot or firmware images.

General

This package provides full support for a variety of variants for XMSS and LMS. Key generation, signature generation, and signature verification. Security of HBS also depends on the management of the state of the secret key. Secret keys can only used once to generate a signature. Multiple signing with same key can reveal that key to an attacker. Because of this, NIST recommends that key and signature generation be done in hardware security modules. Having said that, this library is fully functional for research purposes. Secret keys are incremented after each sign operation. However, secure storage and lifecycle management of the secret keys are left to applications using this feature. Secret key storage is easily done by supplying a callback function to the library. This callback is invoked to store the secret key.

Key State Management

Application writers have to supply callback functions to store and update secret keys. After a sign operation the secret key index is advanced and stored. This ensures one-time use of the key. Signing operations will fail without this callback set because the private key cannot be advanced (to prevent reuse).

Stateful keys can generate a finite number of signatures. A counter tracks the limit when the key is created and is decremented after each signature is generated. When the counter is down to 0, signature generation fails. Applications can query the remaining count via an API.