Skip to content

Commit

Permalink
remove Trezor support
Browse files Browse the repository at this point in the history
  • Loading branch information
prusnak authored and rfjakob committed Dec 28, 2019
1 parent 7dda236 commit 1364b44
Show file tree
Hide file tree
Showing 11 changed files with 14 additions and 279 deletions.
10 changes: 0 additions & 10 deletions Documentation/MANPAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -405,16 +405,6 @@ You need root permissions to use `-suid`.
#### -trace string
Write execution trace to file. View the trace using "go tool trace FILE".

#### -trezor
With `-init`: Protect the masterkey using a SatoshiLabs Trezor instead of a password.

This feature is disabled by default and must be enabled at compile time using:

./build.bash -tags enable_trezor

You can determine if your gocryptfs binary has Trezor support enabled checking
if the `gocryptfs -version` output contains the string `enable_trezor`.

#### -version
Print version and exit. The output contains three fields separated by ";".
Example: "gocryptfs v1.1.1-5-g75b776c; go-fuse 6b801d3; 2016-11-01 go1.7.3".
Expand Down
10 changes: 1 addition & 9 deletions cli_args.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
"github.com/rfjakob/gocryptfs/internal/configfile"
"github.com/rfjakob/gocryptfs/internal/exitcodes"
"github.com/rfjakob/gocryptfs/internal/prefer_openssl"
"github.com/rfjakob/gocryptfs/internal/readpassword"
"github.com/rfjakob/gocryptfs/internal/stupidgcm"
"github.com/rfjakob/gocryptfs/internal/tlog"
)
Expand All @@ -29,7 +28,7 @@ type argContainer struct {
plaintextnames, quiet, nosyslog, wpanic,
longnames, allow_other, reverse, aessiv, nonempty, raw64,
noprealloc, speed, hkdf, serialize_reads, forcedecode, hh, info,
sharedstorage, devrandom, fsck, trezor bool
sharedstorage, devrandom, fsck bool
// Mount options with opposites
dev, nodev, suid, nosuid, exec, noexec, rw, ro bool
masterkey, mountpoint, cipherdir, cpuprofile,
Expand Down Expand Up @@ -170,9 +169,6 @@ func parseCliOpts() (args argContainer) {
flagSet.BoolVar(&args.sharedstorage, "sharedstorage", false, "Make concurrent access to a shared CIPHERDIR safer")
flagSet.BoolVar(&args.devrandom, "devrandom", false, "Use /dev/random for generating master key")
flagSet.BoolVar(&args.fsck, "fsck", false, "Run a filesystem check on CIPHERDIR")
if readpassword.TrezorSupport {
flagSet.BoolVar(&args.trezor, "trezor", false, "Protect the masterkey using a SatoshiLabs Trezor instead of a password")
}

// Mount options with opposites
flagSet.BoolVar(&args.dev, "dev", false, "Allow device files")
Expand Down Expand Up @@ -282,10 +278,6 @@ func parseCliOpts() (args argContainer) {
tlog.Fatal.Printf("The options -extpass and -masterkey cannot be used at the same time")
os.Exit(exitcodes.Usage)
}
if !args.extpass.Empty() && args.trezor {
tlog.Fatal.Printf("The options -extpass and -trezor cannot be used at the same time")
os.Exit(exitcodes.Usage)
}
if args.idle < 0 {
tlog.Fatal.Printf("Idle timeout cannot be less than 0")
os.Exit(exitcodes.Usage)
Expand Down
14 changes: 2 additions & 12 deletions init_dir.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"syscall"

"github.com/rfjakob/gocryptfs/internal/configfile"
"github.com/rfjakob/gocryptfs/internal/cryptocore"
"github.com/rfjakob/gocryptfs/internal/exitcodes"
"github.com/rfjakob/gocryptfs/internal/nametransform"
"github.com/rfjakob/gocryptfs/internal/readpassword"
Expand Down Expand Up @@ -72,19 +71,10 @@ func initDir(args *argContainer) {
tlog.Info.Printf("Choose a password for protecting your files.")
}
{
var password []byte
var trezorPayload []byte
if args.trezor {
trezorPayload = cryptocore.RandBytes(readpassword.TrezorPayloadLen)
// Get binary data from from Trezor
password = readpassword.Trezor(trezorPayload)
} else {
// Normal password entry
password = readpassword.Twice([]string(args.extpass), args.passfile)
}
password := readpassword.Twice([]string(args.extpass), args.passfile)
creator := tlog.ProgramName + " " + GitVersion
err = configfile.Create(args.config, password, args.plaintextnames,
args.scryptn, creator, args.aessiv, args.devrandom, trezorPayload)
args.scryptn, creator, args.aessiv, args.devrandom)
if err != nil {
tlog.Fatal.Println(err)
os.Exit(exitcodes.WriteConf)
Expand Down
10 changes: 1 addition & 9 deletions internal/configfile/config_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ type ConfFile struct {
// mounting. This mechanism is analogous to the ext4 feature flags that are
// stored in the superblock.
FeatureFlags []string
// TrezorPayload stores 32 random bytes used for unlocking the master key using
// a Trezor security module. The randomness makes sure that a unique unlock
// value is used for each gocryptfs filesystem.
TrezorPayload []byte `json:",omitempty"`
// Filename is the name of the config file. Not exported to JSON.
filename string
}
Expand All @@ -73,7 +69,7 @@ func randBytesDevRandom(n int) []byte {
// "password" and write it to "filename".
// Uses scrypt with cost parameter logN.
func Create(filename string, password []byte, plaintextNames bool,
logN int, creator string, aessiv bool, devrandom bool, trezorPayload []byte) error {
logN int, creator string, aessiv bool, devrandom bool) error {
var cf ConfFile
cf.filename = filename
cf.Creator = creator
Expand All @@ -93,10 +89,6 @@ func Create(filename string, password []byte, plaintextNames bool,
if aessiv {
cf.FeatureFlags = append(cf.FeatureFlags, knownFlags[FlagAESSIV])
}
if len(trezorPayload) > 0 {
cf.FeatureFlags = append(cf.FeatureFlags, knownFlags[FlagTrezor])
cf.TrezorPayload = trezorPayload
}
{
// Generate new random master key
var key []byte
Expand Down
8 changes: 4 additions & 4 deletions internal/configfile/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func TestLoadV2StrangeFeature(t *testing.T) {
}

func TestCreateConfDefault(t *testing.T) {
err := Create("config_test/tmp.conf", testPw, false, 10, "test", false, false, nil)
err := Create("config_test/tmp.conf", testPw, false, 10, "test", false, false)
if err != nil {
t.Fatal(err)
}
Expand All @@ -83,14 +83,14 @@ func TestCreateConfDefault(t *testing.T) {
}

func TestCreateConfDevRandom(t *testing.T) {
err := Create("config_test/tmp.conf", testPw, false, 10, "test", false, true, nil)
err := Create("config_test/tmp.conf", testPw, false, 10, "test", false, true)
if err != nil {
t.Fatal(err)
}
}

func TestCreateConfPlaintextnames(t *testing.T) {
err := Create("config_test/tmp.conf", testPw, true, 10, "test", false, false, nil)
err := Create("config_test/tmp.conf", testPw, true, 10, "test", false, false)
if err != nil {
t.Fatal(err)
}
Expand All @@ -111,7 +111,7 @@ func TestCreateConfPlaintextnames(t *testing.T) {

// Reverse mode uses AESSIV
func TestCreateConfFileAESSIV(t *testing.T) {
err := Create("config_test/tmp.conf", testPw, false, 10, "test", true, false, nil)
err := Create("config_test/tmp.conf", testPw, false, 10, "test", true, false)
if err != nil {
t.Fatal(err)
}
Expand Down
4 changes: 0 additions & 4 deletions internal/configfile/feature_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ const (
// Note that this flag does not change the password hashing algorithm
// which always is scrypt.
FlagHKDF
// FlagTrezor means that "-trezor" was used when creating the filesystem.
// The masterkey is protected using a Trezor device instead of a password.
FlagTrezor
)

// knownFlags stores the known feature flags and their string representation
Expand All @@ -40,7 +37,6 @@ var knownFlags = map[flagIota]string{
FlagAESSIV: "AESSIV",
FlagRaw64: "Raw64",
FlagHKDF: "HKDF",
FlagTrezor: "Trezor",
}

// Filesystems that do not have these feature flags set are deprecated.
Expand Down
4 changes: 1 addition & 3 deletions internal/exitcodes/exitcodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,7 @@ const (
FsckErrors = 26
// DeprecatedFS - this filesystem is deprecated
DeprecatedFS = 27
// TrezorError - an error was encountered while interacting with a Trezor
// device
TrezorError = 28
// skip 28
// ExcludeError - an error occurred while processing "-exclude"
ExcludeError = 29
// DevNull means that /dev/null could not be opened
Expand Down
119 changes: 0 additions & 119 deletions internal/readpassword/trezor.go.broken

This file was deleted.

25 changes: 0 additions & 25 deletions internal/readpassword/trezor_disabled.go

This file was deleted.

Loading

0 comments on commit 1364b44

Please sign in to comment.