File tree Expand file tree Collapse file tree 6 files changed +0
-171
lines changed
Expand file tree Collapse file tree 6 files changed +0
-171
lines changed Original file line number Diff line number Diff line change @@ -62,24 +62,6 @@ type PublicKey struct {
6262 X , Y * big.Int
6363}
6464
65- // Equal reports whether pub and x have the same value.
66- //
67- // Two keys are only considered to have the same value if they have the same Curve value.
68- // Note that for example elliptic.P256() and elliptic.P256().Params() are different
69- // values, as the latter is a generic not constant time implementation.
70- func (pub * PublicKey ) Equal (x crypto.PublicKey ) bool {
71- xx , ok := x .(* PublicKey )
72- if ! ok {
73- return false
74- }
75- return pub .X .Cmp (xx .X ) == 0 && pub .Y .Cmp (xx .Y ) == 0 &&
76- // Standard library Curve implementations are singletons, so this check
77- // will work for those. Other Curves might be equivalent even if not
78- // singletons, but there is no definitive way to check for that, and
79- // better to err on the side of safety.
80- pub .Curve == xx .Curve
81- }
82-
8365// PrivateKey represents an ECDSA private key.
8466type PrivateKey struct {
8567 PublicKey
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -40,15 +40,6 @@ const (
4040// PublicKey is the type of Ed25519 public keys.
4141type PublicKey []byte
4242
43- // Equal reports whether pub and x have the same value.
44- func (pub PublicKey ) Equal (x crypto.PublicKey ) bool {
45- xx , ok := x .(PublicKey )
46- if ! ok {
47- return false
48- }
49- return bytes .Equal (pub , xx )
50- }
51-
5243// PrivateKey is the type of Ed25519 private keys. It implements crypto.Signer.
5344type PrivateKey []byte
5445
Original file line number Diff line number Diff line change @@ -88,22 +88,6 @@ func TestCryptoSigner(t *testing.T) {
8888 }
8989}
9090
91- func TestEqual (t * testing.T ) {
92- public , private , _ := GenerateKey (rand .Reader )
93-
94- if ! public .Equal (public ) {
95- t .Errorf ("public key is not equal to itself: %q" , public )
96- }
97- if ! public .Equal (crypto .Signer (private ).Public ().(PublicKey )) {
98- t .Errorf ("private.Public() is not Equal to public: %q" , public )
99- }
100-
101- other , _ , _ := GenerateKey (rand .Reader )
102- if public .Equal (other ) {
103- t .Errorf ("different public keys are Equal" )
104- }
105- }
106-
10791func TestGolden (t * testing.T ) {
10892 // sign.input.gz is a selection of test cases from
10993 // https://ed25519.cr.yp.to/python/sign.input
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -50,15 +50,6 @@ func (pub *PublicKey) Size() int {
5050 return (pub .N .BitLen () + 7 ) / 8
5151}
5252
53- // Equal reports whether pub and x have the same value.
54- func (pub * PublicKey ) Equal (x crypto.PublicKey ) bool {
55- xx , ok := x .(* PublicKey )
56- if ! ok {
57- return false
58- }
59- return pub .N .Cmp (xx .N ) == 0 && pub .E == xx .E
60- }
61-
6253// OAEPOptions is an interface for passing options to OAEP decryption using the
6354// crypto.Decrypter interface.
6455type OAEPOptions struct {
You can’t perform that action at this time.
0 commit comments