fix for very small requests

This commit is contained in:
themighty1
2022-01-17 13:05:17 +03:00
parent 98c59dc1eb
commit 42404792b3
2 changed files with 8 additions and 1 deletions

View File

@@ -88,6 +88,11 @@ export class GHASH {
return this.maxOddPowerNeeded > 19;
}
// return true if we expect the notary to respond with data on Step1
isStep1ResponseExpected(){
return this.maxOddPowerNeeded > 3;
}
// findMaxOddPower finds the max odd share that we
findMaxOddPower(maxPowerNeeded){
assert(maxPowerNeeded <= 1026);

View File

@@ -289,7 +289,9 @@ export class TWOPC {
ghashInputs.push(concatTA(lenA, lenC));
const resp1 = await this.send('ghash_step1', await this.ghash.buildStep1());
this.ghash.processOTResponse(resp1);
if (this.ghash.isStep1ResponseExpected()){
this.ghash.processOTResponse(resp1);
}
if (this.ghash.isStep2Needed()){
const resp2 = await this.send('ghash_step2', await this.ghash.buildStep2());
this.ghash.processOTResponse(resp2);