Skip to content

Commit

Permalink
xmr: bp - deterministic mask generation init
Browse files Browse the repository at this point in the history
  • Loading branch information
ph4r05 committed Aug 25, 2018
1 parent 5060d6a commit a10d05a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/apps/monero/xmr/bulletproof.py
Original file line number Diff line number Diff line change
Expand Up @@ -773,10 +773,13 @@ def aL_vct(self):
def aR_vct(self):
return KeyVEval(64, lambda x, r: self.aX(x, r, False))

def _det_mask_init(self):
memcpy(self.tmp_det_buff, 0, self.proof_sec, 0, len(self.proof_sec))

def _det_mask(self, i, is_sL=True, dst=None):
dst = _ensure_dst_key(dst)
self.tmp_det_buff[0] = int(is_sL)
memcpy(self.tmp_det_buff, 1, self.proof_sec, 0, len(self.proof_sec))
self.tmp_det_buff[64] = int(is_sL)
memcpy(self.tmp_det_buff, 65, ZERO, 0, 4)
dump_uvarint_b_into(i, self.tmp_det_buff, 65)
crypto.hash_to_scalar_into(self.tmp_sc_1, self.tmp_det_buff)
crypto.encodeint_into(self.tmp_sc_1, dst)
Expand Down Expand Up @@ -1101,6 +1104,7 @@ def prove_testnet(self, sv, gamma):
self.value_enc = crypto.encodeint(sv)
self.gamma_enc = crypto.encodeint(gamma)
self.proof_sec = crypto.random_bytes(64)
self._det_mask_init()

L = _ensure_dst_keyvect(None, BP_LOG_N)
R = _ensure_dst_keyvect(None, BP_LOG_N)
Expand Down Expand Up @@ -1139,6 +1143,7 @@ def prove_batch(self, sv, gamma):
self.assrt(len(sv) > 0, "sv empty")

self.proof_sec = crypto.random_bytes(64)
self._det_mask_init()
sv = [crypto.encodeint(x) for x in sv]
gamma = [crypto.encodeint(x) for x in gamma]

Expand Down

0 comments on commit a10d05a

Please sign in to comment.