mirror of
https://github.com/encryptogroup/PSI.git
synced 2024-03-22 13:30:44 +08:00
Second step for enabling pipelined AES
This commit is contained in:
parent
ac4d534b02
commit
8f59edce71
|
@ -660,7 +660,7 @@ void InitOTReceiver(uint8_t* keyMtx, CSocket sock, crypto* crypt)
|
|||
uint8_t* pBuf = (uint8_t*) malloc(crypt->get_hash_bytes() * numbaseOTs * 2);
|
||||
bot->Sender(2, numbaseOTs, sock, pBuf);
|
||||
|
||||
#ifdef AES256_HASH2
|
||||
#ifdef AES256_HASH
|
||||
//Key expansion
|
||||
uint8_t* pBufIdx = pBuf;
|
||||
for(uint32_t i=0; i<numbaseOTs; i++ )
|
||||
|
|
|
@ -205,12 +205,21 @@ void OTExtension1ooNECCReceiver::GenerateChoiceCodes(CBitVector& choicecodes, CB
|
|||
|
||||
void OTExtension1ooNECCReceiver::BuildMatrices(CBitVector& T, CBitVector& SndBuf, uint32_t numblocks, uint32_t ctr, uint8_t* ctr_buf)
|
||||
{
|
||||
uint32_t* counter = (uint32_t*) ctr_buf;
|
||||
uint32_t tempctr = (*counter);
|
||||
uint64_t* counter = (uint64_t*) ctr_buf;
|
||||
uint64_t tempctr = (*counter);
|
||||
|
||||
uint8_t* Tptr = T.GetArr();
|
||||
uint8_t* sndbufptr = SndBuf.GetArr();
|
||||
|
||||
|
||||
#ifdef AES256_HASH
|
||||
//first prg output written to tptr
|
||||
intrin_sequential_gen_rnd8(ctr_buf, tempctr, Tptr, (int) 2*numblocks, (int) m_nCodeWordBits, m_vKeySeedMtx);
|
||||
|
||||
//second prg output written to snd buffer
|
||||
intrin_sequential_gen_rnd8(ctr_buf, tempctr, sndbufptr, (int) 2*numblocks, (int) m_nCodeWordBits, m_vKeySeedMtx+m_nCodeWordBits);
|
||||
|
||||
#else
|
||||
//cout << "Numblocks = " << numblocks << endl;
|
||||
for(uint32_t k = 0; k < m_nCodeWordBits; k++)
|
||||
{
|
||||
|
@ -240,6 +249,7 @@ void OTExtension1ooNECCReceiver::BuildMatrices(CBitVector& T, CBitVector& SndBuf
|
|||
cout << endl;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
SndBuf.XORBytes(T.GetArr(), (uint32_t) 0, m_nCodeWordBytes*numblocks*m_nCodeWordBits);
|
||||
}
|
||||
|
||||
|
|
|
@ -196,6 +196,10 @@ void OTExtensionReceiver::BuildMatrices(CBitVector& T, CBitVector& SndBuf, uint3
|
|||
uint8_t* Tptr = T.GetArr();
|
||||
uint8_t* sndbufptr = SndBuf.GetArr();
|
||||
uint32_t ctrbyte = ctr/8;
|
||||
#ifdef AES256_HASH
|
||||
cerr << "Not supported with AES256 HASH enabled. Exiting." << endl;
|
||||
exit(0);
|
||||
#else
|
||||
for(uint32_t k = 0; k < m_nSymSecParam; k++)
|
||||
{
|
||||
(*counter) = tempctr;
|
||||
|
@ -211,6 +215,7 @@ void OTExtensionReceiver::BuildMatrices(CBitVector& T, CBitVector& SndBuf, uint3
|
|||
}
|
||||
SndBuf.XORBytesReverse(m_nChoices.GetArr()+ctrbyte, k*OTEXT_BLOCK_SIZE_BYTES * numblocks, OTEXT_BLOCK_SIZE_BYTES * numblocks);
|
||||
}
|
||||
#endif
|
||||
SndBuf.XORBytes(T.GetArr(), (uint32_t) 0, OTEXT_BLOCK_SIZE_BYTES*numblocks*m_nSymSecParam);
|
||||
}
|
||||
|
||||
|
@ -575,7 +580,7 @@ void OTExtensionSender::BuildQMatrix(CBitVector& T, CBitVector& RcvBuf, uint32_t
|
|||
uint32_t* counter = (uint32_t*) ctr_buf;
|
||||
uint32_t tempctr = *counter;
|
||||
#ifdef AES256_HASH
|
||||
cerr << "Not supported atm. Exiting." << endl;
|
||||
cerr << "Not supported with AES256 HASH enabled. Exiting." << endl;
|
||||
exit(0);
|
||||
#else
|
||||
for (uint32_t k = 0; k < m_nSymSecParam; k++, rcvbufptr += (OTEXT_BLOCK_SIZE_BYTES * numblocks))
|
||||
|
|
|
@ -210,8 +210,13 @@ class OTExtensionReceiver {
|
|||
|
||||
|
||||
m_nCounter = 0;
|
||||
#ifdef AES256_HASH
|
||||
m_vKeySeedMtx = (ROUND_KEYS*) malloc(sizeof(ROUND_KEYS) * nbaseOTs * nSndVals);
|
||||
intrin_sequential_ks4(m_vKeySeedMtx, keybytes, (int) nbaseOTs * nSndVals);
|
||||
#else
|
||||
m_vKeySeedMtx = (AES_KEY_CTX*) malloc(sizeof(AES_KEY_CTX) * nbaseOTs * nSndVals);
|
||||
InitAESKey(m_vKeySeedMtx, keybytes, nbaseOTs * nSndVals);
|
||||
#endif
|
||||
|
||||
m_nSeed = (uint8_t*) malloc(sizeof(AES_BYTES)); //
|
||||
m_cCrypto->gen_rnd(m_nSeed, AES_BYTES);//seed;
|
||||
|
@ -252,7 +257,11 @@ class OTExtensionReceiver {
|
|||
CBitVector m_vTempOTMasks;
|
||||
uint8_t* m_nSeed;
|
||||
MaskingFunction* m_fMaskFct;
|
||||
#ifdef AES256_HASH
|
||||
ROUND_KEYS* m_vKeySeedMtx;
|
||||
#else
|
||||
AES_KEY_CTX* m_vKeySeedMtx;
|
||||
#endif
|
||||
crypto* m_cCrypto;
|
||||
CLock* m_lRcvLock;
|
||||
#ifdef FIXED_KEY_AES_HASHING
|
||||
|
|
Loading…
Reference in New Issue
Block a user