1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-08-08 19:02:06 +03:00

pki: Add ssh_pki_log function.

The plan is to get rid of the session as a parameter to ssh pki key
functions. We don't need a session for it and probably don't want it.
This commit is contained in:
Andreas Schneider
2011-08-16 01:18:36 +02:00
parent 330c713fdb
commit df29df6e35

View File

@@ -46,6 +46,12 @@
#include "libssh/keys.h" #include "libssh/keys.h"
#include "libssh/buffer.h" #include "libssh/buffer.h"
#ifdef DEBUG_CRYPTO
#define ssh_pki_log(fmt, ...) fprintf(stderr, fmt, ##__VA_ARGS__);
#else
#define ssh_pki_log(fmt, ...)
#endif
enum ssh_keytypes_e pki_privatekey_type_from_string(const char *privkey) { enum ssh_keytypes_e pki_privatekey_type_from_string(const char *privkey) {
if (strncmp(privkey, DSA_HEADER_BEGIN, strlen(DSA_HEADER_BEGIN)) == 0) { if (strncmp(privkey, DSA_HEADER_BEGIN, strlen(DSA_HEADER_BEGIN)) == 0) {
return SSH_KEYTYPE_DSS; return SSH_KEYTYPE_DSS;
@@ -356,8 +362,8 @@ int ssh_pki_import_privkey_base64(ssh_session session,
return SSH_ERROR; return SSH_ERROR;
} }
ssh_log(session, SSH_LOG_RARE, "Trying to decode privkey passphrase=%s", ssh_pki_log("Trying to decode privkey passphrase=%s",
passphrase ? "true" : "false"); passphrase ? "true" : "false");
key = pki_private_key_from_base64(session, b64_key, passphrase); key = pki_private_key_from_base64(session, b64_key, passphrase);
if (key == NULL) { if (key == NULL) {