瀏覽代碼

go.crypto/ocsp: make the zero value of RequestOptions valid and documented.

R=bradfitz
CC=golang-dev
https://golang.org/cl/10431044
Adam Langley 12 年之前
父節點
當前提交
3f4ad28b7c
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      ocsp/ocsp.go

+ 2 - 2
ocsp/ocsp.go

@@ -261,12 +261,12 @@ type request struct {
 // RequestOptions contains options for constructing OCSP requests.
 type RequestOptions struct {
 	// Hash contains the hash function that should be used when
-	// constructing the OCSP request.
+	// constructing the OCSP request. If zero, SHA-1 will be used.
 	Hash crypto.Hash
 }
 
 func (opts *RequestOptions) hash() crypto.Hash {
-	if opts == nil {
+	if opts == nil || opts.Hash == 0 {
 		// SHA-1 is nearly universally used in OCSP.
 		return crypto.SHA1
 	}