From ac5b003a92aa2f1fdcf7cf017e2cbe76a63324a9 Mon Sep 17 00:00:00 2001 From: Phi Hung Le Date: Wed, 20 Mar 2024 18:20:47 +0000 Subject: [PATCH] Address comments. --- src/main/cc/crypto/shuffle.cc | 4 ++-- src/main/cc/crypto/shuffle.h | 4 ++-- src/main/cc/frequency_count/BUILD.bazel | 2 +- .../secret_share_generator_adapter.cc | 2 +- src/main/proto/wfa/frequency_count/BUILD.bazel | 16 ++++++++-------- ...uffle_sketch.proto => frequency_vector.proto} | 5 ++--- ..._methods.proto => secret_share_methods.proto} | 2 +- src/test/cc/crypto/shuffle_test.cc | 2 +- src/test/cc/frequency_count/BUILD.bazel | 2 +- .../secret_share_generator_adapter_test.cc | 2 +- 10 files changed, 20 insertions(+), 21 deletions(-) rename src/main/proto/wfa/frequency_count/{share_shuffle_sketch.proto => frequency_vector.proto} (87%) rename src/main/proto/wfa/frequency_count/{share_shuffle_methods.proto => secret_share_methods.proto} (94%) diff --git a/src/main/cc/crypto/shuffle.cc b/src/main/cc/crypto/shuffle.cc index 3e7f9cd..852f113 100644 --- a/src/main/cc/crypto/shuffle.cc +++ b/src/main/cc/crypto/shuffle.cc @@ -20,7 +20,7 @@ #include "common_cpp/macros/macros.h" #include "math/open_ssl_uniform_random_generator.h" -namespace wfa::measurement::common::crypto { +namespace wfa::crypto { absl::Status SecureShuffleWithSeed(std::vector& data, const frequency_count::PrngSeed& seed) { @@ -61,4 +61,4 @@ absl::Status SecureShuffleWithSeed(std::vector& data, return absl::OkStatus(); } -} // namespace wfa::measurement::common::crypto +} // namespace wfa::crypto diff --git a/src/main/cc/crypto/shuffle.h b/src/main/cc/crypto/shuffle.h index 4d77d9c..f7c40ea 100644 --- a/src/main/cc/crypto/shuffle.h +++ b/src/main/cc/crypto/shuffle.h @@ -22,7 +22,7 @@ #include "absl/status/status.h" #include "wfa/frequency_count/secret_share.pb.h" -namespace wfa::measurement::common::crypto { +namespace wfa::crypto { // Shuffles the vector data using Fisher-Yates approach. Let n be the size of // data, the Fisher-Yates shuffle is as below. @@ -32,6 +32,6 @@ namespace wfa::measurement::common::crypto { absl::Status SecureShuffleWithSeed(std::vector& data, const frequency_count::PrngSeed& seed); -} // namespace wfa::measurement::common::crypto +} // namespace wfa::crypto #endif // SRC_MAIN_CC_CRYPTO_SHUFFLE_H_ diff --git a/src/main/cc/frequency_count/BUILD.bazel b/src/main/cc/frequency_count/BUILD.bazel index a9735d6..fc4840e 100644 --- a/src/main/cc/frequency_count/BUILD.bazel +++ b/src/main/cc/frequency_count/BUILD.bazel @@ -22,6 +22,6 @@ cc_library( deps = [ ":secret_share_generator", "//src/main/proto/wfa/frequency_count:secret_share_cc_proto", - "//src/main/proto/wfa/frequency_count:share_shuffle_methods_cc_proto", + "//src/main/proto/wfa/frequency_count:secret_share_methods_cc_proto", ], ) diff --git a/src/main/cc/frequency_count/secret_share_generator_adapter.cc b/src/main/cc/frequency_count/secret_share_generator_adapter.cc index 94626c9..9dea06b 100644 --- a/src/main/cc/frequency_count/secret_share_generator_adapter.cc +++ b/src/main/cc/frequency_count/secret_share_generator_adapter.cc @@ -23,7 +23,7 @@ #include "common_cpp/macros/macros.h" #include "frequency_count/secret_share_generator.h" #include "wfa/frequency_count/secret_share.pb.h" -#include "wfa/frequency_count/share_shuffle_methods.pb.h" +#include "wfa/frequency_count/secret_share_methods.pb.h" namespace wfa::frequency_count { diff --git a/src/main/proto/wfa/frequency_count/BUILD.bazel b/src/main/proto/wfa/frequency_count/BUILD.bazel index bdab576..acb74c9 100644 --- a/src/main/proto/wfa/frequency_count/BUILD.bazel +++ b/src/main/proto/wfa/frequency_count/BUILD.bazel @@ -17,19 +17,19 @@ cc_proto_library( ) proto_library( - name = "share_shuffle_sketch_proto", - srcs = ["share_shuffle_sketch.proto"], + name = "frequency_vector_proto", + srcs = ["frequency_vector.proto"], strip_import_prefix = IMPORT_PREFIX, ) cc_proto_library( - name = "share_shuffle_sketch_cc_proto", - deps = [":share_shuffle_sketch_proto"], + name = "frequency_vector_cc_proto", + deps = [":frequency_vector_proto"], ) proto_library( - name = "share_shuffle_methods_proto", - srcs = ["share_shuffle_methods.proto"], + name = "secret_share_methods_proto", + srcs = ["secret_share_methods.proto"], strip_import_prefix = IMPORT_PREFIX, deps = [ ":secret_share_proto", @@ -37,6 +37,6 @@ proto_library( ) cc_proto_library( - name = "share_shuffle_methods_cc_proto", - deps = [":share_shuffle_methods_proto"], + name = "secret_share_methods_cc_proto", + deps = [":secret_share_methods_proto"], ) diff --git a/src/main/proto/wfa/frequency_count/share_shuffle_sketch.proto b/src/main/proto/wfa/frequency_count/frequency_vector.proto similarity index 87% rename from src/main/proto/wfa/frequency_count/share_shuffle_sketch.proto rename to src/main/proto/wfa/frequency_count/frequency_vector.proto index 31c70a9..07c6c23 100644 --- a/src/main/proto/wfa/frequency_count/share_shuffle_sketch.proto +++ b/src/main/proto/wfa/frequency_count/frequency_vector.proto @@ -22,10 +22,9 @@ package wfa.frequency_count; option java_package = "org.wfanet.frequencycount"; option java_multiple_files = true; -option java_outer_classname = "ShareShuffleSketchProto"; +option java_outer_classname = "FrequencyVectorProto"; -// The data share of HonestMajorityShareShuffle protocol. -message ShareShuffleSketch { +message FrequencyVector { // A vector of count where each count corresponds to the frequency of a single // VID. repeated uint32 data = 1; diff --git a/src/main/proto/wfa/frequency_count/share_shuffle_methods.proto b/src/main/proto/wfa/frequency_count/secret_share_methods.proto similarity index 94% rename from src/main/proto/wfa/frequency_count/share_shuffle_methods.proto rename to src/main/proto/wfa/frequency_count/secret_share_methods.proto index dc53aa3..1f27433 100644 --- a/src/main/proto/wfa/frequency_count/share_shuffle_methods.proto +++ b/src/main/proto/wfa/frequency_count/secret_share_methods.proto @@ -21,7 +21,7 @@ import "wfa/frequency_count/secret_share.proto"; option java_package = "org.wfanet.frequencycount"; option java_multiple_files = true; -// The request to encrypt a sketch. +// The request to secret share a frequency vector. message SecretShareGeneratorRequest { uint32 ring_modulus = 1; // The input frequency vector diff --git a/src/test/cc/crypto/shuffle_test.cc b/src/test/cc/crypto/shuffle_test.cc index 4c7501d..8790f9c 100644 --- a/src/test/cc/crypto/shuffle_test.cc +++ b/src/test/cc/crypto/shuffle_test.cc @@ -25,8 +25,8 @@ namespace wfa::crypto { namespace { using frequency_count::PrngSeed; -using measurement::common::crypto::SecureShuffleWithSeed; using ::wfa::StatusIs; +using ::wfa::crypto::SecureShuffleWithSeed; using ::wfa::math::kBytesPerAes256Iv; using ::wfa::math::kBytesPerAes256Key; diff --git a/src/test/cc/frequency_count/BUILD.bazel b/src/test/cc/frequency_count/BUILD.bazel index f64c1f6..e5080f2 100644 --- a/src/test/cc/frequency_count/BUILD.bazel +++ b/src/test/cc/frequency_count/BUILD.bazel @@ -22,7 +22,7 @@ cc_test( "//src/main/cc/frequency_count:secret_share_generator_adapter", "//src/main/cc/math:open_ssl_uniform_random_generator", "//src/main/proto/wfa/frequency_count:secret_share_cc_proto", - "//src/main/proto/wfa/frequency_count:share_shuffle_methods_cc_proto", + "//src/main/proto/wfa/frequency_count:secret_share_methods_cc_proto", "@com_google_googletest//:gtest", "@com_google_googletest//:gtest_main", "@wfa_common_cpp//src/main/cc/common_cpp/testing:status", diff --git a/src/test/cc/frequency_count/secret_share_generator_adapter_test.cc b/src/test/cc/frequency_count/secret_share_generator_adapter_test.cc index 43a9e23..32ebfc2 100644 --- a/src/test/cc/frequency_count/secret_share_generator_adapter_test.cc +++ b/src/test/cc/frequency_count/secret_share_generator_adapter_test.cc @@ -21,7 +21,7 @@ #include "frequency_count/secret_share_generator.h" #include "gtest/gtest.h" #include "math/open_ssl_uniform_random_generator.h" -#include "wfa/frequency_count/share_shuffle_methods.pb.h" +#include "wfa/frequency_count/secret_share_methods.pb.h" namespace wfa::frequency_count { namespace {