Skip to content

Commit

Permalink
test dependency fix
Browse files Browse the repository at this point in the history
  • Loading branch information
eschorn1 committed Feb 10, 2024
1 parent baa06c3 commit 012e983
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 24 deletions.
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ hex = "0.4.3"
rand_chacha = "0.3.1"
criterion = "0.5.1"
flate2 = "1.0.27"
clap_lex = "0.6.0"


[[bench]]
name = "benchmark"
Expand Down
2 changes: 1 addition & 1 deletion ct_cm4/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ edition = "2021"

[dependencies]
fips203 = { path = "..", default-features = false, features = ["ml-kem-512"] }
embedded-alloc = "0.5"
#embedded-alloc = "0.5"
cortex-m-semihosting = "0.5.0"
panic-semihosting = { version = "0.6.0", features = ["exit"] }
cortex-m = { version = "0.7.7", features = ["critical-section-single-core"] }
Expand Down
44 changes: 21 additions & 23 deletions ct_cm4/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,38 +22,36 @@


// Embedded heap allocator (since no_std)
extern crate alloc;
//extern crate alloc;

// CPU support
use core::fmt::Write;
use core::mem::MaybeUninit;
//use core::fmt::Write;
//use core::mem::MaybeUninit;

// for hio
//use cortex_m::peripheral::DWT;
use cortex_m_rt::entry;
use cortex_m_semihosting::hio;
//use embedded_alloc::Heap;
use fips203::ml_kem_512;
// Could also be ml_kem_768 or ml_kem_1024.
use fips203::traits::{Decaps, Encaps, KeyGen};
//use cortex_m_semihosting::hio;
use rand_core::{CryptoRng, RngCore};
// Board support
use stm32f3_discovery::leds::Leds;
use stm32f3_discovery::stm32f3xx_hal::{pac, prelude::*};
use stm32f3_discovery::switch_hal::OutputSwitch;

use embedded_alloc::Heap;
use fips203::ml_kem_512;
// Could also be ml_kem_768 or ml_kem_1024.
use fips203::traits::{Decaps, Encaps, KeyGen};


#[global_allocator]
static HEAP: Heap = Heap::empty();

// This function prints to semihosting
fn print_semi(msg: &str, delta: u32) {
let mut stdout = hio::hstdout()
.map_err(|_| core::fmt::Error)
.expect("hio fail");
write!(stdout, "{} delta is #{}\n", msg, delta).expect("write fail");
}
// #[global_allocator]
// static HEAP: Heap = Heap::empty();
//
// // This function prints to semihosting
// fn print_semi(msg: &str, delta: u32) {
// let mut stdout = hio::hstdout()
// .map_err(|_| core::fmt::Error)
// .expect("hio fail");
// write!(stdout, "{} delta is #{}\n", msg, delta).expect("write fail");
// }

// Dummy RNG
struct MyRng();
Expand All @@ -77,9 +75,9 @@ impl CryptoRng for MyRng {}
#[entry]
fn main() -> ! {
// Configure heap
const HEAP_SIZE: usize = 10 * 1024;
static mut HEAP_MEM: [MaybeUninit<u8>; HEAP_SIZE] = [MaybeUninit::uninit(); HEAP_SIZE];
unsafe { HEAP.init(HEAP_MEM.as_ptr() as usize, HEAP_SIZE) }
// const HEAP_SIZE: usize = 10 * 1024;
// static mut HEAP_MEM: [MaybeUninit<u8>; HEAP_SIZE] = [MaybeUninit::uninit(); HEAP_SIZE];
// unsafe { HEAP.init(HEAP_MEM.as_ptr() as usize, HEAP_SIZE) }

// Configure MCU
let device_periphs = pac::Peripherals::take().expect("device_periphs fail");
Expand Down

0 comments on commit 012e983

Please sign in to comment.