Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ZKSigma in stead of built in crypto.go #2

Merged
merged 5 commits into from Mar 8, 2019

Conversation

Projects
None yet
3 participants
@gertjaap
Copy link
Contributor

commented Feb 15, 2019

This pull request removes crypto.go and replaces it with the use of ZKSigma

In order for this PR to be merged, a couple updates to ZKSigma need to be merged in, that are in ZKSigma PR #16

gertjaap added some commits Feb 15, 2019

Improved use of ZKSigma and related bugfixes
This commit updates the using of ZKSigma in a couple ways:

* It moves the ZKCurve into ZKLedger. This way ZKLedger drives the curve
and G/H points in stead of ZKSigma dictating this.
* Where appropriate, adopts the changed interfaces of making ZKSigma
fully parameterized (passing in the curve where necessary)

@gertjaap gertjaap requested review from narula and Nabeelperson Feb 15, 2019

@Nabeelperson
Copy link
Member

left a comment

All good! Only a small error at line 126 in pki.go
Print string needs a placeholder for pk.

audit.go Outdated
@@ -1,4 +1,4 @@
package zkledger
package apl

This comment has been minimized.

Copy link
@narula

narula Feb 28, 2019

Member

should be zkledger

@@ -1,4 +1,4 @@
package zkledger
package apl

This comment has been minimized.

Copy link
@narula
@gertjaap

This comment has been minimized.

Copy link
Contributor Author

commented Mar 1, 2019

Okay, I fixed all the pending issues. First need to merge mit-dci/zksigma#17 and make it public, then we can merge this.

for i := 0; i < a.num; i++ {
a.CommsCache[i] = EC.Zero()
a.RTokenCache[i] = EC.Zero()
a.CommsCache[i] = zksigma.Zero

This comment has been minimized.

Copy link
@narula

narula Mar 7, 2019

Member

how is this safe? it means all the caches are using the same underlying big ints, right?

This comment has been minimized.

Copy link
@gertjaap

gertjaap Mar 8, 2019

Author Contributor

As far as I can tell, the only operation done on these cache points is Add. And an Add to Zero will return the point you're adding. But even an Add between two non-zero points returns new BigInts. So the Zero point will never be modified.

verifies := VerifyEquivalence(T, rtokens, EC.H, a.pki.Get(bank_i), rep.Eproof)
gv := ZKLedgerCurve.Neg(ZKLedgerCurve.Mult(ZKLedgerCurve.G, rep.Sum)) // 1 / g^\sum{v_i}
T := ZKLedgerCurve.Add(comms, gv)
verifies, _ := rep.Eproof.Verify(ZKLedgerCurve, T, rtokens, ZKLedgerCurve.H, a.pki.Get(bank_i))

This comment has been minimized.

Copy link
@narula

narula Mar 7, 2019

Member

add a TODO for checking the error

// Issuance
if e.Type == Issuance {
en := &e.Entries[e.Sender]
e.print_decrypted()

This comment has been minimized.

Copy link
@narula

narula Mar 7, 2019

Member

is this supposed to be here?

This comment has been minimized.

Copy link
@Nabeelperson

Nabeelperson Mar 8, 2019

Member

I think this is an artifact of Willy's code. Probably just to see some terminal output of what is happening. Does not need to be passed around anywhere so I don't think it is a big issue.

@Nabeelperson Nabeelperson merged commit a7f074c into mit-dci:master Mar 8, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.