Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: typo in Ed25519 functions #236

Open
wants to merge 3 commits into
base: v2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion ed25519.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -108,14 +108,24 @@ func GenerateKeyEd25519() (*PrivateKeyEd25519, error) {
return priv, nil
}

// Deprecated: use NewPrivateKeyEd25519 instead.
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)))
}
return NewPrivateKeyEd25519FromSeed(priv[:seedSizeEd25519])
}

// Deprecated: use NewPublicKeyEd25519 instead.
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)))
}
Expand Down
2 changes: 1 addition & 1 deletion ed25519_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
Loading