diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2016-07-22 18:15:38 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2016-07-22 18:15:38 +0000 |
commit | 22b955cca564a9a3a5b8c9d9dd1e295b7943c128 (patch) | |
tree | abdbd898676e1f853fca2d7e031d105d7ebcf676 /libgo/go/crypto/elliptic | |
parent | 9d04a3af4c6491536badf6bde9707c907e4d196b (diff) | |
download | gcc-22b955cca564a9a3a5b8c9d9dd1e295b7943c128.zip gcc-22b955cca564a9a3a5b8c9d9dd1e295b7943c128.tar.gz gcc-22b955cca564a9a3a5b8c9d9dd1e295b7943c128.tar.bz2 |
libgo: update to go1.7rc3
Reviewed-on: https://go-review.googlesource.com/25150
From-SVN: r238662
Diffstat (limited to 'libgo/go/crypto/elliptic')
-rw-r--r-- | libgo/go/crypto/elliptic/p224.go | 2 | ||||
-rw-r--r-- | libgo/go/crypto/elliptic/p224_test.go | 2 | ||||
-rw-r--r-- | libgo/go/crypto/elliptic/p256.go | 6 | ||||
-rw-r--r-- | libgo/go/crypto/elliptic/p256_amd64.go | 10 |
4 files changed, 12 insertions, 8 deletions
diff --git a/libgo/go/crypto/elliptic/p224.go b/libgo/go/crypto/elliptic/p224.go index 2d3fac7..de266ca 100644 --- a/libgo/go/crypto/elliptic/p224.go +++ b/libgo/go/crypto/elliptic/p224.go @@ -1,4 +1,4 @@ -// Copyright 2012 The Go Authors. All rights reserved. +// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. diff --git a/libgo/go/crypto/elliptic/p224_test.go b/libgo/go/crypto/elliptic/p224_test.go index 4b26d16..8b4fa04 100644 --- a/libgo/go/crypto/elliptic/p224_test.go +++ b/libgo/go/crypto/elliptic/p224_test.go @@ -1,4 +1,4 @@ -// Copyright 2012 The Go Authors. All rights reserved. +// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. diff --git a/libgo/go/crypto/elliptic/p256.go b/libgo/go/crypto/elliptic/p256.go index 5103e86..05a3311 100644 --- a/libgo/go/crypto/elliptic/p256.go +++ b/libgo/go/crypto/elliptic/p256.go @@ -1,4 +1,4 @@ -// Copyright 2013 The Go Authors. All rights reserved. +// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. @@ -1056,7 +1056,7 @@ func p256ScalarBaseMult(xOut, yOut, zOut *[p256Limbs]uint32, scalar *[32]uint8) p256CopyConditional(yOut, &ty, mask) p256CopyConditional(zOut, &tz, mask) // If p was not zero, then n is now non-zero. - nIsInfinityMask &= ^pIsNoninfiniteMask + nIsInfinityMask &^= pIsNoninfiniteMask } } } @@ -1136,7 +1136,7 @@ func p256ScalarMult(xOut, yOut, zOut, x, y *[p256Limbs]uint32, scalar *[32]uint8 p256CopyConditional(xOut, &tx, mask) p256CopyConditional(yOut, &ty, mask) p256CopyConditional(zOut, &tz, mask) - nIsInfinityMask &= ^pIsNoninfiniteMask + nIsInfinityMask &^= pIsNoninfiniteMask } } diff --git a/libgo/go/crypto/elliptic/p256_amd64.go b/libgo/go/crypto/elliptic/p256_amd64.go index 586cd10..66b7cf8 100644 --- a/libgo/go/crypto/elliptic/p256_amd64.go +++ b/libgo/go/crypto/elliptic/p256_amd64.go @@ -66,7 +66,7 @@ func p256NegCond(val []uint64, cond int) // if cond == 0 res <- b; else res <- a func p256MovCond(res, a, b []uint64, cond int) -// Endianess swap +// Endianness swap func p256BigToLittle(res []uint64, in []byte) func p256LittleToBig(res []byte, in []uint64) @@ -93,10 +93,14 @@ func p256PointAddAsm(res, in1, in2 []uint64) func p256PointDoubleAsm(res, in []uint64) func (curve p256Curve) Inverse(k *big.Int) *big.Int { + if k.Sign() < 0 { + // This should never happen. + k = new(big.Int).Neg(k) + } + if k.Cmp(p256.N) >= 0 { // This should never happen. - reducedK := new(big.Int).Mod(k, p256.N) - k = reducedK + k = new(big.Int).Mod(k, p256.N) } // table will store precomputed powers of x. The four words at index |