@Override public SpdzTriple getNextTriple() { ensureInitialized(); if (triples.isEmpty()) { logger.trace("Getting another triple batch"); triples.addAll(mascot.getTriples(batchSize)); logger.trace("Got another triple batch"); } MultiplicationTriple triple = triples.pop(); return MascotFormatConverter.toSpdzTriple(triple); }
@Test public void testFirstTriples() throws Exception { List<Map<Integer, RotList>> seedOts = setupOts(); Map<Integer, FieldElement> perPartyMacKeyShares = setupMacKeyShares(); List<Callable<List<MultiplicationTriple>>> mascotCreators = new ArrayList<>(); for (int i = 0; i < iterations; i++) { @SuppressWarnings("resource") NetManager normalManager = new NetManager(ports); for (int myId = 1; myId <= noOfParties; myId++) { int finalMyId = myId; int finalInstanceId = i; FieldElement randomSsk = perPartyMacKeyShares.get(finalMyId); Map<Integer, RotList> seedOt = seedOts.get(finalMyId - 1); mascotCreators.add(() -> { Mascot mascot = new Mascot( new MascotResourcePoolImpl(finalMyId, noOfParties, finalInstanceId, getDrbg(), seedOt, mascotSecurityParameters, definition), normalManager.createExtraNetwork(finalMyId), randomSsk); return mascot.getTriples(16); }); } } invoke(mascotCreators); }