aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/key.go
diff options
context:
space:
mode:
authorGustav Simonsson <gustav.simonsson@gmail.com>2015-01-20 03:24:30 +0800
committerGustav Simonsson <gustav.simonsson@gmail.com>2015-01-20 03:24:30 +0800
commit3cf038f300950c5a14b99fb0249ec09f663ef6af (patch)
tree1f47a770b06507e679775dce7c6361d8c8aa6055 /crypto/key.go
parent9caf32befebb41fbb013b299caf2fff5fe840430 (diff)
downloadgo-tangerine-3cf038f300950c5a14b99fb0249ec09f663ef6af.tar
go-tangerine-3cf038f300950c5a14b99fb0249ec09f663ef6af.tar.gz
go-tangerine-3cf038f300950c5a14b99fb0249ec09f663ef6af.tar.bz2
go-tangerine-3cf038f300950c5a14b99fb0249ec09f663ef6af.tar.lz
go-tangerine-3cf038f300950c5a14b99fb0249ec09f663ef6af.tar.xz
go-tangerine-3cf038f300950c5a14b99fb0249ec09f663ef6af.tar.zst
go-tangerine-3cf038f300950c5a14b99fb0249ec09f663ef6af.zip
Address pull request comments
* Allocate with composite literal instead of new * Remove check of number of bytes read from rand
Diffstat (limited to 'crypto/key.go')
-rw-r--r--crypto/key.go6
1 files changed, 1 insertions, 5 deletions
diff --git a/crypto/key.go b/crypto/key.go
index 0e7c04275..d371ad4dc 100644
--- a/crypto/key.go
+++ b/crypto/key.go
@@ -87,13 +87,9 @@ func (k *Key) UnmarshalJSON(j []byte) (err error) {
func NewKey(rand io.Reader) *Key {
randBytes := make([]byte, 32)
- n, err := rand.Read(randBytes)
+ _, err := rand.Read(randBytes)
if err != nil {
panic("key generation: could not read from random source: " + err.Error())
- } else {
- if n != 32 {
- panic("key generation: read less than required bytes from random source: " + err.Error())
- }
}
reader := bytes.NewReader(randBytes)
_, x, y, err := elliptic.GenerateKey(S256(), reader)