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
5df4ff13
Commit
5df4ff13
authored
Sep 08, 2022
by
Chris Denton
Committed by
Alexandre Julliard
Sep 09, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcrypt: Add basic support for pseudo-handles.
Support constant values for algorithm handles in `BCryptGenRandom` and make no attempt to dereference such handles.
parent
c8592b97
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
0 deletions
+22
-0
bcrypt_main.c
dlls/bcrypt/bcrypt_main.c
+11
-0
bcrypt.c
dlls/bcrypt/tests/bcrypt.c
+8
-0
bcrypt.h
include/bcrypt.h
+3
-0
No files found.
dlls/bcrypt/bcrypt_main.c
View file @
5df4ff13
...
...
@@ -190,6 +190,17 @@ NTSTATUS WINAPI BCryptGenRandom(BCRYPT_ALG_HANDLE handle, UCHAR *buffer, ULONG c
if
(
!
(
flags
&
BCRYPT_USE_SYSTEM_PREFERRED_RNG
))
return
STATUS_INVALID_HANDLE
;
}
else
if
(((
ULONG_PTR
)
algorithm
&
1
)
==
1
)
{
/* Pseudo algorithm handles are denoted by having the lowest bit set.
* An aligned algorithm pointer will never have this bit set.
*/
if
(
algorithm
!=
BCRYPT_RNG_ALG_HANDLE
)
{
FIXME
(
"pseudo-handle algorithm %p not supported
\n
"
,
algorithm
);
return
STATUS_NOT_IMPLEMENTED
;
}
}
else
if
(
algorithm
->
hdr
.
magic
!=
MAGIC_ALG
||
algorithm
->
id
!=
ALG_ID_RNG
)
return
STATUS_INVALID_HANDLE
;
...
...
dlls/bcrypt/tests/bcrypt.c
View file @
5df4ff13
...
...
@@ -57,6 +57,14 @@ static void test_BCryptGenRandom(void)
ret
=
BCryptGenRandom
(
NULL
,
buffer
,
8
,
BCRYPT_USE_SYSTEM_PREFERRED_RNG
);
ok
(
ret
==
STATUS_SUCCESS
,
"Expected success, got %#lx
\n
"
,
ret
);
ok
(
memcmp
(
buffer
,
buffer
+
8
,
8
),
"Expected a random number, got 0
\n
"
);
/* Test pseudo handle, which was introduced at the same time as BCryptHash */
if
(
pBCryptHash
)
{
ret
=
BCryptGenRandom
(
BCRYPT_RNG_ALG_HANDLE
,
buffer
,
sizeof
(
buffer
),
0
);
ok
(
ret
==
STATUS_SUCCESS
,
"Expected success, got %#lx
\n
"
,
ret
);
}
else
win_skip
(
"BCryptGenRandom pseudo handles are not available
\n
"
);
}
static
void
test_BCryptGetFipsAlgorithmMode
(
void
)
...
...
include/bcrypt.h
View file @
5df4ff13
...
...
@@ -401,6 +401,9 @@ typedef PVOID BCRYPT_HANDLE;
typedef
PVOID
BCRYPT_HASH_HANDLE
;
typedef
PVOID
BCRYPT_SECRET_HANDLE
;
/* Pseudo handles for BCryptGenRandom */
#define BCRYPT_RNG_ALG_HANDLE ((BCRYPT_ALG_HANDLE)0x00000081)
/* Flags for BCryptGenRandom */
#define BCRYPT_RNG_USE_ENTROPY_IN_BUFFER 0x00000001
#define BCRYPT_USE_SYSTEM_PREFERRED_RNG 0x00000002
...
...
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