blob: 91095005d7a832832c315228eb2e7d4e01d17428 [file] [log] [blame]
Amr Aboelkhere6eac202020-04-08 20:46:44 +00001# Copyright 2020 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
Yuta Hijikata639e5d92020-10-24 01:12:54 +00005import("//build/config/chromeos/ui_mode.gni")
Amr Aboelkhere6eac202020-04-08 20:46:44 +00006import("//testing/test.gni")
7import("//third_party/protobuf/proto_library.gni")
8
9config("shell_encryption_config1") {
Amr Aboelkher3e6c6942020-06-27 00:26:41 +000010 # TODO(crbug.com/1095122) Reenable the warning for unused functions and typedef.
11 cflags = [
12 "-Wno-unused-local-typedef",
13 "-Wno-unused-function",
14 "-Wno-sign-compare",
15 "-Wno-ignored-qualifiers",
16 ]
17
Amr Aboelkhere6eac202020-04-08 20:46:44 +000018 include_dirs = [
19 # Allow includes to be prefixed with shell-encryption/src/ in case it is not an
20 # immediate subdirectory of the top-level.
21 "src",
22
23 # Allow includes to be prefixed with shell-encryption/ in case it is not an
24 # immediate subdirectory of the top-level. That's mainly is being used for
25 # glog/logging.h includes.
26 ".",
27
28 # Just like the root shell-encryption directory is added to include path, the
29 # corresponding directory tree with generated files needs to be added too.
30 # Note: this path does not change depending on the current target, e.g.
31 # it is always "//gen/third_party/shell-encryption/src" when building with Chromium.
32 # See also: http://cs.chromium.org/?q=%5C"default_include_dirs
33 # https://gn.googlesource.com/gn/+/master/docs/reference.md#target_gen_dir"
34 target_gen_dir,
35 ]
36}
37
38# Protos.
39proto_library("serialization_proto") {
40 sources = [ "src/serialization.proto" ]
41 proto_in_dir = "src/"
42}
43
44proto_library("coefficient_polynomial_proto") {
45 sources = [ "src/testing/coefficient_polynomial.proto" ]
46 proto_in_dir = "src/testing/"
47}
48
49# SHELL lib.
Yuta Hijikata8a719752020-12-17 04:00:53 +000050if (is_chromeos_ash) {
Amr Aboelkher6373da62020-09-02 07:30:02 +000051 source_set("shell_encryption") {
52 public_configs = [ ":shell_encryption_config1" ]
53 configs -= [ "//build/config/compiler:chromium_code" ]
54 configs += [ "//build/config/compiler:no_chromium_code" ]
55 public = [
56 "glog/logging.h",
57 "src/bits_util.h",
58 "src/constants.h",
59 "src/context.h",
60 "src/error_params.h",
61 "src/galois_key.h",
62 "src/int256.h",
63 "src/integral_types.h",
64 "src/montgomery.h",
65 "src/ntt_parameters.h",
66 "src/polynomial.h",
67 "src/prng/chacha_prng.h",
68 "src/prng/chacha_prng_util.h",
69 "src/prng/integral_prng_types.h",
70 "src/prng/prng.h",
71 "src/prng/single_thread_chacha_prng.h",
72 "src/relinearization_key.h",
73 "src/sample_error.h",
74 "src/status_macros.h",
75 "src/statusor.h",
76 "src/symmetric_encryption.h",
77 "src/symmetric_encryption_with_prng.h",
78 "src/transcription.h",
79 ]
80 sources = [
81 "src/int256.cc",
82 "src/montgomery.cc",
83 "src/ntt_parameters.cc",
84 "src/prng/chacha_prng.cc",
85 "src/prng/chacha_prng_util.cc",
86 "src/prng/single_thread_chacha_prng.cc",
87 "src/relinearization_key.cc",
88 "src/statusor.cc",
89 ]
90 public_deps = [
91 ":serialization_proto",
92 "//base:base",
93 "//third_party/abseil-cpp:absl",
94 "//third_party/boringssl:boringssl",
95 "//third_party/protobuf:protobuf_lite",
96 ]
97 }
Amr Aboelkhere6eac202020-04-08 20:46:44 +000098}
99
Yuta Hijikata8a719752020-12-17 04:00:53 +0000100if (is_chromeos_ash) {
Kevin Yeo39494742020-09-01 21:30:28 +0000101 source_set("shell_encryption_test_library") {
102 testonly = true
103 public_configs = [ ":shell_encryption_config1" ]
104 configs -= [ "//build/config/compiler:chromium_code" ]
105 configs += [ "//build/config/compiler:no_chromium_code" ]
106 public = [
107 "src/prng/integral_prng_testing_types.h",
108 "src/testing/coefficient_polynomial.h",
109 "src/testing/coefficient_polynomial_ciphertext.h",
110 "src/testing/parameters.h",
111 "src/testing/protobuf_matchers.h",
112 "src/testing/status_matchers.h",
113 "src/testing/status_testing.h",
114 "src/testing/testing_prng.h",
115 "src/testing/testing_utils.h",
116 ]
117 public_deps = [
118 ":coefficient_polynomial_proto",
119 ":shell_encryption",
120 "//testing/gmock:gmock",
121 "//testing/gtest:gtest",
122 ]
123 }
Amr Aboelkher3e6c6942020-06-27 00:26:41 +0000124
Amr Aboelkher85341392020-11-30 23:49:19 +0000125 test("shell_encryption_unittests") {
Kevin Yeo39494742020-09-01 21:30:28 +0000126 testonly = true
127 public_configs = [ ":shell_encryption_config1" ]
128 configs -= [ "//build/config/compiler:chromium_code" ]
129 configs += [ "//build/config/compiler:no_chromium_code" ]
130 sources = [
131 "src/bits_util_test.cc",
132 "src/context_test.cc",
133 "src/error_params_test.cc",
134 "src/galois_key_test.cc",
135 "src/int256_test.cc",
136 "src/montgomery_test.cc",
137 "src/ntt_parameters_test.cc",
138 "src/polynomial_test.cc",
139 "src/prng/prng_test.cc",
140 "src/prng/single_thread_chacha_prng_test.cc",
141 "src/relinearization_key_test.cc",
142 "src/sample_error_test.cc",
143 "src/status_macros_test.cc",
144 "src/statusor_test.cc",
145 "src/symmetric_encryption_test.cc",
146 "src/symmetric_encryption_with_prng_test.cc",
147 "src/testing/coefficient_polynomial_ciphertext_test.cc",
148 "src/testing/coefficient_polynomial_test.cc",
149 "src/testing/protobuf_matchers_test.cc",
150 "src/transcription_test.cc",
Amr Aboelkher85341392020-11-30 23:49:19 +0000151 "tests/run_all_unittests.cc",
Kevin Yeo39494742020-09-01 21:30:28 +0000152 ]
153 deps = [
154 ":shell_encryption_test_library",
Amr Aboelkher85341392020-11-30 23:49:19 +0000155 "//base/test:test_support",
156 "//testing/gtest",
Kevin Yeo39494742020-09-01 21:30:28 +0000157 ]
158 }
Amr Aboelkher3e6c6942020-06-27 00:26:41 +0000159}