summaryrefslogtreecommitdiff
path: root/chromium/third_party/shell-encryption/BUILD.gn
blob: 41a98af3f6ba7950fc6e87eb4d2f2f4960687213 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# Copyright 2020 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//testing/test.gni")
import("//third_party/protobuf/proto_library.gni")

config("shell_encryption_config1") {
  include_dirs = [
    # Allow includes to be prefixed with shell-encryption/src/ in case it is not an
    # immediate subdirectory of the top-level.
    "src",

    # Allow includes to be prefixed with shell-encryption/ in case it is not an
    # immediate subdirectory of the top-level. That's mainly is being used for
    # glog/logging.h includes.
    ".",

    # Just like the root shell-encryption directory is added to include path, the
    # corresponding directory tree with generated files needs to be added too.
    # Note: this path does not change depending on the current target, e.g.
    # it is always "//gen/third_party/shell-encryption/src" when building with Chromium.
    # See also: http://cs.chromium.org/?q=%5C"default_include_dirs
    # https://gn.googlesource.com/gn/+/master/docs/reference.md#target_gen_dir"
    target_gen_dir,
  ]
}

# Protos.
proto_library("serialization_proto") {
  sources = [ "src/serialization.proto" ]
  proto_in_dir = "src/"
}

proto_library("coefficient_polynomial_proto") {
  sources = [ "src/testing/coefficient_polynomial.proto" ]
  proto_in_dir = "src/testing/"
}

# SHELL lib.
source_set("shell_encryption") {
  public_configs = [ ":shell_encryption_config1" ]
  configs -= [ "//build/config/compiler:chromium_code" ]
  configs += [ "//build/config/compiler:no_chromium_code" ]
  public = [
    "glog/logging.h",
    "src/bits_util.h",
    "src/constants.h",
    "src/context.h",
    "src/error_params.h",
    "src/galois_key.h",
    "src/int256.h",
    "src/integral_types.h",
    "src/montgomery.h",
    "src/ntt_parameters.h",
    "src/polynomial.h",
    "src/prng/chacha_prng.h",
    "src/prng/chacha_prng_util.h",
    "src/prng/integral_prng_types.h",
    "src/prng/prng.h",
    "src/prng/single_thread_chacha_prng.h",
    "src/relinearization_key.h",
    "src/sample_error.h",
    "src/status_macros.h",
    "src/statusor.h",
    "src/symmetric_encryption.h",
    "src/symmetric_encryption_with_prng.h",
    "src/transcription.h",
  ]
  sources = [
    "src/int256.cc",
    "src/montgomery.cc",
    "src/ntt_parameters.cc",
    "src/prng/chacha_prng.cc",
    "src/prng/chacha_prng_util.cc",
    "src/prng/single_thread_chacha_prng.cc",
    "src/relinearization_key.cc",
    "src/statusor.cc",
  ]
  public_deps = [
    ":serialization_proto",
    "//third_party/abseil-cpp/absl/base",
    "//third_party/abseil-cpp/absl/base:core_headers",
    "//third_party/abseil-cpp/absl/memory",
    "//third_party/abseil-cpp/absl/numeric:int128",
    "//third_party/abseil-cpp/absl/status:status",
    "//third_party/abseil-cpp/absl/strings",
    "//third_party/abseil-cpp/absl/types:optional",
    "//third_party/boringssl:boringssl",
  ]
}

test("shell_encryption_test") {
  testonly = true
  public_configs = [ ":shell_encryption_config1" ]
  configs -= [ "//build/config/compiler:chromium_code" ]
  configs += [ "//build/config/compiler:no_chromium_code" ]
  public = [
    "src/testing/coefficient_polynomial.h",
    "src/testing/coefficient_polynomial_ciphertext.h",
    "src/testing/parameter.h",
    "src/testing/protobuf_matchers.h",
    "src/testing/status_matchers.h",
    "src/testing/status_testing.h",
    "src/testing/testing_prng.h",
    "src/testing/testing_utils.h",
  ]
  sources = [
    "src/bits_util_test.cc",
    "src/context_test.cc",
    "src/error_params_test.cc",
    "src/galois_key_test.cc",
    "src/int256_test.cc",
    "src/montgomery_test.cc",
    "src/ntt_parameters_test.cc",
    "src/polynomial_test.cc",
    "src/prng/chacha_prng.cc",
    "src/prng/integral_prng_testing_types.h",
    "src/prng/prng_test.cc",
    "src/prng/single_thread_chacha_prng_test.cc",
    "src/relinearization_key_test.cc",
    "src/sample_error_test.cc",
    "src/status_macros_test.cc",
    "src/statusor_test.cc",
    "src/symmetric_encryption_test.cc",
    "src/symmetric_encryption_with_prng_test.cc",
    "src/testing/coefficient_polynomial_ciphertext_test.cc",
    "src/testing/coefficient_polynomial_test.cc",
    "src/testing/protobuf_matchers_test.cc",
    "src/transcription_test.cc",
  ]
  public_deps = [
    ":coefficient_polynomial_proto",
    ":shell_encryption",
    "//testing/gmock:gmock",
    "//testing/gtest:gtest",
  ]
}