blob: f541cce3f8de0cc55d7083cd8370af5694fda8ea [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
5import("//testing/test.gni")
6import("//third_party/protobuf/proto_library.gni")
7
8config("shell_encryption_config1") {
Amr Aboelkher3e6c6942020-06-27 00:26:41 +00009 # TODO(crbug.com/1095122) Reenable the warning for unused functions and typedef.
10 cflags = [
11 "-Wno-unused-local-typedef",
12 "-Wno-unused-function",
13 "-Wno-sign-compare",
14 "-Wno-ignored-qualifiers",
15 ]
16
Amr Aboelkhere6eac202020-04-08 20:46:44 +000017 include_dirs = [
18 # Allow includes to be prefixed with shell-encryption/src/ in case it is not an
19 # immediate subdirectory of the top-level.
20 "src",
21
22 # Allow includes to be prefixed with shell-encryption/ in case it is not an
23 # immediate subdirectory of the top-level. That's mainly is being used for
24 # glog/logging.h includes.
25 ".",
26
27 # Just like the root shell-encryption directory is added to include path, the
28 # corresponding directory tree with generated files needs to be added too.
29 # Note: this path does not change depending on the current target, e.g.
30 # it is always "//gen/third_party/shell-encryption/src" when building with Chromium.
31 # See also: http://cs.chromium.org/?q=%5C"default_include_dirs
32 # https://gn.googlesource.com/gn/+/master/docs/reference.md#target_gen_dir"
33 target_gen_dir,
34 ]
35}
36
37# Protos.
38proto_library("serialization_proto") {
39 sources = [ "src/serialization.proto" ]
40 proto_in_dir = "src/"
41}
42
43proto_library("coefficient_polynomial_proto") {
44 sources = [ "src/testing/coefficient_polynomial.proto" ]
45 proto_in_dir = "src/testing/"
46}
47
48# SHELL lib.
49source_set("shell_encryption") {
50 public_configs = [ ":shell_encryption_config1" ]
51 configs -= [ "//build/config/compiler:chromium_code" ]
52 configs += [ "//build/config/compiler:no_chromium_code" ]
53 public = [
54 "glog/logging.h",
55 "src/bits_util.h",
56 "src/constants.h",
Amr Aboelkher1fd6f752020-04-21 16:06:56 +000057 "src/context.h",
Amr Aboelkhere6eac202020-04-08 20:46:44 +000058 "src/error_params.h",
59 "src/galois_key.h",
60 "src/int256.h",
61 "src/integral_types.h",
62 "src/montgomery.h",
63 "src/ntt_parameters.h",
64 "src/polynomial.h",
65 "src/prng/chacha_prng.h",
66 "src/prng/chacha_prng_util.h",
67 "src/prng/integral_prng_types.h",
68 "src/prng/prng.h",
69 "src/prng/single_thread_chacha_prng.h",
70 "src/relinearization_key.h",
71 "src/sample_error.h",
72 "src/status_macros.h",
73 "src/statusor.h",
74 "src/symmetric_encryption.h",
75 "src/symmetric_encryption_with_prng.h",
76 "src/transcription.h",
77 ]
78 sources = [
79 "src/int256.cc",
Amr Aboelkher1fd6f752020-04-21 16:06:56 +000080 "src/montgomery.cc",
Amr Aboelkhere6eac202020-04-08 20:46:44 +000081 "src/ntt_parameters.cc",
82 "src/prng/chacha_prng.cc",
83 "src/prng/chacha_prng_util.cc",
84 "src/prng/single_thread_chacha_prng.cc",
85 "src/relinearization_key.cc",
86 "src/statusor.cc",
87 ]
88 public_deps = [
89 ":serialization_proto",
90 "//third_party/abseil-cpp/absl/base",
91 "//third_party/abseil-cpp/absl/base:core_headers",
92 "//third_party/abseil-cpp/absl/memory",
93 "//third_party/abseil-cpp/absl/numeric:int128",
94 "//third_party/abseil-cpp/absl/status:status",
95 "//third_party/abseil-cpp/absl/strings",
Amr Aboelkher3e6c6942020-06-27 00:26:41 +000096 "//third_party/abseil-cpp/absl/synchronization",
Amr Aboelkhere6eac202020-04-08 20:46:44 +000097 "//third_party/abseil-cpp/absl/types:optional",
98 "//third_party/boringssl:boringssl",
Amr Aboelkher3e6c6942020-06-27 00:26:41 +000099 "//third_party/protobuf:protobuf_lite",
Amr Aboelkhere6eac202020-04-08 20:46:44 +0000100 ]
101}
102
Amr Aboelkher3e6c6942020-06-27 00:26:41 +0000103source_set("shell_encryption_test_library") {
Amr Aboelkhere6eac202020-04-08 20:46:44 +0000104 testonly = true
105 public_configs = [ ":shell_encryption_config1" ]
106 configs -= [ "//build/config/compiler:chromium_code" ]
107 configs += [ "//build/config/compiler:no_chromium_code" ]
108 public = [
Amr Aboelkher3e6c6942020-06-27 00:26:41 +0000109 "src/prng/integral_prng_testing_types.h",
Amr Aboelkhere6eac202020-04-08 20:46:44 +0000110 "src/testing/coefficient_polynomial.h",
111 "src/testing/coefficient_polynomial_ciphertext.h",
Amr Aboelkher3e6c6942020-06-27 00:26:41 +0000112 "src/testing/parameters.h",
Amr Aboelkhere6eac202020-04-08 20:46:44 +0000113 "src/testing/protobuf_matchers.h",
114 "src/testing/status_matchers.h",
115 "src/testing/status_testing.h",
116 "src/testing/testing_prng.h",
117 "src/testing/testing_utils.h",
118 ]
Amr Aboelkher3e6c6942020-06-27 00:26:41 +0000119 public_deps = [
120 ":coefficient_polynomial_proto",
121 ":shell_encryption",
122 "//testing/gmock:gmock",
123 "//testing/gtest:gtest",
124 ]
125}
126
127source_set("shell_encryption_test") {
128 testonly = true
129 public_configs = [ ":shell_encryption_config1" ]
130 configs -= [ "//build/config/compiler:chromium_code" ]
131 configs += [ "//build/config/compiler:no_chromium_code" ]
Amr Aboelkhere6eac202020-04-08 20:46:44 +0000132 sources = [
133 "src/bits_util_test.cc",
Amr Aboelkher1fd6f752020-04-21 16:06:56 +0000134 "src/context_test.cc",
Amr Aboelkhere6eac202020-04-08 20:46:44 +0000135 "src/error_params_test.cc",
136 "src/galois_key_test.cc",
137 "src/int256_test.cc",
138 "src/montgomery_test.cc",
139 "src/ntt_parameters_test.cc",
140 "src/polynomial_test.cc",
Amr Aboelkhere6eac202020-04-08 20:46:44 +0000141 "src/prng/prng_test.cc",
142 "src/prng/single_thread_chacha_prng_test.cc",
143 "src/relinearization_key_test.cc",
144 "src/sample_error_test.cc",
145 "src/status_macros_test.cc",
146 "src/statusor_test.cc",
147 "src/symmetric_encryption_test.cc",
148 "src/symmetric_encryption_with_prng_test.cc",
149 "src/testing/coefficient_polynomial_ciphertext_test.cc",
150 "src/testing/coefficient_polynomial_test.cc",
151 "src/testing/protobuf_matchers_test.cc",
152 "src/transcription_test.cc",
153 ]
Amr Aboelkher3e6c6942020-06-27 00:26:41 +0000154 deps = [
155 ":shell_encryption_test_library",
156 "//testing/gtest:gtest_main",
Amr Aboelkhere6eac202020-04-08 20:46:44 +0000157 ]
158}
Amr Aboelkher3e6c6942020-06-27 00:26:41 +0000159
160test("shell_encryption_unittests") {
161 deps = [ ":shell_encryption_test" ]
162}