Build one of NSS or BoringSSL but not both.

The libraries have some common symbols. When both are linked I observed NSS
SHA1_Update called followed by BoringSSL SHA1_Final, which results in a
segfault. We should only link one of these.

Based off of https://review.webrtc.org/25689004/

BUG=3855
R=pthatcher@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/31469004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7310 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
pthatcher@webrtc.org 2014-09-26 18:53:40 +00:00
parent a21d071607
commit 5d0071fb1f
2 changed files with 60 additions and 118 deletions

View File

@ -30,7 +30,6 @@ config("webrtc_base_config") {
config("webrtc_base_chromium_config") {
defines = [
"NO_MAIN_THREAD_WRAPPING",
"SSL_USE_NSS",
]
}
@ -49,17 +48,6 @@ config("no_openssl_config") {
]
}
config("android_config") {
defines = [ "HAVE_OPENSSL_SSL_H" ]
}
config("no_android_config") {
defines = [
"HAVE_NSS_SSL_H",
"SSL_USE_NSS_RNG",
]
}
config("ios_config") {
ldflags = [
#"Foundation.framework", # Already included in //build/config:default_libs.
@ -221,10 +209,6 @@ static_library("webrtc_base") {
"nethelpers.h",
"network.cc",
"network.h",
"nssidentity.cc",
"nssidentity.h",
"nssstreamadapter.cc",
"nssstreamadapter.h",
"nullsocketserver.h",
"pathutils.cc",
"pathutils.h",
@ -359,7 +343,6 @@ static_library("webrtc_base") {
"natsocketfactory.h",
"nattypes.cc",
"nattypes.h",
"openssl.h",
"optionsfile.cc",
"optionsfile.h",
"profiler.cc",
@ -468,8 +451,36 @@ static_library("webrtc_base") {
} else {
configs += [ "external_ssl_library" ]
}
sources += [
"openssl.h",
"openssladapter.cc",
"openssladapter.h",
"openssldigest.cc",
"openssldigest.h",
"opensslidentity.cc",
"opensslidentity.h",
"opensslstreamadapter.cc",
"opensslstreamadapter.h",
]
} else {
direct_dependent_configs += [ ":no_openssl_config" ]
sources += [
"nssidentity.cc",
"nssidentity.h",
"nssstreamadapter.cc",
"nssstreamadapter.h",
]
if (is_mac || is_ios || is_win) {
if (rtc_build_ssl) {
deps += [
"//net/third_party/nss/ssl:libssl",
"//third_party/nss:nspr",
"//third_party/nss:nss",
]
} else {
configs += [ "external_ssl_library" ]
}
}
}
if (is_android) {
@ -478,24 +489,14 @@ static_library("webrtc_base") {
"ifaddrs-android.h",
]
direct_dependent_configs += [ ":android_config" ]
libs += [
"log",
"GLESv2"
]
} else {
direct_dependent_configs += [ ":no_android_config" ]
}
if (is_ios) {
all_dependent_configs += [ ":ios_config" ]
if (rtc_build_ssl) {
deps += [ "//net/third_party/nss/ssl:libssl" ]
} else {
configs += [ "external_ssl_library" ]
}
}
if (use_x11) {
@ -536,10 +537,6 @@ static_library("webrtc_base") {
all_dependent_configs = [ ":mac_config" ]
libs += [
"crypto", # $(SDKROOT)/usr/lib/libcrypto.dylib
"ssl", # $(SDKROOT)/usr/lib/libssl.dylib
]
if (cpu_arch == "x86") {
all_dependent_configs += [ ":mac_x86_config" ]
}
@ -590,20 +587,6 @@ static_library("webrtc_base") {
defines += [ "CARBON_DEPRECATED=YES" ]
}
if (!is_ios) {
sources += [
"openssl.h",
"openssladapter.cc",
"openssladapter.h",
"openssldigest.cc",
"openssldigest.h",
"opensslidentity.cc",
"opensslidentity.h",
"opensslstreamadapter.cc",
"opensslstreamadapter.h",
]
}
if (is_linux || is_android) {
sources += [
"linux.cc",
@ -611,18 +594,6 @@ static_library("webrtc_base") {
]
}
if (is_mac || is_ios || is_win) {
if (rtc_build_ssl) {
deps += [
"//net/third_party/nss/ssl:libssl",
"//third_party/nss:nspr",
"//third_party/nss:nss",
]
} else {
configs += [ "external_ssl_library" ]
}
}
if (is_posix && !is_mac && !is_ios && !is_android) {
if (build_with_chromium) {
deps += [ "//crypto:platform" ]

View File

@ -192,20 +192,7 @@
'nethelpers.h',
'network.cc',
'network.h',
'nssidentity.cc',
'nssidentity.h',
'nssstreamadapter.cc',
'nssstreamadapter.h',
'nullsocketserver.h',
'openssl.h',
'openssladapter.cc',
'openssladapter.h',
'openssldigest.cc',
'openssldigest.h',
'opensslidentity.cc',
'opensslidentity.h',
'opensslstreamadapter.cc',
'opensslstreamadapter.h',
'optionsfile.cc',
'optionsfile.h',
'pathutils.cc',
@ -421,7 +408,6 @@
'natsocketfactory.h',
'nattypes.cc',
'nattypes.h',
'openssl.h',
'optionsfile.cc',
'optionsfile.h',
'posix.cc',
@ -464,12 +450,10 @@
],
'defines': [
'NO_MAIN_THREAD_WRAPPING',
'SSL_USE_NSS',
],
'direct_dependent_settings': {
'defines': [
'NO_MAIN_THREAD_WRAPPING',
'SSL_USE_NSS',
],
},
}, {
@ -509,6 +493,17 @@
'HAVE_OPENSSL_SSL_H',
],
},
'sources': [
'openssl.h',
'openssladapter.cc',
'openssladapter.h',
'openssldigest.cc',
'openssldigest.h',
'opensslidentity.cc',
'opensslidentity.h',
'opensslstreamadapter.cc',
'opensslstreamadapter.h',
],
'conditions': [
['build_ssl==1', {
'dependencies': [
@ -521,6 +516,12 @@
}],
],
}, {
'sources': [
'nssidentity.cc',
'nssidentity.h',
'nssstreamadapter.cc',
'nssstreamadapter.h',
],
'conditions': [
['use_legacy_ssl_defaults!=1', {
'defines': [
@ -536,6 +537,21 @@
],
},
}],
['OS=="mac" or OS=="ios" or OS=="win"', {
'conditions': [
['build_ssl==1', {
'dependencies': [
'<(DEPTH)/net/third_party/nss/ssl.gyp:libssl',
'<(DEPTH)/third_party/nss/nss.gyp:nspr',
'<(DEPTH)/third_party/nss/nss.gyp:nss',
],
}, {
'include_dirs': [
'<(ssl_root)',
],
}],
],
}],
],
}],
['OS == "android"', {
@ -584,17 +600,6 @@
],
},
},
'conditions': [
['build_ssl==1', {
'dependencies': [
'<(DEPTH)/net/third_party/nss/ssl.gyp:libssl',
]
}, {
'include_dirs': [
'<(ssl_root)',
],
}],
],
}],
['use_x11 == 1', {
'link_settings': {
@ -645,12 +650,6 @@
],
}],
['OS=="mac"', {
'link_settings': {
'libraries': [
'$(SDKROOT)/usr/lib/libcrypto.dylib',
'$(SDKROOT)/usr/lib/libssl.dylib',
],
},
'all_dependent_settings': {
'link_settings': {
'xcode_settings': {
@ -750,40 +749,12 @@
'scoped_autorelease_pool.mm',
],
}],
['OS=="ios"', {
'sources!': [
'openssl.h',
'openssladapter.cc',
'openssladapter.h',
'openssldigest.cc',
'openssldigest.h',
'opensslidentity.cc',
'opensslidentity.h',
'opensslstreamadapter.cc',
'opensslstreamadapter.h',
],
}],
['OS!="linux" and OS!="android"', {
'sources!': [
'linux.cc',
'linux.h',
],
}],
['OS == "mac" or OS == "ios" or OS == "win"', {
'conditions': [
['build_ssl==1', {
'dependencies': [
'<(DEPTH)/net/third_party/nss/ssl.gyp:libssl',
'<(DEPTH)/third_party/nss/nss.gyp:nspr',
'<(DEPTH)/third_party/nss/nss.gyp:nss',
],
}, {
'include_dirs': [
'<(ssl_root)',
],
}],
],
}],
['os_posix == 1 and OS != "mac" and OS != "ios" and OS != "android"', {
'conditions': [
['build_ssl==1', {