| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssh/src/ge25519.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||
|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||
| 2 | static const crypto_sign_ed25519_ref_fe25519 ge25519_ecd = {{0xA3, 0x78, 0x59, 0x13, 0xCA, 0x4D, 0xEB, 0x75, 0xAB, 0xD8, 0x41, 0x41, 0x4D, 0x0A, 0x70, 0x00, | - | ||||||
| 3 | 0x98, 0xE8, 0x79, 0x77, 0x79, 0x40, 0xC7, 0x8C, 0x73, 0xFE, 0x6F, 0x2B, 0xEE, 0x6C, 0x03, 0x52}}; | - | ||||||
| 4 | - | |||||||
| 5 | static const crypto_sign_ed25519_ref_fe25519 ge25519_ec2d = {{0x59, 0xF1, 0xB2, 0x26, 0x94, 0x9B, 0xD6, 0xEB, 0x56, 0xB1, 0x83, 0x82, 0x9A, 0x14, 0xE0, 0x00, | - | ||||||
| 6 | 0x30, 0xD1, 0xF3, 0xEE, 0xF2, 0x80, 0x8E, 0x19, 0xE7, 0xFC, 0xDF, 0x56, 0xDC, 0xD9, 0x06, 0x24}}; | - | ||||||
| 7 | - | |||||||
| 8 | static const crypto_sign_ed25519_ref_fe25519 ge25519_sqrtm1 = {{0xB0, 0xA0, 0x0E, 0x4A, 0x27, 0x1B, 0xEE, 0xC4, 0x78, 0xE4, 0x2F, 0xAD, 0x06, 0x18, 0x43, 0x2F, | - | ||||||
| 9 | 0xA7, 0xD7, 0xFB, 0x3D, 0x99, 0x00, 0x4D, 0x2B, 0x0B, 0xDF, 0xC1, 0x4F, 0x80, 0x24, 0x83, 0x2B}}; | - | ||||||
| 10 | - | |||||||
| 11 | - | |||||||
| 12 | - | |||||||
| 13 | typedef struct | - | ||||||
| 14 | { | - | ||||||
| 15 | crypto_sign_ed25519_ref_fe25519 x; | - | ||||||
| 16 | crypto_sign_ed25519_ref_fe25519 z; | - | ||||||
| 17 | crypto_sign_ed25519_ref_fe25519 y; | - | ||||||
| 18 | crypto_sign_ed25519_ref_fe25519 t; | - | ||||||
| 19 | } ge25519_p1p1; | - | ||||||
| 20 | - | |||||||
| 21 | typedef struct | - | ||||||
| 22 | { | - | ||||||
| 23 | crypto_sign_ed25519_ref_fe25519 x; | - | ||||||
| 24 | crypto_sign_ed25519_ref_fe25519 y; | - | ||||||
| 25 | crypto_sign_ed25519_ref_fe25519 z; | - | ||||||
| 26 | } ge25519_p2; | - | ||||||
| 27 | - | |||||||
| 28 | typedef struct | - | ||||||
| 29 | { | - | ||||||
| 30 | crypto_sign_ed25519_ref_fe25519 x; | - | ||||||
| 31 | crypto_sign_ed25519_ref_fe25519 y; | - | ||||||
| 32 | } ge25519_aff; | - | ||||||
| 33 | - | |||||||
| 34 | - | |||||||
| 35 | - | |||||||
| 36 | const crypto_sign_ed25519_ref_ge25519 crypto_sign_ed25519_ref_ge25519_base = {{{0x1A, 0xD5, 0x25, 0x8F, 0x60, 0x2D, 0x56, 0xC9, 0xB2, 0xA7, 0x25, 0x95, 0x60, 0xC7, 0x2C, 0x69, | - | ||||||
| 37 | 0x5C, 0xDC, 0xD6, 0xFD, 0x31, 0xE2, 0xA4, 0xC0, 0xFE, 0x53, 0x6E, 0xCD, 0xD3, 0x36, 0x69, 0x21}}, | - | ||||||
| 38 | {{0x58, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, | - | ||||||
| 39 | 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66}}, | - | ||||||
| 40 | {{0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | - | ||||||
| 41 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}, | - | ||||||
| 42 | {{0xA3, 0xDD, 0xB7, 0xA5, 0xB3, 0x8A, 0xDE, 0x6D, 0xF5, 0x52, 0x51, 0x77, 0x80, 0x9F, 0xF0, 0x20, | - | ||||||
| 43 | 0x7D, 0xE3, 0xAB, 0x64, 0x8E, 0x4E, 0xEA, 0x66, 0x65, 0x76, 0x8B, 0xD7, 0x0F, 0x5F, 0x87, 0x67}}}; | - | ||||||
| 44 | - | |||||||
| 45 | - | |||||||
| 46 | static const ge25519_aff ge25519_base_multiples_affine[425] = { | - | ||||||
| 47 | }; | - | ||||||
| 48 | - | |||||||
| 49 | static void p1p1_to_p2(ge25519_p2 *r, const ge25519_p1p1 *p) | - | ||||||
| 50 | { | - | ||||||
| 51 | crypto_sign_ed25519_ref_fe25519_mul(&r->x, &p->x, &p->t); | - | ||||||
| 52 | crypto_sign_ed25519_ref_fe25519_mul(&r->y, &p->y, &p->z); | - | ||||||
| 53 | crypto_sign_ed25519_ref_fe25519_mul(&r->z, &p->z, &p->t); | - | ||||||
| 54 | } executed 5340538 times by 2 tests: end of blockExecuted by:
| 5340538 | ||||||
| 55 | - | |||||||
| 56 | static void p1p1_to_p3(crypto_sign_ed25519_ref_ge25519 *r, const ge25519_p1p1 *p) | - | ||||||
| 57 | { | - | ||||||
| 58 | p1p1_to_p2((ge25519_p2 *)r, p); | - | ||||||
| 59 | crypto_sign_ed25519_ref_fe25519_mul(&r->t, &p->x, &p->y); | - | ||||||
| 60 | } executed 1846116 times by 2 tests: end of blockExecuted by:
| 1846116 | ||||||
| 61 | - | |||||||
| 62 | static void ge25519_mixadd2(crypto_sign_ed25519_ref_ge25519 *r, const ge25519_aff *q) | - | ||||||
| 63 | { | - | ||||||
| 64 | crypto_sign_ed25519_ref_fe25519 a,b,t1,t2,c,d,e,f,g,h,qt; | - | ||||||
| 65 | crypto_sign_ed25519_ref_fe25519_mul(&qt, &q->x, &q->y); | - | ||||||
| 66 | crypto_sign_ed25519_ref_fe25519_sub(&a, &r->y, &r->x); | - | ||||||
| 67 | crypto_sign_ed25519_ref_fe25519_add(&b, &r->y, &r->x); | - | ||||||
| 68 | crypto_sign_ed25519_ref_fe25519_sub(&t1, &q->y, &q->x); | - | ||||||
| 69 | crypto_sign_ed25519_ref_fe25519_add(&t2, &q->y, &q->x); | - | ||||||
| 70 | crypto_sign_ed25519_ref_fe25519_mul(&a, &a, &t1); | - | ||||||
| 71 | crypto_sign_ed25519_ref_fe25519_mul(&b, &b, &t2); | - | ||||||
| 72 | crypto_sign_ed25519_ref_fe25519_sub(&e, &b, &a); | - | ||||||
| 73 | crypto_sign_ed25519_ref_fe25519_add(&h, &b, &a); | - | ||||||
| 74 | crypto_sign_ed25519_ref_fe25519_mul(&c, &r->t, &qt); | - | ||||||
| 75 | crypto_sign_ed25519_ref_fe25519_mul(&c, &c, &ge25519_ec2d); | - | ||||||
| 76 | crypto_sign_ed25519_ref_fe25519_add(&d, &r->z, &r->z); | - | ||||||
| 77 | crypto_sign_ed25519_ref_fe25519_sub(&f, &d, &c); | - | ||||||
| 78 | crypto_sign_ed25519_ref_fe25519_add(&g, &d, &c); | - | ||||||
| 79 | crypto_sign_ed25519_ref_fe25519_mul(&r->x, &e, &f); | - | ||||||
| 80 | crypto_sign_ed25519_ref_fe25519_mul(&r->y, &h, &g); | - | ||||||
| 81 | crypto_sign_ed25519_ref_fe25519_mul(&r->z, &g, &f); | - | ||||||
| 82 | crypto_sign_ed25519_ref_fe25519_mul(&r->t, &e, &h); | - | ||||||
| 83 | } executed 6552 times by 3 tests: end of blockExecuted by:
| 6552 | ||||||
| 84 | - | |||||||
| 85 | static void add_p1p1(ge25519_p1p1 *r, const crypto_sign_ed25519_ref_ge25519 *p, const crypto_sign_ed25519_ref_ge25519 *q) | - | ||||||
| 86 | { | - | ||||||
| 87 | crypto_sign_ed25519_ref_fe25519 a, b, c, d, t; | - | ||||||
| 88 | - | |||||||
| 89 | crypto_sign_ed25519_ref_fe25519_sub(&a, &p->y, &p->x); | - | ||||||
| 90 | crypto_sign_ed25519_ref_fe25519_sub(&t, &q->y, &q->x); | - | ||||||
| 91 | crypto_sign_ed25519_ref_fe25519_mul(&a, &a, &t); | - | ||||||
| 92 | crypto_sign_ed25519_ref_fe25519_add(&b, &p->x, &p->y); | - | ||||||
| 93 | crypto_sign_ed25519_ref_fe25519_add(&t, &q->x, &q->y); | - | ||||||
| 94 | crypto_sign_ed25519_ref_fe25519_mul(&b, &b, &t); | - | ||||||
| 95 | crypto_sign_ed25519_ref_fe25519_mul(&c, &p->t, &q->t); | - | ||||||
| 96 | crypto_sign_ed25519_ref_fe25519_mul(&c, &c, &ge25519_ec2d); | - | ||||||
| 97 | crypto_sign_ed25519_ref_fe25519_mul(&d, &p->z, &q->z); | - | ||||||
| 98 | crypto_sign_ed25519_ref_fe25519_add(&d, &d, &d); | - | ||||||
| 99 | crypto_sign_ed25519_ref_fe25519_sub(&r->x, &b, &a); | - | ||||||
| 100 | crypto_sign_ed25519_ref_fe25519_sub(&r->t, &d, &c); | - | ||||||
| 101 | crypto_sign_ed25519_ref_fe25519_add(&r->z, &d, &c); | - | ||||||
| 102 | crypto_sign_ed25519_ref_fe25519_add(&r->y, &b, &a); | - | ||||||
| 103 | } executed 1790428 times by 2 tests: end of blockExecuted by:
| 1790428 | ||||||
| 104 | - | |||||||
| 105 | - | |||||||
| 106 | static void dbl_p1p1(ge25519_p1p1 *r, const ge25519_p2 *p) | - | ||||||
| 107 | { | - | ||||||
| 108 | crypto_sign_ed25519_ref_fe25519 a,b,c,d; | - | ||||||
| 109 | crypto_sign_ed25519_ref_fe25519_square(&a, &p->x); | - | ||||||
| 110 | crypto_sign_ed25519_ref_fe25519_square(&b, &p->y); | - | ||||||
| 111 | crypto_sign_ed25519_ref_fe25519_square(&c, &p->z); | - | ||||||
| 112 | crypto_sign_ed25519_ref_fe25519_add(&c, &c, &c); | - | ||||||
| 113 | crypto_sign_ed25519_ref_fe25519_neg(&d, &a); | - | ||||||
| 114 | - | |||||||
| 115 | crypto_sign_ed25519_ref_fe25519_add(&r->x, &p->x, &p->y); | - | ||||||
| 116 | crypto_sign_ed25519_ref_fe25519_square(&r->x, &r->x); | - | ||||||
| 117 | crypto_sign_ed25519_ref_fe25519_sub(&r->x, &r->x, &a); | - | ||||||
| 118 | crypto_sign_ed25519_ref_fe25519_sub(&r->x, &r->x, &b); | - | ||||||
| 119 | crypto_sign_ed25519_ref_fe25519_add(&r->z, &d, &b); | - | ||||||
| 120 | crypto_sign_ed25519_ref_fe25519_sub(&r->t, &r->z, &c); | - | ||||||
| 121 | crypto_sign_ed25519_ref_fe25519_sub(&r->y, &d, &b); | - | ||||||
| 122 | } executed 3550110 times by 2 tests: end of blockExecuted by:
| 3550110 | ||||||
| 123 | - | |||||||
| 124 | - | |||||||
| 125 | static void cmov_aff(ge25519_aff *r, const ge25519_aff *p, unsigned char b) | - | ||||||
| 126 | { | - | ||||||
| 127 | crypto_sign_ed25519_ref_fe25519_cmov(&r->x, &p->x, b); | - | ||||||
| 128 | crypto_sign_ed25519_ref_fe25519_cmov(&r->y, &p->y, b); | - | ||||||
| 129 | } executed 26520 times by 3 tests: end of blockExecuted by:
| 26520 | ||||||
| 130 | - | |||||||
| 131 | static unsigned char equal(signed char b,signed char c) | - | ||||||
| 132 | { | - | ||||||
| 133 | unsigned char ub = b; | - | ||||||
| 134 | unsigned char uc = c; | - | ||||||
| 135 | unsigned char x = ub ^ uc; | - | ||||||
| 136 | crypto_uint32 y = x; | - | ||||||
| 137 | y -= 1; | - | ||||||
| 138 | y >>= 31; | - | ||||||
| 139 | return executed 46410 times by 3 tests: y;return y;Executed by:
executed 46410 times by 3 tests: return y;Executed by:
| 46410 | ||||||
| 140 | } | - | ||||||
| 141 | - | |||||||
| 142 | static unsigned char negative(signed char b) | - | ||||||
| 143 | { | - | ||||||
| 144 | unsigned long long x = b; | - | ||||||
| 145 | x >>= 63; | - | ||||||
| 146 | return executed 6630 times by 3 tests: x;return x;Executed by:
executed 6630 times by 3 tests: return x;Executed by:
| 6630 | ||||||
| 147 | } | - | ||||||
| 148 | - | |||||||
| 149 | static void choose_t(ge25519_aff *t, unsigned long long pos, signed char b) | - | ||||||
| 150 | { | - | ||||||
| 151 | - | |||||||
| 152 | crypto_sign_ed25519_ref_fe25519 v; | - | ||||||
| 153 | *t = ge25519_base_multiples_affine[5*pos+0]; | - | ||||||
| 154 | cmov_aff(t, &ge25519_base_multiples_affine[5*pos+1],equal(b,1) | equal(b,-1)); | - | ||||||
| 155 | cmov_aff(t, &ge25519_base_multiples_affine[5*pos+2],equal(b,2) | equal(b,-2)); | - | ||||||
| 156 | cmov_aff(t, &ge25519_base_multiples_affine[5*pos+3],equal(b,3) | equal(b,-3)); | - | ||||||
| 157 | cmov_aff(t, &ge25519_base_multiples_affine[5*pos+4],equal(b,-4)); | - | ||||||
| 158 | crypto_sign_ed25519_ref_fe25519_neg(&v, &t->x); | - | ||||||
| 159 | crypto_sign_ed25519_ref_fe25519_cmov(&t->x, &v, negative(b)); | - | ||||||
| 160 | } executed 6630 times by 3 tests: end of blockExecuted by:
| 6630 | ||||||
| 161 | - | |||||||
| 162 | static void setneutral(crypto_sign_ed25519_ref_ge25519 *r) | - | ||||||
| 163 | { | - | ||||||
| 164 | crypto_sign_ed25519_ref_fe25519_setzero(&r->x); | - | ||||||
| 165 | crypto_sign_ed25519_ref_fe25519_setone(&r->y); | - | ||||||
| 166 | crypto_sign_ed25519_ref_fe25519_setone(&r->z); | - | ||||||
| 167 | crypto_sign_ed25519_ref_fe25519_setzero(&r->t); | - | ||||||
| 168 | } executed 13922 times by 2 tests: end of blockExecuted by:
| 13922 | ||||||
| 169 | - | |||||||
| 170 | - | |||||||
| 171 | - | |||||||
| 172 | - | |||||||
| 173 | - | |||||||
| 174 | - | |||||||
| 175 | int crypto_sign_ed25519_ref_unpackneg_vartime(crypto_sign_ed25519_ref_ge25519 *r, const unsigned char p[32]) | - | ||||||
| 176 | { | - | ||||||
| 177 | unsigned char par; | - | ||||||
| 178 | crypto_sign_ed25519_ref_fe25519 t, chk, num, den, den2, den4, den6; | - | ||||||
| 179 | crypto_sign_ed25519_ref_fe25519_setone(&r->z); | - | ||||||
| 180 | par = p[31] >> 7; | - | ||||||
| 181 | crypto_sign_ed25519_ref_fe25519_unpack(&r->y, p); | - | ||||||
| 182 | crypto_sign_ed25519_ref_fe25519_square(&num, &r->y); | - | ||||||
| 183 | crypto_sign_ed25519_ref_fe25519_mul(&den, &num, &ge25519_ecd); | - | ||||||
| 184 | crypto_sign_ed25519_ref_fe25519_sub(&num, &num, &r->z); | - | ||||||
| 185 | crypto_sign_ed25519_ref_fe25519_add(&den, &r->z, &den); | - | ||||||
| 186 | - | |||||||
| 187 | - | |||||||
| 188 | - | |||||||
| 189 | crypto_sign_ed25519_ref_fe25519_square(&den2, &den); | - | ||||||
| 190 | crypto_sign_ed25519_ref_fe25519_square(&den4, &den2); | - | ||||||
| 191 | crypto_sign_ed25519_ref_fe25519_mul(&den6, &den4, &den2); | - | ||||||
| 192 | crypto_sign_ed25519_ref_fe25519_mul(&t, &den6, &num); | - | ||||||
| 193 | crypto_sign_ed25519_ref_fe25519_mul(&t, &t, &den); | - | ||||||
| 194 | - | |||||||
| 195 | crypto_sign_ed25519_ref_fe25519_pow2523(&t, &t); | - | ||||||
| 196 | - | |||||||
| 197 | crypto_sign_ed25519_ref_fe25519_mul(&t, &t, &num); | - | ||||||
| 198 | crypto_sign_ed25519_ref_fe25519_mul(&t, &t, &den); | - | ||||||
| 199 | crypto_sign_ed25519_ref_fe25519_mul(&t, &t, &den); | - | ||||||
| 200 | crypto_sign_ed25519_ref_fe25519_mul(&r->x, &t, &den); | - | ||||||
| 201 | - | |||||||
| 202 | - | |||||||
| 203 | crypto_sign_ed25519_ref_fe25519_square(&chk, &r->x); | - | ||||||
| 204 | crypto_sign_ed25519_ref_fe25519_mul(&chk, &chk, &den); | - | ||||||
| 205 | if (!crypto_sign_ed25519_ref_fe25519_iseq_vartime(&chk, &num)
| 216-14183 | ||||||
| 206 | crypto_sign_ed25519_ref_fe25519_mul(&r->x, &r->x, &ge25519_sqrtm1); executed 14183 times by 2 tests: crypto_sign_ed25519_ref_fe25519_mul(&r->x, &r->x, &ge25519_sqrtm1);Executed by:
| 14183 | ||||||
| 207 | - | |||||||
| 208 | - | |||||||
| 209 | crypto_sign_ed25519_ref_fe25519_square(&chk, &r->x); | - | ||||||
| 210 | crypto_sign_ed25519_ref_fe25519_mul(&chk, &chk, &den); | - | ||||||
| 211 | if (!crypto_sign_ed25519_ref_fe25519_iseq_vartime(&chk, &num)
| 477-13922 | ||||||
| 212 | return executed 477 times by 1 test: -1;return -1;Executed by:
executed 477 times by 1 test: return -1;Executed by:
| 477 | ||||||
| 213 | - | |||||||
| 214 | - | |||||||
| 215 | if(crypto_sign_ed25519_ref_fe25519_getparity(&r->x) != (1-par)
| 227-13695 | ||||||
| 216 | crypto_sign_ed25519_ref_fe25519_neg(&r->x, &r->x); executed 227 times by 2 tests: crypto_sign_ed25519_ref_fe25519_neg(&r->x, &r->x);Executed by:
| 227 | ||||||
| 217 | - | |||||||
| 218 | crypto_sign_ed25519_ref_fe25519_mul(&r->t, &r->x, &r->y); | - | ||||||
| 219 | return executed 13922 times by 2 tests: 0;return 0;Executed by:
executed 13922 times by 2 tests: return 0;Executed by:
| 13922 | ||||||
| 220 | } | - | ||||||
| 221 | - | |||||||
| 222 | void crypto_sign_ed25519_ref_pack(unsigned char r[32], const crypto_sign_ed25519_ref_ge25519 *p) | - | ||||||
| 223 | { | - | ||||||
| 224 | crypto_sign_ed25519_ref_fe25519 tx, ty, zi; | - | ||||||
| 225 | crypto_sign_ed25519_ref_fe25519_invert(&zi, &p->z); | - | ||||||
| 226 | crypto_sign_ed25519_ref_fe25519_mul(&tx, &p->x, &zi); | - | ||||||
| 227 | crypto_sign_ed25519_ref_fe25519_mul(&ty, &p->y, &zi); | - | ||||||
| 228 | crypto_sign_ed25519_ref_fe25519_pack(r, &ty); | - | ||||||
| 229 | r[31] ^= crypto_sign_ed25519_ref_fe25519_getparity(&tx) << 7; | - | ||||||
| 230 | } executed 14000 times by 3 tests: end of blockExecuted by:
| 14000 | ||||||
| 231 | - | |||||||
| 232 | int crypto_sign_ed25519_ref_isneutral_vartime(const crypto_sign_ed25519_ref_ge25519 *p) | - | ||||||
| 233 | { | - | ||||||
| 234 | int ret = 1; | - | ||||||
| 235 | if(!crypto_sign_ed25519_ref_fe25519_iszero(&p->x)
never executed: ret = 0; | 0 | ||||||
| 236 | if(!crypto_sign_ed25519_ref_fe25519_iseq_vartime(&p->y, &p->z)
never executed: ret = 0; | 0 | ||||||
| 237 | return never executed: ret;return ret;never executed: return ret; | 0 | ||||||
| 238 | } | - | ||||||
| 239 | - | |||||||
| 240 | - | |||||||
| 241 | void crypto_sign_ed25519_ref_double_scalarmult_vartime(crypto_sign_ed25519_ref_ge25519 *r, const crypto_sign_ed25519_ref_ge25519 *p1, const crypto_sign_ed25519_ref_sc25519 *s1, const crypto_sign_ed25519_ref_ge25519 *p2, const crypto_sign_ed25519_ref_sc25519 *s2) | - | ||||||
| 242 | { | - | ||||||
| 243 | ge25519_p1p1 tp1p1; | - | ||||||
| 244 | crypto_sign_ed25519_ref_ge25519 pre[16]; | - | ||||||
| 245 | unsigned char b[127]; | - | ||||||
| 246 | int i; | - | ||||||
| 247 | - | |||||||
| 248 | - | |||||||
| 249 | setneutral(pre); | - | ||||||
| 250 | pre[1] = *p1; | - | ||||||
| 251 | dbl_p1p1(&tp1p1,(ge25519_p2 *)p1); p1p1_to_p3( &pre[2], &tp1p1); | - | ||||||
| 252 | add_p1p1(&tp1p1,&pre[1], &pre[2]); p1p1_to_p3( &pre[3], &tp1p1); | - | ||||||
| 253 | pre[4] = *p2; | - | ||||||
| 254 | add_p1p1(&tp1p1,&pre[1], &pre[4]); p1p1_to_p3( &pre[5], &tp1p1); | - | ||||||
| 255 | add_p1p1(&tp1p1,&pre[2], &pre[4]); p1p1_to_p3( &pre[6], &tp1p1); | - | ||||||
| 256 | add_p1p1(&tp1p1,&pre[3], &pre[4]); p1p1_to_p3( &pre[7], &tp1p1); | - | ||||||
| 257 | dbl_p1p1(&tp1p1,(ge25519_p2 *)p2); p1p1_to_p3( &pre[8], &tp1p1); | - | ||||||
| 258 | add_p1p1(&tp1p1,&pre[1], &pre[8]); p1p1_to_p3( &pre[9], &tp1p1); | - | ||||||
| 259 | dbl_p1p1(&tp1p1,(ge25519_p2 *)&pre[5]); p1p1_to_p3(&pre[10], &tp1p1); | - | ||||||
| 260 | add_p1p1(&tp1p1,&pre[3], &pre[8]); p1p1_to_p3(&pre[11], &tp1p1); | - | ||||||
| 261 | add_p1p1(&tp1p1,&pre[4], &pre[8]); p1p1_to_p3(&pre[12], &tp1p1); | - | ||||||
| 262 | add_p1p1(&tp1p1,&pre[1],&pre[12]); p1p1_to_p3(&pre[13], &tp1p1); | - | ||||||
| 263 | add_p1p1(&tp1p1,&pre[2],&pre[12]); p1p1_to_p3(&pre[14], &tp1p1); | - | ||||||
| 264 | add_p1p1(&tp1p1,&pre[3],&pre[12]); p1p1_to_p3(&pre[15], &tp1p1); | - | ||||||
| 265 | - | |||||||
| 266 | crypto_sign_ed25519_ref_sc25519_2interleave2(b,s1,s2); | - | ||||||
| 267 | - | |||||||
| 268 | - | |||||||
| 269 | *r = pre[b[126]]; | - | ||||||
| 270 | for(i=125;i>=0
| 13922-1754172 | ||||||
| 271 | { | - | ||||||
| 272 | dbl_p1p1(&tp1p1, (ge25519_p2 *)r); | - | ||||||
| 273 | p1p1_to_p2((ge25519_p2 *) r, &tp1p1); | - | ||||||
| 274 | dbl_p1p1(&tp1p1, (ge25519_p2 *)r); | - | ||||||
| 275 | if(b[i]!=0
| 102964-1651208 | ||||||
| 276 | { | - | ||||||
| 277 | p1p1_to_p3(r, &tp1p1); | - | ||||||
| 278 | add_p1p1(&tp1p1, r, &pre[b[i]]); | - | ||||||
| 279 | } executed 1651208 times by 2 tests: end of blockExecuted by:
| 1651208 | ||||||
| 280 | if(i != 0
executed 1740250 times by 2 tests: p1p1_to_p2((ge25519_p2 *)r, &tp1p1);Executed by:
| 13922-1740250 | ||||||
| 281 | else p1p1_to_p3(r, &tp1p1); executed 13922 times by 2 tests: p1p1_to_p3(r, &tp1p1);Executed by:
| 13922 | ||||||
| 282 | } | - | ||||||
| 283 | } executed 13922 times by 2 tests: end of blockExecuted by:
| 13922 | ||||||
| 284 | - | |||||||
| 285 | void crypto_sign_ed25519_ref_scalarmult_base(crypto_sign_ed25519_ref_ge25519 *r, const crypto_sign_ed25519_ref_sc25519 *s) | - | ||||||
| 286 | { | - | ||||||
| 287 | signed char b[85]; | - | ||||||
| 288 | int i; | - | ||||||
| 289 | ge25519_aff t; | - | ||||||
| 290 | crypto_sign_ed25519_ref_sc25519_window3(b,s); | - | ||||||
| 291 | - | |||||||
| 292 | choose_t((ge25519_aff *)r, 0, b[0]); | - | ||||||
| 293 | crypto_sign_ed25519_ref_fe25519_setone(&r->z); | - | ||||||
| 294 | crypto_sign_ed25519_ref_fe25519_mul(&r->t, &r->x, &r->y); | - | ||||||
| 295 | for(i=1;i<85
| 78-6552 | ||||||
| 296 | { | - | ||||||
| 297 | choose_t(&t, (unsigned long long) i, b[i]); | - | ||||||
| 298 | ge25519_mixadd2(r, &t); | - | ||||||
| 299 | } executed 6552 times by 3 tests: end of blockExecuted by:
| 6552 | ||||||
| 300 | } executed 78 times by 3 tests: end of blockExecuted by:
| 78 | ||||||
| Switch to Source code | Preprocessed file |