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
d32f9ef3
Commit
d32f9ef3
authored
Sep 08, 2022
by
Nikolay Sivov
Committed by
Alexandre Julliard
Sep 08, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dssenh: Use CRT allocation functions.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
parent
76dc7641
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
21 deletions
+20
-21
main.c
dlls/dssenh/main.c
+20
-21
No files found.
dlls/dssenh/main.c
View file @
d32f9ef3
...
...
@@ -31,7 +31,6 @@
#include "ntsecapi.h"
#include "wine/debug.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
dssenh
);
...
...
@@ -88,7 +87,7 @@ static struct container *create_key_container( const char *name, DWORD flags )
{
struct
container
*
ret
;
if
(
!
(
ret
=
heap_alloc_zero
(
sizeof
(
*
ret
)
)))
return
NULL
;
if
(
!
(
ret
=
calloc
(
1
,
sizeof
(
*
ret
)
)))
return
NULL
;
ret
->
magic
=
MAGIC_CONTAINER
;
ret
->
flags
=
flags
;
if
(
name
)
strcpy
(
ret
->
name
,
name
);
...
...
@@ -154,14 +153,14 @@ static struct key *create_key( ALG_ID algid, DWORD flags )
return
NULL
;
}
if
(
!
(
ret
=
heap_alloc_zero
(
sizeof
(
*
ret
)
)))
return
NULL
;
if
(
!
(
ret
=
calloc
(
1
,
sizeof
(
*
ret
)
)))
return
NULL
;
ret
->
magic
=
MAGIC_KEY
;
ret
->
algid
=
algid
;
ret
->
flags
=
flags
;
if
(
BCryptOpenAlgorithmProvider
(
&
ret
->
alg_handle
,
alg
,
MS_PRIMITIVE_PROVIDER
,
0
))
{
heap_
free
(
ret
);
free
(
ret
);
return
NULL
;
}
return
ret
;
...
...
@@ -173,7 +172,7 @@ static void destroy_key( struct key *key )
BCryptDestroyKey
(
key
->
handle
);
BCryptCloseAlgorithmProvider
(
key
->
alg_handle
,
0
);
key
->
magic
=
0
;
heap_
free
(
key
);
free
(
key
);
}
static
struct
key
*
import_key
(
DWORD
keyspec
,
BYTE
*
data
,
DWORD
len
)
...
...
@@ -201,7 +200,7 @@ static struct key *read_key( HKEY hkey, DWORD keyspec, DWORD flags )
if
(
!
(
value
=
map_keyspec_to_keypair_name
(
keyspec
)))
return
NULL
;
if
(
RegQueryValueExW
(
hkey
,
value
,
0
,
&
type
,
NULL
,
&
len
))
return
NULL
;
if
(
!
(
data
=
heap_
alloc
(
len
)))
return
NULL
;
if
(
!
(
data
=
m
alloc
(
len
)))
return
NULL
;
if
(
!
RegQueryValueExW
(
hkey
,
value
,
0
,
&
type
,
data
,
&
len
))
{
...
...
@@ -214,7 +213,7 @@ static struct key *read_key( HKEY hkey, DWORD keyspec, DWORD flags )
}
}
heap_
free
(
data
);
free
(
data
);
return
ret
;
}
...
...
@@ -224,7 +223,7 @@ static void destroy_container( struct container *container )
destroy_key
(
container
->
exch_key
);
destroy_key
(
container
->
sign_key
);
container
->
magic
=
0
;
heap_
free
(
container
);
free
(
container
);
}
static
struct
container
*
read_key_container
(
const
char
*
name
,
DWORD
flags
)
...
...
@@ -292,7 +291,7 @@ BOOL WINAPI CPAcquireContext( HCRYPTPROV *ret_prov, LPSTR container, DWORD flags
case
CRYPT_NEWKEYSET
|
CRYPT_MACHINE_KEYSET
:
if
((
ret
=
read_key_container
(
name
,
flags
)))
{
heap_
free
(
ret
);
free
(
ret
);
SetLastError
(
NTE_EXISTS
);
return
FALSE
;
}
...
...
@@ -348,7 +347,7 @@ static BOOL store_key_pair( struct key *key, HKEY hkey, DWORD keyspec, DWORD fla
if
(
!
(
value
=
map_keyspec_to_keypair_name
(
keyspec
)))
return
FALSE
;
if
(
BCryptExportKey
(
key
->
handle
,
NULL
,
LEGACY_DSA_V2_PRIVATE_BLOB
,
NULL
,
0
,
&
len
,
0
))
return
FALSE
;
if
(
!
(
data
=
heap_
alloc
(
len
)))
return
FALSE
;
if
(
!
(
data
=
m
alloc
(
len
)))
return
FALSE
;
if
(
!
BCryptExportKey
(
key
->
handle
,
NULL
,
LEGACY_DSA_V2_PRIVATE_BLOB
,
data
,
len
,
&
len
,
0
))
{
...
...
@@ -361,7 +360,7 @@ static BOOL store_key_pair( struct key *key, HKEY hkey, DWORD keyspec, DWORD fla
}
}
heap_
free
(
data
);
free
(
data
);
return
ret
;
}
...
...
@@ -392,7 +391,7 @@ static struct key *duplicate_key( const struct key *key )
if
(
BCryptDuplicateKey
(
key
->
handle
,
&
ret
->
handle
,
NULL
,
0
,
0
))
{
heap_
free
(
ret
);
free
(
ret
);
return
NULL
;
}
return
ret
;
...
...
@@ -596,7 +595,7 @@ static BOOL import_key_dss3( struct container *container, ALG_ID algid, const BY
if
(
!
(
key
=
create_key
(
CALG_DSS_SIGN
,
flags
)))
return
FALSE
;
size
=
sizeof
(
*
blob
)
+
(
pubkey
->
bitlenP
/
8
)
*
3
;
if
(
!
(
blob
=
heap_alloc_zero
(
size
)))
if
(
!
(
blob
=
calloc
(
1
,
size
)))
{
destroy_key
(
key
);
return
FALSE
;
...
...
@@ -630,11 +629,11 @@ static BOOL import_key_dss3( struct container *container, ALG_ID algid, const BY
{
WARN
(
"failed to import key %08lx
\n
"
,
status
);
destroy_key
(
key
);
heap_
free
(
blob
);
free
(
blob
);
return
FALSE
;
}
heap_
free
(
blob
);
free
(
blob
);
*
ret_key
=
(
HCRYPTKEY
)
key
;
return
TRUE
;
}
...
...
@@ -792,19 +791,19 @@ static struct hash *create_hash( ALG_ID algid )
return
NULL
;
}
if
(
!
(
ret
=
heap_alloc_zero
(
sizeof
(
*
ret
)
)))
return
NULL
;
if
(
!
(
ret
=
calloc
(
1
,
sizeof
(
*
ret
)
)))
return
NULL
;
ret
->
magic
=
MAGIC_HASH
;
ret
->
len
=
len
;
if
(
BCryptOpenAlgorithmProvider
(
&
alg_handle
,
alg
,
MS_PRIMITIVE_PROVIDER
,
0
))
{
heap_
free
(
ret
);
free
(
ret
);
return
NULL
;
}
if
(
BCryptCreateHash
(
alg_handle
,
&
ret
->
handle
,
NULL
,
0
,
NULL
,
0
,
0
))
{
BCryptCloseAlgorithmProvider
(
alg_handle
,
0
);
heap_
free
(
ret
);
free
(
ret
);
return
NULL
;
}
...
...
@@ -841,7 +840,7 @@ static void destroy_hash( struct hash *hash )
if
(
!
hash
)
return
;
BCryptDestroyHash
(
hash
->
handle
);
hash
->
magic
=
0
;
heap_
free
(
hash
);
free
(
hash
);
}
BOOL
WINAPI
CPDestroyHash
(
HCRYPTPROV
hprov
,
HCRYPTHASH
hhash
)
...
...
@@ -864,13 +863,13 @@ static struct hash *duplicate_hash( const struct hash *hash )
{
struct
hash
*
ret
;
if
(
!
(
ret
=
heap_
alloc
(
sizeof
(
*
ret
)
)))
return
NULL
;
if
(
!
(
ret
=
m
alloc
(
sizeof
(
*
ret
)
)))
return
NULL
;
ret
->
magic
=
hash
->
magic
;
ret
->
len
=
hash
->
len
;
if
(
BCryptDuplicateHash
(
hash
->
handle
,
&
ret
->
handle
,
NULL
,
0
,
0
))
{
heap_
free
(
ret
);
free
(
ret
);
return
NULL
;
}
memcpy
(
ret
->
value
,
hash
->
value
,
sizeof
(
hash
->
value
)
);
...
...
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