diff options
author | Matt Johnston <matt@ucc.asn.au> | 2015-03-01 23:02:06 +0800 |
---|---|---|
committer | Matt Johnston <matt@ucc.asn.au> | 2015-03-01 23:02:06 +0800 |
commit | f782cf375a360eff337f3e8ac8e0d61dc17f80a9 (patch) | |
tree | c10903933a3a3d473775759cf4d3ba9129d57670 /svr-authpubkey.c | |
parent | f367273549350d99f476ad140b083d10a212d186 (diff) |
Fix pubkey auth after change to reuse ses.readbuf as ses.payload
(4d7b4c5526c5)
--HG--
branch : nocircbuffer
Diffstat (limited to 'svr-authpubkey.c')
-rw-r--r-- | svr-authpubkey.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/svr-authpubkey.c b/svr-authpubkey.c index 66fe5e5..e8af319 100644 --- a/svr-authpubkey.c +++ b/svr-authpubkey.c @@ -86,6 +86,7 @@ void svr_auth_pubkey() { unsigned int algolen; unsigned char* keyblob = NULL; unsigned int keybloblen; + unsigned int sign_payload_length; buffer * signbuf = NULL; sign_key * key = NULL; char* fp = NULL; @@ -125,9 +126,18 @@ void svr_auth_pubkey() { /* create the data which has been signed - this a string containing * session_id, concatenated with the payload packet up to the signature */ + assert(ses.payload_beginning <= ses.payload->pos); + sign_payload_length = ses.payload->pos - ses.payload_beginning; signbuf = buf_new(ses.payload->pos + 4 + ses.session_id->len); buf_putbufstring(signbuf, ses.session_id); - buf_putbytes(signbuf, ses.payload->data, ses.payload->pos); + + /* The entire contents of the payload prior. */ + buf_setpos(ses.payload, ses.payload_beginning); + buf_putbytes(signbuf, + buf_getptr(ses.payload, sign_payload_length), + sign_payload_length); + buf_incrpos(ses.payload, sign_payload_length); + buf_setpos(signbuf, 0); /* ... and finally verify the signature */ |