Line | Count | Source |
1 | | /* |
2 | | * Copyright Supranational LLC |
3 | | * Licensed under the Apache License, Version 2.0, see LICENSE for details. |
4 | | * SPDX-License-Identifier: Apache-2.0 |
5 | | */ |
6 | | #ifndef __BLS12_381_ASM_POINT_H__ |
7 | | #define __BLS12_381_ASM_POINT_H__ |
8 | | |
9 | | #include "vect.h" |
10 | | #include "bytes.h" |
11 | | |
12 | | #define DECLARE_POINT(ptype, bits) \ |
13 | | typedef struct { vec##bits X,Y,Z; } ptype; \ |
14 | | typedef struct { vec##bits X,Y; } ptype##_affine; \ |
15 | | \ |
16 | | static void ptype##_dadd(ptype *out, const ptype *p1, const ptype *p2, \ |
17 | | const vec##bits a4); \ |
18 | | static void ptype##_dadd_affine(ptype *out, const ptype *p1, \ |
19 | | const ptype##_affine *p2); \ |
20 | | static void ptype##_add(ptype *out, const ptype *p1, const ptype *p2); \ |
21 | | static void ptype##_add_affine(ptype *out, const ptype *p1, \ |
22 | | const ptype##_affine *p2); \ |
23 | | static void ptype##_double(ptype *out, const ptype *p1); \ |
24 | | static void ptype##_mult_w5(ptype *out, const ptype *point, \ |
25 | | const byte *scalar, size_t nbits); \ |
26 | | static void ptype##_cneg(ptype *p, limb_t cbit); \ |
27 | | static void ptype##_to_affine(ptype##_affine *out, const ptype *in); \ |
28 | | static void ptype##_from_Jacobian(ptype *out, const ptype *in); \ |
29 | | \ |
30 | | static inline void ptype##_cswap(ptype *restrict a, \ |
31 | 0 | ptype *restrict b, bool_t cbit) { \ |
32 | 0 | vec_cswap(a, b, sizeof(ptype), cbit); \ |
33 | 0 | } \ Unexecuted instantiation: server.c:POINTonE1_cswap Unexecuted instantiation: server.c:POINTonE2_cswap |
34 | | static inline void ptype##_ccopy(ptype *restrict a, \ |
35 | 1.29M | const ptype *restrict b, bool_t cbit) {\ |
36 | 1.29M | vec_select(a, b, a, sizeof(ptype), cbit); \ |
37 | 1.29M | } Line | Count | Source | 35 | 908k | const ptype *restrict b, bool_t cbit) {\ | 36 | 908k | vec_select(a, b, a, sizeof(ptype), cbit); \ | 37 | 908k | } |
Line | Count | Source | 35 | 389k | const ptype *restrict b, bool_t cbit) {\ | 36 | 389k | vec_select(a, b, a, sizeof(ptype), cbit); \ | 37 | 389k | } |
|
38 | | |
39 | | #define DECLARE_PRIVATE_POINTXZ(ptype, bits) \ |
40 | | typedef struct { vec##bits X,Z; } ptype##xz; \ |
41 | | \ |
42 | | static void ptype##xz_ladder_pre(ptype##xz *out, const ptype *in); \ |
43 | | static void ptype##xz_ladder_step(ptype##xz *r, ptype##xz *s, \ |
44 | | const ptype##xz *p); \ |
45 | | static void ptype##xz_ladder_post(ptype *ret, \ |
46 | | const ptype##xz *r, const ptype##xz *s, \ |
47 | | const ptype##xz *p, const vec##bits Y1);\ |
48 | | \ |
49 | | static inline void ptype##xz_cswap(ptype##xz *restrict a, \ |
50 | | ptype##xz *restrict b, bool_t cbit) {\ |
51 | | vec_cswap(a, b, sizeof(ptype##xz), cbit); \ |
52 | | } |
53 | | |
54 | | DECLARE_POINT(POINTonE1, 384) |
55 | | |
56 | | DECLARE_POINT(POINTonE2, 384x) |
57 | | |
58 | | #ifdef __GNUC__ |
59 | | # pragma GCC diagnostic ignored "-Wunused-function" |
60 | | #endif |
61 | | |
62 | | #endif |