summaryrefslogtreecommitdiff
path: root/internal/cryptocore/nonce.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2016-12-10 11:50:16 +0100
committerJakob Unterwurzacher2016-12-10 11:54:36 +0100
commitc9f4400e6dc71a36df5dc9725f52a8968f5f9803 (patch)
tree601cff97e2f5d472a68e3a133da43237af032521 /internal/cryptocore/nonce.go
parent6c86afb5cd63b099d1762da1a2ce3f76703dc4fb (diff)
Replace all calls to naked panic() with log.Panic()
We want all panics to show up in the syslog.
Diffstat (limited to 'internal/cryptocore/nonce.go')
-rw-r--r--internal/cryptocore/nonce.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/internal/cryptocore/nonce.go b/internal/cryptocore/nonce.go
index 973d2d8..3f56cc9 100644
--- a/internal/cryptocore/nonce.go
+++ b/internal/cryptocore/nonce.go
@@ -6,6 +6,7 @@ import (
"encoding/binary"
"encoding/hex"
"fmt"
+ "log"
"github.com/rfjakob/gocryptfs/internal/tlog"
)
@@ -15,7 +16,7 @@ func RandBytes(n int) []byte {
b := make([]byte, n)
_, err := rand.Read(b)
if err != nil {
- panic("Failed to read random bytes: " + err.Error())
+ log.Panic("Failed to read random bytes: " + err.Error())
}
return b
}
@@ -37,7 +38,7 @@ func (n *nonceGenerator) Get() []byte {
tlog.Debug.Printf("nonceGenerator.Get(): %s\n", hex.EncodeToString(nonce))
if bytes.Equal(nonce, n.lastNonce) {
m := fmt.Sprintf("Got the same nonce twice: %s. This should never happen!", hex.EncodeToString(nonce))
- panic(m)
+ log.Panic(m)
}
n.lastNonce = nonce
return nonce