Left: | ||
Right: |
LEFT | RIGHT |
---|---|
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 | 10 |
11 #include "poly1305.h" | 11 #include "poly1305.h" |
12 | 12 |
13 #if defined(_MSC_VER) && _MSC_VER < 1600 | 13 #if defined(_MSC_VER) && _MSC_VER < 1600 |
14 #include <prtypes.h> | 14 #include "prtypes.h" |
wtc1
2016/02/10 21:09:02
Same here.
ttaubert
2016/02/11 07:38:38
Done.
| |
15 typedef PRUint32 uint32_t; | 15 typedef PRUint32 uint32_t; |
16 typedef PRUint64 uint64_t; | 16 typedef PRUint64 uint64_t; |
17 #else | 17 #else |
18 #include <stdint.h> | 18 #include <stdint.h> |
19 #endif | 19 #endif |
20 | 20 |
21 #if defined(NSS_X86) || defined(NSS_X64) | 21 #if defined(NSS_X86) || defined(NSS_X64) |
22 /* We can assume little-endian. */ | 22 /* We can assume little-endian. */ |
23 static uint32_t U8TO32_LE(const unsigned char *m) { | 23 static uint32_t U8TO32_LE(const unsigned char *m) { |
24 uint32_t r; | 24 uint32_t r; |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
252 f0 = ((state->h0 ) | (state->h1 << 26)) + (uint64_t)U8TO32_LE(&stat e->key[0]); | 252 f0 = ((state->h0 ) | (state->h1 << 26)) + (uint64_t)U8TO32_LE(&stat e->key[0]); |
253 f1 = ((state->h1 >> 6) | (state->h2 << 20)) + (uint64_t)U8TO32_LE(&stat e->key[4]); | 253 f1 = ((state->h1 >> 6) | (state->h2 << 20)) + (uint64_t)U8TO32_LE(&stat e->key[4]); |
254 f2 = ((state->h2 >> 12) | (state->h3 << 14)) + (uint64_t)U8TO32_LE(&stat e->key[8]); | 254 f2 = ((state->h2 >> 12) | (state->h3 << 14)) + (uint64_t)U8TO32_LE(&stat e->key[8]); |
255 f3 = ((state->h3 >> 18) | (state->h4 << 8)) + (uint64_t)U8TO32_LE(&stat e->key[12]); | 255 f3 = ((state->h3 >> 18) | (state->h4 << 8)) + (uint64_t)U8TO32_LE(&stat e->key[12]); |
256 | 256 |
257 U32TO8_LE(&mac[ 0], (uint32_t)f0); f1 += (f0 >> 32); | 257 U32TO8_LE(&mac[ 0], (uint32_t)f0); f1 += (f0 >> 32); |
258 U32TO8_LE(&mac[ 4], (uint32_t)f1); f2 += (f1 >> 32); | 258 U32TO8_LE(&mac[ 4], (uint32_t)f1); f2 += (f1 >> 32); |
259 U32TO8_LE(&mac[ 8], (uint32_t)f2); f3 += (f2 >> 32); | 259 U32TO8_LE(&mac[ 8], (uint32_t)f2); f3 += (f2 >> 32); |
260 U32TO8_LE(&mac[12], (uint32_t)f3); | 260 U32TO8_LE(&mac[12], (uint32_t)f3); |
261 } | 261 } |
LEFT | RIGHT |