summaryrefslogtreecommitdiff
path: root/libgo/go/crypto/rsa/rsa_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/crypto/rsa/rsa_test.go')
-rw-r--r--libgo/go/crypto/rsa/rsa_test.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/libgo/go/crypto/rsa/rsa_test.go b/libgo/go/crypto/rsa/rsa_test.go
index f9fa56efe72..9be22a8f0bf 100644
--- a/libgo/go/crypto/rsa/rsa_test.go
+++ b/libgo/go/crypto/rsa/rsa_test.go
@@ -21,6 +21,9 @@ func TestKeyGeneration(t *testing.T) {
if err != nil {
t.Errorf("failed to generate key")
}
+ if bits := priv.N.BitLen(); bits != size {
+ t.Errorf("key too short (%d vs %d)", bits, size)
+ }
testKeyBasics(t, priv)
}
@@ -176,7 +179,7 @@ func TestEncryptOAEP(t *testing.T) {
if err != nil {
t.Errorf("#%d,%d error: %s", i, j, err)
}
- if bytes.Compare(out, message.out) != 0 {
+ if !bytes.Equal(out, message.out) {
t.Errorf("#%d,%d bad result: %x (want %x)", i, j, out, message.out)
}
}
@@ -200,7 +203,7 @@ func TestDecryptOAEP(t *testing.T) {
out, err := DecryptOAEP(sha1, nil, private, message.out, nil)
if err != nil {
t.Errorf("#%d,%d error: %s", i, j, err)
- } else if bytes.Compare(out, message.in) != 0 {
+ } else if !bytes.Equal(out, message.in) {
t.Errorf("#%d,%d bad result: %#v (want %#v)", i, j, out, message.in)
}
@@ -208,7 +211,7 @@ func TestDecryptOAEP(t *testing.T) {
out, err = DecryptOAEP(sha1, random, private, message.out, nil)
if err != nil {
t.Errorf("#%d,%d (blind) error: %s", i, j, err)
- } else if bytes.Compare(out, message.in) != 0 {
+ } else if !bytes.Equal(out, message.in) {
t.Errorf("#%d,%d (blind) bad result: %#v (want %#v)", i, j, out, message.in)
}
}