Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
c57a0848
Commit
c57a0848
authored
Oct 10, 2007
by
Juan Lang
Committed by
Alexandre Julliard
Oct 11, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Implement name constraints decoding.
parent
30355fa6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
122 additions
and
1 deletion
+122
-1
decode.c
dlls/crypt32/decode.c
+122
-0
encode.c
dlls/crypt32/tests/encode.c
+0
-1
No files found.
dlls/crypt32/decode.c
View file @
c57a0848
...
...
@@ -4061,6 +4061,123 @@ static BOOL WINAPI CRYPT_AsnDecodeIssuingDistPoint(DWORD dwCertEncodingType,
return
ret
;
}
static
BOOL
CRYPT_AsnDecodeMaximum
(
const
BYTE
*
pbEncoded
,
DWORD
cbEncoded
,
DWORD
dwFlags
,
void
*
pvStructInfo
,
DWORD
*
pcbStructInfo
,
DWORD
*
pcbDecoded
)
{
BOOL
ret
=
FALSE
;
TRACE
(
"%p, %d, %08x, %p, %d, %p
\n
"
,
pbEncoded
,
cbEncoded
,
dwFlags
,
pvStructInfo
,
*
pcbStructInfo
,
pcbDecoded
);
if
(
!
cbEncoded
)
{
SetLastError
(
CRYPT_E_ASN1_EOD
);
return
FALSE
;
}
if
(
pbEncoded
[
0
]
!=
(
ASN_CONTEXT
|
1
))
{
SetLastError
(
CRYPT_E_ASN1_BADTAG
);
return
FALSE
;
}
/* The BOOL is implicit: if the integer is present, then it's TRUE */
ret
=
CRYPT_AsnDecodeIntInternal
(
pbEncoded
,
cbEncoded
,
dwFlags
,
pvStructInfo
?
(
BYTE
*
)
pvStructInfo
+
sizeof
(
BOOL
)
:
NULL
,
pcbStructInfo
,
pcbDecoded
);
if
(
ret
&&
pvStructInfo
)
*
(
BOOL
*
)
pvStructInfo
=
TRUE
;
TRACE
(
"returning %d
\n
"
,
ret
);
return
ret
;
}
static
BOOL
CRYPT_AsnDecodeSubtree
(
const
BYTE
*
pbEncoded
,
DWORD
cbEncoded
,
DWORD
dwFlags
,
void
*
pvStructInfo
,
DWORD
*
pcbStructInfo
,
DWORD
*
pcbDecoded
)
{
BOOL
ret
;
struct
AsnDecodeSequenceItem
items
[]
=
{
{
0
,
offsetof
(
CERT_GENERAL_SUBTREE
,
Base
),
CRYPT_AsnDecodeAltNameEntry
,
sizeof
(
CERT_ALT_NAME_ENTRY
),
TRUE
,
TRUE
,
offsetof
(
CERT_ALT_NAME_ENTRY
,
u
.
pwszURL
),
0
},
{
ASN_CONTEXT
|
0
,
offsetof
(
CERT_GENERAL_SUBTREE
,
dwMinimum
),
CRYPT_AsnDecodeIntInternal
,
sizeof
(
DWORD
),
TRUE
,
FALSE
,
0
,
0
},
{
ASN_CONTEXT
|
1
,
offsetof
(
CERT_GENERAL_SUBTREE
,
fMaximum
),
CRYPT_AsnDecodeMaximum
,
sizeof
(
BOOL
)
+
sizeof
(
DWORD
),
TRUE
,
FALSE
,
0
,
0
},
};
CERT_GENERAL_SUBTREE
*
subtree
=
(
CERT_GENERAL_SUBTREE
*
)
pvStructInfo
;
TRACE
(
"%p, %d, %08x, %p, %d, %p
\n
"
,
pbEncoded
,
cbEncoded
,
dwFlags
,
pvStructInfo
,
*
pcbStructInfo
,
pcbDecoded
);
ret
=
CRYPT_AsnDecodeSequence
(
items
,
sizeof
(
items
)
/
sizeof
(
items
[
0
]),
pbEncoded
,
cbEncoded
,
dwFlags
,
NULL
,
pvStructInfo
,
pcbStructInfo
,
pcbDecoded
,
subtree
?
(
BYTE
*
)
subtree
->
Base
.
u
.
pwszURL
:
NULL
);
if
(
pcbDecoded
)
{
TRACE
(
"%d
\n
"
,
*
pcbDecoded
);
if
(
*
pcbDecoded
<
cbEncoded
)
TRACE
(
"%02x %02x
\n
"
,
*
(
pbEncoded
+
*
pcbDecoded
),
*
(
pbEncoded
+
*
pcbDecoded
+
1
));
}
TRACE
(
"returning %d
\n
"
,
ret
);
return
ret
;
}
static
BOOL
CRYPT_AsnDecodeSubtreeArray
(
const
BYTE
*
pbEncoded
,
DWORD
cbEncoded
,
DWORD
dwFlags
,
void
*
pvStructInfo
,
DWORD
*
pcbStructInfo
,
DWORD
*
pcbDecoded
)
{
BOOL
ret
=
TRUE
;
struct
AsnArrayDescriptor
arrayDesc
=
{
0
,
CRYPT_AsnDecodeSubtree
,
sizeof
(
CERT_GENERAL_SUBTREE
),
TRUE
,
offsetof
(
CERT_GENERAL_SUBTREE
,
Base
.
u
.
pwszURL
)
};
struct
GenericArray
*
array
=
(
struct
GenericArray
*
)
pvStructInfo
;
TRACE
(
"%p, %d, %08x, %p, %d, %p
\n
"
,
pbEncoded
,
cbEncoded
,
dwFlags
,
pvStructInfo
,
*
pcbStructInfo
,
pcbDecoded
);
ret
=
CRYPT_AsnDecodeArray
(
&
arrayDesc
,
pbEncoded
,
cbEncoded
,
dwFlags
,
NULL
,
pvStructInfo
,
pcbStructInfo
,
pcbDecoded
,
array
?
array
->
rgItems
:
NULL
);
return
ret
;
}
static
BOOL
WINAPI
CRYPT_AsnDecodeNameConstraints
(
DWORD
dwCertEncodingType
,
LPCSTR
lpszStructType
,
const
BYTE
*
pbEncoded
,
DWORD
cbEncoded
,
DWORD
dwFlags
,
PCRYPT_DECODE_PARA
pDecodePara
,
void
*
pvStructInfo
,
DWORD
*
pcbStructInfo
)
{
BOOL
ret
=
FALSE
;
TRACE
(
"%p, %d, %08x, %p, %p, %d
\n
"
,
pbEncoded
,
cbEncoded
,
dwFlags
,
pDecodePara
,
pvStructInfo
,
*
pcbStructInfo
);
__TRY
{
struct
AsnDecodeSequenceItem
items
[]
=
{
{
ASN_CONTEXT
|
ASN_CONSTRUCTOR
|
0
,
offsetof
(
CERT_NAME_CONSTRAINTS_INFO
,
cPermittedSubtree
),
CRYPT_AsnDecodeSubtreeArray
,
sizeof
(
struct
GenericArray
),
TRUE
,
TRUE
,
offsetof
(
CERT_NAME_CONSTRAINTS_INFO
,
rgPermittedSubtree
),
0
},
{
ASN_CONTEXT
|
ASN_CONSTRUCTOR
|
1
,
offsetof
(
CERT_NAME_CONSTRAINTS_INFO
,
cExcludedSubtree
),
CRYPT_AsnDecodeSubtreeArray
,
sizeof
(
struct
GenericArray
),
TRUE
,
TRUE
,
offsetof
(
CERT_NAME_CONSTRAINTS_INFO
,
rgExcludedSubtree
),
0
},
};
ret
=
CRYPT_AsnDecodeSequence
(
items
,
sizeof
(
items
)
/
sizeof
(
items
[
0
]),
pbEncoded
,
cbEncoded
,
dwFlags
,
pDecodePara
,
pvStructInfo
,
pcbStructInfo
,
NULL
,
NULL
);
}
__EXCEPT_PAGE_FAULT
{
SetLastError
(
STATUS_ACCESS_VIOLATION
);
}
__ENDTRY
return
ret
;
}
static
BOOL
CRYPT_AsnDecodeIssuerSerialNumber
(
const
BYTE
*
pbEncoded
,
DWORD
cbEncoded
,
DWORD
dwFlags
,
void
*
pvStructInfo
,
DWORD
*
pcbStructInfo
,
DWORD
*
pcbDecoded
)
...
...
@@ -4336,6 +4453,9 @@ static CryptDecodeObjectExFunc CRYPT_GetBuiltinDecoder(DWORD dwCertEncodingType,
case
(
WORD
)
X509_ISSUING_DIST_POINT
:
decodeFunc
=
CRYPT_AsnDecodeIssuingDistPoint
;
break
;
case
(
WORD
)
X509_NAME_CONSTRAINTS
:
decodeFunc
=
CRYPT_AsnDecodeNameConstraints
;
break
;
case
(
WORD
)
PKCS7_SIGNER_INFO
:
decodeFunc
=
CRYPT_AsnDecodePKCSSignerInfo
;
break
;
...
...
@@ -4375,6 +4495,8 @@ static CryptDecodeObjectExFunc CRYPT_GetBuiltinDecoder(DWORD dwCertEncodingType,
decodeFunc
=
CRYPT_AsnDecodeEnhancedKeyUsage
;
else
if
(
!
strcmp
(
lpszStructType
,
szOID_ISSUING_DIST_POINT
))
decodeFunc
=
CRYPT_AsnDecodeIssuingDistPoint
;
else
if
(
!
strcmp
(
lpszStructType
,
szOID_NAME_CONSTRAINTS
))
decodeFunc
=
CRYPT_AsnDecodeNameConstraints
;
return
decodeFunc
;
}
...
...
dlls/crypt32/tests/encode.c
View file @
c57a0848
...
...
@@ -5653,7 +5653,6 @@ static void test_decodeNameConstraints(DWORD dwEncoding)
encodedNameConstraints
[
i
].
encoded
.
pbData
,
encodedNameConstraints
[
i
].
encoded
.
cbData
,
CRYPT_DECODE_ALLOC_FLAG
,
NULL
,
&
constraints
,
&
size
);
todo_wine
ok
(
ret
,
"%d: CryptDecodeObjectEx failed: %08x
\n
"
,
i
,
GetLastError
());
if
(
ret
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment