]> Cypherpunks repositories - gostls13.git/commit
crypto/rsa: check for primes ≤ 1 in Validate
authorAdam Langley <agl@golang.org>
Sat, 27 Jun 2015 21:50:39 +0000 (14:50 -0700)
committerRuss Cox <rsc@golang.org>
Mon, 29 Jun 2015 19:32:48 +0000 (19:32 +0000)
commit2814906df029aea2130c7065d12be85634229861
tree893716a831dc1fcd94317e2cfda81ee0ee9ad1aa
parent9b2d84efc896b50b5d143fed4fe128237a864a72
crypto/rsa: check for primes ≤ 1 in Validate

Change 7c7126cfeb82894229b9c3d5109e4b04e6cfde0c removed the primality
checking in Validate to save CPU time. That check happened to be
filtering out private keys with primes that were zero or one. Without
that filtering, such primes cause a panic when trying to use such a
private key.

This change specifically checks for and rejects primes ≤ 1 in Validate.

Fixes #11233.

Change-Id: Ie6537edb8250c07a45aaf50dab43227002ee7386
Reviewed-on: https://go-review.googlesource.com/11611
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
src/crypto/rsa/rsa.go
src/crypto/x509/x509_test.go