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.
6 use_system_libsrtp = false
7 use_srtp_boringssl = true
10 config("libsrtp_config") {
21 "srtp/crypto/include",
24 if (use_srtp_boringssl) {
25 defines += [ "OPENSSL" ]
43 cflags = [ "-Wno-unused-variable" ]
48 "HAVE_BYTESWAP_METHODS_H",
50 # All Windows architectures are this way.
51 "SIZEOF_UNSIGNED_LONG=4",
52 "SIZEOF_UNSIGNED_LONG_LONG=8",
56 if (current_cpu == "x64" || current_cpu == "x86" || current_cpu == "arm") {
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.
67 if (current_cpu == "mipsel") {
68 defines += [ "CPU_RISC" ]
72 config("system_libsrtp_config") {
73 defines = [ "USE_SYSTEM_LIBSRTP" ]
74 include_dirs = [ "/usr/include/srtp" ]
77 if (use_system_libsrtp) {
81 ":system_libsrtp_config",
86 static_library("libsrtp") {
87 configs -= [ "//build/config/compiler:chromium_code" ]
88 configs += [ "//build/config/compiler:no_chromium_code" ]
89 public_configs = [ ":libsrtp_config" ]
94 "srtp/include/getopt_s.h",
96 "srtp/include/rtp_priv.h",
97 "srtp/include/srtp.h",
98 "srtp/include/srtp_priv.h",
99 "srtp/include/ut_sim.h",
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",
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",
158 cflags = [ "-Wno-implicit-function-declaration" ]
161 if (use_srtp_boringssl) {
163 "//third_party/boringssl:boringssl",
166 "//third_party/boringssl:boringssl",
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",
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",
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.
189 executable("rdbx_driver") {
190 configs -= [ "//build/config/compiler:chromium_code" ]
191 configs += [ "//build/config/compiler:no_chromium_code" ]
196 "srtp/include/getopt_s.h",
197 "srtp/test/getopt_s.c",
198 "srtp/test/rdbx_driver.c",
202 executable("srtp_driver") {
203 configs -= [ "//build/config/compiler:chromium_code" ]
204 configs += [ "//build/config/compiler:no_chromium_code" ]
209 "srtp/include/getopt_s.h",
210 "srtp/include/srtp_priv.h",
211 "srtp/test/getopt_s.c",
212 "srtp/test/srtp_driver.c",
216 executable("roc_driver") {
217 configs -= [ "//build/config/compiler:chromium_code" ]
218 configs += [ "//build/config/compiler:no_chromium_code" ]
223 "srtp/crypto/include/rdbx.h",
224 "srtp/include/ut_sim.h",
225 "srtp/test/roc_driver.c",
229 executable("replay_driver") {
230 configs -= [ "//build/config/compiler:chromium_code" ]
231 configs += [ "//build/config/compiler:no_chromium_code" ]
236 "srtp/crypto/include/rdbx.h",
237 "srtp/include/ut_sim.h",
238 "srtp/test/replay_driver.c",
243 configs -= [ "//build/config/compiler:chromium_code" ]
244 configs += [ "//build/config/compiler:no_chromium_code" ]
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",
258 defines = [ "HAVE_SYS_SOCKET_H" ]
261 cflags = [ "-Wno-implicit-function-declaration" ]
265 executable("srtp_test_cipher_driver") {
266 configs -= [ "//build/config/compiler:chromium_code" ]
267 configs += [ "//build/config/compiler:no_chromium_code" ]
272 "srtp/crypto/test/cipher_driver.c",
273 "srtp/include/getopt_s.h",
274 "srtp/test/getopt_s.c",
278 executable("srtp_test_datatypes_driver") {
279 configs -= [ "//build/config/compiler:chromium_code" ]
280 configs += [ "//build/config/compiler:no_chromium_code" ]
285 "srtp/crypto/test/datatypes_driver.c",
289 executable("srtp_test_stat_driver") {
290 configs -= [ "//build/config/compiler:chromium_code" ]
291 configs += [ "//build/config/compiler:no_chromium_code" ]
296 "srtp/crypto/test/stat_driver.c",
300 executable("srtp_test_sha1_driver") {
301 configs -= [ "//build/config/compiler:chromium_code" ]
302 configs += [ "//build/config/compiler:no_chromium_code" ]
307 "srtp/crypto/test/sha1_driver.c",
311 executable("srtp_test_kernel_driver") {
312 configs -= [ "//build/config/compiler:chromium_code" ]
313 configs += [ "//build/config/compiler:no_chromium_code" ]
318 "srtp/crypto/test/kernel_driver.c",
319 "srtp/include/getopt_s.h",
320 "srtp/test/getopt_s.c",
324 executable("srtp_test_aes_calc") {
325 configs -= [ "//build/config/compiler:chromium_code" ]
326 configs += [ "//build/config/compiler:no_chromium_code" ]
331 "srtp/crypto/test/aes_calc.c",
335 executable("srtp_test_rand_gen") {
336 configs -= [ "//build/config/compiler:chromium_code" ]
337 configs += [ "//build/config/compiler:no_chromium_code" ]
342 "srtp/crypto/test/rand_gen.c",
343 "srtp/include/getopt_s.h",
344 "srtp/test/getopt_s.c",
348 executable("srtp_test_rand_gen_soak") {
349 configs -= [ "//build/config/compiler:chromium_code" ]
350 configs += [ "//build/config/compiler:no_chromium_code" ]
355 "srtp/crypto/test/rand_gen_soak.c",
356 "srtp/include/getopt_s.h",
357 "srtp/test/getopt_s.c",
361 executable("srtp_test_env") {
362 configs -= [ "//build/config/compiler:chromium_code" ]
363 configs += [ "//build/config/compiler:no_chromium_code" ]
368 "srtp/crypto/test/env.c",
372 group("srtp_runtest") {
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",