Amr Aboelkher | e6eac20 | 2020-04-08 20:46:44 +0000 | [diff] [blame] | 1 | # 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 Hijikata | 639e5d9 | 2020-10-24 01:12:54 +0000 | [diff] [blame] | 5 | import("//build/config/chromeos/ui_mode.gni") |
Amr Aboelkher | e6eac20 | 2020-04-08 20:46:44 +0000 | [diff] [blame] | 6 | import("//testing/test.gni") |
| 7 | import("//third_party/protobuf/proto_library.gni") |
| 8 | |
| 9 | config("shell_encryption_config1") { |
Amr Aboelkher | 3e6c694 | 2020-06-27 00:26:41 +0000 | [diff] [blame] | 10 | # 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 Aboelkher | e6eac20 | 2020-04-08 20:46:44 +0000 | [diff] [blame] | 18 | 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. |
| 39 | proto_library("serialization_proto") { |
| 40 | sources = [ "src/serialization.proto" ] |
| 41 | proto_in_dir = "src/" |
| 42 | } |
| 43 | |
| 44 | proto_library("coefficient_polynomial_proto") { |
| 45 | sources = [ "src/testing/coefficient_polynomial.proto" ] |
| 46 | proto_in_dir = "src/testing/" |
| 47 | } |
| 48 | |
| 49 | # SHELL lib. |
Yuta Hijikata | 8a71975 | 2020-12-17 04:00:53 +0000 | [diff] [blame] | 50 | if (is_chromeos_ash) { |
Amr Aboelkher | 6373da6 | 2020-09-02 07:30:02 +0000 | [diff] [blame] | 51 | 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 Aboelkher | e6eac20 | 2020-04-08 20:46:44 +0000 | [diff] [blame] | 98 | } |
| 99 | |
Yuta Hijikata | 8a71975 | 2020-12-17 04:00:53 +0000 | [diff] [blame] | 100 | if (is_chromeos_ash) { |
Kevin Yeo | 3949474 | 2020-09-01 21:30:28 +0000 | [diff] [blame] | 101 | 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 Aboelkher | 3e6c694 | 2020-06-27 00:26:41 +0000 | [diff] [blame] | 124 | |
Amr Aboelkher | 8534139 | 2020-11-30 23:49:19 +0000 | [diff] [blame] | 125 | test("shell_encryption_unittests") { |
Kevin Yeo | 3949474 | 2020-09-01 21:30:28 +0000 | [diff] [blame] | 126 | 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 Aboelkher | 8534139 | 2020-11-30 23:49:19 +0000 | [diff] [blame] | 151 | "tests/run_all_unittests.cc", |
Kevin Yeo | 3949474 | 2020-09-01 21:30:28 +0000 | [diff] [blame] | 152 | ] |
| 153 | deps = [ |
| 154 | ":shell_encryption_test_library", |
Amr Aboelkher | 8534139 | 2020-11-30 23:49:19 +0000 | [diff] [blame] | 155 | "//base/test:test_support", |
| 156 | "//testing/gtest", |
Kevin Yeo | 3949474 | 2020-09-01 21:30:28 +0000 | [diff] [blame] | 157 | ] |
| 158 | } |
Amr Aboelkher | 3e6c694 | 2020-06-27 00:26:41 +0000 | [diff] [blame] | 159 | } |