From 2c612e457f15158abd695d7bf85d0f77bf06e70b Mon Sep 17 00:00:00 2001 From: Dusan Klinec Date: Fri, 17 Aug 2018 04:56:52 +0200 Subject: [PATCH] xmr: bp - use sc_inv_into --- src/apps/monero/xmr/bulletproof.py | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/apps/monero/xmr/bulletproof.py b/src/apps/monero/xmr/bulletproof.py index 92a7a8012..7e2b80fb5 100644 --- a/src/apps/monero/xmr/bulletproof.py +++ b/src/apps/monero/xmr/bulletproof.py @@ -8,11 +8,6 @@ from apps.monero.xmr.serialize.int_serialize import dump_uvarint_b, dump_uvarint_b_into from apps.monero.xmr.serialize_messages.tx_rsig_bulletproof import Bulletproof -# curve size -# 2**252 + 3*610042537739*15158679415041928064055629 -ED25519_ORD = 0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed - - # Constants BP_LOG_N = 6 @@ -127,11 +122,9 @@ def invert(dst, x): :return: """ dst = _ensure_dst_key(dst) - xint = 0 - xint = xint.from_bytes(x, "little") - xinv = mul_inverse_used(xint, ED25519_ORD) - buff = xinv.to_bytes(32, "little") - copy_key(dst, buff) + crypto.decodeint_into_noreduce(tmp_sc_1, x) + crypto.sc_inv_into(tmp_sc_2, tmp_sc_1) + crypto.encodeint_into(tmp_sc_2, dst) return dst