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

Side by Side Diff: patches/nss-chacha20-poly1305.patch

Issue 515383002: Avoids MSVC warnings about possible value truncation. (Closed) Base URL: http://src.chromium.org/svn/trunk/deps/third_party/nss
Patch Set: Created 6 years, 3 months 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
OLDNEW
1 diff -r c3565a90b8c4 lib/freebl/blapi.h 1 diff -r c3565a90b8c4 lib/freebl/blapi.h
2 --- a/lib/freebl/blapi.h Fri Jan 03 20:59:10 2014 +0100 2 --- a/lib/freebl/blapi.h Fri Jan 03 20:59:10 2014 +0100
3 +++ b/lib/freebl/blapi.h Tue Jan 07 12:11:36 2014 -0800 3 +++ b/lib/freebl/blapi.h Tue Jan 07 12:11:36 2014 -0800
4 @@ -986,6 +986,38 @@ 4 @@ -986,6 +986,38 @@
5 unsigned int *outputLen, unsigned int maxOutputLen, 5 unsigned int *outputLen, unsigned int maxOutputLen,
6 const unsigned char *input, unsigned int inputLen); 6 const unsigned char *input, unsigned int inputLen);
7 7
8 +/******************************************/ 8 +/******************************************/
9 +/* 9 +/*
10 +** ChaCha20+Poly1305 AEAD 10 +** ChaCha20+Poly1305 AEAD
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 + input[8] = U8TO32_LITTLE(key + 16); 136 + input[8] = U8TO32_LITTLE(key + 16);
137 + input[9] = U8TO32_LITTLE(key + 20); 137 + input[9] = U8TO32_LITTLE(key + 20);
138 + input[10] = U8TO32_LITTLE(key + 24); 138 + input[10] = U8TO32_LITTLE(key + 24);
139 + input[11] = U8TO32_LITTLE(key + 28); 139 + input[11] = U8TO32_LITTLE(key + 28);
140 + 140 +
141 + input[0] = U8TO32_LITTLE(sigma + 0); 141 + input[0] = U8TO32_LITTLE(sigma + 0);
142 + input[1] = U8TO32_LITTLE(sigma + 4); 142 + input[1] = U8TO32_LITTLE(sigma + 4);
143 + input[2] = U8TO32_LITTLE(sigma + 8); 143 + input[2] = U8TO32_LITTLE(sigma + 8);
144 + input[3] = U8TO32_LITTLE(sigma + 12); 144 + input[3] = U8TO32_LITTLE(sigma + 12);
145 + 145 +
146 + input[12] = counter; 146 + input[12] = (PRUint32)counter;
147 + input[13] = counter >> 32; 147 + input[13] = counter >> 32;
agl 2014/08/28 20:51:30 ditto.
148 + input[14] = U8TO32_LITTLE(nonce + 0); 148 + input[14] = U8TO32_LITTLE(nonce + 0);
149 + input[15] = U8TO32_LITTLE(nonce + 4); 149 + input[15] = U8TO32_LITTLE(nonce + 4);
150 + 150 +
151 + while (inLen >= 64) { 151 + while (inLen >= 64) {
152 + ChaChaCore(block, input, 20); 152 + ChaChaCore(block, input, 20);
153 + for (i = 0; i < 64; i++) { 153 + for (i = 0; i < 64; i++) {
154 + out[i] = in[i] ^ block[i]; 154 + out[i] = in[i] ^ block[i];
155 + } 155 + }
156 + 156 +
157 + input[12]++; 157 + input[12]++;
(...skipping 1389 matching lines...) Expand 10 before | Expand all | Expand 10 after
1547 + state->h1 = (state->h1 & nb) | (g1 & b); 1547 + state->h1 = (state->h1 & nb) | (g1 & b);
1548 + state->h2 = (state->h2 & nb) | (g2 & b); 1548 + state->h2 = (state->h2 & nb) | (g2 & b);
1549 + state->h3 = (state->h3 & nb) | (g3 & b); 1549 + state->h3 = (state->h3 & nb) | (g3 & b);
1550 + state->h4 = (state->h4 & nb) | (g4 & b); 1550 + state->h4 = (state->h4 & nb) | (g4 & b);
1551 + 1551 +
1552 + f0 = ((state->h0 ) | (state->h1 << 26)) + (uint64_t)U8TO32_LE(&stat e->key[0]); 1552 + f0 = ((state->h0 ) | (state->h1 << 26)) + (uint64_t)U8TO32_LE(&stat e->key[0]);
1553 + f1 = ((state->h1 >> 6) | (state->h2 << 20)) + (uint64_t)U8TO32_LE(&stat e->key[4]); 1553 + f1 = ((state->h1 >> 6) | (state->h2 << 20)) + (uint64_t)U8TO32_LE(&stat e->key[4]);
1554 + f2 = ((state->h2 >> 12) | (state->h3 << 14)) + (uint64_t)U8TO32_LE(&stat e->key[8]); 1554 + f2 = ((state->h2 >> 12) | (state->h3 << 14)) + (uint64_t)U8TO32_LE(&stat e->key[8]);
1555 + f3 = ((state->h3 >> 18) | (state->h4 << 8)) + (uint64_t)U8TO32_LE(&stat e->key[12]); 1555 + f3 = ((state->h3 >> 18) | (state->h4 << 8)) + (uint64_t)U8TO32_LE(&stat e->key[12]);
1556 + 1556 +
1557 +» U32TO8_LE(&mac[ 0], f0); f1 += (f0 >> 32); 1557 +» U32TO8_LE(&mac[ 0], (uint32_t)f0); f1 += (f0 >> 32);
1558 +» U32TO8_LE(&mac[ 4], f1); f2 += (f1 >> 32); 1558 +» U32TO8_LE(&mac[ 4], (uint32_t)f1); f2 += (f1 >> 32);
1559 +» U32TO8_LE(&mac[ 8], f2); f3 += (f2 >> 32); 1559 +» U32TO8_LE(&mac[ 8], (uint32_t)f2); f3 += (f2 >> 32);
1560 +» U32TO8_LE(&mac[12], f3); 1560 +» U32TO8_LE(&mac[12], (uint32_t)f3);
1561 +} 1561 +}
1562 diff -r c3565a90b8c4 lib/freebl/poly1305/poly1305.h 1562 diff -r c3565a90b8c4 lib/freebl/poly1305/poly1305.h
1563 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1563 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1564 +++ b/lib/freebl/poly1305/poly1305.h Tue Jan 07 12:11:36 2014 -0800 1564 +++ b/lib/freebl/poly1305/poly1305.h Tue Jan 07 12:11:36 2014 -0800
1565 @@ -0,0 +1,31 @@ 1565 @@ -0,0 +1,31 @@
1566 +/* 1566 +/*
1567 + * poly1305.h - header file for Poly1305 implementation. 1567 + * poly1305.h - header file for Poly1305 implementation.
1568 + * 1568 + *
1569 + * This Source Code Form is subject to the terms of the Mozilla Public 1569 + * This Source Code Form is subject to the terms of the Mozilla Public
1570 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1570 + * License, v. 2.0. If a copy of the MPL was not distributed with this
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
1859 + CK_BYTE_PTR pIv; /* This is the nonce. */ 1859 + CK_BYTE_PTR pIv; /* This is the nonce. */
1860 + CK_ULONG ulIvLen; 1860 + CK_ULONG ulIvLen;
1861 + CK_BYTE_PTR pAAD; 1861 + CK_BYTE_PTR pAAD;
1862 + CK_ULONG ulAADLen; 1862 + CK_ULONG ulAADLen;
1863 + CK_ULONG ulTagLen; 1863 + CK_ULONG ulTagLen;
1864 +} CK_NSS_AEAD_PARAMS; 1864 +} CK_NSS_AEAD_PARAMS;
1865 + 1865 +
1866 /* 1866 /*
1867 * NSS-defined return values 1867 * NSS-defined return values
1868 * 1868 *
OLDNEW
« nss/lib/freebl/chacha20/chacha20.c ('K') | « nss/lib/freebl/poly1305/poly1305.c ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698