Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
663bce9d
Commit
663bce9d
authored
Dec 22, 2023
by
Zhiyi Zhang
Committed by
Alexandre Julliard
Jan 19, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ncrypt: Add some missing RSA key properties.
parent
1144efbc
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
8 deletions
+26
-8
main.c
dlls/ncrypt/main.c
+18
-0
ncrypt.c
dlls/ncrypt/tests/ncrypt.c
+8
-8
No files found.
dlls/ncrypt/main.c
View file @
663bce9d
...
...
@@ -128,7 +128,9 @@ static SECURITY_STATUS set_object_property(struct object *object, const WCHAR *n
static
struct
object
*
create_key_object
(
enum
algid
algid
,
NCRYPT_PROV_HANDLE
provider
)
{
NCRYPT_SUPPORTED_LENGTHS
supported_lengths
=
{
512
,
16384
,
8
,
1024
};
struct
object
*
object
;
DWORD
dw_value
;
switch
(
algid
)
{
...
...
@@ -136,8 +138,16 @@ static struct object *create_key_object(enum algid algid, NCRYPT_PROV_HANDLE pro
if
(
!
(
object
=
allocate_object
(
KEY
)))
return
NULL
;
object
->
key
.
algid
=
RSA
;
set_object_property
(
object
,
NCRYPT_ALGORITHM_PROPERTY
,
(
BYTE
*
)
BCRYPT_RSA_ALGORITHM
,
sizeof
(
BCRYPT_RSA_ALGORITHM
));
set_object_property
(
object
,
NCRYPT_ALGORITHM_GROUP_PROPERTY
,
(
BYTE
*
)
BCRYPT_RSA_ALGORITHM
,
sizeof
(
BCRYPT_RSA_ALGORITHM
));
set_object_property
(
object
,
NCRYPT_LENGTHS_PROPERTY
,
(
BYTE
*
)
&
supported_lengths
,
sizeof
(
supported_lengths
));
dw_value
=
128
;
set_object_property
(
object
,
NCRYPT_BLOCK_LENGTH_PROPERTY
,
(
BYTE
*
)
&
dw_value
,
sizeof
(
dw_value
));
dw_value
=
128
;
set_object_property
(
object
,
BCRYPT_SIGNATURE_LENGTH
,
(
BYTE
*
)
&
dw_value
,
sizeof
(
dw_value
));
break
;
default:
...
...
@@ -145,6 +155,12 @@ static struct object *create_key_object(enum algid algid, NCRYPT_PROV_HANDLE pro
return
NULL
;
}
dw_value
=
0
;
set_object_property
(
object
,
NCRYPT_EXPORT_POLICY_PROPERTY
,
(
BYTE
*
)
&
dw_value
,
sizeof
(
dw_value
));
dw_value
=
NCRYPT_ALLOW_ALL_USAGES
;
set_object_property
(
object
,
NCRYPT_KEY_USAGE_PROPERTY
,
(
BYTE
*
)
&
dw_value
,
sizeof
(
dw_value
));
dw_value
=
0
;
set_object_property
(
object
,
NCRYPT_KEY_TYPE_PROPERTY
,
(
BYTE
*
)
&
dw_value
,
sizeof
(
dw_value
));
set_object_property
(
object
,
NCRYPT_PROVIDER_HANDLE_PROPERTY
,
(
BYTE
*
)
&
provider
,
sizeof
(
provider
));
return
object
;
}
...
...
@@ -181,6 +197,7 @@ SECURITY_STATUS WINAPI NCryptCreatePersistedKey(NCRYPT_PROV_HANDLE provider, NCR
}
set_object_property
(
object
,
NCRYPT_LENGTH_PROPERTY
,
(
BYTE
*
)
&
default_bitlen
,
sizeof
(
default_bitlen
));
set_object_property
(
object
,
BCRYPT_PUBLIC_KEY_LENGTH
,
(
BYTE
*
)
&
default_bitlen
,
sizeof
(
default_bitlen
));
}
else
{
...
...
@@ -401,6 +418,7 @@ SECURITY_STATUS WINAPI NCryptImportKey(NCRYPT_PROV_HANDLE provider, NCRYPT_KEY_H
}
set_object_property
(
object
,
NCRYPT_LENGTH_PROPERTY
,
(
BYTE
*
)
&
rsablob
->
BitLength
,
sizeof
(
rsablob
->
BitLength
));
set_object_property
(
object
,
BCRYPT_PUBLIC_KEY_LENGTH
,
(
BYTE
*
)
&
rsablob
->
BitLength
,
sizeof
(
rsablob
->
BitLength
));
break
;
}
default:
...
...
dlls/ncrypt/tests/ncrypt.c
View file @
663bce9d
...
...
@@ -232,17 +232,17 @@ static void _check_properties(int line, NCRYPT_PROV_HANDLE prov, NCRYPT_KEY_HAND
/* NCrypt properties */
{
NCRYPT_NAME_PROPERTY
,
{
0
},
0
,
NTE_NOT_SUPPORTED
,
TRUE
},
{
NCRYPT_UNIQUE_NAME_PROPERTY
,
{
0
},
0
,
NTE_NOT_SUPPORTED
,
TRUE
},
{
NCRYPT_ALGORITHM_PROPERTY
,
{
'R'
,
0
,
'S'
,
0
,
'A'
,
0
},
sizeof
(
L"RSA"
),
ERROR_SUCCESS
,
TRUE
},
{
NCRYPT_ALGORITHM_PROPERTY
,
{
'R'
,
0
,
'S'
,
0
,
'A'
,
0
},
sizeof
(
L"RSA"
),
ERROR_SUCCESS
},
{
NCRYPT_LENGTH_PROPERTY
,
{
0
,
0x4
}
/* 1024 */
,
sizeof
(
DWORD
)},
{
NCRYPT_LENGTHS_PROPERTY
,
{
0
,
0x2
,
0
,
0
,
0
,
0x40
,
0
,
0
,
0x8
,
0
,
0
,
0
,
0
,
0x4
,
0
,
0
},
sizeof
(
DWORD
)
*
4
/* NCRYPT_SUPPORTED_LENGTHS */
,
ERROR_SUCCESS
,
TRU
E
,
ERROR_SUCCESS
,
{
0
,
0x2
,
0
,
0
,
0
,
0x40
,
0
,
0
,
0x40
,
0
,
0
,
0
,
0
,
0x4
,
0
,
0
}},
{
NCRYPT_BLOCK_LENGTH_PROPERTY
,
{
0x80
,
0
,
0
,
0
},
sizeof
(
DWORD
),
ERROR_SUCCESS
,
TRUE
},
{
NCRYPT_LENGTHS_PROPERTY
,
{
0
,
0x2
,
0
,
0
,
0
,
0x40
,
0
,
0
,
0x8
,
0
,
0
,
0
,
0
,
0x4
,
0
,
0
},
sizeof
(
DWORD
)
*
4
/* NCRYPT_SUPPORTED_LENGTHS */
,
ERROR_SUCCESS
,
FALS
E
,
ERROR_SUCCESS
,
{
0
,
0x2
,
0
,
0
,
0
,
0x40
,
0
,
0
,
0x40
,
0
,
0
,
0
,
0
,
0x4
,
0
,
0
}},
{
NCRYPT_BLOCK_LENGTH_PROPERTY
,
{
0x80
,
0
,
0
,
0
},
sizeof
(
DWORD
),
ERROR_SUCCESS
},
{
NCRYPT_UI_POLICY_PROPERTY
,
{
0
},
sizeof
(
NCRYPT_UI_POLICY
),
NTE_NOT_FOUND
,
TRUE
},
{
NCRYPT_EXPORT_POLICY_PROPERTY
,
{
0
},
sizeof
(
DWORD
),
ERROR_SUCCESS
,
TRUE
},
{
NCRYPT_EXPORT_POLICY_PROPERTY
,
{
0
},
sizeof
(
DWORD
),
ERROR_SUCCESS
},
{
NCRYPT_WINDOW_HANDLE_PROPERTY
,
{
0
},
0
,
NTE_NOT_FOUND
,
TRUE
},
{
NCRYPT_USE_CONTEXT_PROPERTY
,
{
0
},
0
,
NTE_NOT_FOUND
,
TRUE
},
{
NCRYPT_IMPL_TYPE_PROPERTY
,
{
0
},
0
,
NTE_NOT_SUPPORTED
,
TRUE
},
{
NCRYPT_KEY_USAGE_PROPERTY
,
{
0xff
,
0xff
,
0xff
,
0
}
/* NCRYPT_ALLOW_ALL_USAGES */
,
sizeof
(
DWORD
),
ERROR_SUCCESS
,
TRUE
},
{
NCRYPT_KEY_TYPE_PROPERTY
,
{
0
},
sizeof
(
DWORD
),
ERROR_SUCCESS
,
TRUE
},
{
NCRYPT_KEY_USAGE_PROPERTY
,
{
0xff
,
0xff
,
0xff
,
0
}
/* NCRYPT_ALLOW_ALL_USAGES */
,
sizeof
(
DWORD
),
ERROR_SUCCESS
},
{
NCRYPT_KEY_TYPE_PROPERTY
,
{
0
},
sizeof
(
DWORD
),
ERROR_SUCCESS
},
{
NCRYPT_VERSION_PROPERTY
,
{
0
},
0
,
NTE_NOT_SUPPORTED
,
TRUE
},
{
NCRYPT_SECURITY_DESCR_SUPPORT_PROPERTY
,
{
0
},
0
,
NTE_NOT_SUPPORTED
,
TRUE
},
{
NCRYPT_SECURITY_DESCR_PROPERTY
,
{
0
},
0
,
NTE_BAD_FLAGS
,
TRUE
},
...
...
@@ -281,8 +281,8 @@ static void _check_properties(int line, NCRYPT_PROV_HANDLE prov, NCRYPT_KEY_HAND
{
BCRYPT_OBJECT_LENGTH
,
{
0
},
0
,
NTE_NOT_SUPPORTED
,
TRUE
},
{
BCRYPT_PADDING_SCHEMES
,
{
0
},
0
,
NTE_NOT_SUPPORTED
,
TRUE
},
{
BCRYPT_PROVIDER_HANDLE
,
{
0
},
0
,
NTE_NOT_SUPPORTED
,
TRUE
},
{
BCRYPT_SIGNATURE_LENGTH
,
{
0x80
,
0
,
0
,
0
}
/* 128 */
,
sizeof
(
DWORD
),
ERROR_SUCCESS
,
TRU
E
,
NTE_NOT_SUPPORTED
/* <= Win 8 */
},
{
BCRYPT_PUBLIC_KEY_LENGTH
,
{
0
,
0x4
}
/* 1024 */
,
sizeof
(
DWORD
),
ERROR_SUCCESS
,
TRU
E
,
NTE_NOT_SUPPORTED
/* <= Win 8 */
},
{
BCRYPT_SIGNATURE_LENGTH
,
{
0x80
,
0
,
0
,
0
}
/* 128 */
,
sizeof
(
DWORD
),
ERROR_SUCCESS
,
FALS
E
,
NTE_NOT_SUPPORTED
/* <= Win 8 */
},
{
BCRYPT_PUBLIC_KEY_LENGTH
,
{
0
,
0x4
}
/* 1024 */
,
sizeof
(
DWORD
),
ERROR_SUCCESS
,
FALS
E
,
NTE_NOT_SUPPORTED
/* <= Win 8 */
},
};
unsigned
int
i
;
...
...
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