diff options
-rw-r--r-- | src/cmd/auth/factotum/dsa.c | 4 | ||||
-rw-r--r-- | src/cmd/auth/factotum/rsa.c | 4 |
2 files changed, 8 insertions, 0 deletions
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; diff --git a/src/cmd/auth/factotum/rsa.c b/src/cmd/auth/factotum/rsa.c index a865810d..95545f93 100644 --- a/src/cmd/auth/factotum/rsa.c +++ b/src/cmd/auth/factotum/rsa.c @@ -199,6 +199,10 @@ readrsapriv(Key *k) || (priv->q=strtomp(a, nil, 16, nil))==nil) goto Error; strlwr(a); + if(!probably_prime(priv->p, 20) || !probably_prime(priv->q, 20)) { + werrstr("rsa: p or q not prime"); + goto Error; + } if((a=strfindattr(k->privattr, "!kp"))==nil || (priv->kp=strtomp(a, nil, 16, nil))==nil) goto Error; |