From a8135dec1e8b9360274679c9ff89cb98cda87930 Mon Sep 17 00:00:00 2001 From: Matt Johnston Date: Sat, 6 Apr 2013 16:00:37 +0800 Subject: Make _sign and _verify functions take a buffer* rather than void* and int --HG-- branch : ecc --- cli-authpubkey.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'cli-authpubkey.c') 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 */ -- cgit v1.2.3