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
46369d79
Commit
46369d79
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 BCryptGetProperty.
Signed-off-by:
Hans Leidekker
<
hans@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
0c9b94ee
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
149 additions
and
3 deletions
+149
-3
bcrypt_main.c
dlls/bcrypt/bcrypt_main.c
+149
-3
No files found.
dlls/bcrypt/bcrypt_main.c
View file @
46369d79
...
...
@@ -216,11 +216,157 @@ static NTSTATUS hash_init( struct hash *hash )
}
#endif
NTSTATUS
WINAPI
BCryptGetProperty
(
BCRYPT_HANDLE
obj
,
LPCWSTR
prop
,
UCHAR
*
buffer
,
ULONG
count
,
ULONG
*
res
,
ULONG
flags
)
#define OBJECT_LENGTH_SHA1 278
#define OBJECT_LENGTH_SHA256 286
#define OBJECT_LENGTH_SHA384 382
#define OBJECT_LENGTH_SHA512 382
#define HASH_DIGEST_LENGTH_SHA1 20
#define HASH_DIGEST_LENGTH_SHA256 32
#define HASH_DIGEST_LENGTH_SHA384 48
#define HASH_DIGEST_LENGTH_SHA512 64
static
NTSTATUS
get_alg_property
(
enum
alg_id
id
,
const
WCHAR
*
prop
,
UCHAR
*
buf
,
ULONG
size
,
ULONG
*
ret_size
)
{
FIXME
(
"%p, %s, %p, %u, %p, %08x - stub
\n
"
,
obj
,
wine_dbgstr_w
(
prop
),
buffer
,
count
,
res
,
flags
)
;
ULONG
value
;
return
STATUS_NOT_IMPLEMENTED
;
switch
(
id
)
{
case
ALG_ID_SHA1
:
if
(
!
strcmpW
(
prop
,
BCRYPT_OBJECT_LENGTH
))
{
value
=
OBJECT_LENGTH_SHA1
;
break
;
}
FIXME
(
"unsupported sha1 algorithm property %s
\n
"
,
debugstr_w
(
prop
)
);
return
STATUS_NOT_IMPLEMENTED
;
case
ALG_ID_SHA256
:
if
(
!
strcmpW
(
prop
,
BCRYPT_OBJECT_LENGTH
))
{
value
=
OBJECT_LENGTH_SHA256
;
break
;
}
FIXME
(
"unsupported sha256 algorithm property %s
\n
"
,
debugstr_w
(
prop
)
);
return
STATUS_NOT_IMPLEMENTED
;
case
ALG_ID_SHA384
:
if
(
!
strcmpW
(
prop
,
BCRYPT_OBJECT_LENGTH
))
{
value
=
OBJECT_LENGTH_SHA384
;
break
;
}
FIXME
(
"unsupported sha384 algorithm property %s
\n
"
,
debugstr_w
(
prop
)
);
return
STATUS_NOT_IMPLEMENTED
;
case
ALG_ID_SHA512
:
if
(
!
strcmpW
(
prop
,
BCRYPT_OBJECT_LENGTH
))
{
value
=
OBJECT_LENGTH_SHA512
;
break
;
}
FIXME
(
"unsupported sha512 algorithm property %s
\n
"
,
debugstr_w
(
prop
)
);
return
STATUS_NOT_IMPLEMENTED
;
default:
FIXME
(
"unsupported algorithm %u
\n
"
,
id
);
return
STATUS_NOT_IMPLEMENTED
;
}
if
(
size
<
sizeof
(
ULONG
))
{
*
ret_size
=
sizeof
(
ULONG
);
return
STATUS_BUFFER_TOO_SMALL
;
}
if
(
buf
)
*
(
ULONG
*
)
buf
=
value
;
*
ret_size
=
sizeof
(
ULONG
);
return
STATUS_SUCCESS
;
}
static
NTSTATUS
get_hash_property
(
enum
alg_id
id
,
const
WCHAR
*
prop
,
UCHAR
*
buf
,
ULONG
size
,
ULONG
*
ret_size
)
{
ULONG
value
;
switch
(
id
)
{
case
ALG_ID_SHA1
:
if
(
!
strcmpW
(
prop
,
BCRYPT_HASH_LENGTH
))
{
value
=
HASH_DIGEST_LENGTH_SHA1
;
break
;
}
FIXME
(
"unsupported sha1 hash property %s
\n
"
,
debugstr_w
(
prop
)
);
return
STATUS_NOT_IMPLEMENTED
;
case
ALG_ID_SHA256
:
if
(
!
strcmpW
(
prop
,
BCRYPT_HASH_LENGTH
))
{
value
=
HASH_DIGEST_LENGTH_SHA256
;
break
;
}
FIXME
(
"unsupported sha256 hash property %s
\n
"
,
debugstr_w
(
prop
)
);
return
STATUS_NOT_IMPLEMENTED
;
case
ALG_ID_SHA384
:
if
(
!
strcmpW
(
prop
,
BCRYPT_HASH_LENGTH
))
{
value
=
HASH_DIGEST_LENGTH_SHA384
;
break
;
}
FIXME
(
"unsupported sha384 hash property %s
\n
"
,
debugstr_w
(
prop
)
);
return
STATUS_NOT_IMPLEMENTED
;
case
ALG_ID_SHA512
:
if
(
!
strcmpW
(
prop
,
BCRYPT_HASH_LENGTH
))
{
value
=
HASH_DIGEST_LENGTH_SHA512
;
break
;
}
FIXME
(
"unsupported sha512 hash property %s
\n
"
,
debugstr_w
(
prop
)
);
return
STATUS_NOT_IMPLEMENTED
;
default:
FIXME
(
"unsupported hash %u
\n
"
,
id
);
return
STATUS_NOT_IMPLEMENTED
;
}
if
(
size
<
sizeof
(
ULONG
))
{
*
ret_size
=
sizeof
(
ULONG
);
return
STATUS_BUFFER_TOO_SMALL
;
}
if
(
buf
)
*
(
ULONG
*
)
buf
=
value
;
*
ret_size
=
sizeof
(
ULONG
);
return
STATUS_SUCCESS
;
}
NTSTATUS
WINAPI
BCryptGetProperty
(
BCRYPT_HANDLE
handle
,
LPCWSTR
prop
,
UCHAR
*
buffer
,
ULONG
count
,
ULONG
*
res
,
ULONG
flags
)
{
struct
object
*
object
=
handle
;
TRACE
(
"%p, %s, %p, %u, %p, %08x
\n
"
,
handle
,
wine_dbgstr_w
(
prop
),
buffer
,
count
,
res
,
flags
);
if
(
!
object
)
return
STATUS_INVALID_HANDLE
;
if
(
!
prop
||
!
res
)
return
STATUS_INVALID_PARAMETER
;
switch
(
object
->
magic
)
{
case
MAGIC_ALG
:
{
const
struct
algorithm
*
alg
=
(
const
struct
algorithm
*
)
object
;
return
get_alg_property
(
alg
->
id
,
prop
,
buffer
,
count
,
res
);
}
case
MAGIC_HASH
:
{
const
struct
hash
*
hash
=
(
const
struct
hash
*
)
object
;
return
get_hash_property
(
hash
->
alg_id
,
prop
,
buffer
,
count
,
res
);
}
default:
WARN
(
"unknown magic %08x"
,
object
->
magic
);
return
STATUS_INVALID_HANDLE
;
}
}
NTSTATUS
WINAPI
BCryptCreateHash
(
BCRYPT_ALG_HANDLE
algorithm
,
BCRYPT_HASH_HANDLE
*
handle
,
UCHAR
*
object
,
ULONG
objectlen
,
...
...
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