blob: 60acbf5a7f5933a2b79447abb506c91544219b2e [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.
Amr Aboelkher6373da62020-09-02 07:30:02 +000049if (is_chromeos) {
50 source_set("shell_encryption") {
51 public_configs = [ ":shell_encryption_config1" ]
52 configs -= [ "//build/config/compiler:chromium_code" ]
53 configs += [ "//build/config/compiler:no_chromium_code" ]
54 public = [
55 "glog/logging.h",
56 "src/bits_util.h",
57 "src/constants.h",
58 "src/context.h",
59 "src/error_params.h",
60 "src/galois_key.h",
61 "src/int256.h",
62 "src/integral_types.h",
63 "src/montgomery.h",
64 "src/ntt_parameters.h",
65 "src/polynomial.h",
66 "src/prng/chacha_prng.h",
67 "src/prng/chacha_prng_util.h",
68 "src/prng/integral_prng_types.h",
69 "src/prng/prng.h",
70 "src/prng/single_thread_chacha_prng.h",
71 "src/relinearization_key.h",
72 "src/sample_error.h",
73 "src/status_macros.h",
74 "src/statusor.h",
75 "src/symmetric_encryption.h",
76 "src/symmetric_encryption_with_prng.h",
77 "src/transcription.h",
78 ]
79 sources = [
80 "src/int256.cc",
81 "src/montgomery.cc",
82 "src/ntt_parameters.cc",
83 "src/prng/chacha_prng.cc",
84 "src/prng/chacha_prng_util.cc",
85 "src/prng/single_thread_chacha_prng.cc",
86 "src/relinearization_key.cc",
87 "src/statusor.cc",
88 ]
89 public_deps = [
90 ":serialization_proto",
91 "//base:base",
92 "//third_party/abseil-cpp:absl",
93 "//third_party/boringssl:boringssl",
94 "//third_party/protobuf:protobuf_lite",
95 ]
96 }
Amr Aboelkhere6eac202020-04-08 20:46:44 +000097}
98
Kevin Yeo39494742020-09-01 21:30:28 +000099if (is_chromeos) {
100 source_set("shell_encryption_test_library") {
101 testonly = true
102 public_configs = [ ":shell_encryption_config1" ]
103 configs -= [ "//build/config/compiler:chromium_code" ]
104 configs += [ "//build/config/compiler:no_chromium_code" ]
105 public = [
106 "src/prng/integral_prng_testing_types.h",
107 "src/testing/coefficient_polynomial.h",
108 "src/testing/coefficient_polynomial_ciphertext.h",
109 "src/testing/parameters.h",
110 "src/testing/protobuf_matchers.h",
111 "src/testing/status_matchers.h",
112 "src/testing/status_testing.h",
113 "src/testing/testing_prng.h",
114 "src/testing/testing_utils.h",
115 ]
116 public_deps = [
117 ":coefficient_polynomial_proto",
118 ":shell_encryption",
119 "//testing/gmock:gmock",
120 "//testing/gtest:gtest",
121 ]
122 }
Amr Aboelkher3e6c6942020-06-27 00:26:41 +0000123
Kevin Yeo39494742020-09-01 21:30:28 +0000124 source_set("shell_encryption_test") {
125 testonly = true
126 public_configs = [ ":shell_encryption_config1" ]
127 configs -= [ "//build/config/compiler:chromium_code" ]
128 configs += [ "//build/config/compiler:no_chromium_code" ]
129 sources = [
130 "src/bits_util_test.cc",
131 "src/context_test.cc",
132 "src/error_params_test.cc",
133 "src/galois_key_test.cc",
134 "src/int256_test.cc",
135 "src/montgomery_test.cc",
136 "src/ntt_parameters_test.cc",
137 "src/polynomial_test.cc",
138 "src/prng/prng_test.cc",
139 "src/prng/single_thread_chacha_prng_test.cc",
140 "src/relinearization_key_test.cc",
141 "src/sample_error_test.cc",
142 "src/status_macros_test.cc",
143 "src/statusor_test.cc",
144 "src/symmetric_encryption_test.cc",
145 "src/symmetric_encryption_with_prng_test.cc",
146 "src/testing/coefficient_polynomial_ciphertext_test.cc",
147 "src/testing/coefficient_polynomial_test.cc",
148 "src/testing/protobuf_matchers_test.cc",
149 "src/transcription_test.cc",
150 ]
151 deps = [
152 ":shell_encryption_test_library",
153 "//testing/gtest:gtest_main",
154 ]
155 }
Amr Aboelkher3e6c6942020-06-27 00:26:41 +0000156
Kevin Yeo39494742020-09-01 21:30:28 +0000157 test("shell_encryption_unittests") {
158 deps = [ ":shell_encryption_test" ]
159 }
Amr Aboelkher3e6c6942020-06-27 00:26:41 +0000160}