2 * Copyright 2002 Mike McCormack for CodeWeavers
3 * Copyright 2005-2008 Juan Lang
4 * Copyright 2006 Paul Vriens
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "crypt32_private.h"
23 WINE_DEFAULT_DEBUG_CHANNEL(crypt
);
25 static const WCHAR szOID
[] = {
26 'S','o','f','t','w','a','r','e','\\',
27 'M','i','c','r','o','s','o','f','t','\\',
28 'C','r','y','p','t','o','g','r','a','p','h','y','\\',
30 'E','n','c','o','d','i','n','g','T','y','p','e',' ','0','\\',
31 'C','r','y','p','t','S','I','P','D','l','l', 0 };
33 static const WCHAR szPutSigned
[] = {
34 'P','u','t','S','i','g','n','e','d','D','a','t','a','M','s','g','\\',0};
35 static const WCHAR szGetSigned
[] = {
36 'G','e','t','S','i','g','n','e','d','D','a','t','a','M','s','g','\\',0};
37 static const WCHAR szRemoveSigned
[] = {
38 'R','e','m','o','v','e','S','i','g','n','e','d','D','a','t','a','M','s','g','\\',0};
39 static const WCHAR szCreate
[] = {
40 'C','r','e','a','t','e','I','n','d','i','r','e','c','t','D','a','t','a','\\',0};
41 static const WCHAR szVerify
[] = {
42 'V','e','r','i','f','y','I','n','d','i','r','e','c','t','D','a','t','a','\\',0};
43 static const WCHAR szIsMyFile
[] = {
44 'I','s','M','y','F','i','l','e','T','y','p','e','\\',0};
45 static const WCHAR szIsMyFile2
[] = {
46 'I','s','M','y','F','i','l','e','T','y','p','e','2','\\',0};
48 static const WCHAR szDllName
[] = { 'D','l','l',0 };
49 static const WCHAR szFuncName
[] = { 'F','u','n','c','N','a','m','e',0 };
51 /* convert a guid to a wide character string */
52 static void CRYPT_guid2wstr( const GUID
*guid
, LPWSTR wstr
)
56 sprintf(str
, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
57 guid
->Data1
, guid
->Data2
, guid
->Data3
,
58 guid
->Data4
[0], guid
->Data4
[1], guid
->Data4
[2], guid
->Data4
[3],
59 guid
->Data4
[4], guid
->Data4
[5], guid
->Data4
[6], guid
->Data4
[7] );
60 MultiByteToWideChar( CP_ACP
, 0, str
, -1, wstr
, 40 );
63 /***********************************************************************
64 * CRYPT_SIPDeleteFunction
66 * Helper function for CryptSIPRemoveProvider
68 static LONG
CRYPT_SIPDeleteFunction( const GUID
*guid
, LPCWSTR szKey
)
70 WCHAR szFullKey
[ 0x100 ];
71 LONG r
= ERROR_SUCCESS
;
73 /* max length of szFullKey depends on our code only, so we won't overrun */
74 lstrcpyW( szFullKey
, szOID
);
75 lstrcatW( szFullKey
, szKey
);
76 CRYPT_guid2wstr( guid
, &szFullKey
[ lstrlenW( szFullKey
) ] );
78 r
= RegDeleteKeyW(HKEY_LOCAL_MACHINE
, szFullKey
);
83 /***********************************************************************
84 * CryptSIPRemoveProvider (CRYPT32.@)
86 * Remove a SIP provider and its functions from the registry.
89 * pgProv [I] Pointer to a GUID for this SIP provider
93 * Failure: FALSE. (Look at GetLastError()).
96 * Registry errors are always reported via SetLastError(). Every registry
97 * deletion will be tried.
99 BOOL WINAPI
CryptSIPRemoveProvider(GUID
*pgProv
)
101 LONG r
= ERROR_SUCCESS
;
102 LONG remove_error
= ERROR_SUCCESS
;
104 TRACE("%s\n", debugstr_guid(pgProv
));
108 SetLastError(ERROR_INVALID_PARAMETER
);
113 #define CRYPT_SIPREMOVEPROV( key ) \
114 r = CRYPT_SIPDeleteFunction( pgProv, key); \
115 if (r != ERROR_SUCCESS) remove_error = r
117 CRYPT_SIPREMOVEPROV( szPutSigned
);
118 CRYPT_SIPREMOVEPROV( szGetSigned
);
119 CRYPT_SIPREMOVEPROV( szRemoveSigned
);
120 CRYPT_SIPREMOVEPROV( szCreate
);
121 CRYPT_SIPREMOVEPROV( szVerify
);
122 CRYPT_SIPREMOVEPROV( szIsMyFile
);
123 CRYPT_SIPREMOVEPROV( szIsMyFile2
);
125 #undef CRYPT_SIPREMOVEPROV
127 if (remove_error
!= ERROR_SUCCESS
)
129 SetLastError(remove_error
);
137 * Helper for CryptSIPAddProvider
139 * Add a registry key containing a dll name and function under
140 * "Software\\Microsoft\\Cryptography\\OID\\EncodingType 0\\<func>\\<guid>"
142 static LONG
CRYPT_SIPWriteFunction( const GUID
*guid
, LPCWSTR szKey
,
143 LPCWSTR szDll
, LPCWSTR szFunction
)
145 WCHAR szFullKey
[ 0x100 ];
146 LONG r
= ERROR_SUCCESS
;
150 return ERROR_SUCCESS
;
152 /* max length of szFullKey depends on our code only, so we won't overrun */
153 lstrcpyW( szFullKey
, szOID
);
154 lstrcatW( szFullKey
, szKey
);
155 CRYPT_guid2wstr( guid
, &szFullKey
[ lstrlenW( szFullKey
) ] );
157 TRACE("key is %s\n", debugstr_w( szFullKey
) );
159 r
= RegCreateKeyW( HKEY_LOCAL_MACHINE
, szFullKey
, &hKey
);
160 if( r
!= ERROR_SUCCESS
) goto error_close_key
;
162 /* write the values */
163 r
= RegSetValueExW( hKey
, szFuncName
, 0, REG_SZ
, (const BYTE
*) szFunction
,
164 ( lstrlenW( szFunction
) + 1 ) * sizeof (WCHAR
) );
165 if( r
!= ERROR_SUCCESS
) goto error_close_key
;
166 r
= RegSetValueExW( hKey
, szDllName
, 0, REG_SZ
, (const BYTE
*) szDll
,
167 ( lstrlenW( szDll
) + 1) * sizeof (WCHAR
) );
176 /***********************************************************************
177 * CryptSIPAddProvider (CRYPT32.@)
179 * Add a SIP provider and its functions to the registry.
182 * psNewProv [I] Pointer to a structure with information about
183 * the functions this SIP provider can perform.
187 * Failure: FALSE. (Look at GetLastError()).
190 * Registry errors are always reported via SetLastError(). If a
191 * registry error occurs the rest of the registry write operations
194 BOOL WINAPI
CryptSIPAddProvider(SIP_ADD_NEWPROVIDER
*psNewProv
)
196 LONG r
= ERROR_SUCCESS
;
198 TRACE("%p\n", psNewProv
);
201 psNewProv
->cbStruct
< FIELD_OFFSET(SIP_ADD_NEWPROVIDER
, pwszGetCapFuncName
) ||
202 !psNewProv
->pwszGetFuncName
||
203 !psNewProv
->pwszPutFuncName
||
204 !psNewProv
->pwszCreateFuncName
||
205 !psNewProv
->pwszVerifyFuncName
||
206 !psNewProv
->pwszRemoveFuncName
)
208 SetLastError(ERROR_INVALID_PARAMETER
);
212 TRACE("%s %s %s %s %s\n",
213 debugstr_guid( psNewProv
->pgSubject
),
214 debugstr_w( psNewProv
->pwszDLLFileName
),
215 debugstr_w( psNewProv
->pwszMagicNumber
),
216 debugstr_w( psNewProv
->pwszIsFunctionName
),
217 debugstr_w( psNewProv
->pwszIsFunctionNameFmt2
) );
219 #define CRYPT_SIPADDPROV( key, field ) \
220 r = CRYPT_SIPWriteFunction( psNewProv->pgSubject, key, \
221 psNewProv->pwszDLLFileName, psNewProv->field); \
222 if (r != ERROR_SUCCESS) goto end_function
224 CRYPT_SIPADDPROV( szPutSigned
, pwszPutFuncName
);
225 CRYPT_SIPADDPROV( szGetSigned
, pwszGetFuncName
);
226 CRYPT_SIPADDPROV( szRemoveSigned
, pwszRemoveFuncName
);
227 CRYPT_SIPADDPROV( szCreate
, pwszCreateFuncName
);
228 CRYPT_SIPADDPROV( szVerify
, pwszVerifyFuncName
);
229 CRYPT_SIPADDPROV( szIsMyFile
, pwszIsFunctionName
);
230 CRYPT_SIPADDPROV( szIsMyFile2
, pwszIsFunctionNameFmt2
);
232 #undef CRYPT_SIPADDPROV
236 if (r
!= ERROR_SUCCESS
)
245 static void *CRYPT_LoadSIPFuncFromKey(HKEY key
, HMODULE
*pLib
)
249 WCHAR dllName
[MAX_PATH
];
250 char functionName
[MAX_PATH
];
254 /* Read the DLL entry */
255 size
= sizeof(dllName
);
256 r
= RegQueryValueExW(key
, szDllName
, NULL
, NULL
, (LPBYTE
)dllName
, &size
);
259 /* Read the Function entry */
260 size
= sizeof(functionName
);
261 r
= RegQueryValueExA(key
, "FuncName", NULL
, NULL
, (LPBYTE
)functionName
,
265 lib
= LoadLibraryW(dllName
);
268 func
= GetProcAddress(lib
, functionName
);
278 /***********************************************************************
279 * CryptSIPRetrieveSubjectGuid (CRYPT32.@)
281 * Determine the right SIP GUID for the given file.
284 * FileName [I] Filename.
285 * hFileIn [I] Optional handle to the file.
286 * pgSubject [O] The SIP's GUID.
289 * Success: TRUE. pgSubject contains the SIP GUID.
290 * Failure: FALSE. (Look at GetLastError()).
293 * On failure pgSubject will contain a NULL GUID.
294 * The handle is always preferred above the filename.
296 BOOL WINAPI CryptSIPRetrieveSubjectGuid
297 (LPCWSTR FileName
, HANDLE hFileIn
, GUID
*pgSubject
)
302 LARGE_INTEGER zero
, oldPos
;
303 /* FIXME, find out if there is a name for this GUID */
304 static const GUID unknown
= { 0xC689AAB8, 0x8E78, 0x11D0, { 0x8C,0x47,0x00,0xC0,0x4F,0xC2,0x95,0xEE }};
305 static const GUID cabGUID
= { 0xc689aaba, 0x8e78, 0x11d0, {0x8c,0x47,0x00,0xc0,0x4f,0xc2,0x95,0xee }};
306 static const GUID catGUID
= { 0xDE351A43, 0x8E59, 0x11D0, { 0x8C,0x47,0x00,0xC0,0x4F,0xC2,0x95,0xEE }};
307 static const WORD dosHdr
= IMAGE_DOS_SIGNATURE
;
308 static const BYTE cabHdr
[] = { 'M','S','C','F' };
309 BYTE hdr
[SIP_MAX_MAGIC_NUMBER
];
310 WCHAR szFullKey
[ 0x100 ];
311 LONG r
= ERROR_SUCCESS
;
314 TRACE("(%s %p %p)\n", wine_dbgstr_w(FileName
), hFileIn
, pgSubject
);
316 if (!pgSubject
|| (!FileName
&& !hFileIn
))
318 SetLastError(ERROR_INVALID_PARAMETER
);
322 /* Set pgSubject to zero's */
323 memset(pgSubject
, 0 , sizeof(GUID
));
326 /* Use the given handle, make sure not to close this one ourselves */
330 hFile
= CreateFileW(FileName
, GENERIC_READ
, FILE_SHARE_READ
, NULL
, OPEN_EXISTING
, FILE_ATTRIBUTE_NORMAL
, NULL
);
331 /* Last error is set by CreateFile */
332 if (hFile
== INVALID_HANDLE_VALUE
) return FALSE
;
336 SetFilePointerEx(hFile
, zero
, &oldPos
, FILE_CURRENT
);
337 SetFilePointer(hFile
, 0, NULL
, FILE_BEGIN
);
338 if (!ReadFile(hFile
, hdr
, sizeof(hdr
), &count
, NULL
))
341 if (count
< SIP_MAX_MAGIC_NUMBER
)
343 SetLastError(ERROR_INVALID_PARAMETER
);
347 TRACE("file magic = 0x%02x%02x%02x%02x\n", hdr
[0], hdr
[1], hdr
[2], hdr
[3]);
348 /* As everything is in place now we start looking at the file header */
349 if (!memcmp(hdr
, &dosHdr
, sizeof(dosHdr
)))
351 *pgSubject
= unknown
;
356 /* Quick-n-dirty check for a cab file. */
357 if (!memcmp(hdr
, cabHdr
, sizeof(cabHdr
)))
359 *pgSubject
= cabGUID
;
364 /* If it's asn.1-encoded, it's probably a .cat file. */
367 DWORD fileLen
= GetFileSize(hFile
, NULL
);
369 TRACE("fileLen = %d\n", fileLen
);
370 /* Sanity-check length */
371 if (hdr
[1] < 0x80 && fileLen
== 2 + hdr
[1])
373 *pgSubject
= catGUID
;
378 else if (hdr
[1] == 0x80)
380 /* Indefinite length, can't verify with just the header, assume it
383 *pgSubject
= catGUID
;
390 BYTE lenBytes
= hdr
[1] & 0x7f;
392 if (lenBytes
== 1 && fileLen
== 2 + lenBytes
+ hdr
[2])
394 *pgSubject
= catGUID
;
399 else if (lenBytes
== 2 && fileLen
== 2 + lenBytes
+
400 (hdr
[2] << 8 | hdr
[3]))
402 *pgSubject
= catGUID
;
407 else if (fileLen
> 0xffff)
409 /* The file size must be greater than 2 bytes in length, so
410 * assume it is a .cat file
412 *pgSubject
= catGUID
;
420 /* Check for supported functions using CryptSIPDllIsMyFileType */
421 /* max length of szFullKey depends on our code only, so we won't overrun */
422 lstrcpyW(szFullKey
, szOID
);
423 lstrcatW(szFullKey
, szIsMyFile
);
424 r
= RegOpenKeyExW(HKEY_LOCAL_MACHINE
, szFullKey
, 0, KEY_READ
, &key
);
425 if (r
== ERROR_SUCCESS
)
427 DWORD index
= 0, size
;
428 WCHAR subKeyName
[MAX_PATH
];
431 size
= sizeof(subKeyName
) / sizeof(subKeyName
[0]);
432 r
= RegEnumKeyExW(key
, index
++, subKeyName
, &size
, NULL
, NULL
,
434 if (r
== ERROR_SUCCESS
)
438 r
= RegOpenKeyExW(key
, subKeyName
, 0, KEY_READ
, &subKey
);
439 if (r
== ERROR_SUCCESS
)
442 pfnIsFileSupported isMy
= CRYPT_LoadSIPFuncFromKey(subKey
,
447 bRet
= isMy(hFile
, pgSubject
);
453 } while (!bRet
&& r
== ERROR_SUCCESS
);
457 /* Check for supported functions using CryptSIPDllIsMyFileType2 */
460 lstrcpyW(szFullKey
, szOID
);
461 lstrcatW(szFullKey
, szIsMyFile2
);
462 r
= RegOpenKeyExW(HKEY_LOCAL_MACHINE
, szFullKey
, 0, KEY_READ
, &key
);
463 if (r
== ERROR_SUCCESS
)
465 DWORD index
= 0, size
;
466 WCHAR subKeyName
[MAX_PATH
];
469 size
= sizeof(subKeyName
) / sizeof(subKeyName
[0]);
470 r
= RegEnumKeyExW(key
, index
++, subKeyName
, &size
, NULL
, NULL
,
472 if (r
== ERROR_SUCCESS
)
476 r
= RegOpenKeyExW(key
, subKeyName
, 0, KEY_READ
, &subKey
);
477 if (r
== ERROR_SUCCESS
)
480 pfnIsFileSupportedName isMy2
=
481 CRYPT_LoadSIPFuncFromKey(subKey
, &lib
);
485 bRet
= isMy2((LPWSTR
)FileName
, pgSubject
);
491 } while (!bRet
&& r
== ERROR_SUCCESS
);
497 SetLastError(TRUST_E_SUBJECT_FORM_UNKNOWN
);
500 /* If we didn't open this one we shouldn't close it (hFile is a copy),
501 * but we should reset the file pointer to its original position.
506 SetFilePointerEx(hFile
, oldPos
, NULL
, FILE_BEGIN
);
511 static LONG
CRYPT_OpenSIPFunctionKey(const GUID
*guid
, LPCWSTR function
,
514 WCHAR szFullKey
[ 0x100 ];
516 lstrcpyW(szFullKey
, szOID
);
517 lstrcatW(szFullKey
, function
);
518 CRYPT_guid2wstr(guid
, &szFullKey
[lstrlenW(szFullKey
)]);
519 return RegOpenKeyExW(HKEY_LOCAL_MACHINE
, szFullKey
, 0, KEY_READ
, key
);
522 /* Loads the function named function for the SIP specified by pgSubject, and
523 * returns it if found. Returns NULL on error. If the function is loaded,
524 * *pLib is set to the library in which it is found.
526 static void *CRYPT_LoadSIPFunc(const GUID
*pgSubject
, LPCWSTR function
,
533 TRACE("(%s, %s)\n", debugstr_guid(pgSubject
), debugstr_w(function
));
535 r
= CRYPT_OpenSIPFunctionKey(pgSubject
, function
, &key
);
538 func
= CRYPT_LoadSIPFuncFromKey(key
, pLib
);
541 TRACE("returning %p\n", func
);
545 typedef struct _WINE_SIP_PROVIDER
{
547 SIP_DISPATCH_INFO info
;
551 static struct list providers
= { &providers
, &providers
};
552 static CRITICAL_SECTION providers_cs
;
553 static CRITICAL_SECTION_DEBUG providers_cs_debug
=
556 { &providers_cs_debug
.ProcessLocksList
,
557 &providers_cs_debug
.ProcessLocksList
},
558 0, 0, { (DWORD_PTR
)(__FILE__
": providers_cs") }
560 static CRITICAL_SECTION providers_cs
= { &providers_cs_debug
, -1, 0, 0, 0, 0 };
562 static void CRYPT_CacheSIP(const GUID
*pgSubject
, SIP_DISPATCH_INFO
*info
)
564 WINE_SIP_PROVIDER
*prov
= CryptMemAlloc(sizeof(WINE_SIP_PROVIDER
));
568 prov
->subject
= *pgSubject
;
570 EnterCriticalSection(&providers_cs
);
571 list_add_tail(&providers
, &prov
->entry
);
572 LeaveCriticalSection(&providers_cs
);
576 static WINE_SIP_PROVIDER
*CRYPT_GetCachedSIP(const GUID
*pgSubject
)
578 WINE_SIP_PROVIDER
*provider
= NULL
, *ret
= NULL
;
580 EnterCriticalSection(&providers_cs
);
581 LIST_FOR_EACH_ENTRY(provider
, &providers
, WINE_SIP_PROVIDER
, entry
)
583 if (IsEqualGUID(pgSubject
, &provider
->subject
))
586 if (provider
&& IsEqualGUID(pgSubject
, &provider
->subject
))
588 LeaveCriticalSection(&providers_cs
);
592 static inline BOOL
CRYPT_IsSIPCached(const GUID
*pgSubject
)
594 return CRYPT_GetCachedSIP(pgSubject
) != NULL
;
597 void crypt_sip_free(void)
599 WINE_SIP_PROVIDER
*prov
, *next
;
601 LIST_FOR_EACH_ENTRY_SAFE(prov
, next
, &providers
, WINE_SIP_PROVIDER
, entry
)
603 list_remove(&prov
->entry
);
604 FreeLibrary(prov
->info
.hSIP
);
607 DeleteCriticalSection(&providers_cs
);
610 /* Loads the SIP for pgSubject into the global cache. Returns FALSE if the
611 * SIP isn't registered or is invalid.
613 static BOOL
CRYPT_LoadSIP(const GUID
*pgSubject
)
615 SIP_DISPATCH_INFO sip
= { 0 };
616 HMODULE lib
= NULL
, temp
= NULL
;
618 sip
.pfGet
= CRYPT_LoadSIPFunc(pgSubject
, szGetSigned
, &lib
);
621 sip
.pfPut
= CRYPT_LoadSIPFunc(pgSubject
, szPutSigned
, &temp
);
622 if (!sip
.pfPut
|| temp
!= lib
)
626 sip
.pfCreate
= CRYPT_LoadSIPFunc(pgSubject
, szCreate
, &temp
);
627 if (!sip
.pfCreate
|| temp
!= lib
)
631 sip
.pfVerify
= CRYPT_LoadSIPFunc(pgSubject
, szVerify
, &temp
);
632 if (!sip
.pfVerify
|| temp
!= lib
)
636 sip
.pfRemove
= CRYPT_LoadSIPFunc(pgSubject
, szRemoveSigned
, &temp
);
637 if (!sip
.pfRemove
|| temp
!= lib
)
641 CRYPT_CacheSIP(pgSubject
, &sip
);
647 SetLastError(TRUST_E_SUBJECT_FORM_UNKNOWN
);
651 /***********************************************************************
652 * CryptSIPLoad (CRYPT32.@)
654 * Load some internal crypt32 functions into a SIP_DISPATCH_INFO structure.
657 * pgSubject [I] The GUID.
659 * pSipDispatch [I] The loaded functions.
662 * Success: TRUE. pSipDispatch contains the functions.
663 * Failure: FALSE. (Look at GetLastError()).
666 * CryptSIPLoad uses caching for the list of GUIDs and whether a SIP is
669 * An application calls CryptSipLoad which will return a structure with the
670 * function addresses of some internal crypt32 functions. The application will
671 * then call these functions which will be forwarded to the appropriate SIP.
673 * CryptSIPLoad will load the needed SIP but doesn't unload this dll. The unloading
674 * is done when crypt32 is unloaded.
676 BOOL WINAPI CryptSIPLoad
677 (const GUID
*pgSubject
, DWORD dwFlags
, SIP_DISPATCH_INFO
*pSipDispatch
)
679 TRACE("(%s %d %p)\n", debugstr_guid(pgSubject
), dwFlags
, pSipDispatch
);
681 if (!pgSubject
|| dwFlags
!= 0 || !pSipDispatch
)
683 SetLastError(ERROR_INVALID_PARAMETER
);
686 if (!CRYPT_IsSIPCached(pgSubject
) && !CRYPT_LoadSIP(pgSubject
))
689 pSipDispatch
->hSIP
= NULL
;
690 pSipDispatch
->pfGet
= CryptSIPGetSignedDataMsg
;
691 pSipDispatch
->pfPut
= CryptSIPPutSignedDataMsg
;
692 pSipDispatch
->pfCreate
= CryptSIPCreateIndirectData
;
693 pSipDispatch
->pfVerify
= CryptSIPVerifyIndirectData
;
694 pSipDispatch
->pfRemove
= CryptSIPRemoveSignedDataMsg
;
699 /***********************************************************************
700 * CryptSIPCreateIndirectData (CRYPT32.@)
702 BOOL WINAPI
CryptSIPCreateIndirectData(SIP_SUBJECTINFO
* pSubjectInfo
, DWORD
* pcbIndirectData
,
703 SIP_INDIRECT_DATA
* pIndirectData
)
705 WINE_SIP_PROVIDER
*sip
;
708 TRACE("(%p %p %p)\n", pSubjectInfo
, pcbIndirectData
, pIndirectData
);
710 if (!pSubjectInfo
|| !pSubjectInfo
->pgSubjectType
|| !pcbIndirectData
)
712 SetLastError(ERROR_INVALID_PARAMETER
);
715 if ((sip
= CRYPT_GetCachedSIP(pSubjectInfo
->pgSubjectType
)))
716 ret
= sip
->info
.pfCreate(pSubjectInfo
, pcbIndirectData
, pIndirectData
);
717 TRACE("returning %d\n", ret
);
721 /***********************************************************************
722 * CryptSIPGetSignedDataMsg (CRYPT32.@)
724 BOOL WINAPI
CryptSIPGetSignedDataMsg(SIP_SUBJECTINFO
* pSubjectInfo
, DWORD
* pdwEncodingType
,
725 DWORD dwIndex
, DWORD
* pcbSignedDataMsg
, BYTE
* pbSignedDataMsg
)
727 WINE_SIP_PROVIDER
*sip
;
730 TRACE("(%p %p %d %p %p)\n", pSubjectInfo
, pdwEncodingType
, dwIndex
,
731 pcbSignedDataMsg
, pbSignedDataMsg
);
733 if ((sip
= CRYPT_GetCachedSIP(pSubjectInfo
->pgSubjectType
)))
734 ret
= sip
->info
.pfGet(pSubjectInfo
, pdwEncodingType
, dwIndex
,
735 pcbSignedDataMsg
, pbSignedDataMsg
);
736 TRACE("returning %d\n", ret
);
740 /***********************************************************************
741 * CryptSIPPutSignedDataMsg (CRYPT32.@)
743 BOOL WINAPI
CryptSIPPutSignedDataMsg(SIP_SUBJECTINFO
* pSubjectInfo
, DWORD pdwEncodingType
,
744 DWORD
* pdwIndex
, DWORD cbSignedDataMsg
, BYTE
* pbSignedDataMsg
)
746 WINE_SIP_PROVIDER
*sip
;
749 TRACE("(%p %d %p %d %p)\n", pSubjectInfo
, pdwEncodingType
, pdwIndex
,
750 cbSignedDataMsg
, pbSignedDataMsg
);
752 if ((sip
= CRYPT_GetCachedSIP(pSubjectInfo
->pgSubjectType
)))
753 ret
= sip
->info
.pfPut(pSubjectInfo
, pdwEncodingType
, pdwIndex
,
754 cbSignedDataMsg
, pbSignedDataMsg
);
755 TRACE("returning %d\n", ret
);
759 /***********************************************************************
760 * CryptSIPRemoveSignedDataMsg (CRYPT32.@)
762 BOOL WINAPI
CryptSIPRemoveSignedDataMsg(SIP_SUBJECTINFO
* pSubjectInfo
,
765 WINE_SIP_PROVIDER
*sip
;
768 TRACE("(%p %d)\n", pSubjectInfo
, dwIndex
);
770 if ((sip
= CRYPT_GetCachedSIP(pSubjectInfo
->pgSubjectType
)))
771 ret
= sip
->info
.pfRemove(pSubjectInfo
, dwIndex
);
772 TRACE("returning %d\n", ret
);
776 /***********************************************************************
777 * CryptSIPVerifyIndirectData (CRYPT32.@)
779 BOOL WINAPI
CryptSIPVerifyIndirectData(SIP_SUBJECTINFO
* pSubjectInfo
,
780 SIP_INDIRECT_DATA
* pIndirectData
)
782 WINE_SIP_PROVIDER
*sip
;
785 TRACE("(%p %p)\n", pSubjectInfo
, pIndirectData
);
787 if ((sip
= CRYPT_GetCachedSIP(pSubjectInfo
->pgSubjectType
)))
788 ret
= sip
->info
.pfVerify(pSubjectInfo
, pIndirectData
);
789 TRACE("returning %d\n", ret
);