-rw-r--r-- 1002 lib25519-20240321/crypto_nP/montgomery25519/amd64-avx512ifma-hey5l-maax/mont25519.c raw
#include "randombytes.h"
#include "crypto_nP.h"
#include "fe25519.h"
#include "crypto_uint64_vec4x1.h"
#define mladder CRYPTO_SHARED_NAMESPACE(mladder)
extern void mladder(crypto_uint64_vec4x1 *,crypto_uint64_vec4x1 *,const unsigned char *);
void crypto_nP(unsigned char *r,
const unsigned char *s,
const unsigned char *p)
{
unsigned char e[32];
int i;
crypto_uint64_vec4x1 a[5] = {{0}};
crypto_uint64_vec4x1 b[5] = {{0}};
fe25519_base52_5l u,v;
fe25519 z[2];
for(i=0;i<32;i++) e[i] = s[i];
e[0] &= 248;
e[31] &= 127;
e[31] |= 64;
fe25519_unpack(z,p);
fe25519_to_base52_5l(&u,z);
b[0][0] = b[0][3] = a[0][2] = 1; a[0][1] = 486662;
for (i=0;i<5;i++) {b[i][2] = u.l[i]; a[i][3] = u.l[i];}
mladder(b,a,e);
for (i=0;i<5;i++) {u.l[i] = b[i][0]; v.l[i] = b[i][1];}
fe25519_from_base52_5l(z,&u);
fe25519_from_base52_5l(z+1,&v);
fe25519_invert(z+1, z+1);
fe25519_mul(z, z, z+1);
fe25519_pack(r, z);
}