Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create test MLDSA key pairs. #1852

Merged
merged 6 commits into from
Dec 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 4 additions & 2 deletions rom/dev/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ TARGET_DIR=../../target/riscv32imc-unknown-none-elf/firmware
CURRENT_DIR = $(shell pwd)
GIT_REV = $(shell git rev-parse HEAD)
EXTRA_CARGO_CONFIG = target.'cfg(all())'.rustflags = [\"-Dwarnings\"]
# Default to MLDSA key type.
PQC_KEY_TYPE ?= 2

default: build

Expand Down Expand Up @@ -68,10 +70,10 @@ build-fw-image: gen-certs build-test-fmc build-test-rt
--manifest-path ../../image/app/Cargo.toml \
-- \
create \
--pqc-key-type 1 \
--pqc-key-type $(PQC_KEY_TYPE) \
--key-config $(TARGET_DIR)/keys.toml \
--ecc-pk-idx 1 \
--pqc-pk-idx 3 \
--pqc-pk-idx 0 \
--fmc $(TARGET_DIR)/caliptra-rom-test-fmc \
--fmc-version 0 \
--fmc-svn 0 \
Expand Down
23 changes: 14 additions & 9 deletions rom/dev/tools/keys.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ lms_pub_keys = [
"vnd-lms-pub-key-2.pem",
"vnd-lms-pub-key-3.pem",
]

# [TODO][CAP2] Add MLDSA key files.
mldsa_pub_keys = []

ecc_priv_keys = [
"vnd-priv-key-0.pem",
"vnd-priv-key-1.pem",
Expand Down Expand Up @@ -85,14 +81,23 @@ lms_priv_keys = [
"vnd-lms-priv-key-2.pem",
"vnd-lms-priv-key-3.pem",
]

mldsa_priv_keys = []
mldsa_pub_keys = [
"vnd-mldsa-pub-key-0.bin",
"vnd-mldsa-pub-key-1.bin",
"vnd-mldsa-pub-key-2.bin",
"vnd-mldsa-pub-key-3.bin",
]
mldsa_priv_keys = [
"vnd-mldsa-priv-key-0.bin",
"vnd-mldsa-priv-key-1.bin",
"vnd-mldsa-priv-key-2.bin",
"vnd-mldsa-priv-key-3.bin",
]

[owner]
ecc_pub_key = "own-pub-key.pem"
ecc_priv_key = "own-priv-key.pem"
lms_pub_key = "own-lms-pub-key.pem"
lms_priv_key = "own-lms-priv-key.pem"
mldsa_pub_key = ""
mldsa_priv_key = ""

mldsa_pub_key = "own-mldsa-pub-key.bin"
mldsa_priv_key = "own-mldsa-priv-key.bin"
Binary file added rom/dev/tools/mldsa_keys/own-mldsa-priv-key.bin
Binary file not shown.
Binary file added rom/dev/tools/mldsa_keys/own-mldsa-pub-key.bin
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
8 changes: 8 additions & 0 deletions rom/dev/tools/scripts/gen_test_certs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,11 @@ done
openssl ecparam -name secp384r1 -genkey -noout -out $1/own-priv-key.pem
openssl ec -in $1/own-priv-key.pem -pubout -out $1/own-pub-key.pem

for value in {0..3}
do
cp tools/mldsa_keys/vnd-mldsa-pub-key-$value.bin $1/
cp tools/mldsa_keys/vnd-mldsa-priv-key-$value.bin $1/
done

cp tools/mldsa_keys/own-mldsa-pub-key.bin $1/
cp tools/mldsa_keys/own-mldsa-priv-key.bin $1/