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

Side by Side Diff: net/third_party/nss/ssl/bodge/secure_memcmp.c

Issue 394003: Linux: enable building with a local version of libssl. (Closed)
Patch Set: ... Created 11 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
« no previous file with comments | « net/third_party/nss/ssl/bodge/nssrenam.h ('k') | net/third_party/nss/ssl/cmpcert.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // This file exists to provide the secure memcmp function. This was added in
2 // NSS 3.12.5.
3
4 #include <stdlib.h>
5
6 /*
7 * Perform a constant-time compare of two memory regions. The return value is
8 * 0 if the memory regions are equal and non-zero otherwise.
9 */
10 int
11 NSS_SecureMemcmp(const void *ia, const void *ib, size_t n)
12 {
13 const unsigned char *a = (const unsigned char*) ia;
14 const unsigned char *b = (const unsigned char*) ib;
15 size_t i;
16 unsigned char r = 0;
17
18 for (i = 0; i < n; ++i) {
19 r |= *a++ ^ *b++;
20 }
21
22 return r;
23 }
OLDNEW
« no previous file with comments | « net/third_party/nss/ssl/bodge/nssrenam.h ('k') | net/third_party/nss/ssl/cmpcert.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698