Skip to content

Commit

Permalink
crypto/tls: panic with unknown hash functions.
Browse files Browse the repository at this point in the history
Just so that we notice in the future if another hash function is added
without updating this utility function, make it panic when passed an
unknown handshake hash function. (Which should never happen.)

Change-Id: I60a6fc01669441523d8c44e8fbe7ed435e7f04c8
Reviewed-on: https://go-review.googlesource.com/7646
Reviewed-by: Andrew Gerrand <[email protected]>
Reviewed-by: Joël Stemmer <[email protected]>
  • Loading branch information
agl committed Mar 18, 2015
1 parent 123b38e commit a432568
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/crypto/tls/prf.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"crypto/md5"
"crypto/sha1"
"hash"
"strconv"
)

// Split a premaster secret in two as specified in RFC 4346, section 5.
Expand Down Expand Up @@ -303,5 +304,5 @@ func tls12HashID(h crypto.Hash) uint8 {
case crypto.SHA384:
return hashSHA384
}
return 0
panic("tls12HashID called with unknown hash " + strconv.Itoa(int(h)))
}

0 comments on commit a432568

Please sign in to comment.