crypt32: Fix alignment for 64-bit systems.

This commit is contained in:
Juan Lang 2007-09-18 09:21:39 -07:00 committed by Alexandre Julliard
parent 71b5ba0336
commit 91f2a4d687
1 changed files with 10 additions and 10 deletions

View File

@ -1756,8 +1756,8 @@ static inline void CRYPT_CopyAttributes(CRYPT_ATTRIBUTES *out,
{ {
DWORD i; DWORD i;
if ((*nextData - (LPBYTE)0) % sizeof(DWORD)) if ((*nextData - (LPBYTE)0) % sizeof(DWORD_PTR))
*nextData += (*nextData - (LPBYTE)0) % sizeof(DWORD); *nextData += (*nextData - (LPBYTE)0) % sizeof(DWORD_PTR);
out->rgAttr = (CRYPT_ATTRIBUTE *)*nextData; out->rgAttr = (CRYPT_ATTRIBUTE *)*nextData;
*nextData += in->cAttr * sizeof(CRYPT_ATTRIBUTE); *nextData += in->cAttr * sizeof(CRYPT_ATTRIBUTE);
for (i = 0; i < in->cAttr; i++) for (i = 0; i < in->cAttr; i++)
@ -1773,8 +1773,8 @@ static inline void CRYPT_CopyAttributes(CRYPT_ATTRIBUTES *out,
DWORD j; DWORD j;
out->rgAttr[i].cValue = in->rgAttr[i].cValue; out->rgAttr[i].cValue = in->rgAttr[i].cValue;
if ((*nextData - (LPBYTE)0) % sizeof(DWORD)) if ((*nextData - (LPBYTE)0) % sizeof(DWORD_PTR))
*nextData += (*nextData - (LPBYTE)0) % sizeof(DWORD); *nextData += (*nextData - (LPBYTE)0) % sizeof(DWORD_PTR);
out->rgAttr[i].rgValue = (PCRYPT_DATA_BLOB)*nextData; out->rgAttr[i].rgValue = (PCRYPT_DATA_BLOB)*nextData;
for (j = 0; j < in->rgAttr[i].cValue; j++) for (j = 0; j < in->rgAttr[i].cValue; j++)
CRYPT_CopyBlob(&out->rgAttr[i].rgValue[j], CRYPT_CopyBlob(&out->rgAttr[i].rgValue[j],
@ -1793,8 +1793,8 @@ static DWORD CRYPT_SizeOfAttributes(const CRYPT_ATTRIBUTES *attr)
if (attr->rgAttr[i].pszObjId) if (attr->rgAttr[i].pszObjId)
size += strlen(attr->rgAttr[i].pszObjId) + 1; size += strlen(attr->rgAttr[i].pszObjId) + 1;
/* align pointer */ /* align pointer */
if (size % sizeof(DWORD)) if (size % sizeof(DWORD_PTR))
size += size % sizeof(DWORD); size += size % sizeof(DWORD_PTR);
size += attr->rgAttr[i].cValue * sizeof(CRYPT_DATA_BLOB); size += attr->rgAttr[i].cValue * sizeof(CRYPT_DATA_BLOB);
for (j = 0; j < attr->rgAttr[i].cValue; j++) for (j = 0; j < attr->rgAttr[i].cValue; j++)
size += attr->rgAttr[i].rgValue[j].cbData; size += attr->rgAttr[i].rgValue[j].cbData;
@ -1818,8 +1818,8 @@ static BOOL CRYPT_CopySignerInfo(void *pvData, DWORD *pcbData,
size += in->HashEncryptionAlgorithm.Parameters.cbData; size += in->HashEncryptionAlgorithm.Parameters.cbData;
size += in->EncryptedHash.cbData; size += in->EncryptedHash.cbData;
/* align pointer */ /* align pointer */
if (size % sizeof(DWORD)) if (size % sizeof(DWORD_PTR))
size += size % sizeof(DWORD); size += size % sizeof(DWORD_PTR);
size += CRYPT_SizeOfAttributes(&in->AuthAttrs); size += CRYPT_SizeOfAttributes(&in->AuthAttrs);
size += CRYPT_SizeOfAttributes(&in->UnauthAttrs); size += CRYPT_SizeOfAttributes(&in->UnauthAttrs);
if (!pvData) if (!pvData)
@ -1847,8 +1847,8 @@ static BOOL CRYPT_CopySignerInfo(void *pvData, DWORD *pcbData,
&in->HashEncryptionAlgorithm, &nextData); &in->HashEncryptionAlgorithm, &nextData);
CRYPT_CopyBlob(&out->EncryptedHash, &in->EncryptedHash, &nextData); CRYPT_CopyBlob(&out->EncryptedHash, &in->EncryptedHash, &nextData);
/* align pointer */ /* align pointer */
if ((nextData - (LPBYTE)0) % sizeof(DWORD)) if ((nextData - (LPBYTE)0) % sizeof(DWORD_PTR))
nextData += (nextData - (LPBYTE)0) % sizeof(DWORD); nextData += (nextData - (LPBYTE)0) % sizeof(DWORD_PTR);
CRYPT_CopyAttributes(&out->AuthAttrs, &in->AuthAttrs, &nextData); CRYPT_CopyAttributes(&out->AuthAttrs, &in->AuthAttrs, &nextData);
CRYPT_CopyAttributes(&out->UnauthAttrs, &in->UnauthAttrs, &nextData); CRYPT_CopyAttributes(&out->UnauthAttrs, &in->UnauthAttrs, &nextData);
ret = TRUE; ret = TRUE;