From 4a51bc2dfea1e2814195b091268be5bb4783689d Mon Sep 17 00:00:00 2001 From: George Adams Date: Wed, 18 Dec 2024 11:57:09 +0000 Subject: [PATCH 1/3] fix: typo in Ed25519 functions --- ed25519.go | 6 +++--- ed25519_test.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ed25519.go b/ed25519.go index cd237025..700aaafe 100644 --- a/ed25519.go +++ b/ed25519.go @@ -90,7 +90,7 @@ func (k *PrivateKeyEd25519) Public() (*PublicKeyEd25519, error) { if err := extractPKEYPubEd25519(k._pkey, pub); err != nil { return nil, err } - pubk, err := NewPublicKeyEd25119(pub) + pubk, err := NewPublicKeyEd25519(pub) if err != nil { return nil, err } @@ -108,14 +108,14 @@ func GenerateKeyEd25519() (*PrivateKeyEd25519, error) { return priv, nil } -func NewPrivateKeyEd25119(priv []byte) (*PrivateKeyEd25519, error) { +func NewPrivateKeyEd25519(priv []byte) (*PrivateKeyEd25519, error) { if len(priv) != privateKeySizeEd25519 { panic("ed25519: bad private key length: " + strconv.Itoa(len(priv))) } return NewPrivateKeyEd25519FromSeed(priv[:seedSizeEd25519]) } -func NewPublicKeyEd25119(pub []byte) (*PublicKeyEd25519, error) { +func NewPublicKeyEd25519(pub []byte) (*PublicKeyEd25519, error) { if len(pub) != publicKeySizeEd25519 { panic("ed25519: bad public key length: " + strconv.Itoa(len(pub))) } diff --git a/ed25519_test.go b/ed25519_test.go index e4dbb896..33d7dd2b 100644 --- a/ed25519_test.go +++ b/ed25519_test.go @@ -82,7 +82,7 @@ func TestEd25519Malleability(t *testing.T) { 0xb1, 0x08, 0xc3, 0xbd, 0xae, 0x36, 0x9e, 0xf5, 0x49, 0xfa, } - pub, err := openssl.NewPublicKeyEd25119(publicKey) + pub, err := openssl.NewPublicKeyEd25519(publicKey) if err != nil { t.Fatal(err) } From a4fea14147b69b5d6644cd7e75dbe62ab017264e Mon Sep 17 00:00:00 2001 From: George Adams Date: Wed, 18 Dec 2024 12:07:01 +0000 Subject: [PATCH 2/3] add deprecated notices --- ed25519.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ed25519.go b/ed25519.go index 700aaafe..10dfb1ac 100644 --- a/ed25519.go +++ b/ed25519.go @@ -108,6 +108,11 @@ func GenerateKeyEd25519() (*PrivateKeyEd25519, error) { return priv, nil } +// Deprecated: NewPrivateKeyEd25119 has been deprecated in favor of NewPrivateKeyEd25519. +func NewPrivateKeyEd25119(priv []byte) (*PrivateKeyEd25519, error) { + return NewPrivateKeyEd25519(priv) +} + func NewPrivateKeyEd25519(priv []byte) (*PrivateKeyEd25519, error) { if len(priv) != privateKeySizeEd25519 { panic("ed25519: bad private key length: " + strconv.Itoa(len(priv))) @@ -115,6 +120,11 @@ func NewPrivateKeyEd25519(priv []byte) (*PrivateKeyEd25519, error) { return NewPrivateKeyEd25519FromSeed(priv[:seedSizeEd25519]) } +// Deprecated: NewPublicKeyEd25119 has been deprecated in favor of NewPublicKeyEd25519. +func NewPublicKeyEd25119(pub []byte) (*PublicKeyEd25519, error) { + return NewPublicKeyEd25519(pub) +} + func NewPublicKeyEd25519(pub []byte) (*PublicKeyEd25519, error) { if len(pub) != publicKeySizeEd25519 { panic("ed25519: bad public key length: " + strconv.Itoa(len(pub))) From 5fd8a4c93350f2e9bf952497324346c686b8844d Mon Sep 17 00:00:00 2001 From: George Adams Date: Wed, 18 Dec 2024 12:16:58 +0000 Subject: [PATCH 3/3] Update deprecation comments for Ed25519 functions --- ed25519.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ed25519.go b/ed25519.go index 10dfb1ac..f96db2cd 100644 --- a/ed25519.go +++ b/ed25519.go @@ -108,7 +108,7 @@ func GenerateKeyEd25519() (*PrivateKeyEd25519, error) { return priv, nil } -// Deprecated: NewPrivateKeyEd25119 has been deprecated in favor of NewPrivateKeyEd25519. +// Deprecated: use NewPrivateKeyEd25519 instead. func NewPrivateKeyEd25119(priv []byte) (*PrivateKeyEd25519, error) { return NewPrivateKeyEd25519(priv) } @@ -120,7 +120,7 @@ func NewPrivateKeyEd25519(priv []byte) (*PrivateKeyEd25519, error) { return NewPrivateKeyEd25519FromSeed(priv[:seedSizeEd25519]) } -// Deprecated: NewPublicKeyEd25119 has been deprecated in favor of NewPublicKeyEd25519. +// Deprecated: use NewPublicKeyEd25519 instead. func NewPublicKeyEd25119(pub []byte) (*PublicKeyEd25519, error) { return NewPublicKeyEd25519(pub) }