Skip to content

Commit 7e82275

Browse files
committed
minor co_await changes
1 parent e12bfbb commit 7e82275

File tree

3 files changed

+20
-18
lines changed

3 files changed

+20
-18
lines changed

libOTe/Tools/Pprf/RegularPprf.h

+2
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,8 @@ namespace osuCrypto
647647
// The OTs are used in blocks of 8, so make sure that there is a whole
648648
// number of blocks.
649649
mBaseOTs.resize(roundUpTo(mPntCount, 8), mDepth);
650+
if (mBaseOTs.size() < baseMessages.size())
651+
throw RTE_LOC;
650652
memcpy(mBaseOTs.data(), baseMessages.data(), baseMessages.size() * sizeof(block));
651653
}
652654

libOTe/Vole/Noisy/NoisyVoleSender.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ namespace osuCrypto {
6363

6464
setTimePoint("NoisyVoleSender.ot.begin");
6565

66-
co_await(ot.receive(bv, otMsg, prng, chl));
66+
co_await ot.receive(bv, otMsg, prng, chl);
6767
setTimePoint("NoisyVoleSender.ot.end");
6868

69-
co_await(send(delta, b, prng, otMsg, chl, ctx));
69+
co_await send(delta, b, prng, otMsg, chl, ctx);
7070

7171
} MACORO_CATCH(eptr) {
7272
co_await chl.close();
@@ -100,7 +100,7 @@ namespace osuCrypto {
100100

101101
// receive the the excrypted one shares.
102102
buffer.resize(xb.size() * b.size() * ctx.template byteSize<F>());
103-
co_await(chl.recv(buffer));
103+
co_await chl.recv(buffer);
104104
ctx.resize(msg, xb.size() * b.size());
105105
ctx.deserialize(buffer.begin(), buffer.end(), msg.begin());
106106

libOTe/Vole/Silent/SilentVoleReceiver.h

+15-15
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ namespace osuCrypto
196196
bb.randomize(prng);
197197
choice.append(bb);
198198

199-
co_await(mOtExtRecver->receive(choice, msg, prng, chl));
199+
co_await mOtExtRecver->receive(choice, msg, prng, chl);
200200

201201
mOtExtSender->setBaseOts(
202202
span<block>(msg).subspan(
@@ -205,18 +205,18 @@ namespace osuCrypto
205205
bb);
206206

207207
msg.resize(msg.size() - mOtExtSender->baseOtCount());
208-
co_await(nv.receive(noiseVals, baseAs, prng, *mOtExtSender, chl, mCtx));
208+
co_await nv.receive(noiseVals, baseAs, prng, *mOtExtSender, chl, mCtx);
209209
}
210210
else
211211
{
212212
auto chl2 = chl.fork();
213213
auto prng2 = prng.fork();
214214

215-
co_await(
215+
co_await
216216
macoro::when_all_ready(
217217
nv.receive(noiseVals, baseAs, prng2, *mOtExtSender, chl2, mCtx),
218218
mOtExtRecver->receive(choice, msg, prng, chl)
219-
));
219+
);
220220
}
221221
#else
222222
throw std::runtime_error("soft spoken must be enabled");
@@ -228,11 +228,11 @@ namespace osuCrypto
228228
auto prng2 = prng.fork();
229229
BaseOT baseOt;
230230

231-
co_await(
231+
co_await
232232
macoro::when_all_ready(
233233
baseOt.receive(choice, msg, prng, chl),
234234
nv.receive(noiseVals, baseAs, prng2, baseOt, chl2, mCtx))
235-
);
235+
;
236236

237237
}
238238

@@ -400,7 +400,7 @@ namespace osuCrypto
400400
if (c.size() != a.size())
401401
throw std::runtime_error("input sizes do not match." LOCATION);
402402

403-
co_await(silentReceiveInplace(c.size(), prng, chl));
403+
co_await silentReceiveInplace(c.size(), prng, chl);
404404

405405
mCtx.copy(mC.begin(), mC.begin() + c.size(), c.begin());
406406
mCtx.copy(mA.begin(), mA.begin() + a.size(), a.begin());
@@ -437,7 +437,7 @@ namespace osuCrypto
437437

438438
if (hasSilentBaseOts() == false)
439439
{
440-
co_await(genSilentBaseOts(prng, chl));
440+
co_await genSilentBaseOts(prng, chl);
441441
}
442442

443443
// allocate mA
@@ -473,7 +473,7 @@ namespace osuCrypto
473473
//
474474
// mA = mB + mS(mBaseC * mDelta)
475475
//
476-
co_await(mGen.expand(chl, mA, PprfOutputFormat::Interleaved, true, mNumThreads));
476+
co_await mGen.expand(chl, mA, PprfOutputFormat::Interleaved, true, mNumThreads);
477477

478478
setTimePoint("SilentVoleReceiver.expand.pprf_transpose");
479479

@@ -488,22 +488,22 @@ namespace osuCrypto
488488

489489
if (mDebug)
490490
{
491-
co_await(checkRT(chl));
491+
co_await checkRT(chl);
492492
setTimePoint("SilentVoleReceiver.expand.checkRT");
493493
}
494494

495495

496496
if (mMalType == SilentSecType::Malicious)
497497
{
498-
co_await(chl.send(std::move(mMalCheckSeed)));
498+
co_await chl.send(std::move(mMalCheckSeed));
499499

500500
if constexpr (MaliciousSupported)
501501
myHash = ferretMalCheck();
502502
else {
503503
throw std::runtime_error("malicious is currently only supported for GF128 block. " LOCATION);
504504
}
505505

506-
co_await(chl.recv(theirHash));
506+
co_await chl.recv(theirHash);
507507

508508
if (theirHash != myHash)
509509
{
@@ -601,19 +601,19 @@ namespace osuCrypto
601601
// recv delta
602602
buffer.resize(mCtx.template byteSize<F>());
603603
mCtx.resize(delta, 1);
604-
co_await(chl.recv(buffer));
604+
co_await chl.recv(buffer);
605605
mCtx.deserialize(buffer.begin(), buffer.end(), delta.begin());
606606

607607
// recv B
608608
buffer.resize(mCtx.template byteSize<F>() * mA.size());
609609
mCtx.resize(B, mA.size());
610-
co_await(chl.recv(buffer));
610+
co_await chl.recv(buffer);
611611
mCtx.deserialize(buffer.begin(), buffer.end(), B.begin());
612612

613613
// recv the noisy values.
614614
buffer.resize(mCtx.template byteSize<F>() * mBaseA.size());
615615
mCtx.resize(baseB, mBaseA.size());
616-
co_await(chl.recvResize(buffer));
616+
co_await chl.recvResize(buffer);
617617
mCtx.deserialize(buffer.begin(), buffer.end(), baseB.begin());
618618

619619
// it shoudl hold that

0 commit comments

Comments
 (0)