Browse Source

dpf: don't require Copy of SinglePointDpfKey

Lennart Braun 2 years ago
parent
commit
aa6f8a9159
2 changed files with 5 additions and 5 deletions
  1. 4 4
      dpf/src/mpdpf.rs
  2. 1 1
      dpf/src/spdpf.rs

+ 4 - 4
dpf/src/mpdpf.rs

@@ -320,9 +320,9 @@ where
         let mut output = {
             let hash = hashes[0][0] as usize;
             assert!(key.spdpf_keys[hash].is_some());
-            let sp_key = &key.spdpf_keys[hash].unwrap();
+            let sp_key = key.spdpf_keys[hash].as_ref().unwrap();
             assert_eq!(simple_htable[hash][pos(hash, index) as usize], index);
-            SPDPF::evaluate_at(sp_key, pos(hash, index))
+            SPDPF::evaluate_at(&sp_key, pos(hash, index))
         };
 
         // prevent adding the same term multiple times when we have collisions
@@ -342,9 +342,9 @@ where
             }
             let hash = hashes[j][0] as usize;
             assert!(key.spdpf_keys[hash].is_some());
-            let sp_key = &key.spdpf_keys[hash].unwrap();
+            let sp_key = key.spdpf_keys[hash].as_ref().unwrap();
             assert_eq!(simple_htable[hash][pos(hash, index) as usize], index);
-            output += SPDPF::evaluate_at(sp_key, pos(hash, index));
+            output += SPDPF::evaluate_at(&sp_key, pos(hash, index));
         }
 
         output

+ 1 - 1
dpf/src/spdpf.rs

@@ -3,7 +3,7 @@ use core::marker::PhantomData;
 use core::ops::Add;
 use num::traits::Zero;
 
-pub trait SinglePointDpfKey: Copy + Debug {
+pub trait SinglePointDpfKey: Clone + Debug {
     fn get_party_id(&self) -> usize;
     fn get_log_domain_size(&self) -> u64;
 }