diff options
author | Andreas Schneider <asn@cryptomilk.org> | 2011-08-23 21:35:27 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2011-08-25 10:13:23 +0200 |
commit | c5643c0967564e997d84630e45f934b49e43fddf (patch) | |
tree | baee83613ddffd97474a64a953dfd41e2b310775 | |
parent | c5837a6c6335017cd29974a3abf38d54e4357719 (diff) | |
download | libssh-c5643c0967564e997d84630e45f934b49e43fddf.tar.gz libssh-c5643c0967564e997d84630e45f934b49e43fddf.tar.xz libssh-c5643c0967564e997d84630e45f934b49e43fddf.zip |
agent: Remove obsolete agent_sign_data().
-rw-r--r-- | include/libssh/agent.h | 3 | ||||
-rw-r--r-- | src/agent.c | 84 |
2 files changed, 0 insertions, 87 deletions
diff --git a/include/libssh/agent.h b/include/libssh/agent.h index 16dc714..1dc97c7 100644 --- a/include/libssh/agent.h +++ b/include/libssh/agent.h @@ -88,9 +88,6 @@ ssh_key ssh_agent_get_next_ident(struct ssh_session_struct *session, ssh_key ssh_agent_get_first_ident(struct ssh_session_struct *session, char **comment); -ssh_string agent_sign_data(struct ssh_session_struct *session, - struct ssh_buffer_struct *data, - struct ssh_public_key_struct *pubkey); ssh_string ssh_agent_sign_data(ssh_session session, const ssh_key pubkey, struct ssh_buffer_struct *data); diff --git a/src/agent.c b/src/agent.c index ca448bd..548b958 100644 --- a/src/agent.c +++ b/src/agent.c @@ -400,90 +400,6 @@ ssh_key ssh_agent_get_next_ident(struct ssh_session_struct *session, return key; } -ssh_string agent_sign_data(struct ssh_session_struct *session, - struct ssh_buffer_struct *data, - struct ssh_public_key_struct *pubkey) { - struct ssh_string_struct *blob = NULL; - struct ssh_string_struct *sig = NULL; - struct ssh_buffer_struct *request = NULL; - struct ssh_buffer_struct *reply = NULL; - int type = SSH2_AGENT_FAILURE; - int flags = 0; - uint32_t dlen = 0; - - /* create blob from the pubkey */ - blob = publickey_to_string(pubkey); - - request = ssh_buffer_new(); - if (request == NULL) { - goto error; - } - - /* create request */ - if (buffer_add_u8(request, SSH2_AGENTC_SIGN_REQUEST) < 0) { - goto error; - } - - /* adds len + blob */ - if (buffer_add_ssh_string(request, blob) < 0) { - goto error; - } - - /* Add data */ - dlen = buffer_get_rest_len(data); - if (buffer_add_u32(request, htonl(dlen)) < 0) { - goto error; - } - if (buffer_add_data(request, buffer_get_rest(data), dlen) < 0) { - goto error; - } - - if (buffer_add_u32(request, htonl(flags)) < 0) { - goto error; - } - - ssh_string_free(blob); - - reply = ssh_buffer_new(); - if (reply == NULL) { - goto error; - } - - /* send the request */ - if (agent_talk(session, request, reply) < 0) { - ssh_buffer_free(request); - return NULL; - } - ssh_buffer_free(request); - - /* check if reply is valid */ - if (buffer_get_u8(reply, (uint8_t *) &type) != sizeof(uint8_t)) { - goto error; - } - if (agent_failed(type)) { - ssh_log(session, SSH_LOG_RARE, "Agent reports failure in signing the key"); - ssh_buffer_free(reply); - return NULL; - } else if (type != SSH2_AGENT_SIGN_RESPONSE) { - ssh_set_error(session, SSH_FATAL, "Bad authentication response: %d", type); - ssh_buffer_free(reply); - return NULL; - } - - sig = buffer_get_ssh_string(reply); - - ssh_buffer_free(reply); - - return sig; -error: - ssh_set_error(session, SSH_FATAL, "Not enough memory"); - ssh_string_free(blob); - ssh_buffer_free(request); - ssh_buffer_free(reply); - - return NULL; -} - int agent_is_running(ssh_session session) { if (session == NULL || session->agent == NULL) { return 0; |