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
796bb073
Commit
796bb073
authored
Dec 09, 2008
by
Juan Lang
Committed by
Alexandre Julliard
Dec 10, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wintrust: Add tests for WVTAsn1SpcSpOpusInfoEncode.
parent
ffa3d341
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
85 additions
and
0 deletions
+85
-0
asn.c
dlls/wintrust/tests/asn.c
+85
-0
No files found.
dlls/wintrust/tests/asn.c
View file @
796bb073
...
...
@@ -786,6 +786,90 @@ static void test_decodeCatNameValue(void)
}
}
static
const
WCHAR
progName
[]
=
{
'A'
,
' '
,
'p'
,
'r'
,
'o'
,
'g'
,
'r'
,
'a'
,
'm'
,
0
};
static
const
BYTE
spOpusInfoWithProgramName
[]
=
{
0x30
,
0x16
,
0xa0
,
0x14
,
0x80
,
0x12
,
0x00
,
0x41
,
0x00
,
0x20
,
0x00
,
0x70
,
0x00
,
0x72
,
0x00
,
0x6f
,
0x00
,
0x67
,
0x00
,
0x72
,
0x00
,
0x61
,
0x00
,
0x6d
};
static
WCHAR
winehq
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
':'
,
'/'
,
'/'
,
'w'
,
'i'
,
'n'
,
'e'
,
'h'
,
'q'
,
'.'
,
'o'
,
'r'
,
'g'
,
'/'
,
0
};
static
const
BYTE
spOpusInfoWithMoreInfo
[]
=
{
0x30
,
0x16
,
0xa1
,
0x14
,
0x80
,
0x12
,
0x68
,
0x74
,
0x74
,
0x70
,
0x3a
,
0x2f
,
0x2f
,
0x77
,
0x69
,
0x6e
,
0x65
,
0x68
,
0x71
,
0x2e
,
0x6f
,
0x72
,
0x67
,
0x2f
};
static
const
BYTE
spOpusInfoWithPublisherInfo
[]
=
{
0x30
,
0x16
,
0xa2
,
0x14
,
0x80
,
0x12
,
0x68
,
0x74
,
0x74
,
0x70
,
0x3a
,
0x2f
,
0x2f
,
0x77
,
0x69
,
0x6e
,
0x65
,
0x68
,
0x71
,
0x2e
,
0x6f
,
0x72
,
0x67
,
0x2f
};
static
void
test_encodeSpOpusInfo
(
void
)
{
BOOL
ret
;
LPBYTE
buf
;
DWORD
size
;
SPC_SP_OPUS_INFO
info
;
SPC_LINK
moreInfo
;
memset
(
&
info
,
0
,
sizeof
(
info
));
ret
=
pCryptEncodeObjectEx
(
X509_ASN_ENCODING
,
SPC_SP_OPUS_INFO_STRUCT
,
(
LPBYTE
)
&
info
,
CRYPT_ENCODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
todo_wine
ok
(
ret
,
"CryptEncodeObjectEx failed: %08x
\n
"
,
GetLastError
());
if
(
ret
)
{
ok
(
size
==
sizeof
(
emptySequence
),
"unexpected size %d
\n
"
,
size
);
ok
(
!
memcmp
(
buf
,
emptySequence
,
size
),
"unexpected value
\n
"
);
LocalFree
(
buf
);
}
info
.
pwszProgramName
=
progName
;
ret
=
pCryptEncodeObjectEx
(
X509_ASN_ENCODING
,
SPC_SP_OPUS_INFO_STRUCT
,
(
LPBYTE
)
&
info
,
CRYPT_ENCODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
todo_wine
ok
(
ret
,
"CryptEncodeObjectEx failed: %08x
\n
"
,
GetLastError
());
if
(
ret
)
{
ok
(
size
==
sizeof
(
spOpusInfoWithProgramName
),
"unexpected size %d
\n
"
,
size
);
ok
(
!
memcmp
(
buf
,
spOpusInfoWithProgramName
,
size
),
"unexpected value
\n
"
);
LocalFree
(
buf
);
}
info
.
pwszProgramName
=
NULL
;
memset
(
&
moreInfo
,
0
,
sizeof
(
moreInfo
));
info
.
pMoreInfo
=
&
moreInfo
;
SetLastError
(
0xdeadbeef
);
ret
=
pCryptEncodeObjectEx
(
X509_ASN_ENCODING
,
SPC_SP_OPUS_INFO_STRUCT
,
(
LPBYTE
)
&
info
,
CRYPT_ENCODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
E_INVALIDARG
,
"expected E_INVALIDARG, got %08x
\n
"
,
GetLastError
());
moreInfo
.
dwLinkChoice
=
SPC_URL_LINK_CHOICE
;
moreInfo
.
pwszUrl
=
winehq
;
ret
=
pCryptEncodeObjectEx
(
X509_ASN_ENCODING
,
SPC_SP_OPUS_INFO_STRUCT
,
(
LPBYTE
)
&
info
,
CRYPT_ENCODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
todo_wine
ok
(
ret
,
"CryptEncodeObjectEx failed: %08x
\n
"
,
GetLastError
());
if
(
ret
)
{
ok
(
size
==
sizeof
(
spOpusInfoWithMoreInfo
),
"unexpected size %d
\n
"
,
size
);
ok
(
!
memcmp
(
buf
,
spOpusInfoWithMoreInfo
,
size
),
"unexpected value
\n
"
);
LocalFree
(
buf
);
}
info
.
pMoreInfo
=
NULL
;
info
.
pPublisherInfo
=
&
moreInfo
;
ret
=
pCryptEncodeObjectEx
(
X509_ASN_ENCODING
,
SPC_SP_OPUS_INFO_STRUCT
,
(
LPBYTE
)
&
info
,
CRYPT_ENCODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
todo_wine
ok
(
ret
,
"CryptEncodeObjectEx failed: %08x
\n
"
,
GetLastError
());
if
(
ret
)
{
ok
(
size
==
sizeof
(
spOpusInfoWithPublisherInfo
),
"unexpected size %d
\n
"
,
size
);
ok
(
!
memcmp
(
buf
,
spOpusInfoWithPublisherInfo
,
size
),
"unexpected value
\n
"
);
LocalFree
(
buf
);
}
}
START_TEST
(
asn
)
{
HMODULE
hCrypt32
=
LoadLibraryA
(
"crypt32.dll"
);
...
...
@@ -802,6 +886,7 @@ START_TEST(asn)
test_decodeCatMemberInfo
();
test_encodeCatNameValue
();
test_decodeCatNameValue
();
test_encodeSpOpusInfo
();
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