]> Cypherpunks repositories - gostls13.git/commit
crypto/subtle: make ConstantTimeCompare return zero for args of different length.
authorDavid Symonds <dsymonds@golang.org>
Tue, 22 Jul 2014 00:08:23 +0000 (10:08 +1000)
committerDavid Symonds <dsymonds@golang.org>
Tue, 22 Jul 2014 00:08:23 +0000 (10:08 +1000)
commit446bfffcd6cfcaca141988a9d844aac61a704866
tree59d976cd965026c5718e4d7bc7c42e2c75869424
parent7bcbdbd904eeaf671c608b183ae363dfa1b53ad6
crypto/subtle: make ConstantTimeCompare return zero for args of different length.

This is more useful than panicking, since otherwise every caller needs
to do the length check before calling; some will forget, and have a
potential submarine crasher as a result. Other implementations of this
functionality do a length check.

This is backward compatible, except if someone has written code that
relies on this panicking with different length args. However, that was
not the case before Go 1.3 either.

Updates #7304.

LGTM=agl
R=agl, minux, hanwen
CC=golang-codereviews
https://golang.org/cl/118750043
src/pkg/crypto/subtle/constant_time.go
src/pkg/crypto/subtle/constant_time_test.go