Run go fmt

This commit is contained in:
Jakob Unterwurzacher 2015-10-07 22:58:22 +02:00
parent c4a66bc30d
commit ed1df49af5
5 changed files with 16 additions and 17 deletions

View File

@ -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]
}

View File

@ -2,9 +2,9 @@ package cryptfs
import (
"bytes"
"fmt"
"crypto/rand"
"encoding/hex"
"fmt"
)
// Get "n" random bytes from /dev/urandom or panic

View File

@ -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 += "-"
}

View File

@ -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"
)

View File

@ -6,14 +6,14 @@ package benchmark
// go test -bench=.
import (
"fmt"
"os"
"bytes"
"crypto/aes"
"crypto/cipher"
"github.com/spacemonkeygo/openssl"
"testing"
"fmt"
"github.com/rfjakob/gocryptfs/cryptfs"
"github.com/spacemonkeygo/openssl"
"os"
"testing"
)
func TestMain(m *testing.M) {