mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-31 12:19:49 +00:00
crypt32: Use assignment instead of memcpy to copy structs.
This commit is contained in:
parent
7d0ab835ae
commit
6af92365ea
4 changed files with 11 additions and 17 deletions
|
@ -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(©, keyProvInfo, sizeof(copy));
|
copy = *keyProvInfo;
|
||||||
copy.pwszContainerName = containerW;
|
copy.pwszContainerName = containerW;
|
||||||
matches = key_prov_info_matches_cert(pCert, ©);
|
matches = key_prov_info_matches_cert(pCert, ©);
|
||||||
if (matches)
|
if (matches)
|
||||||
|
@ -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,
|
||||||
|
|
||||||
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
|
||||||
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
|
||||||
}
|
}
|
||||||
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;
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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);
|
||||||
|
|
Loading…
Reference in a new issue