aboutsummaryrefslogtreecommitdiff
path: root/cryptfs
diff options
context:
space:
mode:
authorJakob Unterwurzacher2015-12-11 19:54:53 +0100
committerJakob Unterwurzacher2015-12-11 20:02:12 +0100
commite99e8417137a713348d2797ba813bcefe0c3984d (patch)
tree1bd0f54313472a914ebb8f5370f4b97001f8b85c /cryptfs
parent78cd97c5e9de221a6cd2ddfcaaa2c1f1f430d264 (diff)
Rmdir: handle creating and removing unreadable directories
This patch also splits off Mkdir and Rmdir into its own file. Fixes issue #8, thanks to @diseq for the bug report.
Diffstat (limited to 'cryptfs')
-rw-r--r--cryptfs/nonce.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/cryptfs/nonce.go b/cryptfs/nonce.go
index 9bdbb09..a122ea5 100644
--- a/cryptfs/nonce.go
+++ b/cryptfs/nonce.go
@@ -1,6 +1,7 @@
package cryptfs
import (
+ "encoding/binary"
"bytes"
"crypto/rand"
"encoding/hex"
@@ -17,6 +18,12 @@ func RandBytes(n int) []byte {
return b
}
+// Return a secure random uint64
+func RandUint64() uint64 {
+ b := RandBytes(8)
+ return binary.BigEndian.Uint64(b)
+}
+
var gcmNonce nonce96
type nonce96 struct {