Module: wine
Branch: master
Commit: 9d0dccf164c508c3d98ec03bb78aab5752763bc3
URL: http://source.winehq.org/git/wine.git/?a=commit;h=9d0dccf164c508c3d98ec03bb…
Author: Juan Lang <juan.lang(a)gmail.com>
Date: Mon Sep 17 17:04:02 2007 -0700
crypt32: Move a comment that belonged elsewhere.
---
dlls/crypt32/decode.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/dlls/crypt32/decode.c b/dlls/crypt32/decode.c
index f89fbe5..9cc4c0c 100644
--- a/dlls/crypt32/decode.c
+++ b/dlls/crypt32/decode.c
@@ -289,6 +289,7 @@ struct AsnDecodeSequenceItem
* pvStructInfo. nextData is a pointer to the memory location at which the
* first decoded item with a dynamic pointer should point.
* Upon decoding, *cbDecoded is the total number of bytes decoded.
+ * Each item decoder is never called with CRYPT_DECODE_ALLOC_FLAG set.
*/
static BOOL CRYPT_AsnDecodeSequenceItems(DWORD dwCertEncodingType,
struct AsnDecodeSequenceItem items[], DWORD cItem, const BYTE *pbEncoded,
@@ -407,7 +408,6 @@ static BOOL CRYPT_AsnDecodeSequenceItems(DWORD dwCertEncodingType,
* startingPointer is an optional pointer to the first place where dynamic
* data will be stored. If you know the starting offset, you may pass it
* here. Otherwise, pass NULL, and one will be inferred from the items.
- * Each item decoder is never called with CRYPT_DECODE_ALLOC_FLAG set.
*/
static BOOL CRYPT_AsnDecodeSequence(DWORD dwCertEncodingType,
struct AsnDecodeSequenceItem items[], DWORD cItem, const BYTE *pbEncoded,
Module: wine
Branch: master
Commit: 7ecf5becbd9ce7f62a80cc4294db1f44a62a17c1
URL: http://source.winehq.org/git/wine.git/?a=commit;h=7ecf5becbd9ce7f62a80cc429…
Author: Juan Lang <juan.lang(a)gmail.com>
Date: Mon Sep 17 15:09:16 2007 -0700
crypt32: Introduce a helper function to get encoded length that allows indefinite-length encoding.
---
dlls/crypt32/decode.c | 25 ++++++++++++++++++++-----
1 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/dlls/crypt32/decode.c b/dlls/crypt32/decode.c
index 0421bd0..67f79d5 100644
--- a/dlls/crypt32/decode.c
+++ b/dlls/crypt32/decode.c
@@ -135,9 +135,11 @@ static BOOL WINAPI CRYPT_AsnDecodeUnsignedIntegerInternal(
/* Helper function to get the encoded length of the data starting at pbEncoded,
* where pbEncoded[0] is the tag. If the data are too short to contain a
* length or if the length is too large for cbEncoded, sets an appropriate
- * error code and returns FALSE.
+ * error code and returns FALSE. If the encoded length is unknown due to
+ * indefinite length encoding, *len is set to CMSG_INDEFINITE_LENGTH.
*/
-static BOOL CRYPT_GetLen(const BYTE *pbEncoded, DWORD cbEncoded, DWORD *len)
+static BOOL CRYPT_GetLengthIndefinite(const BYTE *pbEncoded, DWORD cbEncoded,
+ DWORD *len)
{
BOOL ret;
@@ -161,9 +163,8 @@ static BOOL CRYPT_GetLen(const BYTE *pbEncoded, DWORD cbEncoded, DWORD *len)
}
else if (pbEncoded[1] == 0x80)
{
- FIXME("unimplemented for indefinite-length encoding\n");
- SetLastError(CRYPT_E_ASN1_CORRUPT);
- ret = FALSE;
+ *len = CMSG_INDEFINITE_LENGTH;
+ ret = TRUE;
}
else
{
@@ -204,6 +205,20 @@ static BOOL CRYPT_GetLen(const BYTE *pbEncoded, DWORD cbEncoded, DWORD *len)
return ret;
}
+/* Like CRYPT_GetLengthIndefinite, but disallows indefinite-length encoding. */
+static BOOL CRYPT_GetLen(const BYTE *pbEncoded, DWORD cbEncoded, DWORD *len)
+{
+ BOOL ret;
+
+ if ((ret = CRYPT_GetLengthIndefinite(pbEncoded, cbEncoded, len)) &&
+ *len == CMSG_INDEFINITE_LENGTH)
+ {
+ SetLastError(CRYPT_E_ASN1_CORRUPT);
+ ret = FALSE;
+ }
+ return ret;
+}
+
/* Helper function to check *pcbStructInfo, set it to the required size, and
* optionally to allocate memory. Assumes pvStructInfo is not NULL.
* If CRYPT_DECODE_ALLOC_FLAG is set in dwFlags, *pvStructInfo will be set to a