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
b1e08b39
Commit
b1e08b39
authored
Jan 06, 2016
by
Hans Leidekker
Committed by
Alexandre Julliard
Jan 06, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcrypt: Implement BCryptHashData.
Signed-off-by:
Hans Leidekker
<
hans@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
46369d79
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
1 deletion
+45
-1
bcrypt.spec
dlls/bcrypt/bcrypt.spec
+1
-1
bcrypt_main.c
dlls/bcrypt/bcrypt_main.c
+44
-0
No files found.
dlls/bcrypt/bcrypt.spec
View file @
b1e08b39
...
...
@@ -29,7 +29,7 @@
@ stub BCryptGenerateSymmetricKey
@ stdcall BCryptGetFipsAlgorithmMode(ptr)
@ stdcall BCryptGetProperty(ptr wstr ptr long ptr long)
@ st
ub BCryptHashData
@ st
dcall BCryptHashData(ptr ptr long long)
@ stub BCryptImportKey
@ stub BCryptImportKeyPair
@ stdcall BCryptOpenAlgorithmProvider(ptr wstr wstr long)
...
...
dlls/bcrypt/bcrypt_main.c
View file @
b1e08b39
...
...
@@ -202,6 +202,32 @@ static NTSTATUS hash_init( struct hash *hash )
}
return
STATUS_SUCCESS
;
}
static
void
hash_update
(
struct
hash
*
hash
,
UCHAR
*
input
,
ULONG
size
)
{
switch
(
hash
->
alg_id
)
{
case
ALG_ID_SHA1
:
CC_SHA1_Update
(
&
hash
->
u
.
sha1_ctx
,
input
,
size
);
break
;
case
ALG_ID_SHA256
:
CC_SHA256_Update
(
&
hash
->
u
.
sha256_ctx
,
input
,
size
);
break
;
case
ALG_ID_SHA384
:
CC_SHA384_Update
(
&
hash
->
u
.
sha512_ctx
,
input
,
size
);
break
;
case
ALG_ID_SHA512
:
CC_SHA512_Update
(
&
hash
->
u
.
sha512_ctx
,
input
,
size
);
break
;
default:
ERR
(
"unhandled id %u
\n
"
,
hash
->
alg_id
);
break
;
}
}
#else
struct
hash
{
...
...
@@ -214,6 +240,11 @@ static NTSTATUS hash_init( struct hash *hash )
ERR
(
"support for hashes not available at build time
\n
"
);
return
STATUS_NOT_IMPLEMENTED
;
}
static
void
hash_update
(
struct
hash
*
hash
,
UCHAR
*
input
,
ULONG
size
)
{
ERR
(
"support for hashes not available at build time
\n
"
);
}
#endif
#define OBJECT_LENGTH_SHA1 278
...
...
@@ -410,3 +441,16 @@ NTSTATUS WINAPI BCryptDestroyHash( BCRYPT_HASH_HANDLE handle )
HeapFree
(
GetProcessHeap
(),
0
,
hash
);
return
STATUS_SUCCESS
;
}
NTSTATUS
WINAPI
BCryptHashData
(
BCRYPT_HASH_HANDLE
handle
,
UCHAR
*
input
,
ULONG
size
,
ULONG
flags
)
{
struct
hash
*
hash
=
handle
;
TRACE
(
"%p, %p, %u, %08x
\n
"
,
handle
,
input
,
size
,
flags
);
if
(
!
hash
||
hash
->
hdr
.
magic
!=
MAGIC_HASH
)
return
STATUS_INVALID_HANDLE
;
if
(
!
input
)
return
STATUS_INVALID_PARAMETER
;
hash_update
(
hash
,
input
,
size
);
return
STATUS_SUCCESS
;
}
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