diff options
Diffstat (limited to 'src/lib/libcrypto/curve25519/curve25519_internal.h')
-rw-r--r-- | src/lib/libcrypto/curve25519/curve25519_internal.h | 105 |
1 files changed, 0 insertions, 105 deletions
diff --git a/src/lib/libcrypto/curve25519/curve25519_internal.h b/src/lib/libcrypto/curve25519/curve25519_internal.h deleted file mode 100644 index abfaaaf52b..0000000000 --- a/src/lib/libcrypto/curve25519/curve25519_internal.h +++ /dev/null | |||
@@ -1,105 +0,0 @@ | |||
1 | /* $OpenBSD: curve25519_internal.h,v 1.6 2022/11/09 17:45:55 jsing Exp $ */ | ||
2 | /* | ||
3 | * Copyright (c) 2015, Google Inc. | ||
4 | * | ||
5 | * Permission to use, copy, modify, and/or distribute this software for any | ||
6 | * purpose with or without fee is hereby granted, provided that the above | ||
7 | * copyright notice and this permission notice appear in all copies. | ||
8 | * | ||
9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY | ||
12 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION | ||
14 | * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN | ||
15 | * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
16 | */ | ||
17 | |||
18 | #ifndef HEADER_CURVE25519_INTERNAL_H | ||
19 | #define HEADER_CURVE25519_INTERNAL_H | ||
20 | |||
21 | #include <stdint.h> | ||
22 | |||
23 | __BEGIN_HIDDEN_DECLS | ||
24 | |||
25 | /* fe means field element. Here the field is \Z/(2^255-19). An element t, | ||
26 | * entries t[0]...t[9], represents the integer t[0]+2^26 t[1]+2^51 t[2]+2^77 | ||
27 | * t[3]+2^102 t[4]+...+2^230 t[9]. Bounds on each t[i] vary depending on | ||
28 | * context. */ | ||
29 | typedef int32_t fe[10]; | ||
30 | |||
31 | /* ge means group element. | ||
32 | |||
33 | * Here the group is the set of pairs (x,y) of field elements (see fe.h) | ||
34 | * satisfying -x^2 + y^2 = 1 + d x^2y^2 | ||
35 | * where d = -121665/121666. | ||
36 | * | ||
37 | * Representations: | ||
38 | * ge_p2 (projective): (X:Y:Z) satisfying x=X/Z, y=Y/Z | ||
39 | * ge_p3 (extended): (X:Y:Z:T) satisfying x=X/Z, y=Y/Z, XY=ZT | ||
40 | * ge_p1p1 (completed): ((X:Z),(Y:T)) satisfying x=X/Z, y=Y/T | ||
41 | * ge_precomp (Duif): (y+x,y-x,2dxy) */ | ||
42 | |||
43 | typedef struct { | ||
44 | fe X; | ||
45 | fe Y; | ||
46 | fe Z; | ||
47 | } ge_p2; | ||
48 | |||
49 | typedef struct { | ||
50 | fe X; | ||
51 | fe Y; | ||
52 | fe Z; | ||
53 | fe T; | ||
54 | } ge_p3; | ||
55 | |||
56 | typedef struct { | ||
57 | fe X; | ||
58 | fe Y; | ||
59 | fe Z; | ||
60 | fe T; | ||
61 | } ge_p1p1; | ||
62 | |||
63 | typedef struct { | ||
64 | fe yplusx; | ||
65 | fe yminusx; | ||
66 | fe xy2d; | ||
67 | } ge_precomp; | ||
68 | |||
69 | typedef struct { | ||
70 | fe YplusX; | ||
71 | fe YminusX; | ||
72 | fe Z; | ||
73 | fe T2d; | ||
74 | } ge_cached; | ||
75 | |||
76 | void x25519_ge_tobytes(uint8_t *s, const ge_p2 *h); | ||
77 | int x25519_ge_frombytes_vartime(ge_p3 *h, const uint8_t *s); | ||
78 | void x25519_ge_p3_to_cached(ge_cached *r, const ge_p3 *p); | ||
79 | void x25519_ge_p1p1_to_p2(ge_p2 *r, const ge_p1p1 *p); | ||
80 | void x25519_ge_p1p1_to_p3(ge_p3 *r, const ge_p1p1 *p); | ||
81 | void x25519_ge_add(ge_p1p1 *r, const ge_p3 *p, const ge_cached *q); | ||
82 | void x25519_ge_sub(ge_p1p1 *r, const ge_p3 *p, const ge_cached *q); | ||
83 | void x25519_ge_scalarmult_small_precomp(ge_p3 *h, const uint8_t a[32], | ||
84 | const uint8_t precomp_table[15 * 2 * 32]); | ||
85 | void x25519_ge_scalarmult_base(ge_p3 *h, const uint8_t a[32]); | ||
86 | void x25519_ge_scalarmult(ge_p2 *r, const uint8_t *scalar, const ge_p3 *A); | ||
87 | void x25519_sc_reduce(uint8_t *s); | ||
88 | |||
89 | void x25519_public_from_private(uint8_t out_public_value[32], | ||
90 | const uint8_t private_key[32]); | ||
91 | |||
92 | void x25519_scalar_mult(uint8_t out[32], const uint8_t scalar[32], | ||
93 | const uint8_t point[32]); | ||
94 | void x25519_scalar_mult_generic(uint8_t out[32], const uint8_t scalar[32], | ||
95 | const uint8_t point[32]); | ||
96 | |||
97 | void ED25519_public_from_private(uint8_t out_public_key[32], | ||
98 | const uint8_t private_key[32]); | ||
99 | |||
100 | void X25519_public_from_private(uint8_t out_public_key[32], | ||
101 | const uint8_t private_key[32]); | ||
102 | |||
103 | __END_HIDDEN_DECLS | ||
104 | |||
105 | #endif /* HEADER_CURVE25519_INTERNAL_H */ | ||