aboutsummaryrefslogtreecommitdiff
path: root/src/crypto/shen_ed25519_ref/ref10CommentedCombined/ge_msub.q
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2015-08-24 19:21:24 +0200
committerRiccardo Spagni <ric@spagni.net>2015-08-24 19:21:31 +0200
commit32077d381013ce19fb9824105a1d348fc8975658 (patch)
treeb2fbd2123b601e14350a9ada57212aa60e8836a0 /src/crypto/shen_ed25519_ref/ref10CommentedCombined/ge_msub.q
parentMerge pull request #383 (diff)
parentAdded ref10 shen_ed25519_ref code, which includes code that can replace crypt... (diff)
downloadmonero-32077d381013ce19fb9824105a1d348fc8975658.tar.xz
Merge pull request #385
0a4bc84 Added ref10 shen_ed25519_ref code, which includes code that can replace crypto-ops with a version straight from Bernstein's ref 10 (ShenNoether) 0d70fdc revert to 776b4fc91a821be152f0f23e6873aabb78a72029 (ShenNoether) b01f286 Added shen_ed25519_ref to crypto ops subfolder, the point is to directly have bitmonero's crypto code come from bernstein et al's ref 10 code (ShenNoether)
Diffstat (limited to 'src/crypto/shen_ed25519_ref/ref10CommentedCombined/ge_msub.q')
-rw-r--r--src/crypto/shen_ed25519_ref/ref10CommentedCombined/ge_msub.q46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/crypto/shen_ed25519_ref/ref10CommentedCombined/ge_msub.q b/src/crypto/shen_ed25519_ref/ref10CommentedCombined/ge_msub.q
new file mode 100644
index 000000000..e3cadd882
--- /dev/null
+++ b/src/crypto/shen_ed25519_ref/ref10CommentedCombined/ge_msub.q
@@ -0,0 +1,46 @@
+:name:fe:r->X:r->Y:r->Z:r->T:t0:t1:t2:t3:t4:t5:p->X:p->Y:p->Z:p->T:q->yplusx:q->yminusx:q->xy2d:
+fe r:var/r=fe:
+
+enter f:enter/f:>X1=fe#11:>Y1=fe#12:>Z1=fe#13:>T1=fe#14:>ypx2=fe#15:>ymx2=fe#16:>xy2d2=fe#17:
+return:nofallthrough:<X3=fe#1:<Y3=fe#2:<Z3=fe#3:<T3=fe#4:leave:
+
+h=f+g:<f=fe:<g=fe:>h=fe:asm/fe_add(>h,<f,<g);:
+h=f-g:<f=fe:<g=fe:>h=fe:asm/fe_sub(>h,<f,<g);:
+h=f*g:<f=fe:<g=fe:>h=fe:asm/fe_mul(>h,<f,<g);:
+h=f^2:<f=fe:>h=fe:asm/fe_sq(>h,<f);:
+h=2*g:<g=fe:>h=fe:asm/fe_add(>h,<g,<g);:
+
+:
+
+enter ge_msub
+
+fe X1
+fe Y1
+fe Z1
+fe T1
+fe ypx2
+fe ymx2
+fe xy2d2
+fe X3
+fe Y3
+fe Z3
+fe T3
+fe YpX1
+fe YmX1
+fe A
+fe B
+fe C
+fe D
+
+YpX1 = Y1+X1
+YmX1 = Y1-X1
+A = YpX1*ymx2
+B = YmX1*ypx2
+C = xy2d2*T1
+D = 2*Z1
+X3 = A-B
+Y3 = A+B
+Z3 = D-C
+T3 = D+C
+
+return