Exemple #1
0
bool AbstractStage::needsToProcess() const
{
    std::set<AbstractInputSlot*> inputs = allInputs();

    return m_alwaysProcess || m_processScheduled || inputs.empty() || std::any_of(inputs.begin(), inputs.end(), [](const AbstractInputSlot * input) {
        return input->hasChanged();
    });
}
Exemple #2
0
bool AbstractStage::inputsUsable() const
{
    if (m_usable.isValid())
        return m_usable.value();

    std::set<AbstractInputSlot*> inputs = allInputs();
    m_usable.setValue(std::all_of(inputs.begin(), inputs.end(), [](const AbstractInputSlot * input) {
        return input->isUsable();
    }));

    if (!m_usable.value())
    {
        std::cout << "Some inputs in " << asPrintable() << " are not be connected: ";
        for (AbstractInputSlot * slot : inputs)
            if (!slot->isUsable())
                std::cout << slot->asPrintable() << ". ";
        std::cout << std::endl;
    }

    return m_usable.value();
}
Exemple #3
0
byte* PartyTwo::computeCircuit(OTBatchROutput * otOutput) {
	// Get the output of the protocol.
	vector<byte> p2Inputs = ((OTOnByteArrayROutput *)otOutput)->getXSigma();
	int p2InputsSize = ((OTOnByteArrayROutput *)otOutput)->getLength();
	// Get party two input wires' indices.
	//int* labels = NULL;
	//labels = circuit->getInputWireIndices(2);
	vector<byte> allInputs(p1InputsSize + p2InputsSize);
	memcpy(&allInputs[0], p1Inputs, p1InputsSize);
	memcpy(&allInputs[p1InputsSize], p2Inputs.data(), p2InputsSize);
	
	// set the input to the circuit.
	//circuit->setInputs(allInputs);
	
	// compute the circuit.
	block* garbledOutput = (block *)_aligned_malloc(sizeof(block) * 2 * circuit->getNumberOfOutputs(), SIZE_OF_BLOCK); ;
	circuit->compute((block *)&allInputs[0], garbledOutput);

	// translate the result from compute.
	byte* circuitOutput = new byte[circuit->getNumberOfOutputs()];
	circuit->translate(garbledOutput, circuitOutput);

	return circuitOutput;
}