From ac4c5699b13faa9d6f10f1b26b3180cebd52cd84 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Fri, 18 Oct 2013 22:46:44 +0200 Subject: pki: Add the type as a char pointer. --- include/libssh/pki.h | 1 + src/pki.c | 2 +- src/pki_crypto.c | 5 ++++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/libssh/pki.h b/include/libssh/pki.h index 96bacd52..89a0f982 100644 --- a/include/libssh/pki.h +++ b/include/libssh/pki.h @@ -60,6 +60,7 @@ struct ssh_key_struct { struct ssh_signature_struct { enum ssh_keytypes_e type; + const char *type_c; #ifdef HAVE_LIBGCRYPT gcry_sexp_t dsa_sig; gcry_sexp_t rsa_sig; diff --git a/src/pki.c b/src/pki.c index 770cfc72..defc4061 100644 --- a/src/pki.c +++ b/src/pki.c @@ -1118,7 +1118,7 @@ int ssh_pki_export_signature_blob(const ssh_signature sig, return SSH_ERROR; } - str = ssh_string_from_char(ssh_key_type_to_char(sig->type)); + str = ssh_string_from_char(sig->type_c); if (str == NULL) { ssh_buffer_free(buf); return SSH_ERROR; diff --git a/src/pki_crypto.c b/src/pki_crypto.c index 92c37c85..82fbe93b 100644 --- a/src/pki_crypto.c +++ b/src/pki_crypto.c @@ -1047,7 +1047,7 @@ ssh_string pki_signature_to_blob(const ssh_signature sig) break; #endif case SSH_KEYTYPE_UNKNOWN: - ssh_pki_log("Unknown signature key type: %d", sig->type); + ssh_pki_log("Unknown signature key type: %s", sig->type_c); return NULL; } @@ -1070,6 +1070,7 @@ ssh_signature pki_signature_from_blob(const ssh_key pubkey, } sig->type = type; + sig->type_c = ssh_key_type_to_char(type); len = ssh_string_len(sig_blob); @@ -1309,6 +1310,7 @@ ssh_signature pki_do_sign(const ssh_key privkey, } sig->type = privkey->type; + sig->type_c = privkey->type_c; switch(privkey->type) { case SSH_KEYTYPE_DSS: @@ -1368,6 +1370,7 @@ ssh_signature pki_do_sign_sessionid(const ssh_key key, return NULL; } sig->type = key->type; + sig->type_c = key->type_c; switch(key->type) { case SSH_KEYTYPE_DSS: -- cgit v1.2.3