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

x/crypto: curve25519 returns broken values #44643

Closed
map0zle opened this issue Feb 26, 2021 · 2 comments
Closed

x/crypto: curve25519 returns broken values #44643

map0zle opened this issue Feb 26, 2021 · 2 comments
Milestone

Comments

@map0zle
Copy link

@map0zle map0zle commented Feb 26, 2021

What version of Go are you using (go version)?

$ go version
go version go1.16 darwin/arm64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GOARCH="arm64"

What did you do?

The value of the public key will be the same every time.
I think the reason is probably that the arm version is not supported.

func generateKeyPair() (privateKey, publicKey *[32]byte) {
	privateKey, publicKey = new([32]byte), new([32]byte)
	if _, err := rand.Read(privateKey[:]); err != nil {
		log.Fatal(err)
	}
	curve25519.ScalarBaseMult(privateKey, publicKey)
	return
}

result

private key >> L+V9o0fNYkMVKNqsX7spBzD/9oSvxM/C7ZCZX1jLO3Q=
public key >> AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=

What did you expect to see?

What did you see instead?

@gopherbot gopherbot added this to the Unreleased milestone Feb 26, 2021
@seankhliao
Copy link
Contributor

@seankhliao seankhliao commented Feb 26, 2021

Your order of arguments is wrong

@seankhliao seankhliao closed this Feb 26, 2021
@map0zle
Copy link
Author

@map0zle map0zle commented Feb 27, 2021

Hi @seankhliao,

What was I expecting?
It outputs the same value every time.
It worked on non-arm64.

What did you see instead?
As shown in PoC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants