OLD | NEW |
---|---|
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
kjellander_chromium
2016/10/05 07:14:13
nit: according to the style guide, year shouldn't
mattdr-at-chromium
2016/10/05 08:46:41
Reverted
| |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 declare_args() { | 5 import("//testing/test.gni") |
6 use_srtp_boringssl = true | |
7 } | |
8 | 6 |
9 config("libsrtp_config") { | 7 config("libsrtp_config") { |
10 defines = [ | 8 defines = [ |
9 # Package identity | |
10 "PACKAGE_STRING=\"libsrtp2 2.0.0-pre\"", | |
11 "PACKAGE_VERSION=\"2.0.0-pre\"", | |
12 | |
13 # Config | |
11 "HAVE_CONFIG_H", | 14 "HAVE_CONFIG_H", |
15 "OPENSSL", | |
16 | |
17 # Platform properties | |
12 "HAVE_STDLIB_H", | 18 "HAVE_STDLIB_H", |
13 "HAVE_STRING_H", | 19 "HAVE_STRING_H", |
14 "TESTAPP_SOURCE", | 20 "HAVE_STDINT_H", |
15 ] | 21 "HAVE_INTTYPES_H", |
16 | 22 "HAVE_INT16_T", |
17 include_dirs = [ | 23 "HAVE_INT32_T", |
18 "config", | 24 "HAVE_INT8_T", |
19 "srtp/include", | 25 "HAVE_UINT16_T", |
20 "srtp/crypto/include", | 26 "HAVE_UINT32_T", |
21 ] | 27 "HAVE_UINT64_T", |
22 | 28 "HAVE_UINT8_T", |
23 if (use_srtp_boringssl) { | 29 ] |
24 defines += [ "OPENSSL" ] | |
25 } | |
26 | |
27 if (is_posix) { | 30 if (is_posix) { |
28 defines += [ | 31 defines += [ |
29 "HAVE_INT16_T", | 32 "HAVE_ARPA_INET_H", |
30 "HAVE_INT32_T", | |
31 "HAVE_INT8_T", | |
32 "HAVE_UINT16_T", | |
33 "HAVE_UINT32_T", | |
34 "HAVE_UINT64_T", | |
35 "HAVE_UINT8_T", | |
36 "HAVE_STDINT_H", | |
37 "HAVE_INTTYPES_H", | |
38 "HAVE_NETINET_IN_H", | 33 "HAVE_NETINET_IN_H", |
39 "HAVE_ARPA_INET_H", | 34 "HAVE_SYS_TYPES_H", |
40 "HAVE_UNISTD_H", | 35 "HAVE_UNISTD_H", |
41 ] | 36 ] |
42 cflags = [ "-Wno-unused-variable" ] | 37 } |
43 } | |
44 | |
45 if (is_win) { | 38 if (is_win) { |
46 defines += [ | 39 defines += [ "HAVE_WINSOCK2_H" ] |
47 "HAVE_BYTESWAP_METHODS_H", | 40 } |
48 | 41 } |
49 # All Windows architectures are this way. | 42 |
50 "SIZEOF_UNSIGNED_LONG=4", | 43 config("libsrtp_public_config") { |
51 "SIZEOF_UNSIGNED_LONG_LONG=8", | 44 # Supports clients depending on SRTP_RELATIVE_PATH. |
52 ] | 45 # TODO(mattdr): Remove SRTP_RELATIVE_PATH and this config. |
53 } | 46 include_dirs = [ |
54 | 47 ".", |
kjellander_chromium
2016/10/05 07:14:12
I don't believe you need "." in the GN world. It's
mattdr-at-chromium
2016/10/05 08:46:41
Confirmed. Removed.
mattdr-at-chromium
2016/10/05 09:02:21
I spoke too soon. Without this, srtpfilter_unittes
kjellander_chromium
2016/10/05 09:17:12
That's weird. Well, if it fails it fails :)
| |
55 if (current_cpu == "x64" || current_cpu == "x86") { | 48 "config", |
56 defines += [ | 49 "include", |
57 "CPU_CISC", | 50 "crypto/include", |
58 ] | 51 ] |
59 } | |
60 | |
61 if (current_cpu == "arm" || current_cpu == "arm64" || | |
62 current_cpu == "mipsel" || current_cpu == "mips64el") { | |
63 # TODO(leozwang): CPU_RISC doesn't work properly on android/arm and | |
64 # mips platforms for unknown reasons, need to investigate the root | |
65 # cause of it. CPU_RISC is used for optimization only, and CPU_CISC | |
66 # should just work just fine, it has been tested on android/arm with | |
67 # srtp test applications and libjingle. | |
68 defines += [ "CPU_CISC" ] | |
69 } | |
70 if (current_cpu == "mipsel" || current_cpu == "arm" || current_cpu == "x86") { | |
71 # Define FORCE_64BIT_ALIGN to avoid alignment-related-crashes like | |
72 # crbug/414919. Without this, aes_cbc_alloc will allocate an | |
73 # aes_cbc_ctx_t not 64-bit aligned and the v128_t members of | |
74 # aes_cbc_ctx_t will not be 64-bit aligned, which breaks the | |
75 # compiler optimizations that assume 64-bit alignment of v128_t. | |
76 defines += [ "FORCE_64BIT_ALIGN" ] | |
77 } | |
78 } | 52 } |
79 | 53 |
80 static_library("libsrtp") { | 54 static_library("libsrtp") { |
81 configs -= [ "//build/config/compiler:chromium_code" ] | 55 configs -= [ "//build/config/compiler:chromium_code" ] |
82 configs += [ "//build/config/compiler:no_chromium_code" ] | 56 configs += [ "//build/config/compiler:no_chromium_code" ] |
83 public_configs = [ ":libsrtp_config" ] | 57 configs += [ ":libsrtp_config" ] |
84 | 58 public_configs = [ ":libsrtp_public_config" ] |
85 sources = [ | 59 sources = [ |
86 # includes | 60 # includes |
87 "srtp/include/ekt.h", | 61 "include/ekt.h", |
88 "srtp/include/getopt_s.h", | 62 "include/rtp.h", |
89 "srtp/include/rtp.h", | 63 "include/srtp.h", |
90 "srtp/include/rtp_priv.h", | |
91 "srtp/include/srtp.h", | |
92 "srtp/include/srtp_priv.h", | |
93 "srtp/include/ut_sim.h", | |
94 | 64 |
95 # headers | 65 # headers |
96 "srtp/crypto/include/aes.h", | 66 "crypto/include/aes.h", |
97 "srtp/crypto/include/aes_cbc.h", | 67 "crypto/include/aes_gcm_ossl.h", |
98 "srtp/crypto/include/aes_icm.h", | 68 "crypto/include/aes_icm.h", |
99 "srtp/crypto/include/alloc.h", | 69 "crypto/include/aes_icm_ossl.h", |
100 "srtp/crypto/include/auth.h", | 70 "crypto/include/alloc.h", |
101 "srtp/crypto/include/cipher.h", | 71 "crypto/include/auth.h", |
102 "srtp/crypto/include/crypto.h", | 72 "crypto/include/cipher.h", |
103 "srtp/crypto/include/crypto_kernel.h", | 73 "crypto/include/crypto_kernel.h", |
104 "srtp/crypto/include/crypto_math.h", | 74 "crypto/include/crypto_types.h", |
105 "srtp/crypto/include/crypto_types.h", | 75 "crypto/include/datatypes.h", |
106 "srtp/crypto/include/cryptoalg.h", | 76 "crypto/include/err.h", |
107 "srtp/crypto/include/datatypes.h", | 77 "crypto/include/integers.h", |
108 "srtp/crypto/include/err.h", | 78 "crypto/include/key.h", |
109 "srtp/crypto/include/gf2_8.h", | 79 "crypto/include/null_auth.h", |
110 "srtp/crypto/include/hmac.h", | 80 "crypto/include/null_cipher.h", |
111 "srtp/crypto/include/integers.h", | 81 "crypto/include/rdb.h", |
112 "srtp/crypto/include/kernel_compat.h", | 82 "crypto/include/rdbx.h", |
113 "srtp/crypto/include/key.h", | 83 "crypto/include/stat.h", |
114 "srtp/crypto/include/null_auth.h", | 84 "include/rtp_priv.h", |
115 "srtp/crypto/include/null_cipher.h", | 85 "include/srtp_priv.h", |
116 "srtp/crypto/include/prng.h", | 86 "include/ut_sim.h", |
117 "srtp/crypto/include/rand_source.h", | |
118 "srtp/crypto/include/rdb.h", | |
119 "srtp/crypto/include/rdbx.h", | |
120 "srtp/crypto/include/sha1.h", | |
121 "srtp/crypto/include/stat.h", | |
122 "srtp/crypto/include/xfm.h", | |
123 | 87 |
124 # sources | 88 # sources |
125 "srtp/crypto/cipher/aes.c", | 89 "crypto/cipher/aes_gcm_ossl.c", |
126 "srtp/crypto/cipher/aes_cbc.c", | 90 "crypto/cipher/aes_icm_ossl.c", |
127 "srtp/crypto/cipher/aes_icm.c", | 91 "crypto/cipher/cipher.c", |
128 "srtp/crypto/cipher/cipher.c", | 92 "crypto/cipher/null_cipher.c", |
129 "srtp/crypto/cipher/null_cipher.c", | 93 "crypto/hash/auth.c", |
130 "srtp/crypto/hash/auth.c", | 94 "crypto/hash/hmac_ossl.c", |
131 "srtp/crypto/hash/hmac.c", | 95 "crypto/hash/null_auth.c", |
132 "srtp/crypto/hash/null_auth.c", | 96 "crypto/kernel/alloc.c", |
133 "srtp/crypto/hash/sha1.c", | 97 "crypto/kernel/crypto_kernel.c", |
134 "srtp/crypto/kernel/alloc.c", | 98 "crypto/kernel/err.c", |
135 "srtp/crypto/kernel/crypto_kernel.c", | 99 "crypto/kernel/key.c", |
136 "srtp/crypto/kernel/err.c", | 100 "crypto/math/datatypes.c", |
137 "srtp/crypto/kernel/key.c", | 101 "crypto/math/stat.c", |
138 "srtp/crypto/math/datatypes.c", | 102 "crypto/replay/rdb.c", |
139 "srtp/crypto/math/gf2_8.c", | 103 "crypto/replay/rdbx.c", |
140 "srtp/crypto/math/stat.c", | 104 "srtp/ekt.c", |
141 "srtp/crypto/replay/rdb.c", | 105 "srtp/srtp.c", |
142 "srtp/crypto/replay/rdbx.c", | 106 ] |
143 "srtp/crypto/replay/ut_sim.c", | 107 public_deps = [ |
144 "srtp/crypto/rng/ctr_prng.c", | 108 "//third_party/boringssl:boringssl", |
145 "srtp/crypto/rng/prng.c", | 109 ] |
146 "srtp/crypto/rng/rand_source.c", | 110 } |
147 "srtp/srtp/ekt.c", | 111 |
148 "srtp/srtp/srtp.c", | 112 config("srtp_test_config") { |
149 ] | 113 include_dirs = [ "test" ] |
150 | 114 } |
151 if (is_clang) { | 115 |
152 cflags = [ "-Wno-implicit-function-declaration" ] | 116 template("srtp_test") { |
153 } | 117 test("srtp_test_${target_name}") { |
kjellander_chromium
2016/10/05 07:14:12
add testonly = true to the template.
mattdr-at-chromium
2016/10/05 08:46:41
Done.
| |
154 | |
155 if (use_srtp_boringssl) { | |
156 deps = [ | |
157 "//third_party/boringssl:boringssl", | |
158 ] | |
159 public_deps = [ | |
160 "//third_party/boringssl:boringssl", | |
161 ] | |
162 sources -= [ | |
163 "srtp/crypto/cipher/aes_cbc.c", | |
164 "srtp/crypto/cipher/aes_icm.c", | |
165 "srtp/crypto/hash/hmac.c", | |
166 "srtp/crypto/hash/sha1.c", | |
167 "srtp/crypto/rng/ctr_prng.c", | |
168 "srtp/crypto/rng/prng.c", | |
169 "srtp/crypto/rng/rand_source.c", | |
170 ] | |
171 sources += [ | |
172 "srtp/crypto/cipher/aes_gcm_ossl.c", | |
173 "srtp/crypto/cipher/aes_icm_ossl.c", | |
174 "srtp/crypto/hash/hmac_ossl.c", | |
175 "srtp/crypto/include/aes_gcm_ossl.h", | |
176 "srtp/crypto/include/aes_icm_ossl.h", | |
177 "srtp/crypto/rng/rand_source_ossl.c", | |
178 ] | |
179 } | |
180 } | |
181 | |
182 # TODO(GYP): A bunch of these tests don't compile (in gyp either). They're | |
183 # not very broken, so could probably be made to work if it's useful. | |
184 if (!is_win) { | |
185 executable("rdbx_driver") { | |
186 configs -= [ "//build/config/compiler:chromium_code" ] | 118 configs -= [ "//build/config/compiler:chromium_code" ] |
187 configs += [ "//build/config/compiler:no_chromium_code" ] | 119 configs += [ "//build/config/compiler:no_chromium_code" ] |
120 configs += [ | |
121 ":libsrtp_config", | |
122 ":srtp_test_config", | |
123 ] | |
188 deps = [ | 124 deps = [ |
189 ":libsrtp", | 125 ":libsrtp", |
190 ] | 126 ] |
191 sources = [ | 127 sources = [ |
192 "srtp/include/getopt_s.h", | 128 "crypto/replay/ut_sim.c", |
193 "srtp/test/getopt_s.c", | 129 "include/getopt_s.h", |
194 "srtp/test/rdbx_driver.c", | 130 "include/ut_sim.h", |
195 ] | 131 "test/getopt_s.c", |
196 } | 132 "test/util.c", |
197 | 133 "test/util.h", |
198 executable("srtp_driver") { | 134 invoker.source, |
199 configs -= [ "//build/config/compiler:chromium_code" ] | 135 ] |
200 configs += [ "//build/config/compiler:no_chromium_code" ] | 136 } |
201 deps = [ | 137 } |
202 ":libsrtp", | 138 |
203 ] | 139 srtp_test("dtls_srtp_driver") { |
204 sources = [ | 140 source = "test/dtls_srtp_driver.c" |
205 "srtp/include/getopt_s.h", | 141 } |
206 "srtp/include/srtp_priv.h", | 142 srtp_test("rdbx_driver") { |
207 "srtp/test/getopt_s.c", | 143 source = "test/rdbx_driver.c" |
208 "srtp/test/srtp_driver.c", | 144 } |
209 ] | 145 srtp_test("replay_driver") { |
210 } | 146 source = "test/replay_driver.c" |
211 | 147 } |
212 executable("roc_driver") { | 148 srtp_test("roc_driver") { |
213 configs -= [ "//build/config/compiler:chromium_code" ] | 149 source = "test/roc_driver.c" |
214 configs += [ "//build/config/compiler:no_chromium_code" ] | 150 } |
215 deps = [ | 151 srtp_test("srtp_driver") { |
216 ":libsrtp", | 152 source = "test/srtp_driver.c" |
217 ] | 153 } |
218 sources = [ | 154 srtp_test("cipher_driver") { |
219 "srtp/crypto/include/rdbx.h", | 155 source = "crypto/test/cipher_driver.c" |
220 "srtp/include/ut_sim.h", | 156 } |
221 "srtp/test/roc_driver.c", | 157 srtp_test("datatypes_driver") { |
222 ] | 158 source = "crypto/test/datatypes_driver.c" |
223 } | 159 } |
224 | 160 srtp_test("kernel_driver") { |
225 executable("replay_driver") { | 161 source = "crypto/test/kernel_driver.c" |
226 configs -= [ "//build/config/compiler:chromium_code" ] | 162 } |
227 configs += [ "//build/config/compiler:no_chromium_code" ] | 163 |
228 deps = [ | 164 if (is_posix) { |
229 ":libsrtp", | 165 # This might compile but won't be useful on non-POSIX. |
230 ] | |
231 sources = [ | |
232 "srtp/crypto/include/rdbx.h", | |
233 "srtp/include/ut_sim.h", | |
234 "srtp/test/replay_driver.c", | |
235 ] | |
236 } | |
237 | 166 |
238 executable("rtpw") { | 167 executable("rtpw") { |
kjellander_chromium
2016/10/05 07:14:13
It looks like this can also use the srtp_test temp
mattdr-at-chromium
2016/10/05 08:46:41
The two differ slightly in sources and defines, so
kjellander_chromium
2016/10/05 09:17:12
OK, I mostly wanted to check, since the other test
| |
239 configs -= [ "//build/config/compiler:chromium_code" ] | 168 configs -= [ "//build/config/compiler:chromium_code" ] |
240 configs += [ "//build/config/compiler:no_chromium_code" ] | 169 configs += [ "//build/config/compiler:no_chromium_code" ] |
170 configs += [ | |
171 ":libsrtp_config", | |
172 ":srtp_test_config", | |
173 ] | |
241 deps = [ | 174 deps = [ |
242 ":libsrtp", | 175 ":libsrtp", |
243 ] | 176 ] |
244 sources = [ | 177 sources = [ |
245 "srtp/crypto/include/datatypes.h", | 178 "include/getopt_s.h", |
246 "srtp/include/getopt_s.h", | 179 "test/getopt_s.c", |
247 "srtp/include/rtp.h", | 180 "test/rtp.c", |
248 "srtp/include/srtp.h", | 181 "test/rtpw.c", |
249 "srtp/test/getopt_s.c", | 182 "test/util.c", |
250 "srtp/test/rtp.c", | 183 "test/util.h", |
251 "srtp/test/rtpw.c", | 184 |
252 ] | 185 # The original Makefile includes this file, but all the functions rtpw |
253 if (is_android) { | 186 # uses have been moved to util.c. |
254 defines = [ "HAVE_SYS_SOCKET_H" ] | 187 "crypto/math/datatypes.c", |
255 } | 188 ] |
256 if (is_clang) { | 189 defines = [ "HAVE_SYS_SOCKET_H" ] |
257 cflags = [ "-Wno-implicit-function-declaration" ] | 190 testonly = true |
258 } | 191 } |
259 } | 192 |
260 | 193 copy("rtpw_test_scripts") { |
261 executable("srtp_test_cipher_driver") { | 194 sources = [ |
262 configs -= [ "//build/config/compiler:chromium_code" ] | 195 "test/rtpw_test.sh", |
263 configs += [ "//build/config/compiler:no_chromium_code" ] | 196 "test/rtpw_test_gcm.sh", |
197 ] | |
198 outputs = [ | |
199 "$root_out_dir/{{source_file_part}}", | |
200 ] | |
201 testonly = true | |
202 } | |
203 | |
204 group("srtp_test_rtpw") { | |
264 deps = [ | 205 deps = [ |
265 ":libsrtp", | |
266 ] | |
267 sources = [ | |
268 "srtp/crypto/test/cipher_driver.c", | |
269 "srtp/include/getopt_s.h", | |
270 "srtp/test/getopt_s.c", | |
271 ] | |
272 } | |
273 | |
274 executable("srtp_test_datatypes_driver") { | |
275 configs -= [ "//build/config/compiler:chromium_code" ] | |
276 configs += [ "//build/config/compiler:no_chromium_code" ] | |
277 deps = [ | |
278 ":libsrtp", | |
279 ] | |
280 sources = [ | |
281 "srtp/crypto/test/datatypes_driver.c", | |
282 ] | |
283 } | |
284 | |
285 executable("srtp_test_stat_driver") { | |
286 configs -= [ "//build/config/compiler:chromium_code" ] | |
287 configs += [ "//build/config/compiler:no_chromium_code" ] | |
288 deps = [ | |
289 ":libsrtp", | |
290 ] | |
291 sources = [ | |
292 "srtp/crypto/test/stat_driver.c", | |
293 ] | |
294 } | |
295 | |
296 executable("srtp_test_sha1_driver") { | |
297 configs -= [ "//build/config/compiler:chromium_code" ] | |
298 configs += [ "//build/config/compiler:no_chromium_code" ] | |
299 deps = [ | |
300 ":libsrtp", | |
301 ] | |
302 sources = [ | |
303 "srtp/crypto/test/sha1_driver.c", | |
304 ] | |
305 } | |
306 | |
307 executable("srtp_test_kernel_driver") { | |
308 configs -= [ "//build/config/compiler:chromium_code" ] | |
309 configs += [ "//build/config/compiler:no_chromium_code" ] | |
310 deps = [ | |
311 ":libsrtp", | |
312 ] | |
313 sources = [ | |
314 "srtp/crypto/test/kernel_driver.c", | |
315 "srtp/include/getopt_s.h", | |
316 "srtp/test/getopt_s.c", | |
317 ] | |
318 } | |
319 | |
320 executable("srtp_test_aes_calc") { | |
321 configs -= [ "//build/config/compiler:chromium_code" ] | |
322 configs += [ "//build/config/compiler:no_chromium_code" ] | |
323 deps = [ | |
324 ":libsrtp", | |
325 ] | |
326 sources = [ | |
327 "srtp/crypto/test/aes_calc.c", | |
328 ] | |
329 } | |
330 | |
331 executable("srtp_test_rand_gen") { | |
332 configs -= [ "//build/config/compiler:chromium_code" ] | |
333 configs += [ "//build/config/compiler:no_chromium_code" ] | |
334 deps = [ | |
335 ":libsrtp", | |
336 ] | |
337 sources = [ | |
338 "srtp/crypto/test/rand_gen.c", | |
339 "srtp/include/getopt_s.h", | |
340 "srtp/test/getopt_s.c", | |
341 ] | |
342 } | |
343 | |
344 executable("srtp_test_rand_gen_soak") { | |
345 configs -= [ "//build/config/compiler:chromium_code" ] | |
346 configs += [ "//build/config/compiler:no_chromium_code" ] | |
347 deps = [ | |
348 ":libsrtp", | |
349 ] | |
350 sources = [ | |
351 "srtp/crypto/test/rand_gen_soak.c", | |
352 "srtp/include/getopt_s.h", | |
353 "srtp/test/getopt_s.c", | |
354 ] | |
355 } | |
356 | |
357 executable("srtp_test_env") { | |
358 configs -= [ "//build/config/compiler:chromium_code" ] | |
359 configs += [ "//build/config/compiler:no_chromium_code" ] | |
360 deps = [ | |
361 ":libsrtp", | |
362 ] | |
363 sources = [ | |
364 "srtp/crypto/test/env.c", | |
365 ] | |
366 } | |
367 | |
368 group("srtp_runtest") { | |
369 deps = [ | |
370 ":rdbx_driver", | |
371 ":srtp_driver", | |
372 ":roc_driver", | |
373 ":replay_driver", | |
374 ":rtpw", | 206 ":rtpw", |
375 ":srtp_test_cipher_driver", | 207 ":rtpw_test_scripts", |
376 ":srtp_test_datatypes_driver", | 208 ] |
377 ":srtp_test_stat_driver", | 209 testonly = true |
378 ":srtp_test_sha1_driver", | 210 } |
379 ":srtp_test_kernel_driver", | 211 } else { |
380 ":srtp_test_aes_calc", | 212 group("srtp_test_rtpw") { |
381 ":srtp_test_rand_gen", | 213 testonly = true |
382 ":srtp_test_rand_gen_soak", | 214 } |
383 ":srtp_test_env", | 215 } |
384 ] | 216 |
385 } | 217 # Run with, e.g.: |
386 } | 218 # for a in out/Default/srtp_test_*; do |
219 # echo $a | |
220 # "${a}" -v > /dev/null || "${a}" > /dev/null || echo $a FAILED | |
221 # done | |
222 | |
223 group("srtp_tests") { | |
224 deps = [ | |
225 ":srtp_test_cipher_driver", | |
226 ":srtp_test_datatypes_driver", | |
227 ":srtp_test_dtls_srtp_driver", | |
228 ":srtp_test_kernel_driver", | |
229 ":srtp_test_rdbx_driver", | |
230 ":srtp_test_replay_driver", | |
231 ":srtp_test_roc_driver", | |
232 ":srtp_test_rtpw", | |
233 ":srtp_test_srtp_driver", | |
234 ] | |
235 testonly = true | |
236 } | |
OLD | NEW |