/** * Returns the receiver object for the protocol. * * @return Returns the receiver object for the protocol */ public CoteReceiver getReceiver() { if (receiver == null) { this.receiver = new CoteReceiver(resources, network); } return receiver; } }
IntStream.range(0, resources.getComputationalSecurityParameter()).parallel() .forEach(i -> ulist.get(i).xor(tlistZero.get(i))); sendList(ulist); return Transpose.transpose(tlistZero);
/** * Constructs a correlated OT extension with errors receiver instance. * * @param resources * The common resource pool needed for OT extension * @param network * The network object used to communicate with the other party */ public CoteReceiver(OtExtensionResourcePool resources, Network network) { super(resources.getInstanceId()); this.prgs = new ArrayList<>(resources.getComputationalSecurityParameter()); for (Pair<StrictBitVector, StrictBitVector> pair : resources.getSeedOts() .getSentMessages()) { Drbg prgZero = initPrg(pair.getFirst()); Drbg prgOne = initPrg(pair.getSecond()); prgs.add(new Pair<>(prgZero, prgOne)); } this.resources = resources; this.network = network; }
@Override public List<StrictBitVector> extend(StrictBitVector choices) { // The underlying scheme requires computational security parameter plus lambda security // parameter extra OTs int minOts = choices.getSize() + resources.getComputationalSecurityParameter() + resources .getLambdaSecurityParam(); // Round up to nearest two-power, which is required by the underlying scheme int ellPrime = (int) Math.pow(2, Math.ceil(Math.log(minOts) / Math.log(2))); // Extend the choices with random choices for padding StrictBitVector paddingChoices = new StrictBitVector(ellPrime - choices.getSize(), resources .getRandomGenerator()); StrictBitVector extendedChoices = StrictBitVector.concat(choices, paddingChoices); // Use the choices along with the random padding uses for correlated OT with // errors List<StrictBitVector> tlist = receiver.extend(extendedChoices); // Agree on challenges for linear combination test List<StrictBitVector> chiList = getChallenges(ellPrime); StrictBitVector xvec = computeBitLinearCombination(extendedChoices, chiList); network.send(resources.getOtherId(), xvec.toByteArray()); StrictBitVector tvec = computeInnerProduct(chiList, tlist); network.send(resources.getOtherId(), tvec.toByteArray()); // Remove the correlation of the OTs by hashing List<StrictBitVector> vvec = hashBitVector(tlist, choices.getSize()); return vvec; }
public RotReceiver createReceiver() { CoteReceiver receiver = new CoteReceiver(resources, network); return new RotReceiverImpl(receiver, resources, network); } }