mirror of
https://github.com/saymrwulf/betrusted-curve25519-dalek-source.git
synced 2026-09-10 21:21:08 +00:00
move microcode to the Xous side of things
minimizing the mount of data movement speeds up operations by about 2x
This commit is contained in:
parent
41cc7c4ab3
commit
1a79b76e90
1 changed files with 297 additions and 278 deletions
|
|
@ -613,6 +613,12 @@ impl<'a, 'b> Mul<&'b Scalar> for &'a MontgomeryPoint {
|
|||
W: FieldElement::one(),
|
||||
};
|
||||
|
||||
// for now, prefer to use the fully-accelerated version where this code is local to the server
|
||||
// instead of transmitting it every call with the data...gives about a 2x performance speedup
|
||||
if false {
|
||||
#[cfg(not(test))] // due to issue https://github.com/rust-lang/rust/issues/59168, you will have to manually comment this out when running a test on the full system and not just this crate.
|
||||
log::warn!("wrong multiply being used!");
|
||||
|
||||
let mcode = assemble_engine25519!(
|
||||
start:
|
||||
// P.U in %20
|
||||
|
|
@ -918,6 +924,19 @@ impl<'a, 'b> Mul<&'b Scalar> for &'a MontgomeryPoint {
|
|||
} else {
|
||||
MontgomeryPoint(copy_from_rf(31, &result_rf))
|
||||
}
|
||||
} else {
|
||||
let mut engine = engine_25519::Engine25519::new();
|
||||
let job = engine_25519::MontgomeryJob {
|
||||
x0_u: x0.U.to_bytes(),
|
||||
x0_w: x0.W.to_bytes(),
|
||||
x1_u: x1.U.to_bytes(),
|
||||
x1_w: x1.W.to_bytes(),
|
||||
affine_u: affine_u.to_bytes(),
|
||||
scalar: scalar.bytes,
|
||||
};
|
||||
|
||||
MontgomeryPoint(engine.montgomery_job(job).expect("couldn't run montgomery multiply job"))
|
||||
}
|
||||
}
|
||||
#[cfg(not(feature = "betrusted"))]
|
||||
fn mul(self, scalar: &'b Scalar) -> MontgomeryPoint {
|
||||
|
|
|
|||
Loading…
Reference in a new issue