Skip to content

Commit

Permalink
MLDSA KAT for Signature randomness (#734)
Browse files Browse the repository at this point in the history
* added sign rnd smoke test

* MICROSOFT AUTOMATED PIPELINE: Stamp 'user/dev/ekarabulut/mldsa_sign_rnd_test' with updated timestamp and hash after successful run

* MICROSOFT AUTOMATED PIPELINE: Stamp 'user/dev/ekarabulut/mldsa_sign_rnd_test' with updated timestamp and hash after successful run

* removed a misleading comment

* MICROSOFT AUTOMATED PIPELINE: Stamp 'user/dev/ekarabulut/mldsa_sign_rnd_test' with updated timestamp and hash after successful run
  • Loading branch information
ekarabu authored Feb 18, 2025
1 parent 0ea3374 commit f9aace3
Show file tree
Hide file tree
Showing 6 changed files with 613 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflow_metadata/pr_hash
Original file line number Diff line number Diff line change
@@ -1 +1 @@
97c2111bc2ca1496d92ef24508279e453bceec5045a529618ce70e4da4a999730e262da3cc4031468186cd62897d61a0
7003ac7c436a770c014e8b76999ddc237b08f17fc21332ad4cca6592d545910c71a67e0bdb5252e90942e849f31db042
2 changes: 1 addition & 1 deletion .github/workflow_metadata/pr_timestamp
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1739593668
1739901899
120 changes: 120 additions & 0 deletions src/integration/test_suites/smoke_test_mldsa_sign_rnd/caliptra_isr.h
Original file line number Diff line number Diff line change
@@ -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 <stdint.h>
#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
Loading

0 comments on commit f9aace3

Please sign in to comment.