summaryrefslogtreecommitdiffhomepage
path: root/cli-authpubkey.c
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2013-04-06 16:00:37 +0800
committerMatt Johnston <matt@ucc.asn.au>2013-04-06 16:00:37 +0800
commita8135dec1e8b9360274679c9ff89cb98cda87930 (patch)
tree42cf334c3aac754cdf1a1fb4a9ed0789d49d16b0 /cli-authpubkey.c
parentb4bcc606576dab755441da1bc2fbe28041d54b06 (diff)
Make _sign and _verify functions take a buffer* rather than void* and int
--HG-- branch : ecc
Diffstat (limited to 'cli-authpubkey.c')
-rw-r--r--cli-authpubkey.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/cli-authpubkey.c b/cli-authpubkey.c
index 49853ed..adcf2a8 100644
--- a/cli-authpubkey.c
+++ b/cli-authpubkey.c
@@ -121,23 +121,19 @@ void recv_msg_userauth_pk_ok() {
}
void cli_buf_put_sign(buffer* buf, sign_key *key, int type,
- const unsigned char *data, unsigned int len)
-{
+ buffer *data_buf) {
#ifdef ENABLE_CLI_AGENTFWD
if (key->source == SIGNKEY_SOURCE_AGENT) {
/* Format the agent signature ourselves, as buf_put_sign would. */
buffer *sigblob;
sigblob = buf_new(MAX_PUBKEY_SIZE);
- agent_buf_sign(sigblob, key, data, len);
- buf_setpos(sigblob, 0);
- buf_putstring(buf, buf_getptr(sigblob, sigblob->len),
- sigblob->len);
-
+ agent_buf_sign(sigblob, key, data_buf);
+ buf_putbufstring(buf, sigblob);
buf_free(sigblob);
} else
#endif /* ENABLE_CLI_AGENTFWD */
{
- buf_put_sign(buf, key, type, data, len);
+ buf_put_sign(buf, key, type, data_buf);
}
}
@@ -174,7 +170,7 @@ static void send_msg_userauth_pubkey(sign_key *key, int type, int realsign) {
/* We put the signature as well - this contains string(session id), then
* the contents of the write payload to this point */
sigbuf = buf_new(4 + SHA1_HASH_SIZE + ses.writepayload->len);
- buf_putstring(sigbuf, ses.session_id, SHA1_HASH_SIZE);
+ buf_putbufstring(sigbuf, ses.session_id);
buf_putbytes(sigbuf, ses.writepayload->data, ses.writepayload->len);
cli_buf_put_sign(ses.writepayload, key, type, sigbuf->data, sigbuf->len);
buf_free(sigbuf); /* Nothing confidential in the buffer */