yggm/libs/ed25519.cuh
2025-03-14 22:52:59 +05:00

17 lines
1.2 KiB
Plaintext

#ifndef __ED25519_CUH
#define __ED25519_CUH
#define F25519_SIZE 32
struct ed25519_pt { unsigned char x[F25519_SIZE], y[F25519_SIZE], t[F25519_SIZE], z[F25519_SIZE]; };
extern __device__ __constant__ struct ed25519_pt ed25519_base;
extern __device__ __constant__ struct ed25519_pt ed25519_neutral;
extern __device__ __constant__ unsigned char ed25519_d[F25519_SIZE];
extern __device__ __constant__ unsigned char ed25519_k[F25519_SIZE];
__device__ __forceinline__ void ed25519_project(struct ed25519_pt* p, const unsigned char* x, const unsigned char* y);
__device__ void ed25519_unproject(unsigned char* x, unsigned char* y, const struct ed25519_pt* p);
__device__ void ed25519_pack(unsigned char* c, const unsigned char* x, const unsigned char* y);
__device__ __forceinline__ void ed25519_add(struct ed25519_pt* r, const struct ed25519_pt* p1, const struct ed25519_pt* p2);
__device__ __forceinline__ void ed25519_double(struct ed25519_pt* r, const struct ed25519_pt* p);
__device__ __forceinline__ void ed25519_copy(struct ed25519_pt* dst, const struct ed25519_pt* src);
__device__ void ed25519_smult(struct ed25519_pt* r_out, const struct ed25519_pt* p, const unsigned char* e);
__device__ void ed25519_prepare(unsigned char* e);
#endif