blob: 3570685860443c6fb2a93e605ea7247d0599f9d3 [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",
Amr Aboelkher6531b1f2020-07-23 02:18:05 +000090 "//base:base",
91 "//third_party/abseil-cpp:absl",
Amr Aboelkhere6eac202020-04-08 20:46:44 +000092 "//third_party/boringssl:boringssl",
Amr Aboelkher3e6c6942020-06-27 00:26:41 +000093 "//third_party/protobuf:protobuf_lite",
Amr Aboelkhere6eac202020-04-08 20:46:44 +000094 ]
95}
96
Kevin Yeo39494742020-09-01 21:30:28 +000097if (is_chromeos) {
98 source_set("shell_encryption_test_library") {
99 testonly = true
100 public_configs = [ ":shell_encryption_config1" ]
101 configs -= [ "//build/config/compiler:chromium_code" ]
102 configs += [ "//build/config/compiler:no_chromium_code" ]
103 public = [
104 "src/prng/integral_prng_testing_types.h",
105 "src/testing/coefficient_polynomial.h",
106 "src/testing/coefficient_polynomial_ciphertext.h",
107 "src/testing/parameters.h",
108 "src/testing/protobuf_matchers.h",
109 "src/testing/status_matchers.h",
110 "src/testing/status_testing.h",
111 "src/testing/testing_prng.h",
112 "src/testing/testing_utils.h",
113 ]
114 public_deps = [
115 ":coefficient_polynomial_proto",
116 ":shell_encryption",
117 "//testing/gmock:gmock",
118 "//testing/gtest:gtest",
119 ]
120 }
Amr Aboelkher3e6c6942020-06-27 00:26:41 +0000121
Kevin Yeo39494742020-09-01 21:30:28 +0000122 source_set("shell_encryption_test") {
123 testonly = true
124 public_configs = [ ":shell_encryption_config1" ]
125 configs -= [ "//build/config/compiler:chromium_code" ]
126 configs += [ "//build/config/compiler:no_chromium_code" ]
127 sources = [
128 "src/bits_util_test.cc",
129 "src/context_test.cc",
130 "src/error_params_test.cc",
131 "src/galois_key_test.cc",
132 "src/int256_test.cc",
133 "src/montgomery_test.cc",
134 "src/ntt_parameters_test.cc",
135 "src/polynomial_test.cc",
136 "src/prng/prng_test.cc",
137 "src/prng/single_thread_chacha_prng_test.cc",
138 "src/relinearization_key_test.cc",
139 "src/sample_error_test.cc",
140 "src/status_macros_test.cc",
141 "src/statusor_test.cc",
142 "src/symmetric_encryption_test.cc",
143 "src/symmetric_encryption_with_prng_test.cc",
144 "src/testing/coefficient_polynomial_ciphertext_test.cc",
145 "src/testing/coefficient_polynomial_test.cc",
146 "src/testing/protobuf_matchers_test.cc",
147 "src/transcription_test.cc",
148 ]
149 deps = [
150 ":shell_encryption_test_library",
151 "//testing/gtest:gtest_main",
152 ]
153 }
Amr Aboelkher3e6c6942020-06-27 00:26:41 +0000154
Kevin Yeo39494742020-09-01 21:30:28 +0000155 test("shell_encryption_unittests") {
156 deps = [ ":shell_encryption_test" ]
157 }
Amr Aboelkher3e6c6942020-06-27 00:26:41 +0000158}