Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/ec/curve448/field.h |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||
---|---|---|---|---|---|---|---|---|
1 | - | |||||||
2 | typedef struct gf_s { | - | ||||||
3 | word_t limb[(64/sizeof(word_t))]; | - | ||||||
4 | } __attribute__((__aligned__(16))) gf_s, gf[1]; | - | ||||||
5 | - | |||||||
6 | - | |||||||
7 | - | |||||||
8 | - | |||||||
9 | - | |||||||
10 | - | |||||||
11 | static __inline__ __attribute__((__unused__,__always_inline__)) void gf_copy(gf out, const gf a) | - | ||||||
12 | { | - | ||||||
13 | *out = *a; | - | ||||||
14 | } executed 8435 times by 2 tests: end of block Executed by:
| 8435 | ||||||
15 | - | |||||||
16 | static __inline__ __attribute__((__unused__,__always_inline__)) void gf_add_RAW(gf out, const gf a, const gf b); | - | ||||||
17 | static __inline__ __attribute__((__unused__,__always_inline__)) void gf_sub_RAW(gf out, const gf a, const gf b); | - | ||||||
18 | static __inline__ __attribute__((__unused__,__always_inline__)) void gf_bias(gf inout, int amount); | - | ||||||
19 | static __inline__ __attribute__((__unused__,__always_inline__)) void gf_weak_reduce(gf inout); | - | ||||||
20 | - | |||||||
21 | void gf_strong_reduce(gf inout); | - | ||||||
22 | void gf_add(gf out, const gf a, const gf b); | - | ||||||
23 | void gf_sub(gf out, const gf a, const gf b); | - | ||||||
24 | void gf_mul(gf_s * __restrict__ out, const gf a, const gf b); | - | ||||||
25 | void gf_mulw_unsigned(gf_s * __restrict__ out, const gf a, uint32_t b); | - | ||||||
26 | void gf_sqr(gf_s * __restrict__ out, const gf a); | - | ||||||
27 | mask_t gf_isr(gf a, const gf x); | - | ||||||
28 | mask_t gf_eq(const gf x, const gf y); | - | ||||||
29 | mask_t gf_lobit(const gf x); | - | ||||||
30 | mask_t gf_hibit(const gf x); | - | ||||||
31 | - | |||||||
32 | void gf_serialize(uint8_t *serial, const gf x, int with_highbit); | - | ||||||
33 | mask_t gf_deserialize(gf x, const uint8_t serial[56], int with_hibit, | - | ||||||
34 | uint8_t hi_nmask); | - | ||||||
35 | - | |||||||
36 | - | |||||||
37 | - | |||||||
38 | - | |||||||
39 | - | |||||||
40 | static const gf ZERO = {{{0}}}, ONE = {{{1}}}; | - | ||||||
41 | - | |||||||
42 | - | |||||||
43 | static inline void gf_sqrn(gf_s * __restrict__ y, const gf x, int n) | - | ||||||
44 | { | - | ||||||
45 | gf tmp; | - | ||||||
46 | - | |||||||
47 | - | |||||||
48 | ((void) (0)) | - | ||||||
49 | ; | - | ||||||
50 | if (n & 1
| 1154-8078 | ||||||
51 | gf_sqr(y, x); | - | ||||||
52 | n--; | - | ||||||
53 | } executed 8078 times by 2 tests: else {end of block Executed by:
| 8078 | ||||||
54 | gf_sqr(tmp, x); | - | ||||||
55 | gf_sqr(y, tmp); | - | ||||||
56 | n -= 2; | - | ||||||
57 | } executed 1154 times by 2 tests: end of block Executed by:
| 1154 | ||||||
58 | for (; n
| 9232-249264 | ||||||
59 | gf_sqr(tmp, y); | - | ||||||
60 | gf_sqr(y, tmp); | - | ||||||
61 | } executed 249264 times by 2 tests: end of block Executed by:
| 249264 | ||||||
62 | } executed 9232 times by 2 tests: end of block Executed by:
| 9232 | ||||||
63 | - | |||||||
64 | - | |||||||
65 | - | |||||||
66 | - | |||||||
67 | static inline void gf_sub_nr(gf c, const gf a, const gf b) | - | ||||||
68 | { | - | ||||||
69 | gf_sub_RAW(c, a, b); | - | ||||||
70 | gf_bias(c, 2); | - | ||||||
71 | if (2 < 3
| 0-1859470 | ||||||
72 | gf_weak_reduce(c); executed 1859470 times by 2 tests: gf_weak_reduce(c); Executed by:
| 1859470 | ||||||
73 | } executed 1859470 times by 2 tests: end of block Executed by:
| 1859470 | ||||||
74 | - | |||||||
75 | - | |||||||
76 | static inline void gf_subx_nr(gf c, const gf a, const gf b, int amt) | - | ||||||
77 | { | - | ||||||
78 | gf_sub_RAW(c, a, b); | - | ||||||
79 | gf_bias(c, amt); | - | ||||||
80 | if (2 < amt + 1
| 0-12182 | ||||||
81 | gf_weak_reduce(c); executed 12182 times by 2 tests: gf_weak_reduce(c); Executed by:
| 12182 | ||||||
82 | } executed 12182 times by 2 tests: end of block Executed by:
| 12182 | ||||||
83 | - | |||||||
84 | - | |||||||
85 | static inline void gf_mulw(gf c, const gf a, int32_t w) | - | ||||||
86 | { | - | ||||||
87 | if (w > 0
| 99-454272 | ||||||
88 | gf_mulw_unsigned(c, a, w); | - | ||||||
89 | } executed 454272 times by 2 tests: else {end of block Executed by:
| 454272 | ||||||
90 | gf_mulw_unsigned(c, a, -w); | - | ||||||
91 | gf_sub(c, ZERO, c); | - | ||||||
92 | } executed 99 times by 1 test: end of block Executed by:
| 99 | ||||||
93 | } | - | ||||||
94 | - | |||||||
95 | - | |||||||
96 | static inline void gf_cond_sel(gf x, const gf y, const gf z, mask_t is_z) | - | ||||||
97 | { | - | ||||||
98 | size_t i; | - | ||||||
99 | - | |||||||
100 | for (i = 0; i < (64/sizeof(word_t))
| 10998-175968 | ||||||
101 | - | |||||||
102 | x[0].limb[i] = constant_time_select_32(is_z, z[0].limb[i], | - | ||||||
103 | y[0].limb[i]); | - | ||||||
104 | - | |||||||
105 | - | |||||||
106 | - | |||||||
107 | - | |||||||
108 | - | |||||||
109 | } executed 175968 times by 2 tests: end of block Executed by:
| 175968 | ||||||
110 | } executed 10998 times by 2 tests: end of block Executed by:
| 10998 | ||||||
111 | - | |||||||
112 | - | |||||||
113 | static inline void gf_cond_neg(gf x, mask_t neg) | - | ||||||
114 | { | - | ||||||
115 | gf y; | - | ||||||
116 | - | |||||||
117 | gf_sub(y, ZERO, x); | - | ||||||
118 | gf_cond_sel(x, x, y, neg); | - | ||||||
119 | } executed 10998 times by 2 tests: end of block Executed by:
| 10998 | ||||||
120 | - | |||||||
121 | - | |||||||
122 | static inline void gf_cond_swap(gf x, gf_s * __restrict__ y, mask_t swap) | - | ||||||
123 | { | - | ||||||
124 | size_t i; | - | ||||||
125 | - | |||||||
126 | for (i = 0; i < (64/sizeof(word_t))
| 921552-14744832 | ||||||
127 | - | |||||||
128 | constant_time_cond_swap_32(swap, &(x[0].limb[i]), &(y->limb[i])); | - | ||||||
129 | - | |||||||
130 | - | |||||||
131 | - | |||||||
132 | - | |||||||
133 | } executed 14744832 times by 2 tests: end of block Executed by:
| 14744832 | ||||||
134 | } executed 921552 times by 2 tests: end of block Executed by:
| 921552 | ||||||
Switch to Source code | Preprocessed file |