Adam Langley | cfd80a9 | 2019-11-08 14:40:08 -0800 | [diff] [blame] | 1 | # coding=utf8 |
| 2 | |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 3 | # Copyright (c) 2015, Google Inc. |
| 4 | # |
| 5 | # Permission to use, copy, modify, and/or distribute this software for any |
| 6 | # purpose with or without fee is hereby granted, provided that the above |
| 7 | # copyright notice and this permission notice appear in all copies. |
| 8 | # |
| 9 | # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
| 10 | # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
| 11 | # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY |
| 12 | # SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
| 13 | # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION |
| 14 | # OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN |
| 15 | # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | |
Matt Braithwaite | 1669589 | 2016-06-09 09:34:11 -0700 | [diff] [blame] | 17 | """Enumerates source files for consumption by various build systems.""" |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 18 | |
Matt Braithwaite | 1669589 | 2016-06-09 09:34:11 -0700 | [diff] [blame] | 19 | import optparse |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 20 | import os |
| 21 | import subprocess |
| 22 | import sys |
Adam Langley | 9c164b2 | 2015-06-10 18:54:47 -0700 | [diff] [blame] | 23 | import json |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 24 | |
| 25 | |
| 26 | # OS_ARCH_COMBOS maps from OS and platform to the OpenSSL assembly "style" for |
| 27 | # that platform and the extension used by asm files. |
| 28 | OS_ARCH_COMBOS = [ |
David Benjamin | f6584e7 | 2017-06-08 16:27:16 -0400 | [diff] [blame] | 29 | ('ios', 'arm', 'ios32', [], 'S'), |
| 30 | ('ios', 'aarch64', 'ios64', [], 'S'), |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 31 | ('linux', 'arm', 'linux32', [], 'S'), |
| 32 | ('linux', 'aarch64', 'linux64', [], 'S'), |
Adam Langley | 7c075b9 | 2017-05-22 15:31:13 -0700 | [diff] [blame] | 33 | ('linux', 'ppc64le', 'linux64le', [], 'S'), |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 34 | ('linux', 'x86', 'elf', ['-fPIC', '-DOPENSSL_IA32_SSE2'], 'S'), |
| 35 | ('linux', 'x86_64', 'elf', [], 'S'), |
| 36 | ('mac', 'x86', 'macosx', ['-fPIC', '-DOPENSSL_IA32_SSE2'], 'S'), |
| 37 | ('mac', 'x86_64', 'macosx', [], 'S'), |
| 38 | ('win', 'x86', 'win32n', ['-DOPENSSL_IA32_SSE2'], 'asm'), |
| 39 | ('win', 'x86_64', 'nasm', [], 'asm'), |
Anthony Roberts | afd5dba | 2020-10-19 12:27:51 +0100 | [diff] [blame^] | 40 | ('win', 'aarch64', 'win64', [], 'S'), |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 41 | ] |
| 42 | |
| 43 | # NON_PERL_FILES enumerates assembly files that are not processed by the |
| 44 | # perlasm system. |
| 45 | NON_PERL_FILES = { |
| 46 | ('linux', 'arm'): [ |
Adam Langley | 7b8b9c1 | 2016-01-04 07:13:00 -0800 | [diff] [blame] | 47 | 'src/crypto/curve25519/asm/x25519-asm-arm.S', |
David Benjamin | 3c4a5cb | 2016-03-29 17:43:31 -0400 | [diff] [blame] | 48 | 'src/crypto/poly1305/poly1305_arm_asm.S', |
Adam Langley | 7b93593 | 2018-11-12 13:53:42 -0800 | [diff] [blame] | 49 | ], |
| 50 | ('linux', 'x86_64'): [ |
| 51 | 'src/crypto/hrss/asm/poly_rq_mul.S', |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 52 | ], |
| 53 | } |
| 54 | |
Matt Braithwaite | 1669589 | 2016-06-09 09:34:11 -0700 | [diff] [blame] | 55 | PREFIX = None |
Adam Langley | 990a323 | 2018-05-22 10:02:59 -0700 | [diff] [blame] | 56 | EMBED_TEST_DATA = True |
Matt Braithwaite | 1669589 | 2016-06-09 09:34:11 -0700 | [diff] [blame] | 57 | |
| 58 | |
| 59 | def PathOf(x): |
| 60 | return x if not PREFIX else os.path.join(PREFIX, x) |
| 61 | |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 62 | |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 63 | class Android(object): |
| 64 | |
| 65 | def __init__(self): |
| 66 | self.header = \ |
| 67 | """# Copyright (C) 2015 The Android Open Source Project |
| 68 | # |
| 69 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 70 | # you may not use this file except in compliance with the License. |
| 71 | # You may obtain a copy of the License at |
| 72 | # |
| 73 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 74 | # |
| 75 | # Unless required by applicable law or agreed to in writing, software |
| 76 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 77 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 78 | # See the License for the specific language governing permissions and |
| 79 | # limitations under the License. |
| 80 | |
Dan Willemsen | b57e4fc | 2016-07-21 11:08:44 -0700 | [diff] [blame] | 81 | # This file is created by generate_build_files.py. Do not edit manually. |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 82 | """ |
| 83 | |
| 84 | def PrintVariableSection(self, out, name, files): |
| 85 | out.write('%s := \\\n' % name) |
| 86 | for f in sorted(files): |
| 87 | out.write(' %s\\\n' % f) |
| 88 | out.write('\n') |
| 89 | |
| 90 | def WriteFiles(self, files, asm_outputs): |
Dan Willemsen | b57e4fc | 2016-07-21 11:08:44 -0700 | [diff] [blame] | 91 | # New Android.bp format |
| 92 | with open('sources.bp', 'w+') as blueprint: |
| 93 | blueprint.write(self.header.replace('#', '//')) |
| 94 | |
Pete Bentley | 44544d9 | 2019-08-15 15:01:26 +0100 | [diff] [blame] | 95 | # Separate out BCM files to allow different compilation rules (specific to Android FIPS) |
| 96 | bcm_c_files = files['bcm_crypto'] |
| 97 | non_bcm_c_files = [file for file in files['crypto'] if file not in bcm_c_files] |
| 98 | non_bcm_asm = self.FilterBcmAsm(asm_outputs, False) |
| 99 | bcm_asm = self.FilterBcmAsm(asm_outputs, True) |
Dan Willemsen | b57e4fc | 2016-07-21 11:08:44 -0700 | [diff] [blame] | 100 | |
Pete Bentley | 44544d9 | 2019-08-15 15:01:26 +0100 | [diff] [blame] | 101 | self.PrintDefaults(blueprint, 'libcrypto_sources', non_bcm_c_files, non_bcm_asm) |
| 102 | self.PrintDefaults(blueprint, 'libcrypto_bcm_sources', bcm_c_files, bcm_asm) |
| 103 | self.PrintDefaults(blueprint, 'libssl_sources', files['ssl']) |
| 104 | self.PrintDefaults(blueprint, 'bssl_sources', files['tool']) |
| 105 | self.PrintDefaults(blueprint, 'boringssl_test_support_sources', files['test_support']) |
| 106 | self.PrintDefaults(blueprint, 'boringssl_crypto_test_sources', files['crypto_test']) |
| 107 | self.PrintDefaults(blueprint, 'boringssl_ssl_test_sources', files['ssl_test']) |
| 108 | |
| 109 | # Legacy Android.mk format, only used by Trusty in new branches |
| 110 | with open('sources.mk', 'w+') as makefile: |
| 111 | makefile.write(self.header) |
| 112 | makefile.write('\n') |
| 113 | self.PrintVariableSection(makefile, 'crypto_sources', files['crypto']) |
| 114 | |
| 115 | for ((osname, arch), asm_files) in asm_outputs: |
| 116 | if osname != 'linux': |
| 117 | continue |
| 118 | self.PrintVariableSection( |
| 119 | makefile, '%s_%s_sources' % (osname, arch), asm_files) |
| 120 | |
| 121 | def PrintDefaults(self, blueprint, name, files, asm_outputs={}): |
| 122 | """Print a cc_defaults section from a list of C files and optionally assembly outputs""" |
| 123 | blueprint.write('\n') |
| 124 | blueprint.write('cc_defaults {\n') |
| 125 | blueprint.write(' name: "%s",\n' % name) |
| 126 | blueprint.write(' srcs: [\n') |
| 127 | for f in sorted(files): |
| 128 | blueprint.write(' "%s",\n' % f) |
| 129 | blueprint.write(' ],\n') |
| 130 | |
| 131 | if asm_outputs: |
| 132 | blueprint.write(' target: {\n') |
Dan Willemsen | b57e4fc | 2016-07-21 11:08:44 -0700 | [diff] [blame] | 133 | for ((osname, arch), asm_files) in asm_outputs: |
Steven Valdez | 93d242b | 2016-10-06 13:49:01 -0400 | [diff] [blame] | 134 | if osname != 'linux' or arch == 'ppc64le': |
Dan Willemsen | b57e4fc | 2016-07-21 11:08:44 -0700 | [diff] [blame] | 135 | continue |
| 136 | if arch == 'aarch64': |
| 137 | arch = 'arm64' |
| 138 | |
Dan Willemsen | 2eb4bc5 | 2017-10-16 14:37:00 -0700 | [diff] [blame] | 139 | blueprint.write(' linux_%s: {\n' % arch) |
Dan Willemsen | b57e4fc | 2016-07-21 11:08:44 -0700 | [diff] [blame] | 140 | blueprint.write(' srcs: [\n') |
| 141 | for f in sorted(asm_files): |
| 142 | blueprint.write(' "%s",\n' % f) |
| 143 | blueprint.write(' ],\n') |
| 144 | blueprint.write(' },\n') |
Dan Willemsen | b57e4fc | 2016-07-21 11:08:44 -0700 | [diff] [blame] | 145 | blueprint.write(' },\n') |
Dan Willemsen | b57e4fc | 2016-07-21 11:08:44 -0700 | [diff] [blame] | 146 | |
Pete Bentley | 44544d9 | 2019-08-15 15:01:26 +0100 | [diff] [blame] | 147 | blueprint.write('}\n') |
Dan Willemsen | b57e4fc | 2016-07-21 11:08:44 -0700 | [diff] [blame] | 148 | |
Pete Bentley | 44544d9 | 2019-08-15 15:01:26 +0100 | [diff] [blame] | 149 | def FilterBcmAsm(self, asm, want_bcm): |
| 150 | """Filter a list of assembly outputs based on whether they belong in BCM |
Dan Willemsen | b57e4fc | 2016-07-21 11:08:44 -0700 | [diff] [blame] | 151 | |
Pete Bentley | 44544d9 | 2019-08-15 15:01:26 +0100 | [diff] [blame] | 152 | Args: |
| 153 | asm: Assembly file lists to filter |
| 154 | want_bcm: If true then include BCM files, otherwise do not |
Dan Willemsen | b57e4fc | 2016-07-21 11:08:44 -0700 | [diff] [blame] | 155 | |
Pete Bentley | 44544d9 | 2019-08-15 15:01:26 +0100 | [diff] [blame] | 156 | Returns: |
| 157 | A copy of |asm| with files filtered according to |want_bcm| |
| 158 | """ |
| 159 | return [(archinfo, filter(lambda p: ("/crypto/fipsmodule/" in p) == want_bcm, files)) |
| 160 | for (archinfo, files) in asm] |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 161 | |
| 162 | |
David Benjamin | eca48e5 | 2019-08-13 11:51:53 -0400 | [diff] [blame] | 163 | class AndroidCMake(object): |
| 164 | |
| 165 | def __init__(self): |
| 166 | self.header = \ |
| 167 | """# Copyright (C) 2019 The Android Open Source Project |
| 168 | # |
| 169 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 170 | # you may not use this file except in compliance with the License. |
| 171 | # You may obtain a copy of the License at |
| 172 | # |
| 173 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 174 | # |
| 175 | # Unless required by applicable law or agreed to in writing, software |
| 176 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 177 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 178 | # See the License for the specific language governing permissions and |
| 179 | # limitations under the License. |
| 180 | |
| 181 | # This file is created by generate_build_files.py. Do not edit manually. |
| 182 | # To specify a custom path prefix, set BORINGSSL_ROOT before including this |
| 183 | # file, or use list(TRANSFORM ... PREPEND) from CMake 3.12. |
| 184 | |
| 185 | """ |
| 186 | |
| 187 | def PrintVariableSection(self, out, name, files): |
| 188 | out.write('set(%s\n' % name) |
| 189 | for f in sorted(files): |
| 190 | # Ideally adding the prefix would be the caller's job, but |
| 191 | # list(TRANSFORM ... PREPEND) is only available starting CMake 3.12. When |
| 192 | # sources.cmake is the source of truth, we can ask Android to either write |
| 193 | # a CMake function or update to 3.12. |
| 194 | out.write(' ${BORINGSSL_ROOT}%s\n' % f) |
| 195 | out.write(')\n') |
| 196 | |
| 197 | def WriteFiles(self, files, asm_outputs): |
| 198 | # The Android emulator uses a custom CMake buildsystem. |
| 199 | # |
| 200 | # TODO(davidben): Move our various source lists into sources.cmake and have |
| 201 | # Android consume that directly. |
| 202 | with open('android-sources.cmake', 'w+') as out: |
| 203 | out.write(self.header) |
| 204 | |
| 205 | self.PrintVariableSection(out, 'crypto_sources', files['crypto']) |
| 206 | self.PrintVariableSection(out, 'ssl_sources', files['ssl']) |
| 207 | self.PrintVariableSection(out, 'tool_sources', files['tool']) |
| 208 | self.PrintVariableSection(out, 'test_support_sources', |
| 209 | files['test_support']) |
| 210 | self.PrintVariableSection(out, 'crypto_test_sources', |
| 211 | files['crypto_test']) |
| 212 | self.PrintVariableSection(out, 'ssl_test_sources', files['ssl_test']) |
| 213 | |
| 214 | for ((osname, arch), asm_files) in asm_outputs: |
| 215 | self.PrintVariableSection( |
| 216 | out, 'crypto_sources_%s_%s' % (osname, arch), asm_files) |
| 217 | |
| 218 | |
Adam Langley | 049ef41 | 2015-06-09 18:20:57 -0700 | [diff] [blame] | 219 | class Bazel(object): |
| 220 | """Bazel outputs files suitable for including in Bazel files.""" |
| 221 | |
| 222 | def __init__(self): |
| 223 | self.firstSection = True |
| 224 | self.header = \ |
| 225 | """# This file is created by generate_build_files.py. Do not edit manually. |
| 226 | |
| 227 | """ |
| 228 | |
| 229 | def PrintVariableSection(self, out, name, files): |
| 230 | if not self.firstSection: |
| 231 | out.write('\n') |
| 232 | self.firstSection = False |
| 233 | |
| 234 | out.write('%s = [\n' % name) |
| 235 | for f in sorted(files): |
Matt Braithwaite | 1669589 | 2016-06-09 09:34:11 -0700 | [diff] [blame] | 236 | out.write(' "%s",\n' % PathOf(f)) |
Adam Langley | 049ef41 | 2015-06-09 18:20:57 -0700 | [diff] [blame] | 237 | out.write(']\n') |
| 238 | |
| 239 | def WriteFiles(self, files, asm_outputs): |
Chuck Hays | c608d6b | 2015-10-06 17:54:16 -0700 | [diff] [blame] | 240 | with open('BUILD.generated.bzl', 'w+') as out: |
Adam Langley | 049ef41 | 2015-06-09 18:20:57 -0700 | [diff] [blame] | 241 | out.write(self.header) |
| 242 | |
| 243 | self.PrintVariableSection(out, 'ssl_headers', files['ssl_headers']) |
Adam Langley | fd49993 | 2017-04-04 14:21:43 -0700 | [diff] [blame] | 244 | self.PrintVariableSection(out, 'fips_fragments', files['fips_fragments']) |
Adam Langley | 049ef41 | 2015-06-09 18:20:57 -0700 | [diff] [blame] | 245 | self.PrintVariableSection( |
| 246 | out, 'ssl_internal_headers', files['ssl_internal_headers']) |
| 247 | self.PrintVariableSection(out, 'ssl_sources', files['ssl']) |
| 248 | self.PrintVariableSection(out, 'crypto_headers', files['crypto_headers']) |
| 249 | self.PrintVariableSection( |
| 250 | out, 'crypto_internal_headers', files['crypto_internal_headers']) |
| 251 | self.PrintVariableSection(out, 'crypto_sources', files['crypto']) |
| 252 | self.PrintVariableSection(out, 'tool_sources', files['tool']) |
Adam Langley | f11f233 | 2016-06-30 11:56:19 -0700 | [diff] [blame] | 253 | self.PrintVariableSection(out, 'tool_headers', files['tool_headers']) |
Adam Langley | 049ef41 | 2015-06-09 18:20:57 -0700 | [diff] [blame] | 254 | |
| 255 | for ((osname, arch), asm_files) in asm_outputs: |
Adam Langley | 049ef41 | 2015-06-09 18:20:57 -0700 | [diff] [blame] | 256 | self.PrintVariableSection( |
Piotr Sikora | 3f5fe60 | 2015-10-28 12:24:35 -0700 | [diff] [blame] | 257 | out, 'crypto_sources_%s_%s' % (osname, arch), asm_files) |
Adam Langley | 049ef41 | 2015-06-09 18:20:57 -0700 | [diff] [blame] | 258 | |
Chuck Hays | c608d6b | 2015-10-06 17:54:16 -0700 | [diff] [blame] | 259 | with open('BUILD.generated_tests.bzl', 'w+') as out: |
Adam Langley | 9c164b2 | 2015-06-10 18:54:47 -0700 | [diff] [blame] | 260 | out.write(self.header) |
| 261 | |
| 262 | out.write('test_support_sources = [\n') |
David Benjamin | c5aa841 | 2016-07-29 17:41:58 -0400 | [diff] [blame] | 263 | for filename in sorted(files['test_support'] + |
| 264 | files['test_support_headers'] + |
| 265 | files['crypto_internal_headers'] + |
| 266 | files['ssl_internal_headers']): |
Adam Langley | 9c164b2 | 2015-06-10 18:54:47 -0700 | [diff] [blame] | 267 | if os.path.basename(filename) == 'malloc.cc': |
| 268 | continue |
Matt Braithwaite | 1669589 | 2016-06-09 09:34:11 -0700 | [diff] [blame] | 269 | out.write(' "%s",\n' % PathOf(filename)) |
Adam Langley | 9c164b2 | 2015-06-10 18:54:47 -0700 | [diff] [blame] | 270 | |
Adam Langley | 7b6acc5 | 2017-07-27 16:33:27 -0700 | [diff] [blame] | 271 | out.write(']\n') |
Chuck Hays | c608d6b | 2015-10-06 17:54:16 -0700 | [diff] [blame] | 272 | |
David Benjamin | 9662843 | 2017-01-19 19:05:47 -0500 | [diff] [blame] | 273 | self.PrintVariableSection(out, 'crypto_test_sources', |
| 274 | files['crypto_test']) |
| 275 | self.PrintVariableSection(out, 'ssl_test_sources', files['ssl_test']) |
Adam Langley | 990a323 | 2018-05-22 10:02:59 -0700 | [diff] [blame] | 276 | self.PrintVariableSection(out, 'crypto_test_data', |
| 277 | files['crypto_test_data']) |
Adam Langley | 3e502c8 | 2019-10-16 09:56:38 -0700 | [diff] [blame] | 278 | self.PrintVariableSection(out, 'urandom_test_sources', |
| 279 | files['urandom_test']) |
David Benjamin | 9662843 | 2017-01-19 19:05:47 -0500 | [diff] [blame] | 280 | |
Adam Langley | 049ef41 | 2015-06-09 18:20:57 -0700 | [diff] [blame] | 281 | |
Robert Sloan | e091af4 | 2017-10-09 12:47:17 -0700 | [diff] [blame] | 282 | class Eureka(object): |
| 283 | |
| 284 | def __init__(self): |
| 285 | self.header = \ |
| 286 | """# Copyright (C) 2017 The Android Open Source Project |
| 287 | # |
| 288 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 289 | # you may not use this file except in compliance with the License. |
| 290 | # You may obtain a copy of the License at |
| 291 | # |
| 292 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 293 | # |
| 294 | # Unless required by applicable law or agreed to in writing, software |
| 295 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 296 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 297 | # See the License for the specific language governing permissions and |
| 298 | # limitations under the License. |
| 299 | |
| 300 | # This file is created by generate_build_files.py. Do not edit manually. |
| 301 | |
| 302 | """ |
| 303 | |
| 304 | def PrintVariableSection(self, out, name, files): |
| 305 | out.write('%s := \\\n' % name) |
| 306 | for f in sorted(files): |
| 307 | out.write(' %s\\\n' % f) |
| 308 | out.write('\n') |
| 309 | |
| 310 | def WriteFiles(self, files, asm_outputs): |
| 311 | # Legacy Android.mk format |
| 312 | with open('eureka.mk', 'w+') as makefile: |
| 313 | makefile.write(self.header) |
| 314 | |
| 315 | self.PrintVariableSection(makefile, 'crypto_sources', files['crypto']) |
| 316 | self.PrintVariableSection(makefile, 'ssl_sources', files['ssl']) |
| 317 | self.PrintVariableSection(makefile, 'tool_sources', files['tool']) |
| 318 | |
| 319 | for ((osname, arch), asm_files) in asm_outputs: |
| 320 | if osname != 'linux': |
| 321 | continue |
| 322 | self.PrintVariableSection( |
| 323 | makefile, '%s_%s_sources' % (osname, arch), asm_files) |
| 324 | |
| 325 | |
David Benjamin | 38d01c6 | 2016-04-21 18:47:57 -0400 | [diff] [blame] | 326 | class GN(object): |
| 327 | |
| 328 | def __init__(self): |
| 329 | self.firstSection = True |
| 330 | self.header = \ |
| 331 | """# Copyright (c) 2016 The Chromium Authors. All rights reserved. |
| 332 | # Use of this source code is governed by a BSD-style license that can be |
| 333 | # found in the LICENSE file. |
| 334 | |
| 335 | # This file is created by generate_build_files.py. Do not edit manually. |
| 336 | |
| 337 | """ |
| 338 | |
| 339 | def PrintVariableSection(self, out, name, files): |
| 340 | if not self.firstSection: |
| 341 | out.write('\n') |
| 342 | self.firstSection = False |
| 343 | |
| 344 | out.write('%s = [\n' % name) |
| 345 | for f in sorted(files): |
| 346 | out.write(' "%s",\n' % f) |
| 347 | out.write(']\n') |
| 348 | |
| 349 | def WriteFiles(self, files, asm_outputs): |
| 350 | with open('BUILD.generated.gni', 'w+') as out: |
| 351 | out.write(self.header) |
| 352 | |
David Benjamin | c5aa841 | 2016-07-29 17:41:58 -0400 | [diff] [blame] | 353 | self.PrintVariableSection(out, 'crypto_sources', |
James Robinson | 98dd68f | 2018-04-11 14:47:34 -0700 | [diff] [blame] | 354 | files['crypto'] + |
David Benjamin | c5aa841 | 2016-07-29 17:41:58 -0400 | [diff] [blame] | 355 | files['crypto_internal_headers']) |
James Robinson | 98dd68f | 2018-04-11 14:47:34 -0700 | [diff] [blame] | 356 | self.PrintVariableSection(out, 'crypto_headers', |
| 357 | files['crypto_headers']) |
David Benjamin | c5aa841 | 2016-07-29 17:41:58 -0400 | [diff] [blame] | 358 | self.PrintVariableSection(out, 'ssl_sources', |
James Robinson | 98dd68f | 2018-04-11 14:47:34 -0700 | [diff] [blame] | 359 | files['ssl'] + files['ssl_internal_headers']) |
| 360 | self.PrintVariableSection(out, 'ssl_headers', files['ssl_headers']) |
David Benjamin | bb0cb95 | 2020-12-17 16:35:39 -0500 | [diff] [blame] | 361 | self.PrintVariableSection(out, 'tool_sources', |
| 362 | files['tool'] + files['tool_headers']) |
David Benjamin | 38d01c6 | 2016-04-21 18:47:57 -0400 | [diff] [blame] | 363 | |
| 364 | for ((osname, arch), asm_files) in asm_outputs: |
| 365 | self.PrintVariableSection( |
| 366 | out, 'crypto_sources_%s_%s' % (osname, arch), asm_files) |
| 367 | |
| 368 | fuzzers = [os.path.splitext(os.path.basename(fuzzer))[0] |
| 369 | for fuzzer in files['fuzz']] |
| 370 | self.PrintVariableSection(out, 'fuzzers', fuzzers) |
| 371 | |
| 372 | with open('BUILD.generated_tests.gni', 'w+') as out: |
| 373 | self.firstSection = True |
| 374 | out.write(self.header) |
| 375 | |
David Benjamin | 9662843 | 2017-01-19 19:05:47 -0500 | [diff] [blame] | 376 | self.PrintVariableSection(out, 'test_support_sources', |
David Benjamin | c5aa841 | 2016-07-29 17:41:58 -0400 | [diff] [blame] | 377 | files['test_support'] + |
| 378 | files['test_support_headers']) |
David Benjamin | 9662843 | 2017-01-19 19:05:47 -0500 | [diff] [blame] | 379 | self.PrintVariableSection(out, 'crypto_test_sources', |
| 380 | files['crypto_test']) |
David Benjamin | f014d60 | 2019-05-07 18:58:06 -0500 | [diff] [blame] | 381 | self.PrintVariableSection(out, 'crypto_test_data', |
| 382 | files['crypto_test_data']) |
David Benjamin | 9662843 | 2017-01-19 19:05:47 -0500 | [diff] [blame] | 383 | self.PrintVariableSection(out, 'ssl_test_sources', files['ssl_test']) |
David Benjamin | 38d01c6 | 2016-04-21 18:47:57 -0400 | [diff] [blame] | 384 | |
| 385 | |
| 386 | class GYP(object): |
| 387 | |
| 388 | def __init__(self): |
| 389 | self.header = \ |
| 390 | """# Copyright (c) 2016 The Chromium Authors. All rights reserved. |
| 391 | # Use of this source code is governed by a BSD-style license that can be |
| 392 | # found in the LICENSE file. |
| 393 | |
| 394 | # This file is created by generate_build_files.py. Do not edit manually. |
| 395 | |
| 396 | """ |
| 397 | |
| 398 | def PrintVariableSection(self, out, name, files): |
| 399 | out.write(' \'%s\': [\n' % name) |
| 400 | for f in sorted(files): |
| 401 | out.write(' \'%s\',\n' % f) |
| 402 | out.write(' ],\n') |
| 403 | |
| 404 | def WriteFiles(self, files, asm_outputs): |
| 405 | with open('boringssl.gypi', 'w+') as gypi: |
| 406 | gypi.write(self.header + '{\n \'variables\': {\n') |
| 407 | |
David Benjamin | c5aa841 | 2016-07-29 17:41:58 -0400 | [diff] [blame] | 408 | self.PrintVariableSection(gypi, 'boringssl_ssl_sources', |
| 409 | files['ssl'] + files['ssl_headers'] + |
| 410 | files['ssl_internal_headers']) |
| 411 | self.PrintVariableSection(gypi, 'boringssl_crypto_sources', |
| 412 | files['crypto'] + files['crypto_headers'] + |
| 413 | files['crypto_internal_headers']) |
David Benjamin | 38d01c6 | 2016-04-21 18:47:57 -0400 | [diff] [blame] | 414 | |
| 415 | for ((osname, arch), asm_files) in asm_outputs: |
| 416 | self.PrintVariableSection(gypi, 'boringssl_%s_%s_sources' % |
| 417 | (osname, arch), asm_files) |
| 418 | |
| 419 | gypi.write(' }\n}\n') |
| 420 | |
Adam Langley | cfd80a9 | 2019-11-08 14:40:08 -0800 | [diff] [blame] | 421 | class CMake(object): |
| 422 | |
| 423 | def __init__(self): |
| 424 | self.header = \ |
| 425 | R'''# Copyright (c) 2019 The Chromium Authors. All rights reserved. |
| 426 | # Use of this source code is governed by a BSD-style license that can be |
| 427 | # found in the LICENSE file. |
| 428 | |
| 429 | # This file is created by generate_build_files.py. Do not edit manually. |
| 430 | |
| 431 | cmake_minimum_required(VERSION 3.0) |
| 432 | |
| 433 | project(BoringSSL LANGUAGES C CXX) |
| 434 | |
| 435 | if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") |
| 436 | set(CLANG 1) |
| 437 | endif() |
| 438 | |
| 439 | if(CMAKE_COMPILER_IS_GNUCXX OR CLANG) |
| 440 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fvisibility=hidden -fno-common -fno-exceptions -fno-rtti") |
| 441 | if(APPLE) |
| 442 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") |
| 443 | endif() |
| 444 | |
| 445 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden -fno-common") |
| 446 | if((CMAKE_C_COMPILER_VERSION VERSION_GREATER "4.8.99") OR CLANG) |
| 447 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11") |
| 448 | else() |
| 449 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99") |
| 450 | endif() |
| 451 | endif() |
| 452 | |
| 453 | # pthread_rwlock_t requires a feature flag. |
| 454 | if(NOT WIN32) |
| 455 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_XOPEN_SOURCE=700") |
| 456 | endif() |
| 457 | |
| 458 | if(WIN32) |
| 459 | add_definitions(-D_HAS_EXCEPTIONS=0) |
| 460 | add_definitions(-DWIN32_LEAN_AND_MEAN) |
| 461 | add_definitions(-DNOMINMAX) |
| 462 | # Allow use of fopen. |
| 463 | add_definitions(-D_CRT_SECURE_NO_WARNINGS) |
| 464 | # VS 2017 and higher supports STL-only warning suppressions. |
| 465 | # A bug in CMake < 3.13.0 may cause the space in this value to |
| 466 | # cause issues when building with NASM. In that case, update CMake. |
| 467 | add_definitions("-D_STL_EXTRA_DISABLED_WARNINGS=4774 4987") |
| 468 | endif() |
| 469 | |
| 470 | add_definitions(-DBORINGSSL_IMPLEMENTATION) |
| 471 | |
Adam Langley | 8973007 | 2020-01-17 08:18:07 -0800 | [diff] [blame] | 472 | # CMake's iOS support uses Apple's multiple-architecture toolchain. It takes an |
| 473 | # architecture list from CMAKE_OSX_ARCHITECTURES, leaves CMAKE_SYSTEM_PROCESSOR |
| 474 | # alone, and expects all architecture-specific logic to be conditioned within |
| 475 | # the source files rather than the build. This does not work for our assembly |
| 476 | # files, so we fix CMAKE_SYSTEM_PROCESSOR and only support single-architecture |
| 477 | # builds. |
| 478 | if(NOT OPENSSL_NO_ASM AND CMAKE_OSX_ARCHITECTURES) |
| 479 | list(LENGTH CMAKE_OSX_ARCHITECTURES NUM_ARCHES) |
| 480 | if(NOT ${NUM_ARCHES} EQUAL 1) |
| 481 | message(FATAL_ERROR "Universal binaries not supported.") |
| 482 | endif() |
| 483 | list(GET CMAKE_OSX_ARCHITECTURES 0 CMAKE_SYSTEM_PROCESSOR) |
| 484 | endif() |
| 485 | |
Adam Langley | cfd80a9 | 2019-11-08 14:40:08 -0800 | [diff] [blame] | 486 | if(OPENSSL_NO_ASM) |
| 487 | add_definitions(-DOPENSSL_NO_ASM) |
| 488 | set(ARCH "generic") |
| 489 | elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64") |
| 490 | set(ARCH "x86_64") |
| 491 | elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "amd64") |
| 492 | set(ARCH "x86_64") |
| 493 | elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64") |
| 494 | # cmake reports AMD64 on Windows, but we might be building for 32-bit. |
David Benjamin | 884614c | 2020-06-16 10:59:58 -0400 | [diff] [blame] | 495 | if(CMAKE_SIZEOF_VOID_P EQUAL 8) |
Adam Langley | cfd80a9 | 2019-11-08 14:40:08 -0800 | [diff] [blame] | 496 | set(ARCH "x86_64") |
| 497 | else() |
| 498 | set(ARCH "x86") |
| 499 | endif() |
| 500 | elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86") |
| 501 | set(ARCH "x86") |
| 502 | elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "i386") |
| 503 | set(ARCH "x86") |
| 504 | elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "i686") |
| 505 | set(ARCH "x86") |
| 506 | elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64") |
| 507 | set(ARCH "aarch64") |
| 508 | elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "arm64") |
| 509 | set(ARCH "aarch64") |
| 510 | # Apple A12 Bionic chipset which is added in iPhone XS/XS Max/XR uses arm64e architecture. |
| 511 | elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "arm64e") |
| 512 | set(ARCH "aarch64") |
| 513 | elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "^arm*") |
| 514 | set(ARCH "arm") |
| 515 | elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "mips") |
| 516 | # Just to avoid the “unknown processor” error. |
| 517 | set(ARCH "generic") |
| 518 | elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "ppc64le") |
| 519 | set(ARCH "ppc64le") |
| 520 | else() |
| 521 | message(FATAL_ERROR "Unknown processor:" ${CMAKE_SYSTEM_PROCESSOR}) |
| 522 | endif() |
| 523 | |
| 524 | if(NOT OPENSSL_NO_ASM) |
| 525 | if(UNIX) |
| 526 | enable_language(ASM) |
| 527 | |
| 528 | # Clang's integerated assembler does not support debug symbols. |
| 529 | if(NOT CMAKE_ASM_COMPILER_ID MATCHES "Clang") |
| 530 | set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -Wa,-g") |
| 531 | endif() |
| 532 | |
| 533 | # CMake does not add -isysroot and -arch flags to assembly. |
| 534 | if(APPLE) |
| 535 | if(CMAKE_OSX_SYSROOT) |
| 536 | set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -isysroot \"${CMAKE_OSX_SYSROOT}\"") |
| 537 | endif() |
| 538 | foreach(arch ${CMAKE_OSX_ARCHITECTURES}) |
| 539 | set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -arch ${arch}") |
| 540 | endforeach() |
| 541 | endif() |
| 542 | else() |
| 543 | set(CMAKE_ASM_NASM_FLAGS "${CMAKE_ASM_NASM_FLAGS} -gcv8") |
| 544 | enable_language(ASM_NASM) |
| 545 | endif() |
| 546 | endif() |
| 547 | |
Adam Langley | a0cdbf9 | 2020-01-21 09:07:46 -0800 | [diff] [blame] | 548 | if(BUILD_SHARED_LIBS) |
| 549 | add_definitions(-DBORINGSSL_SHARED_LIBRARY) |
| 550 | # Enable position-independent code globally. This is needed because |
| 551 | # some library targets are OBJECT libraries. |
| 552 | set(CMAKE_POSITION_INDEPENDENT_CODE TRUE) |
| 553 | endif() |
| 554 | |
Adam Langley | cfd80a9 | 2019-11-08 14:40:08 -0800 | [diff] [blame] | 555 | include_directories(src/include) |
| 556 | |
| 557 | ''' |
| 558 | |
| 559 | def PrintLibrary(self, out, name, files): |
| 560 | out.write('add_library(\n') |
| 561 | out.write(' %s\n\n' % name) |
| 562 | |
| 563 | for f in sorted(files): |
| 564 | out.write(' %s\n' % PathOf(f)) |
| 565 | |
| 566 | out.write(')\n\n') |
| 567 | |
| 568 | def PrintExe(self, out, name, files, libs): |
| 569 | out.write('add_executable(\n') |
| 570 | out.write(' %s\n\n' % name) |
| 571 | |
| 572 | for f in sorted(files): |
| 573 | out.write(' %s\n' % PathOf(f)) |
| 574 | |
| 575 | out.write(')\n\n') |
| 576 | out.write('target_link_libraries(%s %s)\n\n' % (name, ' '.join(libs))) |
| 577 | |
| 578 | def PrintSection(self, out, name, files): |
| 579 | out.write('set(\n') |
| 580 | out.write(' %s\n\n' % name) |
| 581 | for f in sorted(files): |
| 582 | out.write(' %s\n' % PathOf(f)) |
| 583 | out.write(')\n\n') |
| 584 | |
| 585 | def WriteFiles(self, files, asm_outputs): |
| 586 | with open('CMakeLists.txt', 'w+') as cmake: |
| 587 | cmake.write(self.header) |
| 588 | |
| 589 | for ((osname, arch), asm_files) in asm_outputs: |
| 590 | self.PrintSection(cmake, 'CRYPTO_%s_%s_SOURCES' % (osname, arch), |
| 591 | asm_files) |
| 592 | |
| 593 | cmake.write( |
| 594 | R'''if(APPLE AND ${ARCH} STREQUAL "aarch64") |
| 595 | set(CRYPTO_ARCH_SOURCES ${CRYPTO_ios_aarch64_SOURCES}) |
| 596 | elseif(APPLE AND ${ARCH} STREQUAL "arm") |
| 597 | set(CRYPTO_ARCH_SOURCES ${CRYPTO_ios_arm_SOURCES}) |
| 598 | elseif(APPLE) |
| 599 | set(CRYPTO_ARCH_SOURCES ${CRYPTO_mac_${ARCH}_SOURCES}) |
| 600 | elseif(UNIX) |
| 601 | set(CRYPTO_ARCH_SOURCES ${CRYPTO_linux_${ARCH}_SOURCES}) |
| 602 | elseif(WIN32) |
| 603 | set(CRYPTO_ARCH_SOURCES ${CRYPTO_win_${ARCH}_SOURCES}) |
| 604 | endif() |
| 605 | |
| 606 | ''') |
| 607 | |
| 608 | self.PrintLibrary(cmake, 'crypto', |
| 609 | files['crypto'] + ['${CRYPTO_ARCH_SOURCES}']) |
| 610 | self.PrintLibrary(cmake, 'ssl', files['ssl']) |
Adam Langley | ff63113 | 2020-01-13 15:24:22 -0800 | [diff] [blame] | 611 | self.PrintExe(cmake, 'bssl', files['tool'], ['ssl', 'crypto']) |
| 612 | |
| 613 | cmake.write( |
David Benjamin | 8f88b27 | 2020-07-09 13:35:01 -0400 | [diff] [blame] | 614 | R'''if(NOT WIN32 AND NOT ANDROID) |
Adam Langley | ff63113 | 2020-01-13 15:24:22 -0800 | [diff] [blame] | 615 | target_link_libraries(crypto pthread) |
| 616 | endif() |
| 617 | |
David Benjamin | 8f88b27 | 2020-07-09 13:35:01 -0400 | [diff] [blame] | 618 | if(WIN32) |
| 619 | target_link_libraries(bssl ws2_32) |
| 620 | endif() |
| 621 | |
Adam Langley | ff63113 | 2020-01-13 15:24:22 -0800 | [diff] [blame] | 622 | ''') |
David Benjamin | 38d01c6 | 2016-04-21 18:47:57 -0400 | [diff] [blame] | 623 | |
David Benjamin | 8c0a6eb | 2020-07-16 14:45:51 -0400 | [diff] [blame] | 624 | class JSON(object): |
| 625 | def WriteFiles(self, files, asm_outputs): |
| 626 | sources = dict(files) |
| 627 | for ((osname, arch), asm_files) in asm_outputs: |
| 628 | sources['crypto_%s_%s' % (osname, arch)] = asm_files |
| 629 | with open('sources.json', 'w+') as f: |
| 630 | json.dump(sources, f, sort_keys=True, indent=2) |
| 631 | |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 632 | def FindCMakeFiles(directory): |
| 633 | """Returns list of all CMakeLists.txt files recursively in directory.""" |
| 634 | cmakefiles = [] |
| 635 | |
| 636 | for (path, _, filenames) in os.walk(directory): |
| 637 | for filename in filenames: |
| 638 | if filename == 'CMakeLists.txt': |
| 639 | cmakefiles.append(os.path.join(path, filename)) |
| 640 | |
| 641 | return cmakefiles |
| 642 | |
Adam Langley | fd49993 | 2017-04-04 14:21:43 -0700 | [diff] [blame] | 643 | def OnlyFIPSFragments(path, dent, is_dir): |
Matthew Braithwaite | 95511e9 | 2017-05-08 16:38:03 -0700 | [diff] [blame] | 644 | return is_dir or (path.startswith( |
| 645 | os.path.join('src', 'crypto', 'fipsmodule', '')) and |
| 646 | NoTests(path, dent, is_dir)) |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 647 | |
Adam Langley | fd49993 | 2017-04-04 14:21:43 -0700 | [diff] [blame] | 648 | def NoTestsNorFIPSFragments(path, dent, is_dir): |
Adam Langley | 323f1eb | 2017-04-06 17:29:10 -0700 | [diff] [blame] | 649 | return (NoTests(path, dent, is_dir) and |
| 650 | (is_dir or not OnlyFIPSFragments(path, dent, is_dir))) |
Adam Langley | fd49993 | 2017-04-04 14:21:43 -0700 | [diff] [blame] | 651 | |
| 652 | def NoTests(path, dent, is_dir): |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 653 | """Filter function that can be passed to FindCFiles in order to remove test |
| 654 | sources.""" |
| 655 | if is_dir: |
| 656 | return dent != 'test' |
David Benjamin | 96ee4a8 | 2017-07-09 23:46:47 -0400 | [diff] [blame] | 657 | return 'test.' not in dent |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 658 | |
| 659 | |
Adam Langley | fd49993 | 2017-04-04 14:21:43 -0700 | [diff] [blame] | 660 | def OnlyTests(path, dent, is_dir): |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 661 | """Filter function that can be passed to FindCFiles in order to remove |
| 662 | non-test sources.""" |
| 663 | if is_dir: |
David Benjamin | 2607383 | 2015-05-11 20:52:48 -0400 | [diff] [blame] | 664 | return dent != 'test' |
David Benjamin | 96ee4a8 | 2017-07-09 23:46:47 -0400 | [diff] [blame] | 665 | return '_test.' in dent |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 666 | |
| 667 | |
Adam Langley | fd49993 | 2017-04-04 14:21:43 -0700 | [diff] [blame] | 668 | def AllFiles(path, dent, is_dir): |
David Benjamin | 2607383 | 2015-05-11 20:52:48 -0400 | [diff] [blame] | 669 | """Filter function that can be passed to FindCFiles in order to include all |
| 670 | sources.""" |
| 671 | return True |
| 672 | |
| 673 | |
Adam Langley | fd49993 | 2017-04-04 14:21:43 -0700 | [diff] [blame] | 674 | def NoTestRunnerFiles(path, dent, is_dir): |
Martin Kreichgauer | 8b487b7 | 2017-04-03 16:07:27 -0700 | [diff] [blame] | 675 | """Filter function that can be passed to FindCFiles or FindHeaderFiles in |
| 676 | order to exclude test runner files.""" |
| 677 | # NOTE(martinkr): This prevents .h/.cc files in src/ssl/test/runner, which |
| 678 | # are in their own subpackage, from being included in boringssl/BUILD files. |
| 679 | return not is_dir or dent != 'runner' |
| 680 | |
| 681 | |
David Benjamin | 3ecd0a5 | 2017-05-19 15:26:18 -0400 | [diff] [blame] | 682 | def NotGTestSupport(path, dent, is_dir): |
David Benjamin | c388963 | 2019-03-01 15:03:05 -0500 | [diff] [blame] | 683 | return 'gtest' not in dent and 'abi_test' not in dent |
David Benjamin | 9662843 | 2017-01-19 19:05:47 -0500 | [diff] [blame] | 684 | |
| 685 | |
Adam Langley | fd49993 | 2017-04-04 14:21:43 -0700 | [diff] [blame] | 686 | def SSLHeaderFiles(path, dent, is_dir): |
Aaron Green | 0e15002 | 2018-10-16 12:05:29 -0700 | [diff] [blame] | 687 | return dent in ['ssl.h', 'tls1.h', 'ssl23.h', 'ssl3.h', 'dtls1.h', 'srtp.h'] |
Adam Langley | 049ef41 | 2015-06-09 18:20:57 -0700 | [diff] [blame] | 688 | |
| 689 | |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 690 | def FindCFiles(directory, filter_func): |
| 691 | """Recurses through directory and returns a list of paths to all the C source |
| 692 | files that pass filter_func.""" |
| 693 | cfiles = [] |
| 694 | |
| 695 | for (path, dirnames, filenames) in os.walk(directory): |
| 696 | for filename in filenames: |
| 697 | if not filename.endswith('.c') and not filename.endswith('.cc'): |
| 698 | continue |
Adam Langley | fd49993 | 2017-04-04 14:21:43 -0700 | [diff] [blame] | 699 | if not filter_func(path, filename, False): |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 700 | continue |
| 701 | cfiles.append(os.path.join(path, filename)) |
| 702 | |
| 703 | for (i, dirname) in enumerate(dirnames): |
Adam Langley | fd49993 | 2017-04-04 14:21:43 -0700 | [diff] [blame] | 704 | if not filter_func(path, dirname, True): |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 705 | del dirnames[i] |
| 706 | |
David Benjamin | edd4c5f | 2020-08-19 14:46:17 -0400 | [diff] [blame] | 707 | cfiles.sort() |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 708 | return cfiles |
| 709 | |
| 710 | |
Adam Langley | 049ef41 | 2015-06-09 18:20:57 -0700 | [diff] [blame] | 711 | def FindHeaderFiles(directory, filter_func): |
| 712 | """Recurses through directory and returns a list of paths to all the header files that pass filter_func.""" |
| 713 | hfiles = [] |
| 714 | |
| 715 | for (path, dirnames, filenames) in os.walk(directory): |
| 716 | for filename in filenames: |
| 717 | if not filename.endswith('.h'): |
| 718 | continue |
Adam Langley | fd49993 | 2017-04-04 14:21:43 -0700 | [diff] [blame] | 719 | if not filter_func(path, filename, False): |
Adam Langley | 049ef41 | 2015-06-09 18:20:57 -0700 | [diff] [blame] | 720 | continue |
| 721 | hfiles.append(os.path.join(path, filename)) |
| 722 | |
Matt Braithwaite | dfdd49c | 2016-06-13 17:06:48 -0700 | [diff] [blame] | 723 | for (i, dirname) in enumerate(dirnames): |
Adam Langley | fd49993 | 2017-04-04 14:21:43 -0700 | [diff] [blame] | 724 | if not filter_func(path, dirname, True): |
Matt Braithwaite | dfdd49c | 2016-06-13 17:06:48 -0700 | [diff] [blame] | 725 | del dirnames[i] |
| 726 | |
David Benjamin | edd4c5f | 2020-08-19 14:46:17 -0400 | [diff] [blame] | 727 | hfiles.sort() |
Adam Langley | 049ef41 | 2015-06-09 18:20:57 -0700 | [diff] [blame] | 728 | return hfiles |
| 729 | |
| 730 | |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 731 | def ExtractPerlAsmFromCMakeFile(cmakefile): |
| 732 | """Parses the contents of the CMakeLists.txt file passed as an argument and |
| 733 | returns a list of all the perlasm() directives found in the file.""" |
| 734 | perlasms = [] |
| 735 | with open(cmakefile) as f: |
| 736 | for line in f: |
| 737 | line = line.strip() |
| 738 | if not line.startswith('perlasm('): |
| 739 | continue |
| 740 | if not line.endswith(')'): |
| 741 | raise ValueError('Bad perlasm line in %s' % cmakefile) |
| 742 | # Remove "perlasm(" from start and ")" from end |
| 743 | params = line[8:-1].split() |
| 744 | if len(params) < 2: |
| 745 | raise ValueError('Bad perlasm line in %s' % cmakefile) |
| 746 | perlasms.append({ |
| 747 | 'extra_args': params[2:], |
| 748 | 'input': os.path.join(os.path.dirname(cmakefile), params[1]), |
| 749 | 'output': os.path.join(os.path.dirname(cmakefile), params[0]), |
| 750 | }) |
| 751 | |
| 752 | return perlasms |
| 753 | |
| 754 | |
| 755 | def ReadPerlAsmOperations(): |
| 756 | """Returns a list of all perlasm() directives found in CMake config files in |
| 757 | src/.""" |
| 758 | perlasms = [] |
| 759 | cmakefiles = FindCMakeFiles('src') |
| 760 | |
| 761 | for cmakefile in cmakefiles: |
| 762 | perlasms.extend(ExtractPerlAsmFromCMakeFile(cmakefile)) |
| 763 | |
| 764 | return perlasms |
| 765 | |
| 766 | |
| 767 | def PerlAsm(output_filename, input_filename, perlasm_style, extra_args): |
| 768 | """Runs the a perlasm script and puts the output into output_filename.""" |
| 769 | base_dir = os.path.dirname(output_filename) |
| 770 | if not os.path.isdir(base_dir): |
| 771 | os.makedirs(base_dir) |
David Benjamin | fdd8e9c | 2016-06-26 13:18:50 -0400 | [diff] [blame] | 772 | subprocess.check_call( |
| 773 | ['perl', input_filename, perlasm_style] + extra_args + [output_filename]) |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 774 | |
| 775 | |
| 776 | def ArchForAsmFilename(filename): |
| 777 | """Returns the architectures that a given asm file should be compiled for |
| 778 | based on substrings in the filename.""" |
| 779 | |
| 780 | if 'x86_64' in filename or 'avx2' in filename: |
| 781 | return ['x86_64'] |
| 782 | elif ('x86' in filename and 'x86_64' not in filename) or '586' in filename: |
| 783 | return ['x86'] |
| 784 | elif 'armx' in filename: |
| 785 | return ['arm', 'aarch64'] |
| 786 | elif 'armv8' in filename: |
| 787 | return ['aarch64'] |
| 788 | elif 'arm' in filename: |
| 789 | return ['arm'] |
David Benjamin | 9f16ce1 | 2016-09-27 16:30:22 -0400 | [diff] [blame] | 790 | elif 'ppc' in filename: |
| 791 | return ['ppc64le'] |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 792 | else: |
| 793 | raise ValueError('Unknown arch for asm filename: ' + filename) |
| 794 | |
| 795 | |
| 796 | def WriteAsmFiles(perlasms): |
| 797 | """Generates asm files from perlasm directives for each supported OS x |
| 798 | platform combination.""" |
| 799 | asmfiles = {} |
| 800 | |
| 801 | for osarch in OS_ARCH_COMBOS: |
| 802 | (osname, arch, perlasm_style, extra_args, asm_ext) = osarch |
| 803 | key = (osname, arch) |
| 804 | outDir = '%s-%s' % key |
| 805 | |
| 806 | for perlasm in perlasms: |
| 807 | filename = os.path.basename(perlasm['input']) |
| 808 | output = perlasm['output'] |
| 809 | if not output.startswith('src'): |
| 810 | raise ValueError('output missing src: %s' % output) |
| 811 | output = os.path.join(outDir, output[4:]) |
William Hesse | c618c40 | 2015-06-22 16:34:02 +0200 | [diff] [blame] | 812 | if output.endswith('-armx.${ASM_EXT}'): |
| 813 | output = output.replace('-armx', |
| 814 | '-armx64' if arch == 'aarch64' else '-armx32') |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 815 | output = output.replace('${ASM_EXT}', asm_ext) |
| 816 | |
| 817 | if arch in ArchForAsmFilename(filename): |
| 818 | PerlAsm(output, perlasm['input'], perlasm_style, |
| 819 | perlasm['extra_args'] + extra_args) |
| 820 | asmfiles.setdefault(key, []).append(output) |
| 821 | |
| 822 | for (key, non_perl_asm_files) in NON_PERL_FILES.iteritems(): |
| 823 | asmfiles.setdefault(key, []).extend(non_perl_asm_files) |
| 824 | |
David Benjamin | edd4c5f | 2020-08-19 14:46:17 -0400 | [diff] [blame] | 825 | for files in asmfiles.itervalues(): |
| 826 | files.sort() |
| 827 | |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 828 | return asmfiles |
| 829 | |
| 830 | |
David Benjamin | 3ecd0a5 | 2017-05-19 15:26:18 -0400 | [diff] [blame] | 831 | def ExtractVariablesFromCMakeFile(cmakefile): |
| 832 | """Parses the contents of the CMakeLists.txt file passed as an argument and |
| 833 | returns a dictionary of exported source lists.""" |
| 834 | variables = {} |
| 835 | in_set_command = False |
| 836 | set_command = [] |
| 837 | with open(cmakefile) as f: |
| 838 | for line in f: |
| 839 | if '#' in line: |
| 840 | line = line[:line.index('#')] |
| 841 | line = line.strip() |
| 842 | |
| 843 | if not in_set_command: |
| 844 | if line.startswith('set('): |
| 845 | in_set_command = True |
| 846 | set_command = [] |
| 847 | elif line == ')': |
| 848 | in_set_command = False |
| 849 | if not set_command: |
| 850 | raise ValueError('Empty set command') |
| 851 | variables[set_command[0]] = set_command[1:] |
| 852 | else: |
| 853 | set_command.extend([c for c in line.split(' ') if c]) |
| 854 | |
| 855 | if in_set_command: |
| 856 | raise ValueError('Unfinished set command') |
| 857 | return variables |
| 858 | |
| 859 | |
Adam Langley | 049ef41 | 2015-06-09 18:20:57 -0700 | [diff] [blame] | 860 | def main(platforms): |
David Benjamin | 3ecd0a5 | 2017-05-19 15:26:18 -0400 | [diff] [blame] | 861 | cmake = ExtractVariablesFromCMakeFile(os.path.join('src', 'sources.cmake')) |
Andres Erbsen | 5b280a8 | 2017-10-30 15:58:33 +0000 | [diff] [blame] | 862 | crypto_c_files = (FindCFiles(os.path.join('src', 'crypto'), NoTestsNorFIPSFragments) + |
Adam Langley | 7f02881 | 2019-10-18 14:48:11 -0700 | [diff] [blame] | 863 | FindCFiles(os.path.join('src', 'third_party', 'fiat'), NoTestsNorFIPSFragments)) |
Adam Langley | fd49993 | 2017-04-04 14:21:43 -0700 | [diff] [blame] | 864 | fips_fragments = FindCFiles(os.path.join('src', 'crypto', 'fipsmodule'), OnlyFIPSFragments) |
Adam Langley | feca9e5 | 2017-01-23 13:07:50 -0800 | [diff] [blame] | 865 | ssl_source_files = FindCFiles(os.path.join('src', 'ssl'), NoTests) |
David Benjamin | 38d01c6 | 2016-04-21 18:47:57 -0400 | [diff] [blame] | 866 | tool_c_files = FindCFiles(os.path.join('src', 'tool'), NoTests) |
Adam Langley | f11f233 | 2016-06-30 11:56:19 -0700 | [diff] [blame] | 867 | tool_h_files = FindHeaderFiles(os.path.join('src', 'tool'), AllFiles) |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 868 | |
Pete Bentley | 44544d9 | 2019-08-15 15:01:26 +0100 | [diff] [blame] | 869 | # BCM shared library C files |
| 870 | bcm_crypto_c_files = [ |
| 871 | os.path.join('src', 'crypto', 'fipsmodule', 'bcm.c') |
| 872 | ] |
| 873 | |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 874 | # Generate err_data.c |
| 875 | with open('err_data.c', 'w+') as err_data: |
| 876 | subprocess.check_call(['go', 'run', 'err_data_generate.go'], |
| 877 | cwd=os.path.join('src', 'crypto', 'err'), |
| 878 | stdout=err_data) |
| 879 | crypto_c_files.append('err_data.c') |
David Benjamin | edd4c5f | 2020-08-19 14:46:17 -0400 | [diff] [blame] | 880 | crypto_c_files.sort() |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 881 | |
David Benjamin | 38d01c6 | 2016-04-21 18:47:57 -0400 | [diff] [blame] | 882 | test_support_c_files = FindCFiles(os.path.join('src', 'crypto', 'test'), |
David Benjamin | 3ecd0a5 | 2017-05-19 15:26:18 -0400 | [diff] [blame] | 883 | NotGTestSupport) |
Matt Braithwaite | dfdd49c | 2016-06-13 17:06:48 -0700 | [diff] [blame] | 884 | test_support_h_files = ( |
| 885 | FindHeaderFiles(os.path.join('src', 'crypto', 'test'), AllFiles) + |
Martin Kreichgauer | 8b487b7 | 2017-04-03 16:07:27 -0700 | [diff] [blame] | 886 | FindHeaderFiles(os.path.join('src', 'ssl', 'test'), NoTestRunnerFiles)) |
David Benjamin | 2607383 | 2015-05-11 20:52:48 -0400 | [diff] [blame] | 887 | |
Adam Langley | 990a323 | 2018-05-22 10:02:59 -0700 | [diff] [blame] | 888 | crypto_test_files = [] |
| 889 | if EMBED_TEST_DATA: |
| 890 | # Generate crypto_test_data.cc |
| 891 | with open('crypto_test_data.cc', 'w+') as out: |
| 892 | subprocess.check_call( |
| 893 | ['go', 'run', 'util/embed_test_data.go'] + cmake['CRYPTO_TEST_DATA'], |
| 894 | cwd='src', |
| 895 | stdout=out) |
| 896 | crypto_test_files += ['crypto_test_data.cc'] |
David Benjamin | 3ecd0a5 | 2017-05-19 15:26:18 -0400 | [diff] [blame] | 897 | |
Adam Langley | 990a323 | 2018-05-22 10:02:59 -0700 | [diff] [blame] | 898 | crypto_test_files += FindCFiles(os.path.join('src', 'crypto'), OnlyTests) |
David Benjamin | 96ee4a8 | 2017-07-09 23:46:47 -0400 | [diff] [blame] | 899 | crypto_test_files += [ |
David Benjamin | c388963 | 2019-03-01 15:03:05 -0500 | [diff] [blame] | 900 | 'src/crypto/test/abi_test.cc', |
David Benjamin | 3ecd0a5 | 2017-05-19 15:26:18 -0400 | [diff] [blame] | 901 | 'src/crypto/test/file_test_gtest.cc', |
| 902 | 'src/crypto/test/gtest_main.cc', |
| 903 | ] |
Adam Langley | 3e502c8 | 2019-10-16 09:56:38 -0700 | [diff] [blame] | 904 | # urandom_test.cc is in a separate binary so that it can be test PRNG |
| 905 | # initialisation. |
| 906 | crypto_test_files = [ |
| 907 | file for file in crypto_test_files |
| 908 | if not file.endswith('/urandom_test.cc') |
| 909 | ] |
David Benjamin | edd4c5f | 2020-08-19 14:46:17 -0400 | [diff] [blame] | 910 | crypto_test_files.sort() |
David Benjamin | 1d5a570 | 2017-02-13 22:11:49 -0500 | [diff] [blame] | 911 | |
| 912 | ssl_test_files = FindCFiles(os.path.join('src', 'ssl'), OnlyTests) |
Robert Sloan | ae1e087 | 2019-03-01 16:01:30 -0800 | [diff] [blame] | 913 | ssl_test_files += [ |
| 914 | 'src/crypto/test/abi_test.cc', |
| 915 | 'src/crypto/test/gtest_main.cc', |
| 916 | ] |
David Benjamin | edd4c5f | 2020-08-19 14:46:17 -0400 | [diff] [blame] | 917 | ssl_test_files.sort() |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 918 | |
Adam Langley | 3e502c8 | 2019-10-16 09:56:38 -0700 | [diff] [blame] | 919 | urandom_test_files = [ |
| 920 | 'src/crypto/fipsmodule/rand/urandom_test.cc', |
| 921 | ] |
| 922 | |
David Benjamin | 38d01c6 | 2016-04-21 18:47:57 -0400 | [diff] [blame] | 923 | fuzz_c_files = FindCFiles(os.path.join('src', 'fuzz'), NoTests) |
| 924 | |
David Benjamin | edd4c5f | 2020-08-19 14:46:17 -0400 | [diff] [blame] | 925 | ssl_h_files = FindHeaderFiles(os.path.join('src', 'include', 'openssl'), |
| 926 | SSLHeaderFiles) |
Adam Langley | 049ef41 | 2015-06-09 18:20:57 -0700 | [diff] [blame] | 927 | |
Adam Langley | fd49993 | 2017-04-04 14:21:43 -0700 | [diff] [blame] | 928 | def NotSSLHeaderFiles(path, filename, is_dir): |
| 929 | return not SSLHeaderFiles(path, filename, is_dir) |
David Benjamin | edd4c5f | 2020-08-19 14:46:17 -0400 | [diff] [blame] | 930 | crypto_h_files = FindHeaderFiles(os.path.join('src', 'include', 'openssl'), |
| 931 | NotSSLHeaderFiles) |
Adam Langley | 049ef41 | 2015-06-09 18:20:57 -0700 | [diff] [blame] | 932 | |
| 933 | ssl_internal_h_files = FindHeaderFiles(os.path.join('src', 'ssl'), NoTests) |
Andres Erbsen | 5b280a8 | 2017-10-30 15:58:33 +0000 | [diff] [blame] | 934 | crypto_internal_h_files = ( |
| 935 | FindHeaderFiles(os.path.join('src', 'crypto'), NoTests) + |
Adam Langley | 7f02881 | 2019-10-18 14:48:11 -0700 | [diff] [blame] | 936 | FindHeaderFiles(os.path.join('src', 'third_party', 'fiat'), NoTests)) |
Adam Langley | 049ef41 | 2015-06-09 18:20:57 -0700 | [diff] [blame] | 937 | |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 938 | files = { |
Pete Bentley | 44544d9 | 2019-08-15 15:01:26 +0100 | [diff] [blame] | 939 | 'bcm_crypto': bcm_crypto_c_files, |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 940 | 'crypto': crypto_c_files, |
Adam Langley | 049ef41 | 2015-06-09 18:20:57 -0700 | [diff] [blame] | 941 | 'crypto_headers': crypto_h_files, |
| 942 | 'crypto_internal_headers': crypto_internal_h_files, |
David Benjamin | edd4c5f | 2020-08-19 14:46:17 -0400 | [diff] [blame] | 943 | 'crypto_test': crypto_test_files, |
Adam Langley | 990a323 | 2018-05-22 10:02:59 -0700 | [diff] [blame] | 944 | 'crypto_test_data': sorted('src/' + x for x in cmake['CRYPTO_TEST_DATA']), |
Adam Langley | fd49993 | 2017-04-04 14:21:43 -0700 | [diff] [blame] | 945 | 'fips_fragments': fips_fragments, |
David Benjamin | 38d01c6 | 2016-04-21 18:47:57 -0400 | [diff] [blame] | 946 | 'fuzz': fuzz_c_files, |
Adam Langley | feca9e5 | 2017-01-23 13:07:50 -0800 | [diff] [blame] | 947 | 'ssl': ssl_source_files, |
Adam Langley | 049ef41 | 2015-06-09 18:20:57 -0700 | [diff] [blame] | 948 | 'ssl_headers': ssl_h_files, |
| 949 | 'ssl_internal_headers': ssl_internal_h_files, |
David Benjamin | edd4c5f | 2020-08-19 14:46:17 -0400 | [diff] [blame] | 950 | 'ssl_test': ssl_test_files, |
David Benjamin | 38d01c6 | 2016-04-21 18:47:57 -0400 | [diff] [blame] | 951 | 'tool': tool_c_files, |
Adam Langley | f11f233 | 2016-06-30 11:56:19 -0700 | [diff] [blame] | 952 | 'tool_headers': tool_h_files, |
David Benjamin | c5aa841 | 2016-07-29 17:41:58 -0400 | [diff] [blame] | 953 | 'test_support': test_support_c_files, |
| 954 | 'test_support_headers': test_support_h_files, |
David Benjamin | edd4c5f | 2020-08-19 14:46:17 -0400 | [diff] [blame] | 955 | 'urandom_test': urandom_test_files, |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 956 | } |
| 957 | |
| 958 | asm_outputs = sorted(WriteAsmFiles(ReadPerlAsmOperations()).iteritems()) |
| 959 | |
Adam Langley | 049ef41 | 2015-06-09 18:20:57 -0700 | [diff] [blame] | 960 | for platform in platforms: |
| 961 | platform.WriteFiles(files, asm_outputs) |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 962 | |
| 963 | return 0 |
| 964 | |
David Benjamin | 8c0a6eb | 2020-07-16 14:45:51 -0400 | [diff] [blame] | 965 | ALL_PLATFORMS = { |
| 966 | 'android': Android, |
| 967 | 'android-cmake': AndroidCMake, |
| 968 | 'bazel': Bazel, |
| 969 | 'cmake': CMake, |
| 970 | 'eureka': Eureka, |
| 971 | 'gn': GN, |
| 972 | 'gyp': GYP, |
| 973 | 'json': JSON, |
| 974 | } |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 975 | |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 976 | if __name__ == '__main__': |
David Benjamin | 8c0a6eb | 2020-07-16 14:45:51 -0400 | [diff] [blame] | 977 | parser = optparse.OptionParser(usage='Usage: %%prog [--prefix=<path>] [%s]' % |
| 978 | '|'.join(sorted(ALL_PLATFORMS.keys()))) |
Matt Braithwaite | 1669589 | 2016-06-09 09:34:11 -0700 | [diff] [blame] | 979 | parser.add_option('--prefix', dest='prefix', |
| 980 | help='For Bazel, prepend argument to all source files') |
Adam Langley | 990a323 | 2018-05-22 10:02:59 -0700 | [diff] [blame] | 981 | parser.add_option( |
| 982 | '--embed_test_data', type='choice', dest='embed_test_data', |
| 983 | action='store', default="true", choices=["true", "false"], |
David Benjamin | f014d60 | 2019-05-07 18:58:06 -0500 | [diff] [blame] | 984 | help='For Bazel or GN, don\'t embed data files in crypto_test_data.cc') |
Matt Braithwaite | 1669589 | 2016-06-09 09:34:11 -0700 | [diff] [blame] | 985 | options, args = parser.parse_args(sys.argv[1:]) |
| 986 | PREFIX = options.prefix |
Adam Langley | 990a323 | 2018-05-22 10:02:59 -0700 | [diff] [blame] | 987 | EMBED_TEST_DATA = (options.embed_test_data == "true") |
Matt Braithwaite | 1669589 | 2016-06-09 09:34:11 -0700 | [diff] [blame] | 988 | |
| 989 | if not args: |
| 990 | parser.print_help() |
| 991 | sys.exit(1) |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 992 | |
Adam Langley | 049ef41 | 2015-06-09 18:20:57 -0700 | [diff] [blame] | 993 | platforms = [] |
Matt Braithwaite | 1669589 | 2016-06-09 09:34:11 -0700 | [diff] [blame] | 994 | for s in args: |
David Benjamin | 8c0a6eb | 2020-07-16 14:45:51 -0400 | [diff] [blame] | 995 | platform = ALL_PLATFORMS.get(s) |
| 996 | if platform is None: |
Matt Braithwaite | 1669589 | 2016-06-09 09:34:11 -0700 | [diff] [blame] | 997 | parser.print_help() |
| 998 | sys.exit(1) |
David Benjamin | 8c0a6eb | 2020-07-16 14:45:51 -0400 | [diff] [blame] | 999 | platforms.append(platform()) |
Adam Langley | 9e1a660 | 2015-05-05 17:47:53 -0700 | [diff] [blame] | 1000 | |
Adam Langley | 049ef41 | 2015-06-09 18:20:57 -0700 | [diff] [blame] | 1001 | sys.exit(main(platforms)) |