mirror of
https://github.com/saymrwulf/betrusted-curve25519-dalek-source.git
synced 2026-09-06 20:41:11 +00:00
mods to get hardware integration to actually work.
This commit is contained in:
parent
247c8ca2b7
commit
eb45d338ee
3 changed files with 14 additions and 5 deletions
|
|
@ -48,9 +48,11 @@ serde = { version = "1.0", default-features = false, optional = true, features =
|
||||||
packed_simd = { version = "0.3", features = ["into_bits"], optional = true }
|
packed_simd = { version = "0.3", features = ["into_bits"], optional = true }
|
||||||
zeroize = { version = "1", default-features = false }
|
zeroize = { version = "1", default-features = false }
|
||||||
engine25519-as = { path="../engine25519-as", default-features = false, features = [] }
|
engine25519-as = { path="../engine25519-as", default-features = false, features = [] }
|
||||||
rand = { version = "0.7" }
|
rand = { version = "0.7", default-features = false, features = [] }
|
||||||
volatile = "0.2.6"
|
volatile = "0.2.6"
|
||||||
pac = { path = "../../../../sim_support/rust/pac" }
|
#pac = { path = "../../../../sim_support/rust/pac" } # used in test simulation environment, need to figure out how to make a switch for this
|
||||||
|
betrusted-pac = { path = "../betrusted-pac" }
|
||||||
|
#pac = { package = "betrusted-pac" }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
nightly = ["subtle/nightly"]
|
nightly = ["subtle/nightly"]
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ pub(crate) mod macros;
|
||||||
extern crate engine25519_as;
|
extern crate engine25519_as;
|
||||||
extern crate rand;
|
extern crate rand;
|
||||||
extern crate volatile;
|
extern crate volatile;
|
||||||
extern crate pac;
|
extern crate betrusted_pac;
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// curve25519-dalek public modules
|
// curve25519-dalek public modules
|
||||||
|
|
|
||||||
|
|
@ -296,7 +296,7 @@ pub fn differential_add_and_double_hw(
|
||||||
affine_PmQ: &FieldElement,
|
affine_PmQ: &FieldElement,
|
||||||
) {
|
) {
|
||||||
use volatile::Volatile;
|
use volatile::Volatile;
|
||||||
let p = unsafe { pac::Peripherals::steal() };
|
let p = unsafe { betrusted_pac::Peripherals::steal() };
|
||||||
let mcode = assemble_engine25519!(
|
let mcode = assemble_engine25519!(
|
||||||
start:
|
start:
|
||||||
// P.U in %20
|
// P.U in %20
|
||||||
|
|
@ -443,9 +443,16 @@ impl<'a, 'b> Mul<&'b Scalar> for &'a MontgomeryPoint {
|
||||||
copy_to_rf(x1.W.to_bytes(), 28);
|
copy_to_rf(x1.W.to_bytes(), 28);
|
||||||
copy_to_rf(affine_u.to_bytes(), 24);
|
copy_to_rf(affine_u.to_bytes(), 24);
|
||||||
copy_to_rf(scalar.bytes, 31);
|
copy_to_rf(scalar.bytes, 31);
|
||||||
|
// load the number 254 into the loop index register
|
||||||
|
copy_to_rf([
|
||||||
|
254, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
], 19);
|
||||||
|
|
||||||
use volatile::Volatile;
|
use volatile::Volatile;
|
||||||
let p = unsafe { pac::Peripherals::steal() };
|
let p = unsafe { betrusted_pac::Peripherals::steal() };
|
||||||
let mcode = assemble_engine25519!(
|
let mcode = assemble_engine25519!(
|
||||||
start:
|
start:
|
||||||
// P.U in %20
|
// P.U in %20
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue