From ce94dbe662155bd60d6839b5e8c82ad708667bcd Mon Sep 17 00:00:00 2001 From: rsc Date: Sun, 13 Feb 2005 18:04:00 +0000 Subject: add ssh-agent via factotum --- src/cmd/auth/factotum/dsa.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/cmd/auth/factotum/dsa.c') diff --git a/src/cmd/auth/factotum/dsa.c b/src/cmd/auth/factotum/dsa.c index 73f8d296..c0d199e4 100644 --- a/src/cmd/auth/factotum/dsa.c +++ b/src/cmd/auth/factotum/dsa.c @@ -23,7 +23,7 @@ xdsasign(Conv *c) { int n; mpint *m; - uchar digest[SHA1dlen]; + uchar digest[SHA1dlen], sigblob[20+20]; DSAsig *sig; Key *k; @@ -46,7 +46,13 @@ xdsasign(Conv *c) mpfree(m); if(sig == nil) return -1; - convprint(c, "%B %B", sig->r, sig->s); + if(mpsignif(sig->r) > 20*8 || mpsignif(sig->s) > 20*8){ + werrstr("signature too long"); + return -1; + } + mptoberjust(sig->r, sigblob, 20); + mptoberjust(sig->s, sigblob+20, 20); + convwrite(c, sigblob, sizeof sigblob); dsasigfree(sig); return 0; } @@ -80,11 +86,11 @@ readdsapriv(Key *k) || (priv->pub.q=strtomp(a, nil, 16, nil))==nil) goto Error; strlwr(a); - if((a=strfindattr(k->privattr, "alpha"))==nil + if((a=strfindattr(k->attr, "alpha"))==nil || (priv->pub.alpha=strtomp(a, nil, 16, nil))==nil) goto Error; strlwr(a); - if((a=strfindattr(k->privattr, "key"))==nil + if((a=strfindattr(k->attr, "key"))==nil || (priv->pub.key=strtomp(a, nil, 16, nil))==nil) goto Error; strlwr(a); -- cgit v1.2.3