Skip to content

Commit 95aa7ca

Browse files
committed
Fix node bootstrap challenge response hashing
The previous `hasher.Sum(nonce)` doesn't feed data into the hasher so the resulting `hasher.Sum(nil)` was always identical. This replaces those `hasher.Sum()` calls with `hasher.Write()`
1 parent 8dcc550 commit 95aa7ca

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

pkg/bootstrap/challenge_server.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,11 @@ func (s *ChallengeServer) Challenge(ctx context.Context, req *pb.ChallengeReques
205205
return response, nil
206206
}
207207

208-
func buildChallengeResponse(nodeNonce []byte, kopsControllerNonde []byte) []byte {
208+
func buildChallengeResponse(nodeNonce []byte, kopsControllerNonce []byte) []byte {
209209
// Arguably this is overkill because the TLS handshake is stronger and everything is encrypted.
210210
hasher := sha256.New()
211-
hasher.Sum(nodeNonce)
212-
hasher.Sum(kopsControllerNonde)
211+
hasher.Write(nodeNonce)
212+
hasher.Write(kopsControllerNonce)
213213

214214
hash := hasher.Sum(nil)
215215

0 commit comments

Comments
 (0)