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
9742fe89
Commit
9742fe89
authored
Jun 28, 2023
by
Hans Leidekker
Committed by
Alexandre Julliard
Jun 28, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcrypt: Add RC4 algorithm stub.
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=55160
parent
88f4dabc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
62 additions
and
1 deletion
+62
-1
bcrypt_internal.h
dlls/bcrypt/bcrypt_internal.h
+1
-0
bcrypt_main.c
dlls/bcrypt/bcrypt_main.c
+31
-1
bcrypt.c
dlls/bcrypt/tests/bcrypt.c
+30
-0
No files found.
dlls/bcrypt/bcrypt_internal.h
View file @
9742fe89
...
@@ -117,6 +117,7 @@ enum alg_id
...
@@ -117,6 +117,7 @@ enum alg_id
/* cipher */
/* cipher */
ALG_ID_3DES
,
ALG_ID_3DES
,
ALG_ID_AES
,
ALG_ID_AES
,
ALG_ID_RC4
,
/* hash */
/* hash */
ALG_ID_SHA256
,
ALG_ID_SHA256
,
...
...
dlls/bcrypt/bcrypt_main.c
View file @
9742fe89
...
@@ -104,6 +104,7 @@ builtin_algorithms[] =
...
@@ -104,6 +104,7 @@ builtin_algorithms[] =
{
{
{
BCRYPT_3DES_ALGORITHM
,
BCRYPT_CIPHER_INTERFACE
,
522
,
0
,
0
},
{
BCRYPT_3DES_ALGORITHM
,
BCRYPT_CIPHER_INTERFACE
,
522
,
0
,
0
},
{
BCRYPT_AES_ALGORITHM
,
BCRYPT_CIPHER_INTERFACE
,
654
,
0
,
0
},
{
BCRYPT_AES_ALGORITHM
,
BCRYPT_CIPHER_INTERFACE
,
654
,
0
,
0
},
{
BCRYPT_RC4_ALGORITHM
,
BCRYPT_CIPHER_INTERFACE
,
654
,
0
,
0
},
{
BCRYPT_SHA256_ALGORITHM
,
BCRYPT_HASH_INTERFACE
,
286
,
32
,
512
},
{
BCRYPT_SHA256_ALGORITHM
,
BCRYPT_HASH_INTERFACE
,
286
,
32
,
512
},
{
BCRYPT_SHA384_ALGORITHM
,
BCRYPT_HASH_INTERFACE
,
382
,
48
,
1024
},
{
BCRYPT_SHA384_ALGORITHM
,
BCRYPT_HASH_INTERFACE
,
382
,
48
,
1024
},
{
BCRYPT_SHA512_ALGORITHM
,
BCRYPT_HASH_INTERFACE
,
382
,
64
,
1024
},
{
BCRYPT_SHA512_ALGORITHM
,
BCRYPT_HASH_INTERFACE
,
382
,
64
,
1024
},
...
@@ -202,7 +203,7 @@ static const struct algorithm pseudo_algorithms[] =
...
@@ -202,7 +203,7 @@ static const struct algorithm pseudo_algorithms[] =
{{
MAGIC_ALG
},
ALG_ID_SHA256
},
{{
MAGIC_ALG
},
ALG_ID_SHA256
},
{{
MAGIC_ALG
},
ALG_ID_SHA384
},
{{
MAGIC_ALG
},
ALG_ID_SHA384
},
{{
MAGIC_ALG
},
ALG_ID_SHA512
},
{{
MAGIC_ALG
},
ALG_ID_SHA512
},
{{
0
}},
/* RC4 */
{{
MAGIC_ALG
},
ALG_ID_RC4
},
{{
MAGIC_ALG
},
ALG_ID_RNG
},
{{
MAGIC_ALG
},
ALG_ID_RNG
},
{{
MAGIC_ALG
},
ALG_ID_MD5
,
0
,
BCRYPT_ALG_HANDLE_HMAC_FLAG
},
{{
MAGIC_ALG
},
ALG_ID_MD5
,
0
,
BCRYPT_ALG_HANDLE_HMAC_FLAG
},
{{
MAGIC_ALG
},
ALG_ID_SHA1
,
0
,
BCRYPT_ALG_HANDLE_HMAC_FLAG
},
{{
MAGIC_ALG
},
ALG_ID_SHA1
,
0
,
BCRYPT_ALG_HANDLE_HMAC_FLAG
},
...
@@ -568,6 +569,7 @@ struct hash
...
@@ -568,6 +569,7 @@ struct hash
struct
hash_impl
inner
;
struct
hash_impl
inner
;
};
};
#define BLOCK_LENGTH_RC4 1
#define BLOCK_LENGTH_3DES 8
#define BLOCK_LENGTH_3DES 8
#define BLOCK_LENGTH_AES 16
#define BLOCK_LENGTH_AES 16
...
@@ -708,6 +710,20 @@ static NTSTATUS get_aes_property( enum chain_mode mode, const WCHAR *prop, UCHAR
...
@@ -708,6 +710,20 @@ static NTSTATUS get_aes_property( enum chain_mode mode, const WCHAR *prop, UCHAR
return
STATUS_NOT_IMPLEMENTED
;
return
STATUS_NOT_IMPLEMENTED
;
}
}
static
NTSTATUS
get_rc4_property
(
enum
chain_mode
mode
,
const
WCHAR
*
prop
,
UCHAR
*
buf
,
ULONG
size
,
ULONG
*
ret_size
)
{
if
(
!
wcscmp
(
prop
,
BCRYPT_BLOCK_LENGTH
))
{
*
ret_size
=
sizeof
(
ULONG
);
if
(
size
<
sizeof
(
ULONG
))
return
STATUS_BUFFER_TOO_SMALL
;
if
(
buf
)
*
(
ULONG
*
)
buf
=
BLOCK_LENGTH_RC4
;
return
STATUS_SUCCESS
;
}
FIXME
(
"unsupported property %s
\n
"
,
debugstr_w
(
prop
)
);
return
STATUS_NOT_IMPLEMENTED
;
}
static
NTSTATUS
get_rsa_property
(
enum
chain_mode
mode
,
const
WCHAR
*
prop
,
UCHAR
*
buf
,
ULONG
size
,
ULONG
*
ret_size
)
static
NTSTATUS
get_rsa_property
(
enum
chain_mode
mode
,
const
WCHAR
*
prop
,
UCHAR
*
buf
,
ULONG
size
,
ULONG
*
ret_size
)
{
{
if
(
!
wcscmp
(
prop
,
BCRYPT_PADDING_SCHEMES
))
if
(
!
wcscmp
(
prop
,
BCRYPT_PADDING_SCHEMES
))
...
@@ -746,6 +762,9 @@ static NTSTATUS get_alg_property( const struct algorithm *alg, const WCHAR *prop
...
@@ -746,6 +762,9 @@ static NTSTATUS get_alg_property( const struct algorithm *alg, const WCHAR *prop
case
ALG_ID_AES
:
case
ALG_ID_AES
:
return
get_aes_property
(
alg
->
mode
,
prop
,
buf
,
size
,
ret_size
);
return
get_aes_property
(
alg
->
mode
,
prop
,
buf
,
size
,
ret_size
);
case
ALG_ID_RC4
:
return
get_rc4_property
(
alg
->
mode
,
prop
,
buf
,
size
,
ret_size
);
case
ALG_ID_RSA
:
case
ALG_ID_RSA
:
return
get_rsa_property
(
alg
->
mode
,
prop
,
buf
,
size
,
ret_size
);
return
get_rsa_property
(
alg
->
mode
,
prop
,
buf
,
size
,
ret_size
);
...
@@ -813,6 +832,17 @@ static NTSTATUS set_alg_property( struct algorithm *alg, const WCHAR *prop, UCHA
...
@@ -813,6 +832,17 @@ static NTSTATUS set_alg_property( struct algorithm *alg, const WCHAR *prop, UCHA
FIXME
(
"unsupported aes algorithm property %s
\n
"
,
debugstr_w
(
prop
)
);
FIXME
(
"unsupported aes algorithm property %s
\n
"
,
debugstr_w
(
prop
)
);
return
STATUS_NOT_IMPLEMENTED
;
return
STATUS_NOT_IMPLEMENTED
;
case
ALG_ID_RC4
:
if
(
!
wcscmp
(
prop
,
BCRYPT_CHAINING_MODE
))
{
if
(
!
wcscmp
(
(
WCHAR
*
)
value
,
BCRYPT_CHAIN_MODE_NA
))
return
STATUS_SUCCESS
;
FIXME
(
"unsupported mode %s
\n
"
,
debugstr_w
((
WCHAR
*
)
value
)
);
return
STATUS_NOT_IMPLEMENTED
;
}
FIXME
(
"unsupported rc4 algorithm property %s
\n
"
,
debugstr_w
(
prop
)
);
return
STATUS_NOT_IMPLEMENTED
;
default:
default:
FIXME
(
"unsupported algorithm %u
\n
"
,
alg
->
id
);
FIXME
(
"unsupported algorithm %u
\n
"
,
alg
->
id
);
return
STATUS_NOT_IMPLEMENTED
;
return
STATUS_NOT_IMPLEMENTED
;
...
...
dlls/bcrypt/tests/bcrypt.c
View file @
9742fe89
...
@@ -3561,6 +3561,35 @@ static void test_SecretAgreement(void)
...
@@ -3561,6 +3561,35 @@ static void test_SecretAgreement(void)
ok
(
status
==
STATUS_SUCCESS
,
"got %#lx
\n
"
,
status
);
ok
(
status
==
STATUS_SUCCESS
,
"got %#lx
\n
"
,
status
);
}
}
static
void
test_RC4
(
void
)
{
BCRYPT_ALG_HANDLE
alg
;
NTSTATUS
status
;
ULONG
len
,
size
;
status
=
BCryptOpenAlgorithmProvider
(
&
alg
,
BCRYPT_RC4_ALGORITHM
,
NULL
,
0
);
ok
(
status
==
STATUS_SUCCESS
,
"got %#lx
\n
"
,
status
);
len
=
size
=
0
;
status
=
BCryptGetProperty
(
alg
,
BCRYPT_OBJECT_LENGTH
,
(
UCHAR
*
)
&
len
,
sizeof
(
len
),
&
size
,
0
);
ok
(
status
==
STATUS_SUCCESS
,
"got %#lx
\n
"
,
status
);
ok
(
len
,
"expected non-zero len
\n
"
);
ok
(
size
==
sizeof
(
len
),
"got %lu
\n
"
,
size
);
len
=
size
=
0
;
status
=
BCryptGetProperty
(
alg
,
BCRYPT_BLOCK_LENGTH
,
(
UCHAR
*
)
&
len
,
sizeof
(
len
),
&
size
,
0
);
ok
(
status
==
STATUS_SUCCESS
,
"got %#lx
\n
"
,
status
);
ok
(
len
==
1
,
"got %lu
\n
"
,
len
);
ok
(
size
==
sizeof
(
len
),
"got %lu
\n
"
,
size
);
size
=
sizeof
(
BCRYPT_CHAIN_MODE_NA
);
status
=
BCryptSetProperty
(
alg
,
BCRYPT_CHAINING_MODE
,
(
UCHAR
*
)
BCRYPT_CHAIN_MODE_NA
,
size
,
0
);
ok
(
!
status
,
"got %#lx
\n
"
,
status
);
status
=
BCryptCloseAlgorithmProvider
(
alg
,
0
);
ok
(
status
==
STATUS_SUCCESS
,
"got %#lx
\n
"
,
status
);
}
START_TEST
(
bcrypt
)
START_TEST
(
bcrypt
)
{
{
HMODULE
module
;
HMODULE
module
;
...
@@ -3597,6 +3626,7 @@ START_TEST(bcrypt)
...
@@ -3597,6 +3626,7 @@ START_TEST(bcrypt)
test_DSA
();
test_DSA
();
test_SecretAgreement
();
test_SecretAgreement
();
test_rsa_encrypt
();
test_rsa_encrypt
();
test_RC4
();
FreeLibrary
(
module
);
FreeLibrary
(
module
);
}
}
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