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
cb2e21ff
Commit
cb2e21ff
authored
Jun 19, 2006
by
Juan Lang
Committed by
Alexandre Julliard
Jun 20, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Encode/decode CRL issuing dist points.
parent
0b09ecb2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
144 additions
and
0 deletions
+144
-0
decode.c
dlls/crypt32/decode.c
+49
-0
encode.c
dlls/crypt32/encode.c
+95
-0
encode.c
dlls/crypt32/tests/encode.c
+0
-0
No files found.
dlls/crypt32/decode.c
View file @
cb2e21ff
...
...
@@ -3070,6 +3070,50 @@ static BOOL WINAPI CRYPT_AsnDecodeEnhancedKeyUsage(DWORD dwCertEncodingType,
return
ret
;
}
static
BOOL
WINAPI
CRYPT_AsnDecodeIssuingDistPoint
(
DWORD
dwCertEncodingType
,
LPCSTR
lpszStructType
,
const
BYTE
*
pbEncoded
,
DWORD
cbEncoded
,
DWORD
dwFlags
,
PCRYPT_DECODE_PARA
pDecodePara
,
void
*
pvStructInfo
,
DWORD
*
pcbStructInfo
)
{
BOOL
ret
;
TRACE
(
"%p, %ld, %08lx, %p, %p, %ld
\n
"
,
pbEncoded
,
cbEncoded
,
dwFlags
,
pDecodePara
,
pvStructInfo
,
*
pcbStructInfo
);
__TRY
{
struct
AsnDecodeSequenceItem
items
[]
=
{
{
ASN_CONTEXT
|
ASN_CONSTRUCTOR
|
0
,
offsetof
(
CRL_ISSUING_DIST_POINT
,
DistPointName
),
CRYPT_AsnDecodeDistPointName
,
sizeof
(
CRL_DIST_POINT_NAME
),
TRUE
,
TRUE
,
offsetof
(
CRL_ISSUING_DIST_POINT
,
DistPointName
.
u
.
FullName
.
rgAltEntry
),
0
},
{
ASN_CONTEXT
|
1
,
offsetof
(
CRL_ISSUING_DIST_POINT
,
fOnlyContainsUserCerts
),
CRYPT_AsnDecodeBool
,
sizeof
(
BOOL
),
TRUE
,
FALSE
,
0
},
{
ASN_CONTEXT
|
2
,
offsetof
(
CRL_ISSUING_DIST_POINT
,
fOnlyContainsCACerts
),
CRYPT_AsnDecodeBool
,
sizeof
(
BOOL
),
TRUE
,
FALSE
,
0
},
{
ASN_CONTEXT
|
3
,
offsetof
(
CRL_ISSUING_DIST_POINT
,
OnlySomeReasonFlags
),
CRYPT_AsnDecodeBitsInternal
,
sizeof
(
CRYPT_BIT_BLOB
),
TRUE
,
TRUE
,
offsetof
(
CRL_ISSUING_DIST_POINT
,
OnlySomeReasonFlags
.
pbData
),
0
},
{
ASN_CONTEXT
|
4
,
offsetof
(
CRL_ISSUING_DIST_POINT
,
fIndirectCRL
),
CRYPT_AsnDecodeBool
,
sizeof
(
BOOL
),
TRUE
,
FALSE
,
0
},
};
ret
=
CRYPT_AsnDecodeSequence
(
dwCertEncodingType
,
items
,
sizeof
(
items
)
/
sizeof
(
items
[
0
]),
pbEncoded
,
cbEncoded
,
dwFlags
,
pDecodePara
,
pvStructInfo
,
pcbStructInfo
,
NULL
);
}
__EXCEPT_PAGE_FAULT
{
SetLastError
(
STATUS_ACCESS_VIOLATION
);
ret
=
FALSE
;
}
__ENDTRY
return
ret
;
}
BOOL
WINAPI
CryptDecodeObjectEx
(
DWORD
dwCertEncodingType
,
LPCSTR
lpszStructType
,
const
BYTE
*
pbEncoded
,
DWORD
cbEncoded
,
DWORD
dwFlags
,
PCRYPT_DECODE_PARA
pDecodePara
,
void
*
pvStructInfo
,
DWORD
*
pcbStructInfo
)
...
...
@@ -3179,6 +3223,9 @@ BOOL WINAPI CryptDecodeObjectEx(DWORD dwCertEncodingType, LPCSTR lpszStructType,
case
(
WORD
)
X509_ENHANCED_KEY_USAGE
:
decodeFunc
=
CRYPT_AsnDecodeEnhancedKeyUsage
;
break
;
case
(
WORD
)
X509_ISSUING_DIST_POINT
:
decodeFunc
=
CRYPT_AsnDecodeIssuingDistPoint
;
break
;
default:
FIXME
(
"%d: unimplemented
\n
"
,
LOWORD
(
lpszStructType
));
}
...
...
@@ -3211,6 +3258,8 @@ BOOL WINAPI CryptDecodeObjectEx(DWORD dwCertEncodingType, LPCSTR lpszStructType,
decodeFunc
=
CRYPT_AsnDecodeCRLDistPoints
;
else
if
(
!
strcmp
(
lpszStructType
,
szOID_ENHANCED_KEY_USAGE
))
decodeFunc
=
CRYPT_AsnDecodeEnhancedKeyUsage
;
else
if
(
!
strcmp
(
lpszStructType
,
szOID_ISSUING_DIST_POINT
))
decodeFunc
=
CRYPT_AsnDecodeIssuingDistPoint
;
else
TRACE
(
"OID %s not found or unimplemented, looking for DLL
\n
"
,
debugstr_a
(
lpszStructType
));
...
...
dlls/crypt32/encode.c
View file @
cb2e21ff
...
...
@@ -2241,6 +2241,96 @@ static BOOL WINAPI CRYPT_AsnEncodeEnhancedKeyUsage(DWORD dwCertEncodingType,
return
ret
;
}
static
BOOL
WINAPI
CRYPT_AsnEncodeIssuingDistPoint
(
DWORD
dwCertEncodingType
,
LPCSTR
lpszStructType
,
const
void
*
pvStructInfo
,
DWORD
dwFlags
,
PCRYPT_ENCODE_PARA
pEncodePara
,
BYTE
*
pbEncoded
,
DWORD
*
pcbEncoded
)
{
BOOL
ret
;
__TRY
{
const
CRL_ISSUING_DIST_POINT
*
point
=
(
const
CRL_ISSUING_DIST_POINT
*
)
pvStructInfo
;
struct
AsnEncodeSequenceItem
items
[
6
]
=
{
{
0
}
};
struct
AsnConstructedItem
constructed
=
{
0
};
struct
AsnEncodeTagSwappedItem
swapped
[
5
]
=
{
{
0
}
};
DWORD
cItem
=
0
,
cSwapped
=
0
;
ret
=
TRUE
;
switch
(
point
->
DistPointName
.
dwDistPointNameChoice
)
{
case
CRL_DIST_POINT_NO_NAME
:
/* do nothing */
break
;
case
CRL_DIST_POINT_FULL_NAME
:
swapped
[
cSwapped
].
tag
=
ASN_CONTEXT
|
ASN_CONSTRUCTOR
|
0
;
swapped
[
cSwapped
].
pvStructInfo
=
&
point
->
DistPointName
.
u
.
FullName
;
swapped
[
cSwapped
].
encodeFunc
=
CRYPT_AsnEncodeAltName
;
constructed
.
tag
=
0
;
constructed
.
pvStructInfo
=
&
swapped
[
cSwapped
];
constructed
.
encodeFunc
=
CRYPT_AsnEncodeSwapTag
;
items
[
cItem
].
pvStructInfo
=
&
constructed
;
items
[
cItem
].
encodeFunc
=
CRYPT_AsnEncodeConstructed
;
cSwapped
++
;
cItem
++
;
break
;
default:
SetLastError
(
E_INVALIDARG
);
ret
=
FALSE
;
}
if
(
ret
&&
point
->
fOnlyContainsUserCerts
)
{
swapped
[
cSwapped
].
tag
=
ASN_CONTEXT
|
1
;
swapped
[
cSwapped
].
pvStructInfo
=
&
point
->
fOnlyContainsUserCerts
;
swapped
[
cSwapped
].
encodeFunc
=
CRYPT_AsnEncodeBool
;
items
[
cItem
].
pvStructInfo
=
&
swapped
[
cSwapped
];
items
[
cItem
].
encodeFunc
=
CRYPT_AsnEncodeSwapTag
;
cSwapped
++
;
cItem
++
;
}
if
(
ret
&&
point
->
fOnlyContainsCACerts
)
{
swapped
[
cSwapped
].
tag
=
ASN_CONTEXT
|
2
;
swapped
[
cSwapped
].
pvStructInfo
=
&
point
->
fOnlyContainsCACerts
;
swapped
[
cSwapped
].
encodeFunc
=
CRYPT_AsnEncodeBool
;
items
[
cItem
].
pvStructInfo
=
&
swapped
[
cSwapped
];
items
[
cItem
].
encodeFunc
=
CRYPT_AsnEncodeSwapTag
;
cSwapped
++
;
cItem
++
;
}
if
(
ret
&&
point
->
OnlySomeReasonFlags
.
cbData
)
{
swapped
[
cSwapped
].
tag
=
ASN_CONTEXT
|
3
;
swapped
[
cSwapped
].
pvStructInfo
=
&
point
->
OnlySomeReasonFlags
;
swapped
[
cSwapped
].
encodeFunc
=
CRYPT_AsnEncodeBits
;
items
[
cItem
].
pvStructInfo
=
&
swapped
[
cSwapped
];
items
[
cItem
].
encodeFunc
=
CRYPT_AsnEncodeSwapTag
;
cSwapped
++
;
cItem
++
;
}
if
(
ret
&&
point
->
fIndirectCRL
)
{
swapped
[
cSwapped
].
tag
=
ASN_CONTEXT
|
4
;
swapped
[
cSwapped
].
pvStructInfo
=
&
point
->
fIndirectCRL
;
swapped
[
cSwapped
].
encodeFunc
=
CRYPT_AsnEncodeBool
;
items
[
cItem
].
pvStructInfo
=
&
swapped
[
cSwapped
];
items
[
cItem
].
encodeFunc
=
CRYPT_AsnEncodeSwapTag
;
cSwapped
++
;
cItem
++
;
}
if
(
ret
)
ret
=
CRYPT_AsnEncodeSequence
(
dwCertEncodingType
,
items
,
cItem
,
dwFlags
,
pEncodePara
,
pbEncoded
,
pcbEncoded
);
}
__EXCEPT_PAGE_FAULT
{
SetLastError
(
STATUS_ACCESS_VIOLATION
);
ret
=
FALSE
;
}
__ENDTRY
return
ret
;
}
BOOL
WINAPI
CryptEncodeObjectEx
(
DWORD
dwCertEncodingType
,
LPCSTR
lpszStructType
,
const
void
*
pvStructInfo
,
DWORD
dwFlags
,
PCRYPT_ENCODE_PARA
pEncodePara
,
void
*
pvEncoded
,
DWORD
*
pcbEncoded
)
...
...
@@ -2340,6 +2430,9 @@ BOOL WINAPI CryptEncodeObjectEx(DWORD dwCertEncodingType, LPCSTR lpszStructType,
case
(
WORD
)
X509_ENHANCED_KEY_USAGE
:
encodeFunc
=
CRYPT_AsnEncodeEnhancedKeyUsage
;
break
;
case
(
WORD
)
X509_ISSUING_DIST_POINT
:
encodeFunc
=
CRYPT_AsnEncodeIssuingDistPoint
;
break
;
default:
FIXME
(
"%d: unimplemented
\n
"
,
LOWORD
(
lpszStructType
));
}
...
...
@@ -2372,6 +2465,8 @@ BOOL WINAPI CryptEncodeObjectEx(DWORD dwCertEncodingType, LPCSTR lpszStructType,
encodeFunc
=
CRYPT_AsnEncodeCRLDistPoints
;
else
if
(
!
strcmp
(
lpszStructType
,
szOID_ENHANCED_KEY_USAGE
))
encodeFunc
=
CRYPT_AsnEncodeEnhancedKeyUsage
;
else
if
(
!
strcmp
(
lpszStructType
,
szOID_ISSUING_DIST_POINT
))
encodeFunc
=
CRYPT_AsnEncodeIssuingDistPoint
;
else
TRACE
(
"OID %s not found or unimplemented, looking for DLL
\n
"
,
debugstr_a
(
lpszStructType
));
...
...
dlls/crypt32/tests/encode.c
View file @
cb2e21ff
This diff is collapsed.
Click to expand it.
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