-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #466 from philljj/ml_dsa_example
pq: ML-DSA example, and reorganize examples.
- Loading branch information
Showing
22 changed files
with
518 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
CC = gcc | ||
|
||
WOLFSSL_INSTALL_DIR = /usr/local | ||
|
||
WOLFSSL_CFLAGS = -Wextra -Werror -Wall -I$(WOLFSSL_INSTALL_DIR)/include | ||
WOLFSSL_LIBS = -L$(WOLFSSL_INSTALL_DIR)/lib -lm -lwolfssl | ||
|
||
DEBUG_FLAGS = -g -DDEBUG | ||
|
||
all: ml_dsa_test | ||
|
||
ml_dsa_test: ml_dsa.c | ||
$(CC) -o $@ $^ $(WOLFSSL_CFLAGS) $(WOLFSSL_LIBS) $(DEBUG_FLAGS) | ||
|
||
.PHONY: clean all | ||
|
||
clean: | ||
rm -f *.o wolfssl_acert ml_dsa_test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# Description | ||
|
||
Simple example of wolfCrypt ML-DSA keygen, signing, and verifying. | ||
|
||
Requires wolfSSL is built with: | ||
|
||
```sh | ||
./configure --enable-dilithium | ||
make | ||
make install | ||
``` | ||
|
||
Build the ML-DSA example with: | ||
|
||
```sh | ||
make ml_dsa_test | ||
``` | ||
|
||
# Usage | ||
|
||
``` | ||
./ml_dsa_test -? | ||
usage: | ||
./ml_dsa_test [-pvw] -c <security category> [-m <message>] | ||
parms: | ||
-m <message> the message to sign | ||
-c <security category> set the security category {2,3,5} | ||
-p print FIPS 204 parameters and exit | ||
-v verbose | ||
-w write keys, msg, and sig to file | ||
-? show this help | ||
``` | ||
|
||
## Keygen, sign, and verify | ||
|
||
This will generate a keypair with security category 5, then | ||
sign and verify a test message, and write the keys, message, | ||
and signature to `*.key` and `*.bin` files: | ||
``` | ||
./ml_dsa_test -c 5 -m "my test message" -w | ||
info: making key | ||
info: using ML-DSA-87, Security Category 5: priv_len 4896, pub_len 2592, sig_len 4627 | ||
info: signed message | ||
info: verify message good | ||
info: done | ||
``` | ||
|
||
## Print Supported ML-DSA Parameters | ||
|
||
To see the supported parameters: | ||
|
||
``` | ||
./ml_dsa_test -p | ||
ML-DSA parameters and key/sig sizes* | ||
Private Key Public Key Signature Size Security Strength | ||
ML-DSA-44 2560 1312 2420 Category 2 | ||
ML-DSA-65 4032 1952 3309 Category 3 | ||
ML-DSA-87 4896 2592 4627 Category 5 | ||
* from Tables 1 & 2 of FIPS 204: | ||
https://csrc.nist.gov/pubs/fips/204/final | ||
``` |
Oops, something went wrong.