Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: nss/lib/freebl/poly1305/poly1305.c

Issue 51333008: Typo fix for non-x86 builds. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/nss/
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
11 11
12 #include "poly1305.h" 12 #include "poly1305.h"
13 13
14 #if defined(NSS_X86) || defined(NSS_X64) 14 #if defined(NSS_X86) || defined(NSS_X64)
15 /* We can assume little-endian. */ 15 /* We can assume little-endian. */
16 static uint32_t U8TO32_LE(const unsigned char *m) { 16 static uint32_t U8TO32_LE(const unsigned char *m) {
17 uint32_t r; 17 uint32_t r;
18 memcpy(&r, m, sizeof(r)); 18 memcpy(&r, m, sizeof(r));
19 return r; 19 return r;
20 } 20 }
21 21
22 static void U32TO8_LE(unsigned char *m, uint32_t v) { 22 static void U32TO8_LE(unsigned char *m, uint32_t v) {
23 memcpy(m, &v, sizeof(v)); 23 memcpy(m, &v, sizeof(v));
24 } 24 }
25 #else 25 #else
26 static void U8TO32_LE(const unsigned char *m) { 26 static uint32_t U8TO32_LE(const unsigned char *m) {
27 return (uint32_t)m[0] | 27 return (uint32_t)m[0] |
28 (uint32_t)m[1] << 8 | 28 (uint32_t)m[1] << 8 |
29 (uint32_t)m[2] << 16 | 29 (uint32_t)m[2] << 16 |
30 (uint32_t)m[3] << 24; 30 (uint32_t)m[3] << 24;
31 } 31 }
32 32
33 static void U32TO8_LE(unsigned char *m, uint32_t v) { 33 static void U32TO8_LE(unsigned char *m, uint32_t v) {
34 m[0] = v; 34 m[0] = v;
35 m[1] = v >> 8; 35 m[1] = v >> 8;
36 m[2] = v >> 16; 36 m[2] = v >> 16;
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
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], f0); f1 += (f0 >> 32);
251 U32TO8_LE(&mac[ 4], f1); f2 += (f1 >> 32); 251 U32TO8_LE(&mac[ 4], f1); f2 += (f1 >> 32);
252 U32TO8_LE(&mac[ 8], f2); f3 += (f2 >> 32); 252 U32TO8_LE(&mac[ 8], f2); f3 += (f2 >> 32);
253 U32TO8_LE(&mac[12], f3); 253 U32TO8_LE(&mac[12], f3);
254 } 254 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698