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 | |
| 5 | import("//testing/test.gni") |
| 6 | import("//third_party/protobuf/proto_library.gni") |
| 7 | |
| 8 | config("shell_encryption_config1") { |
| 9 | include_dirs = [ |
| 10 | # Allow includes to be prefixed with shell-encryption/src/ in case it is not an |
| 11 | # immediate subdirectory of the top-level. |
| 12 | "src", |
| 13 | |
| 14 | # Allow includes to be prefixed with shell-encryption/ in case it is not an |
| 15 | # immediate subdirectory of the top-level. That's mainly is being used for |
| 16 | # glog/logging.h includes. |
| 17 | ".", |
| 18 | |
| 19 | # Just like the root shell-encryption directory is added to include path, the |
| 20 | # corresponding directory tree with generated files needs to be added too. |
| 21 | # Note: this path does not change depending on the current target, e.g. |
| 22 | # it is always "//gen/third_party/shell-encryption/src" when building with Chromium. |
| 23 | # See also: http://cs.chromium.org/?q=%5C"default_include_dirs |
| 24 | # https://gn.googlesource.com/gn/+/master/docs/reference.md#target_gen_dir" |
| 25 | target_gen_dir, |
| 26 | ] |
| 27 | } |
| 28 | |
| 29 | # Protos. |
| 30 | proto_library("serialization_proto") { |
| 31 | sources = [ "src/serialization.proto" ] |
| 32 | proto_in_dir = "src/" |
| 33 | } |
| 34 | |
| 35 | proto_library("coefficient_polynomial_proto") { |
| 36 | sources = [ "src/testing/coefficient_polynomial.proto" ] |
| 37 | proto_in_dir = "src/testing/" |
| 38 | } |
| 39 | |
| 40 | # SHELL lib. |
| 41 | source_set("shell_encryption") { |
| 42 | public_configs = [ ":shell_encryption_config1" ] |
| 43 | configs -= [ "//build/config/compiler:chromium_code" ] |
| 44 | configs += [ "//build/config/compiler:no_chromium_code" ] |
| 45 | public = [ |
| 46 | "glog/logging.h", |
| 47 | "src/bits_util.h", |
| 48 | "src/constants.h", |
| 49 | "src/error_params.h", |
| 50 | "src/galois_key.h", |
| 51 | "src/int256.h", |
| 52 | "src/integral_types.h", |
| 53 | "src/montgomery.h", |
| 54 | "src/ntt_parameters.h", |
| 55 | "src/polynomial.h", |
| 56 | "src/prng/chacha_prng.h", |
| 57 | "src/prng/chacha_prng_util.h", |
| 58 | "src/prng/integral_prng_types.h", |
| 59 | "src/prng/prng.h", |
| 60 | "src/prng/single_thread_chacha_prng.h", |
| 61 | "src/relinearization_key.h", |
| 62 | "src/sample_error.h", |
| 63 | "src/status_macros.h", |
| 64 | "src/statusor.h", |
| 65 | "src/symmetric_encryption.h", |
| 66 | "src/symmetric_encryption_with_prng.h", |
| 67 | "src/transcription.h", |
| 68 | ] |
| 69 | sources = [ |
| 70 | "src/int256.cc", |
| 71 | "src/ntt_parameters.cc", |
| 72 | "src/prng/chacha_prng.cc", |
| 73 | "src/prng/chacha_prng_util.cc", |
| 74 | "src/prng/single_thread_chacha_prng.cc", |
| 75 | "src/relinearization_key.cc", |
| 76 | "src/statusor.cc", |
| 77 | ] |
| 78 | public_deps = [ |
| 79 | ":serialization_proto", |
| 80 | "//third_party/abseil-cpp/absl/base", |
| 81 | "//third_party/abseil-cpp/absl/base:core_headers", |
| 82 | "//third_party/abseil-cpp/absl/memory", |
| 83 | "//third_party/abseil-cpp/absl/numeric:int128", |
| 84 | "//third_party/abseil-cpp/absl/status:status", |
| 85 | "//third_party/abseil-cpp/absl/strings", |
| 86 | "//third_party/abseil-cpp/absl/types:optional", |
| 87 | "//third_party/boringssl:boringssl", |
| 88 | ] |
| 89 | } |
| 90 | |
| 91 | test("shell_encryption_test") { |
| 92 | testonly = true |
| 93 | public_configs = [ ":shell_encryption_config1" ] |
| 94 | configs -= [ "//build/config/compiler:chromium_code" ] |
| 95 | configs += [ "//build/config/compiler:no_chromium_code" ] |
| 96 | public = [ |
| 97 | "src/testing/coefficient_polynomial.h", |
| 98 | "src/testing/coefficient_polynomial_ciphertext.h", |
| 99 | "src/testing/protobuf_matchers.h", |
| 100 | "src/testing/status_matchers.h", |
| 101 | "src/testing/status_testing.h", |
| 102 | "src/testing/testing_prng.h", |
| 103 | "src/testing/testing_utils.h", |
| 104 | ] |
| 105 | sources = [ |
| 106 | "src/bits_util_test.cc", |
| 107 | "src/error_params_test.cc", |
| 108 | "src/galois_key_test.cc", |
| 109 | "src/int256_test.cc", |
| 110 | "src/montgomery_test.cc", |
| 111 | "src/ntt_parameters_test.cc", |
| 112 | "src/polynomial_test.cc", |
| 113 | "src/prng/chacha_prng.cc", |
| 114 | "src/prng/integral_prng_testing_types.h", |
| 115 | "src/prng/prng_test.cc", |
| 116 | "src/prng/single_thread_chacha_prng_test.cc", |
| 117 | "src/relinearization_key_test.cc", |
| 118 | "src/sample_error_test.cc", |
| 119 | "src/status_macros_test.cc", |
| 120 | "src/statusor_test.cc", |
| 121 | "src/symmetric_encryption_test.cc", |
| 122 | "src/symmetric_encryption_with_prng_test.cc", |
| 123 | "src/testing/coefficient_polynomial_ciphertext_test.cc", |
| 124 | "src/testing/coefficient_polynomial_test.cc", |
| 125 | "src/testing/protobuf_matchers_test.cc", |
| 126 | "src/transcription_test.cc", |
| 127 | ] |
| 128 | public_deps = [ |
| 129 | ":coefficient_polynomial_proto", |
| 130 | ":shell_encryption", |
| 131 | "//testing/gmock:gmock", |
| 132 | "//testing/gtest:gtest", |
| 133 | ] |
| 134 | } |