blob: 9d9a114b421e1d7a11f2d85d1e16a779a55f1a3e [file] [log] [blame]
Damien Miller3cccc0e2013-12-07 11:27:47 +11001/* $OpenBSD: fe25519.h,v 1.2 2013/12/07 00:26:37 djm Exp $ */
Damien Miller5be9d9e2013-12-07 11:24:01 +11002
3/* Public Domain, from supercop-20130419/crypto_sign/ed25519/ref/fe25519.h */
4
5#ifndef FE25519_H
6#define FE25519_H
7
8#include "crypto_api.h"
9
10#define fe25519 crypto_sign_ed25519_ref_fe25519
11#define fe25519_freeze crypto_sign_ed25519_ref_fe25519_freeze
12#define fe25519_unpack crypto_sign_ed25519_ref_fe25519_unpack
13#define fe25519_pack crypto_sign_ed25519_ref_fe25519_pack
14#define fe25519_iszero crypto_sign_ed25519_ref_fe25519_iszero
15#define fe25519_iseq_vartime crypto_sign_ed25519_ref_fe25519_iseq_vartime
16#define fe25519_cmov crypto_sign_ed25519_ref_fe25519_cmov
17#define fe25519_setone crypto_sign_ed25519_ref_fe25519_setone
18#define fe25519_setzero crypto_sign_ed25519_ref_fe25519_setzero
19#define fe25519_neg crypto_sign_ed25519_ref_fe25519_neg
20#define fe25519_getparity crypto_sign_ed25519_ref_fe25519_getparity
21#define fe25519_add crypto_sign_ed25519_ref_fe25519_add
22#define fe25519_sub crypto_sign_ed25519_ref_fe25519_sub
23#define fe25519_mul crypto_sign_ed25519_ref_fe25519_mul
24#define fe25519_square crypto_sign_ed25519_ref_fe25519_square
25#define fe25519_invert crypto_sign_ed25519_ref_fe25519_invert
26#define fe25519_pow2523 crypto_sign_ed25519_ref_fe25519_pow2523
27
28typedef struct
29{
30 crypto_uint32 v[32];
31}
32fe25519;
33
34void fe25519_freeze(fe25519 *r);
35
36void fe25519_unpack(fe25519 *r, const unsigned char x[32]);
37
38void fe25519_pack(unsigned char r[32], const fe25519 *x);
39
40int fe25519_iszero(const fe25519 *x);
41
42int fe25519_iseq_vartime(const fe25519 *x, const fe25519 *y);
43
44void fe25519_cmov(fe25519 *r, const fe25519 *x, unsigned char b);
45
46void fe25519_setone(fe25519 *r);
47
48void fe25519_setzero(fe25519 *r);
49
50void fe25519_neg(fe25519 *r, const fe25519 *x);
51
52unsigned char fe25519_getparity(const fe25519 *x);
53
54void fe25519_add(fe25519 *r, const fe25519 *x, const fe25519 *y);
55
56void fe25519_sub(fe25519 *r, const fe25519 *x, const fe25519 *y);
57
58void fe25519_mul(fe25519 *r, const fe25519 *x, const fe25519 *y);
59
60void fe25519_square(fe25519 *r, const fe25519 *x);
61
62void fe25519_invert(fe25519 *r, const fe25519 *x);
63
64void fe25519_pow2523(fe25519 *r, const fe25519 *x);
65
66#endif