123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520 |
- # Copyright 2017 Google LLC.
- #
- # Licensed under the Apache License, Version 2.0 (the "License");
- # you may not use this file except in compliance with the License.
- # You may obtain a copy of the License at
- #
- # https://www.apache.org/licenses/LICENSE-2.0
- #
- # Unless required by applicable law or agreed to in writing, software
- # distributed under the License is distributed on an "AS IS" BASIS,
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- # See the License for the specific language governing permissions and
- # limitations under the License.
- load("@rules_cc//cc:defs.bzl", "cc_library")
- load("@rules_proto//proto:defs.bzl", "proto_library")
- package(default_visibility = ["//visibility:public"])
- licenses(["notice"])
- exports_files(["LICENSE"])
- # Protos.
- proto_library(
- name = "serialization_proto",
- srcs = ["serialization.proto"],
- )
- cc_proto_library(
- name = "serialization_cc_proto",
- deps = [":serialization_proto"],
- )
- # Context.
- cc_library(
- name = "context",
- hdrs = ["context.h"],
- deps = [
- ":error_params",
- ":ntt_parameters",
- ":statusor_fork",
- "@com_google_absl//absl/memory",
- ],
- )
- cc_test(
- name = "context_test",
- size = "small",
- srcs = ["context_test.cc"],
- deps = [
- ":constants",
- ":context",
- ":integral_types",
- ":montgomery",
- ":statusor_fork",
- "//testing:parameters",
- "//testing:status_testing",
- "@com_github_google_googletest//:gtest_main",
- "@com_google_absl//absl/numeric:int128",
- ],
- )
- # Integral types for integers.
- cc_library(
- name = "integral_types",
- hdrs = ["integral_types.h"],
- deps = [
- "@com_google_absl//absl/numeric:int128",
- ],
- )
- # Constants.
- cc_library(
- name = "constants",
- hdrs = ["constants.h"],
- deps = [
- ":integral_types",
- "@com_google_absl//absl/numeric:int128",
- ],
- )
- # Utilities.
- cc_library(
- name = "bits_util",
- hdrs = ["bits_util.h"],
- deps = [
- ":integral_types",
- "@com_google_absl//absl/numeric:int128",
- ],
- )
- cc_test(
- name = "bits_util_test",
- size = "small",
- srcs = ["bits_util_test.cc"],
- deps = [
- ":bits_util",
- "@com_github_google_googletest//:gtest_main",
- "@com_google_absl//absl/numeric:int128",
- ],
- )
- cc_library(
- name = "sample_error",
- hdrs = ["sample_error.h"],
- deps = [
- ":bits_util",
- ":constants",
- ":error_params",
- ":statusor_fork",
- "//prng",
- "@com_google_absl//absl/strings",
- ],
- )
- cc_test(
- name = "sample_error_test",
- size = "small",
- srcs = [
- "sample_error_test.cc",
- ],
- deps = [
- ":context",
- ":montgomery",
- ":sample_error",
- ":symmetric_encryption",
- "//testing:parameters",
- "//testing:status_is_fork",
- "//testing:status_testing",
- "//testing:testing_prng",
- "@com_github_google_googletest//:gtest_main",
- ],
- )
- cc_library(
- name = "statusor_fork",
- srcs = ["statusor.cc"],
- hdrs = [
- "status_macros.h",
- "statusor.h",
- ],
- deps = [
- "@com_github_google_glog//:glog",
- "@com_google_absl//absl/base:core_headers",
- "@com_google_absl//absl/status",
- "@com_google_absl//absl/types:optional",
- ],
- )
- cc_test(
- name = "statusor_test",
- size = "small",
- srcs = ["statusor_test.cc"],
- deps = [
- ":statusor_fork",
- "@com_github_google_googletest//:gtest_main",
- "@com_google_absl//absl/status",
- ],
- )
- cc_test(
- name = "status_macros_test",
- size = "small",
- srcs = ["status_macros_test.cc"],
- deps = [
- ":statusor_fork",
- "@com_github_google_googletest//:gtest_main",
- "@com_google_absl//absl/status",
- ],
- )
- # Montgomery integers.
- cc_library(
- name = "montgomery",
- srcs = ["montgomery.cc"],
- hdrs = ["montgomery.h"],
- deps = [
- ":bits_util",
- ":constants",
- ":int256",
- ":serialization_cc_proto",
- ":statusor_fork",
- ":transcription",
- "//prng",
- "@com_github_google_glog//:glog",
- "@com_google_absl//absl/numeric:int128",
- "@com_google_absl//absl/strings",
- ],
- )
- cc_test(
- name = "montgomery_test",
- size = "small",
- srcs = [
- "montgomery_test.cc",
- ],
- deps = [
- ":constants",
- ":montgomery",
- ":serialization_cc_proto",
- ":statusor_fork",
- "//testing:parameters",
- "//testing:status_is_fork",
- "//testing:status_testing",
- "//testing:testing_prng",
- "@com_github_google_googletest//:gtest_main",
- "@com_google_absl//absl/numeric:int128",
- ],
- )
- # NTT parameters.
- cc_library(
- name = "ntt_parameters",
- srcs = ["ntt_parameters.cc"],
- hdrs = ["ntt_parameters.h"],
- deps = [
- ":constants",
- ":statusor_fork",
- "@com_google_absl//absl/memory",
- "@com_google_absl//absl/strings",
- ],
- )
- cc_test(
- name = "ntt_parameters_test",
- size = "small",
- srcs = [
- "ntt_parameters_test.cc",
- ],
- deps = [
- ":constants",
- ":montgomery",
- ":ntt_parameters",
- ":statusor_fork",
- "//testing:parameters",
- "//testing:status_is_fork",
- "//testing:status_testing",
- "@com_github_google_googletest//:gtest_main",
- "@com_google_absl//absl/numeric:int128",
- ],
- )
- # NTT polynomial.
- cc_library(
- name = "polynomial",
- hdrs = ["polynomial.h"],
- deps = [
- ":constants",
- ":ntt_parameters",
- ":serialization_cc_proto",
- ":statusor_fork",
- "//prng",
- "@com_google_absl//absl/strings",
- ],
- )
- cc_test(
- name = "polynomial_test",
- size = "small",
- srcs = [
- "polynomial_test.cc",
- ],
- deps = [
- ":constants",
- ":montgomery",
- ":ntt_parameters",
- ":polynomial",
- ":serialization_cc_proto",
- ":statusor_fork",
- "//prng:integral_prng_testing_types",
- "//testing:coefficient_polynomial",
- "//testing:status_is_fork",
- "//testing:status_testing",
- "//testing:testing_prng",
- "@com_github_google_googletest//:gtest_main",
- ],
- )
- # Error parameters.
- cc_library(
- name = "error_params",
- hdrs = ["error_params.h"],
- deps = [
- ":montgomery",
- ":ntt_parameters",
- ":statusor_fork",
- ],
- )
- cc_test(
- name = "error_params_test",
- size = "small",
- srcs = [
- "error_params_test.cc",
- ],
- deps = [
- ":constants",
- ":context",
- ":error_params",
- ":montgomery",
- ":ntt_parameters",
- ":statusor_fork",
- ":symmetric_encryption",
- "//prng:integral_prng_types",
- "//testing:parameters",
- "//testing:status_is_fork",
- "//testing:status_testing",
- "//testing:testing_prng",
- "//testing:testing_utils",
- "@com_github_google_googletest//:gtest_main",
- ],
- )
- # Encryption.
- cc_library(
- name = "symmetric_encryption",
- hdrs = ["symmetric_encryption.h"],
- deps = [
- ":error_params",
- ":polynomial",
- ":sample_error",
- ":serialization_cc_proto",
- ":statusor_fork",
- "//prng",
- "//prng:integral_prng_types",
- ],
- )
- cc_test(
- name = "symmetric_encryption_test",
- size = "medium",
- srcs = [
- "symmetric_encryption_test.cc",
- ],
- deps = [
- ":constants",
- ":context",
- ":montgomery",
- ":ntt_parameters",
- ":polynomial",
- ":serialization_cc_proto",
- ":statusor_fork",
- ":symmetric_encryption",
- "//prng:integral_prng_types",
- "//testing:parameters",
- "//testing:status_is_fork",
- "//testing:status_testing",
- "//testing:testing_prng",
- "//testing:testing_utils",
- "@com_github_google_googletest//:gtest_main",
- ],
- )
- cc_library(
- name = "symmetric_encryption_with_prng",
- hdrs = ["symmetric_encryption_with_prng.h"],
- deps = [
- ":polynomial",
- ":statusor_fork",
- ":symmetric_encryption",
- "//prng",
- "//prng:integral_prng_types",
- ],
- )
- cc_test(
- name = "symmetric_encryption_with_prng_test",
- size = "small",
- srcs = [
- "symmetric_encryption_with_prng_test.cc",
- ],
- deps = [
- ":context",
- ":montgomery",
- ":ntt_parameters",
- ":polynomial",
- ":statusor_fork",
- ":symmetric_encryption_with_prng",
- "//prng:integral_prng_types",
- "//testing:parameters",
- "//testing:status_is_fork",
- "//testing:status_testing",
- "//testing:testing_utils",
- "@com_github_google_googletest//:gtest_main",
- ],
- )
- # Relinearization Key
- cc_library(
- name = "relinearization_key",
- srcs = ["relinearization_key.cc"],
- hdrs = ["relinearization_key.h"],
- deps = [
- ":bits_util",
- ":montgomery",
- ":sample_error",
- ":statusor_fork",
- ":symmetric_encryption",
- ":symmetric_encryption_with_prng",
- "//prng:integral_prng_types",
- "@com_google_absl//absl/numeric:int128",
- ],
- )
- cc_test(
- name = "relinearization_key_test",
- size = "small",
- srcs = ["relinearization_key_test.cc"],
- deps = [
- ":constants",
- ":montgomery",
- ":ntt_parameters",
- ":polynomial",
- ":relinearization_key",
- ":statusor_fork",
- ":symmetric_encryption",
- "//prng:integral_prng_types",
- "//testing:status_is_fork",
- "//testing:status_testing",
- "//testing:testing_prng",
- "@com_github_google_googletest//:gtest_main",
- ],
- )
- # Galois Key.
- cc_library(
- name = "galois_key",
- hdrs = ["galois_key.h"],
- deps = [
- ":relinearization_key",
- ":statusor_fork",
- "@com_google_absl//absl/strings",
- ],
- )
- cc_test(
- name = "galois_key_test",
- size = "small",
- srcs = ["galois_key_test.cc"],
- deps = [
- ":constants",
- ":galois_key",
- ":montgomery",
- ":ntt_parameters",
- ":polynomial",
- ":statusor_fork",
- ":symmetric_encryption",
- "//prng:integral_prng_types",
- "//testing:status_is_fork",
- "//testing:status_testing",
- "//testing:testing_prng",
- "//testing:testing_utils",
- "@com_github_google_googletest//:gtest_main",
- ],
- )
- # int256 Type
- cc_library(
- name = "int256",
- srcs = ["int256.cc"],
- hdrs = ["int256.h"],
- deps = [
- ":integral_types",
- "@com_github_google_glog//:glog",
- "@com_google_absl//absl/numeric:int128",
- ],
- )
- cc_test(
- name = "int256_test",
- size = "small",
- srcs = ["int256_test.cc"],
- deps = [
- ":int256",
- "@com_github_google_glog//:glog",
- "@com_github_google_googletest//:gtest_main",
- "@com_google_absl//absl/container:fixed_array",
- "@com_google_absl//absl/numeric:int128",
- ],
- )
- # Transcription
- cc_library(
- name = "transcription",
- hdrs = ["transcription.h"],
- deps = [
- ":statusor_fork",
- "@com_google_absl//absl/status",
- "@com_google_absl//absl/strings",
- ],
- )
- cc_test(
- name = "transcription_test",
- size = "small",
- srcs = ["transcription_test.cc"],
- deps = [
- ":integral_types",
- ":statusor_fork",
- ":transcription",
- "//testing:status_is_fork",
- "//testing:status_testing",
- "@com_github_google_googletest//:gtest_main",
- "@com_google_absl//absl/numeric:int128",
- ],
- )
|