Skip to content

Commit 6c888cc

Browse files
committed
windows: replace uintptr in crypto structs
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 <[email protected]> Run-TryBot: Alex Brainman <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
1 parent 8014b7b commit 6c888cc

File tree

1 file changed

+26
-6
lines changed

1 file changed

+26
-6
lines changed

windows/types_windows.go

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,14 @@ var (
312312
OID_SGC_NETSCAPE = []byte("2.16.840.1.113730.4.1\x00")
313313
)
314314

315+
// Pointer represents a pointer to an arbitrary Windows type.
316+
//
317+
// Pointer-typed fields may point to one of many different types. It's
318+
// up to the caller to provide a pointer to the appropriate type, cast
319+
// to Pointer. The caller must obey the unsafe.Pointer rules while
320+
// doing so.
321+
type Pointer *struct{}
322+
315323
// Invented values to support what package os expects.
316324
type Timeval struct {
317325
Sec int32
@@ -880,11 +888,15 @@ type MibIfRow struct {
880888
Descr [MAXLEN_IFDESCR]byte
881889
}
882890

891+
type CertInfo struct {
892+
// Not implemented
893+
}
894+
883895
type CertContext struct {
884896
EncodingType uint32
885897
EncodedCert *byte
886898
Length uint32
887-
CertInfo uintptr
899+
CertInfo *CertInfo
888900
Store Handle
889901
}
890902

@@ -899,12 +911,16 @@ type CertChainContext struct {
899911
RevocationFreshnessTime uint32
900912
}
901913

914+
type CertTrustListInfo struct {
915+
// Not implemented
916+
}
917+
902918
type CertSimpleChain struct {
903919
Size uint32
904920
TrustStatus CertTrustStatus
905921
NumElements uint32
906922
Elements **CertChainElement
907-
TrustListInfo uintptr
923+
TrustListInfo *CertTrustListInfo
908924
HasRevocationFreshnessTime uint32
909925
RevocationFreshnessTime uint32
910926
}
@@ -919,14 +935,18 @@ type CertChainElement struct {
919935
ExtendedErrorInfo *uint16
920936
}
921937

938+
type CertRevocationCrlInfo struct {
939+
// Not implemented
940+
}
941+
922942
type CertRevocationInfo struct {
923943
Size uint32
924944
RevocationResult uint32
925945
RevocationOid *byte
926-
OidSpecificInfo uintptr
946+
OidSpecificInfo Pointer
927947
HasFreshnessTime uint32
928948
FreshnessTime uint32
929-
CrlInfo uintptr // *CertRevocationCrlInfo
949+
CrlInfo *CertRevocationCrlInfo
930950
}
931951

932952
type CertTrustStatus struct {
@@ -957,7 +977,7 @@ type CertChainPara struct {
957977
type CertChainPolicyPara struct {
958978
Size uint32
959979
Flags uint32
960-
ExtraPolicyPara uintptr
980+
ExtraPolicyPara Pointer
961981
}
962982

963983
type SSLExtraCertChainPolicyPara struct {
@@ -972,7 +992,7 @@ type CertChainPolicyStatus struct {
972992
Error uint32
973993
ChainIndex uint32
974994
ElementIndex uint32
975-
ExtraPolicyStatus uintptr
995+
ExtraPolicyStatus Pointer
976996
}
977997

978998
const (

0 commit comments

Comments
 (0)