Skip to content

Commit

Permalink
windows: replace uintptr in crypto structs
Browse files Browse the repository at this point in the history
This CL is a copy of CL 106275 (see CL 106275 for details).

It introduces CertInfo, CertTrustListInfo and CertRevocationCrlInfo
types. It uses pointers to new types instead of uintptr in CertContext,
CertSimpleChain and CertRevocationInfo.

CertRevocationInfo, CertChainPolicyPara and CertChainPolicyStatus types
have uintptr field that can be pointer to many different things
(according to Windows API). So this CL introduces Pointer type to be
used for those cases.

Fixes golang/go#25797

Change-Id: I7797ddc6daf3e67b7eab69ab9fbf4d51650f8b6a
Reviewed-on: https://go-review.googlesource.com/118797
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
  • Loading branch information
alexbrainman committed Jun 16, 2018
1 parent 8014b7b commit 6c888cc
Showing 1 changed file with 26 additions and 6 deletions.
32 changes: 26 additions & 6 deletions windows/types_windows.go
Expand Up @@ -312,6 +312,14 @@ var (
OID_SGC_NETSCAPE = []byte("2.16.840.1.113730.4.1\x00")
)

// Pointer represents a pointer to an arbitrary Windows type.
//
// Pointer-typed fields may point to one of many different types. It's
// up to the caller to provide a pointer to the appropriate type, cast
// to Pointer. The caller must obey the unsafe.Pointer rules while
// doing so.
type Pointer *struct{}

// Invented values to support what package os expects.
type Timeval struct {
Sec int32
Expand Down Expand Up @@ -880,11 +888,15 @@ type MibIfRow struct {
Descr [MAXLEN_IFDESCR]byte
}

type CertInfo struct {
// Not implemented
}

type CertContext struct {
EncodingType uint32
EncodedCert *byte
Length uint32
CertInfo uintptr
CertInfo *CertInfo
Store Handle
}

Expand All @@ -899,12 +911,16 @@ type CertChainContext struct {
RevocationFreshnessTime uint32
}

type CertTrustListInfo struct {
// Not implemented
}

type CertSimpleChain struct {
Size uint32
TrustStatus CertTrustStatus
NumElements uint32
Elements **CertChainElement
TrustListInfo uintptr
TrustListInfo *CertTrustListInfo
HasRevocationFreshnessTime uint32
RevocationFreshnessTime uint32
}
Expand All @@ -919,14 +935,18 @@ type CertChainElement struct {
ExtendedErrorInfo *uint16
}

type CertRevocationCrlInfo struct {
// Not implemented
}

type CertRevocationInfo struct {
Size uint32
RevocationResult uint32
RevocationOid *byte
OidSpecificInfo uintptr
OidSpecificInfo Pointer
HasFreshnessTime uint32
FreshnessTime uint32
CrlInfo uintptr // *CertRevocationCrlInfo
CrlInfo *CertRevocationCrlInfo
}

type CertTrustStatus struct {
Expand Down Expand Up @@ -957,7 +977,7 @@ type CertChainPara struct {
type CertChainPolicyPara struct {
Size uint32
Flags uint32
ExtraPolicyPara uintptr
ExtraPolicyPara Pointer
}

type SSLExtraCertChainPolicyPara struct {
Expand All @@ -972,7 +992,7 @@ type CertChainPolicyStatus struct {
Error uint32
ChainIndex uint32
ElementIndex uint32
ExtraPolicyStatus uintptr
ExtraPolicyStatus Pointer
}

const (
Expand Down

0 comments on commit 6c888cc

Please sign in to comment.