Commit 34ee744d authored by Alex Brainman's avatar Alex Brainman

crypto/x509: use syscall.GetVersion instead of internal/syscall/windows.GetVersion

cl8167 introduced internal/syscall/windows.GetVersion, but we already
have that function in syscall.GetVersion. Use that instead.
Also revert all internal/syscall/windows cl8167 changes.

Change-Id: I512a5bf4b3b696e93aaf69e9e8b7df7022670ec0
Reviewed-on: https://go-review.googlesource.com/8302Reviewed-by: default avatarDaniel Theophanes <kardianos@gmail.com>
Reviewed-by: default avatarMinux Ma <minux@golang.org>
parent a2f3d73f
......@@ -4,10 +4,14 @@
package x509
import "internal/syscall/windows"
import "syscall"
func init() {
if major, _ := windows.GetVersion(); major < 6 {
v, err := syscall.GetVersion()
if err != nil {
return
}
if major := byte(v); major < 6 {
// Windows XP SP2 and Windows 2003 do not support SHA2.
// http://blogs.technet.com/b/pki/archive/2010/09/30/sha2-and-windows.aspx
supportSHA2 = false
......
......@@ -97,7 +97,6 @@ const (
//sys GetAdaptersAddresses(family uint32, flags uint32, reserved uintptr, adapterAddresses *IpAdapterAddresses, sizeOfPointer *uint32) (errcode error) = iphlpapi.GetAdaptersAddresses
//sys GetComputerNameEx(nameformat uint32, buf *uint16, n *uint32) (err error) = GetComputerNameExW
//sys getVersion() (v uint32) = GetVersion
const (
ComputerNameNetBIOS = 0
......@@ -110,8 +109,3 @@ const (
ComputerNamePhysicalDnsFullyQualified = 7
ComputerNameMax = 8
)
func GetVersion() (major, minor byte) {
low := uint16(getVersion())
return byte(low), byte(low >> 8)
}
......@@ -13,7 +13,6 @@ var (
procGetAdaptersAddresses = modiphlpapi.NewProc("GetAdaptersAddresses")
procGetComputerNameExW = modkernel32.NewProc("GetComputerNameExW")
procGetVersion = modkernel32.NewProc("GetVersion")
)
func GetAdaptersAddresses(family uint32, flags uint32, reserved uintptr, adapterAddresses *IpAdapterAddresses, sizeOfPointer *uint32) (errcode error) {
......@@ -35,9 +34,3 @@ func GetComputerNameEx(nameformat uint32, buf *uint16, n *uint32) (err error) {
}
return
}
func getVersion() (v uint32) {
r0, _, _ := syscall.Syscall(procGetVersion.Addr(), 0, 0, 0, 0)
v = uint32(r0)
return
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment