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

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: Added missing licences. Created 7 years, 11 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
« no previous file with comments | « third_party/scrypt/README.chromium ('k') | third_party/scrypt/config.aux/depcomp » ('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 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/lib/util/warn.h b/third_party/scrypt/lib/util/wa rn.h
41 index 262d24b..4ebc7e5 100644
42 --- a/third_party/scrypt/lib/util/warn.h
43 +++ b/third_party/scrypt/lib/util/warn.h
44 @@ -1,3 +1,32 @@
45 +/*-
46 + * Copyright 2009 Colin Percival
47 + * All rights reserved.
48 + *
49 + * Redistribution and use in source and binary forms, with or without
50 + * modification, are permitted provided that the following conditions
51 + * are met:
52 + * 1. Redistributions of source code must retain the above copyright
53 + * notice, this list of conditions and the following disclaimer.
54 + * 2. Redistributions in binary form must reproduce the above copyright
55 + * notice, this list of conditions and the following disclaimer in the
56 + * documentation and/or other materials provided with the distribution.
57 + *
58 + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
59 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
60 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
61 + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
62 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
63 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
64 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
65 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
66 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
67 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
68 + * SUCH DAMAGE.
69 + *
70 + * This file was originally written by Colin Percival as part of the Tarsnap
71 + * online backup system.
72 + */
73 +
74 #ifndef _WARN_H_
75 #define _WARN_H_
76
77 diff --git a/third_party/scrypt/scrypt_platform.h b/third_party/scrypt/scrypt_pl atform.h
78 index 5cec236..8e406f3 100644
79 --- a/third_party/scrypt/scrypt_platform.h
80 +++ b/third_party/scrypt/scrypt_platform.h
81 @@ -1,3 +1,32 @@
82 +/*-
83 + * Copyright 2009 Colin Percival
84 + * All rights reserved.
85 + *
86 + * Redistribution and use in source and binary forms, with or without
87 + * modification, are permitted provided that the following conditions
88 + * are met:
89 + * 1. Redistributions of source code must retain the above copyright
90 + * notice, this list of conditions and the following disclaimer.
91 + * 2. Redistributions in binary form must reproduce the above copyright
92 + * notice, this list of conditions and the following disclaimer in the
93 + * documentation and/or other materials provided with the distribution.
94 + *
95 + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
96 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
97 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
98 + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
99 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
100 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
101 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
102 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
103 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
104 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
105 + * SUCH DAMAGE.
106 + *
107 + * This file was originally written by Colin Percival as part of the Tarsnap
108 + * online backup system.
109 + */
110 +
111 #ifndef _SCRYPT_PLATFORM_H_
112 #define _SCRYPT_PLATFORM_H_
113
114 @@ -6,7 +35,7 @@
115 #elif defined(HAVE_CONFIG_H)
116 #include "config.h"
117 #else
118 -#error Need either CONFIG_H_FILE or HAVE_CONFIG_H defined.
119 +/* GOOGLE: assume all defines are done on the command line */
120 #endif
121
122 #endif /* !_SCRYPT_PLATFORM_H_ */
123 diff --git a/third_party/scrypt/sysendian.h b/third_party/scrypt/sysendian.h
124 new file mode 100644
125 index 0000000..c147511
126 --- /dev/null
127 +++ b/third_party/scrypt/sysendian.h
128 @@ -0,0 +1,42 @@
129 +/*
130 + * Copyright (c) 2012 The Chromium Authors. All rights reserved.
131 + * Use of this source code is governed by a BSD-style license.
132 + *
133 + * Some functions commonly found in sys/endian.h, a header file not available
134 + * on Windows platforms.
135 + */
136 +
137 +#ifndef _SCRYPT_SYSENDIAN_H
138 +#define _SCRYPT_SYSENDIAN_H
139 +
140 +static __inline void be32enc(void *buf, uint32_t u)
141 +{
142 + uint8_t *p = (uint8_t *)buf;
143 + p[0] = (uint8_t)((u >> 24) & 0xff);
144 + p[1] = (uint8_t)((u >> 16) & 0xff);
145 + p[2] = (uint8_t)((u >> 8) & 0xff);
146 + p[3] = (uint8_t)(u & 0xff);
147 +}
148 +
149 +static __inline void le32enc(void *buf, uint32_t u)
150 +{
151 + uint8_t *p = (uint8_t *)buf;
152 + p[0] = (uint8_t)(u & 0xff);
153 + p[1] = (uint8_t)((u >> 8) & 0xff);
154 + p[2] = (uint8_t)((u >> 16) & 0xff);
155 + p[3] = (uint8_t)((u >> 24) & 0xff);
156 +}
157 +
158 +static __inline uint32_t be32dec(const void *buf)
159 +{
160 + const uint8_t *p = (const uint8_t *)buf;
161 + return ((p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]);
162 +}
163 +
164 +static __inline uint32_t le32dec(const void *buf)
165 +{
166 + const uint8_t *p = (const uint8_t *)buf;
167 + return ((p[3] << 24) | (p[2] << 16) | (p[1] << 8) | p[0]);
168 +}
169 +
170 +#endif // _SCRYPT_SYSENDIAN_H
OLDNEW
« no previous file with comments | « third_party/scrypt/README.chromium ('k') | third_party/scrypt/config.aux/depcomp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698