summaryrefslogtreecommitdiffhomepage
path: root/svr-authpubkey.c
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2004-08-03 15:51:55 +0000
committerMatt Johnston <matt@ucc.asn.au>2004-08-03 15:51:55 +0000
commit7a854cb1f8ffb4ec8f81b8ec50cc42c165839ff3 (patch)
tree940a782c38b9283735af6f5170db69027d56c4d6 /svr-authpubkey.c
parent9c91ea1caf8a7263d830de0bbd5f3b183940b595 (diff)
Improved signkey code
--HG-- extra : convert_revision : fcf64cb4d2e273f80bf8c5f1d2dd00a0f4dc1acf
Diffstat (limited to 'svr-authpubkey.c')
-rw-r--r--svr-authpubkey.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/svr-authpubkey.c b/svr-authpubkey.c
index 9c58a8d..e6cc606 100644
--- a/svr-authpubkey.c
+++ b/svr-authpubkey.c
@@ -58,7 +58,6 @@ void svr_auth_pubkey() {
unsigned char* keyblob;
unsigned int keybloblen;
buffer * signbuf = NULL;
- unsigned int sigoffset;
sign_key * key = NULL;
char* fp = NULL;
int type = -1;
@@ -99,14 +98,9 @@ void svr_auth_pubkey() {
* session_id, concatenated with the payload packet up to the signature */
signbuf = buf_new(ses.payload->pos + 4 + SHA1_HASH_SIZE);
buf_putstring(signbuf, ses.session_id, SHA1_HASH_SIZE);
- sigoffset = ses.payload->pos;
- buf_setpos(ses.payload, 0);
- memcpy(buf_getwriteptr(signbuf, sigoffset),
- buf_getptr(ses.payload, sigoffset), sigoffset);
- buf_incrwritepos(signbuf, sigoffset);
- buf_setpos(ses.payload, sigoffset);
-
+ buf_putbytes(signbuf, ses.payload->data, ses.payload->pos);
buf_setpos(signbuf, 0);
+
/* ... and finally verify the signature */
fp = sign_key_fingerprint(key, type);
if (buf_verify(ses.payload, key, buf_getptr(signbuf, signbuf->len),