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

Unified Diff: nss/lib/freebl/poly1305/poly1305.c

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/chacha20/chacha20.c ('k') | patches/nss-chacha20-poly1305.patch » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: nss/lib/freebl/poly1305/poly1305.c
diff --git a/nss/lib/freebl/poly1305/poly1305.c b/nss/lib/freebl/poly1305/poly1305.c
index 1220638b32b544bb6ee7c18611c6f69fe61015cf..d86048a4efe7f7408192068763806d685aa3ae22 100644
--- a/nss/lib/freebl/poly1305/poly1305.c
+++ b/nss/lib/freebl/poly1305/poly1305.c
@@ -247,8 +247,8 @@ void Poly1305Finish(poly1305_state *statep, unsigned char mac[16]) {
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);
}
« no previous file with comments | « nss/lib/freebl/chacha20/chacha20.c ('k') | patches/nss-chacha20-poly1305.patch » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698