blob: 23dd9c3f2914dfaf9b35a0ed5e4eca72174d5259 [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
Amr Aboelkher3e6c6942020-06-27 00:26:41 +000097source_set("shell_encryption_test_library") {
Amr Aboelkhere6eac202020-04-08 20:46:44 +000098 testonly = true
99 public_configs = [ ":shell_encryption_config1" ]
100 configs -= [ "//build/config/compiler:chromium_code" ]
101 configs += [ "//build/config/compiler:no_chromium_code" ]
102 public = [
Amr Aboelkher3e6c6942020-06-27 00:26:41 +0000103 "src/prng/integral_prng_testing_types.h",
Amr Aboelkhere6eac202020-04-08 20:46:44 +0000104 "src/testing/coefficient_polynomial.h",
105 "src/testing/coefficient_polynomial_ciphertext.h",
Amr Aboelkher3e6c6942020-06-27 00:26:41 +0000106 "src/testing/parameters.h",
Amr Aboelkhere6eac202020-04-08 20:46:44 +0000107 "src/testing/protobuf_matchers.h",
108 "src/testing/status_matchers.h",
109 "src/testing/status_testing.h",
110 "src/testing/testing_prng.h",
111 "src/testing/testing_utils.h",
112 ]
Amr Aboelkher3e6c6942020-06-27 00:26:41 +0000113 public_deps = [
114 ":coefficient_polynomial_proto",
115 ":shell_encryption",
116 "//testing/gmock:gmock",
117 "//testing/gtest:gtest",
118 ]
119}
120
121source_set("shell_encryption_test") {
122 testonly = true
123 public_configs = [ ":shell_encryption_config1" ]
124 configs -= [ "//build/config/compiler:chromium_code" ]
125 configs += [ "//build/config/compiler:no_chromium_code" ]
Amr Aboelkhere6eac202020-04-08 20:46:44 +0000126 sources = [
127 "src/bits_util_test.cc",
Amr Aboelkher1fd6f752020-04-21 16:06:56 +0000128 "src/context_test.cc",
Amr Aboelkhere6eac202020-04-08 20:46:44 +0000129 "src/error_params_test.cc",
130 "src/galois_key_test.cc",
131 "src/int256_test.cc",
132 "src/montgomery_test.cc",
133 "src/ntt_parameters_test.cc",
134 "src/polynomial_test.cc",
Amr Aboelkhere6eac202020-04-08 20:46:44 +0000135 "src/prng/prng_test.cc",
136 "src/prng/single_thread_chacha_prng_test.cc",
137 "src/relinearization_key_test.cc",
138 "src/sample_error_test.cc",
139 "src/status_macros_test.cc",
140 "src/statusor_test.cc",
141 "src/symmetric_encryption_test.cc",
142 "src/symmetric_encryption_with_prng_test.cc",
143 "src/testing/coefficient_polynomial_ciphertext_test.cc",
144 "src/testing/coefficient_polynomial_test.cc",
145 "src/testing/protobuf_matchers_test.cc",
146 "src/transcription_test.cc",
147 ]
Amr Aboelkher3e6c6942020-06-27 00:26:41 +0000148 deps = [
149 ":shell_encryption_test_library",
150 "//testing/gtest:gtest_main",
Amr Aboelkhere6eac202020-04-08 20:46:44 +0000151 ]
152}
Amr Aboelkher3e6c6942020-06-27 00:26:41 +0000153
154test("shell_encryption_unittests") {
155 deps = [ ":shell_encryption_test" ]
156}