summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/installer/mac/third_party/bsdiff/README.chromium1
-rw-r--r--chrome/installer/mac/third_party/bsdiff/empty.cc7
-rw-r--r--chrome/installer/mac/third_party/bsdiff/goobsdiff.c3
-rw-r--r--chrome/installer/mac/third_party/bsdiff/goobsdiff.gyp41
-rw-r--r--chrome/installer/mac/third_party/bsdiff/goobspatch.c11
-rw-r--r--chrome/installer/mac/third_party/bsdiff/sha1_adapter.cc11
-rw-r--r--chrome/installer/mac/third_party/bsdiff/sha1_adapter.h26
7 files changed, 83 insertions, 17 deletions
diff --git a/chrome/installer/mac/third_party/bsdiff/README.chromium b/chrome/installer/mac/third_party/bsdiff/README.chromium
index ea79013..260d68c 100644
--- a/chrome/installer/mac/third_party/bsdiff/README.chromium
+++ b/chrome/installer/mac/third_party/bsdiff/README.chromium
@@ -33,6 +33,7 @@ Local Modifications:
checked in to the Chromium repository at r49280.
- Created goobsdiff.gyp for GYP build system integration.
- Renamed bsdiff.c to goobsdiff.c and bspatch.c to goobspatch.c.
+ - Added sha1_adapter.cc, sha1_adapter.h, and empty.cc to facilitate hashing.
- Added #include <sys/types.h> to goobspatch.c so that it compiles. (Oops!)
- Changed the magic number in the header from BSDIFF40 to BSDIFF4G.
- Expanded the header to include SHA1 hashes of the original and new files,
diff --git a/chrome/installer/mac/third_party/bsdiff/empty.cc b/chrome/installer/mac/third_party/bsdiff/empty.cc
new file mode 100644
index 0000000..16026ac
--- /dev/null
+++ b/chrome/installer/mac/third_party/bsdiff/empty.cc
@@ -0,0 +1,7 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// This is an empty file with a .cc extension, to convince the toolchain
+// (I'm looking at YOU, Xcode) that it needs to link any target this file
+// belongs to as C++.
diff --git a/chrome/installer/mac/third_party/bsdiff/goobsdiff.c b/chrome/installer/mac/third_party/bsdiff/goobsdiff.c
index d723a03..22b0bc1 100644
--- a/chrome/installer/mac/third_party/bsdiff/goobsdiff.c
+++ b/chrome/installer/mac/third_party/bsdiff/goobsdiff.c
@@ -34,7 +34,6 @@ __FBSDID("$FreeBSD: src/usr.bin/bsdiff/bsdiff/bsdiff.c,v 1.1 2005/08/06 01:59:05
#include <err.h>
#include <fcntl.h>
#include <lzma.h>
-#include <openssl/sha.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -52,6 +51,8 @@ __FBSDID("$FreeBSD: src/usr.bin/bsdiff/bsdiff/bsdiff.c,v 1.1 2005/08/06 01:59:05
#error Provide htole64 for this platform
#endif
+#include "chrome/installer/mac/third_party/bsdiff/sha1_adapter.h"
+
#define MIN(x,y) (((x)<(y)) ? (x) : (y))
static void split(off_t *I,off_t *V,off_t start,off_t len,off_t h)
diff --git a/chrome/installer/mac/third_party/bsdiff/goobsdiff.gyp b/chrome/installer/mac/third_party/bsdiff/goobsdiff.gyp
index 68ffd58..68e4668 100644
--- a/chrome/installer/mac/third_party/bsdiff/goobsdiff.gyp
+++ b/chrome/installer/mac/third_party/bsdiff/goobsdiff.gyp
@@ -1,44 +1,63 @@
-# Copyright (c) 2010 The Chromium Authors. All rights reserved.
+# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'target_defaults': {
- 'type': 'executable',
+ 'include_dirs': [
+ '../../../../..',
+ ],
'link_settings': {
'libraries': [
'$(SDKROOT)/usr/lib/libbz2.dylib',
'$(SDKROOT)/usr/lib/libz.dylib',
- '$(SDKROOT)/usr/lib/libcrypto.dylib',
],
},
+ 'configurations': {
+ 'Release': {
+ 'xcode_settings': {
+ # Use -Os to minimize the size of the installer tools.
+ 'GCC_OPTIMIZATION_LEVEL': 's',
+ },
+ },
+ },
},
'targets': [
{
+ # Because size is a concern, don't link against all of base. Instead,
+ # just bring in a copy of the one component that's needed, along with
+ # the adapter that allows it to be called from C (not C++) code.
+ 'target_name': 'goobsdiff_sha1_adapter',
+ 'type': 'static_library',
+ 'sources': [
+ '../../../../../base/sha1_portable.cc',
+ 'sha1_adapter.cc',
+ 'sha1_adapter.h',
+ ],
+ },
+ {
'target_name': 'goobsdiff',
+ 'type': 'executable',
'dependencies': [
+ 'goobsdiff_sha1_adapter',
'../xz/xz.gyp:lzma',
],
'sources': [
+ 'empty.cc',
'goobsdiff.c',
],
},
{
'target_name': 'goobspatch',
+ 'type': 'executable',
'dependencies': [
+ 'goobsdiff_sha1_adapter',
'../xz/xz.gyp:lzma_decompress',
],
'sources': [
+ 'empty.cc',
'goobspatch.c',
],
- 'configurations': {
- 'Release': {
- 'xcode_settings': {
- # Use -Os to minimize the size of the installer tools.
- 'GCC_OPTIMIZATION_LEVEL': 's',
- },
- },
- },
},
],
}
diff --git a/chrome/installer/mac/third_party/bsdiff/goobspatch.c b/chrome/installer/mac/third_party/bsdiff/goobspatch.c
index c06aaaa..418f666 100644
--- a/chrome/installer/mac/third_party/bsdiff/goobspatch.c
+++ b/chrome/installer/mac/third_party/bsdiff/goobspatch.c
@@ -37,7 +37,6 @@ __FBSDID("$FreeBSD: src/usr.bin/bsdiff/bspatch/bspatch.c,v 1.1 2005/08/06 01:59:
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <openssl/sha.h>
#include <unistd.h>
#include <zlib.h>
@@ -52,6 +51,8 @@ __FBSDID("$FreeBSD: src/usr.bin/bsdiff/bspatch/bspatch.c,v 1.1 2005/08/06 01:59:
#error Provide le64toh for this platform
#endif
+#include "chrome/installer/mac/third_party/bsdiff/sha1_adapter.h"
+
static inline off_t offtin(u_char *buf)
{
return le64toh(*((off_t*)buf));
@@ -60,7 +61,7 @@ static inline off_t offtin(u_char *buf)
static void sha1tostr(const u_char *sha1, char *sha1str)
{
int i;
- for (i = 0; i < SHA_DIGEST_LENGTH; ++i)
+ for (i = 0; i < SHA1_DIGEST_LENGTH; ++i)
sprintf(&sha1str[i * 2], "%02x", sha1[i]);
}
@@ -374,9 +375,9 @@ int main(int argc,char * argv[])
off_t oldpos,newpos;
off_t ctrl[3];
off_t i;
- u_char sha1[SHA_DIGEST_LENGTH];
- char sha1str[SHA_DIGEST_LENGTH * 2 + 1];
- char expected_sha1str[SHA_DIGEST_LENGTH * 2 + 1];
+ u_char sha1[SHA1_DIGEST_LENGTH];
+ char sha1str[SHA1_DIGEST_LENGTH * 2 + 1];
+ char expected_sha1str[SHA1_DIGEST_LENGTH * 2 + 1];
if(argc!=4) errx(1,"usage: %s oldfile newfile patchfile",argv[0]);
diff --git a/chrome/installer/mac/third_party/bsdiff/sha1_adapter.cc b/chrome/installer/mac/third_party/bsdiff/sha1_adapter.cc
new file mode 100644
index 0000000..aa62861
--- /dev/null
+++ b/chrome/installer/mac/third_party/bsdiff/sha1_adapter.cc
@@ -0,0 +1,11 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/installer/mac/third_party/bsdiff/sha1_adapter.h"
+
+#include "base/sha1.h"
+
+void SHA1(const unsigned char* data, size_t len, unsigned char* hash) {
+ base::SHA1HashBytes(data, len, hash);
+}
diff --git a/chrome/installer/mac/third_party/bsdiff/sha1_adapter.h b/chrome/installer/mac/third_party/bsdiff/sha1_adapter.h
new file mode 100644
index 0000000..7c8e031
--- /dev/null
+++ b/chrome/installer/mac/third_party/bsdiff/sha1_adapter.h
@@ -0,0 +1,26 @@
+/* Copyright (c) 2011 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file. */
+
+#ifndef CHROME_INSTALLER_MAC_THIRD_PARTY_BSDIFF_SHA1_ADAPTER_H_
+#define CHROME_INSTALLER_MAC_THIRD_PARTY_BSDIFF_SHA1_ADAPTER_H_
+#pragma once
+
+/* This file defines a wrapper around Chromium's C++ base::SHA1HashBytes
+ * function allowing it to be called from C code. */
+
+#include <sys/types.h>
+
+#define SHA1_DIGEST_LENGTH 20
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+void SHA1(const unsigned char* data, size_t len, unsigned char* hash);
+
+#if defined(__cplusplus)
+} // extern "C"
+#endif
+
+#endif /* CHROME_INSTALLER_MAC_THIRD_PARTY_BSDIFF_SHA1_ADAPTER_H_ */