Piotr Dyraga 530e40c1d4 Deadlock fixed - result channel buffer increased
Although the result channel send operation and context cancel are
guarded by the same mutex and context is cancelled by the main thread
when it receives a result message from the channnel, there is absolutely
no guarantee that one goroutine can't write result to the channel after
the first goroutine did the same and before the main thread cancelled
the context. This is the following scenario:

- Worker #1 acquires mutex, writes to the result channel
- Worker #2 acquires mutex, writes to the result channel
- Main thread reads from the result channel, acquires mutex, cancels the
context

Since our result channel (and error channel) had buffer of size 1, the
Worker #2 was hanging indefinitely. Setting the buffer size to the
number of goroutines fixed the problem.

Alternative scenario was:

- Worker #1 acquires mutex, writes to the result channel
- Main thread acquires mutex, reads from the result channel, cancels the
context
- Worker #2 receives cancel notification so it completes without
yielding the result

That's why deadlock was happening only from time to time.
2018-07-30 09:56:40 +02:00
2014-11-29 22:22:14 -08:00
2014-11-29 22:22:14 -08:00
2014-11-29 22:47:18 -08:00

paillier

Go implementation of the paillier cryptosystem and threshold paillier crytposystem.

travis

introduction

Implementation of the paillier cryptosystem. See http://en.wikipedia.org/wiki/Paillier_cryptosystem for an introduction.

The threshold paillier cryptosystem is a translation of the java version that can be found at http://cs.utdallas.edu/dspl/cgi-bin/pailliertoolbox/ that is an implementation of the algorithm defined in Damgård's paper "A Generalization of Paillier's Public-Key System with Applications to Electronic Voting".

Another important feature of the library is the ease of serilisation of all the structs in JSON and BSON.

Implements the paillier cryptosystem and threshold paillier crytposystem.

caveat

As any cryptographic library, if you use it, you need to trust it. Unfortunatly, this library as not been verified by a third party. There might be some bugs and vulnerabilities. If you find one, please fill a bug.

If you need to encrypt something serious, use the library provided by Go. If you want to have fun, use Paillier!

S
Description
Paillier cryptosystem implemented in Go
Readme MIT
188 KiB
0 Stars 1 Watchers 0 Forks
Languages
Go 100%