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
60c6a9e3
Commit
60c6a9e3
authored
Jul 17, 2007
by
Juan Lang
Committed by
Alexandre Julliard
Jul 18, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Add tests for decoding a hash message.
parent
703a0f6f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
81 additions
and
0 deletions
+81
-0
msg.c
dlls/crypt32/tests/msg.c
+81
-0
No files found.
dlls/crypt32/tests/msg.c
View file @
60c6a9e3
...
...
@@ -977,6 +977,12 @@ static const struct update_accum a4 = { 1, &b4 };
static
const
BYTE
bogusOIDContent
[]
=
{
0x30
,
0x0f
,
0x06
,
0x09
,
0x2a
,
0x86
,
0x48
,
0x86
,
0xf7
,
0x0d
,
0x01
,
0x07
,
0x07
,
0xa0
,
0x02
,
0x04
,
0x00
};
static
const
BYTE
bogusHashContent
[]
=
{
0x30
,
0x47
,
0x06
,
0x09
,
0x2a
,
0x86
,
0x48
,
0x86
,
0xf7
,
0x0d
,
0x01
,
0x07
,
0x05
,
0xa0
,
0x3a
,
0x30
,
0x38
,
0x02
,
0x01
,
0x00
,
0x30
,
0x0c
,
0x06
,
0x08
,
0x2a
,
0x86
,
0x48
,
0x86
,
0xf7
,
0x0d
,
0x02
,
0x05
,
0x05
,
0x00
,
0x30
,
0x13
,
0x06
,
0x09
,
0x2a
,
0x86
,
0x48
,
0x86
,
0xf7
,
0x0d
,
0x01
,
0x07
,
0x01
,
0xa0
,
0x06
,
0x04
,
0x04
,
0x01
,
0x02
,
0x03
,
0x04
,
0x04
,
0x10
,
0x00
,
0xd6
,
0xc0
,
0x5a
,
0x21
,
0x51
,
0x2a
,
0x79
,
0xa1
,
0xdf
,
0xeb
,
0x9d
,
0x2a
,
0x8f
,
0x26
,
0x2f
};
static
void
test_decode_msg_update
(
void
)
{
...
...
@@ -1120,6 +1126,81 @@ static void test_decode_msg_update(void)
ok
(
!
ret
&&
GetLastError
()
==
CRYPT_E_INVALID_MSG_TYPE
,
"Expected CRYPT_E_INVALID_MSG_TYPE, got %x
\n
"
,
GetLastError
());
CryptMsgClose
(
msg
);
/* Similarly, opening an empty hash with unspecified type succeeds.. */
msg
=
CryptMsgOpenToDecode
(
PKCS_7_ASN_ENCODING
,
0
,
0
,
0
,
NULL
,
NULL
);
SetLastError
(
0xdeadbeef
);
ret
=
CryptMsgUpdate
(
msg
,
hashEmptyContent
,
sizeof
(
hashEmptyContent
),
TRUE
);
ok
(
ret
,
"CryptMsgUpdate failed: %08x
\n
"
,
GetLastError
());
CryptMsgClose
(
msg
);
/* while with specified type it fails. */
msg
=
CryptMsgOpenToDecode
(
PKCS_7_ASN_ENCODING
,
0
,
CMSG_HASHED
,
0
,
NULL
,
NULL
);
SetLastError
(
0xdeadbeef
);
ret
=
CryptMsgUpdate
(
msg
,
hashEmptyContent
,
sizeof
(
hashEmptyContent
),
TRUE
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
CRYPT_E_ASN1_BADTAG
,
"Expected CRYPT_E_ASN1_BADTAG, got %x
\n
"
,
GetLastError
());
CryptMsgClose
(
msg
);
/* On the other hand, decoding the bare content of an empty hash message
* fails with unspecified type..
*/
msg
=
CryptMsgOpenToDecode
(
PKCS_7_ASN_ENCODING
,
0
,
0
,
0
,
NULL
,
NULL
);
SetLastError
(
0xdeadbeef
);
ret
=
CryptMsgUpdate
(
msg
,
hashEmptyBareContent
,
sizeof
(
hashEmptyBareContent
),
TRUE
);
ok
(
!
ret
&&
GetLastError
()
==
CRYPT_E_ASN1_BADTAG
,
"Expected CRYPT_E_ASN1_BADTAG, got %x
\n
"
,
GetLastError
());
CryptMsgClose
(
msg
);
/* but succeeds with explicit type. */
msg
=
CryptMsgOpenToDecode
(
PKCS_7_ASN_ENCODING
,
0
,
CMSG_HASHED
,
0
,
NULL
,
NULL
);
ret
=
CryptMsgUpdate
(
msg
,
hashEmptyBareContent
,
sizeof
(
hashEmptyBareContent
),
TRUE
);
ok
(
ret
,
"CryptMsgUpdate failed: %x
\n
"
,
GetLastError
());
CryptMsgClose
(
msg
);
/* And again, opening a (non-empty) hash message with unspecified type
* succeeds..
*/
msg
=
CryptMsgOpenToDecode
(
PKCS_7_ASN_ENCODING
,
0
,
0
,
0
,
NULL
,
NULL
);
SetLastError
(
0xdeadbeef
);
ret
=
CryptMsgUpdate
(
msg
,
hashContent
,
sizeof
(
hashContent
),
TRUE
);
ok
(
ret
,
"CryptMsgUpdate failed: %08x
\n
"
,
GetLastError
());
CryptMsgClose
(
msg
);
/* while with specified type it fails.. */
msg
=
CryptMsgOpenToDecode
(
PKCS_7_ASN_ENCODING
,
0
,
CMSG_HASHED
,
0
,
NULL
,
NULL
);
SetLastError
(
0xdeadbeef
);
ret
=
CryptMsgUpdate
(
msg
,
hashContent
,
sizeof
(
hashContent
),
TRUE
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
CRYPT_E_ASN1_BADTAG
,
"Expected CRYPT_E_ASN1_BADTAG, got %x
\n
"
,
GetLastError
());
CryptMsgClose
(
msg
);
/* and decoding the bare content of a non-empty hash message fails with
* unspecified type..
*/
msg
=
CryptMsgOpenToDecode
(
PKCS_7_ASN_ENCODING
,
0
,
0
,
0
,
NULL
,
NULL
);
SetLastError
(
0xdeadbeef
);
ret
=
CryptMsgUpdate
(
msg
,
hashBareContent
,
sizeof
(
hashBareContent
),
TRUE
);
ok
(
!
ret
&&
GetLastError
()
==
CRYPT_E_ASN1_BADTAG
,
"Expected CRYPT_E_ASN1_BADTAG, got %x
\n
"
,
GetLastError
());
CryptMsgClose
(
msg
);
/* but succeeds with explicit type. */
msg
=
CryptMsgOpenToDecode
(
PKCS_7_ASN_ENCODING
,
0
,
CMSG_HASHED
,
0
,
NULL
,
NULL
);
ret
=
CryptMsgUpdate
(
msg
,
hashBareContent
,
sizeof
(
hashBareContent
),
TRUE
);
ok
(
ret
,
"CryptMsgUpdate failed: %x
\n
"
,
GetLastError
());
CryptMsgClose
(
msg
);
/* Opening a (non-empty) hash message with unspecified type and a bogus
* hash value succeeds..
*/
msg
=
CryptMsgOpenToDecode
(
PKCS_7_ASN_ENCODING
,
0
,
0
,
0
,
NULL
,
NULL
);
SetLastError
(
0xdeadbeef
);
ret
=
CryptMsgUpdate
(
msg
,
bogusHashContent
,
sizeof
(
bogusHashContent
),
TRUE
);
ok
(
ret
,
"CryptMsgUpdate failed: %08x
\n
"
,
GetLastError
());
CryptMsgClose
(
msg
);
}
static
void
test_decode_msg
(
void
)
...
...
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