ReactOS 0.4.16-dev-2498-g8632030
softpub.c File Reference
#include <stdio.h>
#include <stdarg.h>
#include <windef.h>
#include <winbase.h>
#include <winerror.h>
#include <wintrust.h>
#include <softpub.h>
#include <mssip.h>
#include <winuser.h>
#include "winnls.h"
#include "wine/test.h"
#include <pshpack1.h>
#include <poppack.h>
Include dependency graph for softpub.c:

Go to the source code of this file.

Classes

struct  _SAFE_PROVIDER_FUNCTIONS
 
struct  Imports
 
struct  Imports::__IMPORT_BY_NAME
 
struct  _PeImage
 

Macros

#define WINTRUST_GET_PROC(func)
 
#define CRYPT32_GET_PROC(func)
 
#define VA_START   0x400000
 
#define FILE_PE_START   0x50
 
#define NUM_SECTIONS   3
 
#define FILE_TEXT   0x200
 
#define RVA_TEXT   0x1000
 
#define RVA_BSS   0x2000
 
#define FILE_IDATA   0x400
 
#define RVA_IDATA   0x3000
 
#define FILE_TOTAL   0x600
 
#define RVA_TOTAL   0x4000
 
#define EXIT_PROCESS   (VA_START+RVA_IDATA+FIELD_OFFSET(struct Imports, thunks))
 

Typedefs

typedef void *(WINAPISAFE_MEM_ALLOC) (DWORD)
 
typedef void(WINAPISAFE_MEM_FREE) (void *)
 
typedef BOOL(WINAPISAFE_ADD_STORE) (CRYPT_PROVIDER_DATA *, HCERTSTORE)
 
typedef BOOL(WINAPISAFE_ADD_SGNR) (CRYPT_PROVIDER_DATA *, BOOL, DWORD, struct _CRYPT_PROVIDER_SGNR *)
 
typedef BOOL(WINAPISAFE_ADD_CERT) (CRYPT_PROVIDER_DATA *, DWORD, BOOL, DWORD, PCCERT_CONTEXT)
 
typedef BOOL(WINAPISAFE_ADD_PRIVDATA) (CRYPT_PROVIDER_DATA *, CRYPT_PROVIDER_PRIVDATA *)
 
typedef HRESULT(WINAPISAFE_PROVIDER_INIT_CALL) (CRYPT_PROVIDER_DATA *)
 
typedef HRESULT(WINAPISAFE_PROVIDER_OBJTRUST_CALL) (CRYPT_PROVIDER_DATA *)
 
typedef HRESULT(WINAPISAFE_PROVIDER_SIGTRUST_CALL) (CRYPT_PROVIDER_DATA *)
 
typedef HRESULT(WINAPISAFE_PROVIDER_CERTTRUST_CALL) (CRYPT_PROVIDER_DATA *)
 
typedef HRESULT(WINAPISAFE_PROVIDER_FINALPOLICY_CALL) (CRYPT_PROVIDER_DATA *)
 
typedef HRESULT(WINAPISAFE_PROVIDER_TESTFINALPOLICY_CALL) (CRYPT_PROVIDER_DATA *)
 
typedef HRESULT(WINAPISAFE_PROVIDER_CLEANUP_CALL) (CRYPT_PROVIDER_DATA *)
 
typedef BOOL(WINAPISAFE_PROVIDER_CERTCHKPOLICY_CALL) (CRYPT_PROVIDER_DATA *, DWORD, BOOL, DWORD)
 
typedef struct _SAFE_PROVIDER_FUNCTIONS SAFE_PROVIDER_FUNCTIONS
 

Functions

static BOOL (WINAPI *pWTHelperGetKnownUsages)(DWORD action
 
static DWORD SIP_INDIRECT_DATA *static VOID (WINAPI *CertFreeCertificateChain_p)(PCCERT_CHAIN_CONTEXT)
 
static void InitFunctionPtrs (void)
 
static void test_utils (SAFE_PROVIDER_FUNCTIONS *funcs)
 
static void testInitialize (SAFE_PROVIDER_FUNCTIONS *funcs, GUID *actionID)
 
static void getNotepadPath (WCHAR *notepadPathW, DWORD size)
 
static HANDLE create_temp_file (WCHAR *temp_file)
 
static void testObjTrust (SAFE_PROVIDER_FUNCTIONS *funcs, GUID *actionID)
 
static void testCertTrust (SAFE_PROVIDER_FUNCTIONS *funcs, GUID *actionID)
 
static void test_provider_funcs (void)
 
static void test_sip_create_indirect_data (void)
 
static void test_wintrust (void)
 
static void call_winverify (WCHAR *pathW, LONG *status, BOOL hash_only)
 
static void test_wintrust_digest (void)
 
static void test_get_known_usages (void)
 
static void test_multiple_signatures (void)
 
static void test_pe_image_hash (void)
 
 START_TEST (softpub)
 

Variables

static PCCRYPT_OID_INFO ** usages
 
static const BYTE v1CertWithPubKey []
 
static const BYTE selfSignedCert []
 
static struct _PeImage bin
 
static const BYTE SelfSignedFile32 []
 
static const BYTE SelfSignedFile64 []
 
static const BYTE self_signed_3certs []
 
static DWORD BYTE DWORD
 

Macro Definition Documentation

◆ CRYPT32_GET_PROC

#define CRYPT32_GET_PROC (   func)
Value:
func ## _p = (void*)GetProcAddress(hCrypt32, #func); \
if(!func ## _p) { \
trace("GetProcAddress(%s) failed\n", #func); \
}
#define GetProcAddress(x, y)
Definition: compat.h:753
GLenum func
Definition: glext.h:6028

◆ EXIT_PROCESS

#define EXIT_PROCESS   (VA_START+RVA_IDATA+FIELD_OFFSET(struct Imports, thunks))

Definition at line 670 of file softpub.c.

◆ FILE_IDATA

#define FILE_IDATA   0x400

Definition at line 655 of file softpub.c.

◆ FILE_PE_START

#define FILE_PE_START   0x50

Definition at line 650 of file softpub.c.

◆ FILE_TEXT

#define FILE_TEXT   0x200

Definition at line 652 of file softpub.c.

◆ FILE_TOTAL

#define FILE_TOTAL   0x600

Definition at line 657 of file softpub.c.

◆ NUM_SECTIONS

#define NUM_SECTIONS   3

Definition at line 651 of file softpub.c.

◆ RVA_BSS

#define RVA_BSS   0x2000

Definition at line 654 of file softpub.c.

◆ RVA_IDATA

#define RVA_IDATA   0x3000

Definition at line 656 of file softpub.c.

◆ RVA_TEXT

#define RVA_TEXT   0x1000

Definition at line 653 of file softpub.c.

◆ RVA_TOTAL

#define RVA_TOTAL   0x4000

Definition at line 658 of file softpub.c.

◆ VA_START

#define VA_START   0x400000

Definition at line 649 of file softpub.c.

◆ WINTRUST_GET_PROC

#define WINTRUST_GET_PROC (   func)
Value:
p ## func = (void*)GetProcAddress(hWintrust, #func); \
if(!p ## func) { \
trace("GetProcAddress(%s) failed\n", #func); \
}
GLfloat GLfloat p
Definition: glext.h:8902

Typedef Documentation

◆ SAFE_ADD_CERT

typedef BOOL(WINAPI * SAFE_ADD_CERT) (CRYPT_PROVIDER_DATA *, DWORD, BOOL, DWORD, PCCERT_CONTEXT)

Definition at line 46 of file softpub.c.

◆ SAFE_ADD_PRIVDATA

typedef BOOL(WINAPI * SAFE_ADD_PRIVDATA) (CRYPT_PROVIDER_DATA *, CRYPT_PROVIDER_PRIVDATA *)

Definition at line 48 of file softpub.c.

◆ SAFE_ADD_SGNR

Definition at line 44 of file softpub.c.

◆ SAFE_ADD_STORE

typedef BOOL(WINAPI * SAFE_ADD_STORE) (CRYPT_PROVIDER_DATA *, HCERTSTORE)

Definition at line 42 of file softpub.c.

◆ SAFE_MEM_ALLOC

typedef void *(WINAPI * SAFE_MEM_ALLOC) (DWORD)

Definition at line 40 of file softpub.c.

◆ SAFE_MEM_FREE

typedef void(WINAPI * SAFE_MEM_FREE) (void *)

Definition at line 41 of file softpub.c.

◆ SAFE_PROVIDER_CERTCHKPOLICY_CALL

typedef BOOL(WINAPI * SAFE_PROVIDER_CERTCHKPOLICY_CALL) (CRYPT_PROVIDER_DATA *, DWORD, BOOL, DWORD)

Definition at line 58 of file softpub.c.

◆ SAFE_PROVIDER_CERTTRUST_CALL

typedef HRESULT(WINAPI * SAFE_PROVIDER_CERTTRUST_CALL) (CRYPT_PROVIDER_DATA *)

Definition at line 53 of file softpub.c.

◆ SAFE_PROVIDER_CLEANUP_CALL

typedef HRESULT(WINAPI * SAFE_PROVIDER_CLEANUP_CALL) (CRYPT_PROVIDER_DATA *)

Definition at line 57 of file softpub.c.

◆ SAFE_PROVIDER_FINALPOLICY_CALL

typedef HRESULT(WINAPI * SAFE_PROVIDER_FINALPOLICY_CALL) (CRYPT_PROVIDER_DATA *)

Definition at line 54 of file softpub.c.

◆ SAFE_PROVIDER_FUNCTIONS

◆ SAFE_PROVIDER_INIT_CALL

typedef HRESULT(WINAPI * SAFE_PROVIDER_INIT_CALL) (CRYPT_PROVIDER_DATA *)

Definition at line 50 of file softpub.c.

◆ SAFE_PROVIDER_OBJTRUST_CALL

typedef HRESULT(WINAPI * SAFE_PROVIDER_OBJTRUST_CALL) (CRYPT_PROVIDER_DATA *)

Definition at line 51 of file softpub.c.

◆ SAFE_PROVIDER_SIGTRUST_CALL

typedef HRESULT(WINAPI * SAFE_PROVIDER_SIGTRUST_CALL) (CRYPT_PROVIDER_DATA *)

Definition at line 52 of file softpub.c.

◆ SAFE_PROVIDER_TESTFINALPOLICY_CALL

typedef HRESULT(WINAPI * SAFE_PROVIDER_TESTFINALPOLICY_CALL) (CRYPT_PROVIDER_DATA *)

Definition at line 55 of file softpub.c.

Function Documentation

◆ BOOL()

static BOOL ( WINAPI pWTHelperGetKnownUsages)
static

◆ call_winverify()

static void call_winverify ( WCHAR pathW,
LONG status,
BOOL  hash_only 
)
static

Definition at line 1596 of file softpub.c.

1597{
1598 static GUID WVTPolicyGUID = WINTRUST_ACTION_GENERIC_VERIFY_V2;
1599 WINTRUST_FILE_INFO file_info = { sizeof(file_info), 0 };
1600 WINTRUST_DATA data = { sizeof(data), 0 };
1601 LONG ret;
1602
1603 file_info.pcwszFilePath = pathW;
1604
1605 data.dwUIChoice = WTD_UI_NONE;
1606 data.fdwRevocationChecks = WTD_REVOKE_NONE;
1607 data.dwUnionChoice = WTD_CHOICE_FILE;
1608 data.pFile = &file_info;
1609 data.dwStateAction = WTD_STATEACTION_VERIFY;
1610 data.dwProvFlags = hash_only ? WTD_HASH_ONLY_FLAG : 0;
1611 *status = WinVerifyTrust(NULL, &WVTPolicyGUID, &data);
1612
1613 data.dwStateAction = WTD_STATEACTION_CLOSE;
1614 ret = WinVerifyTrust(NULL, &WVTPolicyGUID, &data);
1615 ok(ret == S_OK, "WinVerifyTrust failed: %08lx\n", ret);
1616}
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
return ret
Definition: mutex.c:146
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define S_OK
Definition: intsafe.h:52
static const WCHAR pathW[]
Definition: path.c:2368
long LONG
Definition: pedump.c:60
#define WINTRUST_ACTION_GENERIC_VERIFY_V2
Definition: softpub.h:108
Definition: ps.c:97
#define WTD_HASH_ONLY_FLAG
Definition: wintrust.h:137
#define WTD_STATEACTION_CLOSE
Definition: wintrust.h:124
#define WTD_STATEACTION_VERIFY
Definition: wintrust.h:123
#define WTD_REVOKE_NONE
Definition: wintrust.h:88
#define WTD_UI_NONE
Definition: wintrust.h:84
#define WTD_CHOICE_FILE
Definition: wintrust.h:91
LONG WINAPI WinVerifyTrust(HWND hwnd, GUID *ActionID, LPVOID ActionData)

Referenced by test_wintrust_digest().

◆ create_temp_file()

static HANDLE create_temp_file ( WCHAR temp_file)
static

Definition at line 286 of file softpub.c.

287{
290
292 {
293 static const WCHAR img[] = { 'i','m','g',0 };
294
298 }
299 return file;
300}
#define ARRAY_SIZE(A)
Definition: main.h:20
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define GENERIC_READ
Definition: compat.h:135
#define MAX_PATH
Definition: compat.h:34
#define CreateFileW
Definition: compat.h:741
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
DWORD WINAPI GetTempPathW(IN DWORD count, OUT LPWSTR path)
Definition: path.c:1999
UINT WINAPI GetTempFileNameW(IN LPCWSTR lpPathName, IN LPCWSTR lpPrefixString, IN UINT uUnique, OUT LPWSTR lpTempFileName)
Definition: filename.c:84
GLint GLvoid * img
Definition: gl.h:1956
#define CREATE_ALWAYS
Definition: disk.h:72
char temp_path[MAX_PATH]
Definition: mspatcha.c:123
#define GENERIC_WRITE
Definition: nt_native.h:90
Definition: fci.c:127
Definition: fci.c:110
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by test_bind_image_ex(), test_get_digest_stream(), test_image_load(), test_multiple_signatures(), test_pe_image_hash(), test_sip_create_indirect_data(), test_wintrust(), test_wintrust_digest(), and testObjTrust().

◆ getNotepadPath()

static void getNotepadPath ( WCHAR notepadPathW,
DWORD  size 
)
static

Definition at line 272 of file softpub.c.

273{
274 static const CHAR notepad[] = "\\notepad.exe";
275 CHAR notepadPath[MAX_PATH];
276
277 /* Workaround missing W-functions for win9x */
278 GetWindowsDirectoryA(notepadPath, MAX_PATH);
279 lstrcatA(notepadPath, notepad);
280 MultiByteToWideChar(CP_ACP, 0, notepadPath, -1, notepadPathW, size);
281}
#define CP_ACP
Definition: compat.h:109
#define MultiByteToWideChar
Definition: compat.h:110
UINT WINAPI GetWindowsDirectoryA(OUT LPSTR lpBuffer, IN UINT uSize)
Definition: path.c:2256
GLsizeiptr size
Definition: glext.h:5919
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:123
char CHAR
Definition: xmlstorage.h:175

Referenced by test_wintrust(), and testObjTrust().

◆ InitFunctionPtrs()

static void InitFunctionPtrs ( void  )
static

Definition at line 85 of file softpub.c.

86{
87 HMODULE hWintrust = GetModuleHandleA("wintrust.dll");
88 HMODULE hCrypt32 = GetModuleHandleA("crypt32.dll");
89
90#define WINTRUST_GET_PROC(func) \
91 p ## func = (void*)GetProcAddress(hWintrust, #func); \
92 if(!p ## func) { \
93 trace("GetProcAddress(%s) failed\n", #func); \
94 }
95
97
98#undef WINTRUST_GET_PROC
99
100#define CRYPT32_GET_PROC(func) \
101 func ## _p = (void*)GetProcAddress(hCrypt32, #func); \
102 if(!func ## _p) { \
103 trace("GetProcAddress(%s) failed\n", #func); \
104 }
105
108
109#undef CRYPT32_GET_PROC
110}
VOID WINAPI CertFreeCertificateChain(PCCERT_CHAIN_CONTEXT pChainContext)
Definition: chain.c:2960
BOOL WINAPI CryptSIPCreateIndirectData(SIP_SUBJECTINFO *pSubjectInfo, DWORD *pcbIndirectData, SIP_INDIRECT_DATA *pIndirectData)
Definition: sip.c:715
BOOL WINAPI WTHelperGetKnownUsages(DWORD action, PCCRYPT_OID_INFO **usages)
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
#define CRYPT32_GET_PROC(func)
#define WINTRUST_GET_PROC(func)

Referenced by START_TEST().

◆ START_TEST()

START_TEST ( softpub  )

Definition at line 1928 of file softpub.c.

1929{
1933 test_wintrust();
1938}
static void test_get_known_usages(void)
Definition: softpub.c:1721
static void test_pe_image_hash(void)
Definition: softpub.c:1897
static void test_multiple_signatures(void)
Definition: softpub.c:1785
static void test_provider_funcs(void)
Definition: softpub.c:629
static void test_sip_create_indirect_data(void)
Definition: softpub.c:740
static void InitFunctionPtrs(void)
Definition: softpub.c:85
static void test_wintrust(void)
Definition: softpub.c:827
static void test_wintrust_digest(void)
Definition: softpub.c:1618

◆ test_get_known_usages()

static void test_get_known_usages ( void  )
static

Definition at line 1721 of file softpub.c.

1722{
1723 BOOL ret;
1725
1726 if (!pWTHelperGetKnownUsages)
1727 {
1728 skip("missing WTHelperGetKnownUsages\n");
1729 return;
1730 }
1731 SetLastError(0xdeadbeef);
1732 ret = pWTHelperGetKnownUsages(0, NULL);
1734 "expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
1735 SetLastError(0xdeadbeef);
1736 ret = pWTHelperGetKnownUsages(1, NULL);
1738 "expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
1739 SetLastError(0xdeadbeef);
1740 ret = pWTHelperGetKnownUsages(0, &usages);
1742 "expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
1743 /* A value of 1 for the first parameter seems to imply the value is
1744 * allocated
1745 */
1746 SetLastError(0xdeadbeef);
1747 usages = NULL;
1748 ret = pWTHelperGetKnownUsages(1, &usages);
1749 ok(ret, "WTHelperGetKnownUsages failed: %ld\n", GetLastError());
1750 ok(usages != NULL, "expected a pointer\n");
1751 if (ret && usages)
1752 {
1754
1755 /* The returned usages are an array of PCCRYPT_OID_INFOs, terminated with a
1756 * NULL pointer.
1757 */
1758 for (ptr = usages; *ptr; ptr++)
1759 {
1760 ok((*ptr)->cbSize == sizeof(CRYPT_OID_INFO) ||
1761 (*ptr)->cbSize == (sizeof(CRYPT_OID_INFO) + 2 * sizeof(LPCWSTR)), /* Vista */
1762 "unexpected size %ld\n", (*ptr)->cbSize);
1763 /* Each returned usage is in the CRYPT_ENHKEY_USAGE_OID_GROUP_ID group */
1764 ok((*ptr)->dwGroupId == CRYPT_ENHKEY_USAGE_OID_GROUP_ID,
1765 "expected group CRYPT_ENHKEY_USAGE_OID_GROUP_ID, got %ld\n",
1766 (*ptr)->dwGroupId);
1767 }
1768 }
1769 /* A value of 2 for the second parameter seems to imply the value is freed
1770 */
1771 SetLastError(0xdeadbeef);
1772 ret = pWTHelperGetKnownUsages(2, &usages);
1773 ok(ret, "WTHelperGetKnownUsages failed: %ld\n", GetLastError());
1774 ok(usages == NULL, "expected pointer to be cleared\n");
1775 SetLastError(0xdeadbeef);
1776 usages = NULL;
1777 ret = pWTHelperGetKnownUsages(2, &usages);
1778 ok(ret, "WTHelperGetKnownUsages failed: %ld\n", GetLastError());
1779 SetLastError(0xdeadbeef);
1780 ret = pWTHelperGetKnownUsages(2, NULL);
1782 "expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
1783}
#define skip(...)
Definition: atltest.h:64
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define SetLastError(x)
Definition: compat.h:752
unsigned int BOOL
Definition: ntddk_ex.h:94
static PVOID ptr
Definition: dispmode.c:27
static PCCRYPT_OID_INFO ** usages
Definition: softpub.c:81
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define CRYPT_ENHKEY_USAGE_OID_GROUP_ID
Definition: wincrypt.h:1943
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by START_TEST().

◆ test_multiple_signatures()

static void test_multiple_signatures ( void  )
static

Definition at line 1785 of file softpub.c.

1786{
1787 static const BYTE serials[][16] =
1788 {
1789 { 0xfa, 0x4b, 0x40, 0x69, 0x40, 0x4b, 0xc0, 0x44, 0xa2, 0x31, 0x3a, 0xa7, 0xaa, 0x97, 0x73, 0xd1, },
1790 { 0xcc, 0x03, 0x6b, 0x72, 0x4a, 0x93, 0x42, 0x40, 0x8f, 0x93, 0x41, 0x68, 0xa9, 0xec, 0x01, 0x8d, },
1791 { 0xa1, 0x58, 0x5b, 0x68, 0x85, 0x6a, 0x91, 0x4d, 0xa7, 0xe3, 0xa4, 0x15, 0x08, 0x3e, 0xfb, 0xae, },
1792 };
1793 static GUID WVTPolicyGUID = WINTRUST_ACTION_GENERIC_VERIFY_V2;
1796 WINTRUST_DATA data = { sizeof(data) };
1797 CRYPT_PROVIDER_DATA *prov;
1799 CERT_INFO *cert_info;
1800 unsigned int i;
1801 BYTE buf[4096];
1802 DWORD written;
1803 LONG status;
1804 HANDLE file;
1805 DWORD size;
1806 BOOL bret;
1807
1809 ok(file != INVALID_HANDLE_VALUE, "Failed to create temporary file.\n");
1810 bret = WriteFile(file, self_signed_3certs, sizeof(self_signed_3certs), &written, NULL);
1811 ok(bret, "Failed, err %lu.\n", GetLastError());
1813
1814 file_info.pcwszFilePath = pathW;
1815 data.dwUIChoice = WTD_UI_NONE;
1816 data.fdwRevocationChecks = WTD_REVOKE_NONE;
1817 data.dwUnionChoice = WTD_CHOICE_FILE;
1818 data.pFile = &file_info;
1819 data.dwStateAction = WTD_STATEACTION_VERIFY;
1820 data.dwProvFlags = 0;
1821 data.pSignatureSettings = &settings;
1822
1823 settings.cSecondarySigs = 0xcccccccc;
1824 settings.dwVerifiedSigIndex = 0xcccccccc;
1825 status = WinVerifyTrust(NULL, &WVTPolicyGUID, &data);
1826 todo_wine ok(status == CERT_E_UNTRUSTEDROOT || status == CERT_E_CHAINING, "Failed, ret %#lx\n", status);
1827 ok(settings.cSecondarySigs == 0xcccccccc, "Got %lu.\n", settings.cSecondarySigs);
1828 todo_wine ok(settings.dwVerifiedSigIndex == 2, "Got %lu.\n", settings.dwVerifiedSigIndex);
1829
1830 prov = (CRYPT_PROVIDER_DATA *)data.hWVTStateData;
1831 ok(prov->cbStruct == sizeof(*prov), "Got size %lu.\n", prov->cbStruct);
1832 ok(prov->csSigners == 1, "Got %lu.\n", prov->csSigners);
1833 ok(prov->pSigSettings == &settings, "Got %p, expected %p.\n", prov->pSigSettings, &settings);
1834 ok(!!prov->pSigState, "Got %p, expected %p.\n", prov->pSigSettings, &settings);
1835 if (prov->cbStruct == sizeof(*prov) && prov->pSigState)
1836 {
1837 ok(prov->pSigState->cbStruct == sizeof(*prov->pSigState)
1838 || broken(prov->pSigState->cbStruct == offsetof(CRYPT_PROVIDER_SIGSTATE, iAttemptCount)) /* Win7 */,
1839 "Got %lu.\n", prov->pSigState->cbStruct);
1840 ok(prov->pSigState->fSupportMultiSig, "Got %d.\n", prov->pSigState->fSupportMultiSig);
1841 ok(prov->pSigState->dwCryptoPolicySupport == (WSS_SIGTRUST_SUPPORT | WSS_OBJTRUST_SUPPORT
1842 | WSS_CERTTRUST_SUPPORT), "Got %#lx.\n", prov->pSigState->dwCryptoPolicySupport);
1843 ok(prov->pSigState->cSecondarySigs == 2, "Got %lu.\n", prov->pSigState->cSecondarySigs);
1844
1845 size = sizeof(buf);
1846 bret = CryptMsgGetParam(prov->pSigState->hPrimarySig, CMSG_SIGNER_CERT_INFO_PARAM, 0, buf, &size);
1847 ok(bret, "Failed, err %#lx.\n", GetLastError());
1848 cert_info = (CERT_INFO *)buf;
1849 ok(cert_info->SerialNumber.cbData == sizeof(serials[0]), "Got %lu.\n", cert_info->SerialNumber.cbData);
1850 ok(!memcmp(cert_info->SerialNumber.pbData, serials[0], sizeof(serials[0])), "Data does not match.\n");
1851 for (i = 0; i < prov->pSigState->cSecondarySigs; ++i)
1852 {
1853 bret = CryptMsgGetParam(prov->pSigState->rhSecondarySigs[i], CMSG_SIGNER_CERT_INFO_PARAM, 0, buf, &size);
1854 ok(bret, "Failed, err %#lx.\n", GetLastError());
1855 ok(cert_info->SerialNumber.cbData == sizeof(serials[0]), "Got %lu.\n", cert_info->SerialNumber.cbData);
1856 ok(!memcmp(cert_info->SerialNumber.pbData, serials[i + 1], sizeof(serials[0])), "Data does not match.\n");
1857 }
1858 }
1859
1860 data.dwStateAction = WTD_STATEACTION_CLOSE;
1861 status = WinVerifyTrust(NULL, &WVTPolicyGUID, &data);
1862 ok(status == S_OK, "Failed, ret %#lx\n", status);
1863
1864 data.dwStateAction = WTD_STATEACTION_VERIFY;
1866 settings.cSecondarySigs = 0xcccccccc;
1867 settings.dwVerifiedSigIndex = 0xcccccccc;
1868 status = WinVerifyTrust(NULL, &WVTPolicyGUID, &data);
1869 todo_wine ok(status == CERT_E_UNTRUSTEDROOT || status == CERT_E_CHAINING, "Failed, ret %#lx\n", status);
1870 ok(settings.cSecondarySigs == 2, "Got %lu.\n", settings.cSecondarySigs);
1871 todo_wine ok(settings.dwVerifiedSigIndex == 2, "Got %lu.\n", settings.dwVerifiedSigIndex);
1872
1873 data.dwStateAction = WTD_STATEACTION_CLOSE;
1874 status = WinVerifyTrust(NULL, &WVTPolicyGUID, &data);
1875 ok(status == S_OK, "Failed, ret %#lx\n", status);
1876
1877 data.dwStateAction = WTD_STATEACTION_VERIFY;
1879 settings.cSecondarySigs = 0xcccccccc;
1880 settings.dwVerifiedSigIndex = 0xcccccccc;
1881 settings.dwIndex = 1;
1882 status = WinVerifyTrust(NULL, &WVTPolicyGUID, &data);
1883 todo_wine ok(status == CERT_E_UNTRUSTEDROOT || status == CERT_E_CHAINING, "Failed, ret %#lx\n", status);
1884 ok(settings.cSecondarySigs == 2, "Got %lu.\n", settings.cSecondarySigs);
1885 todo_wine ok(settings.dwVerifiedSigIndex == 1, "Got %lu.\n", settings.dwVerifiedSigIndex);
1886 settings.dwIndex = 0;
1887
1888 data.dwStateAction = WTD_STATEACTION_CLOSE;
1889 status = WinVerifyTrust(NULL, &WVTPolicyGUID, &data);
1890 ok(status == S_OK, "Failed, ret %#lx\n", status);
1891
1893}
struct mke2fs_defaults settings[]
#define broken(x)
Definition: atltest.h:178
BOOL WINAPI CryptMsgGetParam(HCRYPTMSG hCryptMsg, DWORD dwParamType, DWORD dwIndex, void *pvData, DWORD *pcbData)
Definition: msg.c:3626
#define CloseHandle
Definition: compat.h:739
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
Definition: string.c:2802
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define todo_wine
Definition: minitest.h:80
static HANDLE create_temp_file(WCHAR *temp_file)
Definition: softpub.c:286
static const BYTE self_signed_3certs[]
Definition: softpub.c:1141
#define offsetof(TYPE, MEMBER)
CRYPT_INTEGER_BLOB SerialNumber
Definition: wincrypt.h:251
BYTE * pbData
Definition: wincrypt.h:112
struct WINTRUST_SIGNATURE_SETTINGS_ * pSigSettings
Definition: wintrust.h:381
struct _CRYPT_PROVIDER_SIGSTATE * pSigState
Definition: wintrust.h:380
#define CMSG_SIGNER_CERT_INFO_PARAM
Definition: wincrypt.h:4096
#define CERT_E_CHAINING
Definition: winerror.h:4640
#define CERT_E_UNTRUSTEDROOT
Definition: winerror.h:4639
#define WSS_GET_SECONDARY_SIG_COUNT
Definition: wintrust.h:156
#define WSS_CERTTRUST_SUPPORT
Definition: wintrust.h:416
#define WSS_OBJTRUST_SUPPORT
Definition: wintrust.h:414
#define WSS_VERIFY_SPECIFIC
Definition: wintrust.h:155
#define WSS_SIGTRUST_SUPPORT
Definition: wintrust.h:415
unsigned char BYTE
Definition: xxhash.c:193

Referenced by START_TEST().

◆ test_pe_image_hash()

static void test_pe_image_hash ( void  )
static

Definition at line 1897 of file softpub.c.

1898{
1899 static const char expected[] =
1900 {0x8a,0xd5,0x45,0x53,0x3d,0x67,0xdf,0x2f,0x78,0xe0,0x55,0x0a,0xe0,0xd9,0x7a,0x28,0x3e,0xbf,0x45,0x2b};
1902 HANDLE file;
1903 BYTE sha1[20];
1904 DWORD size, count;
1905 HMODULE wintrust = GetModuleHandleA("wintrust.dll");
1906 BOOL ret;
1907
1908 pCryptCATAdminCalcHashFromFileHandle = (void *)GetProcAddress(wintrust, "CryptCATAdminCalcHashFromFileHandle");
1909 if (!pCryptCATAdminCalcHashFromFileHandle)
1910 {
1911 win_skip("hash function missing\n");
1912 return;
1913 }
1914
1916 WriteFile(file, &bin, sizeof(bin), &count, NULL);
1917
1918 size = sizeof(sha1);
1919 memset(sha1, 0, sizeof(sha1));
1920 ret = pCryptCATAdminCalcHashFromFileHandle(file, &size, sha1, 0);
1921 ok(ret, "got %lu\n", GetLastError());
1922 ok(!memcmp(sha1, expected, sizeof(sha1)), "wrong hash\n");
1923
1926}
#define sha1
Definition: compat-1.3.h:2261
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define win_skip
Definition: minitest.h:67
BOOL expected
Definition: store.c:2000
static struct _PeImage bin
#define memset(x, y, z)
Definition: compat.h:39

Referenced by START_TEST().

◆ test_provider_funcs()

static void test_provider_funcs ( void  )
static

Definition at line 629 of file softpub.c.

630{
631 static GUID generic_verify_v2 = WINTRUST_ACTION_GENERIC_VERIFY_V2;
633 BOOL ret;
634
635 ret = WintrustLoadFunctionPointers(&generic_verify_v2,
637 if (!ret)
638 skip("WintrustLoadFunctionPointers failed\n");
639 else
640 {
642 testInitialize(&funcs, &generic_verify_v2);
643 testObjTrust(&funcs, &generic_verify_v2);
644 testCertTrust(&funcs, &generic_verify_v2);
645 }
646}
BOOL WINAPI WintrustLoadFunctionPointers(GUID *pgActionID, CRYPT_PROVIDER_FUNCTIONS *pPfns)
Definition: register.c:865
static void testInitialize(void)
Definition: main.c:66
static void testObjTrust(SAFE_PROVIDER_FUNCTIONS *funcs, GUID *actionID)
Definition: softpub.c:302
struct _SAFE_PROVIDER_FUNCTIONS SAFE_PROVIDER_FUNCTIONS
static void test_utils(SAFE_PROVIDER_FUNCTIONS *funcs)
Definition: softpub.c:125
static void testCertTrust(SAFE_PROVIDER_FUNCTIONS *funcs, GUID *actionID)
Definition: softpub.c:548
static struct __wine_debug_functions funcs
Definition: debug.c:48

Referenced by START_TEST().

◆ test_sip_create_indirect_data()

static void test_sip_create_indirect_data ( void  )
static

Definition at line 740 of file softpub.c.

741{
742 static GUID unknown = { 0xC689AAB8, 0x8E78, 0x11D0, { 0x8C,0x47,
743 0x00,0xC0,0x4F,0xC2,0x95,0xEE } };
744 static char oid_sha1[] = szOID_OIWSEC_sha1;
745 BOOL ret;
746 SIP_SUBJECTINFO subjinfo = { 0 };
748 HANDLE file;
749 DWORD count;
750
751 if (!CryptSIPCreateIndirectData_p)
752 {
753 skip("Missing CryptSIPCreateIndirectData\n");
754 return;
755 }
756 SetLastError(0xdeadbeef);
757 ret = CryptSIPCreateIndirectData_p(NULL, NULL, NULL);
759 "expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
760 SetLastError(0xdeadbeef);
761 ret = CryptSIPCreateIndirectData_p(&subjinfo, NULL, NULL);
763 "expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
764 subjinfo.cbSize = sizeof(subjinfo);
765 SetLastError(0xdeadbeef);
766 ret = CryptSIPCreateIndirectData_p(&subjinfo, NULL, NULL);
768 "expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
771 {
772 skip("couldn't create temp file\n");
773 return;
774 }
775 WriteFile(file, &bin, sizeof(bin), &count, NULL);
777
778 subjinfo.hFile = file;
779 SetLastError(0xdeadbeef);
780 ret = CryptSIPCreateIndirectData_p(&subjinfo, NULL, NULL);
782 "expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
783 subjinfo.pgSubjectType = &unknown;
784 SetLastError(0xdeadbeef);
785 ret = CryptSIPCreateIndirectData_p(&subjinfo, NULL, NULL);
787 "expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
788 subjinfo.DigestAlgorithm.pszObjId = oid_sha1;
789 count = 0xdeadbeef;
790 ret = CryptSIPCreateIndirectData_p(&subjinfo, &count, NULL);
792 ok(ret, "CryptSIPCreateIndirectData failed: %ld\n", GetLastError());
793 ok(count, "expected a positive count\n");
794 if (ret)
795 {
797
798 count = 256;
799 ret = CryptSIPCreateIndirectData_p(&subjinfo, &count, indirect);
800 ok(ret, "CryptSIPCreateIndirectData failed: %ld\n", GetLastError());
801 /* If the count is larger than needed, it's unmodified */
802 ok(count == 256, "unexpected count %ld\n", count);
803 ok(!strcmp(indirect->Data.pszObjId, SPC_PE_IMAGE_DATA_OBJID),
804 "unexpected data oid %s\n",
805 indirect->Data.pszObjId);
806 ok(!strcmp(indirect->DigestAlgorithm.pszObjId, oid_sha1),
807 "unexpected digest algorithm oid %s\n",
808 indirect->DigestAlgorithm.pszObjId);
809 ok(indirect->Digest.cbData == 20, "unexpected hash size %ld\n",
810 indirect->Digest.cbData);
811 if (indirect->Digest.cbData == 20)
812 {
813 const BYTE hash[20] = {
814 0x8a,0xd5,0x45,0x53,0x3d,0x67,0xdf,0x2f,0x78,0xe0,
815 0x55,0x0a,0xe0,0xd9,0x7a,0x28,0x3e,0xbf,0x45,0x2b };
816
817 ok(!memcmp(indirect->Digest.pbData, hash, 20),
818 "unexpected value\n");
819 }
820
822 }
825}
static WCHAR unknown[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1605
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
BOOL WINAPI FlushFileBuffers(IN HANDLE hFile)
Definition: fileinfo.c:25
_ACRTIMP int __cdecl strcmp(const char *, const char *)
Definition: string.c:3319
CRYPT_ALGORITHM_IDENTIFIER DigestAlgorithm
Definition: mssip.h:61
HANDLE hFile
Definition: mssip.h:53
GUID * pgSubjectType
Definition: mssip.h:52
DWORD cbSize
Definition: mssip.h:51
Definition: _hash_fun.h:40
#define szOID_OIWSEC_sha1
Definition: wincrypt.h:3253
#define SPC_PE_IMAGE_DATA_OBJID
Definition: wintrust.h:485

Referenced by START_TEST().

◆ test_utils()

static void test_utils ( SAFE_PROVIDER_FUNCTIONS funcs)
static

Definition at line 125 of file softpub.c.

126{
128 HCERTSTORE store;
129 CRYPT_PROVIDER_SGNR sgnr = { 0 };
130 BOOL ret;
131
132 /* Crash
133 ret = funcs->pfnAddStore2Chain(NULL, NULL);
134 ret = funcs->pfnAddStore2Chain(&data, NULL);
135 */
138 if (store)
139 {
140 ret = funcs->pfnAddStore2Chain(&data, store);
141 ok(ret, "pfnAddStore2Chain failed: %08lx\n", GetLastError());
142 ok(data.chStores == 1, "Expected 1 store, got %ld\n", data.chStores);
143 ok(data.pahStores != NULL, "Expected pahStores to be allocated\n");
144 if (data.pahStores)
145 {
146 ok(data.pahStores[0] == store, "Unexpected store\n");
147 CertCloseStore(data.pahStores[0], 0);
148 funcs->pfnFree(data.pahStores);
149 data.pahStores = NULL;
150 data.chStores = 0;
151 CertCloseStore(store, 0);
152 store = NULL;
153 }
154 }
155 else
156 skip("CertOpenStore failed: %08lx\n", GetLastError());
157
158 /* Crash
159 ret = funcs->pfnAddSgnr2Chain(NULL, FALSE, 0, NULL);
160 ret = funcs->pfnAddSgnr2Chain(&data, FALSE, 0, NULL);
161 */
162 ret = funcs->pfnAddSgnr2Chain(&data, FALSE, 0, &sgnr);
163 ok(ret, "pfnAddSgnr2Chain failed: %08lx\n", GetLastError());
164 ok(data.csSigners == 1, "Expected 1 signer, got %ld\n", data.csSigners);
165 ok(data.pasSigners != NULL, "Expected pasSigners to be allocated\n");
166 if (data.pasSigners)
167 {
169
170 ok(!memcmp(&data.pasSigners[0], &sgnr, sizeof(sgnr)),
171 "Unexpected data in signer\n");
172 /* Adds into the location specified by the index */
173 sgnr.cbStruct = sizeof(CRYPT_PROVIDER_SGNR);
174 sgnr.sftVerifyAsOf.dwLowDateTime = 0xdeadbeef;
175 ret = funcs->pfnAddSgnr2Chain(&data, FALSE, 1, &sgnr);
176 ok(ret, "pfnAddSgnr2Chain failed: %08lx\n", GetLastError());
177 ok(data.csSigners == 2, "Expected 2 signers, got %ld\n", data.csSigners);
178 ok(!memcmp(&data.pasSigners[1], &sgnr, sizeof(sgnr)),
179 "Unexpected data in signer\n");
180 /* This also adds, but the index is ignored */
181 sgnr.cbStruct = sizeof(DWORD);
182 ret = funcs->pfnAddSgnr2Chain(&data, FALSE, 0, &sgnr);
183 ok(ret, "pfnAddSgnr2Chain failed: %08lx\n", GetLastError());
184 ok(data.csSigners == 3, "Expected 3 signers, got %ld\n", data.csSigners);
187 ok(!memcmp(&data.pasSigners[2], &sgnr, sizeof(sgnr)),
188 "Unexpected data in signer\n");
189 /* But too large a thing isn't added */
190 sgnr.cbStruct = sizeof(sgnr) + sizeof(DWORD);
191 SetLastError(0xdeadbeef);
192 ret = funcs->pfnAddSgnr2Chain(&data, FALSE, 0, &sgnr);
194 "Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
195
196 /* Crash
197 ret = funcs->pfnAddCert2Chain(NULL, 0, FALSE, 0, NULL);
198 ret = funcs->pfnAddCert2Chain(&data, 0, FALSE, 0, NULL);
199 */
201 sizeof(v1CertWithPubKey));
202 if (cert)
203 {
204 /* Notes on behavior that are hard to test:
205 * 1. If pasSigners is invalid, pfnAddCert2Chain crashes
206 * 2. An invalid signer index isn't checked.
207 */
208 ret = funcs->pfnAddCert2Chain(&data, 0, FALSE, 0, cert);
209 ok(ret, "pfnAddCert2Chain failed: %08lx\n", GetLastError());
210 ok(data.pasSigners[0].csCertChain == 1, "Expected 1 cert, got %ld\n",
211 data.pasSigners[0].csCertChain);
212 ok(data.pasSigners[0].pasCertChain != NULL,
213 "Expected pasCertChain to be allocated\n");
214 if (data.pasSigners[0].pasCertChain)
215 {
216 ok(data.pasSigners[0].pasCertChain[0].pCert == cert,
217 "Unexpected cert\n");
219 data.pasSigners[0].pasCertChain[0].pCert);
220 }
222 }
223 else
224 skip("CertCreateCertificateContext failed: %08lx\n", GetLastError());
225 funcs->pfnFree(data.pasSigners);
226 }
227}
#define FALSE
Definition: types.h:117
BOOL WINAPI CertFreeCertificateContext(PCCERT_CONTEXT pCertContext)
Definition: cert.c:371
PCCERT_CONTEXT WINAPI CertCreateCertificateContext(DWORD dwCertEncodingType, const BYTE *pbCertEncoded, DWORD cbCertEncoded)
Definition: cert.c:316
HCERTSTORE WINAPI CertOpenStore(LPCSTR lpszStoreProvider, DWORD dwMsgAndCertEncodingType, HCRYPTPROV_LEGACY hCryptProv, DWORD dwFlags, const void *pvPara)
Definition: store.c:815
BOOL WINAPI CertCloseStore(HCERTSTORE hCertStore, DWORD dwFlags)
Definition: store.c:1127
static BYTE cert[]
Definition: msg.c:1374
static const BYTE v1CertWithPubKey[]
Definition: softpub.c:112
static DWORD BYTE DWORD
Definition: softpub.c:1895
FILETIME sftVerifyAsOf
Definition: wintrust.h:233
DWORD dwLowDateTime
Definition: mapidefs.h:65
#define CERT_STORE_CREATE_NEW_FLAG
Definition: wincrypt.h:2633
#define X509_ASN_ENCODING
Definition: wincrypt.h:2501
#define CERT_STORE_PROV_MEMORY
Definition: wincrypt.h:2455
struct _CRYPT_PROVIDER_SGNR CRYPT_PROVIDER_SGNR

Referenced by test_provider_funcs().

◆ test_wintrust()

static void test_wintrust ( void  )
static

Definition at line 827 of file softpub.c.

828{
829 static GUID generic_action_v2 = WINTRUST_ACTION_GENERIC_VERIFY_V2;
830 WINTRUST_DATA wtd;
832 LONG r;
833 HRESULT hr;
835
836 memset(&wtd, 0, sizeof(wtd));
837 wtd.cbStruct = sizeof(wtd);
841 wtd.pFile = &file;
843 memset(&file, 0, sizeof(file));
844 file.cbStruct = sizeof(file);
845 file.pcwszFilePath = pathW;
846 /* Test with an empty file */
847 file.hFile = create_temp_file(pathW);
848 SetLastError(0xdeadbeef);
849 r = WinVerifyTrust(INVALID_HANDLE_VALUE, &generic_action_v2, &wtd);
850 ok(r == GetLastError(), "expected %08lx, got %08lx\n", GetLastError(), r);
852 "expected TRUST_E_SUBJECT_FORM_UNKNOWN, got %08lx\n", r);
853 CloseHandle(file.hFile);
855 file.hFile = NULL;
856 /* Test with a known file path, which we expect not have a signature */
858 SetLastError(0xdeadbeef);
859 r = WinVerifyTrust(INVALID_HANDLE_VALUE, &generic_action_v2, &wtd);
860 ok(r == GetLastError(), "expected %08lx, got %08lx\n", GetLastError(), r);
862 "expected TRUST_E_NOSIGNATURE or CRYPT_E_FILE_ERROR, got %08lx\n", r);
864 SetLastError(0xdeadbeef);
865 r = WinVerifyTrust(INVALID_HANDLE_VALUE, &generic_action_v2, &wtd);
866 ok(GetLastError() == 0xdeadbeef, "expected 0xdeadbeef, got %08lx\n", GetLastError());
867 ok(r == S_OK, "WinVerifyTrust failed: %08lx\n", r);
869 SetLastError(0xdeadbeef);
870 hr = WinVerifyTrustEx(INVALID_HANDLE_VALUE, &generic_action_v2, &wtd);
871 ok(hr == GetLastError(), "expected %08lx, got %08lx\n", GetLastError(), hr);
873 "expected TRUST_E_NOSIGNATURE or CRYPT_E_FILE_ERROR, got %08lx\n", hr);
875 SetLastError(0xdeadbeef);
876 r = WinVerifyTrust(INVALID_HANDLE_VALUE, &generic_action_v2, &wtd);
877 ok(GetLastError() == 0xdeadbeef, "expected 0xdeadbeef, got %08lx\n", GetLastError());
878 ok(r == S_OK, "WinVerifyTrust failed: %08lx\n", r);
879}
HRESULT hr
Definition: delayimp.cpp:573
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static void getNotepadPath(WCHAR *notepadPathW, DWORD size)
Definition: softpub.c:272
DWORD dwUnionChoice
Definition: wintrust.h:104
struct WINTRUST_FILE_INFO_ * pFile
Definition: wintrust.h:107
DWORD dwStateAction
Definition: wintrust.h:114
DWORD fdwRevocationChecks
Definition: wintrust.h:103
DWORD cbStruct
Definition: wintrust.h:99
DWORD dwUIChoice
Definition: wintrust.h:102
#define CRYPT_E_FILE_ERROR
Definition: winerror.h:4420
#define TRUST_E_SUBJECT_FORM_UNKNOWN
Definition: winerror.h:4621
#define TRUST_E_NOSIGNATURE
Definition: winerror.h:4630
#define WTD_REVOKE_WHOLECHAIN
Definition: wintrust.h:89
HRESULT WINAPI WinVerifyTrustEx(HWND hwnd, GUID *ActionID, WINTRUST_DATA *ActionData)

Referenced by START_TEST().

◆ test_wintrust_digest()

static void test_wintrust_digest ( void  )
static

Definition at line 1618 of file softpub.c.

1619{
1620 static const BYTE Dummy[] = { 0x11,0x22,0x33,0x44 };
1621 static const struct
1622 {
1623 struct { const BYTE *data; DWORD length; } blocks[5];
1624 struct { LONG status; BOOL todo; } t1;
1625 struct { LONG status; BOOL todo; } t2;
1626 }
1627 tests[] =
1628 {
1629 /* 32-bit tests */
1630 {
1631 {{ SelfSignedFile32, sizeof(SelfSignedFile32) }},
1632 { CERT_E_CHAINING, TRUE }, { S_OK, FALSE }
1633 },
1634 {
1635 {{ SelfSignedFile32, sizeof(SelfSignedFile32) },
1636 { Dummy, sizeof(Dummy) }},
1638 },
1639 {
1640 {{ Dummy, sizeof(Dummy) },
1641 { SelfSignedFile32 + sizeof(Dummy), sizeof(SelfSignedFile32) - sizeof(Dummy) }},
1643 },
1644 {
1645 {{ SelfSignedFile32, 19 },
1646 { Dummy, sizeof(Dummy) },
1647 { SelfSignedFile32 + 19 + sizeof(Dummy), sizeof(SelfSignedFile32) - 19 - sizeof(Dummy) }},
1649 },
1650 {
1651 {{ SelfSignedFile32, sizeof(IMAGE_DOS_HEADER) }},
1653 },
1654 {
1655 {{ SelfSignedFile32, sizeof(IMAGE_DOS_HEADER) + sizeof(IMAGE_NT_HEADERS32) * 2 }},
1657 },
1658
1659 /* 64-bit tests */
1660 {
1661 {{ SelfSignedFile64, sizeof(SelfSignedFile64) }},
1662 { CERT_E_CHAINING, TRUE }, { S_OK, FALSE }
1663 },
1664 {
1665 {{ SelfSignedFile64, sizeof(SelfSignedFile64) },
1666 { Dummy, sizeof(Dummy) }},
1668 },
1669 {
1670 {{ Dummy, sizeof(Dummy) },
1671 { SelfSignedFile64 + sizeof(Dummy), sizeof(SelfSignedFile64) - sizeof(Dummy) }},
1673 },
1674 {
1675 {{ SelfSignedFile64, 19 },
1676 { Dummy, sizeof(Dummy) },
1677 { SelfSignedFile64 + 19 + sizeof(Dummy), sizeof(SelfSignedFile64) - 19 - sizeof(Dummy) }},
1679 },
1680 {
1681 {{ SelfSignedFile64, sizeof(IMAGE_DOS_HEADER) }},
1683 },
1684 {
1685 {{ SelfSignedFile64, sizeof(IMAGE_DOS_HEADER) + sizeof(IMAGE_NT_HEADERS64) * 2 }},
1687 },
1688 };
1690 DWORD written;
1691 HANDLE file;
1692 LONG status;
1693 BOOL ret;
1694 int i, j;
1695
1696 for (i = 0; i < ARRAY_SIZE(tests); i++)
1697 {
1699 ok(file != INVALID_HANDLE_VALUE, "failed to create temporary file\n");
1700
1701 for (j = 0; tests[i].blocks[j].data; j++)
1702 {
1703 ret = WriteFile(file, tests[i].blocks[j].data, tests[i].blocks[j].length, &written, NULL);
1704 ok(ret && written == tests[i].blocks[j].length, "WriteFile failed with %lu\n", GetLastError());
1705 }
1706
1708
1710 todo_wine_if(tests[i].t1.todo)
1711 ok(status == tests[i].t1.status, "test %d/1: expected %08lx, got %08lx\n", i, tests[i].t1.status, status);
1712
1714 todo_wine_if(tests[i].t2.todo)
1715 ok(status == tests[i].t2.status, "test %d/2: expected %08lx, got %08lx\n", i, tests[i].t2.status, status);
1716
1718 }
1719}
#define TRUE
Definition: types.h:120
struct _IMAGE_DOS_HEADER IMAGE_DOS_HEADER
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define todo_wine_if(is_todo)
Definition: minitest.h:81
static int blocks
Definition: mkdosfs.c:527
static struct test_info tests[]
BOOL todo
Definition: filedlg.c:313
static const BYTE SelfSignedFile64[]
Definition: softpub.c:999
static const BYTE SelfSignedFile32[]
Definition: softpub.c:893
static void call_winverify(WCHAR *pathW, LONG *status, BOOL hash_only)
Definition: softpub.c:1596
#define TRUST_E_BAD_DIGEST
Definition: winerror.h:4590

Referenced by START_TEST().

◆ testCertTrust()

static void testCertTrust ( SAFE_PROVIDER_FUNCTIONS funcs,
GUID actionID 
)
static

Definition at line 548 of file softpub.c.

549{
551 CRYPT_PROVIDER_SIGSTATE sig_state = { 0 };
552 CRYPT_PROVIDER_SGNR sgnr = { sizeof(sgnr), { 0 } };
553 HRESULT ret;
554 BOOL b;
555
556 if (!CertFreeCertificateChain_p)
557 {
558 win_skip("CertFreeCertificateChain not found\n");
559 return;
560 }
561
562 data.pSigState = &sig_state;
563 data.padwTrustStepErrors =
564 funcs->pfnAlloc(TRUSTERROR_MAX_STEPS * sizeof(DWORD));
565 if (!data.padwTrustStepErrors)
566 {
567 skip("pfnAlloc failed\n");
568 return;
569 }
570 ret = funcs->pfnCertificateTrust(&data);
571 ok(ret == S_FALSE, "Expected S_FALSE, got %08lx\n", ret);
572 ok(data.padwTrustStepErrors[TRUSTERROR_STEP_FINAL_CERTPROV] ==
573 TRUST_E_NOSIGNATURE, "Expected TRUST_E_NOSIGNATURE, got %08lx\n",
574 data.padwTrustStepErrors[TRUSTERROR_STEP_FINAL_CERTPROV]);
575 b = funcs->pfnAddSgnr2Chain(&data, FALSE, 0, &sgnr);
576 if (b)
577 {
579
580 /* An empty signer "succeeds," even though there's no cert */
581 ret = funcs->pfnCertificateTrust(&data);
582 ok(ret == S_OK, "Expected S_OK, got %08lx\n", ret);
584 sizeof(selfSignedCert));
585 if (cert)
586 {
587 WINTRUST_DATA wintrust_data = { 0 };
588
589 b = funcs->pfnAddCert2Chain(&data, 0, FALSE, 0, cert);
590 ok(b == TRUE, "Expected TRUE, got %d\n", b);
591
592 /* If pWintrustData isn't set, crashes attempting to access
593 * pWintrustData->fdwRevocationChecks
594 */
595 data.pWintrustData = &wintrust_data;
596 /* If psPfns isn't set, crashes attempting to access
597 * psPfns->pfnCertCheckPolicy
598 */
600 ret = funcs->pfnCertificateTrust(&data);
601 ok(ret == S_OK, "Expected S_OK, got %08lx\n", ret);
602 ok(data.csSigners == 1, "Unexpected number of signers %ld\n",
603 data.csSigners);
604 ok(data.pasSigners[0].pChainContext != NULL,
605 "Expected a certificate chain\n");
606 ok(data.pasSigners[0].csCertChain == 1,
607 "Unexpected number of chain elements %ld\n",
608 data.pasSigners[0].csCertChain);
609 /* pasSigners and pasSigners[0].pasCertChain are guaranteed to be
610 * initialized, see tests for pfnAddSgnr2Chain and pfnAddCert2Chain
611 */
612 ok(!data.pasSigners[0].pasCertChain[0].fTrustedRoot,
613 "Didn't expect cert to be trusted\n");
614 ok(data.pasSigners[0].pasCertChain[0].fSelfSigned,
615 "Expected cert to be self-signed\n");
616 ok(data.pasSigners[0].pasCertChain[0].dwConfidence ==
618 "Expected CERT_CONFIDENCE_SIG | CERT_CONFIDENCE_TIMENEST, got %08lx\n",
619 data.pasSigners[0].pasCertChain[0].dwConfidence);
621 data.pasSigners[0].pasCertChain[0].pCert);
622 CertFreeCertificateChain_p(data.pasSigners[0].pChainContext);
624 }
625 }
626 funcs->pfnFree(data.padwTrustStepErrors);
627}
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define b
Definition: ke_i.h:79
static const BYTE selfSignedCert[]
Definition: softpub.c:434
#define S_FALSE
Definition: winerror.h:3451
#define TRUSTERROR_MAX_STEPS
Definition: wintrust.h:282
#define TRUSTERROR_STEP_FINAL_CERTPROV
Definition: wintrust.h:277
#define CERT_CONFIDENCE_TIMENEST
Definition: wintrust.h:226
#define CERT_CONFIDENCE_SIG
Definition: wintrust.h:224

Referenced by test_provider_funcs().

◆ testInitialize()

static void testInitialize ( SAFE_PROVIDER_FUNCTIONS funcs,
GUID actionID 
)
static

Definition at line 229 of file softpub.c.

230{
231 HRESULT ret;
233 WINTRUST_DATA wintrust_data = { 0 };
234
235 if (!funcs->pfnInitialize)
236 {
237 skip("missing pfnInitialize\n");
238 return;
239 }
240
241 /* Crashes
242 ret = funcs->pfnInitialize(NULL);
243 */
244 memset(&data, 0, sizeof(data));
245 ret = funcs->pfnInitialize(&data);
246 ok(ret == S_FALSE, "Expected S_FALSE, got %08lx\n", ret);
247 data.padwTrustStepErrors =
248 funcs->pfnAlloc(TRUSTERROR_MAX_STEPS * sizeof(DWORD));
249 /* Without wintrust data set, crashes when padwTrustStepErrors is set */
250 data.pWintrustData = &wintrust_data;
251 if (data.padwTrustStepErrors)
252 {
253 /* Apparently, cdwTrustStepErrors does not need to be set. */
254 memset(data.padwTrustStepErrors, 0,
255 TRUSTERROR_MAX_STEPS * sizeof(DWORD));
256 ret = funcs->pfnInitialize(&data);
257 ok(ret == S_OK, "Expected S_OK, got %08lx\n", ret);
258 data.cdwTrustStepErrors = 1;
259 ret = funcs->pfnInitialize(&data);
260 ok(ret == S_OK, "Expected S_OK, got %08lx\n", ret);
261 memset(data.padwTrustStepErrors, 0xba,
262 TRUSTERROR_MAX_STEPS * sizeof(DWORD));
263 ret = funcs->pfnInitialize(&data);
264 ok(ret == S_FALSE, "Expected S_FALSE, got %08lx\n", ret);
265 data.padwTrustStepErrors[TRUSTERROR_STEP_FINAL_WVTINIT] = 0;
266 ret = funcs->pfnInitialize(&data);
267 ok(ret == S_OK, "Expected S_OK, got %08lx\n", ret);
268 funcs->pfnFree(data.padwTrustStepErrors);
269 }
270}
#define TRUSTERROR_STEP_FINAL_WVTINIT
Definition: wintrust.h:273

◆ testObjTrust()

static void testObjTrust ( SAFE_PROVIDER_FUNCTIONS funcs,
GUID actionID 
)
static

Definition at line 302 of file softpub.c.

303{
304 HRESULT ret;
306 CRYPT_PROVIDER_SIGSTATE sig_state = { 0 };
307 WINTRUST_DATA wintrust_data = { 0 };
308 WINTRUST_CERT_INFO certInfo = { sizeof(WINTRUST_CERT_INFO), 0 };
309 WINTRUST_FILE_INFO fileInfo = { sizeof(WINTRUST_FILE_INFO), 0 };
310
311 if (!funcs->pfnObjectTrust)
312 {
313 skip("missing pfnObjectTrust\n");
314 return;
315 }
316
317 /* Crashes
318 ret = funcs->pfnObjectTrust(NULL);
319 */
320
321 data.cbStruct = sizeof(data);
322 data.pSigState = &sig_state;
323 data.pWintrustData = &wintrust_data;
324 data.padwTrustStepErrors =
325 funcs->pfnAlloc(TRUSTERROR_MAX_STEPS * sizeof(DWORD));
326 if (data.padwTrustStepErrors)
327 {
329 PROVDATA_SIP provDataSIP = { 0 };
330 static const GUID unknown = { 0xC689AAB8, 0x8E78, 0x11D0, { 0x8C,0x47,
331 0x00,0xC0,0x4F,0xC2,0x95,0xEE } };
332 static GUID bogusGuid = { 0xdeadbeef, 0xbaad, 0xf00d, { 0x00,0x00,0x00,
333 0x00,0x00,0x00,0x00,0x00 } };
334
335 ret = funcs->pfnObjectTrust(&data);
336 ok(ret == S_FALSE, "Expected S_FALSE, got %08lx\n", ret);
337 ok(data.padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV] ==
339 "Expected ERROR_INVALID_PARAMETER, got %08lx\n",
340 data.padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV]);
341 wintrust_data.pCert = &certInfo;
342 wintrust_data.dwUnionChoice = WTD_CHOICE_CERT;
343 ret = funcs->pfnObjectTrust(&data);
344 ok(ret == S_OK, "Expected S_OK, got %08lx\n", ret);
347 ret = funcs->pfnObjectTrust(&data);
348 ok(ret == S_OK, "Expected S_OK, got %08lx\n", ret);
350 certInfo.psCertContext = NULL;
351 wintrust_data.dwUnionChoice = WTD_CHOICE_FILE;
352 wintrust_data.pFile = NULL;
353 ret = funcs->pfnObjectTrust(&data);
354 ok(ret == S_FALSE, "Expected S_FALSE, got %08lx\n", ret);
355 ok(data.padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV] ==
357 "Expected ERROR_INVALID_PARAMETER, got %08lx\n",
358 data.padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV]);
359 wintrust_data.pFile = &fileInfo;
360 /* Crashes
361 ret = funcs->pfnObjectTrust(&data);
362 */
363 /* Create and test with an empty file */
364 fileInfo.hFile = create_temp_file(pathW);
365 /* pfnObjectTrust now crashes unless both pPDSip and psPfns are set */
366 data.pPDSip = &provDataSIP;
368 ret = funcs->pfnObjectTrust(&data);
369 ok(ret == S_FALSE, "Expected S_FALSE, got %08lx\n", ret);
370 ok(data.padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV] ==
372 "expected TRUST_E_SUBJECT_FORM_UNKNOWN, got %08lx\n",
373 data.padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV]);
374 CloseHandle(fileInfo.hFile);
375 fileInfo.hFile = NULL;
376 fileInfo.pcwszFilePath = pathW;
377 ret = funcs->pfnObjectTrust(&data);
378 ok(ret == S_FALSE, "Expected S_FALSE, got %08lx\n", ret);
379 ok(data.padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV] ==
381 "expected TRUST_E_SUBJECT_FORM_UNKNOWN, got %08lx\n",
382 data.padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV]);
384 /* Test again with a file we expect to exist, and to contain no
385 * signature.
386 */
388 ret = funcs->pfnObjectTrust(&data);
389 ok(ret == S_FALSE, "Expected S_FALSE, got %08lx\n", ret);
390 ok(data.padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV] ==
392 data.padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV] ==
394 "Expected TRUST_E_NOSIGNATURE or TRUST_E_SUBJECT_FORM_UNKNOWN, got %08lx\n",
395 data.padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV]);
396 if (data.padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV] ==
398 {
399 ok(!memcmp(&provDataSIP.gSubject, &unknown, sizeof(unknown)),
400 "Unexpected subject GUID\n");
401 ok(provDataSIP.pSip != NULL, "Expected a SIP\n");
402 ok(provDataSIP.psSipSubjectInfo != NULL,
403 "Expected a subject info\n");
404 }
405 /* Specifying the GUID results in that GUID being the subject GUID */
406 fileInfo.pgKnownSubject = &bogusGuid;
407 ret = funcs->pfnObjectTrust(&data);
408 ok(ret == S_FALSE, "Expected S_FALSE, got %08lx\n", ret);
409 ok(data.padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV] ==
411 data.padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV] ==
413 data.padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV] ==
415 "Expected TRUST_E_NOSIGNATURE or TRUST_E_SUBJECT_FORM_UNKNOWN or TRUST_E_PROVIDER_UNKNOWN, got %08lx\n",
416 data.padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV]);
417 if (data.padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV] ==
419 {
420 ok(!memcmp(&provDataSIP.gSubject, &bogusGuid, sizeof(bogusGuid)),
421 "unexpected subject GUID\n");
422 }
423 /* Specifying a bogus GUID pointer crashes */
424 if (0)
425 {
426 fileInfo.pgKnownSubject = (GUID *)0xdeadbeef;
427 ret = funcs->pfnObjectTrust(&data);
428 ok(ret == S_FALSE, "Expected S_FALSE, got %08lx\n", ret);
429 }
430 funcs->pfnFree(data.padwTrustStepErrors);
431 }
432}
CERT_CONTEXT * psCertContext
Definition: wintrust.h:72
GUID * pgKnownSubject
Definition: wintrust.h:32
LPCWSTR pcwszFilePath
Definition: wintrust.h:30
struct SIP_SUBJECTINFO_ * psSipSubjectInfo
Definition: wintrust.h:341
GUID gSubject
Definition: wintrust.h:338
struct SIP_DISPATCH_INFO_ * pSip
Definition: wintrust.h:339
struct WINTRUST_CERT_INFO_ * pCert
Definition: wintrust.h:111
struct _CERT_CONTEXT * PCERT_CONTEXT
#define TRUST_E_PROVIDER_UNKNOWN
Definition: winerror.h:4619
struct WINTRUST_CERT_INFO_ WINTRUST_CERT_INFO
#define TRUSTERROR_STEP_FINAL_OBJPROV
Definition: wintrust.h:275
struct WINTRUST_FILE_INFO_ WINTRUST_FILE_INFO
#define WTD_CHOICE_CERT
Definition: wintrust.h:95

Referenced by test_provider_funcs().

◆ VOID()

static DWORD SIP_INDIRECT_DATA *static VOID ( WINAPI CertFreeCertificateChain_p)
static

Variable Documentation

◆ bin

◆ DWORD

Definition at line 1895 of file softpub.c.

Referenced by test_utils().

◆ self_signed_3certs

const BYTE self_signed_3certs[]
static

Definition at line 1141 of file softpub.c.

Referenced by test_multiple_signatures().

◆ selfSignedCert

const BYTE selfSignedCert[]
static

Definition at line 434 of file softpub.c.

Referenced by testCertTrust().

◆ SelfSignedFile32

const BYTE SelfSignedFile32[]
static

Definition at line 893 of file softpub.c.

Referenced by test_wintrust_digest().

◆ SelfSignedFile64

const BYTE SelfSignedFile64[]
static

Definition at line 999 of file softpub.c.

Referenced by test_wintrust_digest().

◆ usages

◆ v1CertWithPubKey

const BYTE v1CertWithPubKey[]
static
Initial value:
= {
0x30,0x81,0x95,0x02,0x01,0x01,0x30,0x02,0x06,0x00,0x30,0x15,0x31,0x13,0x30,
0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,
0x6e,0x67,0x00,0x30,0x22,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,0x30,0x31,
0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,
0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x30,0x15,0x31,0x13,0x30,0x11,
0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,
0x67,0x00,0x30,0x22,0x30,0x0d,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,
0x01,0x01,0x05,0x00,0x03,0x11,0x00,0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0xa3,0x16,0x30,0x14,0x30,0x12,0x06,
0x03,0x55,0x1d,0x13,0x01,0x01,0xff,0x04,0x08,0x30,0x06,0x01,0x01,0xff,0x02,
0x01,0x01 }

Definition at line 112 of file softpub.c.

Referenced by test_utils(), and testObjTrust().