blob: a097637609317f2fc273ec4bf8f8cecce9fe0744 [file] [log] [blame]
miod@openbsd.org51b082c2015-02-16 18:26:26 +00001/* $OpenBSD: ge25519.h,v 1.4 2015/02/16 18:26:26 miod Exp $ */
Damien Miller5be9d9e2013-12-07 11:24:01 +11002
Damien Miller8a56dc22013-12-18 17:48:11 +11003/*
4 * Public Domain, Authors: Daniel J. Bernstein, Niels Duif, Tanja Lange,
5 * Peter Schwabe, Bo-Yin Yang.
6 * Copied from supercop-20130419/crypto_sign/ed25519/ref/ge25519.h
7 */
Damien Miller5be9d9e2013-12-07 11:24:01 +11008
9#ifndef GE25519_H
10#define GE25519_H
11
12#include "fe25519.h"
13#include "sc25519.h"
14
15#define ge25519 crypto_sign_ed25519_ref_ge25519
16#define ge25519_base crypto_sign_ed25519_ref_ge25519_base
17#define ge25519_unpackneg_vartime crypto_sign_ed25519_ref_unpackneg_vartime
18#define ge25519_pack crypto_sign_ed25519_ref_pack
19#define ge25519_isneutral_vartime crypto_sign_ed25519_ref_isneutral_vartime
20#define ge25519_double_scalarmult_vartime crypto_sign_ed25519_ref_double_scalarmult_vartime
21#define ge25519_scalarmult_base crypto_sign_ed25519_ref_scalarmult_base
22
23typedef struct
24{
25 fe25519 x;
26 fe25519 y;
27 fe25519 z;
28 fe25519 t;
29} ge25519;
30
miod@openbsd.org51b082c2015-02-16 18:26:26 +000031extern const ge25519 ge25519_base;
Damien Miller5be9d9e2013-12-07 11:24:01 +110032
33int ge25519_unpackneg_vartime(ge25519 *r, const unsigned char p[32]);
34
35void ge25519_pack(unsigned char r[32], const ge25519 *p);
36
37int ge25519_isneutral_vartime(const ge25519 *p);
38
39void ge25519_double_scalarmult_vartime(ge25519 *r, const ge25519 *p1, const sc25519 *s1, const ge25519 *p2, const sc25519 *s2);
40
41void ge25519_scalarmult_base(ge25519 *r, const sc25519 *s);
42
43#endif