Пример #1
0
void NNOBOTExtSnd::ComputeBaseOTs(field_type ftype) {
	if(m_bDoBaseOTs) {
		m_cBaseOT = new SimpleOT(m_cCrypt, ftype);
		ComputePKBaseOTs();
		delete m_cBaseOT;
	} else {
		//recursive call
	}
}
Пример #2
0
void ALSZOTExtRec::ComputeBaseOTs(field_type ftype) {
	/*m_cBaseOT = new SimpleOT(m_cCrypt, ftype);
	ComputePKBaseOTs();
	delete m_cBaseOT;*/
	uint32_t nsndvals = 2;

	if(m_bDoBaseOTs) { //use public-key crypto routines (simple OT)
		m_cBaseOT = new SimpleOT(m_cCrypt, ftype);
		ComputePKBaseOTs();
		delete m_cBaseOT;

		/*base_ots_snd_t* tmp = (base_ots_snd_t*) malloc(sizeof(base_ots_snd_t));
		tmp->base_ot_key_ptr = (AES_KEY_CTX*) malloc(sizeof(AES_KEY_CTX) * m_nBaseOTs * nsndvals);
		memcpy(tmp->base_ot_key_ptr, m_vBaseOTKeys, sizeof(AES_KEY_CTX) * m_nBaseOTs * nsndvals);
		m_tBaseOTQ.push_back(tmp);*/
	} else {
		ALSZOTExtSnd* snd = new ALSZOTExtSnd(m_cCrypt, m_cRcvThread, m_cSndThread, m_nBaseOTs, m_nChecks);
		uint32_t numots = buffer_ot_keys * m_nBaseOTs;
		XORMasking* m_fMaskFct = new XORMasking(m_cCrypt->get_seclvl().symbits);
		CBitVector** X = (CBitVector**) malloc(sizeof(CBitVector*) * nsndvals);//new CBitVector[nsndvals];
		uint32_t secparambytes = bits_in_bytes(m_cCrypt->get_seclvl().symbits);
		uint8_t* buf;

		for(uint32_t i = 0; i < nsndvals; i++) {
			X[i] = new CBitVector();
			X[i]->Create(numots * m_cCrypt->get_seclvl().symbits);
		}
		//X1.Create(numots * m_cCrypt->get_seclvl().symbits);

		snd->computePKBaseOTs();
		snd->ComputeBaseOTs(ftype);

		snd->send(numots, m_cCrypt->get_seclvl().symbits, nsndvals, X, Snd_R_OT, Rec_R_OT, 1, m_fMaskFct);

		//assign keys to base OT queue
		buf = (uint8_t*) malloc(secparambytes * nsndvals * m_nBaseOTs);

		OT_AES_KEY_CTX* tmp_keys;
		for(uint32_t i = 0; i < buffer_ot_keys; i++) {
			//base_ots_snd_t* tmp = (base_ots_snd_t*) malloc(sizeof(base_ots_snd_t));
			tmp_keys = (OT_AES_KEY_CTX*) malloc(sizeof(OT_AES_KEY_CTX) * m_nBaseOTs * nsndvals);
			/*for(uint32_t j = 0; j < m_nBaseOTs; j++) {
				memcpy(buf + j * nsndvals * secparambytes, X0.GetArr() + (i * m_nBaseOTs + j) * secparambytes, secparambytes);
				memcpy(buf + (j * nsndvals + 1) * secparambytes, X1.GetArr() + (i * m_nBaseOTs + j) * secparambytes, secparambytes);
			}*/
			memcpy(buf, X[0]->GetArr() + secparambytes * m_nBaseOTs * i, secparambytes * m_nBaseOTs);
			memcpy(buf + secparambytes * m_nBaseOTs, X[1]->GetArr() + secparambytes * m_nBaseOTs * i, secparambytes * m_nBaseOTs);
			InitAESKey(tmp_keys, buf, nsndvals * m_nBaseOTs, m_cCrypt);
			m_tBaseOTKeys.push_back(tmp_keys);
		}

		free(buf);
		for(uint32_t i = 0; i < nsndvals; i++) {
			delete X[i];
		}
		//free(X);
	//	X0.delCBitVector();
	//	X1.delCBitVector();
		delete m_fMaskFct;
		delete snd;
	}

}
Пример #3
0
void KKOTExtSnd::ComputeBaseOTs(field_type ftype) {
    m_cBaseOT = new NaorPinkas(m_cCrypt, ftype);
    ComputePKBaseOTs();
    m_nSndVals = 16; // TODO hack!
    delete m_cBaseOT;
}
Пример #4
0
void IKNPOTExtSnd::ComputeBaseOTs(field_type ftype) {
	m_cBaseOT = new NaorPinkas(m_cCrypt, ftype);
	ComputePKBaseOTs();
	delete m_cBaseOT;
}