Skip to content

Commit d9525ea

Browse files
committed
ci debug
1 parent b1a5f23 commit d9525ea

File tree

3 files changed

+100
-53
lines changed

3 files changed

+100
-53
lines changed

.github/workflows/build-test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ jobs:
221221

222222

223223
- name: unit test
224-
run: ./out/build/x64-Release/frontend/frontend_libOTe.exe -u
224+
run: ./out/build/x64-Release/frontend/frontend_libOTe.exe -u 111
225225

226226
# - name: find source tree
227227
# run: |

libOTe/Vole/Silent/SilentVoleReceiver.h

+63-32
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ namespace osuCrypto
135135
// otherwise we perform a base OT protocol to
136136
// generate the needed OTs.
137137
task<> genSilentBaseOts(PRNG& prng, Socket& chl)
138-
{
138+
try {
139139
#ifdef LIBOTE_HAS_BASE_OT
140140

141141
#if defined ENABLE_MRR_TWIST && defined ENABLE_SSE
@@ -150,24 +150,20 @@ namespace osuCrypto
150150
using BaseOT = DefaultBaseOT;
151151
#endif
152152

153-
auto choice = BitVector{};
154-
auto bb = BitVector{};
155-
auto msg = AlignedUnVector<block>{};
156-
auto baseVole = std::vector<block>{};
157-
auto baseOt = BaseOT{};
158-
auto chl2 = Socket{};
159-
auto prng2 = PRNG{};
160-
auto noiseVals = VecG{};
161-
auto baseAs = VecF{};
162-
auto nv = NoisyVoleReceiver<F, G, Ctx>{};
153+
//auto choice = BitVector{};
154+
//auto bb = BitVector{};
155+
//auto msg = AlignedUnVector<block>{};
156+
//auto baseVole = std::vector<block>{};
157+
//auto baseOt = BaseOT{};
158+
//auto nv = NoisyVoleReceiver<F, G, Ctx>{};
163159

164160

165161
setTimePoint("SilentVoleReceiver.genSilent.begin");
166162
if (isConfigured() == false)
167163
throw std::runtime_error("configure must be called first");
168164

169-
choice = sampleBaseChoiceBits(prng);
170-
msg.resize(choice.size());
165+
auto choice = sampleBaseChoiceBits(prng);
166+
AlignedUnVector<block> msg(choice.size());
171167

172168
// sample the noise vector noiseVals such that we will compute
173169
//
@@ -183,9 +179,11 @@ namespace osuCrypto
183179
// plus voleDeltaShares[i] added to the appreciate spot. Similarly, the
184180
// other party will program the PPRF to output their share of delta * noiseVals.
185181
//
186-
noiseVals = sampleBaseVoleVals(prng);
182+
auto noiseVals = sampleBaseVoleVals(prng);
183+
auto baseAs = VecF{};
187184
mCtx.resize(baseAs, noiseVals.size());
188185

186+
auto nv = NoisyVoleReceiver<F, G, Ctx>{};
189187
if (mTimer)
190188
nv.setTimer(*mTimer);
191189

@@ -201,7 +199,7 @@ namespace osuCrypto
201199
if (mOtExtSender->hasBaseOts() == false)
202200
{
203201
msg.resize(msg.size() + mOtExtSender->baseOtCount());
204-
bb.resize(mOtExtSender->baseOtCount());
202+
auto bb = BitVector{ mOtExtSender->baseOtCount() };
205203
bb.randomize(prng);
206204
choice.append(bb);
207205

@@ -218,9 +216,8 @@ namespace osuCrypto
218216
}
219217
else
220218
{
221-
chl2 = chl.fork();
222-
prng2.SetSeed(prng.get());
223-
219+
auto chl2 = chl.fork();
220+
auto prng2 = prng.fork();
224221

225222
co_await(
226223
macoro::when_all_ready(
@@ -234,8 +231,9 @@ namespace osuCrypto
234231
}
235232
else
236233
{
237-
chl2 = chl.fork();
238-
prng2.SetSeed(prng.get());
234+
auto chl2 = chl.fork();
235+
auto prng2 = prng.fork();
236+
BaseOT baseOt;
239237

240238
co_await(
241239
macoro::when_all_ready(
@@ -250,7 +248,12 @@ namespace osuCrypto
250248
throw std::runtime_error("LIBOTE_HAS_BASE_OT = false, must enable relic, sodium or simplest ot asm." LOCATION);
251249
co_return;
252250
#endif
253-
};
251+
}
252+
catch (...)
253+
{
254+
chl.close();
255+
throw;
256+
}
254257

255258
// configure the silent OT extension. This sets
256259
// the parameters and figures out how many base OT
@@ -268,10 +271,8 @@ namespace osuCrypto
268271
mState = State::Configured;
269272
mBaseType = type;
270273

271-
272274
syndromeDecodingConfigure(mNumPartitions, mSizePer, mNoiseVecSize, mSecParam, mRequestSize, mMultType);
273275

274-
275276
mGen.configure(mSizePer, mNumPartitions);
276277
}
277278

@@ -286,7 +287,6 @@ namespace osuCrypto
286287
throw std::runtime_error("configure must be called first");
287288

288289
return mGen.baseOtCount();
289-
290290
}
291291

292292
// The silent base OTs must have specially set base OTs.
@@ -306,7 +306,7 @@ namespace osuCrypto
306306
VecG sampleBaseVoleVals(PRNG& prng)
307307
{
308308
if (isConfigured() == false)
309-
throw RTE_LOC;
309+
throw std::runtime_error("configure must be called first. " LOCATION);
310310

311311
// sample the values of the noisy coordinate of c
312312
// and perform a noicy vole to get a = b + mD * c
@@ -400,9 +400,10 @@ namespace osuCrypto
400400
VecF& a,
401401
PRNG& prng,
402402
Socket& chl)
403-
{
403+
try {
404+
404405
if (c.size() != a.size())
405-
throw RTE_LOC;
406+
throw std::runtime_error("input sizes do not match." LOCATION);
406407

407408
co_await(silentReceiveInplace(c.size(), prng, chl));
408409

@@ -411,6 +412,11 @@ namespace osuCrypto
411412

412413
clear();
413414
}
415+
catch (...)
416+
{
417+
chl.close();
418+
throw;
419+
}
414420

415421
// Perform the actual OT extension. If silent
416422
// base OTs have been generated or set, then
@@ -420,11 +426,10 @@ namespace osuCrypto
420426
u64 n,
421427
PRNG& prng,
422428
Socket& chl)
423-
{
429+
try {
424430
auto myHash = std::array<u8, 32>{};
425431
auto theirHash = std::array<u8, 32>{};
426432
gTimer.setTimePoint("SilentVoleReceiver.ot.enter");
427-
428433
if (isConfigured() == false)
429434
{
430435
// first generate 128 normal base OTs
@@ -434,9 +439,13 @@ namespace osuCrypto
434439
if (mRequestSize < n)
435440
throw std::invalid_argument("n does not match the requested number of OTs via configure(...). " LOCATION);
436441

442+
437443
if (hasSilentBaseOts() == false)
438444
{
445+
std::cout << "r genBase " << std::endl;
439446
co_await(genSilentBaseOts(prng, chl));
447+
std::cout << "r genBase done" << std::endl;
448+
440449
}
441450

442451
// allocate mA
@@ -472,8 +481,13 @@ namespace osuCrypto
472481
//
473482
// mA = mB + mS(mBaseC * mDelta)
474483
//
484+
485+
std::cout << "r expand" << std::endl;
486+
475487
co_await(mGen.expand(chl, mA, PprfOutputFormat::Interleaved, true, mNumThreads));
476488

489+
std::cout << "r expand done" << std::endl;
490+
477491
setTimePoint("SilentVoleReceiver.expand.pprf_transpose");
478492

479493
// populate the noisy coordinates of mC and
@@ -494,19 +508,27 @@ namespace osuCrypto
494508

495509
if (mMalType == SilentSecType::Malicious)
496510
{
511+
std::cout << "r mal" << std::endl;
512+
497513
co_await(chl.send(std::move(mMalCheckSeed)));
498514

499515
if constexpr (MaliciousSupported)
500516
myHash = ferretMalCheck();
501-
else
517+
else {
502518
throw std::runtime_error("malicious is currently only supported for GF128 block. " LOCATION);
519+
}
503520

504521
co_await(chl.recv(theirHash));
505522

506523
if (theirHash != myHash)
507-
throw RTE_LOC;
524+
{
525+
throw std::runtime_error("malcicious security check failed. " LOCATION);
526+
}
527+
std::cout << "r mal done" << std::endl;
528+
508529
}
509530

531+
510532
switch (mMultType)
511533
{
512534
case osuCrypto::MultType::ExConv7x24:
@@ -543,7 +565,9 @@ namespace osuCrypto
543565
encoder.dualEncode(mC);
544566
}
545567
else
568+
{
546569
throw std::runtime_error("QuasiCyclic is only supported for GF128, i.e. block. " LOCATION);
570+
}
547571
#else
548572
throw std::runtime_error("QuasiCyclic requires ENABLE_BITPOLYMUL = true. " LOCATION);
549573
#endif
@@ -569,11 +593,18 @@ namespace osuCrypto
569593
mBaseC = {};
570594
mBaseA = {};
571595

596+
std::cout << "r done" << std::endl;
597+
598+
572599
// make the protocol as done and that
573600
// mA,mC are ready to be consumed.
574601
mState = State::Default;
575602
}
576-
603+
catch (...)
604+
{
605+
chl.close();
606+
throw;
607+
}
577608

578609

579610
// internal.

0 commit comments

Comments
 (0)