diff options
Diffstat (limited to 'src/or/routerkeys.c')
-rw-r--r-- | src/or/routerkeys.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/or/routerkeys.c b/src/or/routerkeys.c index d38b5a3ba3..955cb9ce23 100644 --- a/src/or/routerkeys.c +++ b/src/or/routerkeys.c @@ -34,14 +34,18 @@ read_encrypted_secret_key(ed25519_secret_key_t *out, r = 0; goto done; } - if (strcmp(tag, ENC_KEY_TAG)) + if (strcmp(tag, ENC_KEY_TAG)) { + saved_errno = EINVAL; goto done; + } while (1) { ssize_t pwlen = tor_getpass("Enter pasphrase for master key:", pwbuf, sizeof(pwbuf)); - if (pwlen < 0) + if (pwlen < 0) { + saved_errno = EINVAL; goto done; + } const int r = crypto_unpwbox(&secret, &secret_len, encrypted_key, encrypted_len, @@ -194,6 +198,10 @@ ed_key_init_from_file(const char *fname, uint32_t flags, const int norepair = !! (flags & INIT_ED_KEY_NO_REPAIR); const int split = !! (flags & INIT_ED_KEY_SPLIT); + /* we don't support setting both of these flags at once. */ + tor_assert((flags & (INIT_ED_KEY_NO_REPAIR|INIT_ED_KEY_NEEDCERT)) != + (INIT_ED_KEY_NO_REPAIR|INIT_ED_KEY_NEEDCERT)); + char tag[8]; tor_snprintf(tag, sizeof(tag), "type%d", (int)cert_type); |