equal
deleted
inserted
replaced
|
1 # |
|
2 # Return OpenSSL error messages in ssherr() for SSH_ERR_LIBCRYPTO_ERROR. |
|
3 # |
|
4 # After code refactoring for library-like interfaces,OpenSSL error string |
|
5 # were replaced by generic and vague "error in libcrypto" message. |
|
6 # |
|
7 # This patch returns OpenSSL error strings for SSH_ERR_LIBCRYPTO_ERROR errors. |
|
8 # |
|
9 # Patch submitted upstream: |
|
10 # https://bugzilla.mindrot.org/show_bug.cgi?id=2508 |
|
11 # |
|
12 diff -pur old/ssherr.c new/ssherr.c |
|
13 --- old/ssherr.c |
|
14 +++ new/ssherr.c |
|
15 @@ -17,11 +17,13 @@ |
|
16 |
|
17 #include <errno.h> |
|
18 #include <string.h> |
|
19 +#include <openssl/err.h> |
|
20 #include "ssherr.h" |
|
21 |
|
22 const char * |
|
23 ssh_err(int n) |
|
24 { |
|
25 + static char err_str[256]; |
|
26 switch (n) { |
|
27 case SSH_ERR_SUCCESS: |
|
28 return "success"; |
|
29 @@ -68,7 +70,8 @@ ssh_err(int n) |
|
30 case SSH_ERR_SIGNATURE_INVALID: |
|
31 return "incorrect signature"; |
|
32 case SSH_ERR_LIBCRYPTO_ERROR: |
|
33 - return "error in libcrypto"; /* XXX fetch and return */ |
|
34 + ERR_error_string_n(ERR_get_error(), err_str, sizeof (err_str)); |
|
35 + return err_str; |
|
36 case SSH_ERR_UNEXPECTED_TRAILING_DATA: |
|
37 return "unexpected bytes remain after decoding"; |
|
38 case SSH_ERR_SYSTEM_ERROR: |