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

crypto/tls: keysFromMasterSecret() takes len(clientRandom), but should be server #13181

Closed
RalphCorderoy opened this issue Nov 7, 2015 · 2 comments

Comments

@RalphCorderoy
Copy link

@RalphCorderoy RalphCorderoy commented Nov 7, 2015

Hi @agl,

keysFromMasterSecret() in crypto/tls/prf.go does

copy(seed[0:len(clientRandom)], serverRandom)
copy(seed[len(serverRandom):], clientRandom)

The first len() should be of serverRandom, not clientRandom. It looks like a copy-and-paste error from the previous masterFromPreMasterSecret(). (They're the same length AFAIK, so no fault occurs.)

But I think both functions could have the first copy() be copy(seed, ...) as used elsewhere in prf.go.

@RalphCorderoy

This comment has been minimized.

Copy link
Author

@RalphCorderoy RalphCorderoy commented Nov 7, 2015

@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Nov 7, 2015

CL https://golang.org/cl/16697 mentions this issue.

@agl agl closed this in 9c8cd83 Nov 10, 2015
@golang golang locked and limited conversation to collaborators Nov 10, 2016
FiloSottile pushed a commit to FiloSottile/go that referenced this issue Oct 12, 2018
In keysFromMasterSecret(), don't copy from serverRandom into
seed[:len(clientRandom)].  Actually, switch from an array to a slice in
keysFromMasterSecret() and masterFromPreMasterSecret() so the length
need not be given;  that's how it's done elsewhere in the file.

Fixes golang#13181

Change-Id: I92abaa892d1bba80c2d4f12776341cda7d538837
Reviewed-on: https://go-review.googlesource.com/16697
Run-TryBot: Adam Langley <agl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Adam Langley <agl@golang.org>
FiloSottile pushed a commit to FiloSottile/go that referenced this issue Oct 12, 2018
In keysFromMasterSecret(), don't copy from serverRandom into
seed[:len(clientRandom)].  Actually, switch from an array to a slice in
keysFromMasterSecret() and masterFromPreMasterSecret() so the length
need not be given;  that's how it's done elsewhere in the file.

Fixes golang#13181

Change-Id: I92abaa892d1bba80c2d4f12776341cda7d538837
Reviewed-on: https://go-review.googlesource.com/16697
Run-TryBot: Adam Langley <agl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Adam Langley <agl@golang.org>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.