cryptocore, main: add two comments
While reading the code, I had to think about what it does, so add a comment that explains it.
This commit is contained in:
parent
0efd220d1e
commit
bd78b44389
|
@ -53,6 +53,9 @@ type CryptoCore struct {
|
||||||
// Even though the "GCMIV128" feature flag is now mandatory, we must still
|
// Even though the "GCMIV128" feature flag is now mandatory, we must still
|
||||||
// support 96-bit IVs here because they were used for encrypting the master
|
// support 96-bit IVs here because they were used for encrypting the master
|
||||||
// key in gocryptfs.conf up to gocryptfs v1.2. v1.3 switched to 128 bits.
|
// key in gocryptfs.conf up to gocryptfs v1.2. v1.3 switched to 128 bits.
|
||||||
|
//
|
||||||
|
// Note: "key" is either the scrypt hash of the password (when decrypting
|
||||||
|
// a config file) or the masterkey (when finally mounting the filesystem).
|
||||||
func New(key []byte, aeadType AEADTypeEnum, IVBitLen int, useHKDF bool, forceDecode bool) *CryptoCore {
|
func New(key []byte, aeadType AEADTypeEnum, IVBitLen int, useHKDF bool, forceDecode bool) *CryptoCore {
|
||||||
if len(key) != KeyLen {
|
if len(key) != KeyLen {
|
||||||
log.Panic(fmt.Sprintf("Unsupported key length %d", len(key)))
|
log.Panic(fmt.Sprintf("Unsupported key length %d", len(key)))
|
||||||
|
|
2
main.go
2
main.go
|
@ -67,6 +67,8 @@ func changePassword(args *argContainer) {
|
||||||
newPw := readpassword.Twice(args.extpass)
|
newPw := readpassword.Twice(args.extpass)
|
||||||
readpassword.CheckTrailingGarbage()
|
readpassword.CheckTrailingGarbage()
|
||||||
confFile.EncryptKey(masterkey, newPw, confFile.ScryptObject.LogN())
|
confFile.EncryptKey(masterkey, newPw, confFile.ScryptObject.LogN())
|
||||||
|
// Are we resetting the password without knowing the old one using
|
||||||
|
// "-masterkey"?
|
||||||
if args.masterkey != "" {
|
if args.masterkey != "" {
|
||||||
bak := args.config + ".bak"
|
bak := args.config + ".bak"
|
||||||
err = os.Link(args.config, bak)
|
err = os.Link(args.config, bak)
|
||||||
|
|
Loading…
Reference in New Issue