|
Lines 41-46
Link Here
|
| 41 |
#include <sys/stat.h> |
41 |
#include <sys/stat.h> |
| 42 |
|
42 |
|
| 43 |
#ifdef WITH_OPENSSL |
43 |
#ifdef WITH_OPENSSL |
|
|
44 |
# include <openssl/err.h> |
| 44 |
# include <openssl/evp.h> |
45 |
# include <openssl/evp.h> |
| 45 |
# include "openbsd-compat/openssl-compat.h" |
46 |
# include "openbsd-compat/openssl-compat.h" |
| 46 |
#endif |
47 |
#endif |
|
Lines 260-268
add_file(int agent_fd, const char *filename, int key_only, int qflag,
Link Here
|
| 260 |
return -1; |
261 |
return -1; |
| 261 |
} |
262 |
} |
| 262 |
} |
263 |
} |
|
|
264 |
ERR_load_crypto_strings(); |
| 263 |
if ((r = sshbuf_load_fd(fd, &keyblob)) != 0) { |
265 |
if ((r = sshbuf_load_fd(fd, &keyblob)) != 0) { |
| 264 |
fprintf(stderr, "Error loading key \"%s\": %s\n", |
266 |
fprintf(stderr, "%d: Error loading key \"%s\": %s\n", |
| 265 |
filename, ssh_err(r)); |
267 |
__LINE__, filename, ssh_err(r)); |
| 266 |
sshbuf_free(keyblob); |
268 |
sshbuf_free(keyblob); |
| 267 |
close(fd); |
269 |
close(fd); |
| 268 |
return -1; |
270 |
return -1; |
|
Lines 272-287
add_file(int agent_fd, const char *filename, int key_only, int qflag,
Link Here
|
| 272 |
/* At first, try empty passphrase */ |
274 |
/* At first, try empty passphrase */ |
| 273 |
if ((r = sshkey_parse_private_fileblob(keyblob, "", &private, |
275 |
if ((r = sshkey_parse_private_fileblob(keyblob, "", &private, |
| 274 |
&comment)) != 0 && r != SSH_ERR_KEY_WRONG_PASSPHRASE) { |
276 |
&comment)) != 0 && r != SSH_ERR_KEY_WRONG_PASSPHRASE) { |
| 275 |
fprintf(stderr, "Error loading key \"%s\": %s\n", |
277 |
fprintf(stderr, "%d: Error loading key \"%s\": %s\n", |
| 276 |
filename, ssh_err(r)); |
278 |
__LINE__, filename, ssh_err(r)); |
| 277 |
goto fail_load; |
279 |
goto fail_load; |
| 278 |
} |
280 |
} |
| 279 |
/* try last */ |
281 |
/* try last */ |
| 280 |
if (private == NULL && pass != NULL) { |
282 |
if (private == NULL && pass != NULL) { |
| 281 |
if ((r = sshkey_parse_private_fileblob(keyblob, pass, &private, |
283 |
if ((r = sshkey_parse_private_fileblob(keyblob, pass, &private, |
| 282 |
&comment)) != 0 && r != SSH_ERR_KEY_WRONG_PASSPHRASE) { |
284 |
&comment)) != 0 && r != SSH_ERR_KEY_WRONG_PASSPHRASE) { |
| 283 |
fprintf(stderr, "Error loading key \"%s\": %s\n", |
285 |
fprintf(stderr, "%d: Error loading key \"%s\": %s\n", |
| 284 |
filename, ssh_err(r)); |
286 |
__LINE__, filename, ssh_err(r)); |
| 285 |
goto fail_load; |
287 |
goto fail_load; |
| 286 |
} |
288 |
} |
| 287 |
} |
289 |
} |
|
Lines 299-307
add_file(int agent_fd, const char *filename, int key_only, int qflag,
Link Here
|
| 299 |
break; |
301 |
break; |
| 300 |
else if (r != SSH_ERR_KEY_WRONG_PASSPHRASE) { |
302 |
else if (r != SSH_ERR_KEY_WRONG_PASSPHRASE) { |
| 301 |
fprintf(stderr, |
303 |
fprintf(stderr, |
| 302 |
"Error loading key \"%s\": %s\n", |
304 |
"%d: Error loading key \"%s\": %s\n", |
| 303 |
filename, ssh_err(r)); |
305 |
__LINE__, filename, ssh_err(r)); |
| 304 |
fail_load: |
306 |
fail_load: |
|
|
307 |
if (r == SSH_ERR_LIBCRYPTO_ERROR) |
| 308 |
ERR_print_errors_fp(stderr); |
| 305 |
clear_pass(); |
309 |
clear_pass(); |
| 306 |
sshbuf_free(keyblob); |
310 |
sshbuf_free(keyblob); |
| 307 |
return -1; |
311 |
return -1; |