add hw acceleration for the affine transform on curve25519

This commit is contained in:
bunnie 2021-06-28 04:43:56 +08:00
parent 89b3875bfc
commit ee87fd35a8
5 changed files with 7 additions and 5 deletions

2
Cargo.lock generated
View file

@ -505,7 +505,7 @@ dependencies = [
[[package]]
name = "curve25519-dalek"
version = "3.1.0"
source = "git+https://github.com/betrusted-io/curve25519-dalek.git?branch=main#9ffc75dd3cccd93478521414f5e1298da4eb831e"
source = "git+https://github.com/betrusted-io/curve25519-dalek.git?branch=main#41cc7c4ab3ccc9e42f8894d96924585bafc23074"
dependencies = [
"byteorder",
"digest",

View file

@ -95,6 +95,7 @@ sha2 = {path = "services/engine-sha512", package = "engine-sha512"}
[patch.crates-io.curve25519-dalek]
git="https://github.com/betrusted-io/curve25519-dalek.git"
branch="main"
#path = "../curve25519-dalek"
default-features = false
features = ["u32_backend", "betrusted"]

View file

@ -3,7 +3,7 @@
<device schemaVersion="1.1" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="CMSIS-SVD.xsd" >
<vendor>litex</vendor>
<name>SOC</name>
<description><![CDATA[Litex SoC 2021-06-25 18:26:55]]></description>
<description><![CDATA[Litex SoC 2021-06-28 03:35:41]]></description>
<addressUnitBits>8</addressUnitBits>
<width>32</width>
@ -3451,7 +3451,7 @@ inject too fast.]]></description>
<name>SEED1</name>
<description><![CDATA[Bits 32-63 of `SEED_SEED`. Seed used for the build]]></description>
<addressOffset>0x0000</addressOffset>
<resetValue>0x199653c4</resetValue>
<resetValue>0x314fcffc</resetValue>
<size>32</size>
<fields>
<field>
@ -3466,7 +3466,7 @@ inject too fast.]]></description>
<name>SEED0</name>
<description><![CDATA[Bits 0-31 of `SEED_SEED`.]]></description>
<addressOffset>0x0004</addressOffset>
<resetValue>0x5a781786</resetValue>
<resetValue>0x67a42778</resetValue>
<size>32</size>
<fields>
<field>

Binary file not shown.

View file

@ -154,8 +154,9 @@ pub fn benchmark_thread(sid0: usize, sid1: usize, sid2: usize, sid3: usize) {
2xop => each iteration has 2x DH ops in it (one for alice, one for bob)
202ms/2xop (10 x 10 iters - sw)
40.5ms/2xop (10 x 10 iters - hw)
33ms/2xop (200 iters - hw)
33ms/2xop (200 iters - hw) - affine done in software
190ms/2xop (200 iters - sw)
26ms/2xop (200 iters -hw) -- affine done in hardware
*/
Some(BenchOp::StartDh) => {
let mut passes = 0;