From 37635403fe583184b99673ed193c40c50ea1867f Mon Sep 17 00:00:00 2001 From: Erik Taubeneck Date: Fri, 11 Oct 2024 10:43:53 -0700 Subject: [PATCH 1/2] add test to show that IPA fails for cap 1, 2, 3, and 4 --- ipa-core/tests/compact_gate.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/ipa-core/tests/compact_gate.rs b/ipa-core/tests/compact_gate.rs index 5cc83beaf..7e31c626e 100644 --- a/ipa-core/tests/compact_gate.rs +++ b/ipa-core/tests/compact_gate.rs @@ -31,6 +31,26 @@ fn compact_gate_cap_8_no_window_semi_honest_encryped_input() { test_compact_gate(IpaSecurityModel::SemiHonest, 8, 0, true); } +#[test] +fn compact_gate_cap_1_no_window_semi_honest_encryped_input() { + test_compact_gate(IpaSecurityModel::SemiHonest, 1, 0, true); +} + +#[test] +fn compact_gate_cap_2_no_window_semi_honest_encryped_input() { + test_compact_gate(IpaSecurityModel::SemiHonest, 2, 0, true); +} + +#[test] +fn compact_gate_cap_3_no_window_semi_honest_encryped_input() { + test_compact_gate(IpaSecurityModel::SemiHonest, 3, 0, true); +} + +#[test] +fn compact_gate_cap_4_no_window_semi_honest_encryped_input() { + test_compact_gate(IpaSecurityModel::SemiHonest, 4, 0, true); +} + #[test] fn compact_gate_cap_8_no_window_semi_honest_plaintext_input() { test_compact_gate(IpaSecurityModel::SemiHonest, 8, 0, false); From 6283343c6bd7aa0890bd3d65b21ba0da23ade658 Mon Sep 17 00:00:00 2001 From: Alex Koshelev Date: Fri, 11 Oct 2024 12:04:19 -0700 Subject: [PATCH 2/2] Make it work for cap 1, 2 and 4. It is still gross that we use 3 bit trigger values for everything, but oh well... --- ipa-core/src/query/runner/oprf_ipa.rs | 4 +++- ipa-core/tests/compact_gate.rs | 5 ----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/ipa-core/src/query/runner/oprf_ipa.rs b/ipa-core/src/query/runner/oprf_ipa.rs index fa8b787d8..27d2c7938 100644 --- a/ipa-core/src/query/runner/oprf_ipa.rs +++ b/ipa-core/src/query/runner/oprf_ipa.rs @@ -147,13 +147,15 @@ where #[cfg(not(feature = "relaxed-dp"))] let padding_params = PaddingParameters::default(); match config.per_user_credit_cap { + 1 => oprf_ipa::<_, BA8, BA3, HV, BA20, 1, 256>(ctx, input, aws, dp_params, padding_params).await, + 2 | 4 => oprf_ipa::<_, BA8, BA3, HV, BA20, 2, 256>(ctx, input, aws, dp_params, padding_params).await, 8 => oprf_ipa::<_, BA8, BA3, HV, BA20, 3, 256>(ctx, input, aws, dp_params, padding_params).await, 16 => oprf_ipa::<_, BA8, BA3, HV, BA20, 4, 256>(ctx, input, aws, dp_params, padding_params).await, 32 => oprf_ipa::<_, BA8, BA3, HV, BA20, 5, 256>(ctx, input, aws, dp_params, padding_params).await, 64 => oprf_ipa::<_, BA8, BA3, HV, BA20, 6, 256>(ctx, input, aws, dp_params, padding_params).await, 128 => oprf_ipa::<_, BA8, BA3, HV, BA20, 7, 256>(ctx, input, aws, dp_params, padding_params).await, _ => panic!( - "Invalid value specified for per-user cap: {:?}. Must be one of 8, 16, 32, 64, or 128.", + "Invalid value specified for per-user cap: {:?}. Must be one of 1, 2, 4, 8, 16, 32, 64, or 128.", config.per_user_credit_cap ), } diff --git a/ipa-core/tests/compact_gate.rs b/ipa-core/tests/compact_gate.rs index 7e31c626e..354ad438c 100644 --- a/ipa-core/tests/compact_gate.rs +++ b/ipa-core/tests/compact_gate.rs @@ -41,11 +41,6 @@ fn compact_gate_cap_2_no_window_semi_honest_encryped_input() { test_compact_gate(IpaSecurityModel::SemiHonest, 2, 0, true); } -#[test] -fn compact_gate_cap_3_no_window_semi_honest_encryped_input() { - test_compact_gate(IpaSecurityModel::SemiHonest, 3, 0, true); -} - #[test] fn compact_gate_cap_4_no_window_semi_honest_encryped_input() { test_compact_gate(IpaSecurityModel::SemiHonest, 4, 0, true);