Include format version even without a protection key.

pull/2/head
Christopher Wellons 2017-03-07 09:21:55 -05:00
parent 369b2bce27
commit 2cb2c2d2cb
1 changed files with 2 additions and 1 deletions

View File

@ -617,6 +617,8 @@ write_seckey(const char *file, const u8 *seckey, int iexp)
u8 *buf_protect_hash = buf + SECFILE_PROTECT_HASH;
u8 *buf_seckey = buf + SECFILE_SECKEY;
buf_version[0] = ENCHIVE_FORMAT_VERSION;
if (iexp) {
/* Prompt for a passphrase. */
char pass[2][ENCHIVE_PASSPHRASE_MAX];
@ -636,7 +638,6 @@ write_seckey(const char *file, const u8 *seckey, int iexp)
key_derive(pass[0], protect, iexp, buf_iv);
buf_iterations[0] = iexp;
buf_version[0] = ENCHIVE_FORMAT_VERSION;
sha256_init(sha);
sha256_update(sha, protect, sizeof(protect));