Restrict YClient visibility to prevent queries without key generation#11
Open
p0mvn wants to merge 1 commit intomenonsamir:artifactfrom
Open
Restrict YClient visibility to prevent queries without key generation#11p0mvn wants to merge 1 commit intomenonsamir:artifactfrom
p0mvn wants to merge 1 commit intomenonsamir:artifactfrom
Conversation
YClient methods were publicly exported, allowing callers to generate queries without first calling generate_secret_keys(). This tightens visibility so external consumers must use YPIRClient, which handles key generation internally. - Make most YClient methods private (fn); keep new() and generate_query_impl() as pub(crate) for server.rs - Refactor scheme.rs to use YPIRClient seed-based API instead of constructing YClient directly - Add decode_response_simplepir_raw() returning Vec<u64> for internal benchmarks - Move noise test into client.rs where it has private access - Make decode_response_*_yclient helpers private Made-with: Cursor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
YClientmethods werepub, allowing external callers to generate queries without first callinggenerate_secret_keys(). Not regenerating keys for each query could expose an attack that is closed by this PR.YPIRClient, which handles key generation internally viagenerate_secret_keys_from_seed(). AllYClientmethods are now eitherfn(private) orpub(crate)(the minimum two thatserver.rsneeds due to Rust lifetime constraints onPolyMatrixRaw<'a>).scheme.rsbenchmarks now useYPIRClient's seed-based API (generate_query_normal/generate_query_simplepir+decode_response_normal/decode_response_simplepir_raw) instead of directly constructingYClient.test_linear_accumulation_noiserelocated fromnoise_analysis.rstoclient.rstest module where it has private access toYClient.Changes
src/client.rsYClient::new—pub→pub(crate)(server.rs needs it)YClient::generate_query_impl—pub→pub(crate)(server.rs needs it)YClient::from_seed,lwe_client,client,generate_query,generate_query_lwe_low_mem,generate_full_query,generate_full_query_simplepir,decode_response—pub→fn(private)decode_response_normal_yclient,decode_response_simplepir_yclient—pub→fn(private, wrapped by publicYPIRClientmethods)YPIRClient::decode_response_simplepir_raw()— returnsVec<u64>for internal benchmarkstest_linear_accumulation_noiseto test module (moved from noise_analysis)src/scheme.rsrun_simple_ypir_on_params: usesYPIRClient::generate_query_simplepir+decode_response_simplepir_rawinstead ofYClientdirectlyrun_ypir_on_params: usesYPIRClient::generate_query_normal+decode_response_normalinstead ofYClientdirectlySeedin query tuples instead ofYClientreferencesspiral_rs::client::*importsrc/noise_analysis.rstest_linear_accumulation_noise(moved toclient.rs)YClient,decrypt_ct_reg_measured,constants::*,barrett_reduction_u128)