summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Unterwurzacher2015-10-07 22:58:22 +0200
committerJakob Unterwurzacher2015-10-07 22:59:36 +0200
commited1df49af5bb616e5ec34585b20c9c93a96b8088 (patch)
tree953d6701036188c1ca68cecb11789106316f99a1
parentc4a66bc30dbec1c3e0240f5d5bdb05412b2168a2 (diff)
Run go fmt
-rw-r--r--cryptfs/cryptfs_content.go6
-rw-r--r--cryptfs/nonce.go2
-rw-r--r--gocryptfs_main/masterkey.go11
-rw-r--r--gocryptfs_main/sendsig.go6
-rw-r--r--openssl_benchmark/openssl_test.go6
5 files changed, 15 insertions, 16 deletions
diff --git a/cryptfs/cryptfs_content.go b/cryptfs/cryptfs_content.go
index cb309ea..566288b 100644
--- a/cryptfs/cryptfs_content.go
+++ b/cryptfs/cryptfs_content.go
@@ -3,10 +3,10 @@ package cryptfs
// File content encryption / decryption
import (
- "encoding/binary"
"bytes"
"crypto/cipher"
"crypto/md5"
+ "encoding/binary"
"encoding/hex"
"errors"
"os"
@@ -90,7 +90,7 @@ func (be *CryptFS) DecryptBlock(ciphertext []byte, blockNo uint64) ([]byte, erro
}
// encryptBlock - Encrypt and add MAC using GCM
-func (be *CryptFS) EncryptBlock(plaintext []byte, blockNo uint64) []byte {
+func (be *CryptFS) EncryptBlock(plaintext []byte, blockNo uint64) []byte {
// Empty block?
if len(plaintext) == 0 {
@@ -197,7 +197,7 @@ func (be *CryptFS) CropPlaintext(plaintext []byte, blocks []intraBlock) []byte {
length := (last.BlockNo - blocks[0].BlockNo + 1) * be.plainBS
var cropped []byte
if offset+length > uint64(len(plaintext)) {
- cropped = plaintext[offset:len(plaintext)]
+ cropped = plaintext[offset:]
} else {
cropped = plaintext[offset : offset+length]
}
diff --git a/cryptfs/nonce.go b/cryptfs/nonce.go
index 0ba079b..9bdbb09 100644
--- a/cryptfs/nonce.go
+++ b/cryptfs/nonce.go
@@ -2,9 +2,9 @@ package cryptfs
import (
"bytes"
- "fmt"
"crypto/rand"
"encoding/hex"
+ "fmt"
)
// Get "n" random bytes from /dev/urandom or panic
diff --git a/gocryptfs_main/masterkey.go b/gocryptfs_main/masterkey.go
index 205f2ab..69f268c 100644
--- a/gocryptfs_main/masterkey.go
+++ b/gocryptfs_main/masterkey.go
@@ -1,14 +1,13 @@
package main
import (
- "os"
- "fmt"
"encoding/hex"
- "strings"
+ "fmt"
"github.com/rfjakob/gocryptfs/cryptfs"
+ "os"
+ "strings"
)
-
// printMasterKey - remind the user that he should store the master key in
// a safe place
func printMasterKey(key []byte) {
@@ -16,8 +15,8 @@ func printMasterKey(key []byte) {
var hChunked string
// Try to make it less scary by splitting it up in chunks
- for i := 0; i < len(h); i+=8 {
- hChunked += h[i:i+8]
+ for i := 0; i < len(h); i += 8 {
+ hChunked += h[i : i+8]
if i < 52 {
hChunked += "-"
}
diff --git a/gocryptfs_main/sendsig.go b/gocryptfs_main/sendsig.go
index 98bd448..d0e1cbb 100644
--- a/gocryptfs_main/sendsig.go
+++ b/gocryptfs_main/sendsig.go
@@ -1,16 +1,16 @@
package main
import (
- "syscall"
"bytes"
"fmt"
- "os"
"io/ioutil"
+ "os"
+ "syscall"
)
// cmdline looks like this: /bin/bash \0 /path/to/gocryptfs \0 --zerokey \0 ...
const (
- WRAPPER_PREFIX = "/bin/bash\000"
+ WRAPPER_PREFIX = "/bin/bash\000"
WRAPPER_CONTAINS = "gocryptfs\000"
)
diff --git a/openssl_benchmark/openssl_test.go b/openssl_benchmark/openssl_test.go
index a1e3d17..76c68a8 100644
--- a/openssl_benchmark/openssl_test.go
+++ b/openssl_benchmark/openssl_test.go
@@ -6,14 +6,14 @@ package benchmark
// go test -bench=.
import (
- "fmt"
- "os"
"bytes"
"crypto/aes"
"crypto/cipher"
+ "fmt"
+ "github.com/rfjakob/gocryptfs/cryptfs"
"github.com/spacemonkeygo/openssl"
+ "os"
"testing"
- "github.com/rfjakob/gocryptfs/cryptfs"
)
func TestMain(m *testing.M) {