crypt32: Add OCSP stubs.

Philippe Groarke philippe.groarke at gmail.com
Sat Aug 8 10:57:13 CDT 2015


This is my first attempt at adding stubs to wine. I needed them while I
was debugging another application. This can be useful to identify
problems/crashes in applications that need OCSP. I tried to follow the
stub guide and other examples throughout the code as thoroughly as
possible.
---
 dlls/crypt32/cert.c       | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 dlls/crypt32/crypt32.spec |  6 ++++++
 include/wincrypt.h        | 24 ++++++++++++++++++++++++
 3 files changed, 76 insertions(+)

diff --git a/dlls/crypt32/cert.c b/dlls/crypt32/cert.c
index ba804e0..d0c36f0 100644
--- a/dlls/crypt32/cert.c
+++ b/dlls/crypt32/cert.c
@@ -3461,3 +3461,49 @@ const void * WINAPI CertCreateContext(DWORD dwContextType, DWORD dwEncodingType,
         return NULL;
     }
 }
+
+/* OCSP functions */
+void WINAPI CertAddRefServerOcspResponse(
+ HCERT_SERVER_OCSP_RESPONSE hServerOcspResponse)
+{
+    FIXME("(%p): stub\n", hServerOcspResponse);
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+}
+
+void WINAPI CertAddRefServerOcspResponseContext(
+ PCCERT_SERVER_OCSP_RESPONSE_CONTEXT pServerOcspResponseContext)
+{
+    FIXME("(%p): stub\n", pServerOcspResponseContext);
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+}
+
+void WINAPI CertCloseServerOcspResponse(
+ HCERT_SERVER_OCSP_RESPONSE hServerOcspResponse, DWORD dwFlags)
+{
+    FIXME("(%p, %d): stub\n", hServerOcspResponse, dwFlags);
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+}
+
+void WINAPI CertFreeServerOcspResponseContext(
+ PCCERT_SERVER_OCSP_RESPONSE_CONTEXT pServerOcspResponseContext)
+{
+    FIXME("(%p): stub\n", pServerOcspResponseContext);
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+}
+
+PCCERT_SERVER_OCSP_RESPONSE_CONTEXT WINAPI CertGetServerOcspResponseContext(
+ HCERT_SERVER_OCSP_RESPONSE hServerOcspResponse, DWORD dwFlags, 
+ LPVOID pvReserved)
+{
+    FIXME("(%p, %d, %p): stub\n", hServerOcspResponse, dwFlags, pvReserved);
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return NULL;
+}
+
+HCERT_SERVER_OCSP_RESPONSE WINAPI CertOpenServerOcspResponse(
+ PCCERT_CHAIN_CONTEXT pChainContext, DWORD dwFlags, LPVOID pvReserved)
+{
+    FIXME("(%p, %d, %p): stub\n", pChainContext, dwFlags, pvReserved);
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return NULL;
+}
diff --git a/dlls/crypt32/crypt32.spec b/dlls/crypt32/crypt32.spec
index e639d7c..b21dcff 100644
--- a/dlls/crypt32/crypt32.spec
+++ b/dlls/crypt32/crypt32.spec
@@ -237,3 +237,9 @@
 @ stub RegQueryInfoKeyU
 @ stub RegQueryValueExU
 @ stub RegSetValueExU
+@ stdcall CertAddRefServerOcspResponse(ptr)
+@ stdcall CertAddRefServerOcspResponseContext(ptr);
+@ stdcall CertCloseServerOcspResponse(ptr long);
+@ stdcall CertFreeServerOcspResponseContext(ptr);
+@ stdcall CertGetServerOcspResponseContext(ptr long ptr);
+@ stdcall CertOpenServerOcspResponse(ptr long ptr);
diff --git a/include/wincrypt.h b/include/wincrypt.h
index 55c9509..40fe302 100644
--- a/include/wincrypt.h
+++ b/include/wincrypt.h
@@ -3905,6 +3905,15 @@ typedef BOOL (WINAPI *PFN_CMSG_IMPORT_KEY_TRANS)(
 #define EXPORT_PRIVATE_KEYS                   0x00000004
 #define PKCS12_EXPORT_RESERVED_MASK           0xffff0000
 
+typedef void *HCERT_SERVER_OCSP_RESPONSE;
+
+typedef struct _CERT_SERVER_OCSP_RESPONSE_CONTEXT {
+    DWORD                          cbSize;
+    BYTE                          *pbEncodedOcspResponse;
+    DWORD                          cbEncodedOcspResponse;
+} CERT_SERVER_OCSP_RESPONSE_CONTEXT, *PCERT_SERVER_OCSP_RESPONSE_CONTEXT, 
+  *PCCERT_SERVER_OCSP_RESPONSE_CONTEXT;
+
 #define CRYPT_USERDATA    0x00000001
 
 /* function declarations */
@@ -4556,6 +4565,21 @@ BOOL WINAPI PFXExportCertStore(HCERTSTORE hStore, CRYPT_DATA_BLOB *pPFX,
 BOOL WINAPI PFXVerifyPassword(CRYPT_DATA_BLOB *pPFX, LPCWSTR szPassword,
  DWORD dwFlags);
 
+/* OCSP functions */
+VOID WINAPI CertAddRefServerOcspResponse(
+ HCERT_SERVER_OCSP_RESPONSE hServerOcspResponse);
+VOID WINAPI CertAddRefServerOcspResponseContext(
+ PCCERT_SERVER_OCSP_RESPONSE_CONTEXT pServerOcspResponseContext);
+VOID WINAPI CertCloseServerOcspResponse(
+ HCERT_SERVER_OCSP_RESPONSE hServerOcspResponse, DWORD dwFlags);
+VOID WINAPI CertFreeServerOcspResponseContext(
+ PCCERT_SERVER_OCSP_RESPONSE_CONTEXT pServerOcspResponseContext);
+PCCERT_SERVER_OCSP_RESPONSE_CONTEXT WINAPI CertGetServerOcspResponseContext(
+ HCERT_SERVER_OCSP_RESPONSE hServerOcspResponse, DWORD dwFlags, 
+ LPVOID pvReserved);
+HCERT_SERVER_OCSP_RESPONSE WINAPI CertOpenServerOcspResponse(
+ PCCERT_CHAIN_CONTEXT pChainContext, DWORD dwFlags, LPVOID pvReserved);
+
 /* cryptnet.dll functions */
 BOOL WINAPI CryptCancelAsyncRetrieval(HCRYPTASYNC hAsyncRetrieval);
 
-- 
2.4.5




More information about the wine-patches mailing list