summaryrefslogtreecommitdiff
path: root/libgo/go/crypto/subtle/constant_time.go
diff options
context:
space:
mode:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2015-01-15 00:27:56 +0000
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2015-01-15 00:27:56 +0000
commitf11c215565ea0c863197b9666581d69c225619c2 (patch)
tree58a1724fee16d2b03c65678c4dd9b50bb97137a9 /libgo/go/crypto/subtle/constant_time.go
parent2bbc72db3287d2bff87b9640e85830337aac0672 (diff)
downloadgcc-f11c215565ea0c863197b9666581d69c225619c2.tar.gz
libgo, compiler: Upgrade libgo to Go 1.4, except for runtime.
This upgrades all of libgo other than the runtime package to the Go 1.4 release. In Go 1.4 much of the runtime was rewritten into Go. Merging that code will take more time and will not change the API, so I'm putting it off for now. There are a few runtime changes anyhow, to accomodate other packages that rely on minor modifications to the runtime support. The compiler changes slightly to add a one-bit flag to each type descriptor kind that is stored directly in an interface, which for gccgo is currently only pointer types. Another one-bit flag (gcprog) is reserved because it is used by the gc compiler, but gccgo does not currently use it. There is another error check in the compiler since I ran across it during testing. gotools/: * Makefile.am (go_cmd_go_files): Sort entries. Add generate.go. * Makefile.in: Rebuild. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@219627 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo/go/crypto/subtle/constant_time.go')
-rw-r--r--libgo/go/crypto/subtle/constant_time.go5
1 files changed, 2 insertions, 3 deletions
diff --git a/libgo/go/crypto/subtle/constant_time.go b/libgo/go/crypto/subtle/constant_time.go
index 9c4b14a65f6..6f80e7c58dc 100644
--- a/libgo/go/crypto/subtle/constant_time.go
+++ b/libgo/go/crypto/subtle/constant_time.go
@@ -6,12 +6,12 @@
// code but require careful thought to use correctly.
package subtle
-// ConstantTimeCompare returns 1 iff the two equal length slices, x
+// ConstantTimeCompare returns 1 iff the two slices, x
// and y, have equal contents. The time taken is a function of the length of
// the slices and is independent of the contents.
func ConstantTimeCompare(x, y []byte) int {
if len(x) != len(y) {
- panic("subtle: slices have different lengths")
+ return 0
}
var v byte
@@ -62,7 +62,6 @@ func ConstantTimeCopy(v int, x, y []byte) {
for i := 0; i < len(x); i++ {
x[i] = x[i]&xmask | y[i]&ymask
}
- return
}
// ConstantTimeLessOrEq returns 1 if x <= y and 0 otherwise.