diff options
author | Andreas Schneider <asn@cryptomilk.org> | 2011-08-22 12:57:01 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2011-08-22 12:57:01 +0200 |
commit | a2e08697b1a24066c9870fe4bd61133de7f2663c (patch) | |
tree | c0661112c63e56d124c0f25db5078bc1b44e3c83 /src/keys.c | |
parent | ca9b01af991d1e7080bef2bb8c9540538eb0df12 (diff) | |
download | libssh-a2e08697b1a24066c9870fe4bd61133de7f2663c.tar.gz libssh-a2e08697b1a24066c9870fe4bd61133de7f2663c.tar.xz libssh-a2e08697b1a24066c9870fe4bd61133de7f2663c.zip |
messages: Move ssh_userauth_build_digest() and make it static.
Diffstat (limited to 'src/keys.c')
-rw-r--r-- | src/keys.c | 64 |
1 files changed, 0 insertions, 64 deletions
@@ -380,70 +380,6 @@ ssh_string ssh_do_sign_with_agent(ssh_session session, #endif /* _WIN32 */ /* - * This function concats in a buffer the values needed to do a signature - * verification. */ -ssh_buffer ssh_userauth_build_digest(ssh_session session, ssh_message msg, char *service) { -/* - The value of 'signature' is a signature by the corresponding private - key over the following data, in the following order: - - string session identifier - byte SSH_MSG_USERAUTH_REQUEST - string user name - string service name - string "publickey" - boolean TRUE - string public key algorithm name - string public key to be used for authentication -*/ - struct ssh_crypto_struct *crypto = session->current_crypto ? session->current_crypto : - session->next_crypto; - ssh_buffer buffer = NULL; - ssh_string session_id = NULL; - uint8_t type = SSH2_MSG_USERAUTH_REQUEST; - ssh_string username = ssh_string_from_char(msg->auth_request.username); - ssh_string servicename = ssh_string_from_char(service); - ssh_string method = ssh_string_from_char("publickey"); - uint8_t has_sign = 1; - ssh_string algo = ssh_string_from_char(msg->auth_request.public_key->type_c); - ssh_string publickey = publickey_to_string(msg->auth_request.public_key); - - buffer = ssh_buffer_new(); - if (buffer == NULL) { - goto error; - } - session_id = ssh_string_new(SHA_DIGEST_LEN); - if (session_id == NULL) { - ssh_buffer_free(buffer); - buffer = NULL; - goto error; - } - ssh_string_fill(session_id, crypto->session_id, SHA_DIGEST_LEN); - - if(buffer_add_ssh_string(buffer, session_id) < 0 || - buffer_add_u8(buffer, type) < 0 || - buffer_add_ssh_string(buffer, username) < 0 || - buffer_add_ssh_string(buffer, servicename) < 0 || - buffer_add_ssh_string(buffer, method) < 0 || - buffer_add_u8(buffer, has_sign) < 0 || - buffer_add_ssh_string(buffer, algo) < 0 || - buffer_add_ssh_string(buffer, publickey) < 0) { - ssh_buffer_free(buffer); - buffer = NULL; - goto error; - } - -error: - if(session_id) ssh_string_free(session_id); - if(username) ssh_string_free(username); - if(servicename) ssh_string_free(servicename); - if(method) ssh_string_free(method); - if(algo) ssh_string_free(algo); - if(publickey) ssh_string_free(publickey); - return buffer; -} - -/* * This function signs the session id (known as H) as a string then * the content of sigbuf */ ssh_string ssh_do_sign(ssh_session session, ssh_buffer sigbuf, |