aboutsummaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2015-07-15 10:35:29 -0400
committerNick Mathewson <nickm@torproject.org>2015-07-15 10:35:29 -0400
commit3c28d95ca7c1f7086c2f840254a2d6663beaf935 (patch)
treeb90b857aff3906991532498e7bf1158ac8924a1f /src/or
parent5e8edba3d80bf53e5e5c09c8a87e06d0c69e00b7 (diff)
downloadtor-3c28d95ca7c1f7086c2f840254a2d6663beaf935.tar.gz
tor-3c28d95ca7c1f7086c2f840254a2d6663beaf935.zip
Add more EINVAL errno setting on key read failures
Teor found these. This is for part of #16582.
Diffstat (limited to 'src/or')
-rw-r--r--src/or/routerkeys.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/or/routerkeys.c b/src/or/routerkeys.c
index 946c48bc08..77bbcfd49f 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,