瀏覽代碼

crypto/tls: panic with unknown hash functions.

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 <adg@golang.org>
Reviewed-by: Joël Stemmer <stemmertech@gmail.com>
tls13
Adam Langley 9 年之前
父節點
當前提交
113bae6283
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. +2
    -1
      prf.go

+ 2
- 1
prf.go 查看文件

@@ -10,6 +10,7 @@ import (
"crypto/md5"
"crypto/sha1"
"hash"
"strconv"
)

// Split a premaster secret in two as specified in RFC 4346, section 5.
@@ -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)))
}

Loading…
取消
儲存