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

Unified 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: Also add a PRUint32 cast to counter >> 32. Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « nss/lib/freebl/poly1305/poly1305.c ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: patches/nss-chacha20-poly1305.patch
diff --git a/patches/nss-chacha20-poly1305.patch b/patches/nss-chacha20-poly1305.patch
index 38fb1bce0b111a4d834a5903b0f38548d2b478d7..f6c13a8a19a96f551535a49750e31699202626d4 100644
--- a/patches/nss-chacha20-poly1305.patch
+++ b/patches/nss-chacha20-poly1305.patch
@@ -143,8 +143,8 @@ diff -r c3565a90b8c4 lib/freebl/chacha20/chacha20.c
+ input[2] = U8TO32_LITTLE(sigma + 8);
+ input[3] = U8TO32_LITTLE(sigma + 12);
+
-+ input[12] = counter;
-+ input[13] = counter >> 32;
++ input[12] = (PRUint32)counter;
++ input[13] = (PRUint32)(counter >> 32);
+ input[14] = U8TO32_LITTLE(nonce + 0);
+ input[15] = U8TO32_LITTLE(nonce + 4);
+
@@ -1554,10 +1554,10 @@ diff -r c3565a90b8c4 lib/freebl/poly1305/poly1305.c
+ f2 = ((state->h2 >> 12) | (state->h3 << 14)) + (uint64_t)U8TO32_LE(&state->key[8]);
+ f3 = ((state->h3 >> 18) | (state->h4 << 8)) + (uint64_t)U8TO32_LE(&state->key[12]);
+
-+ U32TO8_LE(&mac[ 0], f0); f1 += (f0 >> 32);
-+ U32TO8_LE(&mac[ 4], f1); f2 += (f1 >> 32);
-+ U32TO8_LE(&mac[ 8], f2); f3 += (f2 >> 32);
-+ U32TO8_LE(&mac[12], f3);
++ U32TO8_LE(&mac[ 0], (uint32_t)f0); f1 += (f0 >> 32);
++ U32TO8_LE(&mac[ 4], (uint32_t)f1); f2 += (f1 >> 32);
++ U32TO8_LE(&mac[ 8], (uint32_t)f2); f3 += (f2 >> 32);
++ U32TO8_LE(&mac[12], (uint32_t)f3);
+}
diff -r c3565a90b8c4 lib/freebl/poly1305/poly1305.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
« no previous file with comments | « nss/lib/freebl/poly1305/poly1305.c ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698