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 | |
amraboelkher | 4ae61a6 | 2021-11-18 10:54:23 +0000 | [diff] [blame] | 18 | defines = [] |
| 19 | if (is_component_build) { |
| 20 | defines = [ |
| 21 | # Build targets inside shell-encryption will need this macro to |
| 22 | # be defined in order to correctly export symbols when is_component_build |
| 23 | # is true. |
| 24 | # For more info see: base/shell_encryption_export.h. |
| 25 | "SHELL_ENCRYPTION_ENABLE_SYMBOL_EXPORT", |
| 26 | ] |
| 27 | } |
| 28 | |
Amr Aboelkher | e6eac20 | 2020-04-08 20:46:44 +0000 | [diff] [blame] | 29 | include_dirs = [ |
| 30 | # Allow includes to be prefixed with shell-encryption/src/ in case it is not an |
| 31 | # immediate subdirectory of the top-level. |
| 32 | "src", |
| 33 | |
| 34 | # Allow includes to be prefixed with shell-encryption/ in case it is not an |
| 35 | # immediate subdirectory of the top-level. That's mainly is being used for |
| 36 | # glog/logging.h includes. |
| 37 | ".", |
| 38 | |
| 39 | # Just like the root shell-encryption directory is added to include path, the |
| 40 | # corresponding directory tree with generated files needs to be added too. |
| 41 | # Note: this path does not change depending on the current target, e.g. |
| 42 | # it is always "//gen/third_party/shell-encryption/src" when building with Chromium. |
| 43 | # See also: http://cs.chromium.org/?q=%5C"default_include_dirs |
| 44 | # https://gn.googlesource.com/gn/+/master/docs/reference.md#target_gen_dir" |
| 45 | target_gen_dir, |
| 46 | ] |
| 47 | } |
| 48 | |
| 49 | # Protos. |
| 50 | proto_library("serialization_proto") { |
| 51 | sources = [ "src/serialization.proto" ] |
| 52 | proto_in_dir = "src/" |
amraboelkher | 4ae61a6 | 2021-11-18 10:54:23 +0000 | [diff] [blame] | 53 | |
| 54 | cc_generator_options = "dllexport_decl=SHELL_ENCRYPTION_EXPORT:" |
| 55 | cc_include = "third_party/shell-encryption/base/shell_encryption_export.h" |
| 56 | component_build_force_source_set = true |
Amr Aboelkher | e6eac20 | 2020-04-08 20:46:44 +0000 | [diff] [blame] | 57 | } |
| 58 | |
| 59 | proto_library("coefficient_polynomial_proto") { |
| 60 | sources = [ "src/testing/coefficient_polynomial.proto" ] |
| 61 | proto_in_dir = "src/testing/" |
amraboelkher | 4ae61a6 | 2021-11-18 10:54:23 +0000 | [diff] [blame] | 62 | |
| 63 | cc_generator_options = "dllexport_decl=SHELL_ENCRYPTION_EXPORT:" |
| 64 | cc_include = "third_party/shell-encryption/base/shell_encryption_export.h" |
| 65 | component_build_force_source_set = true |
Amr Aboelkher | e6eac20 | 2020-04-08 20:46:44 +0000 | [diff] [blame] | 66 | } |
| 67 | |
| 68 | # SHELL lib. |
Yuta Hijikata | 8a71975 | 2020-12-17 04:00:53 +0000 | [diff] [blame] | 69 | if (is_chromeos_ash) { |
amraboelkher | 4ae61a6 | 2021-11-18 10:54:23 +0000 | [diff] [blame] | 70 | component("shell_encryption") { |
Amr Aboelkher | 6373da6 | 2020-09-02 07:30:02 +0000 | [diff] [blame] | 71 | public_configs = [ ":shell_encryption_config1" ] |
| 72 | configs -= [ "//build/config/compiler:chromium_code" ] |
| 73 | configs += [ "//build/config/compiler:no_chromium_code" ] |
| 74 | public = [ |
amraboelkher | 4ae61a6 | 2021-11-18 10:54:23 +0000 | [diff] [blame] | 75 | "base/shell_encryption_export.h", |
| 76 | "base/shell_encryption_export_template.h", |
Amr Aboelkher | 6373da6 | 2020-09-02 07:30:02 +0000 | [diff] [blame] | 77 | "glog/logging.h", |
| 78 | "src/bits_util.h", |
| 79 | "src/constants.h", |
| 80 | "src/context.h", |
| 81 | "src/error_params.h", |
| 82 | "src/galois_key.h", |
| 83 | "src/int256.h", |
| 84 | "src/integral_types.h", |
| 85 | "src/montgomery.h", |
| 86 | "src/ntt_parameters.h", |
| 87 | "src/polynomial.h", |
| 88 | "src/prng/chacha_prng.h", |
| 89 | "src/prng/chacha_prng_util.h", |
| 90 | "src/prng/integral_prng_types.h", |
| 91 | "src/prng/prng.h", |
| 92 | "src/prng/single_thread_chacha_prng.h", |
| 93 | "src/relinearization_key.h", |
| 94 | "src/sample_error.h", |
| 95 | "src/status_macros.h", |
| 96 | "src/statusor.h", |
| 97 | "src/symmetric_encryption.h", |
| 98 | "src/symmetric_encryption_with_prng.h", |
| 99 | "src/transcription.h", |
| 100 | ] |
| 101 | sources = [ |
| 102 | "src/int256.cc", |
| 103 | "src/montgomery.cc", |
| 104 | "src/ntt_parameters.cc", |
| 105 | "src/prng/chacha_prng.cc", |
| 106 | "src/prng/chacha_prng_util.cc", |
| 107 | "src/prng/single_thread_chacha_prng.cc", |
| 108 | "src/relinearization_key.cc", |
Amr Aboelkher | 6373da6 | 2020-09-02 07:30:02 +0000 | [diff] [blame] | 109 | ] |
| 110 | public_deps = [ |
| 111 | ":serialization_proto", |
| 112 | "//base:base", |
| 113 | "//third_party/abseil-cpp:absl", |
| 114 | "//third_party/boringssl:boringssl", |
| 115 | "//third_party/protobuf:protobuf_lite", |
| 116 | ] |
| 117 | } |
Amr Aboelkher | e6eac20 | 2020-04-08 20:46:44 +0000 | [diff] [blame] | 118 | } |
| 119 | |
Yuta Hijikata | 8a71975 | 2020-12-17 04:00:53 +0000 | [diff] [blame] | 120 | if (is_chromeos_ash) { |
Kevin Yeo | 3949474 | 2020-09-01 21:30:28 +0000 | [diff] [blame] | 121 | source_set("shell_encryption_test_library") { |
| 122 | testonly = true |
| 123 | public_configs = [ ":shell_encryption_config1" ] |
| 124 | configs -= [ "//build/config/compiler:chromium_code" ] |
| 125 | configs += [ "//build/config/compiler:no_chromium_code" ] |
| 126 | public = [ |
| 127 | "src/prng/integral_prng_testing_types.h", |
| 128 | "src/testing/coefficient_polynomial.h", |
| 129 | "src/testing/coefficient_polynomial_ciphertext.h", |
| 130 | "src/testing/parameters.h", |
| 131 | "src/testing/protobuf_matchers.h", |
| 132 | "src/testing/status_matchers.h", |
| 133 | "src/testing/status_testing.h", |
| 134 | "src/testing/testing_prng.h", |
| 135 | "src/testing/testing_utils.h", |
| 136 | ] |
| 137 | public_deps = [ |
| 138 | ":coefficient_polynomial_proto", |
amraboelkher | 4ae61a6 | 2021-11-18 10:54:23 +0000 | [diff] [blame] | 139 | ":serialization_proto", |
Kevin Yeo | 3949474 | 2020-09-01 21:30:28 +0000 | [diff] [blame] | 140 | ":shell_encryption", |
| 141 | "//testing/gmock:gmock", |
| 142 | "//testing/gtest:gtest", |
| 143 | ] |
| 144 | } |
Amr Aboelkher | 3e6c694 | 2020-06-27 00:26:41 +0000 | [diff] [blame] | 145 | |
Amr Aboelkher | 8534139 | 2020-11-30 23:49:19 +0000 | [diff] [blame] | 146 | test("shell_encryption_unittests") { |
Kevin Yeo | 3949474 | 2020-09-01 21:30:28 +0000 | [diff] [blame] | 147 | testonly = true |
| 148 | public_configs = [ ":shell_encryption_config1" ] |
| 149 | configs -= [ "//build/config/compiler:chromium_code" ] |
| 150 | configs += [ "//build/config/compiler:no_chromium_code" ] |
| 151 | sources = [ |
| 152 | "src/bits_util_test.cc", |
| 153 | "src/context_test.cc", |
| 154 | "src/error_params_test.cc", |
| 155 | "src/galois_key_test.cc", |
| 156 | "src/int256_test.cc", |
| 157 | "src/montgomery_test.cc", |
| 158 | "src/ntt_parameters_test.cc", |
| 159 | "src/polynomial_test.cc", |
| 160 | "src/prng/prng_test.cc", |
| 161 | "src/prng/single_thread_chacha_prng_test.cc", |
| 162 | "src/relinearization_key_test.cc", |
| 163 | "src/sample_error_test.cc", |
| 164 | "src/status_macros_test.cc", |
Kevin Yeo | 3949474 | 2020-09-01 21:30:28 +0000 | [diff] [blame] | 165 | "src/symmetric_encryption_test.cc", |
| 166 | "src/symmetric_encryption_with_prng_test.cc", |
| 167 | "src/testing/coefficient_polynomial_ciphertext_test.cc", |
| 168 | "src/testing/coefficient_polynomial_test.cc", |
| 169 | "src/testing/protobuf_matchers_test.cc", |
| 170 | "src/transcription_test.cc", |
Amr Aboelkher | 8534139 | 2020-11-30 23:49:19 +0000 | [diff] [blame] | 171 | "tests/run_all_unittests.cc", |
Kevin Yeo | 3949474 | 2020-09-01 21:30:28 +0000 | [diff] [blame] | 172 | ] |
| 173 | deps = [ |
| 174 | ":shell_encryption_test_library", |
Amr Aboelkher | 8534139 | 2020-11-30 23:49:19 +0000 | [diff] [blame] | 175 | "//base/test:test_support", |
| 176 | "//testing/gtest", |
Kevin Yeo | 3949474 | 2020-09-01 21:30:28 +0000 | [diff] [blame] | 177 | ] |
| 178 | } |
Amr Aboelkher | 3e6c694 | 2020-06-27 00:26:41 +0000 | [diff] [blame] | 179 | } |