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
1f6a67d8
Commit
1f6a67d8
authored
Oct 17, 2008
by
Juan Lang
Committed by
Alexandre Julliard
Oct 18, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wintrust: Add tests for WVTAsn1CatNameValueEncode.
parent
9033fa9a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
73 additions
and
0 deletions
+73
-0
asn.c
dlls/wintrust/tests/asn.c
+73
-0
No files found.
dlls/wintrust/tests/asn.c
View file @
1f6a67d8
...
...
@@ -585,6 +585,78 @@ static void test_decodeCatMemberInfo(void)
}
}
static
const
BYTE
emptyCatNameValue
[]
=
{
0x30
,
0x07
,
0x1e
,
0x00
,
0x02
,
0x01
,
0x00
,
0x04
,
0x00
};
static
const
BYTE
catNameValueWithTag
[]
=
{
0x30
,
0x0d
,
0x1e
,
0x06
,
0x00
,
0x66
,
0x00
,
0x6f
,
0x00
,
0x6f
,
0x02
,
0x01
,
0x00
,
0x04
,
0x00
};
static
const
BYTE
catNameValueWithFlags
[]
=
{
0x30
,
0x0a
,
0x1e
,
0x00
,
0x02
,
0x04
,
0xf0
,
0x0d
,
0xd0
,
0x0d
,
0x04
,
0x00
};
static
const
BYTE
catNameValueWithValue
[]
=
{
0x30
,
0x0b
,
0x1e
,
0x00
,
0x02
,
0x01
,
0x00
,
0x04
,
0x04
,
0x01
,
0x02
,
0x03
,
0x04
};
static
BYTE
aVal
[]
=
{
1
,
2
,
3
,
4
};
static
void
test_encodeCatNameValue
(
void
)
{
static
WCHAR
foo
[]
=
{
'f'
,
'o'
,
'o'
,
0
};
BOOL
ret
;
LPBYTE
buf
;
DWORD
size
;
CAT_NAMEVALUE
value
;
memset
(
&
value
,
0
,
sizeof
(
value
));
ret
=
pCryptEncodeObjectEx
(
X509_ASN_ENCODING
,
CAT_NAMEVALUE_STRUCT
,
(
LPBYTE
)
&
value
,
CRYPT_ENCODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
todo_wine
ok
(
ret
,
"CryptEncodeObjectEx failed: %08x
\n
"
,
GetLastError
());
if
(
ret
)
{
ok
(
size
==
sizeof
(
emptyCatNameValue
),
"Unexpected size %d
\n
"
,
size
);
ok
(
!
memcmp
(
buf
,
emptyCatNameValue
,
sizeof
(
emptyCatNameValue
)),
"Unexpected value
\n
"
);
LocalFree
(
buf
);
}
value
.
pwszTag
=
foo
;
ret
=
pCryptEncodeObjectEx
(
X509_ASN_ENCODING
,
CAT_NAMEVALUE_STRUCT
,
(
LPBYTE
)
&
value
,
CRYPT_ENCODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
todo_wine
ok
(
ret
,
"CryptEncodeObjectEx failed: %08x
\n
"
,
GetLastError
());
if
(
ret
)
{
ok
(
size
==
sizeof
(
catNameValueWithTag
),
"Unexpected size %d
\n
"
,
size
);
ok
(
!
memcmp
(
buf
,
catNameValueWithTag
,
sizeof
(
catNameValueWithTag
)),
"Unexpected value
\n
"
);
LocalFree
(
buf
);
}
value
.
pwszTag
=
NULL
;
value
.
fdwFlags
=
0xf00dd00d
;
ret
=
pCryptEncodeObjectEx
(
X509_ASN_ENCODING
,
CAT_NAMEVALUE_STRUCT
,
(
LPBYTE
)
&
value
,
CRYPT_ENCODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
todo_wine
ok
(
ret
,
"CryptEncodeObjectEx failed: %08x
\n
"
,
GetLastError
());
if
(
ret
)
{
ok
(
size
==
sizeof
(
catNameValueWithFlags
),
"Unexpected size %d
\n
"
,
size
);
ok
(
!
memcmp
(
buf
,
catNameValueWithFlags
,
sizeof
(
catNameValueWithFlags
)),
"Unexpected value
\n
"
);
LocalFree
(
buf
);
}
value
.
fdwFlags
=
0
;
value
.
Value
.
cbData
=
sizeof
(
aVal
);
value
.
Value
.
pbData
=
aVal
;
ret
=
pCryptEncodeObjectEx
(
X509_ASN_ENCODING
,
CAT_NAMEVALUE_STRUCT
,
(
LPBYTE
)
&
value
,
CRYPT_ENCODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
todo_wine
ok
(
ret
,
"CryptEncodeObjectEx failed: %08x
\n
"
,
GetLastError
());
if
(
ret
)
{
ok
(
size
==
sizeof
(
catNameValueWithValue
),
"Unexpected size %d
\n
"
,
size
);
ok
(
!
memcmp
(
buf
,
catNameValueWithValue
,
sizeof
(
catNameValueWithValue
)),
"Unexpected value
\n
"
);
LocalFree
(
buf
);
}
}
START_TEST
(
asn
)
{
HMODULE
hCrypt32
=
LoadLibraryA
(
"crypt32.dll"
);
...
...
@@ -597,6 +669,7 @@ START_TEST(asn)
test_decodeSPCPEImage
();
test_encodeCatMemberInfo
();
test_decodeCatMemberInfo
();
test_encodeCatNameValue
();
FreeLibrary
(
hCrypt32
);
}
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