Index: third_party/scrypt/chromium.patch
|
diff --git a/third_party/scrypt/chromium.patch b/third_party/scrypt/chromium.patch
|
new file mode 100644
|
index 0000000000000000000000000000000000000000..04a48d460b6b0134f004ee9d344b90ea9263ae75
|
--- /dev/null
|
+++ b/third_party/scrypt/chromium.patch
|
@@ -0,0 +1,170 @@
|
+diff --git a/third_party/scrypt/lib/crypto/crypto_scrypt-nosse.c b/third_party/scrypt/lib/crypto/crypto_scrypt-nosse.c
|
+index cad4d0e..8adecff 100644
|
+--- a/third_party/scrypt/lib/crypto/crypto_scrypt-nosse.c
|
++++ b/third_party/scrypt/lib/crypto/crypto_scrypt-nosse.c
|
+@@ -29,7 +29,7 @@
|
+ #include "scrypt_platform.h"
|
+
|
+ #include <sys/types.h>
|
+-#include <sys/mman.h>
|
++//#include <sys/mman.h> // GOOGLE (not available on all platforms)
|
+
|
+ #include <errno.h>
|
+ #include <stdint.h>
|
+diff --git a/third_party/scrypt/lib/crypto/crypto_scrypt.h b/third_party/scrypt/lib/crypto/crypto_scrypt.h
|
+index f72e1f4..0b7909a 100644
|
+--- a/third_party/scrypt/lib/crypto/crypto_scrypt.h
|
++++ b/third_party/scrypt/lib/crypto/crypto_scrypt.h
|
+@@ -31,6 +31,11 @@
|
+
|
+ #include <stdint.h>
|
+
|
++// GOOGLE
|
++#ifdef __cplusplus
|
++extern "C" {
|
++#endif
|
++
|
+ /**
|
+ * crypto_scrypt(passwd, passwdlen, salt, saltlen, N, r, p, buf, buflen):
|
+ * Compute scrypt(passwd[0 .. passwdlen - 1], salt[0 .. saltlen - 1], N, r,
|
+@@ -43,4 +48,9 @@
|
+ int crypto_scrypt(const uint8_t *, size_t, const uint8_t *, size_t, uint64_t,
|
+ uint32_t, uint32_t, uint8_t *, size_t);
|
+
|
++// GOOGLE
|
++#ifdef __cplusplus
|
++}
|
++#endif
|
++
|
+ #endif /* !_CRYPTO_SCRYPT_H_ */
|
+diff --git a/third_party/scrypt/lib/util/warn.h b/third_party/scrypt/lib/util/warn.h
|
+index 262d24b..4ebc7e5 100644
|
+--- a/third_party/scrypt/lib/util/warn.h
|
++++ b/third_party/scrypt/lib/util/warn.h
|
+@@ -1,3 +1,32 @@
|
++/*-
|
++ * Copyright 2009 Colin Percival
|
++ * All rights reserved.
|
++ *
|
++ * Redistribution and use in source and binary forms, with or without
|
++ * modification, are permitted provided that the following conditions
|
++ * are met:
|
++ * 1. Redistributions of source code must retain the above copyright
|
++ * notice, this list of conditions and the following disclaimer.
|
++ * 2. Redistributions in binary form must reproduce the above copyright
|
++ * notice, this list of conditions and the following disclaimer in the
|
++ * documentation and/or other materials provided with the distribution.
|
++ *
|
++ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
++ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
++ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
++ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
++ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
++ * SUCH DAMAGE.
|
++ *
|
++ * This file was originally written by Colin Percival as part of the Tarsnap
|
++ * online backup system.
|
++ */
|
++
|
+ #ifndef _WARN_H_
|
+ #define _WARN_H_
|
+
|
+diff --git a/third_party/scrypt/scrypt_platform.h b/third_party/scrypt/scrypt_platform.h
|
+index 5cec236..8e406f3 100644
|
+--- a/third_party/scrypt/scrypt_platform.h
|
++++ b/third_party/scrypt/scrypt_platform.h
|
+@@ -1,3 +1,32 @@
|
++/*-
|
++ * Copyright 2009 Colin Percival
|
++ * All rights reserved.
|
++ *
|
++ * Redistribution and use in source and binary forms, with or without
|
++ * modification, are permitted provided that the following conditions
|
++ * are met:
|
++ * 1. Redistributions of source code must retain the above copyright
|
++ * notice, this list of conditions and the following disclaimer.
|
++ * 2. Redistributions in binary form must reproduce the above copyright
|
++ * notice, this list of conditions and the following disclaimer in the
|
++ * documentation and/or other materials provided with the distribution.
|
++ *
|
++ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
++ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
++ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
++ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
++ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
++ * SUCH DAMAGE.
|
++ *
|
++ * This file was originally written by Colin Percival as part of the Tarsnap
|
++ * online backup system.
|
++ */
|
++
|
+ #ifndef _SCRYPT_PLATFORM_H_
|
+ #define _SCRYPT_PLATFORM_H_
|
+
|
+@@ -6,7 +35,7 @@
|
+ #elif defined(HAVE_CONFIG_H)
|
+ #include "config.h"
|
+ #else
|
+-#error Need either CONFIG_H_FILE or HAVE_CONFIG_H defined.
|
++/* GOOGLE: assume all defines are done on the command line */
|
+ #endif
|
+
|
+ #endif /* !_SCRYPT_PLATFORM_H_ */
|
+diff --git a/third_party/scrypt/sysendian.h b/third_party/scrypt/sysendian.h
|
+new file mode 100644
|
+index 0000000..c147511
|
+--- /dev/null
|
++++ b/third_party/scrypt/sysendian.h
|
+@@ -0,0 +1,42 @@
|
++/*
|
++ * Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
++ * Use of this source code is governed by a BSD-style license.
|
++ *
|
++ * Some functions commonly found in sys/endian.h, a header file not available
|
++ * on Windows platforms.
|
++ */
|
++
|
++#ifndef _SCRYPT_SYSENDIAN_H
|
++#define _SCRYPT_SYSENDIAN_H
|
++
|
++static __inline void be32enc(void *buf, uint32_t u)
|
++{
|
++ uint8_t *p = (uint8_t *)buf;
|
++ p[0] = (uint8_t)((u >> 24) & 0xff);
|
++ p[1] = (uint8_t)((u >> 16) & 0xff);
|
++ p[2] = (uint8_t)((u >> 8) & 0xff);
|
++ p[3] = (uint8_t)(u & 0xff);
|
++}
|
++
|
++static __inline void le32enc(void *buf, uint32_t u)
|
++{
|
++ uint8_t *p = (uint8_t *)buf;
|
++ p[0] = (uint8_t)(u & 0xff);
|
++ p[1] = (uint8_t)((u >> 8) & 0xff);
|
++ p[2] = (uint8_t)((u >> 16) & 0xff);
|
++ p[3] = (uint8_t)((u >> 24) & 0xff);
|
++}
|
++
|
++static __inline uint32_t be32dec(const void *buf)
|
++{
|
++ const uint8_t *p = (const uint8_t *)buf;
|
++ return ((p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]);
|
++}
|
++
|
++static __inline uint32_t le32dec(const void *buf)
|
++{
|
++ const uint8_t *p = (const uint8_t *)buf;
|
++ return ((p[3] << 24) | (p[2] << 16) | (p[1] << 8) | p[0]);
|
++}
|
++
|
++#endif // _SCRYPT_SYSENDIAN_H
|
|