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

Side by Side Diff: third_party/scrypt/chromium.patch

Issue 11637016: Add "scrypt" to third_party for secure password hashes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add scrypt to .gitignore Created 8 years 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
(Empty)
1 diff --git a/third_party/scrypt/lib/crypto/crypto_scrypt-nosse.c b/third_party/s crypt/lib/crypto/crypto_scrypt-nosse.c
2 index cad4d0e..8adecff 100644
3 --- a/third_party/scrypt/lib/crypto/crypto_scrypt-nosse.c
4 +++ b/third_party/scrypt/lib/crypto/crypto_scrypt-nosse.c
5 @@ -29,7 +29,7 @@
6 #include "scrypt_platform.h"
7
8 #include <sys/types.h>
9 -#include <sys/mman.h>
10 +//#include <sys/mman.h> // GOOGLE (not available on all platforms)
11
12 #include <errno.h>
13 #include <stdint.h>
14 diff --git a/third_party/scrypt/lib/crypto/crypto_scrypt.h b/third_party/scrypt/ lib/crypto/crypto_scrypt.h
15 index f72e1f4..0b7909a 100644
16 --- a/third_party/scrypt/lib/crypto/crypto_scrypt.h
17 +++ b/third_party/scrypt/lib/crypto/crypto_scrypt.h
18 @@ -31,6 +31,11 @@
19
20 #include <stdint.h>
21
22 +// GOOGLE
23 +#ifdef __cplusplus
24 +extern "C" {
25 +#endif
26 +
27 /**
28 * crypto_scrypt(passwd, passwdlen, salt, saltlen, N, r, p, buf, buflen):
29 * Compute scrypt(passwd[0 .. passwdlen - 1], salt[0 .. saltlen - 1], N, r,
30 @@ -43,4 +48,9 @@
31 int crypto_scrypt(const uint8_t *, size_t, const uint8_t *, size_t, uint64_t,
32 uint32_t, uint32_t, uint8_t *, size_t);
33
34 +// GOOGLE
35 +#ifdef __cplusplus
36 +}
37 +#endif
38 +
39 #endif /* !_CRYPTO_SCRYPT_H_ */
40 diff --git a/third_party/scrypt/scrypt_platform.h b/third_party/scrypt/scrypt_pl atform.h
41 index 5cec236..e7bc977 100644
42 --- a/third_party/scrypt/scrypt_platform.h
43 +++ b/third_party/scrypt/scrypt_platform.h
44 @@ -6,7 +6,7 @@
45 #elif defined(HAVE_CONFIG_H)
46 #include "config.h"
47 #else
48 -#error Need either CONFIG_H_FILE or HAVE_CONFIG_H defined.
49 +/* GOOGLE: assume all defines are done on the command line */
50 #endif
51
52 #endif /* !_SCRYPT_PLATFORM_H_ */
53 diff --git a/third_party/scrypt/sysendian.h b/third_party/scrypt/sysendian.h
54 new file mode 100644
55 index 0000000..6b73e9d
56 --- /dev/null
57 +++ b/third_party/scrypt/sysendian.h
58 @@ -0,0 +1,42 @@
59 +/*
60 + * Copyright (c) 2012 The Chromium Authors. All rights reserved.
61 + * Use of this source code is governed by a BSD-style license.
62 + *
63 + * Some functions commonly found in sys/endian.h, a header file not available
64 + * on Windows platforms.
65 + */
66 +
67 +#ifndef _SCRYPT_SYSENDIAN_H
68 +#define _SCRYPT_SYSENDIAN_H
69 +
70 +static __inline void be32enc(void *buf, uint32_t u)
71 +{
72 + uint8_t *p = (uint8_t *)buf;
73 + p[0] = (uint8_t)((u >> 24) & 0xff);
74 + p[1] = (uint8_t)((u >> 16) & 0xff);
75 + p[2] = (uint8_t)((u >> 8) & 0xff);
76 + p[3] = (uint8_t)(u & 0xff);
77 +}
78 +
79 +static __inline void le32enc(void *buf, uint32_t u)
80 +{
81 + uint8_t *p = (uint8_t *)buf;
82 + p[0] = (uint8_t)(u & 0xff);
83 + p[1] = (uint8_t)((u >> 8) & 0xff);
84 + p[2] = (uint8_t)((u >> 16) & 0xff);
85 + p[3] = (uint8_t)((u >> 24) & 0xff);
86 +}
87 +
88 +static __inline uint32_t be32dec(const void *buf)
89 +{
90 + const uint8_t *p = (const uint8_t *)buf;
91 + return ((p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]);
92 +}
93 +
94 +static __inline uint32_t le32dec(const void *buf)
95 +{
96 + const uint8_t *p = (const uint8_t *)buf;
97 + return ((p[3] << 24) | (p[2] << 16) | (p[1] << 8) | p[0]);
98 +}
99 +
100 +#endif // _SCRYPT_SYSENDIAN_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698