diff --git a/.github/workflow_metadata/pr_hash b/.github/workflow_metadata/pr_hash index 49d617218..0e963a37f 100644 --- a/.github/workflow_metadata/pr_hash +++ b/.github/workflow_metadata/pr_hash @@ -1 +1 @@ -1cad8694bd690a699ed8a95772494825b142b6cb12db11fa682a9c71e0865c474b066e6f3c1abe35ce52b03edbac73c1 \ No newline at end of file +c8e06113e37e54e9876411db9113dde467573ddcdfa04c21e4aabed77398465566c22fc6db80017342843e5b55280e45 \ No newline at end of file diff --git a/.github/workflow_metadata/pr_timestamp b/.github/workflow_metadata/pr_timestamp index 668c459c4..2b923128a 100644 --- a/.github/workflow_metadata/pr_timestamp +++ b/.github/workflow_metadata/pr_timestamp @@ -1 +1 @@ -1734735334 \ No newline at end of file +1734986966 \ No newline at end of file diff --git a/src/integration/asserts/caliptra_top_sva.sv b/src/integration/asserts/caliptra_top_sva.sv index bd51e2179..e157dec03 100644 --- a/src/integration/asserts/caliptra_top_sva.sv +++ b/src/integration/asserts/caliptra_top_sva.sv @@ -602,11 +602,11 @@ module caliptra_top_sva ) else $display("SVA ERROR: ECC VALID flag mismatch!"); - MLDSA_valid_flag: assert property ( - @(posedge `SVA_RDC_CLK) - `MLDSA_PATH.mldsa_valid_reg |-> `MLDSA_PATH.mldsa_ready - ) - else $display("SVA ERROR: MLDSA VALID flag mismatch!"); + // MLDSA_valid_flag: assert property ( + // @(posedge `SVA_RDC_CLK) + // `MLDSA_PATH.mldsa_valid_reg |-> `MLDSA_PATH.mldsa_ready + // ) + // else $display("SVA ERROR: MLDSA VALID flag mismatch!"); //SVA for SHA512 restore sha512_restore_cmd: assert property ( diff --git a/src/integration/config/caliptra_top_tb.vf b/src/integration/config/caliptra_top_tb.vf index e7e62af9f..bb962236e 100644 --- a/src/integration/config/caliptra_top_tb.vf +++ b/src/integration/config/caliptra_top_tb.vf @@ -25,6 +25,7 @@ +incdir+${CALIPTRA_ROOT}/src/soc_ifc/coverage +incdir+${CALIPTRA_ROOT}/src/pcrvault/coverage +incdir+${CALIPTRA_ROOT}/src/keyvault/coverage ++incdir+${CALIPTRA_ROOT}/submodules/adams-bridge/src/mldsa_top/coverage +incdir+${CALIPTRA_ROOT}/src/integration/tb +incdir+${CALIPTRA_ROOT}/src/integration/coverage +incdir+${CALIPTRA_ROOT}/src/riscv_core/veer_el2/rtl/include @@ -148,6 +149,8 @@ ${CALIPTRA_ROOT}/src/pcrvault/coverage/pcrvault_cov_bind.sv ${CALIPTRA_ROOT}/src/keyvault/coverage/keyvault_cov_if.sv ${CALIPTRA_ROOT}/src/keyvault/coverage/keyvault_cov_props.sv ${CALIPTRA_ROOT}/src/keyvault/coverage/keyvault_cov_bind.sv +${CALIPTRA_ROOT}/submodules/adams-bridge/src/mldsa_top/coverage/mldsa_top_cov_if.sv +${CALIPTRA_ROOT}/submodules/adams-bridge/src/mldsa_top/coverage/mldsa_top_cov_bind.sv ${CALIPTRA_ROOT}/src/integration/tb/caliptra_top_tb_pkg.sv ${CALIPTRA_ROOT}/src/integration/tb/caliptra_veer_sram_export.sv ${CALIPTRA_ROOT}/src/integration/tb/caliptra_top_tb_services.sv diff --git a/src/integration/config/caliptra_top_tb_pkg.vf b/src/integration/config/caliptra_top_tb_pkg.vf index 90826dbb2..7d7f62568 100644 --- a/src/integration/config/caliptra_top_tb_pkg.vf +++ b/src/integration/config/caliptra_top_tb_pkg.vf @@ -25,6 +25,7 @@ +incdir+${CALIPTRA_ROOT}/src/soc_ifc/coverage +incdir+${CALIPTRA_ROOT}/src/pcrvault/coverage +incdir+${CALIPTRA_ROOT}/src/keyvault/coverage ++incdir+${CALIPTRA_ROOT}/submodules/adams-bridge/src/mldsa_top/coverage +incdir+${CALIPTRA_ROOT}/src/integration/tb +incdir+${CALIPTRA_ROOT}/src/integration/coverage +incdir+${CALIPTRA_ROOT}/src/riscv_core/veer_el2/rtl/include @@ -148,6 +149,8 @@ ${CALIPTRA_ROOT}/src/pcrvault/coverage/pcrvault_cov_bind.sv ${CALIPTRA_ROOT}/src/keyvault/coverage/keyvault_cov_if.sv ${CALIPTRA_ROOT}/src/keyvault/coverage/keyvault_cov_props.sv ${CALIPTRA_ROOT}/src/keyvault/coverage/keyvault_cov_bind.sv +${CALIPTRA_ROOT}/submodules/adams-bridge/src/mldsa_top/coverage/mldsa_top_cov_if.sv +${CALIPTRA_ROOT}/submodules/adams-bridge/src/mldsa_top/coverage/mldsa_top_cov_bind.sv ${CALIPTRA_ROOT}/src/integration/tb/caliptra_top_tb_pkg.sv ${CALIPTRA_ROOT}/src/integration/tb/caliptra_veer_sram_export.sv ${CALIPTRA_ROOT}/src/integration/tb/caliptra_top_tb_services.sv diff --git a/src/integration/config/caliptra_top_trng_tb.vf b/src/integration/config/caliptra_top_trng_tb.vf index e7e62af9f..bb962236e 100644 --- a/src/integration/config/caliptra_top_trng_tb.vf +++ b/src/integration/config/caliptra_top_trng_tb.vf @@ -25,6 +25,7 @@ +incdir+${CALIPTRA_ROOT}/src/soc_ifc/coverage +incdir+${CALIPTRA_ROOT}/src/pcrvault/coverage +incdir+${CALIPTRA_ROOT}/src/keyvault/coverage ++incdir+${CALIPTRA_ROOT}/submodules/adams-bridge/src/mldsa_top/coverage +incdir+${CALIPTRA_ROOT}/src/integration/tb +incdir+${CALIPTRA_ROOT}/src/integration/coverage +incdir+${CALIPTRA_ROOT}/src/riscv_core/veer_el2/rtl/include @@ -148,6 +149,8 @@ ${CALIPTRA_ROOT}/src/pcrvault/coverage/pcrvault_cov_bind.sv ${CALIPTRA_ROOT}/src/keyvault/coverage/keyvault_cov_if.sv ${CALIPTRA_ROOT}/src/keyvault/coverage/keyvault_cov_props.sv ${CALIPTRA_ROOT}/src/keyvault/coverage/keyvault_cov_bind.sv +${CALIPTRA_ROOT}/submodules/adams-bridge/src/mldsa_top/coverage/mldsa_top_cov_if.sv +${CALIPTRA_ROOT}/submodules/adams-bridge/src/mldsa_top/coverage/mldsa_top_cov_bind.sv ${CALIPTRA_ROOT}/src/integration/tb/caliptra_top_tb_pkg.sv ${CALIPTRA_ROOT}/src/integration/tb/caliptra_veer_sram_export.sv ${CALIPTRA_ROOT}/src/integration/tb/caliptra_top_tb_services.sv diff --git a/src/integration/config/compile.yml b/src/integration/config/compile.yml index 95fdfc955..859067193 100644 --- a/src/integration/config/compile.yml +++ b/src/integration/config/compile.yml @@ -77,7 +77,7 @@ requires: - soc_ifc_coverage - pcrvault_cov - keyvault_cov - #- mldsa_coverage //TODO: Add after updating submodule + - mldsa_coverage targets: dpi_compile: directories: diff --git a/src/integration/stimulus/L0_regression.yml b/src/integration/stimulus/L0_regression.yml index 25cc59721..1873c95d7 100644 --- a/src/integration/stimulus/L0_regression.yml +++ b/src/integration/stimulus/L0_regression.yml @@ -24,8 +24,9 @@ contents: - ../test_suites/c_intr_handler/c_intr_handler.yml - ../test_suites/smoke_test_ecc/smoke_test_ecc.yml - ../test_suites/smoke_test_hmac/smoke_test_hmac.yml - #- ../test_suites/smoke_test_mldsa/smoke_test_mldsa.yml //TODO: Add after updating submodule + - ../test_suites/smoke_test_mldsa/smoke_test_mldsa.yml - ../test_suites/smoke_test_aes/smoke_test_aes.yml + - ../test_suites/smoke_test_mldsa_edge/smoke_test_mldsa_edge.yml - ../test_suites/smoke_test_kv/smoke_test_kv.yml - ../test_suites/smoke_test_sram_ecc/smoke_test_sram_ecc.yml - ../test_suites/smoke_test_ras/smoke_test_ras.yml @@ -42,7 +43,7 @@ contents: #- ../test_suites/smoke_test_kv_sha512_flow/smoke_test_kv_sha512_flow.yml Removed SHA KV functionality - ../test_suites/smoke_test_kv_crypto_flow/smoke_test_kv_crypto_flow.yml - ../test_suites/smoke_test_kv_cg/smoke_test_kv_cg.yml - #- ../test_suites/smoke_test_kv_mldsa/smoke_test_kv_mldsa.yml //TODO: Add after updating submodule + - ../test_suites/smoke_test_kv_mldsa/smoke_test_kv_mldsa.yml - ../test_suites/pv_hash_and_sign/pv_hash_and_sign.yml - ../test_suites/smoke_test_pcr_signing/smoke_test_pcr_signing.yml - ../test_suites/smoke_test_fw_kv_backtoback_hmac/smoke_test_fw_kv_backtoback_hmac.yml diff --git a/src/integration/stimulus/testsuites/caliptra_top_nightly_directed_regression.yml b/src/integration/stimulus/testsuites/caliptra_top_nightly_directed_regression.yml index 32ef93ace..33a6f0b62 100644 --- a/src/integration/stimulus/testsuites/caliptra_top_nightly_directed_regression.yml +++ b/src/integration/stimulus/testsuites/caliptra_top_nightly_directed_regression.yml @@ -29,7 +29,8 @@ contents: - ${CALIPTRA_ROOT}/src/integration/test_suites/smoke_test_ecc/smoke_test_ecc.yml - ${CALIPTRA_ROOT}/src/integration/test_suites/smoke_test_hmac/smoke_test_hmac.yml - ${CALIPTRA_ROOT}/src/integration/test_suites/smoke_test_hmac_errortrigger/smoke_test_hmac_errortrigger.yml - # - ${CALIPTRA_ROOT}/src/integration/test_suites/smoke_test_mldsa_rand/smoke_test_mldsa_rand.yml //TODO: Add after updating submodule + - ${CALIPTRA_ROOT}/src/integration/test_suites/smoke_test_mldsa_rand/smoke_test_mldsa_rand.yml + - ${CALIPTRA_ROOT}/src/integration/test_suites/smoke_test_mldsa_rand/smoke_test_mldsa_keygen_rand.yml - ${CALIPTRA_ROOT}/src/integration/test_suites/smoke_test_kv/smoke_test_kv.yml - ${CALIPTRA_ROOT}/src/integration/test_suites/smoke_test_sram_ecc/smoke_test_sram_ecc.yml - ${CALIPTRA_ROOT}/src/integration/test_suites/smoke_test_ras/smoke_test_ras.yml @@ -44,7 +45,7 @@ contents: # - ${CALIPTRA_ROOT}/src/integration/test_suites/smoke_test_kv_sha512_flow/smoke_test_kv_sha512_flow.yml - ${CALIPTRA_ROOT}/src/integration/test_suites/smoke_test_kv_crypto_flow/smoke_test_kv_crypto_flow.yml - ${CALIPTRA_ROOT}/src/integration/test_suites/smoke_test_kv_cg/smoke_test_kv_cg.yml - #- ${CALIPTRA_ROOT}/src/integration/test_suites/smoke_test_kv_mldsa/smoke_test_kv_mldsa.yml //TODO: Add after updating submodule + - ${CALIPTRA_ROOT}/src/integration/test_suites/smoke_test_kv_mldsa/smoke_test_kv_mldsa.yml - ${CALIPTRA_ROOT}/src/integration/test_suites/pv_hash_and_sign/pv_hash_and_sign.yml - ${CALIPTRA_ROOT}/src/integration/test_suites/smoke_test_pcr_signing/smoke_test_pcr_signing.yml - ${CALIPTRA_ROOT}/src/integration/test_suites/smoke_test_fw_kv_backtoback_hmac/smoke_test_fw_kv_backtoback_hmac.yml diff --git a/src/integration/tb/caliptra_top_tb_services.sv b/src/integration/tb/caliptra_top_tb_services.sv index 8203df208..640dbd17a 100644 --- a/src/integration/tb/caliptra_top_tb_services.sv +++ b/src/integration/tb/caliptra_top_tb_services.sv @@ -266,6 +266,7 @@ module caliptra_top_tb_services // 8'ha8 - Inject zero as HMAC_KEY to kv_key register // 8'ha9: 8'haf - Inject HMAC512_KEY to kv_key register // 8'hc0: 8'hc7 - Inject MLDSA_SEED to kv_key register + // 8'hd7 - Inject normcheck failure during mldsa signing // 8'hd8 - Inject makehint failure during mldsa signing // 8'hd9 - Perform mldsa keygen // 8'hda - Perform mldsa signing @@ -598,6 +599,48 @@ module caliptra_top_tb_services end //MLDSA + logic inject_makehint_failure, inject_normcheck_failure; + logic reset_mldsa_failure; + logic [1:0] normcheck_mode_random; + + always_ff @(negedge clk or negedge cptra_rst_b) begin + if (!cptra_rst_b) begin + inject_makehint_failure <= 1'b0; + inject_normcheck_failure <= 1'b0; + reset_mldsa_failure <= 1'b0; + normcheck_mode_random <= 'h0; + end + else if (((WriteData[7:0] == 8'hd8) && mailbox_write) /*&& !caliptra_top_dut.mldsa.mldsa_ctrl_inst.clear_signature_valid*/) begin + inject_makehint_failure <= 1'b1; + end + else if (((WriteData[7:0] == 8'hd7) && mailbox_write) /*&& (!caliptra_top_dut.mldsa.mldsa_ctrl_inst.clear_signature_valid || !caliptra_top_dut.mldsa.mldsa_ctrl_inst.clear_verify_valid)*/) begin + inject_normcheck_failure <= 1'b1; + if (caliptra_top_dut.mldsa.mldsa_ctrl_inst.verifying_process) + normcheck_mode_random <= 'h0; + else + normcheck_mode_random <= $urandom_range(0,2); + end + else if ((caliptra_top_dut.mldsa.mldsa_ctrl_inst.clear_signature_valid)) + reset_mldsa_failure <= 1'b1; + else if (((caliptra_top_dut.mldsa.mldsa_ctrl_inst.sec_prog_cntr == 'h1A) && reset_mldsa_failure) || caliptra_top_dut.mldsa.mldsa_ctrl_inst.clear_verify_valid) begin //clear flags if end of signing loop or verify failed + reset_mldsa_failure <= 1'b0; + inject_makehint_failure <= 1'b0; + inject_normcheck_failure <= 1'b0; + end + end + + always_ff @(negedge clk) begin + if (inject_makehint_failure & caliptra_top_dut.mldsa.makehint_inst.hintgen_enable) + force caliptra_top_dut.mldsa.makehint_inst.hintsum = 'd80; //> OMEGA => makehint fails + else + release caliptra_top_dut.mldsa.makehint_inst.hintsum; + + if (inject_normcheck_failure & caliptra_top_dut.mldsa.norm_check_inst.norm_check_ctrl_inst.check_enable & (caliptra_top_dut.mldsa.norm_check_inst.mode == normcheck_mode_random)) + force caliptra_top_dut.mldsa.norm_check_inst.invalid = 'b1; + else + release caliptra_top_dut.mldsa.norm_check_inst.invalid; + end + logic mldsa_keygen, mldsa_signing, mldsa_verify, mldsa_keygen_signing; always @(negedge clk or negedge cptra_rst_b) begin @@ -632,6 +675,13 @@ module caliptra_top_tb_services mldsa_verify <= 'b0; mldsa_keygen_signing <= 'b1; end + else if((WriteData[7:0] == 8'hdc) && mailbox_write) begin + mldsa_keygen <= 'b0; + mldsa_signing <= 'b0; + mldsa_verify <= 'b0; + mldsa_keygen_signing <= 'b1; + $display("In keygen+sign branch\n"); + end end genvar mldsa_dword; @@ -1953,7 +2003,7 @@ sha512_ctrl_cov_bind i_sha512_ctrl_cov_bind(); sha256_ctrl_cov_bind i_sha256_ctrl_cov_bind(); hmac_ctrl_cov_bind i_hmac_ctrl_cov_bind(); ecc_top_cov_bind i_ecc_top_cov_bind(); -// mldsa_top_cov_bind i_mldsa_top_cov_bind(); //TODO: Add after updating submodule +mldsa_top_cov_bind i_mldsa_top_cov_bind(); keyvault_cov_bind i_keyvault_cov_bind(); pcrvault_cov_bind i_pcrvault_cov_bind(); `endif diff --git a/src/integration/test_suites/libs/mldsa/mldsa.c b/src/integration/test_suites/libs/mldsa/mldsa.c index 48a66b5fc..d3aa806f9 100644 --- a/src/integration/test_suites/libs/mldsa/mldsa.c +++ b/src/integration/test_suites/libs/mldsa/mldsa.c @@ -190,7 +190,7 @@ void mldsa_keygen_signing_flow(mldsa_io seed, uint32_t msg[MLDSA87_MSG_SIZE], ui // Enable MLDSA KEYGEN + SIGNING core printf("\nMLDSA KEYGEN + SIGNING\n"); lsu_write_32(CLP_MLDSA_REG_MLDSA_CTRL, MLDSA_CMD_KEYGEN_SIGN); - + // wait for MLDSA SIGNING process to be done wait_for_mldsa_intr(); diff --git a/src/integration/test_suites/smoke_test_kv_mldsa/smoke_test_kv_mldsa.ld b/src/integration/test_suites/smoke_test_kv_mldsa/smoke_test_kv_mldsa.ld index 6d1882e13..9c304f2ac 100644 --- a/src/integration/test_suites/smoke_test_kv_mldsa/smoke_test_kv_mldsa.ld +++ b/src/integration/test_suites/smoke_test_kv_mldsa/smoke_test_kv_mldsa.ld @@ -30,8 +30,8 @@ SECTIONS { * when copying to DCCM */ /* Only upper half of DCCM is used for ROM image */ _data_lma_start = ALIGN(4); - _data_vma_start = 0x50010000; - .data _data_vma_start : AT(_data_lma_start) { *(.*data) *(.*data.*) *(.rodata*) *(.srodata*) ; . = ALIGN(4);} =0x0000, + _data_vma_start = 0x50000000; + .data _data_vma_start : AT(_data_lma_start) { *(.*data.*) ; . = ALIGN(4);} =0x0000, _data_lma_end = _data_lma_start + SIZEOF(.data); _data_vma_end = _data_vma_start + SIZEOF(.data); @@ -48,7 +48,7 @@ SECTIONS { . = _bss_vma_end; _dccm_lma_start = _bss_vma_end; /* ----\___ SAME */ _dccm_vma_start = _bss_vma_end; /* ----/ */ - .dccm _dccm_vma_start : AT(_dccm_lma_start) { *(.dccm*) . = ALIGN(4); } =0x0000, + .dccm _dccm_vma_start : AT(_dccm_lma_start) { *(.dccm*) *(.*data) *(.rodata*) *(.srodata*) . = ALIGN(4); } =0x0000, iccm_code0_start = .; /* ICCM as VMA */ diff --git a/src/integration/test_suites/smoke_test_mldsa_edge/caliptra_isr.h b/src/integration/test_suites/smoke_test_mldsa_edge/caliptra_isr.h new file mode 100644 index 000000000..90daec8db --- /dev/null +++ b/src/integration/test_suites/smoke_test_mldsa_edge/caliptra_isr.h @@ -0,0 +1,120 @@ +// SPDX-License-Identifier: Apache-2.0 +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// --------------------------------------------------------------------- +// File: caliptra_isr.h +// Description: +// Provides function declarations for use by external test files, so +// that the ISR functionality may behave like a library. +// TODO: +// This header file includes inline function definitions for event and +// test specific interrupt service behavior, so it should be copied and +// modified for each test. +// --------------------------------------------------------------------- + +#ifndef CALIPTRA_ISR_H + #define CALIPTRA_ISR_H + +#define EN_ISR_PRINTS 1 + +#include "caliptra_defines.h" +#include +#include "printf.h" + +/* --------------- symbols/typedefs --------------- */ +typedef struct { + uint32_t doe_error; + uint32_t doe_notif; + uint32_t ecc_error; + uint32_t ecc_notif; + uint32_t hmac_error; + uint32_t hmac_notif; + uint32_t kv_error; + uint32_t kv_notif; + uint32_t sha512_error; + uint32_t sha512_notif; + uint32_t sha256_error; + uint32_t sha256_notif; + uint32_t soc_ifc_error; + uint32_t soc_ifc_notif; + uint32_t sha512_acc_error; + uint32_t sha512_acc_notif; + uint32_t mldsa_error; + uint32_t mldsa_notif; + uint32_t axi_dma_error; + uint32_t axi_dma_notif; +} caliptra_intr_received_s; //TODO: add mldsa intr +extern volatile caliptra_intr_received_s cptra_intr_rcv; + +////////////////////////////////////////////////////////////////////////////// +// Function Declarations +// + +// Performs all the CSR setup to configure and enable vectored external interrupts +void init_interrupts(void); + +// These inline functions are used to insert event-specific functionality into the +// otherwise generic ISR that gets laid down by the parameterized macro "nonstd_veer_isr" +inline void service_doe_error_intr() {return;} +inline void service_doe_notif_intr() {return; +} + +inline void service_ecc_error_intr() {return;} +inline void service_ecc_notif_intr() {return; +} + +inline void service_hmac_error_intr() {return;} +inline void service_hmac_notif_intr() {return; +} + +inline void service_kv_error_intr() {return;} +inline void service_kv_notif_intr() {return;} +inline void service_sha512_error_intr() {return;} +inline void service_sha512_notif_intr() {return; +} + +inline void service_sha256_error_intr() {return;} +inline void service_sha256_notif_intr() {return; +} + + +inline void service_soc_ifc_error_intr() {return; +} + +inline void service_soc_ifc_notif_intr () {return; +} + +inline void service_sha512_acc_error_intr() {return;} +inline void service_sha512_acc_notif_intr() {return; +} + +inline void service_mldsa_error_intr() {return;} +inline void service_mldsa_notif_intr() { + uint32_t * reg = (uint32_t *) (CLP_MLDSA_REG_INTR_BLOCK_RF_NOTIF_INTERNAL_INTR_R); + uint32_t sts = *reg; + /* Write 1 to Clear the pending interrupt */ + if (sts & MLDSA_REG_INTR_BLOCK_RF_NOTIF_INTERNAL_INTR_R_NOTIF_CMD_DONE_STS_MASK) { + *reg = MLDSA_REG_INTR_BLOCK_RF_NOTIF_INTERNAL_INTR_R_NOTIF_CMD_DONE_STS_MASK; + cptra_intr_rcv.mldsa_notif |= MLDSA_REG_INTR_BLOCK_RF_NOTIF_INTERNAL_INTR_R_NOTIF_CMD_DONE_STS_MASK; + } + if (sts == 0) { + VPRINTF(ERROR,"bad mldsa_notif_intr sts:%x\n", sts); + SEND_STDOUT_CTRL(0x1); + while(1); + } +} +inline void service_axi_dma_error_intr() {return;} +inline void service_axi_dma_notif_intr() {return;} + +#endif //CALIPTRA_ISR_H diff --git a/src/integration/test_suites/smoke_test_mldsa_edge/smoke_test_mldsa_edge.c b/src/integration/test_suites/smoke_test_mldsa_edge/smoke_test_mldsa_edge.c new file mode 100644 index 000000000..95b2875b5 --- /dev/null +++ b/src/integration/test_suites/smoke_test_mldsa_edge/smoke_test_mldsa_edge.c @@ -0,0 +1,635 @@ +// SPDX-License-Identifier: Apache-2.0 +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#include "caliptra_defines.h" +#include "caliptra_isr.h" +#include "riscv_hw_if.h" +#include "riscv-csr.h" +#include "printf.h" +#include "mldsa.h" + +volatile char* stdout = (char *)STDOUT; +volatile uint32_t intr_count = 0; +#ifdef CPT_VERBOSITY + enum printf_verbosity verbosity_g = CPT_VERBOSITY; +#else + enum printf_verbosity verbosity_g = LOW; +#endif + +volatile caliptra_intr_received_s cptra_intr_rcv = {0}; + + +// ALL TEST VECTORS IN BIG-ENDIAN PRESENTATION + +const uint32_t mldsa_msg[] = { +0xe188167d, 0x57d2657d, 0x20df4f23, 0x39a0d967, 0xd458b199, 0x5e79f3ea, 0x26d4c2c8, 0x87738f2b, +0xee512acd, 0xd39ee02d, 0xb38783d7, 0x3ea94ec3, 0x213fdc05, 0x7a4d5378, 0x952b4683, 0x1f9de5bc +}; + +const uint32_t mldsa_privkey[] = { +0x0f3ee295, 0xb6353b69, 0x88c43da8, 0x7cda1220, 0x504914ee, 0xa2e15609, 0x2dfc1600, 0x60c65e77, +0xf48fb27e, 0x7ca1412a, 0x87e3b948, 0x208c30d1, 0x6c3e6f16, 0xda0dbcad, 0x26f92ea4, 0xc6f7a15b, +0x55fa995b, 0x4e9bf174, 0x863e4b65, 0xa6ab1cce, 0xb8acd77d, 0xabe36bc5, 0x62367fdb, 0x95e85c63, +0xd87d883b, 0x66bac202, 0x7666b0f9, 0x7fcbb30f, 0xbf7e944e, 0x50f55eb5, 0x1b82b9fa, 0x5e5e2a1a, +0xc7d26284, 0xf6ddbb54, 0x1f75e058, 0xe5b991c0, 0x13cf70a0, 0xb1f2549c, 0x368575d3, 0xad984fa8, +0xc9443401, 0xbf916ef7, 0x9bbb688f, 0x159d3932, 0x7d24b1da, 0xf62b7472, 0x7cc00a5a, 0x03077068, +0x0b3afc25, 0x2ad6e342, 0x95e433fa, 0x8c1d36ef, 0xb147bc09, 0xe81a018b, 0x5bb284b7, 0x0e1ea1ff, +0x19eeeeef, 0x40c29e11, 0x0df4605d, 0x7df73ebe, 0x2878528e, 0xedd7fdd4, 0xf7929b02, 0x144abcd1, +0x24918f34, 0x5cb39e73, 0x29203eed, 0x48533054, 0xa9ccbb1c, 0xf9dccb67, 0x93a85d83, 0x3f9e721a, +0x66315278, 0xbbf6e998, 0xaa05f12b, 0x223c4467, 0x271176a6, 0xa215783a, 0x42f4c785, 0xd7820558, +0xe0c7d68f, 0xca59aea6, 0xce20c3af, 0x31e28948, 0x835de72e, 0x28e6fbf0, 0x911313a7, 0xeb4ed7b2, +0x88b337ec, 0xe9f9667b, 0x052ba3f7, 0x3976856c, 0xa4baa879, 0x014ee239, 0xc8760bc2, 0xc680bcb8, +0xdc3ae9e3, 0xb6911093, 0xf7877a3e, 0x806bad6e, 0xd3be41f0, 0xe93009fd, 0xcb14eb97, 0x3772467a, +0xe3b22b05, 0xebbb901e, 0xa8fb29e5, 0x24ab36b4, 0xae9d5a6d, 0x907b65be, 0x494bb583, 0x70d8c9e3, +0x35f8fa43, 0xa1368e4f, 0x3b63e1e8, 0x836edde4, 0xdf1d1133, 0x0443112a, 0xaf7b83ed, 0x41c5ffbb, +0x82f33438, 0xf05bbede, 0xe162d266, 0x950cad36, 0xf3b08115, 0x233314ef, 0xfa98b067, 0x38c84d6f, +0x24b2d8f4, 0x89972f98, 0x0ecabe9a, 0x9ccca54d, 0x9d3dc9e5, 0x78fc9ef6, 0xb24d8ec6, 0x042cb4f0, +0xead3d648, 0xcfbe8c80, 0x9bb8854e, 0xf6c1fc82, 0x8e096b32, 0x844b2549, 0xf9ef6d00, 0x74c025c9, +0x4ffed1c5, 0x78668b19, 0x22cc73f2, 0x931ed736, 0x41279f27, 0x01bf15c7, 0x84cc4433, 0x585b70f9, +0x47ee6c9d, 0x3fa439f4, 0x68fc7f38, 0x083f08e9, 0x05a4ec13, 0xc44e768b, 0x1d9da95b, 0xd21a5652, +0xbd426026, 0xf5b58cb5, 0x8dbd896c, 0x43729785, 0xda9d081d, 0x4333813b, 0xf9b8836b, 0x5ce9bb56, +0x87d9b519, 0xa0a1c350, 0x7e73f58a, 0x06213563, 0xdac1992f, 0x7bd130f6, 0x4557cbbe, 0x0f71b330, +0x3b2db67e, 0xc90d78eb, 0x45d24a34, 0xf4867133, 0xef707be8, 0xb8515134, 0x3add0896, 0x64ab21bc, +0xebd4ac94, 0xab109877, 0x17b19c1f, 0x968698bc, 0xab5337db, 0x646b244c, 0x6896700a, 0xb172637b, +0x273821f1, 0x7fb4b8ff, 0x054b2be9, 0xadf28dbf, 0x3b518b2a, 0x5e626d6d, 0x2107a1ba, 0x3c4c0683, +0xf4854b2e, 0x1b648947, 0xad1d0daf, 0xcd5cae9f, 0xe4dc191b, 0x416e7701, 0x230ed1e9, 0x75224fc3, +0x1ed90400, 0xac6d8fbc, 0x72157962, 0xb6818b72, 0xbe29cef4, 0x25f00504, 0xafe29034, 0x0de81a9c, +0xaa5988be, 0xffd678af, 0x28b2e89c, 0xddb94889, 0xad9d8f9b, 0x28c769ad, 0xec7e9ecc, 0x0d67c8d6, +0x47cdf8a1, 0x216c06c2, 0x2bce4742, 0x7f5aaf0b, 0x2be78516, 0x55bba409, 0x7af324c8, 0xfff6fa6a, +0x0fc721a0, 0x8bc5a521, 0x7883fefb, 0x71aed2ce, 0x6b3ff2e7, 0x23740efd, 0xb42f8a4e, 0x2c72eead, +0xc887c51c, 0x759d6efb, 0xb86899e5, 0xbec2dcf0, 0x6bd145dd, 0xa7f558da, 0x547a5833, 0xa1c22cf6, +0xaf3bc7b9, 0x2a441408, 0x54b54bf1, 0x648aac7b, 0x9c1ffdb5, 0xfba1c4a8, 0x9a207b9d, 0xae4267c5, +0x6cfa0ce0, 0x79f06baf, 0x4c98af79, 0x4d53be93, 0xf02bf271, 0xfb12fb7e, 0x34c82909, 0xe23173a4, +0x5ee071d2, 0xad6a7d9a, 0xaf69c935, 0x8544000c, 0x2d18183a, 0x53838a47, 0xf81b7511, 0x1693f993, +0x2fbbfe47, 0xc0e56f48, 0xe2938d3b, 0xd3637fb0, 0x8553a05d, 0x4eceb451, 0xee1f9759, 0x6a9a7402, +0xb885a2c1, 0x891b2161, 0x40ec7003, 0x51fdf049, 0xccc70493, 0x75658e66, 0x5ec197c6, 0xd864a1b8, +0xa7a05cea, 0xa93ab3db, 0x89e55a49, 0x8f3e42ab, 0xf4245762, 0xd05d8323, 0x54546a65, 0x24ada4a8, +0x5807a9ff, 0xf374f302, 0xa2ec2ae2, 0xc0c6b228, 0x235f54ef, 0xf9c8ae57, 0xfda96e36, 0x4d336e54, +0x2f4dae47, 0x5fac190f, 0xc2805a22, 0x4ba213b9, 0x98f73125, 0x63a22ea6, 0x7ef9c625, 0x9ead96c0, +0xd21065ef, 0xe072f104, 0x7047180a, 0x51f74aeb, 0x5b4ad409, 0x02d5c23c, 0xec95d719, 0x064e3c58, +0xe75be575, 0x7b75ff17, 0xb8c9bac8, 0x0c927a82, 0x1a90bdad, 0x2215ea04, 0x46e51017, 0xa3907041, +0x1e909b54, 0x048fe353, 0xd51be0a0, 0xcb9c3ed6, 0xd1c174eb, 0x6d58a066, 0x219f3e7e, 0xad91f183, +0x51937446, 0x0f40d7fa, 0x68df9c31, 0xf8fcde43, 0x92ead8af, 0xa4c84114, 0xe1f2f6b7, 0x2d11b13a, +0xdc208b6a, 0x057ec035, 0xcba29a8e, 0x1565d3ec, 0xe091d353, 0xb2f47bfa, 0xebd74aff, 0x81f1919d, +0x79593f9c, 0xdd710a80, 0x9eb10626, 0x123e27ee, 0x1429b7b7, 0xfe635c9f, 0x1b97365e, 0xf8ad5d8d, +0xd41e0388, 0x7c415f05, 0x3bd9f701, 0x1b1f0b98, 0xe450e657, 0x0408e9ca, 0x70641840, 0x962cea65, +0xc3691df5, 0xc664f4f3, 0x09da8f3d, 0x4ea6dca5, 0xcc0af50b, 0x81b8a495, 0x2e10bd3c, 0x16635d45, +0x1199821c, 0x3b8f675c, 0x2f831f7a, 0xa801b380, 0x10cacca5, 0xcdbe389c, 0x9726b447, 0x0f04b7a7, +0x3cc9f4da, 0x6f4ac1d5, 0xa316af9e, 0xc7bb1632, 0x2d487005, 0x485db684, 0xd8d28e76, 0x7c515fe5, +0x45f4241f, 0xc73ca95e, 0x44b743da, 0xed06cc14, 0x3f384f60, 0x95f5a555, 0x9976be18, 0x53b5451d, +0x88e247d8, 0x76394dfd, 0xa87be2c4, 0x49d41ff4, 0x160f5b82, 0xebff48fe, 0xc0cfc5c7, 0xedb503a2, +0x61c39e3b, 0x9576a6be, 0xc3080fa8, 0x0a9bdf4d, 0x17343f49, 0x3790db2c, 0x384277e7, 0x46b22c13, +0x6ffcd9f2, 0x8c507af6, 0x90d46ec9, 0xfa33fb03, 0x43c2c267, 0xa48e2bc4, 0x7f5bb57d, 0xb96bc12f, +0x00a9f035, 0xba7c9472, 0xa8868cd0, 0x44d68179, 0x16c65d38, 0x5ea07b1e, 0x54ab2710, 0x9a07dc85, +0xd164d728, 0x52fc90e4, 0xe11c0854, 0x87f45515, 0x49aa9c0f, 0x442e1c3e, 0x21b9be84, 0xfd871602, +0xcb322f3c, 0x118a3882, 0x0e4df271, 0xb89594d3, 0xe3cf62d4, 0x5c23e5a6, 0x01517bcf, 0x6b130948, +0xe88711d3, 0x3b63422c, 0x41ddac78, 0x20e2413f, 0x50bacf8c, 0x9c55ca48, 0x59270e58, 0x8414a1c7, +0x6786547d, 0x3077b381, 0x5a6c1e08, 0x5a37b0d8, 0xbd634938, 0xe6cc32d8, 0xedae5525, 0xcc114cbd, +0x6d8954c0, 0xce343db9, 0x3b147c5f, 0xc30d47e9, 0xcc3b1f39, 0xb05ade22, 0x74cc23a5, 0x8f03a833, +0x0b4a4d88, 0xecdc7c59, 0x2a4dce4d, 0xf216366a, 0x86072d82, 0x9ccf95f0, 0xa79984e7, 0xe4917518, +0xccd60db7, 0x798dc8eb, 0x31820227, 0x51c1b271, 0x212b61c4, 0x558d4287, 0xbf10deaf, 0x8ecf3c9d, +0x72a0e39c, 0xe39b1610, 0x5814f30e, 0x6752721e, 0xbdb12034, 0x51cb4b28, 0xc54287e6, 0x57486196, +0x2c129396, 0x7908398f, 0x7bcf5286, 0xe9e34994, 0x0275768e, 0x4bbb6868, 0x7cfab6f3, 0xb4104e83, +0xd582bdca, 0x89b9792c, 0x9437ad07, 0x77868e4a, 0x6d3d828a, 0x1f700f54, 0xfd59f978, 0x1ae0b1c0, +0xf0ac7062, 0x9f6dd3d3, 0xea8a1bdf, 0x435d2259, 0x621b6a51, 0xa9b31437, 0x345b9a85, 0x56b1bf1a, +0x64db6133, 0xe0599161, 0x8ea29a58, 0xe179fdb6, 0xd5531822, 0x1a8171a3, 0x7b0e7329, 0xe09d6ecd, +0xe948653a, 0x0ff24a02, 0xc47f4e39, 0xe31ad45b, 0xc7a9fd7a, 0x9bc9fbad, 0x0cdc99bc, 0x33d639ea, +0x026210fb, 0xfdfaae46, 0xf8035405, 0xccda142c, 0x216e9ef1, 0xf665503d, 0x0d4f59e2, 0xf290c9dd, +0xc0e9f0df, 0x83d8be1c, 0x175e9637, 0x22575e04, 0xe58a0556, 0x49368856, 0x2d6dc3b2, 0x33650296, +0x2f1b2244, 0xed92b994, 0x6d79bbf6, 0x977d0136, 0xe0026838, 0x6d9c62e1, 0x3416654b, 0xfd1981fd, +0x962b8d39, 0x460f5d7b, 0xd08c1fbf, 0x0b38cabd, 0x556b5472, 0xa9b96523, 0xc1808dfd, 0xca356312, +0x17997e78, 0x55a45463, 0x1d9bb2bb, 0x42465b6c, 0x2c864f3f, 0xca7d5ddc, 0x93f1a652, 0xadc6fc6b, +0x0c2bc884, 0x8c69c48e, 0xd6e28374, 0xe28d946f, 0x65bd8298, 0x3314e199, 0xa2d0736d, 0xcdb99aab, +0x3d7b14a3, 0x56531867, 0xf8312dcc, 0x7dea998b, 0xf91aab18, 0x70715cf5, 0x18ace1ae, 0x7c3a5cd9, +0xd1331077, 0x9854961e, 0x04370d2d, 0x650f438c, 0xf7ebf4e4, 0x7efd6c6a, 0x6e81e01f, 0xf078b589, +0x90b49248, 0x8c5a95d4, 0x53250123, 0x88b57c55, 0xa51a303e, 0x3acc7a47, 0x892e62bf, 0x6b1f4e1f, +0x8ef5a635, 0x58aba41d, 0xdf29d032, 0x9cf3674d, 0x9a794d8a, 0xa087aac9, 0x30ac25b4, 0xd28a2468, +0xc833d3ae, 0xda595343, 0x6819e522, 0xa5f3f625, 0x7ee0372a, 0x35df6567, 0x9b921b40, 0xf6e7f4c0, +0xa37c26f4, 0x2ecd066c, 0xd600b426, 0xa79cbfd1, 0x2e5f3a3e, 0x96466445, 0xa6106ad4, 0x0fe4c549, +0x301afedb, 0x5e1fa377, 0x9ba5a028, 0xf617df8a, 0x039fa988, 0x8da9a5ab, 0x991282a5, 0xcb7f21d6, +0x370c7d0a, 0x6f4b0048, 0x5ac3d802, 0x7fb7a5d4, 0xc3846cd1, 0x53746519, 0x3bf8198a, 0x1ae482f1, +0xe011a5f1, 0x9ede315c, 0x70c21870, 0x674fd8d7, 0x5c2ec8d7, 0x1fdacd0e, 0xa319a0b7, 0xbea5839d, +0x599b4e82, 0x529e02d1, 0x67672884, 0xdf5073f1, 0x6bfdb394, 0x883f01e0, 0xd3f63b5e, 0x976c5886, +0xfc64f3ed, 0xc0faa6ff, 0x0c2c249a, 0x9980abc3, 0xe1525328, 0xc85c5253, 0x313c7b33, 0x3b24e68d, +0xbc7dd71b, 0x8b9d53b5, 0x2d15ff48, 0xfb5f18f5, 0x6d598d97, 0x6e36158a, 0xf26328b7, 0x3dec7c6f, +0x332ef1f7, 0xe99b023a, 0x9ecacf23, 0x12553a99, 0xa2ae9f72, 0x6a27f39f, 0xf2fbdf26, 0x2ef3fa0a, +0x5a096794, 0xbc626ea4, 0x175b9c77, 0xafed54df, 0x873b0e85, 0x481e2afa, 0xaaa1a45d, 0xad8440f9, +0x03596de6, 0xe1934281, 0x84120747, 0xfde3cf0c, 0xa7c52bbb, 0x92bd525e, 0x6b4008e0, 0x260c9332, +0xe2d6259c, 0x21fbb062, 0x9145caff, 0x2ab90b6e, 0x6d57191f, 0x806cfcb6, 0x43847459, 0x65264043, +0x6fb3b580, 0xe1e95bc1, 0xb7f52423, 0xcd56285f, 0xad14de29, 0x41a9edb2, 0xa85759ac, 0xced3559f, +0x8bb6ec4d, 0x8d70bc1b, 0x08245784, 0x7e650691, 0xa65b2dd6, 0xa239a180, 0x23cadf4f, 0x14588ea5, +0xb10dc77e, 0x91cf3c48, 0xbb389534, 0x96d5b8cf, 0xc693d552, 0x8be8f467, 0xd3969719, 0x88c528dd, +0xe0c7ba58, 0x24eeecfd, 0xecf8f9cb, 0x25eb9112, 0x855cc760, 0xe2b3fc7f, 0x95ad0944, 0xba06c915, +0xdadeea0f, 0x3e5c7b02, 0x2d718095, 0xafaf9d04, 0xd8b8b479, 0x5de5ec07, 0x8a24c563, 0xf23942a1, +0x1a70cea0, 0x6fe1a3b5, 0x014eeed0, 0x159cbaab, 0x6282cbb6, 0x5d821b6c, 0x0e39db07, 0x0cc9b4e5, +0x69abb9a4, 0x308284d3, 0x46ff1fa3, 0x87d95a9d, 0x365c4c18, 0xc60c08e6, 0x2ccaa9e8, 0xe3930bf2, +0x8f5851ed, 0x67c0ea05, 0xd46af85d, 0x3ccff9e5, 0x2d7d8d4d, 0x7a50c338, 0x93ff8230, 0xc97d14c7, +0xcb3abd0f, 0x350be342, 0x53c9b1ce, 0x903ec08c, 0xfd309a03, 0x7d972385, 0xdce13a54, 0xa916627e, +0x36851d90, 0xfbf528ec, 0x1df93631, 0xb1af6c65, 0x27821560, 0x1b590e31, 0x56caaaa9, 0x8c0d64af, +0x4be47ec5, 0x36fd0707, 0x4845da99, 0xcae54648, 0xbbd570b1, 0x1925e812, 0xfb71fe92, 0x928eb4fe, +0x3bc1e216, 0x4a4798cf, 0x0dbf163c, 0x2a1f33b2, 0x892562a8, 0x8fb085fe, 0x3c62d03f, 0x7918e6e7, +0x0b407d93, 0x8915ca49, 0x0167ffe5, 0x51931d50, 0x2b1f72e4, 0xd569847a, 0x9daa53fc, 0xb0f99168, +0x96155912, 0x04f80550, 0x9082b1c0, 0xb447f675, 0x3f2a8312, 0xaff611ee, 0xa89136f0, 0xc559c877, +0xcfecb2f1, 0x0129b28d, 0x23496e1a, 0x58b8fa48, 0x94049035, 0x8fc6efc1, 0x7bc0d453, 0x647d4838, +0x2dc04050, 0xb6193020, 0xca5214a1, 0x2024020e, 0x44cb91a0, 0x2329169c, 0x81b28848, 0xa2c38436, +0xda0594d2, 0x11191c46, 0x26103132, 0xa06a1258, 0x6996c169, 0x071280a8, 0x238cc291, 0x00c20850, +0x288371c9, 0x2228325a, 0x60b85900, 0xa5126994, 0xdc688208, 0x48a81b28, 0xc2984583, 0x082d3601, +0x21352489, 0x46e35186, 0x8b8e1260, 0x80062091, 0xa2138e14, 0x146916dc, 0x71c64b81, 0xc8c400a4, +0x1180b614, 0x2035112d, 0x08838d28, 0xa34a26a4, 0x0ca65364, 0x360389a6, 0x5c2dc059, 0x44b06266, +0x010949a8, 0xdb2c28d0, 0x81440268, 0xc3248dc0, 0x1c2104d9, 0x09270c6e, 0x064b6900, 0xa2418894, +0x84b8644d, 0xa6d28a07, 0x012a2681, 0x8d26608d, 0xa84c0d46, 0x6271c88b, 0x2db31304, 0x911924a8, +0xd22514e0, 0x0998136e, 0x12644245, 0x000408cb, 0x0c35232c, 0x271a6145, 0x024436d9, 0x2dc90b02, +0x23032da8, 0x1a08c0d8, 0x3090cb11, 0xb82141a6, 0x1369c252, 0x05c50a2d, 0x38132194, 0x1c12349c, +0x50a30401, 0x42a04421, 0x11024009, 0x4546e029, 0xa91204b3, 0x1900c891, 0x2d10e272, 0x40d04996, +0x8b012121, 0x42370368, 0x84490842, 0x1031448b, 0x71030365, 0xa6437030, 0xa0620860, 0x60b11400, +0x465a50b8, 0xe0820082, 0x2da0d38c, 0x02587139, 0x018c3283, 0x85a01292, 0x325b6992, 0x2080029a, +0x00204a29, 0x029b8201, 0x190622d4, 0x90a91a05, 0x48012842, 0x4c2e3813, 0x48889a4a, 0x44930422, +0x817198d0, 0x31b85c49, 0xa0802115, 0x086dc119, 0x6026c46e, 0x44210642, 0xc309a320, 0x51269231, +0x98c00048, 0xc485a6c0, 0x6ca24c4e, 0x46888938, 0xc22d00e2, 0x92192020, 0xa4c36d02, 0x0c880400, +0x2a30008c, 0x06927216, 0x9a8a4098, 0x2180d90e, 0x08886d36, 0xa0114440, 0x05964c90, 0x48516e22, +0x64641624, 0x6440c350, 0x20817124, 0x8b118009, 0x4cb60c85, 0x401c7200, 0x08123210, 0x5206e400, +0xa0427239, 0x228c305c, 0x4c46e208, 0x82d46e11, 0x23892093, 0x60000241, 0x08d42500, 0x08518923, +0x62191330, 0x990a8a00, 0x828c9642, 0x8ca29b2e, 0x461a5048, 0x5c40c058, 0x6db50221, 0x90916da8, +0x5a293054, 0x6c460a01, 0x81011038, 0x894c4900, 0x4516146e, 0x024a2d94, 0x0810350c, 0x9040530d, +0x88e38444, 0x5b88a2c4, 0x2dc48361, 0x961431c2, 0x5851070a, 0x48204b26, 0x26d11211, 0x228c0694, +0x30a40b0c, 0xa88c6512, 0x030614ca, 0x50c0d070, 0x050424a4, 0x032108ca, 0x0a209001, 0x40616618, +0x520414e4, 0x51284b92, 0x460825a0, 0x8a62481c, 0x9206da01, 0x01184835, 0x1004a6cb, 0x44a49a44, +0x290811c0, 0x9949848b, 0x0a05226a, 0x045945c4, 0xa26d160c, 0x8c065382, 0x48928623, 0x14298862, +0x40b08304, 0x33184124, 0x9340c488, 0x00444325, 0xc8d98036, 0x8a6c1851, 0x30b45921, 0xc8900e26, +0xcb8430c2, 0x0ca51390, 0x08a24841, 0x04709649, 0x26429310, 0x14db6820, 0x5c4c0111, 0x90c2e208, +0xb0987208, 0xe08e1223, 0x60390006, 0x46996024, 0x994102e1, 0x6636da88, 0xa0c460c0, 0xd32d929b, +0x2506cb20, 0xc48a8c94, 0xdb40b6c4, 0x80332465, 0x22434490, 0x902a2804, 0x71909161, 0x88106225, +0x112248d3, 0x85b48370, 0x09098c83, 0x03459262, 0x8d90d850, 0x008a41b8, 0x1c400654, 0x51032201, +0x825c8db6, 0x222e00db, 0x40345960, 0x32217197, 0x1449a600, 0x49389a48, 0xa7017095, 0x0005b05b, +0x6e44d289, 0x40804444, 0xa16190e0, 0x44471b65, 0x36d36930, 0x188ca503, 0x22150304, 0xa8e44cc8, +0x884a14d8, 0x61941061, 0x452445b1, 0x184c04c3, 0x89322080, 0x19140235, 0x1c693823, 0x0e452262, +0x36940e10, 0x22502860, 0x2834cc0d, 0x02904e48, 0xe28e3108, 0x0cb2dc80, 0x30922d31, 0x1285164b, +0x2c84d464, 0x40516511, 0x00259059, 0x04b09824, 0x820320c4, 0xda45329c, 0x8430c211, 0xb1095043, +0x19263303, 0x2a32a289, 0x24c46596, 0x6441a0d8, 0x40391190, 0x905b2d92, 0xc30984e1, 0x09b61c04, +0x129c8592, 0x0152325c, 0x4838a325, 0xb7236618, 0x5020c6db, 0x0816da24, 0x94423146, 0xdb4d2894, +0x6cc52208, 0x34c10c36, 0x0851b0a3, 0x10290340, 0x800a2c26, 0xda243214, 0x46484928, 0x86e10882, +0x904d8862, 0x61b08189, 0x99142148, 0xa38a0800, 0x91210010, 0x971b8514, 0x8c28820a, 0x81172384, +0x90092004, 0x01208448, 0x8c425941, 0x00108a20, 0x64921908, 0x24101884, 0x32a25202, 0x0c493094, +0x8544432c, 0xb24989c8, 0xa26d405b, 0x65821b0d, 0x88e388c8, 0x1c448884, 0x4546218e, 0x02980d00, +0x53490664, 0x4cc8140a, 0x34e38935, 0x0c263082, 0x29401a05, 0x065a01c1, 0x03204902, 0x49288206, +0x01201198, 0xa4601083, 0x4840d890, 0x360a6582, 0x1b8ca25b, 0x0481228d, 0x82a001b2, 0x928d3460, +0x8ca2c269, 0xb6ca20b8, 0x517094e1, 0x62371320, 0xa0db61b7, 0x02889222, 0x60172390, 0x82801011, +0x0491a701, 0x2e191145, 0xa8c024a8, 0x50412452, 0x0404db0c, 0x88200d88, 0x634d9120, 0x2d185968, +0x97201126, 0xa12c3603, 0x1222e40c, 0xa6010810, 0x5105c804, 0x11190248, 0x23198510, 0xe24842a1, +0x5ae71b29, 0x7fb65ce6, 0xcf0cd7bb, 0x63aa010a, 0xec96cae6, 0x3a1c3dcd, 0x50429a70, 0x9899d1ec, +0xba16f9dd, 0x71bec659, 0x6be39833, 0xce2b1799, 0x34b77163, 0xfe4e9ffd, 0x46386cb0, 0xd39d867d, +0x9feed9fb, 0x268c357f, 0x8e27fd49, 0x6264c03c, 0xbcc8fb62, 0xcf92d11b, 0x333e6b27, 0xa9e8cfd2, +0x9c03d6b5, 0x2637a27a, 0x00ed3350, 0xe8c83e88, 0x27f25a42, 0x858ad455, 0x02329622, 0x30e4e7b4 +}; + +const uint32_t mldsa_seed[] = { +0x647a738e, 0x73d0de08, 0x6a36a929, 0x38dc1336, 0xb83ea6ed, 0x51c867aa, 0xc620174c, 0x6a4e7221 +}; + +const uint32_t mldsa_sign_rnd[] = { //deterministic signature +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000, +0x00000000 +}; + +const uint32_t mldsa_sign[] = { +0x003b352c, 0x231b1411, 0x0b000000, 0x00000000, 0x00000000, 0x00000000, 0x00d89486, 0x6f6216ff, +0xe6dfa28f, 0x7e544238, 0xf7f1daa8, 0x9f857321, 0x1af3ecb3, 0x855f2811, 0x0bc7bba9, 0x8a371d1a, +0xc86829e0, 0xd6cdad59, 0x58e5e4c1, 0xb28d703c, 0x2c271101, 0x7004b77d, 0x793c9c98, 0x7a234644, +0x7a8cffa1, 0x9eb47c9c, 0xf2a0121c, 0x3dd3d5ce, 0x84b6a7cb, 0x0f6d4601, 0xbc761f26, 0xa84e274f, +0x482a4264, 0xf38b5ba1, 0x3d83a61a, 0x6d8ed184, 0xd60fac3e, 0xac6abca6, 0xbb29c619, 0x81bdff7e, +0xd097fa4c, 0xea1fa3fb, 0x9b7aeb48, 0xc9d59d7a, 0xb28499ac, 0x9934c451, 0xb0215186, 0x86439096, +0x7183c17b, 0x07b79c50, 0xedf29eb5, 0x7432b8ca, 0xdd050ff5, 0xa636eb91, 0xc6854005, 0xf5427b6f, +0x2134f56a, 0xbaec6baa, 0xff1e342f, 0x5e84b10a, 0x989d55d4, 0xfc43d0e8, 0xd85c1936, 0x29b2e193, +0xde8efa51, 0x6d05a44a, 0x100f54c7, 0xee2c1622, 0xb333917d, 0x1f377792, 0xa7bfdf80, 0x6a996a95, +0x666d247a, 0x32a7b530, 0xfff27a4f, 0xc7281f42, 0xfd17be5f, 0x6baeb1fc, 0xdee42eb6, 0xc53709fd, +0x1fc6d775, 0x3382afca, 0x0b57ae13, 0xc9cbe1d8, 0x07881ce3, 0x8fc04570, 0x750b074c, 0xda2560ff, +0xf6f53d55, 0xb6b176da, 0xd0eabe0e, 0x8c4bee15, 0x8f12759b, 0x733fab34, 0x6a6dba3c, 0x77761155, +0xe907c12a, 0x9059c3eb, 0xb89d636c, 0xbc264f1f, 0x8506700f, 0xf03203a6, 0xda376ccc, 0x7f19d041, +0xd1dec011, 0xec989ca3, 0x41c4d45b, 0x0a43e2cb, 0x16fac47d, 0x44a858f2, 0x7823dd7f, 0xf3564ae7, +0x9f734501, 0x8d137d08, 0xe670173f, 0xabf1f866, 0xa41d140c, 0x1852a6a9, 0x6a1a18a6, 0xccdf823d, +0xd4257617, 0x0b166303, 0x28ed2fd9, 0x5662492c, 0xa4a63734, 0xf73cc878, 0x3d2fe3d3, 0x87768a9a, +0xfa3af1f0, 0x70de997b, 0x0efdd53a, 0xf9ade3f1, 0xd579285f, 0xc7e73a7a, 0x483f8806, 0x1827d1cb, +0x438880ef, 0xb3440077, 0x1687bbd4, 0x0ae340c0, 0x728267d9, 0x1b0b7478, 0xc9e2ba0f, 0xcc863b1d, +0x6f1bde85, 0xc2c30bcb, 0x3a98e9e5, 0x83c81d16, 0x37c294bb, 0x084c2162, 0x6a7d6514, 0x907ad255, +0x059e19a3, 0xb2f70a63, 0xc1edb0c1, 0xc159ecc4, 0xd09ce783, 0x5d5418c4, 0xf6bc7fe4, 0x5ac92c8b, +0xe28f9029, 0xf93d15cb, 0x33fa6ebf, 0xa00da684, 0x0c82fa50, 0x03ce47ac, 0xe52422e8, 0x83728971, +0x4aeb4f2a, 0xafb7a994, 0x2d95a7e3, 0x01354557, 0x9389a0cc, 0x1e103cc3, 0xb43c9246, 0x6422cceb, +0x9aa7405d, 0x6dc45750, 0xe07b9842, 0xeb5be601, 0xafb922fb, 0xe7d02118, 0x1dbf75f2, 0xb207017d, +0x76ad5160, 0x1d6d01ef, 0x4bc1e80c, 0xf7cfa84a, 0x9a9342e2, 0xba289997, 0x06828987, 0xe9533333, +0x6202b7e1, 0x987465b7, 0xd6e4c4f0, 0xb528ebf5, 0xcc1ad06d, 0xc1cabc01, 0x880a8463, 0x44a2d4fc, +0xfefc4cb4, 0xee5632fa, 0xa9417ad5, 0x61541ddf, 0x5a6b89b8, 0x0350a4b0, 0x5ec70521, 0xa5194a6d, +0xfd44d3b4, 0xc3a794e1, 0xf725b070, 0x60b9102e, 0xa980121f, 0x795ba26f, 0x2545bd48, 0x894846eb, +0xfc522592, 0xbba1bf4f, 0xcee2110e, 0x9e99278d, 0x4117b70d, 0x6922f80a, 0x2a0781e0, 0xb6d5f715, +0x659d5b60, 0xb82929aa, 0x83ac5666, 0x834c0244, 0xe6b6e27e, 0xdffc6dd0, 0x90acc235, 0x386404bb, +0x1718b09d, 0x8e2cc400, 0x63cfd10f, 0x6855adaf, 0xce967ee7, 0x429c2416, 0x8db968ba, 0x75180b0f, +0x8830321e, 0xa454af0c, 0xba964c0d, 0xf39e05bd, 0xae0b8b84, 0x20625c03, 0xe6c5f73b, 0x9604978e, +0x9adccadd, 0x9507eafb, 0x6a190eb7, 0x0b576573, 0x2548961e, 0xc03580ff, 0xdbaf4d0f, 0x07f26fb1, +0xd29fed54, 0x67b4bc53, 0x00b1ab32, 0x40b94b0a, 0x52b63ef8, 0xf050c37c, 0x0d742070, 0x7e55f4d7, +0x3b8e6d4f, 0x3c701333, 0xf199e111, 0x9697c618, 0x9a74ee16, 0x0784cd3d, 0xcfacb3cf, 0x43afd45b, +0x271e82cd, 0x33b5a889, 0x7224e77f, 0x7d1f458b, 0x9c9c3b9d, 0x1aeb25d0, 0x9e6e8da5, 0x5cd4eb6d, +0x91c5640b, 0x01484dc0, 0xb59ea559, 0x574af313, 0xb0efba4a, 0xfbffbd99, 0x942ae12d, 0x7e2d7770, +0x8c6be9be, 0x59a94cd3, 0xc3ee7d21, 0x170b630d, 0x3a53eeb9, 0x5db4f81b, 0x0c997c5b, 0xf66ca5af, +0x6aa1a220, 0x8719b09c, 0x4b67f9d0, 0x8b3d6bfe, 0x584d997c, 0x82e90151, 0x31df34d7, 0xc3580821, +0xe99756ef, 0x4964e44d, 0xa0e65e41, 0xf9044c2e, 0x87d7a363, 0x2608e42a, 0x976c635f, 0x0ed4447d, +0xde49a430, 0x7c32acfb, 0x4daa7a43, 0xe7b6a0d8, 0x3245cd86, 0x70345442, 0xd6ee32d5, 0x85f50c5d, +0x54855aed, 0x1a5b8097, 0x617cae2b, 0x4a3756fc, 0x53f32c3e, 0x69a45843, 0xaec81ad8, 0x31415ef5, +0x845d3917, 0x3822a824, 0x954f3eb0, 0xe0169d0a, 0x3ef1bad0, 0x4b156504, 0x5191b072, 0xd098d2b5, +0x8ab7e2e9, 0xcad4a104, 0x69a352cb, 0xd5b38490, 0xd650d5b2, 0xeeafc1fe, 0xcc387050, 0x3e367cd8, +0x89b5fc5b, 0x734dd7f7, 0x15017b06, 0x4e9a41ec, 0xcd319849, 0xdef87ab6, 0x7b203aba, 0x838271c9, +0x39768969, 0x2c99c3ba, 0x0899ae82, 0xcdbab863, 0xdb15afdc, 0x0b23df36, 0x516d3a72, 0xe0e71212, +0xf2697588, 0x65822ca7, 0x73befec3, 0xd2534584, 0x4c386a41, 0x745f92d6, 0xc84f4246, 0x14451055, +0x83d9b0cd, 0x0de99d4d, 0xd0b41cc2, 0x55f03602, 0x62668b8e, 0x47080265, 0x2564fc38, 0xdabd0832, +0x9c2ff561, 0xa2b713ed, 0xf98e46ac, 0xceba30bf, 0x5cdb61c9, 0x284b30c5, 0x21cf7f23, 0x647df7e9, +0x7f395453, 0xcc038f53, 0x891012a3, 0x1c9c92ef, 0x8a971713, 0x02a0f90c, 0x5feb1ae1, 0x6d9fed43, +0x19906d99, 0xfa1b0402, 0x3a685fa4, 0xb553163d, 0x94850cb3, 0xcc560cca, 0xa4970563, 0x4a9027c1, +0xd958fe65, 0xb8925342, 0x3a2c3eb2, 0xa443639d, 0x3bc6777e, 0xfb62cc4d, 0xc628953e, 0xcc999110, +0xa3bc49cc, 0x9cf3f838, 0x91161031, 0x52c26902, 0xf8aa4425, 0xa5e4fd81, 0xad946cd0, 0xd1757828, +0xbab9e879, 0x319725ce, 0xef8f33b8, 0xb1585eb2, 0x2de8e4af, 0x17423316, 0x4d827a91, 0x1a4e394f, +0x7fd6dd7b, 0xa20e2678, 0x93a92b4c, 0x31a8ff4f, 0x387ffd41, 0x27ea70a3, 0xf1bc8cf4, 0xa9e8c0d5, +0x04236c49, 0xb7701c16, 0xef1ebce4, 0x5a22feca, 0xbdbdb464, 0x28c238cd, 0xc2f00a48, 0xa3d99cc7, +0xdac521ad, 0x99c3decc, 0x085e9f77, 0xb3947156, 0x8e0c2778, 0x5504724e, 0x7401d2b2, 0x5a54d9a5, +0x437b549f, 0x1df5acce, 0xd8ed1e8e, 0xf0c3f668, 0x393da963, 0x2a3a2736, 0x3340ec2a, 0x480dcdad, +0x2c59090c, 0x6180c416, 0x1c16b0ff, 0x8b7bb743, 0x6dea2f00, 0x394e3b9a, 0x00f5fb21, 0x1c64ff8d, +0x143eb825, 0xa579128a, 0x92464e60, 0x02ce5608, 0xc259d565, 0x2cf054be, 0x32c91111, 0x18e07b8d, +0x93a591ef, 0x7fdb4242, 0xf3966e16, 0x88d7b149, 0x8ead7984, 0x06ce4155, 0x188fd4e9, 0x832f0860, +0xac58c102, 0x12e1e1db, 0x7b573184, 0x2e696198, 0x195ba025, 0xcd677ae5, 0x458b7b3a, 0x61a7916c, +0xaef54d5a, 0x0bda1856, 0xbd0994f9, 0x92f6f2cc, 0x801afe71, 0xb7499bd8, 0xecd337d3, 0x02087bcc, +0x2596b4cb, 0x39fcb478, 0xe570b3bd, 0x1b9a603b, 0xb7f59fb5, 0xc6182791, 0x275c0ef2, 0x64fc4767, +0x23235371, 0xaa4a16af, 0xea99c8c9, 0xa9cd5de8, 0xb63c278c, 0x5bc5eb2c, 0x712aca54, 0x64d462e9, +0x9658c3d3, 0xf0cc34ab, 0x8d348166, 0x3d558de9, 0xd63da300, 0x48b3dc35, 0x5e6da23e, 0x445a9eeb, +0xb733648c, 0x1efb2df1, 0x60378fd5, 0x00cfd72e, 0xf48e0598, 0xd1410117, 0xc9e7829d, 0xe0c1464d, +0xaccb355d, 0x44957d1c, 0x0a4c16ee, 0xa3511bc3, 0xd48fdf6c, 0xaa1aa1b8, 0x85ccd141, 0xa6e4de89, +0xad1051b4, 0x15d8811d, 0x8daa0d09, 0x62ccd4de, 0xe3dd6113, 0x4b489390, 0x5bd3f432, 0xdb5e55f7, +0xebec5669, 0x7f1803d2, 0x9914e7dd, 0xd9faf211, 0x2e33c64d, 0xb4c2eb37, 0x83aebae5, 0xca2eea82, +0xadb01dde, 0xbda4e9f2, 0x7016a018, 0x50ec60a3, 0xa4bd7721, 0x1e1a29fb, 0xa9e14f74, 0xdd1f367f, +0xfd209246, 0x8a43f9ad, 0x72a2e84f, 0xff7161ac, 0x500d6b5b, 0x8f40c572, 0x71066cb4, 0x49ef5426, +0xc182ee6a, 0xa67f5831, 0x0a9f23e3, 0x29a12356, 0x51ae9653, 0xc1095698, 0xf205b2a9, 0x3fae8a6f, +0xf3919d2e, 0xf8f511c6, 0x562b8b72, 0x1be671bf, 0xc66ccdcd, 0xf70d1889, 0xfeffa076, 0xd35a7302, +0xfdf73676, 0x4116d9e4, 0x69d8207e, 0x526e4925, 0x39e642b2, 0x88de09b6, 0x73c97872, 0xc1289155, +0x0167a5c6, 0x0060fad5, 0x577e5e6f, 0xf104608b, 0x5fba0d9c, 0x9db92bac, 0x95bdac20, 0x746a384f, +0x2c9b9fcd, 0x9206357a, 0x8aa077e6, 0x0f59a686, 0x5115d507, 0x094065e1, 0x9e5f3932, 0xdaf89af3, +0xbbf9c4d4, 0x97eb3ee5, 0x0a52633c, 0xb99a2840, 0xdb26062b, 0x76674a1c, 0xed511b0e, 0x2765ca54, +0x84112286, 0xeadae698, 0xfb64383e, 0xf1d877d5, 0x18859fca, 0x00d38119, 0xa305bc4b, 0x60565360, +0x1b002b1a, 0xace986a8, 0x71e53a2e, 0x1c4b522f, 0xcb341bbc, 0x44f81d37, 0xa06ef08d, 0x182af467, +0xdd6a116d, 0xfcd3fd75, 0xe0f98bdd, 0x50e91aa6, 0x209525e0, 0x2bf8be6e, 0x8fffac7d, 0x97e63810, +0xbd0aa67d, 0x9638b696, 0xd33fc764, 0xea61646e, 0x7281317f, 0x02cf4984, 0x97282659, 0x530fb6e5, +0xb7dc296a, 0xeca39375, 0xc42f26d3, 0xf3a83574, 0xf22b6495, 0xd4475f40, 0x7bc35ef4, 0x75ce7700, +0xe5b0ccea, 0xfaf6ec86, 0xb5795b18, 0x2ab81383, 0x1f97ed57, 0xee8027c6, 0x11bc35b0, 0xb86d41ca, +0x9d3f1c90, 0x3e670d3a, 0xb58df82a, 0x2049e09e, 0x0484017d, 0xea7429d1, 0xfde319e7, 0xc913e275, +0xc5bd4a84, 0xfec274c0, 0xaf73be84, 0xa5e654b8, 0xe1a7cb0f, 0x53c9cf3d, 0x6a89a64d, 0x4e2378f6, +0x925fdaec, 0xbdf5c6ca, 0x78825545, 0x251f261c, 0x8e033af7, 0x8eff5cbe, 0xb838d579, 0x34f1631f, +0xcc2726ee, 0x56ef91b9, 0x63bd002a, 0x8cb836aa, 0x85035814, 0x4fccb759, 0x09ee5867, 0x1e254a9d, +0x2db60429, 0xa5640c35, 0x234cf143, 0xfabd1a6a, 0x870f7148, 0x74428fc9, 0x9982db07, 0xb4a14929, +0x0b8b5fbe, 0x985f2938, 0x443f2207, 0xdab2cb0a, 0x6c584bb1, 0x1ec31ed4, 0xabe87567, 0x8f461132, +0x6beb3f82, 0x7ef8f6e3, 0xce284e77, 0xf4d512ee, 0x32528ee4, 0xc797e82c, 0x0fbb42c5, 0xfa8bd397, +0x6afabef0, 0xf92d8b91, 0x3251f621, 0xf5964460, 0x8260f8a8, 0x33729938, 0x4c5db542, 0x754d5e89, +0x7d830e86, 0xa0916a08, 0x7cc24c23, 0xa08dd89f, 0x6f92fb97, 0x8e4aadcb, 0x925aa71b, 0x2b713adf, +0x5365bf32, 0x0c110466, 0x2067a8f5, 0xac25e894, 0x95b84f86, 0xb6531b62, 0xc86da6e1, 0x6d092e02, +0x3eff7f7a, 0xf20c8c59, 0x839127dd, 0x416fad82, 0xc4a34ded, 0x9327900d, 0x6407ee29, 0xbe4bd1ca, +0xbc68f6c3, 0x4757be73, 0xc1e318cc, 0xaaaf6037, 0x33f18e99, 0x20b08b9b, 0x03000df8, 0x354b562a, +0x8e4f9aaf, 0x7c272ad2, 0x4b5ba6c1, 0x2128576a, 0x2730c84d, 0xed2cc283, 0x6532b272, 0xb198a92a, +0x062b40b7, 0x07e2b7c3, 0xe607cc37, 0x7c140a83, 0x0a97791e, 0xdc945de2, 0x3b6c4fa2, 0xa901c12b, +0x37768e66, 0xfa422994, 0xe4ab8a62, 0x7b69cd6e, 0x1494705e, 0x5385793b, 0x64edd35f, 0xb29eadf3, +0xecef8a02, 0xf79296d5, 0xe3190f12, 0x6c21eecf, 0x80407c55, 0x01f367bf, 0x35328d4e, 0xe562dbe2, +0x6fe15ba1, 0xf1a59609, 0x8a88f56f, 0x7c4a4c1c, 0x8e742a18, 0x4905e862, 0x145c0445, 0x41848cac, +0xfbe30e8a, 0xfb789582, 0x1c6718aa, 0xca2fb95f, 0xbc00cde4, 0xccbbca04, 0x9aa1d9d9, 0x57b86bb1, +0x2724ae79, 0x12feb183, 0x1ebb44fa, 0x2c88c99c, 0x52714c6d, 0x5578cac9, 0x34d5c539, 0x2ba40890, +0x697aa706, 0xc30688f7, 0xa3768da1, 0x800f8f28, 0xafc2f150, 0x9a31bd69, 0x4b50d99b, 0x3aa5bea8, +0xcb894272, 0x073fefe8, 0x34389877, 0x96705b88, 0x069ed81f, 0xd393a2d3, 0x0020af8c, 0xcfbeed8b, +0x0193fe7f, 0x84cdc9b5, 0x5d933b2f, 0x0c15bb92, 0xcda1c2ae, 0xe0bffa81, 0xc1e7c14d, 0x12911fbf, +0x5efd6f28, 0x268ad7ba, 0x2c4cffce, 0x28084f28, 0x934ec897, 0xa1a4dec2, 0x92efbebb, 0x1bdd6b94, +0xaf75968f, 0x1ce321f3, 0x333a914a, 0xc12710fa, 0xdc3fa1d0, 0xde1c8b2b, 0xcd9279d1, 0xc4e6a538, +0x6e32bfbd, 0x7f525918, 0xbd6d00c2, 0xc3ba2c07, 0x664221d8, 0x7e3992d4, 0xf938a910, 0x32d99bc9, +0x3bba6093, 0x5140b8f2, 0xf23e8e31, 0xb394b20e, 0x3cc08878, 0x672997df, 0x18af3573, 0x9178886f, +0x119fe005, 0x1eec122d, 0xecccf8d5, 0xb849b204, 0x76382be4, 0xa021450f, 0x6372c657, 0xcde8b9ba, +0x25126ec9, 0x2b55bcfc, 0x198376c1, 0x2d8f3400, 0x01d40e5d, 0x293b5d37, 0xe82df4b7, 0x0b12f8ab, +0x3a53f344, 0xb558f36e, 0xafc29847, 0x4a5fbd0f, 0x6782c03f, 0xb900e340, 0xcea87a44, 0x18b2ebe2, +0x5b000d24, 0x207eca24, 0xed712f49, 0x22709f50, 0x986f7b6f, 0x09a020b8, 0x8a787bf8, 0xa10ad4e5, +0x017585ba, 0x16dfe9e0, 0x2f42cb51, 0x6e87456a, 0x0938e9ff, 0x91d1f6e2, 0x2d0c1fde, 0xf2b664b8, +0xb1bc5a0e, 0xf63de86f, 0x3d21f394, 0xac1f3ae5, 0x3757f80f, 0xec7781c2, 0x3546ead9, 0x696a01f5, +0x47ecde1a, 0x38fd46bf, 0x1126daa7, 0xa0273c7a, 0xe00b3f4e, 0x21d7d2fe, 0x2bf387a4, 0x5fb9fb9a, +0x8c3a707a, 0x15c2dd70, 0x93b72d87, 0xdcf9a2d7, 0x99e7ed2a, 0x7b9c914c, 0xf52b3892, 0xdbdddf50, +0x3632be94, 0x49e3b8d3, 0xd4309521, 0xb4403151, 0x563350ca, 0x1cb78768, 0x3bedd7b2, 0xfb0196be, +0x2d213594, 0x8b486d8f, 0xdd0ba0e9, 0xcf34e966, 0xe4b8646f, 0x9751b67a, 0x80293112, 0x2b28d0cc, +0x3c9b8f34, 0x1cf79da5, 0xdeb99dfb, 0xab6e8e63, 0xecd4d576, 0xb0a2a870, 0x9d425b5b, 0x5ebb34f1, +0x6a79b346, 0xfa56750a, 0xcf61ba82, 0x73ebec7c, 0xf36431ec, 0xe115b4a8, 0x25627d54, 0xe7f46c81, +0xb4672ca8, 0x0d654217, 0x7353ca0b, 0x85650bfb, 0xabc4688d, 0x83c79129, 0x9d2fabb6, 0xa5819b22, +0xa70ef1cf, 0x62de5ac3, 0x89315219, 0xbb1046b6, 0x97012126, 0x3cb547b4, 0x4ebae486, 0xa2bcec0b, +0xab7195f4, 0x369b7fba, 0xb611e816, 0x5149091f, 0x6494e38a, 0x53bf4fa3, 0x1ac24f33, 0x53093b3e, +0x9ba9020c, 0x5ee28f6b, 0x851d5cb3, 0x177c17b6, 0x208b0c95, 0xf9487f30, 0x97f05640, 0x58a863ce, +0x65c16cc3, 0xe7d0c25b, 0xd6fecc0b, 0x6ea6167a, 0x439f08a9, 0xe2d28645, 0xd2ae4fe6, 0x3a2c638d, +0xfa2b5911, 0xa40f3f7f, 0x023ea29e, 0xb32d8072, 0x8efb0571, 0xea5298b1, 0x9c0066e9, 0x80abee88, +0x01dc8755, 0xd550ecb0, 0xbf852846, 0x2903a135, 0x4bea8084, 0x4543c46f, 0x84672248, 0x883c8aed, +0xf2ad15fc, 0xaa344cd8, 0xca09b4ad, 0xd8586f24, 0x37ab305b, 0x0c14bc5d, 0x8f075deb, 0x430eb868, +0x4f1f13ec, 0x3beab043, 0x5600b3e5, 0xcc2b85c1, 0x748c559c, 0xcfc5528a, 0x570d2b77, 0xcfebb752, +0xb9d5f39c, 0x6037a698, 0x262b7e17, 0x2b8d9d43, 0x3c2bf60a, 0x125056cd, 0xe2feab1a, 0x7041932e, +0x9d4e25f1, 0x5f23d881, 0x84f9c5b1, 0x01b586fe, 0x148103f9, 0x4a428dad, 0xa0906ff3, 0x20446a5e, +0x4d7026cd, 0xb911119b, 0x2941e1a5, 0x2ef1f896, 0x50f565c6, 0x4206ff62, 0x1675fbab, 0xf903a602, +0xe7d9c966, 0xda7c400e, 0x9b7098ff, 0xcacccb74, 0x83c83f10, 0x7392f2ea, 0x4f035d1b, 0xaf9f4712, +0x0b2dcf31, 0x9afb7870, 0x04f34078, 0x22811b04, 0x040abfc8, 0x02c24ff8, 0x87c719f5, 0x0a9e1f40, +0x843c79be, 0x2e359215, 0xbc536cb2, 0xf12b6edf, 0xf54e02ba, 0x19018a16, 0x3ab15b86, 0xfe46105f, +0x994d39fe, 0x38700006, 0x3c5eeb4b, 0x69f2affe, 0xbe607682, 0x097214be, 0xedc4b152, 0x9d2bcd69, +0x5dee27f2, 0x35ed4038, 0x8d37f883, 0x825044f8, 0x0632738d, 0x0a28dcb9, 0x150e07c2, 0x2cf4a552, +0xca51b5b0, 0xa9c90dbb, 0x1118e562, 0xb173eff3, 0xed2e561d, 0x00a39b69, 0xcdc33029, 0x8c18a9d8, +0xa80db52b, 0xa7dd9caf, 0x308f08a2, 0xbe3105dd, 0xebfb0efd, 0xf551bc1f, 0x300e9d66, 0x9fd9a140, +0x5be2063c, 0xbb67a194, 0x83ba62ca, 0xb7cb1c55, 0xe78895b9, 0x51d6272a, 0xffd44dd1, 0xfdd59035, +0xaabe87ef, 0x9582b041, 0xb0429099, 0xc21376f3, 0x6a6f8e06, 0x510d1155, 0x6a63f6dc, 0x9210eace, +0x6b710518, 0xc05d9ab1, 0xf87ffb6d, 0xa6f4a2f3, 0x644b26df, 0x28f811d9, 0x07496053, 0x963ecfd2, +0x4c709da2, 0xa416dec9, 0xfdca02ac, 0x24ece8b0, 0x312100a2, 0xf9f35472, 0xf0cf01b4, 0x704a5a8f, +0x27f09f63, 0xdc26f535, 0x82a21e47, 0xc5855757, 0xbd399f88 +}; + +const uint32_t mldsa_entropy[] = { +0x3401CEFA, +0xE20A7376, +0x49073AC1, +0xA351E329, +0x26DB9ED0, +0xDB6B1CFF, +0xAB0493DA, +0xAFB93DDD, +0xD83EDEA2, +0x8A803D0D, +0x003B2633, +0xB9D0F1BF, +0x3401CEFA, +0xE20A7376, +0x49073AC1, +0xA351E329 +}; + +const uint32_t mldsa_pubkey[] = { +0x973d61cd, 0x76eb343e, 0x765938db, 0x48e81c15, 0x23d6a60a, 0x4ea84d31, 0xd498328f, 0xc1104617, +0x5a578ffb, 0xb46f2022, 0xc3d92cb7, 0xefba3223, 0x60571db7, 0x2520da5c, 0xbe234914, 0x213238a7, +0x3541c5f8, 0xef7ec4e8, 0x2fde351f, 0x0599511b, 0x369f8d8a, 0x3b3fb0e2, 0x9b76e0d1, 0x8b5e2f58, +0x718892f6, 0x715d304f, 0x8f155aef, 0xc31d9905, 0xb468416d, 0xb3963116, 0x0396a9fd, 0x1e63f38f, +0xb9550d25, 0x7840c77b, 0x6e57064e, 0x0fadf903, 0x7898dbc9, 0xc5e96a09, 0x704ff2d6, 0x44c971d7, +0x6cb9751b, 0x3e1ae247, 0xee69acf8, 0x6f50fc50, 0xf0cd348d, 0x29a432d4, 0x04556250, 0x7277b455, +0xeb708c7f, 0xf4fd5728, 0xd8290a8a, 0x4eddd580, 0x1a96939f, 0x738733fb, 0x6780fcd0, 0x6acad1f8, +0x24b0bdb9, 0xd2b58a24, 0x1aaff0d4, 0x4839bbcc, 0xa774618e, 0xe68dee10, 0x0b2a8238, 0xf0aa3b83, +0x52786654, 0x2cfcb046, 0xa8cb7055, 0x7f81e0af, 0x5aa4d3f3, 0x47a78f12, 0xef8963cc, 0x5b02046b, +0x36d786aa, 0x5cd78fe8, 0x5d368949, 0xfbf1d2a1, 0x214b713e, 0x6cd83154, 0x5d3a7317, 0x583ebd6d, +0x14a4f48d, 0xd7d5ba07, 0x210c9df1, 0xb97441d9, 0x9d250c05, 0x7c4cedd4, 0x5d3eaceb, 0xfcf34a94, +0xfa199697, 0x02f755c3, 0x5d88f678, 0xb15ad867, 0xd98e4bc1, 0x7d851ee7, 0x11a470a0, 0x14a22c67, +0xb4c033d2, 0x9097b941, 0xf677a8af, 0x62b8dd95, 0xac20d57d, 0x232887a5, 0x2070c52b, 0xb9944841, +0x4a0db89d, 0xcec51dac, 0x2f8cff0f, 0x110c46b0, 0x29c78782, 0x49589768, 0xf5637fb6, 0x7e859606, +0xa9fc4511, 0x5ca5f8bc, 0x6854dec3, 0xbd22077f, 0xa1054dc6, 0x50439a11, 0xb9134307, 0xdff3edb0, +0x021f8404, 0x88355fc1, 0xf63d2f07, 0x36661608, 0x22a2141d, 0xf3297c35, 0x3e858d59, 0x8cc6dd5e, +0xd23a2c6b, 0xdf15a30f, 0x5ae21057, 0x58e40bf2, 0x65824c67, 0x3f72f492, 0xd7d0ba09, 0x22c9ca89, +0xe38446bb, 0x50a91313, 0xe4819f3b, 0x80e87ead, 0x50c74f3a, 0x1a2da89e, 0x818cbe66, 0x479b70f8, +0xe2676dc7, 0xea3a4126, 0xff94249b, 0x2c1054fc, 0x663250c7, 0xeb7c712c, 0xee98978a, 0xab09124e, +0x4b61a838, 0x2e842272, 0xa1931e60, 0xc0734a81, 0x9611fd72, 0x8b35a5de, 0xfbc3cbc0, 0x41e67478, +0x3ac4687d, 0x8acd92b6, 0xe3010ef5, 0x1b4ffb4d, 0x7cebb83f, 0xe0e455c5, 0xb0265a0d, 0x82969a88, +0x776e0965, 0x1f064dc5, 0xd27c0722, 0x3d4286d5, 0x69c0c32f, 0xccf23128, 0x2e7c101c, 0xb75826ef, +0xbe18d4ef, 0xadd04645, 0xadae8571, 0xda1bd350, 0xa807a344, 0x2d4fb8a1, 0xbac334c0, 0x124ac4d5, +0x16735b23, 0x9961dd0c, 0xe464bf22, 0xf5a1bfd8, 0x76dd31e5, 0xe9846b68, 0xfa85177c, 0x510bc4a2, +0xe9518982, 0xdf90cc52, 0x63ddf094, 0x41024279, 0xb95e50b0, 0xbeb3bd1e, 0x9375253e, 0x0fc4cf56, +0x0374f753, 0x9012cc71, 0x548e8987, 0x4b657267, 0x2e4e1e99, 0x3fc7751e, 0x1a37e8cf, 0xdf2a0d30, +0xa99b3e3c, 0xc8701d52, 0x80b8443f, 0x76276a19, 0x7ca0411b, 0xab340613, 0xcf2527c0, 0xa0dc827b, +0xb6c284c1, 0xd9b96dac, 0xc882cc24, 0x04662474, 0x7ca42f19, 0x366b0f25, 0xc5f5d075, 0x29ce3d5b, +0x14754843, 0xe71b3d72, 0x0647057f, 0x12d1e95e, 0x20ef5725, 0x70667ee3, 0x3b261a94, 0x88fd6c16, +0x58ac09c4, 0xe5a2ad3e, 0x686cf2f3, 0x82ea609e, 0x2411c571, 0x9f35c4f5, 0x3578316a, 0xe7b9d153, +0xab4bb40e, 0x2d0585e5, 0x645d30ea, 0x3eb72459, 0xc86e8bc0, 0x087173a9, 0xa06906a1, 0x85a0a5df, +0x01fc6dd2, 0x0f64e0fc, 0x06bcd88c, 0xd32bcee6, 0x67830207, 0x827921fd, 0x909405b2, 0x46b953d7, +0xe2bba487, 0x57f29142, 0x01ebe66a, 0x6c6e4a08, 0x899e8994, 0xe129238d, 0xaad3d238, 0x5760dab8, +0x6a8426fb, 0x4dc1d2c6, 0x08a99169, 0x0fa3a0ce, 0xfaeb072e, 0xe4d6c7c1, 0x733aad1d, 0xb50872d5, +0x8966c69e, 0x74ae6efb, 0x25f5d506, 0x77f2a123, 0xa5b2a938, 0x9013f67e, 0xd63b1f80, 0x8c030fd6, +0xad8eb1b4, 0xfde95a25, 0xbec959b6, 0x84477a97, 0xadb4c537, 0xee292b0b, 0x86be78bd, 0x6aaeeeb5, +0xeba53746, 0x2f5c8946, 0x44c1e601, 0xce9340f2, 0x2232556d, 0x4fe22467, 0x66497062, 0xc182662a, +0x17fdd938, 0x4f7c3cc7, 0xc943e657, 0x43087ece, 0xb018b3a5, 0x849530f3, 0x1e5b325e, 0xad78bfbe, +0x33c49a76, 0xa3b7465f, 0xa8cea0d5, 0x5b7d8e6a, 0x624ef0f6, 0x7b58f4bb, 0x569167f6, 0xdc88ae9d, +0x219501b6, 0x63b106f5, 0xa2aac905, 0xe1255afa, 0x081cda11, 0x7b17980e, 0x2b7a6ea7, 0x04bef3de, +0x8b171b91, 0x9ace96f2, 0x3a4539ae, 0xfc9397fc, 0x7b4d0743, 0xcf878a64, 0xf24b4067, 0x80125991, +0x0a116879, 0xf98c3f6e, 0xaa96ebfe, 0x5bdc2674, 0x49bc07b7, 0xfe189039, 0xd3d186b5, 0x209ace32, +0xa32bd588, 0x81e84792, 0x7f9e3a3b, 0xb3a2c06d, 0x6e89e2e5, 0x0e8eeb84, 0xa0600ad0, 0x1a82fddc, +0x915c1dd0, 0xda379a6d, 0x6635ba3b, 0xd384ff81, 0x31d1d6d9, 0x5e42d394, 0xf740fc49, 0xcc74fc9b, +0xd659f3de, 0x99cb6729, 0x0de90373, 0x887f37f0, 0x7c9de1c1, 0x58609c15, 0x97a78222, 0x3025c0a9, +0xbce08094, 0xe6dafb41, 0x45175d58, 0x6282f234, 0xaacb37a0, 0x7a73d6a9, 0xc968b243, 0x0a52be71, +0xe5d3aa25, 0x01eca7de, 0xa1295362, 0xb3b36736, 0x0e408da0, 0x83a0e250, 0xd6440b37, 0xbe9afb8a, +0xba7163fe, 0xfe33ca7c, 0xbb47ba0e, 0xdeed6134, 0x89944d4f, 0x1b5e8f88, 0x6f92fa01, 0x739bdc01, +0xef811072, 0x625ba3aa, 0x40c5f4b4, 0xf594e880, 0x82dcf369, 0xc0ae05d2, 0xc5dfba83, 0x9a2890de, +0x358f3ca0, 0xc39e733a, 0xa3e1e10a, 0xde354cac, 0x6b9bae34, 0x4dd2b45c, 0x2161c5fe, 0x470fe811, +0x98fb3f90, 0xf4edc275, 0x8a91dd08, 0x60630c66, 0xf50e7189, 0x81f99ce9, 0x4eeddc00, 0xe2abe90b, +0x070e80e5, 0x98ac1019, 0xe3a090ee, 0x6167ec26, 0xe6fa3070, 0x54f73da9, 0xbfe12812, 0x93787446, +0x88f85ff4, 0xbe4168b9, 0xa3a24d5f, 0xd529082e, 0x7f729a61, 0x33b9379d, 0xf2df9171, 0x724f6439, +0xfadd7aa7, 0x67242651, 0xbc1631c1, 0xaad416e6, 0x4a77dbd1, 0x4c6a5fb5, 0x20249617, 0x88809bfc, +0x24181d8e, 0x565e1ad9, 0x188e9775, 0x4cabee21, 0x33867aa9, 0x457074fc, 0xb0178c16, 0xa286e4c9, +0x9ae69b3f, 0x1002191f, 0x49982463, 0x10d13ad4, 0x52dc2095, 0xc409d4a3, 0x75123938, 0x5d006275, +0x21fa6db3, 0x8d03db2a, 0x4e823a6e, 0xe58e6624, 0x6d5e0bb2, 0xcd3e7f74, 0xd022c044, 0xe1e010eb, +0x2b4eeaeb, 0xb385cd49, 0xee06112c, 0x8eac7b7c, 0xaade1239, 0xa4bc1ee9, 0xb06fc800, 0x7f55c098, +0x7f176c3f, 0x7f9835ad, 0xb59a56fa, 0xb0b02fa3, 0xf843f058, 0x42f8a314, 0xa1b5574a, 0x0fb7e352, +0x7b0eb259, 0x7f6cf84c, 0x9fa09d80, 0x248b0e21, 0x80ae9ae0, 0xb54aef16, 0xa8019fa4, 0x4ffc389f, +0x7e2981e7, 0xe32463d4, 0x0816f3b0, 0x99f21695, 0x22b06c6f, 0x5d77bfc2, 0x11f8fbd4, 0x6a973f0e, +0x42dad448, 0x9d88e1e4, 0x51f26e53, 0xad9e2d0e, 0xf899367f, 0x15668078, 0x3774798b, 0xf95bd749, +0xa96bcc9e, 0x905a342d, 0x4894053c, 0x4eb948ab, 0x0039a669, 0x862aa70c, 0xcf31b9e7, 0x9f0481f1, +0xd2039995, 0xb8434cc4, 0x110c12b7, 0x1d20d734, 0xeea996a2, 0x83bb5a0a, 0xeafa7c8d, 0xef71f111, +0x1da14fa3, 0x577ece89, 0x069b44e8, 0xc99c767a, 0x218fea21, 0x064d8479, 0xd7bfdd8b, 0x4f1fc5e1, +0x898035df, 0x1fbc552f, 0x2ebd9200, 0xac4ab753, 0x5581c7b5, 0x3f573609, 0x30bfdebf, 0xa7409900, +0xed9ae081, 0x3cfb38a0, 0x9637e7c7, 0xf590c9e2, 0xf545c737, 0xf6ecc808, 0x1760e2c8, 0x9f0c26c5, +0xf9182321, 0x2ea5ce06, 0x59dbd322, 0xae5b9409, 0x5a17f606, 0xfb92e1ae, 0xc11875df, 0xc8da4777, +0x90dfca45, 0xa01a21c2, 0x5ce17762, 0xca136643, 0xf734bb8c, 0x58af8553, 0x935380da, 0x8a4f0f78, +0x231053a6, 0xf97292ea, 0x21152a8a, 0x3a09e3de, 0x4bef112a, 0xb2e5e20b, 0xaf4b7f7f, 0x63b9bd53, +0x5b7730b3, 0x2f667342, 0x06025b32, 0x2b4cbcf4, 0xb6485601, 0xa2914f93, 0xeb24150e, 0x6b5bc8bc, +0x9c12c134, 0x63f8669d, 0xada1e758, 0x68913453, 0xfa8c0f1b, 0xd359fafc, 0x6cd596b9, 0xc002a624, +0xd4d6e058, 0xb3c51f24, 0xb2b410ca, 0x0caa9148, 0x5276c663, 0x5b432bc3, 0x42fad698, 0x29b6d3e0, +0x9fd0f2d0, 0xc295bec5, 0xad678c51, 0xd40f40f2, 0xb0512229, 0x100d7c4c, 0xbf899b44, 0xbeb135ec, +0x4234e2ca, 0x2f59787f, 0xd3b271d2, 0xc0a8a8f2, 0x540dba82, 0x03934d11, 0xc42708c2, 0x79d89c22, +0x929a1e37, 0x317fc4b8, 0x28159498, 0x23592312, 0x61f4c582, 0xb195456e, 0xd7cb8ac5, 0x2a73e213, +0x8c163f8b, 0x3a2475e1, 0xf7a14c20, 0x2747241e, 0xc6c3eba4, 0xb48d049c, 0x3e71feba, 0x5c53ced5, +0xab15e4e7, 0x0d45d80b, 0x411f0fe1, 0x7b866b61, 0x231e3ae9, 0x44fed15d, 0xc692406b, 0x07b13de0, +0xcf95d997, 0xebd6c00a, 0x9ce7aa99, 0x10850269, 0x59da0459, 0xd98c5c4b, 0x955eb031, 0x870535cc, +0xed749070, 0x560d6ec4, 0x6746c43f, 0x7b3f211f, 0xb6b505c9, 0x5b6ffd4b, 0xc4249723, 0x3fc35407, +0x9c03d6b5, 0x2637a27a, 0x00ed3350, 0xe8c83e88, 0x27f25a42, 0x858ad455, 0x02329622, 0x30e4e7b4 +}; + +//Failed verify res +const uint32_t mldsa_verify_res [] = { +0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, +0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 +}; + +void main() { + printf("----------------------------------\n"); + printf(" Running MLDSA Smoke Test !!\n"); + printf("----------------------------------\n"); + + //Call interrupt init + init_interrupts(); + mldsa_io seed; + uint32_t sign_rnd[MLDSA87_SIGN_RND_SIZE], entropy[MLDSA87_ENTROPY_SIZE], privkey[MLDSA87_PRIVKEY_SIZE], pubkey[MLDSA87_PUBKEY_SIZE], msg[MLDSA87_MSG_SIZE], sign[MLDSA87_SIGN_SIZE], verify_res[MLDSA_VERIFY_RES_SIZE]; + + seed.kv_intf = FALSE; + for (int i = 0; i < MLDSA87_SEED_SIZE; i++) + seed.data[i] = mldsa_seed[i]; + + for (int i = 0; i < MLDSA87_SIGN_RND_SIZE; i++) + sign_rnd[i] = mldsa_sign_rnd[i]; + + for (int i = 0; i < MLDSA87_ENTROPY_SIZE; i++) + entropy[i] = mldsa_entropy[i]; + + for (int i = 0; i < MLDSA87_MSG_SIZE; i++) + msg[i] = mldsa_msg[i]; + + for (int i = 0; i < MLDSA87_PRIVKEY_SIZE; i++) + privkey[i] = mldsa_privkey[i]; + + for (int i = 0; i < MLDSA87_PUBKEY_SIZE; i++) + pubkey[i] = mldsa_pubkey[i]; + + for (int i = 0; i < MLDSA87_SIGN_SIZE; i++) + sign[i] = mldsa_sign[i]; + + for (int i = 0; i < MLDSA_VERIFY_RES_SIZE; i++) + verify_res[i] = mldsa_verify_res[i]; + + + volatile uint32_t * reg_ptr; + uint16_t offset; + uint8_t fail_cmd = 0x1; + + // ********************************************** + // Injecting norm check failure into signing + // ********************************************** + + // wait for MLDSA to be ready + printf("Waiting for mldsa status ready in keygen\n"); + while((lsu_read_32(CLP_MLDSA_REG_MLDSA_STATUS) & MLDSA_REG_MLDSA_STATUS_READY_MASK) == 0); + + reg_ptr = (uint32_t*) CLP_MLDSA_REG_MLDSA_SEED_0; + offset = 0; + while (reg_ptr <= (uint32_t*) CLP_MLDSA_REG_MLDSA_SEED_7) { + *reg_ptr++ = seed.data[offset++]; + } + + // Program MLDSA MSG + reg_ptr = (uint32_t*) CLP_MLDSA_REG_MLDSA_MSG_0; + offset = 0; + while (reg_ptr <= (uint32_t*) CLP_MLDSA_REG_MLDSA_MSG_15) { + *reg_ptr++ = msg[offset++]; + } + + // Program MLDSA Sign Rnd + reg_ptr = (uint32_t*) CLP_MLDSA_REG_MLDSA_SIGN_RND_0; + offset = 0; + while (reg_ptr <= (uint32_t*) CLP_MLDSA_REG_MLDSA_SIGN_RND_7) { + *reg_ptr++ = sign_rnd[offset++]; + } + + // Write MLDSA ENTROPY + printf("Writing entropy\n"); + reg_ptr = (uint32_t*) CLP_MLDSA_REG_MLDSA_ENTROPY_0; + offset = 0; + while (reg_ptr <= (uint32_t*) CLP_MLDSA_REG_MLDSA_ENTROPY_15) { + *reg_ptr++ = entropy[offset++]; + } + + // Enable MLDSA KEYGEN + SIGNING core + printf("\nMLDSA KEYGEN + SIGNING\n"); + lsu_write_32(CLP_MLDSA_REG_MLDSA_CTRL, MLDSA_CMD_KEYGEN_SIGN); + + printf("Injecting makehint failure\n"); + printf("%c",0xd8); + + // wait for MLDSA SIGNING process to be done + wait_for_mldsa_intr(); + + // Read the data back from MLDSA register + printf("Load SIGN data from MLDSA\n"); + reg_ptr = (uint32_t *) CLP_MLDSA_REG_MLDSA_SIGNATURE_BASE_ADDR; + offset = 0; + while (offset < MLDSA87_SIGN_SIZE) { + if (sign[offset] != *reg_ptr) { + printf("At offset [%d], mldsa_sign data mismatch!\n", offset); + printf("Actual data: 0x%x\n", *reg_ptr); + printf("Expected data: 0x%x\n", sign[offset]); + printf("%c", fail_cmd); + while(1); + } + reg_ptr++; + offset++; + } + + mldsa_zeroize(); + cptra_intr_rcv.mldsa_notif = 0; + + // ********************************************** + // Injecting norm check failure into verifying + // ********************************************** + + // wait for MLDSA to be ready + while((lsu_read_32(CLP_MLDSA_REG_MLDSA_STATUS) & MLDSA_REG_MLDSA_STATUS_READY_MASK) == 0); + + // Program MLDSA MSG + reg_ptr = (uint32_t*) CLP_MLDSA_REG_MLDSA_MSG_0; + offset = 0; + while (reg_ptr <= (uint32_t*) CLP_MLDSA_REG_MLDSA_MSG_15) { + *reg_ptr++ = msg[offset++]; + } + + // Program MLDSA PUBKEY + reg_ptr = (uint32_t*) CLP_MLDSA_REG_MLDSA_PUBKEY_BASE_ADDR; + offset = 0; + while (offset < MLDSA87_PUBKEY_SIZE) { + *reg_ptr++ = pubkey[offset++]; + } + + // Program MLDSA SIGNATURE + reg_ptr = (uint32_t*) CLP_MLDSA_REG_MLDSA_SIGNATURE_BASE_ADDR; + offset = 0; + while (offset < MLDSA87_SIGN_SIZE) { + *reg_ptr++ = sign[offset++]; + } + + // Enable MLDSA VERIFYING core + printf("\nMLDSA VERIFYING\n"); + lsu_write_32(CLP_MLDSA_REG_MLDSA_CTRL, MLDSA_CMD_VERIFYING); + + printf("Injecting norm check failure\n"); + printf("%c",0xd7); + + // wait for MLDSA VERIFYING process to be done + wait_for_mldsa_intr(); + + reg_ptr = (uint32_t *) CLP_MLDSA_REG_MLDSA_VERIFY_RES_0; + // Read the data back from MLDSA register + printf("Load VERIFY_RES data from MLDSA\n"); + offset = 0; + while (reg_ptr <= (uint32_t*) CLP_MLDSA_REG_MLDSA_VERIFY_RES_15) { + if (verify_res[offset] != *reg_ptr) { + printf("At offset [%d], mldsa_verify_res data mismatch!\n", offset); + printf("Actual data: 0x%x\n", *reg_ptr); + printf("Expected data: 0x%x\n", verify_res[offset]); + printf("%c", fail_cmd); + while(1); + } + reg_ptr++; + offset++; + } + + mldsa_zeroize(); + cptra_intr_rcv.mldsa_notif = 0; + + printf("%c",0xff); //End the test + +} + + diff --git a/src/integration/test_suites/smoke_test_mldsa_edge/smoke_test_mldsa_edge.ld b/src/integration/test_suites/smoke_test_mldsa_edge/smoke_test_mldsa_edge.ld new file mode 100644 index 000000000..a25d56523 --- /dev/null +++ b/src/integration/test_suites/smoke_test_mldsa_edge/smoke_test_mldsa_edge.ld @@ -0,0 +1,72 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + /* custom linker to facilitate MLDSA tests */ + +OUTPUT_ARCH( "riscv" ) +ENTRY(_start) + +SECTIONS { + . = 0x0; + .text : { *(.text*) } + + .eh_frame : { *(.eh_frame) } + /* DCCM as VMA */ + /* Data is bundled with ROM image in iMem */ + /* Align data to 4-bytes to allow LSU access to work + * when copying to DCCM */ + /* Only upper half of DCCM is used for ROM image */ + _data_lma_start = ALIGN(4); + _data_vma_start = 0x50000000; + .data _data_vma_start : AT(_data_lma_start) { *(.*data.*) ; . = ALIGN(4);} =0x0000, + _data_lma_end = _data_lma_start + SIZEOF(.data); + _data_vma_end = _data_vma_start + SIZEOF(.data); + + _bss_lma_start = _data_lma_end; + _bss_vma_start = _data_vma_end; + .bss _bss_vma_start : AT(_bss_lma_start) { *(.sbss) *(.bss) ; . = ALIGN(4);} =0x0000, + _bss_lma_end = _bss_lma_start + SIZEOF(.bss); + _bss_vma_end = _bss_vma_start + SIZEOF(.bss); + + _end = _bss_lma_end; + ASSERT( _end < 0x0000C000, "ERROR: ROM size exceeds 48KiB") + + /* DCCM as VMA and LMA */ + . = _bss_vma_end; + _dccm_lma_start = _bss_vma_end; /* ----\___ SAME */ + _dccm_vma_start = _bss_vma_end; /* ----/ */ + .dccm _dccm_vma_start : AT(_dccm_lma_start) { *(.dccm*) *(.*data) *(.rodata*) *(.srodata*) . = ALIGN(4); } =0x0000, + iccm_code0_start = .; + + /* ICCM as VMA */ + /* All of these sections start at the base address of ICCM, and cannot coexist */ + /* The code in these sections will be loaded to DCCM alongside .data and later + * copied into ICCM for execution. + * NOTE: none of these sections will be used by the val image/FMC/RT flows */ + .data_iccm0 0x40000000 : AT(iccm_code0_start) {*(.data_iccm0) ; . = ALIGN(4); } =0x0000, /* iccm_code0_start, after .data, as LMA */ + iccm_code0_end = iccm_code0_start + SIZEOF(.data_iccm0); + iccm_code1_start = ALIGN(iccm_code0_end,4); + .data_iccm1 0x40000000 : AT(iccm_code1_start) {*(.data_iccm1) ; . = ALIGN(4); } =0x0000, /* iccm_code1_start, after .data, as LMA */ + iccm_code1_end = iccm_code1_start + SIZEOF(.data_iccm1); + iccm_code2_start = ALIGN(iccm_code1_end,4); + .data_iccm2 0x40000000 : AT(iccm_code2_start) {*(.data_iccm2) ; . = ALIGN(4); } =0x0000, /* iccm_code2_start, after .data, as LMA */ + iccm_code2_end = iccm_code2_start + SIZEOF(.data_iccm2); + + /* Stack is at the end of DCCM after .data_iccm2 */ + . = ALIGN(iccm_code2_end,16); + STACK = ALIGN(16) + 0x8000; + ASSERT( (STACK < 0x50020000), "ERROR: Stack overflows the DCCM -- note: lower half of DCCM is allocated in the validation image for remote firmware images") +} \ No newline at end of file diff --git a/src/integration/test_suites/smoke_test_mldsa_edge/smoke_test_mldsa_edge.yml b/src/integration/test_suites/smoke_test_mldsa_edge/smoke_test_mldsa_edge.yml new file mode 100644 index 000000000..361e66677 --- /dev/null +++ b/src/integration/test_suites/smoke_test_mldsa_edge/smoke_test_mldsa_edge.yml @@ -0,0 +1,3 @@ +--- +seed: 1 +testname: smoke_test_mldsa_edge diff --git a/src/integration/test_suites/smoke_test_mldsa_keygen_rand/caliptra_isr.h b/src/integration/test_suites/smoke_test_mldsa_keygen_rand/caliptra_isr.h new file mode 100644 index 000000000..90daec8db --- /dev/null +++ b/src/integration/test_suites/smoke_test_mldsa_keygen_rand/caliptra_isr.h @@ -0,0 +1,120 @@ +// SPDX-License-Identifier: Apache-2.0 +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// --------------------------------------------------------------------- +// File: caliptra_isr.h +// Description: +// Provides function declarations for use by external test files, so +// that the ISR functionality may behave like a library. +// TODO: +// This header file includes inline function definitions for event and +// test specific interrupt service behavior, so it should be copied and +// modified for each test. +// --------------------------------------------------------------------- + +#ifndef CALIPTRA_ISR_H + #define CALIPTRA_ISR_H + +#define EN_ISR_PRINTS 1 + +#include "caliptra_defines.h" +#include +#include "printf.h" + +/* --------------- symbols/typedefs --------------- */ +typedef struct { + uint32_t doe_error; + uint32_t doe_notif; + uint32_t ecc_error; + uint32_t ecc_notif; + uint32_t hmac_error; + uint32_t hmac_notif; + uint32_t kv_error; + uint32_t kv_notif; + uint32_t sha512_error; + uint32_t sha512_notif; + uint32_t sha256_error; + uint32_t sha256_notif; + uint32_t soc_ifc_error; + uint32_t soc_ifc_notif; + uint32_t sha512_acc_error; + uint32_t sha512_acc_notif; + uint32_t mldsa_error; + uint32_t mldsa_notif; + uint32_t axi_dma_error; + uint32_t axi_dma_notif; +} caliptra_intr_received_s; //TODO: add mldsa intr +extern volatile caliptra_intr_received_s cptra_intr_rcv; + +////////////////////////////////////////////////////////////////////////////// +// Function Declarations +// + +// Performs all the CSR setup to configure and enable vectored external interrupts +void init_interrupts(void); + +// These inline functions are used to insert event-specific functionality into the +// otherwise generic ISR that gets laid down by the parameterized macro "nonstd_veer_isr" +inline void service_doe_error_intr() {return;} +inline void service_doe_notif_intr() {return; +} + +inline void service_ecc_error_intr() {return;} +inline void service_ecc_notif_intr() {return; +} + +inline void service_hmac_error_intr() {return;} +inline void service_hmac_notif_intr() {return; +} + +inline void service_kv_error_intr() {return;} +inline void service_kv_notif_intr() {return;} +inline void service_sha512_error_intr() {return;} +inline void service_sha512_notif_intr() {return; +} + +inline void service_sha256_error_intr() {return;} +inline void service_sha256_notif_intr() {return; +} + + +inline void service_soc_ifc_error_intr() {return; +} + +inline void service_soc_ifc_notif_intr () {return; +} + +inline void service_sha512_acc_error_intr() {return;} +inline void service_sha512_acc_notif_intr() {return; +} + +inline void service_mldsa_error_intr() {return;} +inline void service_mldsa_notif_intr() { + uint32_t * reg = (uint32_t *) (CLP_MLDSA_REG_INTR_BLOCK_RF_NOTIF_INTERNAL_INTR_R); + uint32_t sts = *reg; + /* Write 1 to Clear the pending interrupt */ + if (sts & MLDSA_REG_INTR_BLOCK_RF_NOTIF_INTERNAL_INTR_R_NOTIF_CMD_DONE_STS_MASK) { + *reg = MLDSA_REG_INTR_BLOCK_RF_NOTIF_INTERNAL_INTR_R_NOTIF_CMD_DONE_STS_MASK; + cptra_intr_rcv.mldsa_notif |= MLDSA_REG_INTR_BLOCK_RF_NOTIF_INTERNAL_INTR_R_NOTIF_CMD_DONE_STS_MASK; + } + if (sts == 0) { + VPRINTF(ERROR,"bad mldsa_notif_intr sts:%x\n", sts); + SEND_STDOUT_CTRL(0x1); + while(1); + } +} +inline void service_axi_dma_error_intr() {return;} +inline void service_axi_dma_notif_intr() {return;} + +#endif //CALIPTRA_ISR_H diff --git a/src/integration/test_suites/smoke_test_mldsa_keygen_rand/smoke_test_mldsa_keygen_rand.c b/src/integration/test_suites/smoke_test_mldsa_keygen_rand/smoke_test_mldsa_keygen_rand.c new file mode 100644 index 000000000..2e1acf582 --- /dev/null +++ b/src/integration/test_suites/smoke_test_mldsa_keygen_rand/smoke_test_mldsa_keygen_rand.c @@ -0,0 +1,63 @@ +// SPDX-License-Identifier: Apache-2.0 +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#include "caliptra_defines.h" +#include "caliptra_isr.h" +#include "riscv_hw_if.h" +#include "riscv-csr.h" +#include "printf.h" +#include "mldsa.h" + +volatile char* stdout = (char *)STDOUT; +volatile uint32_t intr_count = 0; +#ifdef CPT_VERBOSITY + enum printf_verbosity verbosity_g = CPT_VERBOSITY; +#else + enum printf_verbosity verbosity_g = LOW; +#endif + +volatile caliptra_intr_received_s cptra_intr_rcv = {0}; + + +void main() { + printf("----------------------------------\n"); + printf(" Running MLDSA Smoke Test !!\n"); + printf("----------------------------------\n"); + + //Call interrupt init + init_interrupts(); + + //-------------------------------------------------------------- + printf("%c", 0xd9); //inject keygen seed + + // wait for MLDSA to be ready + printf("Waiting for mldsa status ready in keygen\n"); + while((lsu_read_32(CLP_MLDSA_REG_MLDSA_STATUS) & MLDSA_REG_MLDSA_STATUS_READY_MASK) == 0); + + printf("\nMLDSA KEYGEN\n"); + // Enable MLDSA KEYGEN core + lsu_write_32(CLP_MLDSA_REG_MLDSA_CTRL, MLDSA_CMD_KEYGEN); + + // // wait for MLDSA KEYGEN process to be done + wait_for_mldsa_intr(); + + mldsa_zeroize(); + cptra_intr_rcv.mldsa_notif = 0; + + printf("%c",0xff); //End the test + +} + + diff --git a/src/integration/test_suites/smoke_test_mldsa_keygen_rand/smoke_test_mldsa_keygen_rand.ld b/src/integration/test_suites/smoke_test_mldsa_keygen_rand/smoke_test_mldsa_keygen_rand.ld new file mode 100644 index 000000000..83a09ceac --- /dev/null +++ b/src/integration/test_suites/smoke_test_mldsa_keygen_rand/smoke_test_mldsa_keygen_rand.ld @@ -0,0 +1,69 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +OUTPUT_ARCH( "riscv" ) +ENTRY(_start) + +SECTIONS { + . = 0x0; + .text : { *(.text*) } + + .eh_frame : { *(.eh_frame) } + /* DCCM as VMA */ + /* Data is bundled with ROM image in iMem */ + /* Align data to 4-bytes to allow LSU access to work + * when copying to DCCM */ + /* Only upper half of DCCM is used for ROM image */ + _data_lma_start = ALIGN(4); + _data_vma_start = 0x50010000; + .data _data_vma_start : AT(_data_lma_start) { *(.*data) *(.*data.*) *(.rodata*) *(.srodata*) ; . = ALIGN(4);} =0x0000, + _data_lma_end = _data_lma_start + SIZEOF(.data); + _data_vma_end = _data_vma_start + SIZEOF(.data); + + _bss_lma_start = _data_lma_end; + _bss_vma_start = _data_vma_end; + .bss _bss_vma_start : AT(_bss_lma_start) { *(.sbss) *(.bss) ; . = ALIGN(4);} =0x0000, + _bss_lma_end = _bss_lma_start + SIZEOF(.bss); + _bss_vma_end = _bss_vma_start + SIZEOF(.bss); + + _end = _bss_lma_end; + ASSERT( _end < 0x0000C000, "ERROR: ROM size exceeds 48KiB") + + /* DCCM as VMA and LMA */ + . = _bss_vma_end; + _dccm_lma_start = _bss_vma_end; /* ----\___ SAME */ + _dccm_vma_start = _bss_vma_end; /* ----/ */ + .dccm _dccm_vma_start : AT(_dccm_lma_start) { *(.dccm*) . = ALIGN(4); } =0x0000, + iccm_code0_start = .; + + /* ICCM as VMA */ + /* All of these sections start at the base address of ICCM, and cannot coexist */ + /* The code in these sections will be loaded to DCCM alongside .data and later + * copied into ICCM for execution. + * NOTE: none of these sections will be used by the val image/FMC/RT flows */ + .data_iccm0 0x40000000 : AT(iccm_code0_start) {*(.data_iccm0) ; . = ALIGN(4); } =0x0000, /* iccm_code0_start, after .data, as LMA */ + iccm_code0_end = iccm_code0_start + SIZEOF(.data_iccm0); + iccm_code1_start = ALIGN(iccm_code0_end,4); + .data_iccm1 0x40000000 : AT(iccm_code1_start) {*(.data_iccm1) ; . = ALIGN(4); } =0x0000, /* iccm_code1_start, after .data, as LMA */ + iccm_code1_end = iccm_code1_start + SIZEOF(.data_iccm1); + iccm_code2_start = ALIGN(iccm_code1_end,4); + .data_iccm2 0x40000000 : AT(iccm_code2_start) {*(.data_iccm2) ; . = ALIGN(4); } =0x0000, /* iccm_code2_start, after .data, as LMA */ + iccm_code2_end = iccm_code2_start + SIZEOF(.data_iccm2); + + /* Stack is at the end of DCCM after .data_iccm2 */ + . = ALIGN(iccm_code2_end,16); + STACK = ALIGN(16) + 0x8000; + ASSERT( (STACK < 0x50020000), "ERROR: Stack overflows the DCCM -- note: lower half of DCCM is allocated in the validation image for remote firmware images") +} diff --git a/src/integration/test_suites/smoke_test_mldsa_keygen_rand/smoke_test_mldsa_keygen_rand.yml b/src/integration/test_suites/smoke_test_mldsa_keygen_rand/smoke_test_mldsa_keygen_rand.yml new file mode 100644 index 000000000..78d8fc984 --- /dev/null +++ b/src/integration/test_suites/smoke_test_mldsa_keygen_rand/smoke_test_mldsa_keygen_rand.yml @@ -0,0 +1,3 @@ +--- +seed: ${PLAYBOOK_RANDOM_SEED} +testname: smoke_test_mldsa_keygen_rand diff --git a/src/integration/test_suites/smoke_test_mldsa_rand/smoke_test_mldsa_rand.c b/src/integration/test_suites/smoke_test_mldsa_rand/smoke_test_mldsa_rand.c index 441c150c1..cbe9fb8c8 100644 --- a/src/integration/test_suites/smoke_test_mldsa_rand/smoke_test_mldsa_rand.c +++ b/src/integration/test_suites/smoke_test_mldsa_rand/smoke_test_mldsa_rand.c @@ -505,7 +505,7 @@ void main() { mldsa_zeroize(); cptra_intr_rcv.mldsa_notif = 0; - mldsa_keygen_signing_flow(seed, msg, sign_rnd, entropy, sign); + mldsa_keygen_signing_flow(seed, msg, sign_rnd, entropy, sign, 0x00); mldsa_zeroize(); cptra_intr_rcv.mldsa_notif = 0; @@ -513,7 +513,7 @@ void main() { mldsa_zeroize(); cptra_intr_rcv.mldsa_notif = 0; - mldsa_verifying_flow(msg, pubkey, sign, verify_res); + mldsa_verifying_flow(msg, pubkey, sign, verify_res, 0x00); mldsa_zeroize(); cptra_intr_rcv.mldsa_notif = 0; diff --git a/submodules/adams-bridge b/submodules/adams-bridge index f5a6e2a33..807056003 160000 --- a/submodules/adams-bridge +++ b/submodules/adams-bridge @@ -1 +1 @@ -Subproject commit f5a6e2a33ed99b4ea0cfa36cf441685a720c5d61 +Subproject commit 807056003044bce9a6abab6d8b4fae8028c03dd7