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
6af92365
Commit
6af92365
authored
Feb 05, 2013
by
Michael Stefaniuc
Committed by
Alexandre Julliard
Feb 05, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Use assignment instead of memcpy to copy structs.
parent
7d0ab835
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
17 deletions
+11
-17
cert.c
dlls/crypt32/cert.c
+5
-10
message.c
dlls/crypt32/message.c
+1
-2
serialize.c
dlls/crypt32/serialize.c
+3
-3
main.c
dlls/crypt32/tests/main.c
+2
-2
No files found.
dlls/crypt32/cert.c
View file @
6af92365
...
@@ -842,7 +842,7 @@ static BOOL container_matches_cert(PCCERT_CONTEXT pCert, LPCSTR container,
...
@@ -842,7 +842,7 @@ static BOOL container_matches_cert(PCCERT_CONTEXT pCert, LPCSTR container,
* keyProvInfo->pwszContainerName to be NULL or a heap-allocated container
* keyProvInfo->pwszContainerName to be NULL or a heap-allocated container
* name.
* name.
*/
*/
memcpy
(
&
copy
,
keyProvInfo
,
sizeof
(
copy
))
;
copy
=
*
keyProvInfo
;
copy
.
pwszContainerName
=
containerW
;
copy
.
pwszContainerName
=
containerW
;
matches
=
key_prov_info_matches_cert
(
pCert
,
&
copy
);
matches
=
key_prov_info_matches_cert
(
pCert
,
&
copy
);
if
(
matches
)
if
(
matches
)
...
@@ -2216,9 +2216,7 @@ BOOL WINAPI CryptSignAndEncodeCertificate(HCRYPTPROV_OR_NCRYPT_KEY_HANDLE hCrypt
...
@@ -2216,9 +2216,7 @@ BOOL WINAPI CryptSignAndEncodeCertificate(HCRYPTPROV_OR_NCRYPT_KEY_HANDLE hCrypt
info
.
ToBeSigned
.
cbData
=
encodedSize
;
info
.
ToBeSigned
.
cbData
=
encodedSize
;
info
.
ToBeSigned
.
pbData
=
encoded
;
info
.
ToBeSigned
.
pbData
=
encoded
;
memcpy
(
&
info
.
SignatureAlgorithm
,
info
.
SignatureAlgorithm
=
*
pSignatureAlgorithm
;
pSignatureAlgorithm
,
sizeof
(
info
.
SignatureAlgorithm
));
info
.
Signature
.
cbData
=
hashSize
;
info
.
Signature
.
cbData
=
hashSize
;
info
.
Signature
.
pbData
=
hash
;
info
.
Signature
.
pbData
=
hash
;
info
.
Signature
.
cUnusedBits
=
0
;
info
.
Signature
.
cUnusedBits
=
0
;
...
@@ -2986,8 +2984,7 @@ static PCCERT_CONTEXT CRYPT_CreateSignedCert(const CRYPT_DER_BLOB *blob,
...
@@ -2986,8 +2984,7 @@ static PCCERT_CONTEXT CRYPT_CreateSignedCert(const CRYPT_DER_BLOB *blob,
signedInfo
.
ToBeSigned
.
cbData
=
blob
->
cbData
;
signedInfo
.
ToBeSigned
.
cbData
=
blob
->
cbData
;
signedInfo
.
ToBeSigned
.
pbData
=
blob
->
pbData
;
signedInfo
.
ToBeSigned
.
pbData
=
blob
->
pbData
;
memcpy
(
&
signedInfo
.
SignatureAlgorithm
,
sigAlgo
,
signedInfo
.
SignatureAlgorithm
=
*
sigAlgo
;
sizeof
(
signedInfo
.
SignatureAlgorithm
));
signedInfo
.
Signature
.
cbData
=
sigSize
;
signedInfo
.
Signature
.
cbData
=
sigSize
;
signedInfo
.
Signature
.
pbData
=
sig
;
signedInfo
.
Signature
.
pbData
=
sig
;
signedInfo
.
Signature
.
cUnusedBits
=
0
;
signedInfo
.
Signature
.
cUnusedBits
=
0
;
...
@@ -3038,8 +3035,7 @@ static void CRYPT_MakeCertInfo(PCERT_INFO info, const CRYPT_DATA_BLOB *pSerialNu
...
@@ -3038,8 +3035,7 @@ static void CRYPT_MakeCertInfo(PCERT_INFO info, const CRYPT_DATA_BLOB *pSerialNu
info
->
SerialNumber
.
cbData
=
pSerialNumber
->
cbData
;
info
->
SerialNumber
.
cbData
=
pSerialNumber
->
cbData
;
info
->
SerialNumber
.
pbData
=
pSerialNumber
->
pbData
;
info
->
SerialNumber
.
pbData
=
pSerialNumber
->
pbData
;
if
(
pSignatureAlgorithm
)
if
(
pSignatureAlgorithm
)
memcpy
(
&
info
->
SignatureAlgorithm
,
pSignatureAlgorithm
,
info
->
SignatureAlgorithm
=
*
pSignatureAlgorithm
;
sizeof
(
info
->
SignatureAlgorithm
));
else
else
{
{
info
->
SignatureAlgorithm
.
pszObjId
=
oid
;
info
->
SignatureAlgorithm
.
pszObjId
=
oid
;
...
@@ -3066,8 +3062,7 @@ static void CRYPT_MakeCertInfo(PCERT_INFO info, const CRYPT_DATA_BLOB *pSerialNu
...
@@ -3066,8 +3062,7 @@ static void CRYPT_MakeCertInfo(PCERT_INFO info, const CRYPT_DATA_BLOB *pSerialNu
}
}
info
->
Subject
.
cbData
=
pSubjectIssuerBlob
->
cbData
;
info
->
Subject
.
cbData
=
pSubjectIssuerBlob
->
cbData
;
info
->
Subject
.
pbData
=
pSubjectIssuerBlob
->
pbData
;
info
->
Subject
.
pbData
=
pSubjectIssuerBlob
->
pbData
;
memcpy
(
&
info
->
SubjectPublicKeyInfo
,
pubKey
,
info
->
SubjectPublicKeyInfo
=
*
pubKey
;
sizeof
(
info
->
SubjectPublicKeyInfo
));
if
(
pExtensions
)
if
(
pExtensions
)
{
{
info
->
cExtension
=
pExtensions
->
cExtension
;
info
->
cExtension
=
pExtensions
->
cExtension
;
...
...
dlls/crypt32/message.c
View file @
6af92365
...
@@ -285,8 +285,7 @@ BOOL WINAPI CryptHashMessage(PCRYPT_HASH_MESSAGE_PARA pHashPara,
...
@@ -285,8 +285,7 @@ BOOL WINAPI CryptHashMessage(PCRYPT_HASH_MESSAGE_PARA pHashPara,
memset
(
&
info
,
0
,
sizeof
(
info
));
memset
(
&
info
,
0
,
sizeof
(
info
));
info
.
cbSize
=
sizeof
(
info
);
info
.
cbSize
=
sizeof
(
info
);
info
.
hCryptProv
=
pHashPara
->
hCryptProv
;
info
.
hCryptProv
=
pHashPara
->
hCryptProv
;
memcpy
(
&
info
.
HashAlgorithm
,
&
pHashPara
->
HashAlgorithm
,
info
.
HashAlgorithm
=
pHashPara
->
HashAlgorithm
;
sizeof
(
info
.
HashAlgorithm
));
info
.
pvHashAuxInfo
=
pHashPara
->
pvHashAuxInfo
;
info
.
pvHashAuxInfo
=
pHashPara
->
pvHashAuxInfo
;
msg
=
CryptMsgOpenToEncode
(
pHashPara
->
dwMsgEncodingType
,
flags
,
CMSG_HASHED
,
msg
=
CryptMsgOpenToEncode
(
pHashPara
->
dwMsgEncodingType
,
flags
,
CMSG_HASHED
,
&
info
,
NULL
,
NULL
);
&
info
,
NULL
,
NULL
);
...
...
dlls/crypt32/serialize.c
View file @
6af92365
...
@@ -652,21 +652,21 @@ static BOOL CRYPT_WriteSerializedStoreToStream(HCERTSTORE store,
...
@@ -652,21 +652,21 @@ static BOOL CRYPT_WriteSerializedStoreToStream(HCERTSTORE store,
ret
=
output
(
handle
,
fileHeader
,
sizeof
(
fileHeader
));
ret
=
output
(
handle
,
fileHeader
,
sizeof
(
fileHeader
));
if
(
ret
)
if
(
ret
)
{
{
memcpy
(
&
interface
,
pCertInterface
,
sizeof
(
interface
))
;
interface
=
*
pCertInterface
;
interface
.
serialize
=
(
SerializeElementFunc
)
CRYPT_SerializeCertNoHash
;
interface
.
serialize
=
(
SerializeElementFunc
)
CRYPT_SerializeCertNoHash
;
ret
=
CRYPT_SerializeContextsToStream
(
output
,
handle
,
&
interface
,
ret
=
CRYPT_SerializeContextsToStream
(
output
,
handle
,
&
interface
,
store
);
store
);
}
}
if
(
ret
)
if
(
ret
)
{
{
memcpy
(
&
interface
,
pCRLInterface
,
sizeof
(
interface
))
;
interface
=
*
pCRLInterface
;
interface
.
serialize
=
(
SerializeElementFunc
)
CRYPT_SerializeCRLNoHash
;
interface
.
serialize
=
(
SerializeElementFunc
)
CRYPT_SerializeCRLNoHash
;
ret
=
CRYPT_SerializeContextsToStream
(
output
,
handle
,
&
interface
,
ret
=
CRYPT_SerializeContextsToStream
(
output
,
handle
,
&
interface
,
store
);
store
);
}
}
if
(
ret
)
if
(
ret
)
{
{
memcpy
(
&
interface
,
pCTLInterface
,
sizeof
(
interface
))
;
interface
=
*
pCTLInterface
;
interface
.
serialize
=
(
SerializeElementFunc
)
CRYPT_SerializeCTLNoHash
;
interface
.
serialize
=
(
SerializeElementFunc
)
CRYPT_SerializeCTLNoHash
;
ret
=
CRYPT_SerializeContextsToStream
(
output
,
handle
,
&
interface
,
ret
=
CRYPT_SerializeContextsToStream
(
output
,
handle
,
&
interface
,
store
);
store
);
...
...
dlls/crypt32/tests/main.c
View file @
6af92365
...
@@ -181,12 +181,12 @@ static void test_verifyTimeValidity(void)
...
@@ -181,12 +181,12 @@ static void test_verifyTimeValidity(void)
/* Check with 0 NotBefore and NotAfter */
/* Check with 0 NotBefore and NotAfter */
ret
=
CertVerifyTimeValidity
(
&
fileTime
,
&
info
);
ret
=
CertVerifyTimeValidity
(
&
fileTime
,
&
info
);
ok
(
ret
==
1
,
"Expected 1, got %d
\n
"
,
ret
);
ok
(
ret
==
1
,
"Expected 1, got %d
\n
"
,
ret
);
memcpy
(
&
info
.
NotAfter
,
&
fileTime
,
sizeof
(
info
.
NotAfter
))
;
info
.
NotAfter
=
fileTime
;
/* Check with NotAfter equal to comparison time */
/* Check with NotAfter equal to comparison time */
ret
=
CertVerifyTimeValidity
(
&
fileTime
,
&
info
);
ret
=
CertVerifyTimeValidity
(
&
fileTime
,
&
info
);
ok
(
ret
==
0
,
"Expected 0, got %d
\n
"
,
ret
);
ok
(
ret
==
0
,
"Expected 0, got %d
\n
"
,
ret
);
/* Check with NotBefore after comparison time */
/* Check with NotBefore after comparison time */
memcpy
(
&
info
.
NotBefore
,
&
fileTime
,
sizeof
(
info
.
NotBefore
))
;
info
.
NotBefore
=
fileTime
;
info
.
NotBefore
.
dwLowDateTime
+=
5000
;
info
.
NotBefore
.
dwLowDateTime
+=
5000
;
ret
=
CertVerifyTimeValidity
(
&
fileTime
,
&
info
);
ret
=
CertVerifyTimeValidity
(
&
fileTime
,
&
info
);
ok
(
ret
==
-
1
,
"Expected -1, got %d
\n
"
,
ret
);
ok
(
ret
==
-
1
,
"Expected -1, got %d
\n
"
,
ret
);
...
...
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