fix(gpu): fix oprf output degree

This commit is contained in:
Agnes Leroy
2025-09-27 21:29:23 +02:00
parent c5ad73865c
commit de6b829cf6
2 changed files with 22 additions and 0 deletions

View File

@@ -6028,6 +6028,8 @@ template <typename Torus> struct int_grouped_oprf_memory {
degree, params.message_modulus, params.carry_modulus,
params.glwe_dimension, params.polynomial_size, lut_f,
allocate_gpu_memory);
// In OPRF the degree is hard set to p - 1 instead of the LUT degree
degree = p - 1;
*luts->get_degree(lut_index) = degree;
}

View File

@@ -61,3 +61,23 @@ impl FheBool {
Self::new(ciphertext, tag, ReRandomizationMetadata::default())
}
}
#[cfg(test)]
#[cfg(feature = "gpu")]
mod test {
use crate::prelude::FheDecrypt;
use tfhe_csprng::seeders::Seed;
#[test]
fn test_oprf_boolean() {
let config = crate::ConfigBuilder::default().build();
let client_key = crate::ClientKey::generate(config);
let compressed_server_key = crate::CompressedServerKey::new(&client_key);
let gpu_key = compressed_server_key.decompress_to_gpu();
crate::set_server_key(gpu_key);
let rnd = crate::FheBool::generate_oblivious_pseudo_random(Seed(123u128));
let decrypted_result: bool = rnd.decrypt(&client_key);
println!("Random bool: {decrypted_result}");
}
}