-
Notifications
You must be signed in to change notification settings - Fork 233
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
x509: make Windows policy parameter type version-specific (#286)
Go 1.11 needs syscall.CertChainPolicyPara.ExtraPolicyPara to have type syscall.Pointer, but in previous versions of Go this had type uintptr. As we have a fork of crypto/x509, our source code for x509 can be a different version than the current compiler. To allow our code to work with both 1.11 and earlier versions, encapsulate the cast into a version-specific function. Fixes #284
- Loading branch information
1 parent
3b560b3
commit 37a384c
Showing
3 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright 2018 The Go Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
// +build go1.11 | ||
|
||
package x509 | ||
|
||
import ( | ||
"syscall" | ||
"unsafe" | ||
) | ||
|
||
// For Go versions >= 1.11, the ExtraPolicyPara field in | ||
// syscall.CertChainPolicyPara is of type syscall.Pointer. See: | ||
// https://github.com/golang/go/commit/4869ec00e87ef | ||
|
||
func convertToPolicyParaType(p unsafe.Pointer) syscall.Pointer { | ||
return (syscall.Pointer)(p) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright 2018 The Go Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
// +build !go1.11 | ||
|
||
package x509 | ||
|
||
import "unsafe" | ||
|
||
// For Go versions before 1.11, the ExtraPolicyPara field in | ||
// syscall.CertChainPolicyPara was of type uintptr. See: | ||
// https://github.com/golang/go/commit/4869ec00e87ef | ||
|
||
func convertToPolicyParaType(p unsafe.Pointer) uintptr { | ||
return uintptr(p) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters