summaryrefslogtreecommitdiffstats
path: root/chrome/installer/mac
diff options
context:
space:
mode:
authormark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-28 13:41:01 +0000
committermark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-28 13:41:01 +0000
commit02a91d4e5d9f841cbb86f76b89d4fe2d76364d3f (patch)
tree87a79377550556aa6cdc460955c2512fdeba18e5 /chrome/installer/mac
parent4bd55a3309fba325365ddcae9ac7c0cef1f74105 (diff)
downloadchromium_src-02a91d4e5d9f841cbb86f76b89d4fe2d76364d3f.zip
chromium_src-02a91d4e5d9f841cbb86f76b89d4fe2d76364d3f.tar.gz
chromium_src-02a91d4e5d9f841cbb86f76b89d4fe2d76364d3f.tar.bz2
Wean goobsdfiff off of its OpenSSL libcrypto dependency.
This libcrypto dependency sucks. Linking against OpenSSL is sort of broken in certain Mac OS X SDKs. libcrypto was only being used to provide a SHA1 implementation. Chrome's base library already has its own SHA1 implementation, so just use that instead. Because I'm conscious of the installer tools' size, here's the change for release-mode goobspatch, the component we ship: -rwx------ 1 mark staff 21024 Jul 27 17:18 new -rwx------ 1 mark staff 6709 Jul 27 17:18 new.bz2 -rwx------ 1 mark staff 20048 Jul 27 17:05 old -rwx------ 1 mark staff 5817 Jul 27 17:05 old.bz2 Under 1kB of inflation. I'm OK with that. BUG=90665 TEST=otool -L goobspatch | grep libcrypto should not show any output once this is fixed. goobspatch is only present in a hidden directory in diff updater disk images. Binary diffs produced by "old" and "new" goobsdiff, and patched output produced by "old" and "new" goobspatch executables should be identical and fully interoperable. Review URL: http://codereview.chromium.org/7521008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@94456 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer/mac')
-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_ */