Fill in missing check_bn_tests.go features.
Change-Id: Ic0421b628212521d673cb7053b0fb278c827ebf5 Reviewed-on: https://boringssl-review.googlesource.com/26064 Reviewed-by: Steven Valdez <svaldez@google.com> Commit-Queue: David Benjamin <davidben@google.com> CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
This commit is contained in:
parent
4b6055defb
commit
ac97cc0e51
@ -252,6 +252,18 @@ func main() {
|
||||
r := new(big.Int).ModInverse(test.Values["A"], test.Values["M"])
|
||||
checkResult(test, "A ^ -1 (mod M)", "ModInv", r)
|
||||
}
|
||||
case "ModSquare":
|
||||
if checkKeys(test, "A", "M", "ModSquare") {
|
||||
r := new(big.Int).Mul(test.Values["A"], test.Values["A"])
|
||||
r = r.Mod(r, test.Values["M"])
|
||||
checkResult(test, "A * A (mod M)", "ModSquare", r)
|
||||
}
|
||||
case "NotModSquare":
|
||||
if checkKeys(test, "P", "NotModSquare") {
|
||||
if new(big.Int).ModSqrt(test.Values["NotModSquare"], test.Values["P"]) != nil {
|
||||
fmt.Fprintf(os.Stderr, "Line %d: value was a square.\n", test.LineNumber)
|
||||
}
|
||||
}
|
||||
default:
|
||||
fmt.Fprintf(os.Stderr, "Line %d: unknown test type %q.\n", test.LineNumber, test.Type)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user