mirror of
https://github.com/golang/go
synced 2024-11-21 16:54:46 -07:00
crypto/subtle: unbreak DIT test on openbsd/arm64
OpenBSD already enables DIT on arm64 in both kernel and userland. As such, if DIT is already enabled, do not expect that it can be disabled. Change-Id: If7aae2ace40d97109beefa71c03e0c138a0995ce Reviewed-on: https://go-review.googlesource.com/c/go/+/629995 Reviewed-by: Filippo Valsorda <filippo@golang.org> Reviewed-by: Roland Shoemaker <roland@golang.org> Run-TryBot: Joel Sing <joel@sing.id.au> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
parent
98e719f677
commit
b483f382a2
@ -15,6 +15,8 @@ func TestWithDataIndependentTiming(t *testing.T) {
|
||||
t.Skip("CPU does not support DIT")
|
||||
}
|
||||
|
||||
ditAlreadyEnabled := sys.DITEnabled()
|
||||
|
||||
WithDataIndependentTiming(func() {
|
||||
if !sys.DITEnabled() {
|
||||
t.Fatal("dit not enabled within WithDataIndependentTiming closure")
|
||||
@ -31,7 +33,7 @@ func TestWithDataIndependentTiming(t *testing.T) {
|
||||
}
|
||||
})
|
||||
|
||||
if sys.DITEnabled() {
|
||||
if !ditAlreadyEnabled && sys.DITEnabled() {
|
||||
t.Fatal("dit not unset after returning from WithDataIndependentTiming closure")
|
||||
}
|
||||
}
|
||||
@ -41,12 +43,14 @@ func TestDITPanic(t *testing.T) {
|
||||
t.Skip("CPU does not support DIT")
|
||||
}
|
||||
|
||||
ditAlreadyEnabled := sys.DITEnabled()
|
||||
|
||||
defer func() {
|
||||
e := recover()
|
||||
if e == nil {
|
||||
t.Fatal("didn't panic")
|
||||
}
|
||||
if sys.DITEnabled() {
|
||||
if !ditAlreadyEnabled && sys.DITEnabled() {
|
||||
t.Error("DIT still enabled after panic inside of WithDataIndependentTiming closure")
|
||||
}
|
||||
}()
|
||||
|
Loading…
Reference in New Issue
Block a user