From abcee5eacdf73308829dc180449d2d00bc4cb8cb Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Thu, 24 Oct 2019 20:26:08 -0700 Subject: [PATCH 1/8] Bump up BoringSSL version as it depends on a new commit --- gRPC-Core.podspec | 2 +- src/objective-c/BoringSSL-GRPC.podspec | 2 +- templates/gRPC-Core.podspec.template | 2 +- templates/src/objective-c/BoringSSL-GRPC.podspec.template | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index eeb6beff9f9..c373908dc5e 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -185,7 +185,7 @@ Pod::Spec.new do |s| ss.header_mappings_dir = '.' ss.libraries = 'z' ss.dependency "#{s.name}/Interface", version - ss.dependency 'BoringSSL-GRPC', '0.0.4' + ss.dependency 'BoringSSL-GRPC', '0.0.5' ss.compiler_flags = '-DGRPC_SHADOW_BORINGSSL_SYMBOLS' ss.source_files = 'src/core/ext/filters/census/grpc_context.cc', diff --git a/src/objective-c/BoringSSL-GRPC.podspec b/src/objective-c/BoringSSL-GRPC.podspec index 26c20a0609f..6b2193e48d4 100644 --- a/src/objective-c/BoringSSL-GRPC.podspec +++ b/src/objective-c/BoringSSL-GRPC.podspec @@ -41,7 +41,7 @@ Pod::Spec.new do |s| s.name = 'BoringSSL-GRPC' - version = '0.0.4' + version = '0.0.5' s.version = version s.summary = 'BoringSSL is a fork of OpenSSL that is designed to meet Google\'s needs.' # Adapted from the homepage: diff --git a/templates/gRPC-Core.podspec.template b/templates/gRPC-Core.podspec.template index 32e97872bab..a2b27144da5 100644 --- a/templates/gRPC-Core.podspec.template +++ b/templates/gRPC-Core.podspec.template @@ -172,7 +172,7 @@ ss.header_mappings_dir = '.' ss.libraries = 'z' ss.dependency "#{s.name}/Interface", version - ss.dependency 'BoringSSL-GRPC', '0.0.4' + ss.dependency 'BoringSSL-GRPC', '0.0.5' ss.compiler_flags = '-DGRPC_SHADOW_BORINGSSL_SYMBOLS' ss.source_files = ${ruby_multiline_list(grpc_private_files(libs), 22)} diff --git a/templates/src/objective-c/BoringSSL-GRPC.podspec.template b/templates/src/objective-c/BoringSSL-GRPC.podspec.template index 8bdd255d2a0..694e71e97b2 100644 --- a/templates/src/objective-c/BoringSSL-GRPC.podspec.template +++ b/templates/src/objective-c/BoringSSL-GRPC.podspec.template @@ -46,7 +46,7 @@ Pod::Spec.new do |s| s.name = 'BoringSSL-GRPC' - version = '0.0.4' + version = '0.0.5' s.version = version s.summary = 'BoringSSL is a fork of OpenSSL that is designed to meet Google\'s needs.' # Adapted from the homepage: From df07a787249999171f6b1189fb764c1ef488bfa3 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Thu, 7 Nov 2019 13:58:22 -0800 Subject: [PATCH 2/8] Automatically generate BoringSSL commit number --- templates/src/objective-c/BoringSSL-GRPC.podspec.template | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/templates/src/objective-c/BoringSSL-GRPC.podspec.template b/templates/src/objective-c/BoringSSL-GRPC.podspec.template index 694e71e97b2..72bf9ffedb0 100644 --- a/templates/src/objective-c/BoringSSL-GRPC.podspec.template +++ b/templates/src/objective-c/BoringSSL-GRPC.podspec.template @@ -1,8 +1,10 @@ %YAML 1.2 --- | <%! - def expand_symbol_list(symbol_list): - return ',\n '.join("'#define %s GRPC_SHADOW_%s'" % (symbol, symbol) for symbol in symbol_list) + def expand_symbol_list(symbol_list): + return ',\n '.join("'#define %s GRPC_SHADOW_%s'" % (symbol, symbol) for symbol in symbol_list) + import subprocess + boringssl_commit = subprocess.check_output(['git', 'rev-parse', 'HEAD'], cwd='third_party/boringssl').decode().strip() %> # This file has been automatically generated from a template file. @@ -83,7 +85,7 @@ s.source = { :git => 'https://github.com/google/boringssl.git', - :commit => "7f02881e96e51f1873afcf384d02f782b48967ca", + :commit => "${boringssl_commit}", } s.ios.deployment_target = '7.0' From 42003f859699d1a84ca0141211161b250885a3d1 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Thu, 7 Nov 2019 13:58:44 -0800 Subject: [PATCH 3/8] Update and comment BoringSSL source file list --- .../BoringSSL-GRPC.podspec.template | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/templates/src/objective-c/BoringSSL-GRPC.podspec.template b/templates/src/objective-c/BoringSSL-GRPC.podspec.template index 72bf9ffedb0..c841a5ab35e 100644 --- a/templates/src/objective-c/BoringSSL-GRPC.podspec.template +++ b/templates/src/objective-c/BoringSSL-GRPC.podspec.template @@ -135,22 +135,23 @@ end s.subspec 'Implementation' do |ss| ss.header_mappings_dir = '.' - ss.source_files = 'ssl/*.{h,cc}', - 'ssl/**/*.{h,cc}', - '*.{h,c}', - 'crypto/*.{h,c}', - 'crypto/**/*.{h,c}', - 'third_party/fiat/*.{h,c}' + ss.source_files = 'ssl/*.{h,c,cc}', + 'ssl/**/*.{h,c,cc}', + '*.{h,c,cc}', # for generated file such as err_data.c + 'crypto/*.{h,c,cc}', + 'crypto/**/*.{h,c,cc}', + 'third_party/fiat/*.{h,c,cc}' # has to include fiat because spake25519 depends + # on it ss.private_header_files = 'ssl/*.h', 'ssl/**/*.h', '*.h', 'crypto/*.h', - 'crypto/**/*.h' + 'crypto/**/*.h', + 'third_party/fiat/*.h' # bcm.c includes other source files, creating duplicated symbols. Since it is not used, we # explicitly exclude it from the pod. # TODO (mxyan): Work with BoringSSL team to remove this hack. - ss.exclude_files = 'crypto/fipsmodule/bcm.c', - '**/*_test.*', + ss.exclude_files = '**/*_test.*', '**/test_*.*', '**/test/*.*' From 44ddaa31e88b939e62601fde15df82460f178d29 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Thu, 7 Nov 2019 13:59:08 -0800 Subject: [PATCH 4/8] Update and comment BoringSSL prefix hacks --- .../objective-c/BoringSSL-GRPC.podspec.template | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/templates/src/objective-c/BoringSSL-GRPC.podspec.template b/templates/src/objective-c/BoringSSL-GRPC.podspec.template index c841a5ab35e..adefc4f2ba9 100644 --- a/templates/src/objective-c/BoringSSL-GRPC.podspec.template +++ b/templates/src/objective-c/BoringSSL-GRPC.podspec.template @@ -223,13 +223,18 @@ % endfor EOF - # Remove lines of the format "#define SOME_MACRO SOME_MACRO" because they mess up the symbol prefix + # The symbol prefixing mechanism is performed by redefining BoringSSL symbols with + # "#define SOME_BORINGSSL_SYMBOL GRPC_SHADOW_SOME_BORINGSSL_SYMBOL". Unfortunately, some symbols are already + # redefined as macros in BoringSSL headers in the form "#define SOME_BORINGSSL_SYMBOL SOME_BORINGSSL_SYMBOL" + # Such type of redefinition will cause "duplicate symbols" when using together with our prefix header. So + # the workaround in the below lines removes all such type of #define directives. sed -i'.back' '/^#define \\([A-Za-z0-9_]*\\) \\1/d' include/openssl/*.h - # Remove lines of the format below because they mess up the symbol prefix - # #define SOME_MACRO ${"\\"} - # SOME_MACRO + # Remove lines of the format below for the same reason above + # #define SOME_BORINGSSL_SYMBOL ${"\\"} + # SOME_BORINGSSL_SYMBOL sed -i'.back' '/^#define.*\\\\$/{N;/^#define \\([A-Za-z0-9_]*\\) *\\\\\\n *\\1/d;}' include/openssl/*.h - sed -i'.back' 's/#ifndef md5_block_data_order/#ifndef GRPC_SHADOW_md5_block_data_order/g' crypto/fipsmodule/md5/md5.c + + # We are renaming openssl to openssl_grpc so that there is no conflict with openssl if it exists find . -type f \\( -path '*.h' -or -path '*.cc' -or -path '*.c' \\) -print0 | xargs -0 -L1 sed -E -i'.grpc_back' 's;#include Date: Thu, 7 Nov 2019 14:00:12 -0800 Subject: [PATCH 5/8] generate projects --- src/objective-c/BoringSSL-GRPC.podspec | 34 +++++++++++++++----------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/src/objective-c/BoringSSL-GRPC.podspec b/src/objective-c/BoringSSL-GRPC.podspec index 6b2193e48d4..c42ec88e92f 100644 --- a/src/objective-c/BoringSSL-GRPC.podspec +++ b/src/objective-c/BoringSSL-GRPC.podspec @@ -128,22 +128,23 @@ Pod::Spec.new do |s| end s.subspec 'Implementation' do |ss| ss.header_mappings_dir = '.' - ss.source_files = 'ssl/*.{h,cc}', - 'ssl/**/*.{h,cc}', - '*.{h,c}', - 'crypto/*.{h,c}', - 'crypto/**/*.{h,c}', - 'third_party/fiat/*.{h,c}' + ss.source_files = 'ssl/*.{h,c,cc}', + 'ssl/**/*.{h,c,cc}', + '*.{h,c,cc}', # for generated file such as err_data.c + 'crypto/*.{h,c,cc}', + 'crypto/**/*.{h,c,cc}', + 'third_party/fiat/*.{h,c,cc}' # has to include fiat because spake25519 depends + # on it ss.private_header_files = 'ssl/*.h', 'ssl/**/*.h', '*.h', 'crypto/*.h', - 'crypto/**/*.h' + 'crypto/**/*.h', + 'third_party/fiat/*.h' # bcm.c includes other source files, creating duplicated symbols. Since it is not used, we # explicitly exclude it from the pod. # TODO (mxyan): Work with BoringSSL team to remove this hack. - ss.exclude_files = 'crypto/fipsmodule/bcm.c', - '**/*_test.*', + ss.exclude_files = '**/*_test.*', '**/test_*.*', '**/test/*.*' @@ -1619,13 +1620,18 @@ Pod::Spec.new do |s| EOF - # Remove lines of the format "#define SOME_MACRO SOME_MACRO" because they mess up the symbol prefix + # The symbol prefixing mechanism is performed by redefining BoringSSL symbols with + # "#define SOME_BORINGSSL_SYMBOL GRPC_SHADOW_SOME_BORINGSSL_SYMBOL". Unfortunately, some symbols are already + # redefined as macros in BoringSSL headers in the form "#define SOME_BORINGSSL_SYMBOL SOME_BORINGSSL_SYMBOL" + # Such type of redefinition will cause "duplicate symbols" when using together with our prefix header. So + # the workaround in the below lines removes all such type of #define directives. sed -i'.back' '/^#define \\([A-Za-z0-9_]*\\) \\1/d' include/openssl/*.h - # Remove lines of the format below because they mess up the symbol prefix - # #define SOME_MACRO \ - # SOME_MACRO + # Remove lines of the format below for the same reason above + # #define SOME_BORINGSSL_SYMBOL \ + # SOME_BORINGSSL_SYMBOL sed -i'.back' '/^#define.*\\\\$/{N;/^#define \\([A-Za-z0-9_]*\\) *\\\\\\n *\\1/d;}' include/openssl/*.h - sed -i'.back' 's/#ifndef md5_block_data_order/#ifndef GRPC_SHADOW_md5_block_data_order/g' crypto/fipsmodule/md5/md5.c + + # We are renaming openssl to openssl_grpc so that there is no conflict with openssl if it exists find . -type f \\( -path '*.h' -or -path '*.cc' -or -path '*.c' \\) -print0 | xargs -0 -L1 sed -E -i'.grpc_back' 's;#include Date: Fri, 8 Nov 2019 10:58:04 -0800 Subject: [PATCH 6/8] List err_data.c explicitly in source files --- src/objective-c/BoringSSL-GRPC.podspec | 9 +++++---- .../src/objective-c/BoringSSL-GRPC.podspec.template | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/objective-c/BoringSSL-GRPC.podspec b/src/objective-c/BoringSSL-GRPC.podspec index c42ec88e92f..517c2e3e54b 100644 --- a/src/objective-c/BoringSSL-GRPC.podspec +++ b/src/objective-c/BoringSSL-GRPC.podspec @@ -130,14 +130,15 @@ Pod::Spec.new do |s| ss.header_mappings_dir = '.' ss.source_files = 'ssl/*.{h,c,cc}', 'ssl/**/*.{h,c,cc}', - '*.{h,c,cc}', # for generated file such as err_data.c 'crypto/*.{h,c,cc}', 'crypto/**/*.{h,c,cc}', - 'third_party/fiat/*.{h,c,cc}' # has to include fiat because spake25519 depends - # on it + # We have to include fiat because spake25519 depends on it + 'third_party/fiat/*.{h,c,cc}', + # Include the err_data.c generated in prepare_command below + 'err_data.c' + ss.private_header_files = 'ssl/*.h', 'ssl/**/*.h', - '*.h', 'crypto/*.h', 'crypto/**/*.h', 'third_party/fiat/*.h' diff --git a/templates/src/objective-c/BoringSSL-GRPC.podspec.template b/templates/src/objective-c/BoringSSL-GRPC.podspec.template index adefc4f2ba9..3d0ca89f091 100644 --- a/templates/src/objective-c/BoringSSL-GRPC.podspec.template +++ b/templates/src/objective-c/BoringSSL-GRPC.podspec.template @@ -137,14 +137,15 @@ ss.header_mappings_dir = '.' ss.source_files = 'ssl/*.{h,c,cc}', 'ssl/**/*.{h,c,cc}', - '*.{h,c,cc}', # for generated file such as err_data.c 'crypto/*.{h,c,cc}', 'crypto/**/*.{h,c,cc}', - 'third_party/fiat/*.{h,c,cc}' # has to include fiat because spake25519 depends - # on it + # We have to include fiat because spake25519 depends on it + 'third_party/fiat/*.{h,c,cc}', + # Include the err_data.c generated in prepare_command below + 'err_data.c' + ss.private_header_files = 'ssl/*.h', 'ssl/**/*.h', - '*.h', 'crypto/*.h', 'crypto/**/*.h', 'third_party/fiat/*.h' From 2a7e2af747412e1dce2b08eb1032f2c6793368d9 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Fri, 8 Nov 2019 10:58:12 -0800 Subject: [PATCH 7/8] Fix a typo and a format issue --- src/objective-c/BoringSSL-GRPC.podspec | 13 ++++++------- .../src/objective-c/BoringSSL-GRPC.podspec.template | 13 ++++++------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/objective-c/BoringSSL-GRPC.podspec b/src/objective-c/BoringSSL-GRPC.podspec index 517c2e3e54b..d1cbef112f2 100644 --- a/src/objective-c/BoringSSL-GRPC.podspec +++ b/src/objective-c/BoringSSL-GRPC.podspec @@ -142,8 +142,6 @@ Pod::Spec.new do |s| 'crypto/*.h', 'crypto/**/*.h', 'third_party/fiat/*.h' - # bcm.c includes other source files, creating duplicated symbols. Since it is not used, we - # explicitly exclude it from the pod. # TODO (mxyan): Work with BoringSSL team to remove this hack. ss.exclude_files = '**/*_test.*', '**/test_*.*', @@ -1621,11 +1619,12 @@ Pod::Spec.new do |s| EOF - # The symbol prefixing mechanism is performed by redefining BoringSSL symbols with - # "#define SOME_BORINGSSL_SYMBOL GRPC_SHADOW_SOME_BORINGSSL_SYMBOL". Unfortunately, some symbols are already - # redefined as macros in BoringSSL headers in the form "#define SOME_BORINGSSL_SYMBOL SOME_BORINGSSL_SYMBOL" - # Such type of redefinition will cause "duplicate symbols" when using together with our prefix header. So - # the workaround in the below lines removes all such type of #define directives. + # The symbol prefixing mechanism is performed by redefining BoringSSL symbols with "#define + # SOME_BORINGSSL_SYMBOL GRPC_SHADOW_SOME_BORINGSSL_SYMBOL". Unfortunately, some symbols are + # already redefined as macros in BoringSSL headers in the form "#define SOME_BORINGSSL_SYMBOL + # SOME_BORINGSSL_SYMBOL" Such type of redefinition will cause "SOME_BORINGSSL_SYMBOL redefined" + # error when using together with our prefix header. So the workaround in the below lines removes + # all such type of #define directives. sed -i'.back' '/^#define \\([A-Za-z0-9_]*\\) \\1/d' include/openssl/*.h # Remove lines of the format below for the same reason above # #define SOME_BORINGSSL_SYMBOL \ diff --git a/templates/src/objective-c/BoringSSL-GRPC.podspec.template b/templates/src/objective-c/BoringSSL-GRPC.podspec.template index 3d0ca89f091..4c145de5e79 100644 --- a/templates/src/objective-c/BoringSSL-GRPC.podspec.template +++ b/templates/src/objective-c/BoringSSL-GRPC.podspec.template @@ -149,8 +149,6 @@ 'crypto/*.h', 'crypto/**/*.h', 'third_party/fiat/*.h' - # bcm.c includes other source files, creating duplicated symbols. Since it is not used, we - # explicitly exclude it from the pod. # TODO (mxyan): Work with BoringSSL team to remove this hack. ss.exclude_files = '**/*_test.*', '**/test_*.*', @@ -224,11 +222,12 @@ % endfor EOF - # The symbol prefixing mechanism is performed by redefining BoringSSL symbols with - # "#define SOME_BORINGSSL_SYMBOL GRPC_SHADOW_SOME_BORINGSSL_SYMBOL". Unfortunately, some symbols are already - # redefined as macros in BoringSSL headers in the form "#define SOME_BORINGSSL_SYMBOL SOME_BORINGSSL_SYMBOL" - # Such type of redefinition will cause "duplicate symbols" when using together with our prefix header. So - # the workaround in the below lines removes all such type of #define directives. + # The symbol prefixing mechanism is performed by redefining BoringSSL symbols with "#define + # SOME_BORINGSSL_SYMBOL GRPC_SHADOW_SOME_BORINGSSL_SYMBOL". Unfortunately, some symbols are + # already redefined as macros in BoringSSL headers in the form "#define SOME_BORINGSSL_SYMBOL + # SOME_BORINGSSL_SYMBOL" Such type of redefinition will cause "SOME_BORINGSSL_SYMBOL redefined" + # error when using together with our prefix header. So the workaround in the below lines removes + # all such type of #define directives. sed -i'.back' '/^#define \\([A-Za-z0-9_]*\\) \\1/d' include/openssl/*.h # Remove lines of the format below for the same reason above # #define SOME_BORINGSSL_SYMBOL ${"\\"} From 87e73a5ba45a4a102f4395e1df7d199499fb5421 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Tue, 12 Nov 2019 11:09:16 -0800 Subject: [PATCH 8/8] Put back bcm.c exclusion since it's still creating duplicate symbols error --- src/objective-c/BoringSSL-GRPC.podspec | 5 ++++- templates/src/objective-c/BoringSSL-GRPC.podspec.template | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/objective-c/BoringSSL-GRPC.podspec b/src/objective-c/BoringSSL-GRPC.podspec index d1cbef112f2..6b53dc892d8 100644 --- a/src/objective-c/BoringSSL-GRPC.podspec +++ b/src/objective-c/BoringSSL-GRPC.podspec @@ -142,8 +142,11 @@ Pod::Spec.new do |s| 'crypto/*.h', 'crypto/**/*.h', 'third_party/fiat/*.h' + # bcm.c includes other source files, creating duplicated symbols. Since it is not used, we + # explicitly exclude it from the pod. # TODO (mxyan): Work with BoringSSL team to remove this hack. - ss.exclude_files = '**/*_test.*', + ss.exclude_files = 'crypto/fipsmodule/bcm.c', + '**/*_test.*', '**/test_*.*', '**/test/*.*' diff --git a/templates/src/objective-c/BoringSSL-GRPC.podspec.template b/templates/src/objective-c/BoringSSL-GRPC.podspec.template index 4c145de5e79..94c07657d4d 100644 --- a/templates/src/objective-c/BoringSSL-GRPC.podspec.template +++ b/templates/src/objective-c/BoringSSL-GRPC.podspec.template @@ -149,8 +149,11 @@ 'crypto/*.h', 'crypto/**/*.h', 'third_party/fiat/*.h' + # bcm.c includes other source files, creating duplicated symbols. Since it is not used, we + # explicitly exclude it from the pod. # TODO (mxyan): Work with BoringSSL team to remove this hack. - ss.exclude_files = '**/*_test.*', + ss.exclude_files = 'crypto/fipsmodule/bcm.c', + '**/*_test.*', '**/test_*.*', '**/test/*.*'