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
370ffa0d
Commit
370ffa0d
authored
Dec 17, 2018
by
Hans Leidekker
Committed by
Alexandre Julliard
Dec 17, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcrypt: Clear magic bytes on destroy.
Based on a patch by Steven Noonan. Signed-off-by:
Hans Leidekker
<
hans@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
9e99382b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
1 deletion
+19
-1
bcrypt_main.c
dlls/bcrypt/bcrypt_main.c
+4
-1
bcrypt.c
dlls/bcrypt/tests/bcrypt.c
+15
-0
No files found.
dlls/bcrypt/bcrypt_main.c
View file @
370ffa0d
...
...
@@ -214,6 +214,7 @@ NTSTATUS WINAPI BCryptCloseAlgorithmProvider( BCRYPT_ALG_HANDLE handle, DWORD fl
TRACE
(
"%p, %08x
\n
"
,
handle
,
flags
);
if
(
!
alg
||
alg
->
hdr
.
magic
!=
MAGIC_ALG
)
return
STATUS_INVALID_HANDLE
;
alg
->
hdr
.
magic
=
0
;
heap_free
(
alg
);
return
STATUS_SUCCESS
;
}
...
...
@@ -672,7 +673,8 @@ NTSTATUS WINAPI BCryptDestroyHash( BCRYPT_HASH_HANDLE handle )
TRACE
(
"%p
\n
"
,
handle
);
if
(
!
hash
||
hash
->
hdr
.
magic
!=
MAGIC_HASH
)
return
STATUS_INVALID_HANDLE
;
if
(
!
hash
||
hash
->
hdr
.
magic
!=
MAGIC_HASH
)
return
STATUS_INVALID_PARAMETER
;
hash
->
hdr
.
magic
=
0
;
heap_free
(
hash
);
return
STATUS_SUCCESS
;
}
...
...
@@ -1265,6 +1267,7 @@ NTSTATUS WINAPI BCryptDestroyKey( BCRYPT_KEY_HANDLE handle )
TRACE
(
"%p
\n
"
,
handle
);
if
(
!
key
||
key
->
hdr
.
magic
!=
MAGIC_KEY
)
return
STATUS_INVALID_HANDLE
;
key
->
hdr
.
magic
=
0
;
return
key_destroy
(
key
);
}
...
...
dlls/bcrypt/tests/bcrypt.c
View file @
370ffa0d
...
...
@@ -293,6 +293,12 @@ static void test_hash(const struct hash_test *test)
ret
=
pBCryptDestroyHash
(
hash
);
ok
(
ret
==
STATUS_SUCCESS
,
"got %08x
\n
"
,
ret
);
ret
=
pBCryptDestroyHash
(
hash
);
ok
(
ret
==
STATUS_INVALID_PARAMETER
,
"got %08x
\n
"
,
ret
);
ret
=
pBCryptDestroyHash
(
NULL
);
ok
(
ret
==
STATUS_INVALID_PARAMETER
,
"got %08x
\n
"
,
ret
);
ret
=
pBCryptCloseAlgorithmProvider
(
alg
,
0
);
ok
(
ret
==
STATUS_SUCCESS
,
"got %08x
\n
"
,
ret
);
}
...
...
@@ -1415,8 +1421,17 @@ static void test_BCryptDecrypt(void)
ok
(
ret
==
STATUS_INVALID_HANDLE
,
"got %08x
\n
"
,
ret
);
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
ret
=
pBCryptDestroyKey
(
NULL
);
ok
(
ret
==
STATUS_INVALID_HANDLE
,
"got %08x
\n
"
,
ret
);
ret
=
pBCryptCloseAlgorithmProvider
(
aes
,
0
);
ok
(
ret
==
STATUS_SUCCESS
,
"got %08x
\n
"
,
ret
);
ret
=
pBCryptCloseAlgorithmProvider
(
aes
,
0
);
ok
(
ret
==
STATUS_INVALID_HANDLE
,
"got %08x
\n
"
,
ret
);
ret
=
pBCryptCloseAlgorithmProvider
(
NULL
,
0
);
ok
(
ret
==
STATUS_INVALID_HANDLE
,
"got %08x
\n
"
,
ret
);
}
static
void
test_key_import_export
(
void
)
...
...
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