aboutsummaryrefslogtreecommitdiff
path: root/src/agent.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/agent.c')
-rw-r--r--src/agent.c84
1 files changed, 0 insertions, 84 deletions
diff --git a/src/agent.c b/src/agent.c
index ca448bdd..548b958d 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;