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 // File content encryption / decryption
import ( import (
"encoding/binary"
"bytes" "bytes"
"crypto/cipher" "crypto/cipher"
"crypto/md5" "crypto/md5"
"encoding/binary"
"encoding/hex" "encoding/hex"
"errors" "errors"
"os" "os"
@ -90,7 +90,7 @@ func (be *CryptFS) DecryptBlock(ciphertext []byte, blockNo uint64) ([]byte, erro
} }
// encryptBlock - Encrypt and add MAC using GCM // 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? // Empty block?
if len(plaintext) == 0 { 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 length := (last.BlockNo - blocks[0].BlockNo + 1) * be.plainBS
var cropped []byte var cropped []byte
if offset+length > uint64(len(plaintext)) { if offset+length > uint64(len(plaintext)) {
cropped = plaintext[offset:len(plaintext)] cropped = plaintext[offset:]
} else { } else {
cropped = plaintext[offset : offset+length] cropped = plaintext[offset : offset+length]
} }

View File

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

View File

@ -1,14 +1,13 @@
package main package main
import ( import (
"os"
"fmt"
"encoding/hex" "encoding/hex"
"strings" "fmt"
"github.com/rfjakob/gocryptfs/cryptfs" "github.com/rfjakob/gocryptfs/cryptfs"
"os"
"strings"
) )
// printMasterKey - remind the user that he should store the master key in // printMasterKey - remind the user that he should store the master key in
// a safe place // a safe place
func printMasterKey(key []byte) { func printMasterKey(key []byte) {
@ -16,8 +15,8 @@ func printMasterKey(key []byte) {
var hChunked string var hChunked string
// Try to make it less scary by splitting it up in chunks // Try to make it less scary by splitting it up in chunks
for i := 0; i < len(h); i+=8 { for i := 0; i < len(h); i += 8 {
hChunked += h[i:i+8] hChunked += h[i : i+8]
if i < 52 { if i < 52 {
hChunked += "-" hChunked += "-"
} }

View File

@ -1,16 +1,16 @@
package main package main
import ( import (
"syscall"
"bytes" "bytes"
"fmt" "fmt"
"os"
"io/ioutil" "io/ioutil"
"os"
"syscall"
) )
// cmdline looks like this: /bin/bash \0 /path/to/gocryptfs \0 --zerokey \0 ... // cmdline looks like this: /bin/bash \0 /path/to/gocryptfs \0 --zerokey \0 ...
const ( const (
WRAPPER_PREFIX = "/bin/bash\000" WRAPPER_PREFIX = "/bin/bash\000"
WRAPPER_CONTAINS = "gocryptfs\000" WRAPPER_CONTAINS = "gocryptfs\000"
) )

View File

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