Debian Codegraph @

crypto_nP/montgomery25519/amd64-avx2-ns9l-maa4/mont25519.c

raw symbols SCIP
1 #include "randombytes.h"
2 #include "crypto_nP.h"
3 #include "fe25519.h"
4 #include "crypto_uint64_vec4x1.h"
5
6 #define mladder CRYPTO_SHARED_NAMESPACE(mladder)
7 extern void mladder(crypto_uint64_vec4x1 *,crypto_uint64_vec4x1 *,const unsigned char *);
8
9 void crypto_nP(unsigned char *r,
10 const unsigned char *s,
11 const unsigned char *p)
12 {
13 unsigned char e[32];
14 int i;
15
16 crypto_uint64_vec4x1 a[9] = {{0}};
17 crypto_uint64_vec4x1 b[9] = {{0}};
18 fe25519_9l u,v;
19 fe25519 z[2];
20
21 for(i=0;i<32;i++) e[i] = s[i];
22 e[0] &= 248;
23 e[31] &= 127;
24 e[31] |= 64;
25
26 fe25519_unpack(z,p);
27 fe25519_to_9l(&u,z);
28
29 b[0][0] = b[0][3] = a[0][2] = 1;
30
31 for (i=0;i<9;i++) {b[i][2] = u.l[i]; a[i][3] = u.l[i];}
32
33 mladder(b,a,e);
34
35 for (i=0;i<9;i++) {u.l[i] = b[i][0]; v.l[i] = b[i][1];}
36
37 fe25519_from_9l(z,&u);
38 fe25519_from_9l(z+1,&v);
39 fe25519_invert(z+1, z+1);
40 fe25519_mul(z, z, z+1);
41 fe25519_pack(r, z);
42 }