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
32 #include "wine/debug.h"
33 #include "wine/list.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(crypt
);
37 static const WCHAR szOID
[] = {
38 'S','o','f','t','w','a','r','e','\\',
39 'M','i','c','r','o','s','o','f','t','\\',
40 'C','r','y','p','t','o','g','r','a','p','h','y','\\',
42 'E','n','c','o','d','i','n','g','T','y','p','e',' ','0','\\',
43 'C','r','y','p','t','S','I','P','D','l','l', 0 };
45 static const WCHAR szPutSigned
[] = {
46 'P','u','t','S','i','g','n','e','d','D','a','t','a','M','s','g','\\',0};
47 static const WCHAR szGetSigned
[] = {
48 'G','e','t','S','i','g','n','e','d','D','a','t','a','M','s','g','\\',0};
49 static const WCHAR szRemoveSigned
[] = {
50 'R','e','m','o','v','e','S','i','g','n','e','d','D','a','t','a','M','s','g','\\',0};
51 static const WCHAR szCreate
[] = {
52 'C','r','e','a','t','e','I','n','d','i','r','e','c','t','D','a','t','a','\\',0};
53 static const WCHAR szVerify
[] = {
54 'V','e','r','i','f','y','I','n','d','i','r','e','c','t','D','a','t','a','\\',0};
55 static const WCHAR szIsMyFile
[] = {
56 'I','s','M','y','F','i','l','e','T','y','p','e','\\',0};
57 static const WCHAR szIsMyFile2
[] = {
58 'I','s','M','y','F','i','l','e','T','y','p','e','2','\\',0};
60 static const WCHAR szDllName
[] = { 'D','l','l',0 };
61 static const WCHAR szFuncName
[] = { 'F','u','n','c','N','a','m','e',0 };
63 /* convert a guid to a wide character string */
64 static void CRYPT_guid2wstr( const GUID
*guid
, LPWSTR wstr
)
68 sprintf(str
, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
69 guid
->Data1
, guid
->Data2
, guid
->Data3
,
70 guid
->Data4
[0], guid
->Data4
[1], guid
->Data4
[2], guid
->Data4
[3],
71 guid
->Data4
[4], guid
->Data4
[5], guid
->Data4
[6], guid
->Data4
[7] );
72 MultiByteToWideChar( CP_ACP
, 0, str
, -1, wstr
, 40 );
75 /***********************************************************************
76 * CRYPT_SIPDeleteFunction
78 * Helper function for CryptSIPRemoveProvider
80 static LONG
CRYPT_SIPDeleteFunction( const GUID
*guid
, LPCWSTR szKey
)
82 WCHAR szFullKey
[ 0x100 ];
83 LONG r
= ERROR_SUCCESS
;
85 /* max length of szFullKey depends on our code only, so we won't overrun */
86 lstrcpyW( szFullKey
, szOID
);
87 lstrcatW( szFullKey
, szKey
);
88 CRYPT_guid2wstr( guid
, &szFullKey
[ lstrlenW( szFullKey
) ] );
90 r
= RegDeleteKeyW(HKEY_LOCAL_MACHINE
, szFullKey
);
95 /***********************************************************************
96 * CryptSIPRemoveProvider (CRYPT32.@)
98 * Remove a SIP provider and its functions from the registry.
101 * pgProv [I] Pointer to a GUID for this SIP provider
105 * Failure: FALSE. (Look at GetLastError()).
108 * Registry errors are always reported via SetLastError(). Every registry
109 * deletion will be tried.
111 BOOL WINAPI
CryptSIPRemoveProvider(GUID
*pgProv
)
113 LONG r
= ERROR_SUCCESS
;
114 LONG remove_error
= ERROR_SUCCESS
;
116 TRACE("%s\n", debugstr_guid(pgProv
));
120 SetLastError(ERROR_INVALID_PARAMETER
);
125 #define CRYPT_SIPREMOVEPROV( key ) \
126 r = CRYPT_SIPDeleteFunction( pgProv, key); \
127 if (r != ERROR_SUCCESS) remove_error = r
129 CRYPT_SIPREMOVEPROV( szPutSigned
);
130 CRYPT_SIPREMOVEPROV( szGetSigned
);
131 CRYPT_SIPREMOVEPROV( szRemoveSigned
);
132 CRYPT_SIPREMOVEPROV( szCreate
);
133 CRYPT_SIPREMOVEPROV( szVerify
);
134 CRYPT_SIPREMOVEPROV( szIsMyFile
);
135 CRYPT_SIPREMOVEPROV( szIsMyFile2
);
137 #undef CRYPT_SIPREMOVEPROV
139 if (remove_error
!= ERROR_SUCCESS
)
141 SetLastError(remove_error
);
149 * Helper for CryptSIPAddProvider
151 * Add a registry key containing a dll name and function under
152 * "Software\\Microsoft\\Cryptography\\OID\\EncodingType 0\\<func>\\<guid>"
154 static LONG
CRYPT_SIPWriteFunction( const GUID
*guid
, LPCWSTR szKey
,
155 LPCWSTR szDll
, LPCWSTR szFunction
)
157 WCHAR szFullKey
[ 0x100 ];
158 LONG r
= ERROR_SUCCESS
;
162 return ERROR_SUCCESS
;
164 /* max length of szFullKey depends on our code only, so we won't overrun */
165 lstrcpyW( szFullKey
, szOID
);
166 lstrcatW( szFullKey
, szKey
);
167 CRYPT_guid2wstr( guid
, &szFullKey
[ lstrlenW( szFullKey
) ] );
169 TRACE("key is %s\n", debugstr_w( szFullKey
) );
171 r
= RegCreateKeyW( HKEY_LOCAL_MACHINE
, szFullKey
, &hKey
);
172 if( r
!= ERROR_SUCCESS
) goto error_close_key
;
174 /* write the values */
175 r
= RegSetValueExW( hKey
, szFuncName
, 0, REG_SZ
, (const BYTE
*) szFunction
,
176 ( lstrlenW( szFunction
) + 1 ) * sizeof (WCHAR
) );
177 if( r
!= ERROR_SUCCESS
) goto error_close_key
;
178 r
= RegSetValueExW( hKey
, szDllName
, 0, REG_SZ
, (const BYTE
*) szDll
,
179 ( lstrlenW( szDll
) + 1) * sizeof (WCHAR
) );
188 /***********************************************************************
189 * CryptSIPAddProvider (CRYPT32.@)
191 * Add a SIP provider and its functions to the registry.
194 * psNewProv [I] Pointer to a structure with information about
195 * the functions this SIP provider can perform.
199 * Failure: FALSE. (Look at GetLastError()).
202 * Registry errors are always reported via SetLastError(). If a
203 * registry error occurs the rest of the registry write operations
206 BOOL WINAPI
CryptSIPAddProvider(SIP_ADD_NEWPROVIDER
*psNewProv
)
208 LONG r
= ERROR_SUCCESS
;
210 TRACE("%p\n", psNewProv
);
213 psNewProv
->cbStruct
!= sizeof(SIP_ADD_NEWPROVIDER
) ||
214 !psNewProv
->pwszGetFuncName
||
215 !psNewProv
->pwszPutFuncName
||
216 !psNewProv
->pwszCreateFuncName
||
217 !psNewProv
->pwszVerifyFuncName
||
218 !psNewProv
->pwszRemoveFuncName
)
220 SetLastError(ERROR_INVALID_PARAMETER
);
224 TRACE("%s %s %s %s %s\n",
225 debugstr_guid( psNewProv
->pgSubject
),
226 debugstr_w( psNewProv
->pwszDLLFileName
),
227 debugstr_w( psNewProv
->pwszMagicNumber
),
228 debugstr_w( psNewProv
->pwszIsFunctionName
),
229 debugstr_w( psNewProv
->pwszIsFunctionNameFmt2
) );
231 #define CRYPT_SIPADDPROV( key, field ) \
232 r = CRYPT_SIPWriteFunction( psNewProv->pgSubject, key, \
233 psNewProv->pwszDLLFileName, psNewProv->field); \
234 if (r != ERROR_SUCCESS) goto end_function
236 CRYPT_SIPADDPROV( szPutSigned
, pwszPutFuncName
);
237 CRYPT_SIPADDPROV( szGetSigned
, pwszGetFuncName
);
238 CRYPT_SIPADDPROV( szRemoveSigned
, pwszRemoveFuncName
);
239 CRYPT_SIPADDPROV( szCreate
, pwszCreateFuncName
);
240 CRYPT_SIPADDPROV( szVerify
, pwszVerifyFuncName
);
241 CRYPT_SIPADDPROV( szIsMyFile
, pwszIsFunctionName
);
242 CRYPT_SIPADDPROV( szIsMyFile2
, pwszIsFunctionNameFmt2
);
244 #undef CRYPT_SIPADDPROV
248 if (r
!= ERROR_SUCCESS
)
257 static void *CRYPT_LoadSIPFuncFromKey(HKEY key
, HMODULE
*pLib
)
261 WCHAR dllName
[MAX_PATH
];
262 char functionName
[MAX_PATH
];
266 /* Read the DLL entry */
267 size
= sizeof(dllName
);
268 r
= RegQueryValueExW(key
, szDllName
, NULL
, NULL
, (LPBYTE
)dllName
, &size
);
271 /* Read the Function entry */
272 size
= sizeof(functionName
);
273 r
= RegQueryValueExA(key
, "FuncName", NULL
, NULL
, (LPBYTE
)functionName
,
277 lib
= LoadLibraryW(dllName
);
280 func
= GetProcAddress(lib
, functionName
);
290 /***********************************************************************
291 * CryptSIPRetrieveSubjectGuid (CRYPT32.@)
293 * Determine the right SIP GUID for the given file.
296 * FileName [I] Filename.
297 * hFileIn [I] Optional handle to the file.
298 * pgSubject [O] The SIP's GUID.
301 * Success: TRUE. pgSubject contains the SIP GUID.
302 * Failure: FALSE. (Look at GetLastError()).
305 * On failure pgSubject will contain a NULL GUID.
306 * The handle is always preferred above the filename.
308 BOOL WINAPI CryptSIPRetrieveSubjectGuid
309 (LPCWSTR FileName
, HANDLE hFileIn
, GUID
*pgSubject
)
314 LARGE_INTEGER zero
, oldPos
;
315 /* FIXME, find out if there is a name for this GUID */
316 static const GUID unknown
= { 0xC689AAB8, 0x8E78, 0x11D0, { 0x8C,0x47,0x00,0xC0,0x4F,0xC2,0x95,0xEE }};
317 static const GUID cabGUID
= { 0xc689aaba, 0x8e78, 0x11d0, {0x8c,0x47,0x00,0xc0,0x4f,0xc2,0x95,0xee }};
318 static const GUID catGUID
= { 0xDE351A43, 0x8E59, 0x11D0, { 0x8C,0x47,0x00,0xC0,0x4F,0xC2,0x95,0xEE }};
319 static const WORD dosHdr
= IMAGE_DOS_SIGNATURE
;
320 static const BYTE cabHdr
[] = { 'M','S','C','F' };
321 BYTE hdr
[SIP_MAX_MAGIC_NUMBER
];
322 WCHAR szFullKey
[ 0x100 ];
323 LONG r
= ERROR_SUCCESS
;
326 TRACE("(%s %p %p)\n", wine_dbgstr_w(FileName
), hFileIn
, pgSubject
);
328 if (!pgSubject
|| (!FileName
&& !hFileIn
))
330 SetLastError(ERROR_INVALID_PARAMETER
);
334 /* Set pgSubject to zero's */
335 memset(pgSubject
, 0 , sizeof(GUID
));
338 /* Use the given handle, make sure not to close this one ourselves */
342 hFile
= CreateFileW(FileName
, GENERIC_READ
, FILE_SHARE_READ
, NULL
, OPEN_EXISTING
, FILE_ATTRIBUTE_NORMAL
, NULL
);
343 /* Last error is set by CreateFile */
344 if (hFile
== INVALID_HANDLE_VALUE
) return FALSE
;
348 SetFilePointerEx(hFile
, zero
, &oldPos
, FILE_CURRENT
);
349 SetFilePointer(hFile
, 0, NULL
, FILE_BEGIN
);
350 if (!ReadFile(hFile
, hdr
, sizeof(hdr
), &count
, NULL
))
353 if (count
< SIP_MAX_MAGIC_NUMBER
)
355 SetLastError(ERROR_INVALID_PARAMETER
);
359 TRACE("file magic = 0x%02x%02x%02x%02x\n", hdr
[0], hdr
[1], hdr
[2], hdr
[3]);
360 /* As everything is in place now we start looking at the file header */
361 if (!memcmp(hdr
, &dosHdr
, sizeof(dosHdr
)))
363 *pgSubject
= unknown
;
368 /* Quick-n-dirty check for a cab file. */
369 if (!memcmp(hdr
, cabHdr
, sizeof(cabHdr
)))
371 *pgSubject
= cabGUID
;
376 /* If it's asn.1-encoded, it's probably a .cat file. */
379 DWORD fileLen
= GetFileSize(hFile
, NULL
);
381 TRACE("fileLen = %d\n", fileLen
);
382 /* Sanity-check length */
383 if (hdr
[1] < 0x80 && fileLen
== 2 + hdr
[1])
385 *pgSubject
= catGUID
;
390 else if (hdr
[1] == 0x80)
392 /* Indefinite length, can't verify with just the header, assume it
395 *pgSubject
= catGUID
;
402 BYTE lenBytes
= hdr
[1] & 0x7f;
404 if (lenBytes
== 1 && fileLen
== 2 + lenBytes
+ hdr
[2])
406 *pgSubject
= catGUID
;
411 else if (lenBytes
== 2 && fileLen
== 2 + lenBytes
+
412 (hdr
[2] << 8 | hdr
[3]))
414 *pgSubject
= catGUID
;
419 else if (fileLen
> 0xffff)
421 /* The file size must be greater than 2 bytes in length, so
422 * assume it is a .cat file
424 *pgSubject
= catGUID
;
432 /* Check for supported functions using CryptSIPDllIsMyFileType */
433 /* max length of szFullKey depends on our code only, so we won't overrun */
434 lstrcpyW(szFullKey
, szOID
);
435 lstrcatW(szFullKey
, szIsMyFile
);
436 r
= RegOpenKeyExW(HKEY_LOCAL_MACHINE
, szFullKey
, 0, KEY_READ
, &key
);
437 if (r
== ERROR_SUCCESS
)
439 DWORD index
= 0, size
;
440 WCHAR subKeyName
[MAX_PATH
];
443 size
= sizeof(subKeyName
) / sizeof(subKeyName
[0]);
444 r
= RegEnumKeyExW(key
, index
++, subKeyName
, &size
, NULL
, NULL
,
446 if (r
== ERROR_SUCCESS
)
450 r
= RegOpenKeyExW(key
, subKeyName
, 0, KEY_READ
, &subKey
);
451 if (r
== ERROR_SUCCESS
)
454 pfnIsFileSupported isMy
= CRYPT_LoadSIPFuncFromKey(subKey
,
459 bRet
= isMy(hFile
, pgSubject
);
465 } while (!bRet
&& r
== ERROR_SUCCESS
);
469 /* Check for supported functions using CryptSIPDllIsMyFileType2 */
472 lstrcpyW(szFullKey
, szOID
);
473 lstrcatW(szFullKey
, szIsMyFile2
);
474 r
= RegOpenKeyExW(HKEY_LOCAL_MACHINE
, szFullKey
, 0, KEY_READ
, &key
);
475 if (r
== ERROR_SUCCESS
)
477 DWORD index
= 0, size
;
478 WCHAR subKeyName
[MAX_PATH
];
481 size
= sizeof(subKeyName
) / sizeof(subKeyName
[0]);
482 r
= RegEnumKeyExW(key
, index
++, subKeyName
, &size
, NULL
, NULL
,
484 if (r
== ERROR_SUCCESS
)
488 r
= RegOpenKeyExW(key
, subKeyName
, 0, KEY_READ
, &subKey
);
489 if (r
== ERROR_SUCCESS
)
492 pfnIsFileSupportedName isMy2
=
493 CRYPT_LoadSIPFuncFromKey(subKey
, &lib
);
497 bRet
= isMy2((LPWSTR
)FileName
, pgSubject
);
503 } while (!bRet
&& r
== ERROR_SUCCESS
);
509 SetLastError(TRUST_E_SUBJECT_FORM_UNKNOWN
);
512 /* If we didn't open this one we shouldn't close it (hFile is a copy),
513 * but we should reset the file pointer to its original position.
518 SetFilePointerEx(hFile
, oldPos
, NULL
, FILE_BEGIN
);
523 static LONG
CRYPT_OpenSIPFunctionKey(const GUID
*guid
, LPCWSTR function
,
526 WCHAR szFullKey
[ 0x100 ];
528 lstrcpyW(szFullKey
, szOID
);
529 lstrcatW(szFullKey
, function
);
530 CRYPT_guid2wstr(guid
, &szFullKey
[lstrlenW(szFullKey
)]);
531 return RegOpenKeyExW(HKEY_LOCAL_MACHINE
, szFullKey
, 0, KEY_READ
, key
);
534 /* Loads the function named function for the SIP specified by pgSubject, and
535 * returns it if found. Returns NULL on error. If the function is loaded,
536 * *pLib is set to the library in which it is found.
538 static void *CRYPT_LoadSIPFunc(const GUID
*pgSubject
, LPCWSTR function
,
545 TRACE("(%s, %s)\n", debugstr_guid(pgSubject
), debugstr_w(function
));
547 r
= CRYPT_OpenSIPFunctionKey(pgSubject
, function
, &key
);
550 func
= CRYPT_LoadSIPFuncFromKey(key
, pLib
);
553 TRACE("returning %p\n", func
);
557 typedef struct _WINE_SIP_PROVIDER
{
559 SIP_DISPATCH_INFO info
;
563 static struct list providers
= { &providers
, &providers
};
564 static CRITICAL_SECTION providers_cs
;
565 static CRITICAL_SECTION_DEBUG providers_cs_debug
=
568 { &providers_cs_debug
.ProcessLocksList
,
569 &providers_cs_debug
.ProcessLocksList
},
570 0, 0, { (DWORD_PTR
)(__FILE__
": providers_cs") }
572 static CRITICAL_SECTION providers_cs
= { &providers_cs_debug
, -1, 0, 0, 0, 0 };
574 static void CRYPT_CacheSIP(const GUID
*pgSubject
, SIP_DISPATCH_INFO
*info
)
576 WINE_SIP_PROVIDER
*prov
= CryptMemAlloc(sizeof(WINE_SIP_PROVIDER
));
580 prov
->subject
= *pgSubject
;
582 EnterCriticalSection(&providers_cs
);
583 list_add_tail(&providers
, &prov
->entry
);
584 LeaveCriticalSection(&providers_cs
);
588 static WINE_SIP_PROVIDER
*CRYPT_GetCachedSIP(const GUID
*pgSubject
)
590 WINE_SIP_PROVIDER
*provider
= NULL
, *ret
= NULL
;
592 EnterCriticalSection(&providers_cs
);
593 LIST_FOR_EACH_ENTRY(provider
, &providers
, WINE_SIP_PROVIDER
, entry
)
595 if (IsEqualGUID(pgSubject
, &provider
->subject
))
598 if (provider
&& IsEqualGUID(pgSubject
, &provider
->subject
))
600 LeaveCriticalSection(&providers_cs
);
604 static inline BOOL
CRYPT_IsSIPCached(const GUID
*pgSubject
)
606 return CRYPT_GetCachedSIP(pgSubject
) != NULL
;
609 void crypt_sip_free(void)
611 WINE_SIP_PROVIDER
*prov
, *next
;
613 LIST_FOR_EACH_ENTRY_SAFE(prov
, next
, &providers
, WINE_SIP_PROVIDER
, entry
)
615 list_remove(&prov
->entry
);
616 FreeLibrary(prov
->info
.hSIP
);
619 DeleteCriticalSection(&providers_cs
);
622 /* Loads the SIP for pgSubject into the global cache. Returns FALSE if the
623 * SIP isn't registered or is invalid.
625 static BOOL
CRYPT_LoadSIP(const GUID
*pgSubject
)
627 SIP_DISPATCH_INFO sip
= { 0 };
628 HMODULE lib
= NULL
, temp
= NULL
;
630 sip
.pfGet
= CRYPT_LoadSIPFunc(pgSubject
, szGetSigned
, &lib
);
633 sip
.pfPut
= CRYPT_LoadSIPFunc(pgSubject
, szPutSigned
, &temp
);
634 if (!sip
.pfPut
|| temp
!= lib
)
637 sip
.pfCreate
= CRYPT_LoadSIPFunc(pgSubject
, szCreate
, &temp
);
638 if (!sip
.pfCreate
|| temp
!= lib
)
641 sip
.pfVerify
= CRYPT_LoadSIPFunc(pgSubject
, szVerify
, &temp
);
642 if (!sip
.pfVerify
|| temp
!= lib
)
645 sip
.pfRemove
= CRYPT_LoadSIPFunc(pgSubject
, szRemoveSigned
, &temp
);
646 if (!sip
.pfRemove
|| temp
!= lib
)
650 CRYPT_CacheSIP(pgSubject
, &sip
);
656 SetLastError(TRUST_E_SUBJECT_FORM_UNKNOWN
);
660 /***********************************************************************
661 * CryptSIPLoad (CRYPT32.@)
663 * Load some internal crypt32 functions into a SIP_DISPATCH_INFO structure.
666 * pgSubject [I] The GUID.
668 * pSipDispatch [I] The loaded functions.
671 * Success: TRUE. pSipDispatch contains the functions.
672 * Failure: FALSE. (Look at GetLastError()).
675 * CryptSIPLoad uses caching for the list of GUIDs and whether a SIP is
678 * An application calls CryptSipLoad which will return a structure with the
679 * function addresses of some internal crypt32 functions. The application will
680 * then call these functions which will be forwarded to the appropriate SIP.
682 * CryptSIPLoad will load the needed SIP but doesn't unload this dll. The unloading
683 * is done when crypt32 is unloaded.
685 BOOL WINAPI CryptSIPLoad
686 (const GUID
*pgSubject
, DWORD dwFlags
, SIP_DISPATCH_INFO
*pSipDispatch
)
688 TRACE("(%s %d %p)\n", debugstr_guid(pgSubject
), dwFlags
, pSipDispatch
);
690 if (!pgSubject
|| dwFlags
!= 0 || !pSipDispatch
)
692 SetLastError(ERROR_INVALID_PARAMETER
);
695 if (!CRYPT_IsSIPCached(pgSubject
) && !CRYPT_LoadSIP(pgSubject
))
698 pSipDispatch
->hSIP
= NULL
;
699 pSipDispatch
->pfGet
= CryptSIPGetSignedDataMsg
;
700 pSipDispatch
->pfPut
= CryptSIPPutSignedDataMsg
;
701 pSipDispatch
->pfCreate
= CryptSIPCreateIndirectData
;
702 pSipDispatch
->pfVerify
= CryptSIPVerifyIndirectData
;
703 pSipDispatch
->pfRemove
= CryptSIPRemoveSignedDataMsg
;
708 /***********************************************************************
709 * CryptSIPCreateIndirectData (CRYPT32.@)
711 BOOL WINAPI
CryptSIPCreateIndirectData(SIP_SUBJECTINFO
* pSubjectInfo
, DWORD
* pcbIndirectData
,
712 SIP_INDIRECT_DATA
* pIndirectData
)
714 WINE_SIP_PROVIDER
*sip
;
717 TRACE("(%p %p %p)\n", pSubjectInfo
, pcbIndirectData
, pIndirectData
);
719 if (!pSubjectInfo
|| !pSubjectInfo
->pgSubjectType
|| !pcbIndirectData
)
721 SetLastError(ERROR_INVALID_PARAMETER
);
724 if ((sip
= CRYPT_GetCachedSIP(pSubjectInfo
->pgSubjectType
)))
725 ret
= sip
->info
.pfCreate(pSubjectInfo
, pcbIndirectData
, pIndirectData
);
726 TRACE("returning %d\n", ret
);
730 /***********************************************************************
731 * CryptSIPGetSignedDataMsg (CRYPT32.@)
733 BOOL WINAPI
CryptSIPGetSignedDataMsg(SIP_SUBJECTINFO
* pSubjectInfo
, DWORD
* pdwEncodingType
,
734 DWORD dwIndex
, DWORD
* pcbSignedDataMsg
, BYTE
* pbSignedDataMsg
)
736 WINE_SIP_PROVIDER
*sip
;
739 TRACE("(%p %p %d %p %p)\n", pSubjectInfo
, pdwEncodingType
, dwIndex
,
740 pcbSignedDataMsg
, pbSignedDataMsg
);
742 if ((sip
= CRYPT_GetCachedSIP(pSubjectInfo
->pgSubjectType
)))
743 ret
= sip
->info
.pfGet(pSubjectInfo
, pdwEncodingType
, dwIndex
,
744 pcbSignedDataMsg
, pbSignedDataMsg
);
745 TRACE("returning %d\n", ret
);
749 /***********************************************************************
750 * CryptSIPPutSignedDataMsg (CRYPT32.@)
752 BOOL WINAPI
CryptSIPPutSignedDataMsg(SIP_SUBJECTINFO
* pSubjectInfo
, DWORD pdwEncodingType
,
753 DWORD
* pdwIndex
, DWORD cbSignedDataMsg
, BYTE
* pbSignedDataMsg
)
755 WINE_SIP_PROVIDER
*sip
;
758 TRACE("(%p %d %p %d %p)\n", pSubjectInfo
, pdwEncodingType
, pdwIndex
,
759 cbSignedDataMsg
, pbSignedDataMsg
);
761 if ((sip
= CRYPT_GetCachedSIP(pSubjectInfo
->pgSubjectType
)))
762 ret
= sip
->info
.pfPut(pSubjectInfo
, pdwEncodingType
, pdwIndex
,
763 cbSignedDataMsg
, pbSignedDataMsg
);
764 TRACE("returning %d\n", ret
);
768 /***********************************************************************
769 * CryptSIPRemoveSignedDataMsg (CRYPT32.@)
771 BOOL WINAPI
CryptSIPRemoveSignedDataMsg(SIP_SUBJECTINFO
* pSubjectInfo
,
774 WINE_SIP_PROVIDER
*sip
;
777 TRACE("(%p %d)\n", pSubjectInfo
, dwIndex
);
779 if ((sip
= CRYPT_GetCachedSIP(pSubjectInfo
->pgSubjectType
)))
780 ret
= sip
->info
.pfRemove(pSubjectInfo
, dwIndex
);
781 TRACE("returning %d\n", ret
);
785 /***********************************************************************
786 * CryptSIPVerifyIndirectData (CRYPT32.@)
788 BOOL WINAPI
CryptSIPVerifyIndirectData(SIP_SUBJECTINFO
* pSubjectInfo
,
789 SIP_INDIRECT_DATA
* pIndirectData
)
791 WINE_SIP_PROVIDER
*sip
;
794 TRACE("(%p %p)\n", pSubjectInfo
, pIndirectData
);
796 if ((sip
= CRYPT_GetCachedSIP(pSubjectInfo
->pgSubjectType
)))
797 ret
= sip
->info
.pfVerify(pSubjectInfo
, pIndirectData
);
798 TRACE("returning %d\n", ret
);