From ddfc031c3bb99a251eb927a71f7f77288c869de3 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Thu, 11 Mar 2010 18:03:53 -0800 Subject: factotum: double-check RSA/DSA keys when loading R=rsc http://codereview.appspot.com/463041 --- src/cmd/auth/factotum/dsa.c | 4 ++++ 1 file changed, 4 insertions(+) (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 c0d199e4..ced10355 100644 --- a/src/cmd/auth/factotum/dsa.c +++ b/src/cmd/auth/factotum/dsa.c @@ -86,6 +86,10 @@ readdsapriv(Key *k) || (priv->pub.q=strtomp(a, nil, 16, nil))==nil) goto Error; strlwr(a); + if(!probably_prime(priv->pub.p, 20) && !probably_prime(priv->pub.q, 20)) { + werrstr("dsa: p or q not prime"); + goto Error; + } if((a=strfindattr(k->attr, "alpha"))==nil || (priv->pub.alpha=strtomp(a, nil, 16, nil))==nil) goto Error; -- cgit v1.2.3