Commit 6db69d02 authored by Alex Henrie's avatar Alex Henrie Committed by Alexandre Julliard

wintrust: Use CRT allocation functions.

parent 537bcadb
...@@ -92,10 +92,8 @@ static void WINTRUST_InitRegStructs(void) ...@@ -92,10 +92,8 @@ static void WINTRUST_InitRegStructs(void)
{ {
#define WINTRUST_INITREGENTRY( action, dllname, functionname ) \ #define WINTRUST_INITREGENTRY( action, dllname, functionname ) \
action.cbStruct = sizeof(CRYPT_TRUST_REG_ENTRY); \ action.cbStruct = sizeof(CRYPT_TRUST_REG_ENTRY); \
action.pwszDLLName = WINTRUST_Alloc(sizeof(dllname)); \ action.pwszDLLName = wcsdup(dllname); \
lstrcpyW(action.pwszDLLName, dllname); \ action.pwszFunctionName = wcsdup(functionname);
action.pwszFunctionName = WINTRUST_Alloc(sizeof(functionname)); \
lstrcpyW(action.pwszFunctionName, functionname);
WINTRUST_INITREGENTRY(SoftpubInitialization, SP_POLICY_PROVIDER_DLL_NAME, SP_INIT_FUNCTION) WINTRUST_INITREGENTRY(SoftpubInitialization, SP_POLICY_PROVIDER_DLL_NAME, SP_INIT_FUNCTION)
WINTRUST_INITREGENTRY(SoftpubMessage, SP_POLICY_PROVIDER_DLL_NAME, SP_OBJTRUST_FUNCTION) WINTRUST_INITREGENTRY(SoftpubMessage, SP_POLICY_PROVIDER_DLL_NAME, SP_OBJTRUST_FUNCTION)
...@@ -128,8 +126,8 @@ static void WINTRUST_InitRegStructs(void) ...@@ -128,8 +126,8 @@ static void WINTRUST_InitRegStructs(void)
static void WINTRUST_FreeRegStructs(void) static void WINTRUST_FreeRegStructs(void)
{ {
#define WINTRUST_FREEREGENTRY( action ) \ #define WINTRUST_FREEREGENTRY( action ) \
WINTRUST_Free(action.pwszDLLName); \ free(action.pwszDLLName); \
WINTRUST_Free(action.pwszFunctionName); free(action.pwszFunctionName);
WINTRUST_FREEREGENTRY(SoftpubInitialization); WINTRUST_FREEREGENTRY(SoftpubInitialization);
WINTRUST_FREEREGENTRY(SoftpubMessage); WINTRUST_FREEREGENTRY(SoftpubMessage);
...@@ -383,11 +381,11 @@ static LONG WINTRUST_WriteSingleUsageEntry(LPCSTR OID, ...@@ -383,11 +381,11 @@ static LONG WINTRUST_WriteSingleUsageEntry(LPCSTR OID,
/* Turn OID into a wide-character string */ /* Turn OID into a wide-character string */
Len = MultiByteToWideChar( CP_ACP, 0, OID, -1, NULL, 0 ); Len = MultiByteToWideChar( CP_ACP, 0, OID, -1, NULL, 0 );
OIDW = WINTRUST_Alloc( Len * sizeof(WCHAR) ); OIDW = malloc( Len * sizeof(WCHAR) );
MultiByteToWideChar( CP_ACP, 0, OID, -1, OIDW, Len ); MultiByteToWideChar( CP_ACP, 0, OID, -1, OIDW, Len );
/* Allocate the needed space for UsageKey */ /* Allocate the needed space for UsageKey */
UsageKey = WINTRUST_Alloc((lstrlenW(Trust) + lstrlenW(Usages) + Len) * sizeof(WCHAR)); UsageKey = malloc((wcslen(Trust) + wcslen(Usages) + Len) * sizeof(WCHAR));
/* Create the key string */ /* Create the key string */
lstrcpyW(UsageKey, Trust); lstrcpyW(UsageKey, Trust);
lstrcatW(UsageKey, Usages); lstrcatW(UsageKey, Usages);
...@@ -402,8 +400,8 @@ static LONG WINTRUST_WriteSingleUsageEntry(LPCSTR OID, ...@@ -402,8 +400,8 @@ static LONG WINTRUST_WriteSingleUsageEntry(LPCSTR OID,
} }
RegCloseKey(Key); RegCloseKey(Key);
WINTRUST_Free(OIDW); free(OIDW);
WINTRUST_Free(UsageKey); free(UsageKey);
return Res; return Res;
} }
...@@ -601,8 +599,7 @@ static BOOL WINTRUST_RegisterHttpsProv(void) ...@@ -601,8 +599,7 @@ static BOOL WINTRUST_RegisterHttpsProv(void)
ProvInfo.sTestPolicyProvider = NullCTRE; /* No diagnostic policy */ ProvInfo.sTestPolicyProvider = NullCTRE; /* No diagnostic policy */
ProvInfo.sCleanupProvider = SoftpubCleanup; ProvInfo.sCleanupProvider = SoftpubCleanup;
DefUsage.pwszDllName = WINTRUST_Alloc(sizeof(SP_POLICY_PROVIDER_DLL_NAME)); DefUsage.pwszDllName = wcsdup(SP_POLICY_PROVIDER_DLL_NAME);
lstrcpyW(DefUsage.pwszDllName, SP_POLICY_PROVIDER_DLL_NAME);
if (!WintrustAddDefaultForUsage(szOID_PKIX_KP_SERVER_AUTH, &DefUsage)) if (!WintrustAddDefaultForUsage(szOID_PKIX_KP_SERVER_AUTH, &DefUsage))
RegisteredOK = FALSE; RegisteredOK = FALSE;
...@@ -613,7 +610,7 @@ static BOOL WINTRUST_RegisterHttpsProv(void) ...@@ -613,7 +610,7 @@ static BOOL WINTRUST_RegisterHttpsProv(void)
if (!WintrustAddDefaultForUsage(szOID_SGC_NETSCAPE, &DefUsage)) if (!WintrustAddDefaultForUsage(szOID_SGC_NETSCAPE, &DefUsage))
RegisteredOK = FALSE; RegisteredOK = FALSE;
WINTRUST_Free(DefUsage.pwszDllName); free(DefUsage.pwszDllName);
if (!WintrustAddActionID(&ProvGUID, 0, &ProvInfo)) if (!WintrustAddActionID(&ProvGUID, 0, &ProvInfo))
RegisteredOK = FALSE; RegisteredOK = FALSE;
...@@ -762,26 +759,26 @@ BOOL WINAPI WintrustAddDefaultForUsage(const char *pszUsageOID, ...@@ -762,26 +759,26 @@ BOOL WINAPI WintrustAddDefaultForUsage(const char *pszUsageOID,
WCHAR* CallbackW; WCHAR* CallbackW;
Len = MultiByteToWideChar( CP_ACP, 0, psDefUsage->pwszLoadCallbackDataFunctionName, -1, NULL, 0 ); Len = MultiByteToWideChar( CP_ACP, 0, psDefUsage->pwszLoadCallbackDataFunctionName, -1, NULL, 0 );
CallbackW = WINTRUST_Alloc( Len * sizeof(WCHAR) ); CallbackW = malloc( Len * sizeof(WCHAR) );
MultiByteToWideChar( CP_ACP, 0, psDefUsage->pwszLoadCallbackDataFunctionName, -1, CallbackW, Len ); MultiByteToWideChar( CP_ACP, 0, psDefUsage->pwszLoadCallbackDataFunctionName, -1, CallbackW, Len );
Res = WINTRUST_WriteSingleUsageEntry(pszUsageOID, CBAlloc, CallbackW); Res = WINTRUST_WriteSingleUsageEntry(pszUsageOID, CBAlloc, CallbackW);
if (Res != ERROR_SUCCESS) WriteUsageError = Res; if (Res != ERROR_SUCCESS) WriteUsageError = Res;
WINTRUST_Free(CallbackW); free(CallbackW);
} }
if (psDefUsage->pwszFreeCallbackDataFunctionName) if (psDefUsage->pwszFreeCallbackDataFunctionName)
{ {
WCHAR* CallbackW; WCHAR* CallbackW;
Len = MultiByteToWideChar( CP_ACP, 0, psDefUsage->pwszFreeCallbackDataFunctionName, -1, NULL, 0 ); Len = MultiByteToWideChar( CP_ACP, 0, psDefUsage->pwszFreeCallbackDataFunctionName, -1, NULL, 0 );
CallbackW = WINTRUST_Alloc( Len * sizeof(WCHAR) ); CallbackW = malloc( Len * sizeof(WCHAR) );
MultiByteToWideChar( CP_ACP, 0, psDefUsage->pwszFreeCallbackDataFunctionName, -1, CallbackW, Len ); MultiByteToWideChar( CP_ACP, 0, psDefUsage->pwszFreeCallbackDataFunctionName, -1, CallbackW, Len );
Res = WINTRUST_WriteSingleUsageEntry(pszUsageOID, CBFree, CallbackW); Res = WINTRUST_WriteSingleUsageEntry(pszUsageOID, CBFree, CallbackW);
if (Res != ERROR_SUCCESS) WriteUsageError = Res; if (Res != ERROR_SUCCESS) WriteUsageError = Res;
WINTRUST_Free(CallbackW); free(CallbackW);
} }
WINTRUST_Guid2Wstr(psDefUsage->pgActionID, GuidString); WINTRUST_Guid2Wstr(psDefUsage->pgActionID, GuidString);
...@@ -852,6 +849,16 @@ static struct provider_cache_entry ...@@ -852,6 +849,16 @@ static struct provider_cache_entry
*provider_cache; *provider_cache;
static unsigned int provider_cache_size; static unsigned int provider_cache_size;
static void * WINAPI WINTRUST_Alloc(DWORD cb)
{
return calloc(1, cb);
}
static void WINAPI WINTRUST_Free(void *p)
{
free(p);
}
/*********************************************************************** /***********************************************************************
* WintrustLoadFunctionPointers (WINTRUST.@) * WintrustLoadFunctionPointers (WINTRUST.@)
*/ */
...@@ -951,10 +958,9 @@ static BOOL WINTRUST_SIPPAddProvider(GUID* Subject, WCHAR* MagicNumber) ...@@ -951,10 +958,9 @@ static BOOL WINTRUST_SIPPAddProvider(GUID* Subject, WCHAR* MagicNumber)
/* Clear and initialize the structure */ /* Clear and initialize the structure */
memset(&NewProv, 0, sizeof(SIP_ADD_NEWPROVIDER)); memset(&NewProv, 0, sizeof(SIP_ADD_NEWPROVIDER));
NewProv.cbStruct = sizeof(SIP_ADD_NEWPROVIDER); NewProv.cbStruct = sizeof(SIP_ADD_NEWPROVIDER);
NewProv.pwszDLLFileName = WINTRUST_Alloc(sizeof(SP_POLICY_PROVIDER_DLL_NAME)); NewProv.pwszDLLFileName = wcsdup(SP_POLICY_PROVIDER_DLL_NAME);
/* Fill the structure */ /* Fill the structure */
NewProv.pgSubject = Subject; NewProv.pgSubject = Subject;
lstrcpyW(NewProv.pwszDLLFileName, SP_POLICY_PROVIDER_DLL_NAME);
NewProv.pwszMagicNumber = MagicNumber; NewProv.pwszMagicNumber = MagicNumber;
NewProv.pwszIsFunctionName = NULL; NewProv.pwszIsFunctionName = NULL;
NewProv.pwszGetFuncName = CryptSIPGetSignedDataMsg; NewProv.pwszGetFuncName = CryptSIPGetSignedDataMsg;
...@@ -967,8 +973,8 @@ static BOOL WINTRUST_SIPPAddProvider(GUID* Subject, WCHAR* MagicNumber) ...@@ -967,8 +973,8 @@ static BOOL WINTRUST_SIPPAddProvider(GUID* Subject, WCHAR* MagicNumber)
Ret = CryptSIPAddProvider(&NewProv); Ret = CryptSIPAddProvider(&NewProv);
WINTRUST_Free(NewProv.pwszDLLFileName); free(NewProv.pwszDLLFileName);
return Ret; return Ret;
} }
......
...@@ -213,7 +213,7 @@ static BOOL hash_file_data( HANDLE file, DWORD start, DWORD end, HCRYPTHASH hash ...@@ -213,7 +213,7 @@ static BOOL hash_file_data( HANDLE file, DWORD start, DWORD end, HCRYPTHASH hash
{ {
DWORD bytes_read, size = end - start; DWORD bytes_read, size = end - start;
DWORD buffer_size = min( size, 1024*1024 ); DWORD buffer_size = min( size, 1024*1024 );
BYTE *buffer = HeapAlloc( GetProcessHeap(), 0, buffer_size ); BYTE *buffer = malloc( buffer_size );
if (!buffer) return FALSE; if (!buffer) return FALSE;
SetFilePointer( file, start, NULL, FILE_BEGIN ); SetFilePointer( file, start, NULL, FILE_BEGIN );
...@@ -224,7 +224,7 @@ static BOOL hash_file_data( HANDLE file, DWORD start, DWORD end, HCRYPTHASH hash ...@@ -224,7 +224,7 @@ static BOOL hash_file_data( HANDLE file, DWORD start, DWORD end, HCRYPTHASH hash
if (!CryptHashData( hash, buffer, bytes_read, 0 )) break; if (!CryptHashData( hash, buffer, bytes_read, 0 )) break;
size -= bytes_read; size -= bytes_read;
} }
HeapFree( GetProcessHeap(), 0, buffer ); free( buffer );
return !size; return !size;
} }
......
...@@ -36,24 +36,6 @@ ...@@ -36,24 +36,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(wintrust); WINE_DEFAULT_DEBUG_CHANNEL(wintrust);
/* Utility functions */
void * WINAPI WINTRUST_Alloc(DWORD cb)
{
return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, cb);
}
static void* WINTRUST_ReAlloc(void *ptr, DWORD cb) __WINE_ALLOC_SIZE(2);
static void* WINTRUST_ReAlloc(void *ptr, DWORD cb)
{
return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, ptr, cb);
}
void WINAPI WINTRUST_Free(void *p)
{
HeapFree(GetProcessHeap(), 0, p);
}
/*********************************************************************** /***********************************************************************
* TrustIsCertificateSelfSigned (WINTRUST.@) * TrustIsCertificateSelfSigned (WINTRUST.@)
*/ */
...@@ -200,23 +182,22 @@ static CRYPT_PROVIDER_DATA *WINTRUST_AllocateProviderData(void) ...@@ -200,23 +182,22 @@ static CRYPT_PROVIDER_DATA *WINTRUST_AllocateProviderData(void)
{ {
CRYPT_PROVIDER_DATA *provData; CRYPT_PROVIDER_DATA *provData;
provData = WINTRUST_Alloc(sizeof(CRYPT_PROVIDER_DATA)); provData = calloc(1, sizeof(CRYPT_PROVIDER_DATA));
if (!provData) if (!provData)
goto oom; goto oom;
provData->cbStruct = sizeof(CRYPT_PROVIDER_DATA); provData->cbStruct = sizeof(CRYPT_PROVIDER_DATA);
provData->padwTrustStepErrors = provData->padwTrustStepErrors = calloc(TRUSTERROR_MAX_STEPS, sizeof(DWORD));
WINTRUST_Alloc(TRUSTERROR_MAX_STEPS * sizeof(DWORD));
if (!provData->padwTrustStepErrors) if (!provData->padwTrustStepErrors)
goto oom; goto oom;
provData->cdwTrustStepErrors = TRUSTERROR_MAX_STEPS; provData->cdwTrustStepErrors = TRUSTERROR_MAX_STEPS;
provData->pPDSip = WINTRUST_Alloc(sizeof(PROVDATA_SIP)); provData->pPDSip = calloc(1, sizeof(PROVDATA_SIP));
if (!provData->pPDSip) if (!provData->pPDSip)
goto oom; goto oom;
provData->pPDSip->cbStruct = sizeof(PROVDATA_SIP); provData->pPDSip->cbStruct = sizeof(PROVDATA_SIP);
provData->psPfns = WINTRUST_Alloc(sizeof(CRYPT_PROVIDER_FUNCTIONS)); provData->psPfns = calloc(1, sizeof(CRYPT_PROVIDER_FUNCTIONS));
if (!provData->psPfns) if (!provData->psPfns)
goto oom; goto oom;
provData->psPfns->cbStruct = sizeof(CRYPT_PROVIDER_FUNCTIONS); provData->psPfns->cbStruct = sizeof(CRYPT_PROVIDER_FUNCTIONS);
...@@ -225,10 +206,10 @@ static CRYPT_PROVIDER_DATA *WINTRUST_AllocateProviderData(void) ...@@ -225,10 +206,10 @@ static CRYPT_PROVIDER_DATA *WINTRUST_AllocateProviderData(void)
oom: oom:
if (provData) if (provData)
{ {
WINTRUST_Free(provData->padwTrustStepErrors); free(provData->padwTrustStepErrors);
WINTRUST_Free(provData->pPDSip); free(provData->pPDSip);
WINTRUST_Free(provData->psPfns); free(provData->psPfns);
WINTRUST_Free(provData); free(provData);
} }
return NULL; return NULL;
} }
...@@ -309,10 +290,10 @@ static LONG WINTRUST_DefaultVerify(HWND hwnd, GUID *actionID, ...@@ -309,10 +290,10 @@ static LONG WINTRUST_DefaultVerify(HWND hwnd, GUID *actionID,
goto done; goto done;
error: error:
WINTRUST_Free(provData->padwTrustStepErrors); free(provData->padwTrustStepErrors);
WINTRUST_Free(provData->pPDSip); free(provData->pPDSip);
WINTRUST_Free(provData->psPfns); free(provData->psPfns);
WINTRUST_Free(provData); free(provData);
done: done:
TRACE("returning %08lx\n", err); TRACE("returning %08lx\n", err);
...@@ -332,10 +313,10 @@ static LONG WINTRUST_DefaultClose(HWND hwnd, GUID *actionID, ...@@ -332,10 +313,10 @@ static LONG WINTRUST_DefaultClose(HWND hwnd, GUID *actionID,
if (provData->psPfns->pfnCleanupPolicy) if (provData->psPfns->pfnCleanupPolicy)
err = provData->psPfns->pfnCleanupPolicy(provData); err = provData->psPfns->pfnCleanupPolicy(provData);
WINTRUST_Free(provData->padwTrustStepErrors); free(provData->padwTrustStepErrors);
WINTRUST_Free(provData->pPDSip); free(provData->pPDSip);
WINTRUST_Free(provData->psPfns); free(provData->psPfns);
WINTRUST_Free(provData); free(provData);
data->hWVTStateData = NULL; data->hWVTStateData = NULL;
} }
TRACE("returning %08lx\n", err); TRACE("returning %08lx\n", err);
...@@ -500,10 +481,10 @@ static LONG WINTRUST_CertVerify(HWND hwnd, GUID *actionID, ...@@ -500,10 +481,10 @@ static LONG WINTRUST_CertVerify(HWND hwnd, GUID *actionID,
goto done; goto done;
error: error:
WINTRUST_Free(provData->padwTrustStepErrors); free(provData->padwTrustStepErrors);
WINTRUST_Free(provData->pPDSip); free(provData->pPDSip);
WINTRUST_Free(provData->psPfns); free(provData->psPfns);
WINTRUST_Free(provData); free(provData);
done: done:
TRACE("returning %08lx\n", err); TRACE("returning %08lx\n", err);
...@@ -852,7 +833,7 @@ static BOOL WINAPI WINTRUST_enumUsages(PCCRYPT_OID_INFO pInfo, void *pvArg) ...@@ -852,7 +833,7 @@ static BOOL WINAPI WINTRUST_enumUsages(PCCRYPT_OID_INFO pInfo, void *pvArg)
if (!*usages) if (!*usages)
{ {
cUsages = 0; cUsages = 0;
*usages = WINTRUST_Alloc(2 * sizeof(PCCRYPT_OID_INFO)); *usages = malloc(2 * sizeof(PCCRYPT_OID_INFO));
} }
else else
{ {
...@@ -863,8 +844,7 @@ static BOOL WINAPI WINTRUST_enumUsages(PCCRYPT_OID_INFO pInfo, void *pvArg) ...@@ -863,8 +844,7 @@ static BOOL WINAPI WINTRUST_enumUsages(PCCRYPT_OID_INFO pInfo, void *pvArg)
*/ */
for (cUsages = 0, ptr = *usages; *ptr; ptr++, cUsages++) for (cUsages = 0, ptr = *usages; *ptr; ptr++, cUsages++)
; ;
*usages = WINTRUST_ReAlloc(*usages, *usages = realloc(*usages, (cUsages + 2) * sizeof(PCCRYPT_OID_INFO));
(cUsages + 2) * sizeof(PCCRYPT_OID_INFO));
} }
if (*usages) if (*usages)
{ {
...@@ -916,7 +896,7 @@ BOOL WINAPI WTHelperGetKnownUsages(DWORD action, PCCRYPT_OID_INFO **usages) ...@@ -916,7 +896,7 @@ BOOL WINAPI WTHelperGetKnownUsages(DWORD action, PCCRYPT_OID_INFO **usages)
} }
else if (action == 2) else if (action == 2)
{ {
WINTRUST_Free(*usages); free(*usages);
*usages = NULL; *usages = NULL;
ret = TRUE; ret = TRUE;
} }
...@@ -1003,14 +983,7 @@ BOOL WINAPI WINTRUST_AddStore(CRYPT_PROVIDER_DATA *data, HCERTSTORE store) ...@@ -1003,14 +983,7 @@ BOOL WINAPI WINTRUST_AddStore(CRYPT_PROVIDER_DATA *data, HCERTSTORE store)
TRACE("(%p, %p)\n", data, store); TRACE("(%p, %p)\n", data, store);
if (data->chStores) data->pahStores = realloc(data->pahStores, (data->chStores + 1) * sizeof(HCERTSTORE));
data->pahStores = WINTRUST_ReAlloc(data->pahStores,
(data->chStores + 1) * sizeof(HCERTSTORE));
else
{
data->pahStores = WINTRUST_Alloc(sizeof(HCERTSTORE));
data->chStores = 0;
}
if (data->pahStores) if (data->pahStores)
{ {
data->pahStores[data->chStores++] = CertDuplicateStore(store); data->pahStores[data->chStores++] = CertDuplicateStore(store);
...@@ -1039,14 +1012,8 @@ BOOL WINAPI WINTRUST_AddSgnr(CRYPT_PROVIDER_DATA *data, ...@@ -1039,14 +1012,8 @@ BOOL WINAPI WINTRUST_AddSgnr(CRYPT_PROVIDER_DATA *data,
SetLastError(ERROR_INVALID_PARAMETER); SetLastError(ERROR_INVALID_PARAMETER);
return FALSE; return FALSE;
} }
if (data->csSigners) data->pasSigners = realloc(data->pasSigners,
data->pasSigners = WINTRUST_ReAlloc(data->pasSigners, (data->csSigners + 1) * sizeof(CRYPT_PROVIDER_SGNR));
(data->csSigners + 1) * sizeof(CRYPT_PROVIDER_SGNR));
else
{
data->pasSigners = WINTRUST_Alloc(sizeof(CRYPT_PROVIDER_SGNR));
data->csSigners = 0;
}
if (data->pasSigners) if (data->pasSigners)
{ {
if (idxSigner < data->csSigners) if (idxSigner < data->csSigners)
...@@ -1088,17 +1055,10 @@ BOOL WINAPI WINTRUST_AddCert(CRYPT_PROVIDER_DATA *data, DWORD idxSigner, ...@@ -1088,17 +1055,10 @@ BOOL WINAPI WINTRUST_AddCert(CRYPT_PROVIDER_DATA *data, DWORD idxSigner,
SetLastError(ERROR_INVALID_PARAMETER); SetLastError(ERROR_INVALID_PARAMETER);
return FALSE; return FALSE;
} }
if (data->pasSigners[idxSigner].csCertChain) data->pasSigners[idxSigner].pasCertChain =
data->pasSigners[idxSigner].pasCertChain = realloc(data->pasSigners[idxSigner].pasCertChain,
WINTRUST_ReAlloc(data->pasSigners[idxSigner].pasCertChain, (data->pasSigners[idxSigner].csCertChain + 1) *
(data->pasSigners[idxSigner].csCertChain + 1) * sizeof(CRYPT_PROVIDER_CERT));
sizeof(CRYPT_PROVIDER_CERT));
else
{
data->pasSigners[idxSigner].pasCertChain =
WINTRUST_Alloc(sizeof(CRYPT_PROVIDER_CERT));
data->pasSigners[idxSigner].csCertChain = 0;
}
if (data->pasSigners[idxSigner].pasCertChain) if (data->pasSigners[idxSigner].pasCertChain)
{ {
CRYPT_PROVIDER_CERT *cert = &data->pasSigners[idxSigner].pasCertChain[ CRYPT_PROVIDER_CERT *cert = &data->pasSigners[idxSigner].pasCertChain[
...@@ -1127,14 +1087,8 @@ BOOL WINAPI WINTRUST_AddPrivData(CRYPT_PROVIDER_DATA *data, ...@@ -1127,14 +1087,8 @@ BOOL WINAPI WINTRUST_AddPrivData(CRYPT_PROVIDER_DATA *data,
WARN("invalid struct size\n"); WARN("invalid struct size\n");
return FALSE; return FALSE;
} }
if (data->csProvPrivData) data->pasProvPrivData = realloc(data->pasProvPrivData,
data->pasProvPrivData = WINTRUST_ReAlloc(data->pasProvPrivData, (data->csProvPrivData + 1) * sizeof(CRYPT_PROVIDER_SGNR));
(data->csProvPrivData + 1) * sizeof(CRYPT_PROVIDER_SGNR));
else
{
data->pasProvPrivData = WINTRUST_Alloc(sizeof(CRYPT_PROVIDER_SGNR));
data->csProvPrivData = 0;
}
if (data->pasProvPrivData) if (data->pasProvPrivData)
{ {
DWORD i; DWORD i;
......
...@@ -18,9 +18,6 @@ ...@@ -18,9 +18,6 @@
#ifndef __WINTRUST_PRIV_H__ #ifndef __WINTRUST_PRIV_H__
#define __WINTRUST_PRIV_H__ #define __WINTRUST_PRIV_H__
void WINAPI WINTRUST_Free(void *p) DECLSPEC_HIDDEN;
void * WINAPI WINTRUST_Alloc(DWORD cb)
__WINE_ALLOC_SIZE(1) __WINE_DEALLOC(WINTRUST_Free) __WINE_MALLOC DECLSPEC_HIDDEN;
BOOL WINAPI WINTRUST_AddStore(CRYPT_PROVIDER_DATA *data, HCERTSTORE store) DECLSPEC_HIDDEN; BOOL WINAPI WINTRUST_AddStore(CRYPT_PROVIDER_DATA *data, HCERTSTORE store) DECLSPEC_HIDDEN;
BOOL WINAPI WINTRUST_AddSgnr(CRYPT_PROVIDER_DATA *data, BOOL WINAPI WINTRUST_AddSgnr(CRYPT_PROVIDER_DATA *data,
BOOL fCounterSigner, DWORD idxSigner, CRYPT_PROVIDER_SGNR *sgnr) DECLSPEC_HIDDEN; BOOL fCounterSigner, DWORD idxSigner, CRYPT_PROVIDER_SGNR *sgnr) DECLSPEC_HIDDEN;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment