OLD | NEW |
1 /* This Source Code Form is subject to the terms of the Mozilla Public | 1 /* This Source Code Form is subject to the terms of the Mozilla Public |
2 * License, v. 2.0. If a copy of the MPL was not distributed with this | 2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
4 | 4 |
5 /* This implementation of poly1305 is by Andrew Moon | 5 /* This implementation of poly1305 is by Andrew Moon |
6 * (https://github.com/floodyberry/poly1305-donna) and released as public | 6 * (https://github.com/floodyberry/poly1305-donna) and released as public |
7 * domain. */ | 7 * domain. */ |
8 | 8 |
9 #include <string.h> | 9 #include <string.h> |
10 #include <stdint.h> | 10 #include <stdint.h> |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 state->h1 = (state->h1 & nb) | (g1 & b); | 240 state->h1 = (state->h1 & nb) | (g1 & b); |
241 state->h2 = (state->h2 & nb) | (g2 & b); | 241 state->h2 = (state->h2 & nb) | (g2 & b); |
242 state->h3 = (state->h3 & nb) | (g3 & b); | 242 state->h3 = (state->h3 & nb) | (g3 & b); |
243 state->h4 = (state->h4 & nb) | (g4 & b); | 243 state->h4 = (state->h4 & nb) | (g4 & b); |
244 | 244 |
245 f0 = ((state->h0 ) | (state->h1 << 26)) + (uint64_t)U8TO32_LE(&stat
e->key[0]); | 245 f0 = ((state->h0 ) | (state->h1 << 26)) + (uint64_t)U8TO32_LE(&stat
e->key[0]); |
246 f1 = ((state->h1 >> 6) | (state->h2 << 20)) + (uint64_t)U8TO32_LE(&stat
e->key[4]); | 246 f1 = ((state->h1 >> 6) | (state->h2 << 20)) + (uint64_t)U8TO32_LE(&stat
e->key[4]); |
247 f2 = ((state->h2 >> 12) | (state->h3 << 14)) + (uint64_t)U8TO32_LE(&stat
e->key[8]); | 247 f2 = ((state->h2 >> 12) | (state->h3 << 14)) + (uint64_t)U8TO32_LE(&stat
e->key[8]); |
248 f3 = ((state->h3 >> 18) | (state->h4 << 8)) + (uint64_t)U8TO32_LE(&stat
e->key[12]); | 248 f3 = ((state->h3 >> 18) | (state->h4 << 8)) + (uint64_t)U8TO32_LE(&stat
e->key[12]); |
249 | 249 |
250 » U32TO8_LE(&mac[ 0], f0); f1 += (f0 >> 32); | 250 » U32TO8_LE(&mac[ 0], (uint32_t)f0); f1 += (f0 >> 32); |
251 » U32TO8_LE(&mac[ 4], f1); f2 += (f1 >> 32); | 251 » U32TO8_LE(&mac[ 4], (uint32_t)f1); f2 += (f1 >> 32); |
252 » U32TO8_LE(&mac[ 8], f2); f3 += (f2 >> 32); | 252 » U32TO8_LE(&mac[ 8], (uint32_t)f2); f3 += (f2 >> 32); |
253 » U32TO8_LE(&mac[12], f3); | 253 » U32TO8_LE(&mac[12], (uint32_t)f3); |
254 } | 254 } |
OLD | NEW |