diff --git a/include/libssh/pki_priv.h b/include/libssh/pki_priv.h index d1ffa8a0..8e9347f6 100644 --- a/include/libssh/pki_priv.h +++ b/include/libssh/pki_priv.h @@ -27,7 +27,10 @@ #define DSA_HEADER_BEGIN "-----BEGIN DSA PRIVATE KEY-----" #define DSA_HEADER_END "-----END DSA PRIVATE KEY-----" -void ssh_pki_log(const char *format, ...) PRINTF_ATTRIBUTE(1, 2); +#define ssh_pki_log(...) \ + _ssh_pki_log(__FUNCTION__, __VA_ARGS__) +void _ssh_pki_log(const char *function, + const char *format, ...) PRINTF_ATTRIBUTE(2, 3); /* SSH Key Functions */ ssh_key pki_key_dup(const ssh_key key, int demote); diff --git a/src/pki.c b/src/pki.c index e34958be..dcb97bb2 100644 --- a/src/pki.c +++ b/src/pki.c @@ -64,18 +64,19 @@ #include "libssh/misc.h" #include "libssh/agent.h" -void ssh_pki_log(const char *format, ...) +void _ssh_pki_log(const char *function, const char *format, ...) { #ifdef DEBUG_CRYPTO - char buffer[1024]; - va_list va; + char buffer[1024]; + va_list va; va_start(va, format); vsnprintf(buffer, sizeof(buffer), format, va); va_end(va); - fprintf(stderr, "%s\n", buffer); + ssh_log_function(function, buffer); #else + (void) function; (void) format; #endif return;