OLD | NEW |
| (Empty) |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | |
2 # Use of this source code is governed by a BSD-style license that can be | |
3 # found in the LICENSE file. | |
4 | |
5 declare_args() { | |
6 use_system_libsrtp = false | |
7 use_srtp_boringssl = true | |
8 } | |
9 | |
10 config("libsrtp_config") { | |
11 defines = [ | |
12 "HAVE_CONFIG_H", | |
13 "HAVE_STDLIB_H", | |
14 "HAVE_STRING_H", | |
15 "TESTAPP_SOURCE", | |
16 ] | |
17 | |
18 include_dirs = [ | |
19 "config", | |
20 "srtp/include", | |
21 "srtp/crypto/include", | |
22 ] | |
23 | |
24 if (use_srtp_boringssl) { | |
25 defines += [ "OPENSSL" ] | |
26 } | |
27 | |
28 if (is_posix) { | |
29 defines += [ | |
30 "HAVE_INT16_T", | |
31 "HAVE_INT32_T", | |
32 "HAVE_INT8_T", | |
33 "HAVE_UINT16_T", | |
34 "HAVE_UINT32_T", | |
35 "HAVE_UINT64_T", | |
36 "HAVE_UINT8_T", | |
37 "HAVE_STDINT_H", | |
38 "HAVE_INTTYPES_H", | |
39 "HAVE_NETINET_IN_H", | |
40 "HAVE_ARPA_INET_H", | |
41 "HAVE_UNISTD_H", | |
42 ] | |
43 cflags = [ "-Wno-unused-variable" ] | |
44 } | |
45 | |
46 if (is_win) { | |
47 defines += [ | |
48 "HAVE_BYTESWAP_METHODS_H", | |
49 | |
50 # All Windows architectures are this way. | |
51 "SIZEOF_UNSIGNED_LONG=4", | |
52 "SIZEOF_UNSIGNED_LONG_LONG=8", | |
53 ] | |
54 } | |
55 | |
56 if (current_cpu == "x64" || current_cpu == "x86" || current_cpu == "arm") { | |
57 defines += [ | |
58 # TODO(leozwang): CPU_RISC doesn"t work properly on android/arm | |
59 # platform for unknown reasons, need to investigate the root cause | |
60 # of it. CPU_RISC is used for optimization only, and CPU_CISC should | |
61 # just work just fine, it has been tested on android/arm with srtp | |
62 # test applications and libjingle. | |
63 "CPU_CISC", | |
64 ] | |
65 } | |
66 | |
67 if (current_cpu == "mipsel") { | |
68 defines += [ "CPU_RISC" ] | |
69 } | |
70 } | |
71 | |
72 config("system_libsrtp_config") { | |
73 defines = [ "USE_SYSTEM_LIBSRTP" ] | |
74 include_dirs = [ "/usr/include/srtp" ] | |
75 } | |
76 | |
77 if (use_system_libsrtp) { | |
78 group("libsrtp") { | |
79 public_configs = [ | |
80 ":libsrtp_config", | |
81 ":system_libsrtp_config", | |
82 ] | |
83 libs = [ "-lsrtp" ] | |
84 } | |
85 } else { | |
86 static_library("libsrtp") { | |
87 configs -= [ "//build/config/compiler:chromium_code" ] | |
88 configs += [ "//build/config/compiler:no_chromium_code" ] | |
89 public_configs = [ ":libsrtp_config" ] | |
90 | |
91 sources = [ | |
92 # includes | |
93 "srtp/include/ekt.h", | |
94 "srtp/include/getopt_s.h", | |
95 "srtp/include/rtp.h", | |
96 "srtp/include/rtp_priv.h", | |
97 "srtp/include/srtp.h", | |
98 "srtp/include/srtp_priv.h", | |
99 "srtp/include/ut_sim.h", | |
100 | |
101 # headers | |
102 "srtp/crypto/include/aes.h", | |
103 "srtp/crypto/include/aes_cbc.h", | |
104 "srtp/crypto/include/aes_icm.h", | |
105 "srtp/crypto/include/alloc.h", | |
106 "srtp/crypto/include/auth.h", | |
107 "srtp/crypto/include/cipher.h", | |
108 "srtp/crypto/include/crypto.h", | |
109 "srtp/crypto/include/crypto_kernel.h", | |
110 "srtp/crypto/include/crypto_math.h", | |
111 "srtp/crypto/include/crypto_types.h", | |
112 "srtp/crypto/include/cryptoalg.h", | |
113 "srtp/crypto/include/datatypes.h", | |
114 "srtp/crypto/include/err.h", | |
115 "srtp/crypto/include/gf2_8.h", | |
116 "srtp/crypto/include/hmac.h", | |
117 "srtp/crypto/include/integers.h", | |
118 "srtp/crypto/include/kernel_compat.h", | |
119 "srtp/crypto/include/key.h", | |
120 "srtp/crypto/include/null_auth.h", | |
121 "srtp/crypto/include/null_cipher.h", | |
122 "srtp/crypto/include/prng.h", | |
123 "srtp/crypto/include/rand_source.h", | |
124 "srtp/crypto/include/rdb.h", | |
125 "srtp/crypto/include/rdbx.h", | |
126 "srtp/crypto/include/sha1.h", | |
127 "srtp/crypto/include/stat.h", | |
128 "srtp/crypto/include/xfm.h", | |
129 | |
130 # sources | |
131 "srtp/crypto/cipher/aes.c", | |
132 "srtp/crypto/cipher/aes_cbc.c", | |
133 "srtp/crypto/cipher/aes_icm.c", | |
134 "srtp/crypto/cipher/cipher.c", | |
135 "srtp/crypto/cipher/null_cipher.c", | |
136 "srtp/crypto/hash/auth.c", | |
137 "srtp/crypto/hash/hmac.c", | |
138 "srtp/crypto/hash/null_auth.c", | |
139 "srtp/crypto/hash/sha1.c", | |
140 "srtp/crypto/kernel/alloc.c", | |
141 "srtp/crypto/kernel/crypto_kernel.c", | |
142 "srtp/crypto/kernel/err.c", | |
143 "srtp/crypto/kernel/key.c", | |
144 "srtp/crypto/math/datatypes.c", | |
145 "srtp/crypto/math/gf2_8.c", | |
146 "srtp/crypto/math/stat.c", | |
147 "srtp/crypto/replay/rdb.c", | |
148 "srtp/crypto/replay/rdbx.c", | |
149 "srtp/crypto/replay/ut_sim.c", | |
150 "srtp/crypto/rng/ctr_prng.c", | |
151 "srtp/crypto/rng/prng.c", | |
152 "srtp/crypto/rng/rand_source.c", | |
153 "srtp/srtp/ekt.c", | |
154 "srtp/srtp/srtp.c", | |
155 ] | |
156 | |
157 if (is_clang) { | |
158 cflags = [ "-Wno-implicit-function-declaration" ] | |
159 } | |
160 | |
161 if (use_srtp_boringssl) { | |
162 deps = [ | |
163 "//third_party/boringssl:boringssl", | |
164 ] | |
165 public_deps = [ | |
166 "//third_party/boringssl:boringssl", | |
167 ] | |
168 sources -= [ | |
169 "srtp/crypto/cipher/aes_cbc.c", | |
170 "srtp/crypto/cipher/aes_icm.c", | |
171 "srtp/crypto/hash/hmac.c", | |
172 "srtp/crypto/hash/sha1.c", | |
173 "srtp/crypto/rng/ctr_prng.c", | |
174 "srtp/crypto/rng/prng.c", | |
175 ] | |
176 sources += [ | |
177 "srtp/crypto/cipher/aes_gcm_ossl.c", | |
178 "srtp/crypto/cipher/aes_icm_ossl.c", | |
179 "srtp/crypto/hash/hmac_ossl.c", | |
180 "srtp/crypto/include/aes_gcm_ossl.h", | |
181 "srtp/crypto/include/aes_icm_ossl.h", | |
182 ] | |
183 } | |
184 } | |
185 | |
186 # TODO(GYP): A bunch of these tests don't compile (in gyp either). They're | |
187 # not very broken, so could probably be made to work if it's useful. | |
188 if (!is_win) { | |
189 executable("rdbx_driver") { | |
190 configs -= [ "//build/config/compiler:chromium_code" ] | |
191 configs += [ "//build/config/compiler:no_chromium_code" ] | |
192 deps = [ | |
193 ":libsrtp", | |
194 ] | |
195 sources = [ | |
196 "srtp/include/getopt_s.h", | |
197 "srtp/test/getopt_s.c", | |
198 "srtp/test/rdbx_driver.c", | |
199 ] | |
200 } | |
201 | |
202 executable("srtp_driver") { | |
203 configs -= [ "//build/config/compiler:chromium_code" ] | |
204 configs += [ "//build/config/compiler:no_chromium_code" ] | |
205 deps = [ | |
206 ":libsrtp", | |
207 ] | |
208 sources = [ | |
209 "srtp/include/getopt_s.h", | |
210 "srtp/include/srtp_priv.h", | |
211 "srtp/test/getopt_s.c", | |
212 "srtp/test/srtp_driver.c", | |
213 ] | |
214 } | |
215 | |
216 executable("roc_driver") { | |
217 configs -= [ "//build/config/compiler:chromium_code" ] | |
218 configs += [ "//build/config/compiler:no_chromium_code" ] | |
219 deps = [ | |
220 ":libsrtp", | |
221 ] | |
222 sources = [ | |
223 "srtp/crypto/include/rdbx.h", | |
224 "srtp/include/ut_sim.h", | |
225 "srtp/test/roc_driver.c", | |
226 ] | |
227 } | |
228 | |
229 executable("replay_driver") { | |
230 configs -= [ "//build/config/compiler:chromium_code" ] | |
231 configs += [ "//build/config/compiler:no_chromium_code" ] | |
232 deps = [ | |
233 ":libsrtp", | |
234 ] | |
235 sources = [ | |
236 "srtp/crypto/include/rdbx.h", | |
237 "srtp/include/ut_sim.h", | |
238 "srtp/test/replay_driver.c", | |
239 ] | |
240 } | |
241 | |
242 executable("rtpw") { | |
243 configs -= [ "//build/config/compiler:chromium_code" ] | |
244 configs += [ "//build/config/compiler:no_chromium_code" ] | |
245 deps = [ | |
246 ":libsrtp", | |
247 ] | |
248 sources = [ | |
249 "srtp/crypto/include/datatypes.h", | |
250 "srtp/include/getopt_s.h", | |
251 "srtp/include/rtp.h", | |
252 "srtp/include/srtp.h", | |
253 "srtp/test/getopt_s.c", | |
254 "srtp/test/rtp.c", | |
255 "srtp/test/rtpw.c", | |
256 ] | |
257 if (is_android) { | |
258 defines = [ "HAVE_SYS_SOCKET_H" ] | |
259 } | |
260 if (is_clang) { | |
261 cflags = [ "-Wno-implicit-function-declaration" ] | |
262 } | |
263 } | |
264 | |
265 executable("srtp_test_cipher_driver") { | |
266 configs -= [ "//build/config/compiler:chromium_code" ] | |
267 configs += [ "//build/config/compiler:no_chromium_code" ] | |
268 deps = [ | |
269 ":libsrtp", | |
270 ] | |
271 sources = [ | |
272 "srtp/crypto/test/cipher_driver.c", | |
273 "srtp/include/getopt_s.h", | |
274 "srtp/test/getopt_s.c", | |
275 ] | |
276 } | |
277 | |
278 executable("srtp_test_datatypes_driver") { | |
279 configs -= [ "//build/config/compiler:chromium_code" ] | |
280 configs += [ "//build/config/compiler:no_chromium_code" ] | |
281 deps = [ | |
282 ":libsrtp", | |
283 ] | |
284 sources = [ | |
285 "srtp/crypto/test/datatypes_driver.c", | |
286 ] | |
287 } | |
288 | |
289 executable("srtp_test_stat_driver") { | |
290 configs -= [ "//build/config/compiler:chromium_code" ] | |
291 configs += [ "//build/config/compiler:no_chromium_code" ] | |
292 deps = [ | |
293 ":libsrtp", | |
294 ] | |
295 sources = [ | |
296 "srtp/crypto/test/stat_driver.c", | |
297 ] | |
298 } | |
299 | |
300 executable("srtp_test_sha1_driver") { | |
301 configs -= [ "//build/config/compiler:chromium_code" ] | |
302 configs += [ "//build/config/compiler:no_chromium_code" ] | |
303 deps = [ | |
304 ":libsrtp", | |
305 ] | |
306 sources = [ | |
307 "srtp/crypto/test/sha1_driver.c", | |
308 ] | |
309 } | |
310 | |
311 executable("srtp_test_kernel_driver") { | |
312 configs -= [ "//build/config/compiler:chromium_code" ] | |
313 configs += [ "//build/config/compiler:no_chromium_code" ] | |
314 deps = [ | |
315 ":libsrtp", | |
316 ] | |
317 sources = [ | |
318 "srtp/crypto/test/kernel_driver.c", | |
319 "srtp/include/getopt_s.h", | |
320 "srtp/test/getopt_s.c", | |
321 ] | |
322 } | |
323 | |
324 executable("srtp_test_aes_calc") { | |
325 configs -= [ "//build/config/compiler:chromium_code" ] | |
326 configs += [ "//build/config/compiler:no_chromium_code" ] | |
327 deps = [ | |
328 ":libsrtp", | |
329 ] | |
330 sources = [ | |
331 "srtp/crypto/test/aes_calc.c", | |
332 ] | |
333 } | |
334 | |
335 executable("srtp_test_rand_gen") { | |
336 configs -= [ "//build/config/compiler:chromium_code" ] | |
337 configs += [ "//build/config/compiler:no_chromium_code" ] | |
338 deps = [ | |
339 ":libsrtp", | |
340 ] | |
341 sources = [ | |
342 "srtp/crypto/test/rand_gen.c", | |
343 "srtp/include/getopt_s.h", | |
344 "srtp/test/getopt_s.c", | |
345 ] | |
346 } | |
347 | |
348 executable("srtp_test_rand_gen_soak") { | |
349 configs -= [ "//build/config/compiler:chromium_code" ] | |
350 configs += [ "//build/config/compiler:no_chromium_code" ] | |
351 deps = [ | |
352 ":libsrtp", | |
353 ] | |
354 sources = [ | |
355 "srtp/crypto/test/rand_gen_soak.c", | |
356 "srtp/include/getopt_s.h", | |
357 "srtp/test/getopt_s.c", | |
358 ] | |
359 } | |
360 | |
361 executable("srtp_test_env") { | |
362 configs -= [ "//build/config/compiler:chromium_code" ] | |
363 configs += [ "//build/config/compiler:no_chromium_code" ] | |
364 deps = [ | |
365 ":libsrtp", | |
366 ] | |
367 sources = [ | |
368 "srtp/crypto/test/env.c", | |
369 ] | |
370 } | |
371 | |
372 group("srtp_runtest") { | |
373 deps = [ | |
374 ":rdbx_driver", | |
375 ":srtp_driver", | |
376 ":roc_driver", | |
377 ":replay_driver", | |
378 ":rtpw", | |
379 ":srtp_test_cipher_driver", | |
380 ":srtp_test_datatypes_driver", | |
381 ":srtp_test_stat_driver", | |
382 ":srtp_test_sha1_driver", | |
383 ":srtp_test_kernel_driver", | |
384 ":srtp_test_aes_calc", | |
385 ":srtp_test_rand_gen", | |
386 ":srtp_test_rand_gen_soak", | |
387 ":srtp_test_env", | |
388 ] | |
389 } | |
390 } | |
391 } | |
OLD | NEW |