From fed427c2699104be24efc393c329b5a4b13a17db Mon Sep 17 00:00:00 2001 From: pmvr Date: Sun, 7 Jun 2020 11:09:02 +0200 Subject: [PATCH] added some more optimization --- README.md | 14 +++++++------- mpy-modules/curve25519/arithmetic.c | 4 ---- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 401d519..0d7f873 100644 --- a/README.md +++ b/README.md @@ -26,13 +26,13 @@ Python script `x25519.py` Test vectors from https://tools.ietf.org/html/rfc8031#appendix-A Test 1: X25519: q = d*u - Computatation time: 40 ms + Computatation time: 39 ms q [hex/dec] = 66c7fb0d9f7090f777fa8493081ce8a4f174dbbbf9a36f16ba571206d4ddd548 46489245826987382655505058740283756869827209462947799117248009944518788765000 Test 1 passed. Test 2: X25519 + y-coordinate recovery + transform to Edwards-curve (x, y) = Edward(q, r), (q, r) = d*(u, v) - Computatation time: 45 ms + Computatation time: 44 ms x [hex/dec] = 1ce7e6e3a747a25352df2d3155f06427ba389769e37755731dead2b54c5cef03 13074494971479542188989287385397236998770807488645203601973104535274459557635 y [hex/dec] = 4dd1c7c2001c147333ceedf77ebd48b1100e2a95f88cf1f40d1b74ec7279e657 35198739055214410372845858661063095427357109357427482712729161712065293444695 Test 2 passed. @@ -41,23 +41,23 @@ Python script `x25519.py` Python script `ed25519.py` Test 1: Length of message: 0 bytes - Computatation time: 91 ms + Computatation time: 89 ms Test 1 passed. Test 2: Length of message: 1 byte - Computatation time: 91 ms + Computatation time: 90 ms Test 2 passed. Test 3: Length of message: 2 bytes - Computatation time: 91 ms + Computatation time: 90 ms Test 3 passed. Test 4: Length of message: 1023 bytes - Computatation time: 100 ms + Computatation time: 98 ms Test 4 passed. Test 5: Length of message: 64 bytes - Computatation time: 92 ms + Computatation time: 90 ms Test 5 passed. ## Warning diff --git a/mpy-modules/curve25519/arithmetic.c b/mpy-modules/curve25519/arithmetic.c index b3d5c78..34e45a4 100644 --- a/mpy-modules/curve25519/arithmetic.c +++ b/mpy-modules/curve25519/arithmetic.c @@ -149,13 +149,9 @@ void pu(uint32_t *t, uint32_t u) { "STMIA %0!, {r4}\n" "SBCS r4, r3, r3\n" "STMIA %0!, {r4}\n" - "SBCS r4, r3, r3\n" "STMIA %0!, {r4}\n" - "SBCS r4, r3, r3\n" "STMIA %0!, {r4}\n" - "SBCS r4, r3, r3\n" "STMIA %0!, {r4}\n" - "SBCS r4, r3, r3\n" "STMIA %0!, {r4}\n" "SBCS r4, r2, r3\n" "STMIA %0!, {r4}\n"