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
ec85dfe3
Commit
ec85dfe3
authored
Sep 12, 2022
by
Hans Leidekker
Committed by
Alexandre Julliard
Sep 13, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcrypt: Rename mode_id to chain_mode.
parent
6f5028dd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
63 deletions
+63
-63
bcrypt_internal.h
dlls/bcrypt/bcrypt_internal.h
+16
-16
bcrypt_main.c
dlls/bcrypt/bcrypt_main.c
+35
-35
gnutls.c
dlls/bcrypt/gnutls.c
+12
-12
No files found.
dlls/bcrypt/bcrypt_internal.h
View file @
ec85dfe3
...
@@ -144,31 +144,31 @@ enum alg_id
...
@@ -144,31 +144,31 @@ enum alg_id
ALG_ID_RNG
,
ALG_ID_RNG
,
};
};
enum
mode_id
enum
chain_mode
{
{
MODE_ID
_CBC
,
CHAIN_MODE
_CBC
,
MODE_ID
_ECB
,
CHAIN_MODE
_ECB
,
MODE_ID
_CFB
,
CHAIN_MODE
_CFB
,
MODE_ID
_CCM
,
CHAIN_MODE
_CCM
,
MODE_ID
_GCM
,
CHAIN_MODE
_GCM
,
};
};
struct
algorithm
struct
algorithm
{
{
struct
object
hdr
;
struct
object
hdr
;
enum
alg_id
id
;
enum
alg_id
id
;
enum
mode_id
mode
;
enum
chain_mode
mode
;
unsigned
flags
;
unsigned
flags
;
};
};
struct
key_symmetric
struct
key_symmetric
{
{
enum
mode_id
mode
;
enum
chain_mode
mode
;
ULONG
block_size
;
ULONG
block_size
;
UCHAR
*
vector
;
UCHAR
*
vector
;
ULONG
vector_len
;
ULONG
vector_len
;
UCHAR
*
secret
;
UCHAR
*
secret
;
unsigned
secret_len
;
unsigned
secret_len
;
CRITICAL_SECTION
cs
;
CRITICAL_SECTION
cs
;
};
};
...
...
dlls/bcrypt/bcrypt_main.c
View file @
ec85dfe3
...
@@ -197,17 +197,17 @@ static const struct algorithm pseudo_algorithms[] =
...
@@ -197,17 +197,17 @@ static const struct algorithm pseudo_algorithms[] =
{{
0
}},
/* AES_GMAC */
{{
0
}},
/* AES_GMAC */
{{
MAGIC_ALG
},
ALG_ID_MD2
,
0
,
BCRYPT_ALG_HANDLE_HMAC_FLAG
},
{{
MAGIC_ALG
},
ALG_ID_MD2
,
0
,
BCRYPT_ALG_HANDLE_HMAC_FLAG
},
{{
MAGIC_ALG
},
ALG_ID_MD4
,
0
,
BCRYPT_ALG_HANDLE_HMAC_FLAG
},
{{
MAGIC_ALG
},
ALG_ID_MD4
,
0
,
BCRYPT_ALG_HANDLE_HMAC_FLAG
},
{{
MAGIC_ALG
},
ALG_ID_3DES
,
MODE_ID
_CBC
},
{{
MAGIC_ALG
},
ALG_ID_3DES
,
CHAIN_MODE
_CBC
},
{{
MAGIC_ALG
},
ALG_ID_3DES
,
MODE_ID
_ECB
},
{{
MAGIC_ALG
},
ALG_ID_3DES
,
CHAIN_MODE
_ECB
},
{{
MAGIC_ALG
},
ALG_ID_3DES
,
MODE_ID
_CFB
},
{{
MAGIC_ALG
},
ALG_ID_3DES
,
CHAIN_MODE
_CFB
},
{{
0
}},
/* 3DES_112_CBC */
{{
0
}},
/* 3DES_112_CBC */
{{
0
}},
/* 3DES_112_ECB */
{{
0
}},
/* 3DES_112_ECB */
{{
0
}},
/* 3DES_112_CFB */
{{
0
}},
/* 3DES_112_CFB */
{{
MAGIC_ALG
},
ALG_ID_AES
,
MODE_ID
_CBC
},
{{
MAGIC_ALG
},
ALG_ID_AES
,
CHAIN_MODE
_CBC
},
{{
MAGIC_ALG
},
ALG_ID_AES
,
MODE_ID
_ECB
},
{{
MAGIC_ALG
},
ALG_ID_AES
,
CHAIN_MODE
_ECB
},
{{
MAGIC_ALG
},
ALG_ID_AES
,
MODE_ID
_CFB
},
{{
MAGIC_ALG
},
ALG_ID_AES
,
CHAIN_MODE
_CFB
},
{{
MAGIC_ALG
},
ALG_ID_AES
,
MODE_ID
_CCM
},
{{
MAGIC_ALG
},
ALG_ID_AES
,
CHAIN_MODE
_CCM
},
{{
MAGIC_ALG
},
ALG_ID_AES
,
MODE_ID
_GCM
},
{{
MAGIC_ALG
},
ALG_ID_AES
,
CHAIN_MODE
_GCM
},
{{
0
}},
/* DES_CBC */
{{
0
}},
/* DES_CBC */
{{
0
}},
/* DES_ECB */
{{
0
}},
/* DES_ECB */
{{
0
}},
/* DES_CFB */
{{
0
}},
/* DES_CFB */
...
@@ -309,7 +309,7 @@ NTSTATUS WINAPI BCryptGenRandom( BCRYPT_ALG_HANDLE handle, UCHAR *buffer, ULONG
...
@@ -309,7 +309,7 @@ NTSTATUS WINAPI BCryptGenRandom( BCRYPT_ALG_HANDLE handle, UCHAR *buffer, ULONG
return
STATUS_NOT_IMPLEMENTED
;
return
STATUS_NOT_IMPLEMENTED
;
}
}
static
struct
algorithm
*
create_algorithm
(
enum
alg_id
id
,
enum
mode_id
mode
,
DWORD
flags
)
static
struct
algorithm
*
create_algorithm
(
enum
alg_id
id
,
enum
chain_mode
mode
,
DWORD
flags
)
{
{
struct
algorithm
*
ret
;
struct
algorithm
*
ret
;
if
(
!
(
ret
=
calloc
(
1
,
sizeof
(
*
ret
)
)))
return
NULL
;
if
(
!
(
ret
=
calloc
(
1
,
sizeof
(
*
ret
)
)))
return
NULL
;
...
@@ -577,7 +577,7 @@ static NTSTATUS generic_alg_property( enum alg_id id, const WCHAR *prop, UCHAR *
...
@@ -577,7 +577,7 @@ static NTSTATUS generic_alg_property( enum alg_id id, const WCHAR *prop, UCHAR *
return
STATUS_NOT_IMPLEMENTED
;
return
STATUS_NOT_IMPLEMENTED
;
}
}
static
NTSTATUS
get_3des_property
(
enum
mode_id
mode
,
const
WCHAR
*
prop
,
UCHAR
*
buf
,
ULONG
size
,
ULONG
*
ret_size
)
static
NTSTATUS
get_3des_property
(
enum
chain_mode
mode
,
const
WCHAR
*
prop
,
UCHAR
*
buf
,
ULONG
size
,
ULONG
*
ret_size
)
{
{
if
(
!
wcscmp
(
prop
,
BCRYPT_BLOCK_LENGTH
))
if
(
!
wcscmp
(
prop
,
BCRYPT_BLOCK_LENGTH
))
{
{
...
@@ -591,7 +591,7 @@ static NTSTATUS get_3des_property( enum mode_id mode, const WCHAR *prop, UCHAR *
...
@@ -591,7 +591,7 @@ static NTSTATUS get_3des_property( enum mode_id mode, const WCHAR *prop, UCHAR *
const
WCHAR
*
str
;
const
WCHAR
*
str
;
switch
(
mode
)
switch
(
mode
)
{
{
case
MODE_ID
_CBC
:
str
=
BCRYPT_CHAIN_MODE_CBC
;
break
;
case
CHAIN_MODE
_CBC
:
str
=
BCRYPT_CHAIN_MODE_CBC
;
break
;
default:
return
STATUS_NOT_IMPLEMENTED
;
default:
return
STATUS_NOT_IMPLEMENTED
;
}
}
...
@@ -617,7 +617,7 @@ static NTSTATUS get_3des_property( enum mode_id mode, const WCHAR *prop, UCHAR *
...
@@ -617,7 +617,7 @@ static NTSTATUS get_3des_property( enum mode_id mode, const WCHAR *prop, UCHAR *
return
STATUS_NOT_IMPLEMENTED
;
return
STATUS_NOT_IMPLEMENTED
;
}
}
static
NTSTATUS
get_aes_property
(
enum
mode_id
mode
,
const
WCHAR
*
prop
,
UCHAR
*
buf
,
ULONG
size
,
ULONG
*
ret_size
)
static
NTSTATUS
get_aes_property
(
enum
chain_mode
mode
,
const
WCHAR
*
prop
,
UCHAR
*
buf
,
ULONG
size
,
ULONG
*
ret_size
)
{
{
if
(
!
wcscmp
(
prop
,
BCRYPT_BLOCK_LENGTH
))
if
(
!
wcscmp
(
prop
,
BCRYPT_BLOCK_LENGTH
))
{
{
...
@@ -631,10 +631,10 @@ static NTSTATUS get_aes_property( enum mode_id mode, const WCHAR *prop, UCHAR *b
...
@@ -631,10 +631,10 @@ static NTSTATUS get_aes_property( enum mode_id mode, const WCHAR *prop, UCHAR *b
const
WCHAR
*
str
;
const
WCHAR
*
str
;
switch
(
mode
)
switch
(
mode
)
{
{
case
MODE_ID
_ECB
:
str
=
BCRYPT_CHAIN_MODE_ECB
;
break
;
case
CHAIN_MODE
_ECB
:
str
=
BCRYPT_CHAIN_MODE_ECB
;
break
;
case
MODE_ID
_CBC
:
str
=
BCRYPT_CHAIN_MODE_CBC
;
break
;
case
CHAIN_MODE
_CBC
:
str
=
BCRYPT_CHAIN_MODE_CBC
;
break
;
case
MODE_ID
_GCM
:
str
=
BCRYPT_CHAIN_MODE_GCM
;
break
;
case
CHAIN_MODE
_GCM
:
str
=
BCRYPT_CHAIN_MODE_GCM
;
break
;
case
MODE_ID
_CFB
:
str
=
BCRYPT_CHAIN_MODE_CFB
;
break
;
case
CHAIN_MODE
_CFB
:
str
=
BCRYPT_CHAIN_MODE_CFB
;
break
;
default:
return
STATUS_NOT_IMPLEMENTED
;
default:
return
STATUS_NOT_IMPLEMENTED
;
}
}
...
@@ -659,7 +659,7 @@ static NTSTATUS get_aes_property( enum mode_id mode, const WCHAR *prop, UCHAR *b
...
@@ -659,7 +659,7 @@ static NTSTATUS get_aes_property( enum mode_id mode, const WCHAR *prop, UCHAR *b
if
(
!
wcscmp
(
prop
,
BCRYPT_AUTH_TAG_LENGTH
))
if
(
!
wcscmp
(
prop
,
BCRYPT_AUTH_TAG_LENGTH
))
{
{
BCRYPT_AUTH_TAG_LENGTHS_STRUCT
*
tag_length
=
(
void
*
)
buf
;
BCRYPT_AUTH_TAG_LENGTHS_STRUCT
*
tag_length
=
(
void
*
)
buf
;
if
(
mode
!=
MODE_ID
_GCM
)
return
STATUS_NOT_SUPPORTED
;
if
(
mode
!=
CHAIN_MODE
_GCM
)
return
STATUS_NOT_SUPPORTED
;
*
ret_size
=
sizeof
(
*
tag_length
);
*
ret_size
=
sizeof
(
*
tag_length
);
if
(
tag_length
&&
size
<
*
ret_size
)
return
STATUS_BUFFER_TOO_SMALL
;
if
(
tag_length
&&
size
<
*
ret_size
)
return
STATUS_BUFFER_TOO_SMALL
;
if
(
tag_length
)
if
(
tag_length
)
...
@@ -675,7 +675,7 @@ static NTSTATUS get_aes_property( enum mode_id mode, const WCHAR *prop, UCHAR *b
...
@@ -675,7 +675,7 @@ static NTSTATUS get_aes_property( enum mode_id mode, const WCHAR *prop, UCHAR *b
return
STATUS_NOT_IMPLEMENTED
;
return
STATUS_NOT_IMPLEMENTED
;
}
}
static
NTSTATUS
get_rsa_property
(
enum
mode_id
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
))
{
{
...
@@ -689,7 +689,7 @@ static NTSTATUS get_rsa_property( enum mode_id mode, const WCHAR *prop, UCHAR *b
...
@@ -689,7 +689,7 @@ static NTSTATUS get_rsa_property( enum mode_id mode, const WCHAR *prop, UCHAR *b
return
STATUS_NOT_IMPLEMENTED
;
return
STATUS_NOT_IMPLEMENTED
;
}
}
static
NTSTATUS
get_dsa_property
(
enum
mode_id
mode
,
const
WCHAR
*
prop
,
UCHAR
*
buf
,
ULONG
size
,
ULONG
*
ret_size
)
static
NTSTATUS
get_dsa_property
(
enum
chain_mode
mode
,
const
WCHAR
*
prop
,
UCHAR
*
buf
,
ULONG
size
,
ULONG
*
ret_size
)
{
{
if
(
!
wcscmp
(
prop
,
BCRYPT_PADDING_SCHEMES
))
return
STATUS_NOT_SUPPORTED
;
if
(
!
wcscmp
(
prop
,
BCRYPT_PADDING_SCHEMES
))
return
STATUS_NOT_SUPPORTED
;
FIXME
(
"unsupported property %s
\n
"
,
debugstr_w
(
prop
)
);
FIXME
(
"unsupported property %s
\n
"
,
debugstr_w
(
prop
)
);
...
@@ -736,7 +736,7 @@ static NTSTATUS set_alg_property( struct algorithm *alg, const WCHAR *prop, UCHA
...
@@ -736,7 +736,7 @@ static NTSTATUS set_alg_property( struct algorithm *alg, const WCHAR *prop, UCHA
{
{
if
(
!
wcscmp
(
(
WCHAR
*
)
value
,
BCRYPT_CHAIN_MODE_CBC
))
if
(
!
wcscmp
(
(
WCHAR
*
)
value
,
BCRYPT_CHAIN_MODE_CBC
))
{
{
alg
->
mode
=
MODE_ID
_CBC
;
alg
->
mode
=
CHAIN_MODE
_CBC
;
return
STATUS_SUCCESS
;
return
STATUS_SUCCESS
;
}
}
else
else
...
@@ -753,22 +753,22 @@ static NTSTATUS set_alg_property( struct algorithm *alg, const WCHAR *prop, UCHA
...
@@ -753,22 +753,22 @@ static NTSTATUS set_alg_property( struct algorithm *alg, const WCHAR *prop, UCHA
{
{
if
(
!
wcscmp
(
(
WCHAR
*
)
value
,
BCRYPT_CHAIN_MODE_ECB
))
if
(
!
wcscmp
(
(
WCHAR
*
)
value
,
BCRYPT_CHAIN_MODE_ECB
))
{
{
alg
->
mode
=
MODE_ID
_ECB
;
alg
->
mode
=
CHAIN_MODE
_ECB
;
return
STATUS_SUCCESS
;
return
STATUS_SUCCESS
;
}
}
else
if
(
!
wcscmp
(
(
WCHAR
*
)
value
,
BCRYPT_CHAIN_MODE_CBC
))
else
if
(
!
wcscmp
(
(
WCHAR
*
)
value
,
BCRYPT_CHAIN_MODE_CBC
))
{
{
alg
->
mode
=
MODE_ID
_CBC
;
alg
->
mode
=
CHAIN_MODE
_CBC
;
return
STATUS_SUCCESS
;
return
STATUS_SUCCESS
;
}
}
else
if
(
!
wcscmp
(
(
WCHAR
*
)
value
,
BCRYPT_CHAIN_MODE_GCM
))
else
if
(
!
wcscmp
(
(
WCHAR
*
)
value
,
BCRYPT_CHAIN_MODE_GCM
))
{
{
alg
->
mode
=
MODE_ID
_GCM
;
alg
->
mode
=
CHAIN_MODE
_GCM
;
return
STATUS_SUCCESS
;
return
STATUS_SUCCESS
;
}
}
else
if
(
!
wcscmp
(
(
WCHAR
*
)
value
,
BCRYPT_CHAIN_MODE_CFB
))
else
if
(
!
wcscmp
(
(
WCHAR
*
)
value
,
BCRYPT_CHAIN_MODE_CFB
))
{
{
alg
->
mode
=
MODE_ID
_CFB
;
alg
->
mode
=
CHAIN_MODE
_CFB
;
return
STATUS_SUCCESS
;
return
STATUS_SUCCESS
;
}
}
else
else
...
@@ -792,22 +792,22 @@ static NTSTATUS set_key_property( struct key *key, const WCHAR *prop, UCHAR *val
...
@@ -792,22 +792,22 @@ static NTSTATUS set_key_property( struct key *key, const WCHAR *prop, UCHAR *val
{
{
if
(
!
wcscmp
(
(
WCHAR
*
)
value
,
BCRYPT_CHAIN_MODE_ECB
))
if
(
!
wcscmp
(
(
WCHAR
*
)
value
,
BCRYPT_CHAIN_MODE_ECB
))
{
{
key
->
u
.
s
.
mode
=
MODE_ID
_ECB
;
key
->
u
.
s
.
mode
=
CHAIN_MODE
_ECB
;
return
STATUS_SUCCESS
;
return
STATUS_SUCCESS
;
}
}
else
if
(
!
wcscmp
(
(
WCHAR
*
)
value
,
BCRYPT_CHAIN_MODE_CBC
))
else
if
(
!
wcscmp
(
(
WCHAR
*
)
value
,
BCRYPT_CHAIN_MODE_CBC
))
{
{
key
->
u
.
s
.
mode
=
MODE_ID
_CBC
;
key
->
u
.
s
.
mode
=
CHAIN_MODE
_CBC
;
return
STATUS_SUCCESS
;
return
STATUS_SUCCESS
;
}
}
else
if
(
!
wcscmp
(
(
WCHAR
*
)
value
,
BCRYPT_CHAIN_MODE_GCM
))
else
if
(
!
wcscmp
(
(
WCHAR
*
)
value
,
BCRYPT_CHAIN_MODE_GCM
))
{
{
key
->
u
.
s
.
mode
=
MODE_ID
_GCM
;
key
->
u
.
s
.
mode
=
CHAIN_MODE
_GCM
;
return
STATUS_SUCCESS
;
return
STATUS_SUCCESS
;
}
}
else
if
(
!
wcscmp
(
(
WCHAR
*
)
value
,
BCRYPT_CHAIN_MODE_CFB
))
else
if
(
!
wcscmp
(
(
WCHAR
*
)
value
,
BCRYPT_CHAIN_MODE_CFB
))
{
{
key
->
u
.
s
.
mode
=
MODE_ID
_CFB
;
key
->
u
.
s
.
mode
=
CHAIN_MODE
_CFB
;
return
STATUS_SUCCESS
;
return
STATUS_SUCCESS
;
}
}
else
else
...
@@ -1131,7 +1131,7 @@ static NTSTATUS key_symmetric_set_vector( struct key *key, UCHAR *vector, ULONG
...
@@ -1131,7 +1131,7 @@ static NTSTATUS key_symmetric_set_vector( struct key *key, UCHAR *vector, ULONG
return
STATUS_SUCCESS
;
return
STATUS_SUCCESS
;
}
}
static
struct
key
*
create_symmetric_key
(
enum
alg_id
alg
,
enum
mode_id
mode
,
ULONG
block_size
,
UCHAR
*
secret
,
static
struct
key
*
create_symmetric_key
(
enum
alg_id
alg
,
enum
chain_mode
mode
,
ULONG
block_size
,
UCHAR
*
secret
,
ULONG
secret_len
)
ULONG
secret_len
)
{
{
struct
key
*
ret
;
struct
key
*
ret
;
...
@@ -1311,7 +1311,7 @@ static NTSTATUS key_symmetric_encrypt( struct key *key, UCHAR *input, ULONG inp
...
@@ -1311,7 +1311,7 @@ static NTSTATUS key_symmetric_encrypt( struct key *key, UCHAR *input, ULONG inp
UCHAR
*
buf
;
UCHAR
*
buf
;
NTSTATUS
status
;
NTSTATUS
status
;
if
(
key
->
u
.
s
.
mode
==
MODE_ID
_GCM
)
if
(
key
->
u
.
s
.
mode
==
CHAIN_MODE
_GCM
)
{
{
BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO
*
auth_info
=
padding
;
BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO
*
auth_info
=
padding
;
...
@@ -1357,7 +1357,7 @@ static NTSTATUS key_symmetric_encrypt( struct key *key, UCHAR *input, ULONG inp
...
@@ -1357,7 +1357,7 @@ static NTSTATUS key_symmetric_encrypt( struct key *key, UCHAR *input, ULONG inp
if
(
!
output
)
return
STATUS_SUCCESS
;
if
(
!
output
)
return
STATUS_SUCCESS
;
if
(
output_len
<
*
ret_len
)
return
STATUS_BUFFER_TOO_SMALL
;
if
(
output_len
<
*
ret_len
)
return
STATUS_BUFFER_TOO_SMALL
;
if
(
key
->
u
.
s
.
mode
==
MODE_ID
_ECB
&&
iv
)
return
STATUS_INVALID_PARAMETER
;
if
(
key
->
u
.
s
.
mode
==
CHAIN_MODE
_ECB
&&
iv
)
return
STATUS_INVALID_PARAMETER
;
if
((
status
=
key_symmetric_set_vector
(
key
,
iv
,
iv_len
,
flags
&
BCRYPT_BLOCK_PADDING
)))
return
status
;
if
((
status
=
key_symmetric_set_vector
(
key
,
iv
,
iv_len
,
flags
&
BCRYPT_BLOCK_PADDING
)))
return
status
;
encrypt_params
.
key
=
key
;
encrypt_params
.
key
=
key
;
...
@@ -1369,7 +1369,7 @@ static NTSTATUS key_symmetric_encrypt( struct key *key, UCHAR *input, ULONG inp
...
@@ -1369,7 +1369,7 @@ static NTSTATUS key_symmetric_encrypt( struct key *key, UCHAR *input, ULONG inp
{
{
if
((
status
=
UNIX_CALL
(
key_symmetric_encrypt
,
&
encrypt_params
)))
if
((
status
=
UNIX_CALL
(
key_symmetric_encrypt
,
&
encrypt_params
)))
return
status
;
return
status
;
if
(
key
->
u
.
s
.
mode
==
MODE_ID
_ECB
&&
(
status
=
key_symmetric_set_vector
(
key
,
NULL
,
0
,
TRUE
)))
if
(
key
->
u
.
s
.
mode
==
CHAIN_MODE
_ECB
&&
(
status
=
key_symmetric_set_vector
(
key
,
NULL
,
0
,
TRUE
)))
return
status
;
return
status
;
bytes_left
-=
key
->
u
.
s
.
block_size
;
bytes_left
-=
key
->
u
.
s
.
block_size
;
encrypt_params
.
input
+=
key
->
u
.
s
.
block_size
;
encrypt_params
.
input
+=
key
->
u
.
s
.
block_size
;
...
@@ -1398,7 +1398,7 @@ static NTSTATUS key_symmetric_decrypt( struct key *key, UCHAR *input, ULONG inpu
...
@@ -1398,7 +1398,7 @@ static NTSTATUS key_symmetric_decrypt( struct key *key, UCHAR *input, ULONG inpu
ULONG
bytes_left
=
input_len
;
ULONG
bytes_left
=
input_len
;
NTSTATUS
status
;
NTSTATUS
status
;
if
(
key
->
u
.
s
.
mode
==
MODE_ID
_GCM
)
if
(
key
->
u
.
s
.
mode
==
CHAIN_MODE
_GCM
)
{
{
BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO
*
auth_info
=
padding
;
BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO
*
auth_info
=
padding
;
UCHAR
tag
[
16
];
UCHAR
tag
[
16
];
...
@@ -1449,7 +1449,7 @@ static NTSTATUS key_symmetric_decrypt( struct key *key, UCHAR *input, ULONG inpu
...
@@ -1449,7 +1449,7 @@ static NTSTATUS key_symmetric_decrypt( struct key *key, UCHAR *input, ULONG inpu
}
}
else
if
(
output_len
<
*
ret_len
)
return
STATUS_BUFFER_TOO_SMALL
;
else
if
(
output_len
<
*
ret_len
)
return
STATUS_BUFFER_TOO_SMALL
;
if
(
key
->
u
.
s
.
mode
==
MODE_ID
_ECB
&&
iv
)
return
STATUS_INVALID_PARAMETER
;
if
(
key
->
u
.
s
.
mode
==
CHAIN_MODE
_ECB
&&
iv
)
return
STATUS_INVALID_PARAMETER
;
if
((
status
=
key_symmetric_set_vector
(
key
,
iv
,
iv_len
,
flags
&
BCRYPT_BLOCK_PADDING
)))
return
status
;
if
((
status
=
key_symmetric_set_vector
(
key
,
iv
,
iv_len
,
flags
&
BCRYPT_BLOCK_PADDING
)))
return
status
;
decrypt_params
.
key
=
key
;
decrypt_params
.
key
=
key
;
...
@@ -1460,7 +1460,7 @@ static NTSTATUS key_symmetric_decrypt( struct key *key, UCHAR *input, ULONG inpu
...
@@ -1460,7 +1460,7 @@ static NTSTATUS key_symmetric_decrypt( struct key *key, UCHAR *input, ULONG inpu
while
(
bytes_left
>=
key
->
u
.
s
.
block_size
)
while
(
bytes_left
>=
key
->
u
.
s
.
block_size
)
{
{
if
((
status
=
UNIX_CALL
(
key_symmetric_decrypt
,
&
decrypt_params
)))
return
status
;
if
((
status
=
UNIX_CALL
(
key_symmetric_decrypt
,
&
decrypt_params
)))
return
status
;
if
(
key
->
u
.
s
.
mode
==
MODE_ID
_ECB
&&
(
status
=
key_symmetric_set_vector
(
key
,
NULL
,
0
,
TRUE
)))
if
(
key
->
u
.
s
.
mode
==
CHAIN_MODE
_ECB
&&
(
status
=
key_symmetric_set_vector
(
key
,
NULL
,
0
,
TRUE
)))
return
status
;
return
status
;
bytes_left
-=
key
->
u
.
s
.
block_size
;
bytes_left
-=
key
->
u
.
s
.
block_size
;
decrypt_params
.
input
+=
key
->
u
.
s
.
block_size
;
decrypt_params
.
input
+=
key
->
u
.
s
.
block_size
;
...
...
dlls/bcrypt/gnutls.c
View file @
ec85dfe3
...
@@ -490,7 +490,7 @@ static gnutls_cipher_algorithm_t get_gnutls_cipher( const struct key *key )
...
@@ -490,7 +490,7 @@ static gnutls_cipher_algorithm_t get_gnutls_cipher( const struct key *key )
WARN
(
"handle block size
\n
"
);
WARN
(
"handle block size
\n
"
);
switch
(
key
->
u
.
s
.
mode
)
switch
(
key
->
u
.
s
.
mode
)
{
{
case
MODE_ID
_CBC
:
case
CHAIN_MODE
_CBC
:
return
GNUTLS_CIPHER_3DES_CBC
;
return
GNUTLS_CIPHER_3DES_CBC
;
default:
default:
break
;
break
;
...
@@ -502,17 +502,17 @@ static gnutls_cipher_algorithm_t get_gnutls_cipher( const struct key *key )
...
@@ -502,17 +502,17 @@ static gnutls_cipher_algorithm_t get_gnutls_cipher( const struct key *key )
WARN
(
"handle block size
\n
"
);
WARN
(
"handle block size
\n
"
);
switch
(
key
->
u
.
s
.
mode
)
switch
(
key
->
u
.
s
.
mode
)
{
{
case
MODE_ID
_GCM
:
case
CHAIN_MODE
_GCM
:
if
(
key
->
u
.
s
.
secret_len
==
16
)
return
GNUTLS_CIPHER_AES_128_GCM
;
if
(
key
->
u
.
s
.
secret_len
==
16
)
return
GNUTLS_CIPHER_AES_128_GCM
;
if
(
key
->
u
.
s
.
secret_len
==
32
)
return
GNUTLS_CIPHER_AES_256_GCM
;
if
(
key
->
u
.
s
.
secret_len
==
32
)
return
GNUTLS_CIPHER_AES_256_GCM
;
break
;
break
;
case
MODE_ID
_ECB
:
/* can be emulated with CBC + empty IV */
case
CHAIN_MODE
_ECB
:
/* can be emulated with CBC + empty IV */
case
MODE_ID
_CBC
:
case
CHAIN_MODE
_CBC
:
if
(
key
->
u
.
s
.
secret_len
==
16
)
return
GNUTLS_CIPHER_AES_128_CBC
;
if
(
key
->
u
.
s
.
secret_len
==
16
)
return
GNUTLS_CIPHER_AES_128_CBC
;
if
(
key
->
u
.
s
.
secret_len
==
24
)
return
GNUTLS_CIPHER_AES_192_CBC
;
if
(
key
->
u
.
s
.
secret_len
==
24
)
return
GNUTLS_CIPHER_AES_192_CBC
;
if
(
key
->
u
.
s
.
secret_len
==
32
)
return
GNUTLS_CIPHER_AES_256_CBC
;
if
(
key
->
u
.
s
.
secret_len
==
32
)
return
GNUTLS_CIPHER_AES_256_CBC
;
break
;
break
;
case
MODE_ID
_CFB
:
case
CHAIN_MODE
_CFB
:
if
(
key
->
u
.
s
.
secret_len
==
16
)
return
GNUTLS_CIPHER_AES_128_CFB8
;
if
(
key
->
u
.
s
.
secret_len
==
16
)
return
GNUTLS_CIPHER_AES_128_CFB8
;
if
(
key
->
u
.
s
.
secret_len
==
24
)
return
GNUTLS_CIPHER_AES_192_CFB8
;
if
(
key
->
u
.
s
.
secret_len
==
24
)
return
GNUTLS_CIPHER_AES_192_CFB8
;
if
(
key
->
u
.
s
.
secret_len
==
32
)
return
GNUTLS_CIPHER_AES_256_CFB8
;
if
(
key
->
u
.
s
.
secret_len
==
32
)
return
GNUTLS_CIPHER_AES_256_CFB8
;
...
@@ -2041,13 +2041,13 @@ typedef ULONG PTR32;
...
@@ -2041,13 +2041,13 @@ typedef ULONG PTR32;
struct
key_symmetric32
struct
key_symmetric32
{
{
enum
mode_id
mode
;
enum
chain_mode
mode
;
ULONG
block_size
;
ULONG
block_size
;
PTR32
vector
;
PTR32
vector
;
ULONG
vector_len
;
ULONG
vector_len
;
PTR32
secret
;
PTR32
secret
;
ULONG
secret_len
;
ULONG
secret_len
;
ULONG
__cs
[
6
];
ULONG
__cs
[
6
];
};
};
struct
key_asymmetric32
struct
key_asymmetric32
...
...
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