New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

keygen & keymgmt should take --passphrase-time parameters #17

Closed
cperciva opened this Issue Jul 14, 2015 · 6 comments

Comments

Projects
None yet
2 participants
@cperciva
Member

cperciva commented Jul 14, 2015

Use case: Running tarsnap-keymgmt to create a super-secure encrypted key file because you're going to be printing it out and storing it offline.

Suggested by: Hugo Landau

@cperciva cperciva self-assigned this Aug 2, 2015

@cperciva

This comment has been minimized.

Show comment
Hide comment
@cperciva

cperciva Aug 7, 2015

Member

See passphrase-time branch.

Member

cperciva commented Aug 7, 2015

See passphrase-time branch.

@cperciva cperciva assigned gperciva and unassigned cperciva Aug 7, 2015

@gperciva

This comment has been minimized.

Show comment
Hide comment
@gperciva

gperciva Aug 7, 2015

Member

note to self: this is not aimed at 1.0.36.

Member

gperciva commented Aug 7, 2015

note to self: this is not aimed at 1.0.36.

@gperciva

This comment has been minimized.

Show comment
Hide comment
@gperciva

gperciva Aug 13, 2015

Member

So in lib/keyfile/keyfile.h, it says:

/**
 * keyfile_write(filename, machinenum, keys, passphrase, maxmem, cputime):
 * Write a key file for the specified machine containing the specified keys.
 * If passphrase is non-NULL, use up to cputime seconds and maxmem bytes of
 * memory to encrypt the key file.
 */
int keyfile_write(const char *, uint64_t, int, char *, size_t, double);

I'm not certain how to interpret "use up to" (in computing terms; obviously I understand the English).

With 8a3a352, I see this:

$ time ./tarsnap-keygen --keyfile keys-60.txt --user gperciva@tarsnap.com --machine gin --passphrase-time 60 --passphrased
Enter tarsnap account password: 
Please enter passphrase for keyfile encryption: 
Please confirm passphrase for keyfile encryption: 

real    0m14.500s
user    0m8.607s
sys 0m0.051s

Obviously it took me a bit of time to enter my password and passphrase, so does --passphrase-time have a real interpretation in seconds? or does it stop much sooner than 60 seconds because I didn't specify a large memory limit?

Member

gperciva commented Aug 13, 2015

So in lib/keyfile/keyfile.h, it says:

/**
 * keyfile_write(filename, machinenum, keys, passphrase, maxmem, cputime):
 * Write a key file for the specified machine containing the specified keys.
 * If passphrase is non-NULL, use up to cputime seconds and maxmem bytes of
 * memory to encrypt the key file.
 */
int keyfile_write(const char *, uint64_t, int, char *, size_t, double);

I'm not certain how to interpret "use up to" (in computing terms; obviously I understand the English).

With 8a3a352, I see this:

$ time ./tarsnap-keygen --keyfile keys-60.txt --user gperciva@tarsnap.com --machine gin --passphrase-time 60 --passphrased
Enter tarsnap account password: 
Please enter passphrase for keyfile encryption: 
Please confirm passphrase for keyfile encryption: 

real    0m14.500s
user    0m8.607s
sys 0m0.051s

Obviously it took me a bit of time to enter my password and passphrase, so does --passphrase-time have a real interpretation in seconds? or does it stop much sooner than 60 seconds because I didn't specify a large memory limit?

@cperciva

This comment has been minimized.

Show comment
Hide comment
@cperciva

cperciva Aug 14, 2015

Member

"use up to" means that the scrypt code tries to figure out how fast your CPU is and picks parameters which it predicts will use that much time. In this case, it clearly underestimated your CPU performance -- possibly because your CPU was clocked down but sped up one it started being used.

Member

cperciva commented Aug 14, 2015

"use up to" means that the scrypt code tries to figure out how fast your CPU is and picks parameters which it predicts will use that much time. In this case, it clearly underestimated your CPU performance -- possibly because your CPU was clocked down but sped up one it started being used.

@gperciva

This comment has been minimized.

Show comment
Hide comment
@gperciva

gperciva Aug 16, 2015

Member

Addressed in PR #38.

Member

gperciva commented Aug 16, 2015

Addressed in PR #38.

@cperciva

This comment has been minimized.

Show comment
Hide comment
@cperciva

cperciva Aug 30, 2015

Member

Fixed in 89d0340.

Member

cperciva commented Aug 30, 2015

Fixed in 89d0340.

@cperciva cperciva closed this Aug 30, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment