OpenCoverage

field.h

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/ec/curve448/field.h
Switch to Source codePreprocessed file
LineSourceCount
1-
2typedef 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-
11static __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:
  • curve448_internal_test
  • libcrypto.so.1.1
8435
15-
16static __inline__ __attribute__((__unused__,__always_inline__)) void gf_add_RAW(gf out, const gf a, const gf b);-
17static __inline__ __attribute__((__unused__,__always_inline__)) void gf_sub_RAW(gf out, const gf a, const gf b);-
18static __inline__ __attribute__((__unused__,__always_inline__)) void gf_bias(gf inout, int amount);-
19static __inline__ __attribute__((__unused__,__always_inline__)) void gf_weak_reduce(gf inout);-
20-
21void gf_strong_reduce(gf inout);-
22void gf_add(gf out, const gf a, const gf b);-
23void gf_sub(gf out, const gf a, const gf b);-
24void gf_mul(gf_s * __restrict__ out, const gf a, const gf b);-
25void gf_mulw_unsigned(gf_s * __restrict__ out, const gf a, uint32_t b);-
26void gf_sqr(gf_s * __restrict__ out, const gf a);-
27mask_t gf_isr(gf a, const gf x);-
28mask_t gf_eq(const gf x, const gf y);-
29mask_t gf_lobit(const gf x);-
30mask_t gf_hibit(const gf x);-
31-
32void gf_serialize(uint8_t *serial, const gf x, int with_highbit);-
33mask_t gf_deserialize(gf x, const uint8_t serial[56], int with_hibit,-
34 uint8_t hi_nmask);-
35-
36-
37-
38-
39-
40static const gf ZERO = {{{0}}}, ONE = {{{1}}};-
41-
42-
43static 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
n & 1Description
TRUEevaluated 8078 times by 2 tests
Evaluated by:
  • curve448_internal_test
  • libcrypto.so.1.1
FALSEevaluated 1154 times by 2 tests
Evaluated by:
  • curve448_internal_test
  • libcrypto.so.1.1
) {
1154-8078
51 gf_sqr(y, x);-
52 n--;-
53 }
executed 8078 times by 2 tests: end of block
Executed by:
  • curve448_internal_test
  • libcrypto.so.1.1
else {
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:
  • curve448_internal_test
  • libcrypto.so.1.1
1154
58 for (; n
nDescription
TRUEevaluated 249264 times by 2 tests
Evaluated by:
  • curve448_internal_test
  • libcrypto.so.1.1
FALSEevaluated 9232 times by 2 tests
Evaluated by:
  • curve448_internal_test
  • libcrypto.so.1.1
; n -= 2) {
9232-249264
59 gf_sqr(tmp, y);-
60 gf_sqr(y, tmp);-
61 }
executed 249264 times by 2 tests: end of block
Executed by:
  • curve448_internal_test
  • libcrypto.so.1.1
249264
62}
executed 9232 times by 2 tests: end of block
Executed by:
  • curve448_internal_test
  • libcrypto.so.1.1
9232
63-
64-
65-
66-
67static 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
2 < 3Description
TRUEevaluated 1859470 times by 2 tests
Evaluated by:
  • curve448_internal_test
  • libcrypto.so.1.1
FALSEnever evaluated
)
0-1859470
72 gf_weak_reduce(c);
executed 1859470 times by 2 tests: gf_weak_reduce(c);
Executed by:
  • curve448_internal_test
  • libcrypto.so.1.1
1859470
73}
executed 1859470 times by 2 tests: end of block
Executed by:
  • curve448_internal_test
  • libcrypto.so.1.1
1859470
74-
75-
76static 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
2 < amt + 1Description
TRUEevaluated 12182 times by 2 tests
Evaluated by:
  • curve448_internal_test
  • libcrypto.so.1.1
FALSEnever evaluated
)
0-12182
81 gf_weak_reduce(c);
executed 12182 times by 2 tests: gf_weak_reduce(c);
Executed by:
  • curve448_internal_test
  • libcrypto.so.1.1
12182
82}
executed 12182 times by 2 tests: end of block
Executed by:
  • curve448_internal_test
  • libcrypto.so.1.1
12182
83-
84-
85static inline void gf_mulw(gf c, const gf a, int32_t w)-
86{-
87 if (w > 0
w > 0Description
TRUEevaluated 454272 times by 2 tests
Evaluated by:
  • curve448_internal_test
  • libcrypto.so.1.1
FALSEevaluated 99 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
99-454272
88 gf_mulw_unsigned(c, a, w);-
89 }
executed 454272 times by 2 tests: end of block
Executed by:
  • curve448_internal_test
  • libcrypto.so.1.1
else {
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:
  • libcrypto.so.1.1
99
93}-
94-
95-
96static 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))
i < (64/sizeof(word_t))Description
TRUEevaluated 175968 times by 2 tests
Evaluated by:
  • curve448_internal_test
  • libcrypto.so.1.1
FALSEevaluated 10998 times by 2 tests
Evaluated by:
  • curve448_internal_test
  • libcrypto.so.1.1
; i++) {
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:
  • curve448_internal_test
  • libcrypto.so.1.1
175968
110}
executed 10998 times by 2 tests: end of block
Executed by:
  • curve448_internal_test
  • libcrypto.so.1.1
10998
111-
112-
113static 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:
  • curve448_internal_test
  • libcrypto.so.1.1
10998
120-
121-
122static 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))
i < (64/sizeof(word_t))Description
TRUEevaluated 14744832 times by 2 tests
Evaluated by:
  • curve448_internal_test
  • libcrypto.so.1.1
FALSEevaluated 921552 times by 2 tests
Evaluated by:
  • curve448_internal_test
  • libcrypto.so.1.1
; i++) {
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:
  • curve448_internal_test
  • libcrypto.so.1.1
14744832
134}
executed 921552 times by 2 tests: end of block
Executed by:
  • curve448_internal_test
  • libcrypto.so.1.1
921552
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.2