summaryrefslogtreecommitdiff
path: root/sc25519.h
diff options
context:
space:
mode:
Diffstat (limited to 'sc25519.h')
-rw-r--r--sc25519.h76
1 files changed, 76 insertions, 0 deletions
diff --git a/sc25519.h b/sc25519.h
new file mode 100644
index 000000000..9537b7688
--- /dev/null
+++ b/sc25519.h
@@ -0,0 +1,76 @@
1/* $OpenBSD: */
2
3/* Public Domain, from supercop-20130419/crypto_sign/ed25519/ref/sc25519.h */
4
5#ifndef SC25519_H
6#define SC25519_H
7
8#include "crypto_api.h"
9
10#define sc25519 crypto_sign_ed25519_ref_sc25519
11#define shortsc25519 crypto_sign_ed25519_ref_shortsc25519
12#define sc25519_from32bytes crypto_sign_ed25519_ref_sc25519_from32bytes
13#define shortsc25519_from16bytes crypto_sign_ed25519_ref_shortsc25519_from16bytes
14#define sc25519_from64bytes crypto_sign_ed25519_ref_sc25519_from64bytes
15#define sc25519_from_shortsc crypto_sign_ed25519_ref_sc25519_from_shortsc
16#define sc25519_to32bytes crypto_sign_ed25519_ref_sc25519_to32bytes
17#define sc25519_iszero_vartime crypto_sign_ed25519_ref_sc25519_iszero_vartime
18#define sc25519_isshort_vartime crypto_sign_ed25519_ref_sc25519_isshort_vartime
19#define sc25519_lt_vartime crypto_sign_ed25519_ref_sc25519_lt_vartime
20#define sc25519_add crypto_sign_ed25519_ref_sc25519_add
21#define sc25519_sub_nored crypto_sign_ed25519_ref_sc25519_sub_nored
22#define sc25519_mul crypto_sign_ed25519_ref_sc25519_mul
23#define sc25519_mul_shortsc crypto_sign_ed25519_ref_sc25519_mul_shortsc
24#define sc25519_window3 crypto_sign_ed25519_ref_sc25519_window3
25#define sc25519_window5 crypto_sign_ed25519_ref_sc25519_window5
26#define sc25519_2interleave2 crypto_sign_ed25519_ref_sc25519_2interleave2
27
28typedef struct
29{
30 crypto_uint32 v[32];
31}
32sc25519;
33
34typedef struct
35{
36 crypto_uint32 v[16];
37}
38shortsc25519;
39
40void sc25519_from32bytes(sc25519 *r, const unsigned char x[32]);
41
42void shortsc25519_from16bytes(shortsc25519 *r, const unsigned char x[16]);
43
44void sc25519_from64bytes(sc25519 *r, const unsigned char x[64]);
45
46void sc25519_from_shortsc(sc25519 *r, const shortsc25519 *x);
47
48void sc25519_to32bytes(unsigned char r[32], const sc25519 *x);
49
50int sc25519_iszero_vartime(const sc25519 *x);
51
52int sc25519_isshort_vartime(const sc25519 *x);
53
54int sc25519_lt_vartime(const sc25519 *x, const sc25519 *y);
55
56void sc25519_add(sc25519 *r, const sc25519 *x, const sc25519 *y);
57
58void sc25519_sub_nored(sc25519 *r, const sc25519 *x, const sc25519 *y);
59
60void sc25519_mul(sc25519 *r, const sc25519 *x, const sc25519 *y);
61
62void sc25519_mul_shortsc(sc25519 *r, const sc25519 *x, const shortsc25519 *y);
63
64/* Convert s into a representation of the form \sum_{i=0}^{84}r[i]2^3
65 * with r[i] in {-4,...,3}
66 */
67void sc25519_window3(signed char r[85], const sc25519 *s);
68
69/* Convert s into a representation of the form \sum_{i=0}^{50}r[i]2^5
70 * with r[i] in {-16,...,15}
71 */
72void sc25519_window5(signed char r[51], const sc25519 *s);
73
74void sc25519_2interleave2(unsigned char r[127], const sc25519 *s1, const sc25519 *s2);
75
76#endif