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
3b168abc
Commit
3b168abc
authored
Jun 22, 2018
by
Michael Müller
Committed by
Alexandre Julliard
Jun 22, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32/tests: Add a basic test for ecdsa oid.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
93a5a6d0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
0 deletions
+46
-0
oid.c
dlls/crypt32/tests/oid.c
+31
-0
wincrypt.h
include/wincrypt.h
+15
-0
No files found.
dlls/crypt32/tests/oid.c
View file @
3b168abc
...
...
@@ -22,6 +22,7 @@
#include <windef.h>
#include <winbase.h>
#include <winerror.h>
#define CRYPT_OID_INFO_HAS_EXTRA_FIELDS
#include <wincrypt.h>
#include <winreg.h>
...
...
@@ -543,8 +544,10 @@ static void test_enumOIDInfo(void)
static
void
test_findOIDInfo
(
void
)
{
static
WCHAR
sha256ECDSA
[]
=
{
's'
,
'h'
,
'a'
,
'2'
,
'5'
,
'6'
,
'E'
,
'C'
,
'D'
,
'S'
,
'A'
,
0
};
static
WCHAR
sha1
[]
=
{
's'
,
'h'
,
'a'
,
'1'
,
0
};
static
CHAR
oid_rsa_md5
[]
=
szOID_RSA_MD5
,
oid_sha256
[]
=
szOID_NIST_sha256
;
static
CHAR
oid_ecdsa_sha256
[]
=
szOID_ECDSA_SHA256
;
ALG_ID
alg
=
CALG_SHA1
;
ALG_ID
algs
[
2
]
=
{
CALG_MD5
,
CALG_RSA_SIGN
};
const
struct
oid_info
...
...
@@ -581,6 +584,34 @@ static void test_findOIDInfo(void)
"Unexpected Algid %d, expected %d
\n
"
,
U
(
*
info
).
Algid
,
test
->
algid
);
}
}
info
=
CryptFindOIDInfo
(
CRYPT_OID_INFO_OID_KEY
,
oid_ecdsa_sha256
,
0
);
if
(
info
)
{
DWORD
*
data
;
ok
(
info
->
cbSize
==
sizeof
(
*
info
),
"Unexpected structure size %d.
\n
"
,
info
->
cbSize
);
ok
(
!
strcmp
(
info
->
pszOID
,
oid_ecdsa_sha256
),
"Expected %s, got %s
\n
"
,
oid_ecdsa_sha256
,
info
->
pszOID
);
ok
(
!
lstrcmpW
(
info
->
pwszName
,
sha256ECDSA
),
"Expected %s, got %s
\n
"
,
wine_dbgstr_w
(
sha256ECDSA
),
wine_dbgstr_w
(
info
->
pwszName
));
ok
(
info
->
dwGroupId
==
CRYPT_SIGN_ALG_OID_GROUP_ID
,
"Expected CRYPT_SIGN_ALG_OID_GROUP_ID, got %u
\n
"
,
info
->
dwGroupId
);
ok
(
U
(
*
info
).
Algid
==
CALG_OID_INFO_CNG_ONLY
,
"Expected CALG_OID_INFO_CNG_ONLY, got %d
\n
"
,
U
(
*
info
).
Algid
);
data
=
(
DWORD
*
)
info
->
ExtraInfo
.
pbData
;
ok
(
info
->
ExtraInfo
.
cbData
==
8
,
"Expected 8, got %d
\n
"
,
info
->
ExtraInfo
.
cbData
);
ok
(
data
[
0
]
==
CALG_OID_INFO_PARAMETERS
,
"Expected CALG_OID_INFO_PARAMETERS, got %x
\n
"
,
data
[
0
]);
ok
(
data
[
1
]
==
CRYPT_OID_NO_NULL_ALGORITHM_PARA_FLAG
,
"Expected CRYPT_OID_NO_NULL_ALGORITHM_PARA_FLAG, got %x
\n
"
,
data
[
1
]);
ok
(
!
lstrcmpW
(
info
->
pwszCNGAlgid
,
BCRYPT_SHA256_ALGORITHM
),
"Expected %s, got %s
\n
"
,
wine_dbgstr_w
(
BCRYPT_SHA256_ALGORITHM
),
wine_dbgstr_w
(
info
->
pwszCNGAlgid
));
ok
(
!
lstrcmpW
(
info
->
pwszCNGExtraAlgid
,
CRYPT_OID_INFO_ECC_PARAMETERS_ALGORITHM
),
"Expected %s, got %s
\n
"
,
wine_dbgstr_w
(
CRYPT_OID_INFO_ECC_PARAMETERS_ALGORITHM
),
wine_dbgstr_w
(
info
->
pwszCNGExtraAlgid
));
}
else
todo_wine
win_skip
(
"Host does not support ECDSA_SHA256, skipping test
\n
"
);
}
START_TEST
(
oid
)
...
...
include/wincrypt.h
View file @
3b168abc
...
...
@@ -1244,6 +1244,17 @@ typedef BOOL (WINAPI *PFN_CRYPT_ENUM_OID_FUNC)(DWORD dwEncodingType,
#define CRYPT_MATCH_ANY_ENCODING_TYPE 0xffffffff
#define CALG_OID_INFO_CNG_ONLY 0xffffffff
#define CALG_OID_INFO_PARAMETERS 0xfffffffe
#define CRYPT_OID_INFO_HASH_PARAMETERS_ALGORITHM (const WCHAR []){'C','r','y','p','t','O','I','D','I','n','f','o','H','a','s','h','P','a','r','a','m','e','t','e','r','s',0}
#define CRYPT_OID_INFO_ECC_PARAMETERS_ALGORITHM (const WCHAR []){'C','r','y','p','t','O','I','D','I','n','f','o','E','C','C','P','a','r','a','m','e','t','e','r','s',0}
#define CRYPT_OID_INFO_MGF1_PARAMETERS_ALGORITHM (const WCHAR []){'C','r','y','p','t','O','I','D','I','n','f','o','M','g','f','1','P','a','r','a','m','e','t','e','r','s',0}
#define CRYPT_OID_INFO_NO_SIGN_ALGORITHM (const WCHAR []){'C','r','y','p','t','O','I','D','I','n','f','o','N','o','S','i','g','n',0}
#define CRYPT_OID_INFO_OAEP_PARAMETERS_ALGORITHM (const WCHAR []){'C','r','y','p','t','O','I','D','I','n','f','o','O','A','E','P','P','a','r','a','m','e','t','e','r','s',0}
#define CRYPT_OID_INFO_ECC_WRAP_PARAMETERS_ALGORITHM (const WCHAR []){'C','r','y','p','t','O','I','D','I','n','f','o','E','C','C','W','r','a','p','P','a','r','a','m','e','t','e','r','s',0}
#define CRYPT_OID_INFO_NO_PARAMETERS_ALGORITHM (const WCHAR []){'C','r','y','p','t','O','I','D','I','n','f','o','N','o','P','a','r','a','m','e','t','e','r','s',0}
typedef
struct
_CRYPT_OID_INFO
{
DWORD
cbSize
;
LPCSTR
pszOID
;
...
...
@@ -1255,6 +1266,10 @@ typedef struct _CRYPT_OID_INFO {
DWORD
dwLength
;
}
DUMMYUNIONNAME
;
CRYPT_DATA_BLOB
ExtraInfo
;
#ifdef CRYPT_OID_INFO_HAS_EXTRA_FIELDS
LPCWSTR
pwszCNGAlgid
;
LPCWSTR
pwszCNGExtraAlgid
;
#endif
}
CRYPT_OID_INFO
,
*
PCRYPT_OID_INFO
;
typedef
const
CRYPT_OID_INFO
CCRYPT_OID_INFO
,
*
PCCRYPT_OID_INFO
;
...
...
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