-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
324 mac check spdz #343
Merged
Merged
324 mac check spdz #343
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
a05c828
Do coin tossing in SPDZ mac check
n1v0lg aff65f4
Moving generic broadcast etc into core
n1v0lg 6d78043
Fix seed length
n1v0lg 0129537
Compatible maliciousmaccheck
n1v0lg 6522466
SPDZ res. pool now supplies drbgs
n1v0lg 6023277
Move broadcast test to core
n1v0lg fa0f98a
Move commitment test
n1v0lg 6b16c16
Add drbg seed length to resource pool
n1v0lg 0afa163
Malicious commitment tests
n1v0lg d487c9a
Test all parties cheating during commitment
n1v0lg 15190f6
Plug generic commitment comp into spdz mac check
n1v0lg 9bde357
Remove deprecated spdz commitment functionality
n1v0lg 7ff4203
Clean up spdz mac check
n1v0lg 2d2544c
Update malicious spdz mac check in tests
n1v0lg 60d97e0
Kill unused malicious test classes
n1v0lg ae1fab1
Test for tampering with delta
n1v0lg 0cedc1e
Test coin tossing
n1v0lg 1ae7151
Test default constructor for coin tossing
n1v0lg 156fa7b
Merge branch 'master' into 324-mac-check-spdz
n1v0lg 532f83e
Broadcast code coverage
n1v0lg a5553b4
Remove unused method in spdz native prot.
n1v0lg b1576bd
Kill unused SpdzCommitment
n1v0lg 5f9eb04
Addressing review comments
n1v0lg 626fbfc
Remove unused noOfParties
n1v0lg 13ba572
Fix line alignment in spdz mac check
n1v0lg f146673
Kill validMOD_P
n1v0lg e2c8cf9
Document broadcast computation
n1v0lg 5cf79a1
Nit
n1v0lg File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
74 changes: 74 additions & 0 deletions
74
core/src/main/java/dk/alexandra/fresco/lib/generic/BroadcastComputation.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
package dk.alexandra.fresco.lib.generic; | ||
|
||
import dk.alexandra.fresco.framework.DRes; | ||
import dk.alexandra.fresco.framework.builder.Computation; | ||
import dk.alexandra.fresco.framework.builder.ProtocolBuilderImpl; | ||
import java.util.ArrayList; | ||
import java.util.Collections; | ||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
/** | ||
* Generic active broadcast validation computation. | ||
* | ||
* <p>Allows each party to securely broadcast a list of messages and receive the other parties' | ||
* messages.</p> | ||
* | ||
* <p>Uses generic native protocols {@link InsecureBroadcastProtocol} and {@link | ||
* BroadcastValidationProtocol}.</p> | ||
*/ | ||
public class BroadcastComputation<BuilderT extends ProtocolBuilderImpl<BuilderT>> implements | ||
Computation<List<byte[]>, BuilderT> { | ||
|
||
private final List<byte[]> input; | ||
private final boolean runValidation; | ||
|
||
/** | ||
* Creates new {@link BroadcastComputation}. | ||
* | ||
* @param input list of messages this party will broadcast | ||
* @param runValidation indicates if messages received from other parties need to be validated for | ||
* consistency (this can be false for instance when there are only two parties participating in | ||
* the broadcast) | ||
*/ | ||
public BroadcastComputation(List<byte[]> input, boolean runValidation) { | ||
this.input = input; | ||
this.runValidation = runValidation; | ||
} | ||
|
||
/** | ||
* Default constructor to {@link #BroadcastComputation(List, boolean)} for when a party only | ||
* broadcasts a single message. | ||
*/ | ||
public BroadcastComputation(byte[] input, boolean runValidation) { | ||
this(Collections.singletonList(input), runValidation); | ||
} | ||
|
||
/** | ||
* Default constructor to {@link #BroadcastComputation(byte[], boolean)} for when a party only | ||
* broadcasts a single message and validation is required. | ||
*/ | ||
public BroadcastComputation(byte[] input) { | ||
this(input, true); | ||
} | ||
|
||
@Override | ||
public DRes<List<byte[]>> buildComputation(BuilderT builder) { | ||
return builder.par(par -> { | ||
List<DRes<List<byte[]>>> broadcastValues = new ArrayList<>(); | ||
for (byte[] singleInput : input) { | ||
broadcastValues.add(par.append(new InsecureBroadcastProtocol<>(singleInput))); | ||
} | ||
return () -> broadcastValues; | ||
}).seq((seq, lst) -> { | ||
List<byte[]> toValidate = lst.stream() | ||
.flatMap(broadcast -> broadcast.out().stream()) | ||
.collect(Collectors.toList()); | ||
if (runValidation) { | ||
seq.append(new BroadcastValidationProtocol<>(toValidate)); | ||
} | ||
return () -> toValidate; | ||
}); | ||
} | ||
|
||
} |
5 changes: 2 additions & 3 deletions
5
.../natives/BroadcastValidationProtocol.java → .../generic/BroadcastValidationProtocol.java
This file contains 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
This file contains 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
41 changes: 29 additions & 12 deletions
41
...utations/Spdz2kCommitmentComputation.java → ...co/lib/generic/CommitmentComputation.java
This file contains 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
This file contains 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
2 changes: 1 addition & 1 deletion
2
.../spdz2k/resource/SecureBroadcastUtil.java → ...esco/lib/generic/SecureBroadcastUtil.java
This file contains 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
This file contains 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
11 changes: 11 additions & 0 deletions
11
core/src/test/java/dk/alexandra/fresco/lib/generic/BroadcastValidationProtocolTest.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package dk.alexandra.fresco.lib.generic; | ||
|
||
import org.junit.Test; | ||
|
||
public class BroadcastValidationProtocolTest { | ||
|
||
@Test(expected = IllegalStateException.class) | ||
public void testOutThrows() { | ||
new BroadcastValidationProtocol(new byte[1]).out(); | ||
} | ||
} |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is reasonable to document this class and the constructor - especially when it it resonable to use one or the other