ReactOS  0.4.15-dev-506-ga3ec01c
cryptnet_main.c File Reference
#include <stdio.h>
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winnt.h"
#include "winnls.h"
#include "wininet.h"
#include "objbase.h"
#include "wincrypt.h"
#include "wine/debug.h"
Include dependency graph for cryptnet_main.c:

Go to the source code of this file.

Classes

struct  InetContext
 
struct  _CERT_REVOCATION_PARA_NO_EXTRA_FIELDS
 
struct  _OLD_CERT_REVOCATION_STATUS
 

Macros

#define NONAMELESSUNION
 
#define CERT_REVOCATION_PARA_HAS_EXTRA_FIELDS
 
#define IS_INTOID(x)   (((ULONG_PTR)(x) >> 16) == 0)
 
#define _x(oid)   case LOWORD(oid): return #oid
 

Typedefs

typedef BOOL(WINAPIUrlDllGetObjectUrlFunc) (LPCSTR, LPVOID, DWORD, PCRYPT_URL_ARRAY, DWORD *, PCRYPT_URL_INFO, DWORD *, LPVOID)
 
typedef BOOL(WINAPISchemeDllRetrieveEncodedObjectW) (LPCWSTR pwszUrl, LPCSTR pszObjectOid, DWORD dwRetrievalFlags, DWORD dwTimeout, PCRYPT_BLOB_ARRAY pObject, PFN_FREE_ENCODED_OBJECT_FUNC *ppfnFreeObject, void **ppvFreeContext, HCRYPTASYNC hAsyncRetrieve, PCRYPT_CREDENTIALS pCredentials, PCRYPT_RETRIEVE_AUX_INFO pAuxInfo)
 
typedef BOOL(WINAPIAddContextToStore) (HCERTSTORE hCertStore, const void *pContext, DWORD dwAddDisposition, const void **ppStoreContext)
 
typedef BOOL(WINAPIContextDllCreateObjectContext) (LPCSTR pszObjectOid, DWORD dwRetrievalFlags, const CRYPT_BLOB_ARRAY *pObject, void **ppvContext)
 
typedef struct _CERT_REVOCATION_PARA_NO_EXTRA_FIELDS CERT_REVOCATION_PARA_NO_EXTRA_FIELDS
 
typedef struct _OLD_CERT_REVOCATION_STATUS OLD_CERT_REVOCATION_STATUS
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (cryptnet)
 
HRESULT WINAPI DllRegisterServer (void)
 
HRESULT WINAPI DllUnregisterServer (void)
 
static const charurl_oid_to_str (LPCSTR oid)
 
static BOOL WINAPI CRYPT_GetUrlFromCertificateIssuer (LPCSTR pszUrlOid, LPVOID pvPara, DWORD dwFlags, PCRYPT_URL_ARRAY pUrlArray, DWORD *pcbUrlArray, PCRYPT_URL_INFO pUrlInfo, DWORD *pcbUrlInfo, LPVOID pvReserved)
 
static BOOL CRYPT_GetUrlFromCRLDistPointsExt (const CRYPT_DATA_BLOB *value, PCRYPT_URL_ARRAY pUrlArray, DWORD *pcbUrlArray, PCRYPT_URL_INFO pUrlInfo, DWORD *pcbUrlInfo)
 
static BOOL WINAPI CRYPT_GetUrlFromCertificateCRLDistPoint (LPCSTR pszUrlOid, LPVOID pvPara, DWORD dwFlags, PCRYPT_URL_ARRAY pUrlArray, DWORD *pcbUrlArray, PCRYPT_URL_INFO pUrlInfo, DWORD *pcbUrlInfo, LPVOID pvReserved)
 
BOOL WINAPI CryptGetObjectUrl (LPCSTR pszUrlOid, LPVOID pvPara, DWORD dwFlags, PCRYPT_URL_ARRAY pUrlArray, DWORD *pcbUrlArray, PCRYPT_URL_INFO pUrlInfo, DWORD *pcbUrlInfo, LPVOID pvReserved)
 
BOOL WINAPI CryptRetrieveObjectByUrlA (LPCSTR pszURL, LPCSTR pszObjectOid, DWORD dwRetrievalFlags, DWORD dwTimeout, LPVOID *ppvObject, HCRYPTASYNC hAsyncRetrieve, PCRYPT_CREDENTIALS pCredentials, LPVOID pvVerify, PCRYPT_RETRIEVE_AUX_INFO pAuxInfo)
 
static void WINAPI CRYPT_FreeBlob (LPCSTR pszObjectOid, PCRYPT_BLOB_ARRAY pObject, void *pvFreeContext)
 
static BOOL CRYPT_GetObjectFromFile (HANDLE hFile, PCRYPT_BLOB_ARRAY pObject)
 
static BOOL CRYPT_GetObjectFromCache (LPCWSTR pszURL, PCRYPT_BLOB_ARRAY pObject, PCRYPT_RETRIEVE_AUX_INFO pAuxInfo)
 
static BOOL CRYPT_CrackUrl (LPCWSTR pszURL, URL_COMPONENTSW *components)
 
static struct InetContextCRYPT_MakeInetContext (DWORD dwTimeout)
 
static BOOL CRYPT_DownloadObject (DWORD dwRetrievalFlags, HINTERNET hHttp, struct InetContext *context, PCRYPT_BLOB_ARRAY pObject, PCRYPT_RETRIEVE_AUX_INFO pAuxInfo)
 
static void CRYPT_CacheURL (LPCWSTR pszURL, const CRYPT_BLOB_ARRAY *pObject, DWORD dwRetrievalFlags, FILETIME expires)
 
static void CALLBACK CRYPT_InetStatusCallback (HINTERNET hInt, DWORD_PTR dwContext, DWORD status, void *statusInfo, DWORD statusInfoLen)
 
static BOOL CRYPT_Connect (const URL_COMPONENTSW *components, struct InetContext *context, PCRYPT_CREDENTIALS pCredentials, HINTERNET *phInt, HINTERNET *phHost)
 
static BOOL WINAPI FTP_RetrieveEncodedObjectW (LPCWSTR pszURL, LPCSTR pszObjectOid, DWORD dwRetrievalFlags, DWORD dwTimeout, PCRYPT_BLOB_ARRAY pObject, PFN_FREE_ENCODED_OBJECT_FUNC *ppfnFreeObject, void **ppvFreeContext, HCRYPTASYNC hAsyncRetrieve, PCRYPT_CREDENTIALS pCredentials, PCRYPT_RETRIEVE_AUX_INFO pAuxInfo)
 
static BOOL WINAPI HTTP_RetrieveEncodedObjectW (LPCWSTR pszURL, LPCSTR pszObjectOid, DWORD dwRetrievalFlags, DWORD dwTimeout, PCRYPT_BLOB_ARRAY pObject, PFN_FREE_ENCODED_OBJECT_FUNC *ppfnFreeObject, void **ppvFreeContext, HCRYPTASYNC hAsyncRetrieve, PCRYPT_CREDENTIALS pCredentials, PCRYPT_RETRIEVE_AUX_INFO pAuxInfo)
 
static BOOL WINAPI File_RetrieveEncodedObjectW (LPCWSTR pszURL, LPCSTR pszObjectOid, DWORD dwRetrievalFlags, DWORD dwTimeout, PCRYPT_BLOB_ARRAY pObject, PFN_FREE_ENCODED_OBJECT_FUNC *ppfnFreeObject, void **ppvFreeContext, HCRYPTASYNC hAsyncRetrieve, PCRYPT_CREDENTIALS pCredentials, PCRYPT_RETRIEVE_AUX_INFO pAuxInfo)
 
static BOOL CRYPT_GetRetrieveFunction (LPCWSTR pszURL, SchemeDllRetrieveEncodedObjectW *pFunc, HCRYPTOIDFUNCADDR *phFunc)
 
static BOOL WINAPI CRYPT_CreateBlob (LPCSTR pszObjectOid, DWORD dwRetrievalFlags, const CRYPT_BLOB_ARRAY *pObject, void **ppvContext)
 
static BOOL decode_base64_blob (const CRYPT_DATA_BLOB *in, CRYPT_DATA_BLOB *out)
 
static BOOL CRYPT_CreateContext (const CRYPT_BLOB_ARRAY *pObject, DWORD dwExpectedContentTypeFlags, AddContextToStore addFunc, void **ppvContext)
 
static BOOL WINAPI CRYPT_CreateCert (LPCSTR pszObjectOid, DWORD dwRetrievalFlags, const CRYPT_BLOB_ARRAY *pObject, void **ppvContext)
 
static BOOL WINAPI CRYPT_CreateCRL (LPCSTR pszObjectOid, DWORD dwRetrievalFlags, const CRYPT_BLOB_ARRAY *pObject, void **ppvContext)
 
static BOOL WINAPI CRYPT_CreateCTL (LPCSTR pszObjectOid, DWORD dwRetrievalFlags, const CRYPT_BLOB_ARRAY *pObject, void **ppvContext)
 
static BOOL WINAPI CRYPT_CreatePKCS7 (LPCSTR pszObjectOid, DWORD dwRetrievalFlags, const CRYPT_BLOB_ARRAY *pObject, void **ppvContext)
 
static BOOL WINAPI CRYPT_CreateAny (LPCSTR pszObjectOid, DWORD dwRetrievalFlags, const CRYPT_BLOB_ARRAY *pObject, void **ppvContext)
 
static BOOL CRYPT_GetCreateFunction (LPCSTR pszObjectOid, ContextDllCreateObjectContext *pFunc, HCRYPTOIDFUNCADDR *phFunc)
 
static BOOL CRYPT_GetExpiration (const void *object, const char *pszObjectOid, FILETIME *expiration)
 
BOOL WINAPI CryptRetrieveObjectByUrlW (LPCWSTR pszURL, LPCSTR pszObjectOid, DWORD dwRetrievalFlags, DWORD dwTimeout, LPVOID *ppvObject, HCRYPTASYNC hAsyncRetrieve, PCRYPT_CREDENTIALS pCredentials, LPVOID pvVerify, PCRYPT_RETRIEVE_AUX_INFO pAuxInfo)
 
static DWORD verify_cert_revocation_with_crl_online (PCCERT_CONTEXT cert, PCCRL_CONTEXT crl, DWORD index, FILETIME *pTime, PCERT_REVOCATION_STATUS pRevStatus)
 
static DWORD verify_cert_revocation_from_dist_points_ext (const CRYPT_DATA_BLOB *value, PCCERT_CONTEXT cert, DWORD index, FILETIME *pTime, DWORD dwFlags, const CERT_REVOCATION_PARA *pRevPara, PCERT_REVOCATION_STATUS pRevStatus)
 
static DWORD verify_cert_revocation_from_aia_ext (const CRYPT_DATA_BLOB *value, PCCERT_CONTEXT cert, DWORD index, FILETIME *pTime, DWORD dwFlags, PCERT_REVOCATION_PARA pRevPara, PCERT_REVOCATION_STATUS pRevStatus)
 
static DWORD verify_cert_revocation_with_crl_offline (PCCERT_CONTEXT cert, PCCRL_CONTEXT crl, DWORD index, FILETIME *pTime, PCERT_REVOCATION_STATUS pRevStatus)
 
static DWORD verify_cert_revocation (PCCERT_CONTEXT cert, DWORD index, FILETIME *pTime, DWORD dwFlags, PCERT_REVOCATION_PARA pRevPara, PCERT_REVOCATION_STATUS pRevStatus)
 
BOOL WINAPI CertDllVerifyRevocation (DWORD dwEncodingType, DWORD dwRevType, DWORD cContext, PVOID rgpvContext[], DWORD dwFlags, PCERT_REVOCATION_PARA pRevPara, PCERT_REVOCATION_STATUS pRevStatus)
 

Variables

static const WCHAR cryptNet []
 
static const WCHAR x509cacert []
 
static const WCHAR x509emailcert []
 
static const WCHAR x509servercert []
 
static const WCHAR x509usercert []
 
static const WCHAR pkcs7cert []
 
static const WCHAR pkixCRL []
 
static const WCHAR pkcs7CRL []
 
static const WCHAR pkcs7sig []
 
static const WCHAR pkcs7mime []
 

Macro Definition Documentation

◆ _x

#define _x (   oid)    case LOWORD(oid): return #oid

◆ CERT_REVOCATION_PARA_HAS_EXTRA_FIELDS

#define CERT_REVOCATION_PARA_HAS_EXTRA_FIELDS

Definition at line 22 of file cryptnet_main.c.

◆ IS_INTOID

#define IS_INTOID (   x)    (((ULONG_PTR)(x) >> 16) == 0)

Definition at line 39 of file cryptnet_main.c.

◆ NONAMELESSUNION

#define NONAMELESSUNION

Definition at line 21 of file cryptnet_main.c.

Typedef Documentation

◆ AddContextToStore

typedef BOOL(WINAPI * AddContextToStore) (HCERTSTORE hCertStore, const void *pContext, DWORD dwAddDisposition, const void **ppStoreContext)

Definition at line 1184 of file cryptnet_main.c.

◆ CERT_REVOCATION_PARA_NO_EXTRA_FIELDS

◆ ContextDllCreateObjectContext

typedef BOOL(WINAPI * ContextDllCreateObjectContext) (LPCSTR pszObjectOid, DWORD dwRetrievalFlags, const CRYPT_BLOB_ARRAY *pObject, void **ppvContext)

Definition at line 1416 of file cryptnet_main.c.

◆ OLD_CERT_REVOCATION_STATUS

◆ SchemeDllRetrieveEncodedObjectW

Definition at line 1077 of file cryptnet_main.c.

◆ UrlDllGetObjectUrlFunc

typedef BOOL(WINAPI * UrlDllGetObjectUrlFunc) (LPCSTR, LPVOID, DWORD, PCRYPT_URL_ARRAY, DWORD *, PCRYPT_URL_INFO, DWORD *, LPVOID)

Definition at line 100 of file cryptnet_main.c.

Function Documentation

◆ CertDllVerifyRevocation()

BOOL WINAPI CertDllVerifyRevocation ( DWORD  dwEncodingType,
DWORD  dwRevType,
DWORD  cContext,
PVOID  rgpvContext[],
DWORD  dwFlags,
PCERT_REVOCATION_PARA  pRevPara,
PCERT_REVOCATION_STATUS  pRevStatus 
)

Definition at line 1825 of file cryptnet_main.c.

1828 {
1829  DWORD error = 0, i;
1830  FILETIME now;
1831  LPFILETIME pTime = NULL;
1832 
1833  TRACE("(%08x, %d, %d, %p, %08x, %p, %p)\n", dwEncodingType, dwRevType,
1834  cContext, rgpvContext, dwFlags, pRevPara, pRevStatus);
1835 
1836  if (pRevStatus->cbSize != sizeof(OLD_CERT_REVOCATION_STATUS) &&
1837  pRevStatus->cbSize != sizeof(CERT_REVOCATION_STATUS))
1838  {
1840  return FALSE;
1841  }
1842  if (!cContext)
1843  {
1845  return FALSE;
1846  }
1847  if (pRevPara && pRevPara->cbSize >=
1849  pTime = pRevPara->pftTimeToUse;
1850  if (!pTime)
1851  {
1853  pTime = &now;
1854  }
1855  memset(&pRevStatus->dwIndex, 0, pRevStatus->cbSize - sizeof(DWORD));
1856  if (dwRevType != CERT_CONTEXT_REVOCATION_TYPE)
1858  else
1859  {
1860  for (i = 0; !error && i < cContext; i++)
1861  error = verify_cert_revocation(rgpvContext[i], i, pTime, dwFlags,
1862  pRevPara, pRevStatus);
1863  }
1864  if (error)
1865  {
1867  pRevStatus->dwError = error;
1868  }
1869  TRACE("returning %d (%08x)\n", !error, error);
1870  return !error;
1871 }
VOID WINAPI GetSystemTimeAsFileTime(OUT PFILETIME lpFileTime)
Definition: time.c:128
#define error(str)
Definition: mkdosfs.c:1605
LPFILETIME pftTimeToUse
Definition: wincrypt.h:808
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
_In_ DWORD dwEncodingType
Definition: wincrypt.h:4625
time_t now
Definition: finger.c:65
#define CERT_CONTEXT_REVOCATION_TYPE
Definition: wincrypt.h:818
_In_ PCCERT_CONTEXT _In_opt_ LPFILETIME pTime
Definition: wincrypt.h:4836
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
static DWORD verify_cert_revocation(PCCERT_CONTEXT cert, DWORD index, FILETIME *pTime, DWORD dwFlags, PCERT_REVOCATION_PARA pRevPara, PCERT_REVOCATION_STATUS pRevStatus)
#define TRACE(s)
Definition: solgame.cpp:4
#define CRYPT_E_NO_REVOCATION_CHECK
Definition: winerror.h:3021
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:418
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define memset(x, y, z)
Definition: compat.h:39

◆ CRYPT_CacheURL()

static void CRYPT_CacheURL ( LPCWSTR  pszURL,
const CRYPT_BLOB_ARRAY pObject,
DWORD  dwRetrievalFlags,
FILETIME  expires 
)
static

Definition at line 712 of file cryptnet_main.c.

714 {
715  WCHAR cacheFileName[MAX_PATH];
716  HANDLE hCacheFile;
717  DWORD size = 0, entryType;
718  FILETIME ft;
719 
720  GetUrlCacheEntryInfoW(pszURL, NULL, &size);
722  {
724 
725  if (!info)
726  {
727  ERR("out of memory\n");
728  return;
729  }
730 
731  if (GetUrlCacheEntryInfoW(pszURL, info, &size))
732  {
733  lstrcpyW(cacheFileName, info->lpszLocalFileName);
734  /* Check if the existing cache entry is up to date. If it isn't,
735  * remove the existing cache entry, and create a new one with the
736  * new value.
737  */
739  if (CompareFileTime(&info->ExpireTime, &ft) < 0)
740  {
741  DeleteUrlCacheEntryW(pszURL);
742  }
743  else
744  {
745  info->ExpireTime = expires;
748  return;
749  }
750  }
752  }
753 
754  if (!CreateUrlCacheEntryW(pszURL, pObject->rgBlob[0].cbData, NULL, cacheFileName, 0))
755  return;
756 
757  hCacheFile = CreateFileW(cacheFileName, GENERIC_WRITE, 0,
759  if(hCacheFile == INVALID_HANDLE_VALUE)
760  return;
761 
762  WriteFile(hCacheFile, pObject->rgBlob[0].pbData,
763  pObject->rgBlob[0].cbData, &size, NULL);
764  CloseHandle(hCacheFile);
765 
767  entryType = NORMAL_CACHE_ENTRY;
768  else
769  entryType = STICKY_CACHE_ENTRY;
770  memset(&ft, 0, sizeof(ft));
771  CommitUrlCacheEntryW(pszURL, cacheFileName, expires, ft, entryType,
772  NULL, 0, NULL, NULL);
773 }
BOOL WINAPI CreateUrlCacheEntryW(LPCWSTR lpszUrlName, DWORD dwExpectedFileSize, LPCWSTR lpszFileExtension, LPWSTR lpszFileName, DWORD dwReserved)
Definition: urlcache.c:2827
#define CACHE_ENTRY_EXPTIME_FC
Definition: wininet.h:2296
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
VOID WINAPI GetSystemTimeAsFileTime(OUT PFILETIME lpFileTime)
Definition: time.c:128
#define CloseHandle
Definition: compat.h:407
#define INVALID_HANDLE_VALUE
Definition: compat.h:400
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
LPVOID WINAPI CryptMemAlloc(ULONG cbSize)
Definition: main.c:131
PCRYPT_DATA_BLOB rgBlob
Definition: wincrypt.h:1569
#define STICKY_CACHE_ENTRY
Definition: wininet.h:2088
#define GENERIC_WRITE
Definition: nt_native.h:90
smooth NULL
Definition: ftsmooth.c:416
#define OPEN_EXISTING
Definition: compat.h:435
#define NORMAL_CACHE_ENTRY
Definition: wininet.h:2087
GLsizeiptr size
Definition: glext.h:5919
LONG WINAPI CompareFileTime(IN CONST FILETIME *lpFileTime1, IN CONST FILETIME *lpFileTime2)
Definition: time.c:106
BOOL WINAPI CommitUrlCacheEntryW(LPCWSTR lpszUrlName, LPCWSTR lpszLocalFileName, FILETIME ExpireTime, FILETIME LastModifiedTime, DWORD CacheEntryType, LPWSTR lpHeaderInfo, DWORD dwHeaderSize, LPCWSTR lpszFileExtension, LPCWSTR lpszOriginalUrl)
Definition: urlcache.c:3097
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL WINAPI GetUrlCacheEntryInfoW(LPCWSTR lpszUrl, LPINTERNET_CACHE_ENTRY_INFOW lpCacheEntryInfo, LPDWORD lpdwCacheEntryInfoBufferSize)
Definition: urlcache.c:2022
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
BYTE * pbData
Definition: wincrypt.h:103
#define CRYPT_STICKY_CACHE_RETRIEVAL
Definition: wincrypt.h:1638
#define ERR(fmt,...)
Definition: debug.h:110
#define lstrcpyW
Definition: compat.h:415
_In_opt_ LPCSTR _In_ DWORD dwRetrievalFlags
Definition: wincrypt.h:6114
#define CreateFileW
Definition: compat.h:409
VOID WINAPI CryptMemFree(LPVOID pv)
Definition: main.c:141
BOOL WINAPI SetUrlCacheEntryInfoW(LPCWSTR lpszUrl, LPINTERNET_CACHE_ENTRY_INFOW lpCacheEntryInfo, DWORD dwFieldControl)
Definition: urlcache.c:2089
#define memset(x, y, z)
Definition: compat.h:39
BOOL WINAPI DeleteUrlCacheEntryW(LPCWSTR lpszUrlName)
Definition: urlcache.c:3356
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
Definition: wininet.h:2127

Referenced by CryptRetrieveObjectByUrlW(), and HTTP_RetrieveEncodedObjectW().

◆ CRYPT_Connect()

static BOOL CRYPT_Connect ( const URL_COMPONENTSW components,
struct InetContext context,
PCRYPT_CREDENTIALS  pCredentials,
HINTERNET phInt,
HINTERNET phHost 
)
static

Definition at line 790 of file cryptnet_main.c.

793 {
794  BOOL ret;
795 
796  TRACE("(%s:%d, %p, %p, %p, %p)\n", debugstr_w(components->lpszHostName),
797  components->nPort, context, pCredentials, phInt, phInt);
798 
799  *phHost = NULL;
802  if (*phInt)
803  {
804  DWORD service;
805 
806  if (context)
808  switch (components->nScheme)
809  {
810  case INTERNET_SCHEME_FTP:
811  service = INTERNET_SERVICE_FTP;
812  break;
814  service = INTERNET_SERVICE_HTTP;
815  break;
816  default:
817  service = 0;
818  }
819  /* FIXME: use pCredentials for username/password */
820  *phHost = InternetConnectW(*phInt, components->lpszHostName,
821  components->nPort, NULL, NULL, service, 0, (DWORD_PTR)context);
822  if (!*phHost)
823  {
824  InternetCloseHandle(*phInt);
825  *phInt = NULL;
826  ret = FALSE;
827  }
828  else
829  ret = TRUE;
830  }
831  else
832  ret = FALSE;
833  TRACE("returning %d\n", ret);
834  return ret;
835 }
#define TRUE
Definition: types.h:120
Definition: http.c:7094
BOOL WINAPI InternetCloseHandle(HINTERNET hInternet)
Definition: internet.c:1436
unsigned int BOOL
Definition: ntddk_ex.h:94
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
INTERNET_STATUS_CALLBACK WINAPI InternetSetStatusCallbackW(HINTERNET hInternet, INTERNET_STATUS_CALLBACK lpfnIntCB)
Definition: internet.c:2097
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD _Outptr_opt_ void _In_opt_ PCRYPT_CREDENTIALS pCredentials
Definition: wincrypt.h:6077
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLenum GLuint components
Definition: glext.h:9620
#define INTERNET_FLAG_ASYNC
Definition: wininet.h:64
int ret
#define INTERNET_SERVICE_FTP
Definition: wininet.h:560
static void CALLBACK CRYPT_InetStatusCallback(HINTERNET hInt, DWORD_PTR dwContext, DWORD status, void *statusInfo, DWORD statusInfoLen)
uint32_t DWORD_PTR
Definition: typedefs.h:64
#define INTERNET_OPEN_TYPE_PRECONFIG
Definition: wininet.h:521
HINTERNET WINAPI InternetConnectW(HINTERNET hInternet, LPCWSTR lpszServerName, INTERNET_PORT nServerPort, LPCWSTR lpszUserName, LPCWSTR lpszPassword, DWORD dwService, DWORD dwFlags, DWORD_PTR dwContext)
Definition: internet.c:1280
HINTERNET WINAPI InternetOpenW(LPCWSTR lpszAgent, DWORD dwAccessType, LPCWSTR lpszProxy, LPCWSTR lpszProxyBypass, DWORD dwFlags)
Definition: internet.c:1001
#define INTERNET_SERVICE_HTTP
Definition: wininet.h:562

Referenced by HTTP_RetrieveEncodedObjectW().

◆ CRYPT_CrackUrl()

static BOOL CRYPT_CrackUrl ( LPCWSTR  pszURL,
URL_COMPONENTSW components 
)
static

Definition at line 558 of file cryptnet_main.c.

559 {
560  BOOL ret;
561 
562  TRACE("(%s, %p)\n", debugstr_w(pszURL), components);
563 
564  memset(components, 0, sizeof(*components));
565  components->dwStructSize = sizeof(*components);
566  components->lpszHostName = CryptMemAlloc(INTERNET_MAX_HOST_NAME_LENGTH * sizeof(WCHAR));
567  components->dwHostNameLength = INTERNET_MAX_HOST_NAME_LENGTH;
568  if (!components->lpszHostName)
569  {
571  return FALSE;
572  }
573  components->lpszUrlPath = CryptMemAlloc(INTERNET_MAX_PATH_LENGTH * sizeof(WCHAR));
574  components->dwUrlPathLength = INTERNET_MAX_PATH_LENGTH;
575  if (!components->lpszUrlPath)
576  {
577  CryptMemFree(components->lpszHostName);
579  return FALSE;
580  }
581 
583  if (ret)
584  {
585  switch (components->nScheme)
586  {
587  case INTERNET_SCHEME_FTP:
588  if (!components->nPort)
590  break;
592  if (!components->nPort)
594  break;
595  default:
596  ; /* do nothing */
597  }
598  }
599  TRACE("returning %d\n", ret);
600  return ret;
601 }
#define INTERNET_DEFAULT_HTTP_PORT
Definition: winhttp.h:36
LPVOID WINAPI CryptMemAlloc(ULONG cbSize)
Definition: main.c:131
unsigned int BOOL
Definition: ntddk_ex.h:94
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define SetLastError(x)
Definition: compat.h:418
#define INTERNET_DEFAULT_FTP_PORT
Definition: wininet.h:38
GLenum GLenum GLuint components
Definition: glext.h:9620
int ret
#define INTERNET_MAX_PATH_LENGTH
Definition: wininet.h:49
VOID WINAPI CryptMemFree(LPVOID pv)
Definition: main.c:141
BOOL WINAPI InternetCrackUrlW(const WCHAR *lpszUrl, DWORD dwUrlLength, DWORD dwFlags, URL_COMPONENTSW *lpUC)
Definition: internet.c:1644
#define ICU_DECODE
Definition: winhttp.h:291
#define memset(x, y, z)
Definition: compat.h:39
#define INTERNET_MAX_HOST_NAME_LENGTH
Definition: wininet.h:44
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13

Referenced by HTTP_RetrieveEncodedObjectW().

◆ CRYPT_CreateAny()

static BOOL WINAPI CRYPT_CreateAny ( LPCSTR  pszObjectOid,
DWORD  dwRetrievalFlags,
const CRYPT_BLOB_ARRAY pObject,
void **  ppvContext 
)
static

Definition at line 1326 of file cryptnet_main.c.

1328 {
1329  BOOL ret;
1330 
1331  if (!pObject->cBlob)
1332  {
1334  *ppvContext = NULL;
1335  ret = FALSE;
1336  }
1337  else
1338  {
1341 
1342  if (store)
1343  {
1346 
1347  if (memStore)
1348  {
1349  CertAddStoreToCollection(store, memStore,
1351  CertCloseStore(memStore, 0);
1352  }
1353  else
1354  {
1355  CertCloseStore(store, 0);
1356  store = NULL;
1357  }
1358  }
1359  if (store)
1360  {
1361  DWORD i;
1362 
1363  ret = TRUE;
1364  for (i = 0; i < pObject->cBlob; i++)
1365  {
1366  DWORD contentType, expectedContentTypes =
1372  HCERTSTORE contextStore;
1373  const void *context;
1374 
1376  &pObject->rgBlob[i], expectedContentTypes,
1377  CERT_QUERY_FORMAT_FLAG_BINARY, 0, NULL, &contentType, NULL,
1378  &contextStore, NULL, &context))
1379  {
1380  switch (contentType)
1381  {
1385  ret = FALSE;
1387  break;
1389  if (!CertAddCRLContextToStore(store,
1391  ret = FALSE;
1393  break;
1395  if (!CertAddCTLContextToStore(store,
1397  ret = FALSE;
1399  break;
1400  default:
1401  CertAddStoreToCollection(store, contextStore, 0, 0);
1402  }
1403  CertCloseStore(contextStore, 0);
1404  }
1405  else
1406  ret = FALSE;
1407  }
1408  }
1409  else
1410  ret = FALSE;
1411  *ppvContext = store;
1412  }
1413  return ret;
1414 }
#define TRUE
Definition: types.h:120
Definition: http.c:7094
#define CERT_QUERY_CONTENT_CRL
Definition: wincrypt.h:3531
BOOL WINAPI CertAddCertificateContextToStore(HCERTSTORE hCertStore, PCCERT_CONTEXT pCertContext, DWORD dwAddDisposition, PCCERT_CONTEXT *ppStoreContext)
Definition: cert.c:286
#define CERT_QUERY_OBJECT_BLOB
Definition: wincrypt.h:3527
BOOL WINAPI CertFreeCertificateContext(PCCERT_CONTEXT pCertContext)
Definition: cert.c:371
#define CERT_QUERY_CONTENT_CTL
Definition: wincrypt.h:3530
BOOL WINAPI CertAddStoreToCollection(HCERTSTORE hCollectionStore, HCERTSTORE hSiblingStore, DWORD dwUpdateFlags, DWORD dwPriority)
#define CERT_STORE_PROV_COLLECTION
Definition: wincrypt.h:2261
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
PCRYPT_DATA_BLOB rgBlob
Definition: wincrypt.h:1569
#define CERT_STORE_CREATE_NEW_FLAG
Definition: wincrypt.h:2464
#define CERT_QUERY_CONTENT_FLAG_CRL
Definition: wincrypt.h:3545
unsigned int BOOL
Definition: ntddk_ex.h:94
#define CERT_STORE_PROV_MEMORY
Definition: wincrypt.h:2251
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI CertCloseStore(HCERTSTORE hCertStore, DWORD dwFlags)
Definition: store.c:1127
_In_ DWORD _In_ DWORD _In_ DWORD _In_ DWORD _Out_opt_ DWORD _Outptr_opt_ const void ** ppvContext
Definition: wincrypt.h:5088
#define CERT_QUERY_CONTENT_FLAG_CTL
Definition: wincrypt.h:3544
#define CERT_QUERY_CONTENT_FLAG_CERT
Definition: wincrypt.h:3543
BOOL WINAPI CryptQueryObject(DWORD dwObjectType, const void *pvObject, DWORD dwExpectedContentTypeFlags, DWORD dwExpectedFormatTypeFlags, DWORD dwFlags, DWORD *pdwMsgAndCertEncodingType, DWORD *pdwContentType, DWORD *pdwFormatType, HCERTSTORE *phCertStore, HCRYPTMSG *phMsg, const void **ppvContext)
Definition: object.c:699
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:418
#define CERT_QUERY_FORMAT_FLAG_BINARY
Definition: wincrypt.h:3583
int ret
BOOL WINAPI CertFreeCTLContext(PCCTL_CONTEXT pCTLContext)
Definition: ctl.c:499
#define ERROR_INVALID_DATA
Definition: winerror.h:116
BOOL WINAPI CertAddCTLContextToStore(HCERTSTORE hCertStore, PCCTL_CONTEXT pCtlContext, DWORD dwAddDisposition, PCCTL_CONTEXT *ppStoreContext)
Definition: ctl.c:63
BOOL WINAPI CertAddCRLContextToStore(HCERTSTORE hCertStore, PCCRL_CONTEXT pCrlContext, DWORD dwAddDisposition, PCCRL_CONTEXT *ppStoreContext)
Definition: store.c:960
HCERTSTORE WINAPI CertOpenStore(LPCSTR lpszStoreProvider, DWORD dwMsgAndCertEncodingType, HCRYPTPROV_LEGACY hCryptProv, DWORD dwFlags, const void *pvPara)
Definition: store.c:815
#define CERT_QUERY_CONTENT_CERT
Definition: wincrypt.h:3529
#define CERT_QUERY_CONTENT_FLAG_PKCS7_SIGNED
Definition: wincrypt.h:3554
#define CERT_QUERY_CONTENT_FLAG_PKCS7_UNSIGNED
Definition: wincrypt.h:3556
#define CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG
Definition: wincrypt.h:2580
#define CERT_STORE_ADD_ALWAYS
Definition: wincrypt.h:2485
BOOL WINAPI CertFreeCRLContext(PCCRL_CONTEXT pCrlContext)
Definition: crl.c:386

Referenced by CRYPT_GetCreateFunction().

◆ CRYPT_CreateBlob()

static BOOL WINAPI CRYPT_CreateBlob ( LPCSTR  pszObjectOid,
DWORD  dwRetrievalFlags,
const CRYPT_BLOB_ARRAY pObject,
void **  ppvContext 
)
static

Definition at line 1149 of file cryptnet_main.c.

1151 {
1152  DWORD size, i;
1154  BOOL ret = FALSE;
1155 
1156  size = sizeof(CRYPT_BLOB_ARRAY) + pObject->cBlob * sizeof(CRYPT_DATA_BLOB);
1157  for (i = 0; i < pObject->cBlob; i++)
1158  size += pObject->rgBlob[i].cbData;
1160  if (context)
1161  {
1162  LPBYTE nextData;
1163 
1164  context->cBlob = 0;
1165  context->rgBlob =
1167  nextData =
1168  (LPBYTE)context->rgBlob + pObject->cBlob * sizeof(CRYPT_DATA_BLOB);
1169  for (i = 0; i < pObject->cBlob; i++)
1170  {
1171  memcpy(nextData, pObject->rgBlob[i].pbData,
1172  pObject->rgBlob[i].cbData);
1173  context->rgBlob[i].pbData = nextData;
1174  context->rgBlob[i].cbData = pObject->rgBlob[i].cbData;
1175  nextData += pObject->rgBlob[i].cbData;
1176  context->cBlob++;
1177  }
1178  *ppvContext = context;
1179  ret = TRUE;
1180  }
1181  return ret;
1182 }
#define TRUE
Definition: types.h:120
Definition: http.c:7094
struct _CRYPT_BLOB_ARRAY CRYPT_BLOB_ARRAY
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
LPVOID WINAPI CryptMemAlloc(ULONG cbSize)
Definition: main.c:131
PCRYPT_DATA_BLOB rgBlob
Definition: wincrypt.h:1569
unsigned char * LPBYTE
Definition: typedefs.h:53
unsigned int BOOL
Definition: ntddk_ex.h:94
_In_ DWORD _In_ DWORD _In_ DWORD _In_ DWORD _Out_opt_ DWORD _Outptr_opt_ const void ** ppvContext
Definition: wincrypt.h:5088
GLsizeiptr size
Definition: glext.h:5919
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
BYTE * pbData
Definition: wincrypt.h:103
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878

Referenced by CRYPT_GetCreateFunction().

◆ CRYPT_CreateCert()

static BOOL WINAPI CRYPT_CreateCert ( LPCSTR  pszObjectOid,
DWORD  dwRetrievalFlags,
const CRYPT_BLOB_ARRAY pObject,
void **  ppvContext 
)
static

Definition at line 1281 of file cryptnet_main.c.

1283 {
1286 }
BOOL WINAPI CertAddCertificateContextToStore(HCERTSTORE hCertStore, PCCERT_CONTEXT pCertContext, DWORD dwAddDisposition, PCCERT_CONTEXT *ppStoreContext)
Definition: cert.c:286
_In_ DWORD _In_ DWORD _In_ DWORD _In_ DWORD _Out_opt_ DWORD _Outptr_opt_ const void ** ppvContext
Definition: wincrypt.h:5088
#define CERT_QUERY_CONTENT_FLAG_CERT
Definition: wincrypt.h:3543
BOOL(WINAPI * AddContextToStore)(HCERTSTORE hCertStore, const void *pContext, DWORD dwAddDisposition, const void **ppStoreContext)
static BOOL CRYPT_CreateContext(const CRYPT_BLOB_ARRAY *pObject, DWORD dwExpectedContentTypeFlags, AddContextToStore addFunc, void **ppvContext)

Referenced by CRYPT_GetCreateFunction().

◆ CRYPT_CreateContext()

static BOOL CRYPT_CreateContext ( const CRYPT_BLOB_ARRAY pObject,
DWORD  dwExpectedContentTypeFlags,
AddContextToStore  addFunc,
void **  ppvContext 
)
static

Definition at line 1203 of file cryptnet_main.c.

1205 {
1206  BOOL ret = TRUE;
1208 
1209  if (!pObject->cBlob)
1210  {
1212  *ppvContext = NULL;
1213  ret = FALSE;
1214  }
1215  else if (pObject->cBlob == 1)
1216  {
1217  if (decode_base64_blob(&pObject->rgBlob[0], &blob))
1218  {
1220  dwExpectedContentTypeFlags, CERT_QUERY_FORMAT_FLAG_BINARY, 0,
1221  NULL, NULL, NULL, NULL, NULL, (const void **)ppvContext);
1222  CryptMemFree(blob.pbData);
1223  }
1224  else
1225  {
1227  dwExpectedContentTypeFlags, CERT_QUERY_FORMAT_FLAG_BINARY, 0,
1228  NULL, NULL, NULL, NULL, NULL, (const void **)ppvContext);
1229  }
1230  if (!ret)
1231  {
1233  ret = FALSE;
1234  }
1235  }
1236  else
1237  {
1240 
1241  if (store)
1242  {
1243  DWORD i;
1244  const void *context;
1245 
1246  for (i = 0; i < pObject->cBlob; i++)
1247  {
1248  if (decode_base64_blob(&pObject->rgBlob[i], &blob))
1249  {
1251  dwExpectedContentTypeFlags, CERT_QUERY_FORMAT_FLAG_BINARY,
1252  0, NULL, NULL, NULL, NULL, NULL, &context);
1253  CryptMemFree(blob.pbData);
1254  }
1255  else
1256  {
1258  &pObject->rgBlob[i], dwExpectedContentTypeFlags,
1260  NULL, &context);
1261  }
1262  if (ret)
1263  {
1264  if (!addFunc(store, context, CERT_STORE_ADD_ALWAYS, NULL))
1265  ret = FALSE;
1266  }
1267  else
1268  {
1270  ret = FALSE;
1271  }
1272  }
1273  }
1274  else
1275  ret = FALSE;
1276  *ppvContext = store;
1277  }
1278  return ret;
1279 }
#define TRUE
Definition: types.h:120
Definition: image.c:133
Definition: http.c:7094
#define CERT_QUERY_OBJECT_BLOB
Definition: wincrypt.h:3527
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
PCRYPT_DATA_BLOB rgBlob
Definition: wincrypt.h:1569
#define CERT_STORE_CREATE_NEW_FLAG
Definition: wincrypt.h:2464
unsigned int BOOL
Definition: ntddk_ex.h:94
const DWORD * blob
Definition: effect.c:999
#define CERT_STORE_PROV_MEMORY
Definition: wincrypt.h:2251
smooth NULL
Definition: ftsmooth.c:416
_In_ DWORD _In_ DWORD _In_ DWORD _In_ DWORD _Out_opt_ DWORD _Outptr_opt_ const void ** ppvContext
Definition: wincrypt.h:5088
BOOL WINAPI CryptQueryObject(DWORD dwObjectType, const void *pvObject, DWORD dwExpectedContentTypeFlags, DWORD dwExpectedFormatTypeFlags, DWORD dwFlags, DWORD *pdwMsgAndCertEncodingType, DWORD *pdwContentType, DWORD *pdwFormatType, HCERTSTORE *phCertStore, HCRYPTMSG *phMsg, const void **ppvContext)
Definition: object.c:699
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:418
#define CERT_QUERY_FORMAT_FLAG_BINARY
Definition: wincrypt.h:3583
int ret
static BOOL decode_base64_blob(const CRYPT_DATA_BLOB *in, CRYPT_DATA_BLOB *out)
#define ERROR_INVALID_DATA
Definition: winerror.h:116
#define CRYPT_E_NO_MATCH
Definition: winerror.h:3012
HCERTSTORE WINAPI CertOpenStore(LPCSTR lpszStoreProvider, DWORD dwMsgAndCertEncodingType, HCRYPTPROV_LEGACY hCryptProv, DWORD dwFlags, const void *pvPara)
Definition: store.c:815
VOID WINAPI CryptMemFree(LPVOID pv)
Definition: main.c:141
#define CERT_STORE_ADD_ALWAYS
Definition: wincrypt.h:2485

Referenced by CRYPT_CreateCert(), CRYPT_CreateCRL(), and CRYPT_CreateCTL().

◆ CRYPT_CreateCRL()

static BOOL WINAPI CRYPT_CreateCRL ( LPCSTR  pszObjectOid,
DWORD  dwRetrievalFlags,
const CRYPT_BLOB_ARRAY pObject,
void **  ppvContext 
)
static

Definition at line 1288 of file cryptnet_main.c.

1290 {
1293 }
#define CERT_QUERY_CONTENT_FLAG_CRL
Definition: wincrypt.h:3545
_In_ DWORD _In_ DWORD _In_ DWORD _In_ DWORD _Out_opt_ DWORD _Outptr_opt_ const void ** ppvContext
Definition: wincrypt.h:5088
BOOL(WINAPI * AddContextToStore)(HCERTSTORE hCertStore, const void *pContext, DWORD dwAddDisposition, const void **ppStoreContext)
static BOOL CRYPT_CreateContext(const CRYPT_BLOB_ARRAY *pObject, DWORD dwExpectedContentTypeFlags, AddContextToStore addFunc, void **ppvContext)
BOOL WINAPI CertAddCRLContextToStore(HCERTSTORE hCertStore, PCCRL_CONTEXT pCrlContext, DWORD dwAddDisposition, PCCRL_CONTEXT *ppStoreContext)
Definition: store.c:960

Referenced by CRYPT_GetCreateFunction().

◆ CRYPT_CreateCTL()

static BOOL WINAPI CRYPT_CreateCTL ( LPCSTR  pszObjectOid,
DWORD  dwRetrievalFlags,
const CRYPT_BLOB_ARRAY pObject,
void **  ppvContext 
)
static

Definition at line 1295 of file cryptnet_main.c.

1297 {
1300 }
_In_ DWORD _In_ DWORD _In_ DWORD _In_ DWORD _Out_opt_ DWORD _Outptr_opt_ const void ** ppvContext
Definition: wincrypt.h:5088
#define CERT_QUERY_CONTENT_FLAG_CTL
Definition: wincrypt.h:3544
BOOL(WINAPI * AddContextToStore)(HCERTSTORE hCertStore, const void *pContext, DWORD dwAddDisposition, const void **ppStoreContext)
static BOOL CRYPT_CreateContext(const CRYPT_BLOB_ARRAY *pObject, DWORD dwExpectedContentTypeFlags, AddContextToStore addFunc, void **ppvContext)
BOOL WINAPI CertAddCTLContextToStore(HCERTSTORE hCertStore, PCCTL_CONTEXT pCtlContext, DWORD dwAddDisposition, PCCTL_CONTEXT *ppStoreContext)
Definition: ctl.c:63

Referenced by CRYPT_GetCreateFunction().

◆ CRYPT_CreatePKCS7()

static BOOL WINAPI CRYPT_CreatePKCS7 ( LPCSTR  pszObjectOid,
DWORD  dwRetrievalFlags,
const CRYPT_BLOB_ARRAY pObject,
void **  ppvContext 
)
static

Definition at line 1302 of file cryptnet_main.c.

1304 {
1305  BOOL ret;
1306 
1307  if (!pObject->cBlob)
1308  {
1310  *ppvContext = NULL;
1311  ret = FALSE;
1312  }
1313  else if (pObject->cBlob == 1)
1317  0, NULL, NULL, NULL, ppvContext, NULL, NULL);
1318  else
1319  {
1320  FIXME("multiple messages unimplemented\n");
1321  ret = FALSE;
1322  }
1323  return ret;
1324 }
#define CERT_QUERY_OBJECT_BLOB
Definition: wincrypt.h:3527
PCRYPT_DATA_BLOB rgBlob
Definition: wincrypt.h:1569
unsigned int BOOL
Definition: ntddk_ex.h:94
#define FIXME(fmt,...)
Definition: debug.h:111
smooth NULL
Definition: ftsmooth.c:416
_In_ DWORD _In_ DWORD _In_ DWORD _In_ DWORD _Out_opt_ DWORD _Outptr_opt_ const void ** ppvContext
Definition: wincrypt.h:5088
BOOL WINAPI CryptQueryObject(DWORD dwObjectType, const void *pvObject, DWORD dwExpectedContentTypeFlags, DWORD dwExpectedFormatTypeFlags, DWORD dwFlags, DWORD *pdwMsgAndCertEncodingType, DWORD *pdwContentType, DWORD *pdwFormatType, HCERTSTORE *phCertStore, HCRYPTMSG *phMsg, const void **ppvContext)
Definition: object.c:699
#define SetLastError(x)
Definition: compat.h:418
#define CERT_QUERY_FORMAT_FLAG_BINARY
Definition: wincrypt.h:3583
int ret
#define ERROR_INVALID_DATA
Definition: winerror.h:116
#define CERT_QUERY_CONTENT_FLAG_PKCS7_SIGNED
Definition: wincrypt.h:3554
#define CERT_QUERY_CONTENT_FLAG_PKCS7_UNSIGNED
Definition: wincrypt.h:3556

Referenced by CRYPT_GetCreateFunction().

◆ CRYPT_DownloadObject()

static BOOL CRYPT_DownloadObject ( DWORD  dwRetrievalFlags,
HINTERNET  hHttp,
struct InetContext context,
PCRYPT_BLOB_ARRAY  pObject,
PCRYPT_RETRIEVE_AUX_INFO  pAuxInfo 
)
static

Definition at line 631 of file cryptnet_main.c.

634 {
635  CRYPT_DATA_BLOB object = { 0, NULL };
636  DWORD bytesAvailable;
637  BOOL ret;
638 
639  do {
640  if ((ret = InternetQueryDataAvailable(hHttp, &bytesAvailable, 0, 0)))
641  {
642  if (bytesAvailable)
643  {
644  if (object.pbData)
645  object.pbData = CryptMemRealloc(object.pbData,
646  object.cbData + bytesAvailable);
647  else
648  object.pbData = CryptMemAlloc(bytesAvailable);
649  if (object.pbData)
650  {
651  INTERNET_BUFFERSA buffer = { sizeof(buffer), 0 };
652 
653  buffer.dwBufferLength = bytesAvailable;
654  buffer.lpvBuffer = object.pbData + object.cbData;
655  if (!(ret = InternetReadFileExA(hHttp, &buffer, IRF_NO_WAIT,
656  (DWORD_PTR)context)))
657  {
659  {
661  context->timeout) == WAIT_TIMEOUT)
663  else if (context->error)
664  SetLastError(context->error);
665  else
666  ret = TRUE;
667  }
668  }
669  if (ret)
670  object.cbData += buffer.dwBufferLength;
671  }
672  else
673  {
675  ret = FALSE;
676  }
677  }
678  }
679  else if (GetLastError() == ERROR_IO_PENDING)
680  {
681  if (WaitForSingleObject(context->event, context->timeout) ==
682  WAIT_TIMEOUT)
684  else
685  ret = TRUE;
686  }
687  } while (ret && bytesAvailable);
688  if (ret)
689  {
690  pObject->rgBlob = CryptMemAlloc(sizeof(CRYPT_DATA_BLOB));
691  if (!pObject->rgBlob)
692  {
693  CryptMemFree(object.pbData);
695  ret = FALSE;
696  }
697  else
698  {
699  pObject->rgBlob[0].cbData = object.cbData;
700  pObject->rgBlob[0].pbData = object.pbData;
701  pObject->cBlob = 1;
702  }
703  }
704  TRACE("returning %d\n", ret);
705  return ret;
706 }
#define TRUE
Definition: types.h:120
Definition: http.c:7094
#define ERROR_TIMEOUT
Definition: winerror.h:941
#define IRF_NO_WAIT
Definition: wininet.h:625
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
GLuint buffer
Definition: glext.h:5915
#define ERROR_IO_PENDING
Definition: dderror.h:15
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
LPVOID WINAPI CryptMemAlloc(ULONG cbSize)
Definition: main.c:131
PCRYPT_DATA_BLOB rgBlob
Definition: wincrypt.h:1569
HANDLE event
Definition: http.c:7096
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI InternetQueryDataAvailable(HINTERNET hFile, LPDWORD lpdwNumberOfBytesAvailable, DWORD dwFlags, DWORD_PTR dwContext)
Definition: internet.c:3842
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:418
#define WAIT_TIMEOUT
Definition: dderror.h:14
LPVOID WINAPI CryptMemRealloc(LPVOID pv, ULONG cbSize)
Definition: main.c:136
int ret
BYTE * pbData
Definition: wincrypt.h:103
uint32_t DWORD_PTR
Definition: typedefs.h:64
DWORD dwBufferLength
Definition: wininet.h:265
VOID WINAPI CryptMemFree(LPVOID pv)
Definition: main.c:141
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
BOOL WINAPI InternetReadFileExA(HINTERNET hFile, LPINTERNET_BUFFERSA lpBuffersOut, DWORD dwFlags, DWORD_PTR dwContext)
Definition: internet.c:2230
_In_ HCRYPTHASH _In_ BOOL _In_ DWORD _Inout_updates_bytes_to_ pdwDataLen BYTE * pbData
Definition: wincrypt.h:4201

Referenced by HTTP_RetrieveEncodedObjectW().

◆ CRYPT_FreeBlob()

static void WINAPI CRYPT_FreeBlob ( LPCSTR  pszObjectOid,
PCRYPT_BLOB_ARRAY  pObject,
void pvFreeContext 
)
static

Definition at line 433 of file cryptnet_main.c.

435 {
436  DWORD i;
437 
438  for (i = 0; i < pObject->cBlob; i++)
439  CryptMemFree(pObject->rgBlob[i].pbData);
440  CryptMemFree(pObject->rgBlob);
441 }
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
PCRYPT_DATA_BLOB rgBlob
Definition: wincrypt.h:1569
unsigned long DWORD
Definition: ntddk_ex.h:95
BYTE * pbData
Definition: wincrypt.h:103
VOID WINAPI CryptMemFree(LPVOID pv)
Definition: main.c:141

Referenced by File_RetrieveEncodedObjectW(), FTP_RetrieveEncodedObjectW(), and HTTP_RetrieveEncodedObjectW().

◆ CRYPT_GetCreateFunction()

static BOOL CRYPT_GetCreateFunction ( LPCSTR  pszObjectOid,
ContextDllCreateObjectContext pFunc,
HCRYPTOIDFUNCADDR phFunc 
)
static

Definition at line 1419 of file cryptnet_main.c.

1421 {
1422  BOOL ret = TRUE;
1423 
1424  TRACE("(%s, %p, %p)\n", debugstr_a(pszObjectOid), pFunc, phFunc);
1425 
1426  *pFunc = NULL;
1427  *phFunc = 0;
1428  if (IS_INTOID(pszObjectOid))
1429  {
1430  switch (LOWORD(pszObjectOid))
1431  {
1432  case 0:
1433  *pFunc = CRYPT_CreateBlob;
1434  break;
1436  *pFunc = CRYPT_CreateCert;
1437  break;
1438  case LOWORD(CONTEXT_OID_CRL):
1439  *pFunc = CRYPT_CreateCRL;
1440  break;
1441  case LOWORD(CONTEXT_OID_CTL):
1442  *pFunc = CRYPT_CreateCTL;
1443  break;
1444  case LOWORD(CONTEXT_OID_PKCS7):
1445  *pFunc = CRYPT_CreatePKCS7;
1446  break;
1448  *pFunc = CRYPT_CreateAny;
1449  break;
1450  }
1451  }
1452  if (!*pFunc)
1453  {
1454  static HCRYPTOIDFUNCSET set = NULL;
1455 
1456  if (!set)
1460  0, (void **)pFunc, phFunc);
1461  }
1462  TRACE("returning %d\n", ret);
1463  return ret;
1464 }
HCRYPTOIDFUNCSET WINAPI CryptInitOIDFunctionSet(LPCSTR pszFuncName, DWORD dwFlags)
Definition: oid.c:114
#define TRUE
Definition: types.h:120
#define X509_ASN_ENCODING
Definition: wincrypt.h:2297
unsigned int BOOL
Definition: ntddk_ex.h:94
static BOOL WINAPI CRYPT_CreatePKCS7(LPCSTR pszObjectOid, DWORD dwRetrievalFlags, const CRYPT_BLOB_ARRAY *pObject, void **ppvContext)
smooth NULL
Definition: ftsmooth.c:416
static BOOL WINAPI CRYPT_CreateCert(LPCSTR pszObjectOid, DWORD dwRetrievalFlags, const CRYPT_BLOB_ARRAY *pObject, void **ppvContext)
#define CONTEXT_OID_CREATE_OBJECT_CONTEXT_FUNC
Definition: wincrypt.h:1621
static BOOL WINAPI CRYPT_CreateAny(LPCSTR pszObjectOid, DWORD dwRetrievalFlags, const CRYPT_BLOB_ARRAY *pObject, void **ppvContext)
_In_opt_ LPCSTR pszObjectOid
Definition: wincrypt.h:6114
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
int ret
#define CONTEXT_OID_CERTIFICATE
Definition: wincrypt.h:1627
#define IS_INTOID(x)
Definition: cryptnet_main.c:39
static BOOL WINAPI CRYPT_CreateBlob(LPCSTR pszObjectOid, DWORD dwRetrievalFlags, const CRYPT_BLOB_ARRAY *pObject, void **ppvContext)
#define CONTEXT_OID_CTL
Definition: wincrypt.h:1629
static BOOL WINAPI CRYPT_CreateCRL(LPCSTR pszObjectOid, DWORD dwRetrievalFlags, const CRYPT_BLOB_ARRAY *pObject, void **ppvContext)
#define CONTEXT_OID_CAPI2_ANY
Definition: wincrypt.h:1631
BOOL WINAPI CryptGetOIDFunctionAddress(HCRYPTOIDFUNCSET hFuncSet, DWORD dwEncodingType, LPCSTR pszOID, DWORD dwFlags, void **ppvFuncAddr, HCRYPTOIDFUNCADDR *phFuncAddr)
Definition: oid.c:387
static BOOL WINAPI CRYPT_CreateCTL(LPCSTR pszObjectOid, DWORD dwRetrievalFlags, const CRYPT_BLOB_ARRAY *pObject, void **ppvContext)
#define CONTEXT_OID_PKCS7
Definition: wincrypt.h:1630
Definition: _set.h:46
#define CONTEXT_OID_CRL
Definition: wincrypt.h:1628
#define LOWORD(l)
Definition: pedump.c:82

Referenced by CryptRetrieveObjectByUrlW().

◆ CRYPT_GetExpiration()

static BOOL CRYPT_GetExpiration ( const void object,
const char pszObjectOid,
FILETIME expiration 
)
static

Definition at line 1466 of file cryptnet_main.c.

1467 {
1468  if (!IS_INTOID(pszObjectOid))
1469  return FALSE;
1470 
1471  switch (LOWORD(pszObjectOid)) {
1473  *expiration = ((const CERT_CONTEXT*)object)->pCertInfo->NotAfter;
1474  return TRUE;
1475  case LOWORD(CONTEXT_OID_CRL):
1476  *expiration = ((const CRL_CONTEXT*)object)->pCrlInfo->NextUpdate;
1477  return TRUE;
1478  case LOWORD(CONTEXT_OID_CTL):
1479  *expiration = ((const CTL_CONTEXT*)object)->pCtlInfo->NextUpdate;
1480  return TRUE;
1481  }
1482 
1483  return FALSE;
1484 }
#define TRUE
Definition: types.h:120
_In_opt_ LPCSTR pszObjectOid
Definition: wincrypt.h:6114
#define CONTEXT_OID_CERTIFICATE
Definition: wincrypt.h:1627
#define IS_INTOID(x)
Definition: cryptnet_main.c:39
#define CONTEXT_OID_CTL
Definition: wincrypt.h:1629
#define const
Definition: zconf.h:230
#define CONTEXT_OID_CRL
Definition: wincrypt.h:1628
#define LOWORD(l)
Definition: pedump.c:82

Referenced by CryptRetrieveObjectByUrlW().

◆ CRYPT_GetObjectFromCache()

static BOOL CRYPT_GetObjectFromCache ( LPCWSTR  pszURL,
PCRYPT_BLOB_ARRAY  pObject,
PCRYPT_RETRIEVE_AUX_INFO  pAuxInfo 
)
static

Definition at line 492 of file cryptnet_main.c.

494 {
495  BOOL ret = FALSE;
496  INTERNET_CACHE_ENTRY_INFOW *pCacheInfo = NULL;
497  DWORD size = 0;
498 
499  TRACE("(%s, %p, %p)\n", debugstr_w(pszURL), pObject, pAuxInfo);
500 
501  RetrieveUrlCacheEntryFileW(pszURL, NULL, &size, 0);
503  return FALSE;
504 
505  pCacheInfo = CryptMemAlloc(size);
506  if (!pCacheInfo)
507  {
509  return FALSE;
510  }
511 
512  if ((ret = RetrieveUrlCacheEntryFileW(pszURL, pCacheInfo, &size, 0)))
513  {
514  FILETIME ft;
515 
517  if (CompareFileTime(&pCacheInfo->ExpireTime, &ft) >= 0)
518  {
521 
523  {
524  if ((ret = CRYPT_GetObjectFromFile(hFile, pObject)))
525  {
526  if (pAuxInfo && pAuxInfo->cbSize >=
528  pLastSyncTime) + sizeof(PFILETIME) &&
529  pAuxInfo->pLastSyncTime)
530  memcpy(pAuxInfo->pLastSyncTime,
531  &pCacheInfo->LastSyncTime,
532  sizeof(FILETIME));
533  }
535  }
536  else
537  {
538  DeleteUrlCacheEntryW(pszURL);
539  ret = FALSE;
540  }
541  }
542  else
543  {
544  DeleteUrlCacheEntryW(pszURL);
545  ret = FALSE;
546  }
547  UnlockUrlCacheEntryFileW(pszURL, 0);
548  }
549  CryptMemFree(pCacheInfo);
550  TRACE("returning %d\n", ret);
551  return ret;
552 }
VOID WINAPI GetSystemTimeAsFileTime(OUT PFILETIME lpFileTime)
Definition: time.c:128
#define CloseHandle
Definition: compat.h:407
#define INVALID_HANDLE_VALUE
Definition: compat.h:400
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define FILE_SHARE_READ
Definition: compat.h:125
BOOL WINAPI RetrieveUrlCacheEntryFileW(LPCWSTR lpszUrlName, LPINTERNET_CACHE_ENTRY_INFOW lpCacheEntryInfo, LPDWORD lpdwCacheEntryInfoBufferSize, DWORD dwReserved)
Definition: urlcache.c:2195
LPVOID WINAPI CryptMemAlloc(ULONG cbSize)
Definition: main.c:131
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI UnlockUrlCacheEntryFileW(LPCWSTR lpszUrlName, DWORD dwReserved)
Definition: urlcache.c:2631
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define offsetof(TYPE, MEMBER)
#define OPEN_EXISTING
Definition: compat.h:435
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
LONG WINAPI CompareFileTime(IN CONST FILETIME *lpFileTime1, IN CONST FILETIME *lpFileTime2)
Definition: time.c:106
FILETIME ExpireTime
Definition: wininet.h:2137
LPWSTR lpszLocalFileName
Definition: wininet.h:2130
static BOOL CRYPT_GetObjectFromFile(HANDLE hFile, PCRYPT_BLOB_ARRAY pObject)
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:418
int ret
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define GENERIC_READ
Definition: compat.h:124
_In_ HANDLE hFile
Definition: mswsock.h:90
_In_opt_ LPCSTR _In_ DWORD _In_ DWORD _Outptr_ LPVOID _In_opt_ HCRYPTASYNC _In_opt_ PCRYPT_CREDENTIALS _In_opt_ LPVOID _Inout_opt_ PCRYPT_RETRIEVE_AUX_INFO pAuxInfo
Definition: wincrypt.h:6114
FILETIME LastSyncTime
Definition: wininet.h:2139
#define CreateFileW
Definition: compat.h:409
VOID WINAPI CryptMemFree(LPVOID pv)
Definition: main.c:141
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
BOOL WINAPI DeleteUrlCacheEntryW(LPCWSTR lpszUrlName)
Definition: urlcache.c:3356
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
Definition: wininet.h:2127

Referenced by HTTP_RetrieveEncodedObjectW().

◆ CRYPT_GetObjectFromFile()

static BOOL CRYPT_GetObjectFromFile ( HANDLE  hFile,
PCRYPT_BLOB_ARRAY  pObject 
)
static

Definition at line 443 of file cryptnet_main.c.

444 {
445  BOOL ret;
447 
448  if ((ret = GetFileSizeEx(hFile, &size)))
449  {
450  if (size.u.HighPart)
451  {
452  WARN("file too big\n");
454  ret = FALSE;
455  }
456  else
457  {
459 
460  blob.pbData = CryptMemAlloc(size.u.LowPart);
461  if (blob.pbData)
462  {
463  ret = ReadFile(hFile, blob.pbData, size.u.LowPart, &blob.cbData,
464  NULL);
465  if (ret)
466  {
467  pObject->rgBlob = CryptMemAlloc(sizeof(CRYPT_DATA_BLOB));
468  if (pObject->rgBlob)
469  {
470  pObject->cBlob = 1;
471  memcpy(pObject->rgBlob, &blob, sizeof(CRYPT_DATA_BLOB));
472  }
473  else
474  {
476  ret = FALSE;
477  }
478  }
479  if (!ret)
480  CryptMemFree(blob.pbData);
481  }
482  else
483  {
485  ret = FALSE;
486  }
487  }
488  }
489  return ret;
490 }
Definition: image.c:133
#define WARN(fmt,...)
Definition: debug.h:112
LPVOID WINAPI CryptMemAlloc(ULONG cbSize)
Definition: main.c:131
PCRYPT_DATA_BLOB rgBlob
Definition: wincrypt.h:1569
unsigned int BOOL
Definition: ntddk_ex.h:94
const DWORD * blob
Definition: effect.c:999
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919
#define SetLastError(x)
Definition: compat.h:418
#define GetFileSizeEx
Definition: compat.h:423
int ret
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
_In_ HANDLE hFile
Definition: mswsock.h:90
#define ERROR_INVALID_DATA
Definition: winerror.h:116
VOID WINAPI CryptMemFree(LPVOID pv)
Definition: main.c:141
BOOL WINAPI ReadFile(IN HANDLE hFile, IN LPVOID lpBuffer, IN DWORD nNumberOfBytesToRead, OUT LPDWORD lpNumberOfBytesRead OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:123
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13

Referenced by CRYPT_GetObjectFromCache(), and File_RetrieveEncodedObjectW().

◆ CRYPT_GetRetrieveFunction()

static BOOL CRYPT_GetRetrieveFunction ( LPCWSTR  pszURL,
SchemeDllRetrieveEncodedObjectW pFunc,
HCRYPTOIDFUNCADDR phFunc 
)
static

Definition at line 1083 of file cryptnet_main.c.

1085 {
1086  URL_COMPONENTSW components = { sizeof(components), 0 };
1087  BOOL ret;
1088 
1089  TRACE("(%s, %p, %p)\n", debugstr_w(pszURL), pFunc, phFunc);
1090 
1091  *pFunc = NULL;
1092  *phFunc = 0;
1093  components.dwSchemeLength = 1;
1094  ret = InternetCrackUrlW(pszURL, 0, 0, &components);
1095  if (ret)
1096  {
1097  /* Microsoft always uses CryptInitOIDFunctionSet/
1098  * CryptGetOIDFunctionAddress, but there doesn't seem to be a pressing
1099  * reason to do so for builtin schemes.
1100  */
1101  switch (components.nScheme)
1102  {
1103  case INTERNET_SCHEME_FTP:
1104  *pFunc = FTP_RetrieveEncodedObjectW;
1105  break;
1106  case INTERNET_SCHEME_HTTP:
1107  *pFunc = HTTP_RetrieveEncodedObjectW;
1108  break;
1109  case INTERNET_SCHEME_FILE:
1110  *pFunc = File_RetrieveEncodedObjectW;
1111  break;
1112  default:
1113  {
1114  int len = WideCharToMultiByte(CP_ACP, 0, components.lpszScheme,
1115  components.dwSchemeLength, NULL, 0, NULL, NULL);
1116 
1117  if (len)
1118  {
1120 
1121  if (scheme)
1122  {
1123  static HCRYPTOIDFUNCSET set = NULL;
1124 
1125  if (!set)
1128  WideCharToMultiByte(CP_ACP, 0, components.lpszScheme,
1129  components.dwSchemeLength, scheme, len, NULL, NULL);
1131  scheme, 0, (void **)pFunc, phFunc);
1133  }
1134  else
1135  {
1137  ret = FALSE;
1138  }
1139  }
1140  else
1141  ret = FALSE;
1142  }
1143  }
1144  }
1145  TRACE("returning %d\n", ret);
1146  return ret;
1147 }
HCRYPTOIDFUNCSET WINAPI CryptInitOIDFunctionSet(LPCSTR pszFuncName, DWORD dwFlags)
Definition: oid.c:114
#define SCHEME_OID_RETRIEVE_ENCODED_OBJECTW_FUNC
Definition: wincrypt.h:1611
#define WideCharToMultiByte
Definition: compat.h:101
#define CP_ACP
Definition: compat.h:99
static BOOL WINAPI File_RetrieveEncodedObjectW(LPCWSTR pszURL, LPCSTR pszObjectOid, DWORD dwRetrievalFlags, DWORD dwTimeout, PCRYPT_BLOB_ARRAY pObject, PFN_FREE_ENCODED_OBJECT_FUNC *ppfnFreeObject, void **ppvFreeContext, HCRYPTASYNC hAsyncRetrieve, PCRYPT_CREDENTIALS pCredentials, PCRYPT_RETRIEVE_AUX_INFO pAuxInfo)
DWORD scheme
char * LPSTR
Definition: xmlstorage.h:182
#define X509_ASN_ENCODING
Definition: wincrypt.h:2297
LPVOID WINAPI CryptMemAlloc(ULONG cbSize)
Definition: main.c:131
unsigned int BOOL
Definition: ntddk_ex.h:94
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
static BOOL WINAPI HTTP_RetrieveEncodedObjectW(LPCWSTR pszURL, LPCSTR pszObjectOid, DWORD dwRetrievalFlags, DWORD dwTimeout, PCRYPT_BLOB_ARRAY pObject, PFN_FREE_ENCODED_OBJECT_FUNC *ppfnFreeObject, void **ppvFreeContext, HCRYPTASYNC hAsyncRetrieve, PCRYPT_CREDENTIALS pCredentials, PCRYPT_RETRIEVE_AUX_INFO pAuxInfo)
#define TRACE(s)
Definition: solgame.cpp:4
static BOOL WINAPI FTP_RetrieveEncodedObjectW(LPCWSTR pszURL, LPCSTR pszObjectOid, DWORD dwRetrievalFlags, DWORD dwTimeout, PCRYPT_BLOB_ARRAY pObject, PFN_FREE_ENCODED_OBJECT_FUNC *ppfnFreeObject, void **ppvFreeContext, HCRYPTASYNC hAsyncRetrieve, PCRYPT_CREDENTIALS pCredentials, PCRYPT_RETRIEVE_AUX_INFO pAuxInfo)
#define SetLastError(x)
Definition: compat.h:418
GLenum GLenum GLuint components
Definition: glext.h:9620
int ret
GLenum GLsizei len
Definition: glext.h:6722
VOID WINAPI CryptMemFree(LPVOID pv)
Definition: main.c:141
BOOL WINAPI InternetCrackUrlW(const WCHAR *lpszUrl, DWORD dwUrlLength, DWORD dwFlags, URL_COMPONENTSW *lpUC)
Definition: internet.c:1644
BOOL WINAPI CryptGetOIDFunctionAddress(HCRYPTOIDFUNCSET hFuncSet, DWORD dwEncodingType, LPCSTR pszOID, DWORD dwFlags, void **ppvFuncAddr, HCRYPTOIDFUNCADDR *phFuncAddr)
Definition: oid.c:387
Definition: _set.h:46
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13

Referenced by CryptRetrieveObjectByUrlW().

◆ CRYPT_GetUrlFromCertificateCRLDistPoint()

static BOOL WINAPI CRYPT_GetUrlFromCertificateCRLDistPoint ( LPCSTR  pszUrlOid,
LPVOID  pvPara,
DWORD  dwFlags,
PCRYPT_URL_ARRAY  pUrlArray,
DWORD pcbUrlArray,
PCRYPT_URL_INFO  pUrlInfo,
DWORD pcbUrlInfo,
LPVOID  pvReserved 
)
static

Definition at line 325 of file cryptnet_main.c.

328 {
331  BOOL ret = FALSE;
332 
333  /* The only applicable flag is CRYPT_GET_URL_FROM_EXTENSION */
335  {
337  return FALSE;
338  }
340  cert->pCertInfo->cExtension, cert->pCertInfo->rgExtension)))
341  ret = CRYPT_GetUrlFromCRLDistPointsExt(&ext->Value, pUrlArray,
342  pcbUrlArray, pUrlInfo, pcbUrlInfo);
343  else
345  return ret;
346 }
#define CRYPT_E_NOT_FOUND
Definition: winerror.h:3007
unsigned int BOOL
Definition: ntddk_ex.h:94
char ext[3]
Definition: mkdosfs.c:358
static BYTE cert[]
Definition: msg.c:1437
#define szOID_CRL_DIST_POINTS
Definition: wincrypt.h:3196
static BOOL CRYPT_GetUrlFromCRLDistPointsExt(const CRYPT_DATA_BLOB *value, PCRYPT_URL_ARRAY pUrlArray, DWORD *pcbUrlArray, PCRYPT_URL_INFO pUrlInfo, DWORD *pcbUrlInfo)
#define SetLastError(x)
Definition: compat.h:418
PCERT_EXTENSION WINAPI CertFindExtension(LPCSTR pszObjId, DWORD cExtensions, CERT_EXTENSION rgExtensions[])
Definition: cert.c:2028
#define CRYPT_GET_URL_FROM_EXTENSION
Definition: wincrypt.h:3479
int ret
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
_In_ void * pvPara
Definition: wincrypt.h:6077

Referenced by CryptGetObjectUrl().

◆ CRYPT_GetUrlFromCertificateIssuer()

static BOOL WINAPI CRYPT_GetUrlFromCertificateIssuer ( LPCSTR  pszUrlOid,
LPVOID  pvPara,
DWORD  dwFlags,
PCRYPT_URL_ARRAY  pUrlArray,
DWORD pcbUrlArray,
PCRYPT_URL_INFO  pUrlInfo,
DWORD pcbUrlInfo,
LPVOID  pvReserved 
)
static

Definition at line 103 of file cryptnet_main.c.

106 {
109  BOOL ret = FALSE;
110 
111  /* The only applicable flag is CRYPT_GET_URL_FROM_EXTENSION */
113  {
115  return FALSE;
116  }
118  cert->pCertInfo->cExtension, cert->pCertInfo->rgExtension)))
119  {
121  DWORD size;
122 
124  ext->Value.pbData, ext->Value.cbData, CRYPT_DECODE_ALLOC_FLAG, NULL,
125  &aia, &size);
126  if (ret)
127  {
128  DWORD i, cUrl, bytesNeeded = sizeof(CRYPT_URL_ARRAY);
129 
130  for (i = 0, cUrl = 0; i < aia->cAccDescr; i++)
131  if (!strcmp(aia->rgAccDescr[i].pszAccessMethod,
133  {
134  if (aia->rgAccDescr[i].AccessLocation.dwAltNameChoice ==
136  {
137  if (aia->rgAccDescr[i].AccessLocation.u.pwszURL)
138  {
139  cUrl++;
140  bytesNeeded += sizeof(LPWSTR) +
141  (lstrlenW(aia->rgAccDescr[i].AccessLocation.u.
142  pwszURL) + 1) * sizeof(WCHAR);
143  }
144  }
145  else
146  FIXME("unsupported alt name type %d\n",
147  aia->rgAccDescr[i].AccessLocation.dwAltNameChoice);
148  }
149  if (!pcbUrlArray)
150  {
152  ret = FALSE;
153  }
154  else if (!pUrlArray)
155  *pcbUrlArray = bytesNeeded;
156  else if (*pcbUrlArray < bytesNeeded)
157  {
159  *pcbUrlArray = bytesNeeded;
160  ret = FALSE;
161  }
162  else
163  {
164  LPWSTR nextUrl;
165 
166  *pcbUrlArray = bytesNeeded;
167  pUrlArray->cUrl = 0;
168  pUrlArray->rgwszUrl =
169  (LPWSTR *)((BYTE *)pUrlArray + sizeof(CRYPT_URL_ARRAY));
170  nextUrl = (LPWSTR)((BYTE *)pUrlArray + sizeof(CRYPT_URL_ARRAY)
171  + cUrl * sizeof(LPWSTR));
172  for (i = 0; i < aia->cAccDescr; i++)
173  if (!strcmp(aia->rgAccDescr[i].pszAccessMethod,
175  {
176  if (aia->rgAccDescr[i].AccessLocation.dwAltNameChoice
178  {
179  if (aia->rgAccDescr[i].AccessLocation.u.pwszURL)
180  {
181  lstrcpyW(nextUrl,
182  aia->rgAccDescr[i].AccessLocation.u.pwszURL);
183  pUrlArray->rgwszUrl[pUrlArray->cUrl++] =
184  nextUrl;
185  nextUrl += (lstrlenW(nextUrl) + 1);
186  }
187  }
188  }
189  }
190  if (ret)
191  {
192  if (pcbUrlInfo)
193  {
194  FIXME("url info: stub\n");
195  if (!pUrlInfo)
196  *pcbUrlInfo = sizeof(CRYPT_URL_INFO);
197  else if (*pcbUrlInfo < sizeof(CRYPT_URL_INFO))
198  {
199  *pcbUrlInfo = sizeof(CRYPT_URL_INFO);
201  ret = FALSE;
202  }
203  else
204  {
205  *pcbUrlInfo = sizeof(CRYPT_URL_INFO);
206  memset(pUrlInfo, 0, sizeof(CRYPT_URL_INFO));
207  }
208  }
209  }
210  LocalFree(aia);
211  }
212  }
213  else
215  return ret;
216 }
#define CRYPT_E_NOT_FOUND
Definition: winerror.h:3007
BOOL WINAPI CryptDecodeObjectEx(DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
Definition: decode.c:6286
struct _CRYPT_URL_ARRAY CRYPT_URL_ARRAY
struct _CRYPT_URL_INFO CRYPT_URL_INFO
#define CERT_ALT_NAME_URL
Definition: wincrypt.h:351
#define lstrlenW
Definition: compat.h:416
#define X509_ASN_ENCODING
Definition: wincrypt.h:2297
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
unsigned int BOOL
Definition: ntddk_ex.h:94
#define FIXME(fmt,...)
Definition: debug.h:111
#define X509_AUTHORITY_INFO_ACCESS
Definition: wincrypt.h:3399
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
char ext[3]
Definition: mkdosfs.c:358
static BYTE cert[]
Definition: msg.c:1437
#define szOID_AUTHORITY_INFO_ACCESS
Definition: wincrypt.h:3290
GLsizeiptr size
Definition: glext.h:5919
__wchar_t WCHAR
Definition: xmlstorage.h:180
LPWSTR * rgwszUrl
Definition: wincrypt.h:1514
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:418
PCERT_EXTENSION WINAPI CertFindExtension(LPCSTR pszObjId, DWORD cExtensions, CERT_EXTENSION rgExtensions[])
Definition: cert.c:2028
#define CRYPT_GET_URL_FROM_EXTENSION
Definition: wincrypt.h:3479
int ret
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define ERROR_MORE_DATA
Definition: dderror.h:13
unsigned char BYTE
Definition: xxhash.c:193
#define lstrcpyW
Definition: compat.h:415
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define szOID_PKIX_CA_ISSUERS
Definition: wincrypt.h:3327
static WCHAR aia[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1601
#define CRYPT_DECODE_ALLOC_FLAG
Definition: wincrypt.h:3454
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
_In_ void * pvPara
Definition: wincrypt.h:6077
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define memset(x, y, z)
Definition: compat.h:39

Referenced by CryptGetObjectUrl().

◆ CRYPT_GetUrlFromCRLDistPointsExt()

static BOOL CRYPT_GetUrlFromCRLDistPointsExt ( const CRYPT_DATA_BLOB value,
PCRYPT_URL_ARRAY  pUrlArray,
DWORD pcbUrlArray,
PCRYPT_URL_INFO  pUrlInfo,
DWORD pcbUrlInfo 
)
static

Definition at line 218 of file cryptnet_main.c.

221 {
222  BOOL ret;
224  DWORD size;
225 
227  value->pbData, value->cbData, CRYPT_DECODE_ALLOC_FLAG, NULL, &info, &size);
228  if (ret)
229  {
230  DWORD i, cUrl, bytesNeeded = sizeof(CRYPT_URL_ARRAY);
231 
232  for (i = 0, cUrl = 0; i < info->cDistPoint; i++)
233  if (info->rgDistPoint[i].DistPointName.dwDistPointNameChoice
235  {
236  DWORD j;
238  &info->rgDistPoint[i].DistPointName.u.FullName;
239 
240  for (j = 0; j < name->cAltEntry; j++)
241  if (name->rgAltEntry[j].dwAltNameChoice ==
243  {
244  if (name->rgAltEntry[j].u.pwszURL)
245  {
246  cUrl++;
247  bytesNeeded += sizeof(LPWSTR) +
248  (lstrlenW(name->rgAltEntry[j].u.pwszURL) + 1)
249  * sizeof(WCHAR);
250  }
251  }
252  }
253  if (!pcbUrlArray)
254  {
256  ret = FALSE;
257  }
258  else if (!pUrlArray)
259  *pcbUrlArray = bytesNeeded;
260  else if (*pcbUrlArray < bytesNeeded)
261  {
263  *pcbUrlArray = bytesNeeded;
264  ret = FALSE;
265  }
266  else
267  {
268  LPWSTR nextUrl;
269 
270  *pcbUrlArray = bytesNeeded;
271  pUrlArray->cUrl = 0;
272  pUrlArray->rgwszUrl =
273  (LPWSTR *)((BYTE *)pUrlArray + sizeof(CRYPT_URL_ARRAY));
274  nextUrl = (LPWSTR)((BYTE *)pUrlArray + sizeof(CRYPT_URL_ARRAY)
275  + cUrl * sizeof(LPWSTR));
276  for (i = 0; i < info->cDistPoint; i++)
277  if (info->rgDistPoint[i].DistPointName.dwDistPointNameChoice
279  {
280  DWORD j;
282  &info->rgDistPoint[i].DistPointName.u.FullName;
283 
284  for (j = 0; j < name->cAltEntry; j++)
285  if (name->rgAltEntry[j].dwAltNameChoice ==
287  {
288  if (name->rgAltEntry[j].u.pwszURL)
289  {
290  lstrcpyW(nextUrl,
291  name->rgAltEntry[j].u.pwszURL);
292  pUrlArray->rgwszUrl[pUrlArray->cUrl++] =
293  nextUrl;
294  nextUrl +=
295  (lstrlenW(name->rgAltEntry[j].u.pwszURL) + 1);
296  }
297  }
298  }
299  }
300  if (ret)
301  {
302  if (pcbUrlInfo)
303  {
304  FIXME("url info: stub\n");
305  if (!pUrlInfo)
306  *pcbUrlInfo = sizeof(CRYPT_URL_INFO);
307  else if (*pcbUrlInfo < sizeof(CRYPT_URL_INFO))
308  {
309  *pcbUrlInfo = sizeof(CRYPT_URL_INFO);
311  ret = FALSE;
312  }
313  else
314  {
315  *pcbUrlInfo = sizeof(CRYPT_URL_INFO);
316  memset(pUrlInfo, 0, sizeof(CRYPT_URL_INFO));
317  }
318  }
319  }
320  LocalFree(info);
321  }
322  return ret;
323 }
BOOL WINAPI CryptDecodeObjectEx(DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
Definition: decode.c:6286
struct _CRYPT_URL_ARRAY CRYPT_URL_ARRAY
struct _CRYPT_URL_INFO CRYPT_URL_INFO
#define CERT_ALT_NAME_URL
Definition: wincrypt.h:351
#define lstrlenW
Definition: compat.h:416
struct _test_info info[]
Definition: SetCursorPos.c:19
#define X509_ASN_ENCODING
Definition: wincrypt.h:2297
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
unsigned int BOOL
Definition: ntddk_ex.h:94
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
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
GLsizeiptr size
Definition: glext.h:5919
#define CRL_DIST_POINT_FULL_NAME
Definition: wincrypt.h:514
__wchar_t WCHAR
Definition: xmlstorage.h:180
LPWSTR * rgwszUrl
Definition: wincrypt.h:1514
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:418
int ret
#define ERROR_MORE_DATA
Definition: dderror.h:13
unsigned char BYTE
Definition: xxhash.c:193
#define lstrcpyW
Definition: compat.h:415
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
Definition: name.c:38
#define CRYPT_DECODE_ALLOC_FLAG
Definition: wincrypt.h:3454
#define X509_CRL_DIST_POINTS
Definition: wincrypt.h:3402
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define memset(x, y, z)
Definition: compat.h:39

Referenced by CRYPT_GetUrlFromCertificateCRLDistPoint(), and verify_cert_revocation_from_dist_points_ext().

◆ CRYPT_InetStatusCallback()

static void CALLBACK CRYPT_InetStatusCallback ( HINTERNET  hInt,
DWORD_PTR  dwContext,
DWORD  status,
void statusInfo,
DWORD  statusInfoLen 
)
static

Definition at line 775 of file cryptnet_main.c.

777 {
778  struct InetContext *context = (struct InetContext *)dwContext;
780 
781  switch (status)
782  {
784  result = statusInfo;
785  context->error = result->dwError;
787  }
788 }
Definition: http.c:7094
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
HANDLE event
Definition: http.c:7096
#define INTERNET_STATUS_REQUEST_COMPLETE
Definition: wininet.h:898
GLuint64EXT * result
Definition: glext.h:11304
Definition: ps.c:97

Referenced by CRYPT_Connect().

◆ CRYPT_MakeInetContext()

static struct InetContext* CRYPT_MakeInetContext ( DWORD  dwTimeout)
static

Definition at line 610 of file cryptnet_main.c.

611 {
612  struct InetContext *context = CryptMemAlloc(sizeof(struct InetContext));
613 
614  if (context)
615  {
617  if (!context->event)
618  {
620  context = NULL;
621  }
622  else
623  {
624  context->timeout = dwTimeout;
625  context->error = ERROR_SUCCESS;
626  }
627  }
628  return context;
629 }
#define ERROR_SUCCESS
Definition: deptool.c:10
Definition: http.c:7094
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:651
LPVOID WINAPI CryptMemAlloc(ULONG cbSize)
Definition: main.c:131
HANDLE event
Definition: http.c:7096
smooth NULL
Definition: ftsmooth.c:416
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD dwTimeout
Definition: wincrypt.h:6077
VOID WINAPI CryptMemFree(LPVOID pv)
Definition: main.c:141

Referenced by HTTP_RetrieveEncodedObjectW().

◆ CryptGetObjectUrl()

BOOL WINAPI CryptGetObjectUrl ( LPCSTR  pszUrlOid,
LPVOID  pvPara,
DWORD  dwFlags,
PCRYPT_URL_ARRAY  pUrlArray,
DWORD pcbUrlArray,
PCRYPT_URL_INFO  pUrlInfo,
DWORD pcbUrlInfo,
LPVOID  pvReserved 
)

Definition at line 351 of file cryptnet_main.c.

354 {
356  HCRYPTOIDFUNCADDR hFunc = NULL;
357  BOOL ret = FALSE;
358 
359  TRACE("(%s, %p, %08x, %p, %p, %p, %p, %p)\n", debugstr_a(pszUrlOid),
360  pvPara, dwFlags, pUrlArray, pcbUrlArray, pUrlInfo, pcbUrlInfo, pvReserved);
361 
362  if (IS_INTOID(pszUrlOid))
363  {
364  switch (LOWORD(pszUrlOid))
365  {
368  break;
371  break;
372  default:
373  FIXME("unimplemented for %s\n", url_oid_to_str(pszUrlOid));
375  }
376  }
377  else
378  {
379  static HCRYPTOIDFUNCSET set = NULL;
380 
381  if (!set)
384  (void **)&func, &hFunc);
385  }
386  if (func)
387  ret = func(pszUrlOid, pvPara, dwFlags, pUrlArray, pcbUrlArray,
388  pUrlInfo, pcbUrlInfo, pvReserved);
389  if (hFunc)
390  CryptFreeOIDFunctionAddress(hFunc, 0);
391  return ret;
392 }
GLenum func
Definition: glext.h:6028
HCRYPTOIDFUNCSET WINAPI CryptInitOIDFunctionSet(LPCSTR pszFuncName, DWORD dwFlags)
Definition: oid.c:114
#define X509_ASN_ENCODING
Definition: wincrypt.h:2297
#define URL_OID_CERTIFICATE_ISSUER
Definition: wincrypt.h:1524
unsigned int BOOL
Definition: ntddk_ex.h:94
#define FIXME(fmt,...)
Definition: debug.h:111
smooth NULL
Definition: ftsmooth.c:416
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
static const char * url_oid_to_str(LPCSTR oid)
Definition: cryptnet_main.c:73
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
static LPCSTR DWORD void * pvReserved
Definition: str.c:196
static BOOL WINAPI CRYPT_GetUrlFromCertificateCRLDistPoint(LPCSTR pszUrlOid, LPVOID pvPara, DWORD dwFlags, PCRYPT_URL_ARRAY pUrlArray, DWORD *pcbUrlArray, PCRYPT_URL_INFO pUrlInfo, DWORD *pcbUrlInfo, LPVOID pvReserved)
#define URL_OID_CERTIFICATE_CRL_DIST_POINT
Definition: wincrypt.h:1525
#define SetLastError(x)
Definition: compat.h:418
int ret
#define URL_OID_GET_OBJECT_URL_FUNC
Definition: wincrypt.h:2509
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
static BOOL WINAPI CRYPT_GetUrlFromCertificateIssuer(LPCSTR pszUrlOid, LPVOID pvPara, DWORD dwFlags, PCRYPT_URL_ARRAY pUrlArray, DWORD *pcbUrlArray, PCRYPT_URL_INFO pUrlInfo, DWORD *pcbUrlInfo, LPVOID pvReserved)
#define IS_INTOID(x)
Definition: cryptnet_main.c:39
BOOL WINAPI CryptFreeOIDFunctionAddress(HCRYPTOIDFUNCADDR hFuncAddr, DWORD dwFlags)
Definition: oid.c:468
BOOL WINAPI CryptGetOIDFunctionAddress(HCRYPTOIDFUNCSET hFuncSet, DWORD dwEncodingType, LPCSTR pszOID, DWORD dwFlags, void **ppvFuncAddr, HCRYPTOIDFUNCADDR *phFuncAddr)
Definition: oid.c:387
_In_ void * pvPara
Definition: wincrypt.h:6077
BOOL(WINAPI * UrlDllGetObjectUrlFunc)(LPCSTR, LPVOID, DWORD, PCRYPT_URL_ARRAY, DWORD *, PCRYPT_URL_INFO, DWORD *, LPVOID)
Definition: _set.h:46
#define LOWORD(l)
Definition: pedump.c:82

Referenced by CRYPT_FindIssuer(), and test_getObjectUrl().

◆ CryptRetrieveObjectByUrlA()

BOOL WINAPI CryptRetrieveObjectByUrlA ( LPCSTR  pszURL,
LPCSTR  pszObjectOid,
DWORD  dwRetrievalFlags,
DWORD  dwTimeout,
LPVOID ppvObject,
HCRYPTASYNC  hAsyncRetrieve,
PCRYPT_CREDENTIALS  pCredentials,
LPVOID  pvVerify,
PCRYPT_RETRIEVE_AUX_INFO  pAuxInfo 
)

Definition at line 397 of file cryptnet_main.c.

401 {
402  BOOL ret = FALSE;
403  int len;
404 
405  TRACE("(%s, %s, %08x, %d, %p, %p, %p, %p, %p)\n", debugstr_a(pszURL),
408 
409  if (!pszURL)
410  {
412  return FALSE;
413  }
414  len = MultiByteToWideChar(CP_ACP, 0, pszURL, -1, NULL, 0);
415  if (len)
416  {
417  LPWSTR url = CryptMemAlloc(len * sizeof(WCHAR));
418 
419  if (url)
420  {
421  MultiByteToWideChar(CP_ACP, 0, pszURL, -1, url, len);
425  CryptMemFree(url);
426  }
427  else
429  }
430  return ret;
431 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define CP_ACP
Definition: compat.h:99
LPVOID WINAPI CryptMemAlloc(ULONG cbSize)
Definition: main.c:131
_In_opt_ LPCSTR _In_ DWORD _In_ DWORD _Outptr_ LPVOID _In_opt_ HCRYPTASYNC _In_opt_ PCRYPT_CREDENTIALS _In_opt_ LPVOID pvVerify
Definition: wincrypt.h:6114
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI CryptRetrieveObjectByUrlW(LPCWSTR pszURL, LPCSTR pszObjectOid, DWORD dwRetrievalFlags, DWORD dwTimeout, LPVOID *ppvObject, HCRYPTASYNC hAsyncRetrieve, PCRYPT_CREDENTIALS pCredentials, LPVOID pvVerify, PCRYPT_RETRIEVE_AUX_INFO pAuxInfo)
smooth NULL
Definition: ftsmooth.c:416
_In_opt_ LPCSTR _In_ DWORD _In_ DWORD _Outptr_ LPVOID _In_opt_ HCRYPTASYNC hAsyncRetrieve
Definition: wincrypt.h:6114
_In_opt_ LPCSTR pszObjectOid
Definition: wincrypt.h:6114
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
static const WCHAR url[]
Definition: encode.c:1432
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD _Outptr_opt_ void _In_opt_ PCRYPT_CREDENTIALS pCredentials
Definition: wincrypt.h:6077
#define SetLastError(x)
Definition: compat.h:418
int ret
GLenum GLsizei len
Definition: glext.h:6722
REFIID LPVOID * ppvObject
Definition: precomp.h:44
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD dwTimeout
Definition: wincrypt.h:6077
_In_opt_ LPCSTR _In_ DWORD _In_ DWORD _Outptr_ LPVOID _In_opt_ HCRYPTASYNC _In_opt_ PCRYPT_CREDENTIALS _In_opt_ LPVOID _Inout_opt_ PCRYPT_RETRIEVE_AUX_INFO pAuxInfo
Definition: wincrypt.h:6114
_In_opt_ LPCSTR _In_ DWORD dwRetrievalFlags
Definition: wincrypt.h:6114
#define MultiByteToWideChar
Definition: compat.h:100
VOID WINAPI CryptMemFree(LPVOID pv)
Definition: main.c:141
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13

Referenced by test_retrieveObjectByUrl().

◆ CryptRetrieveObjectByUrlW()

BOOL WINAPI CryptRetrieveObjectByUrlW ( LPCWSTR  pszURL,
LPCSTR  pszObjectOid,
DWORD  dwRetrievalFlags,
DWORD  dwTimeout,
LPVOID ppvObject,
HCRYPTASYNC  hAsyncRetrieve,
PCRYPT_CREDENTIALS  pCredentials,
LPVOID  pvVerify,
PCRYPT_RETRIEVE_AUX_INFO  pAuxInfo 
)

Definition at line 1489 of file cryptnet_main.c.

1493 {
1494  BOOL ret;
1497  HCRYPTOIDFUNCADDR hRetrieve = 0, hCreate = 0;
1498 
1499  TRACE("(%s, %s, %08x, %d, %p, %p, %p, %p, %p)\n", debugstr_w(pszURL),
1502 
1503  if (!pszURL)
1504  {
1506  return FALSE;
1507  }
1508  ret = CRYPT_GetRetrieveFunction(pszURL, &retrieve, &hRetrieve);
1509  if (ret)
1511  if (ret)
1512  {
1513  CRYPT_BLOB_ARRAY object = { 0, NULL };
1514  PFN_FREE_ENCODED_OBJECT_FUNC freeObject;
1515  void *freeContext;
1516  FILETIME expires;
1517 
1518  ret = retrieve(pszURL, pszObjectOid, dwRetrievalFlags, dwTimeout,
1519  &object, &freeObject, &freeContext, hAsyncRetrieve, pCredentials,
1520  pAuxInfo);
1521  if (ret)
1522  {
1526  {
1527  CRYPT_CacheURL(pszURL, &object, dwRetrievalFlags, expires);
1528  }
1529  freeObject(pszObjectOid, &object, freeContext);
1530  }
1531  }
1532  if (hCreate)
1533  CryptFreeOIDFunctionAddress(hCreate, 0);
1534  if (hRetrieve)
1535  CryptFreeOIDFunctionAddress(hRetrieve, 0);
1536  TRACE("returning %d\n", ret);
1537  return ret;
1538 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
BOOL(WINAPI * ContextDllCreateObjectContext)(LPCSTR pszObjectOid, DWORD dwRetrievalFlags, const CRYPT_BLOB_ARRAY *pObject, void **ppvContext)
static BOOL CRYPT_GetCreateFunction(LPCSTR pszObjectOid, ContextDllCreateObjectContext *pFunc, HCRYPTOIDFUNCADDR *phFunc)
_In_opt_ LPCSTR _In_ DWORD _In_ DWORD _Outptr_ LPVOID _In_opt_ HCRYPTASYNC _In_opt_ PCRYPT_CREDENTIALS _In_opt_ LPVOID pvVerify
Definition: wincrypt.h:6114
unsigned int BOOL
Definition: ntddk_ex.h:94
#define debugstr_w
Definition: kernel32.h:32
void(WINAPI * PFN_FREE_ENCODED_OBJECT_FUNC)(_In_opt_ LPCSTR pszObjectOid, _Inout_ PCRYPT_BLOB_ARRAY pObject, _Inout_opt_ void *pvFreeContext)
Definition: wincrypt.h:1604
smooth NULL
Definition: ftsmooth.c:416
_In_opt_ LPCSTR _In_ DWORD _In_ DWORD _Outptr_ LPVOID _In_opt_ HCRYPTASYNC hAsyncRetrieve
Definition: wincrypt.h:6114
_In_opt_ LPCSTR pszObjectOid
Definition: wincrypt.h:6114
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD _Outptr_opt_ void _In_opt_ PCRYPT_CREDENTIALS pCredentials
Definition: wincrypt.h:6077
#define SetLastError(x)
Definition: compat.h:418
int ret
static BOOL CRYPT_GetExpiration(const void *object, const char *pszObjectOid, FILETIME *expiration)
REFIID LPVOID * ppvObject
Definition: precomp.h:44
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD dwTimeout
Definition: wincrypt.h:6077
_In_opt_ LPCSTR _In_ DWORD _In_ DWORD _Outptr_ LPVOID _In_opt_ HCRYPTASYNC _In_opt_ PCRYPT_CREDENTIALS _In_opt_ LPVOID _Inout_opt_ PCRYPT_RETRIEVE_AUX_INFO pAuxInfo
Definition: wincrypt.h:6114
BOOL WINAPI CryptFreeOIDFunctionAddress(HCRYPTOIDFUNCADDR hFuncAddr, DWORD dwFlags)
Definition: oid.c:468
_In_opt_ LPCSTR _In_ DWORD dwRetrievalFlags
Definition: wincrypt.h:6114
#define CRYPT_DONT_CACHE_RESULT
Definition: wincrypt.h:1636
BOOL(WINAPI * SchemeDllRetrieveEncodedObjectW)(LPCWSTR pwszUrl, LPCSTR pszObjectOid, DWORD dwRetrievalFlags, DWORD dwTimeout, PCRYPT_BLOB_ARRAY pObject, PFN_FREE_ENCODED_OBJECT_FUNC *ppfnFreeObject, void **ppvFreeContext, HCRYPTASYNC hAsyncRetrieve, PCRYPT_CREDENTIALS pCredentials, PCRYPT_RETRIEVE_AUX_INFO pAuxInfo)
static void CRYPT_CacheURL(LPCWSTR pszURL, const CRYPT_BLOB_ARRAY *pObject, DWORD dwRetrievalFlags, FILETIME expires)
static BOOL CRYPT_GetRetrieveFunction(LPCWSTR pszURL, SchemeDllRetrieveEncodedObjectW *pFunc, HCRYPTOIDFUNCADDR *phFunc)
static const struct access_res create[16]
Definition: package.c:7720

Referenced by CRYPT_FindIssuer(), CryptRetrieveObjectByUrlA(), and verify_cert_revocation_from_dist_points_ext().

◆ decode_base64_blob()

static BOOL decode_base64_blob ( const CRYPT_DATA_BLOB in,
CRYPT_DATA_BLOB out 
)
static

Definition at line 1187 of file cryptnet_main.c.

1188 {
1189  BOOL ret;
1190  DWORD len = in->cbData;
1191 
1192  while (len && !in->pbData[len - 1]) len--;
1193  if (!CryptStringToBinaryA( (char *)in->pbData, len, CRYPT_STRING_BASE64_ANY,
1194  NULL, &out->cbData, NULL, NULL )) return FALSE;
1195 
1196  if (!(out->pbData = CryptMemAlloc( out->cbData ))) return FALSE;
1197  ret = CryptStringToBinaryA( (char *)in->pbData, len, CRYPT_STRING_BASE64_ANY,
1198  out->pbData, &out->cbData, NULL, NULL );
1199  if (!ret) CryptMemFree( out->pbData );
1200  return ret;
1201 }
#define CRYPT_STRING_BASE64_ANY
Definition: wincrypt.h:2990
LPVOID WINAPI CryptMemAlloc(ULONG cbSize)
Definition: main.c:131
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI CryptStringToBinaryA(LPCSTR pszString, DWORD cchString, DWORD dwFlags, BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip, DWORD *pdwFlags)
Definition: base64.c:772
static FILE * out
Definition: regtests2xml.c:44
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
GLenum GLsizei len
Definition: glext.h:6722
GLuint in
Definition: glext.h:9616
VOID WINAPI CryptMemFree(LPVOID pv)
Definition: main.c:141

Referenced by CRYPT_CreateContext().

◆ DllRegisterServer()

HRESULT WINAPI DllRegisterServer ( void  )

Definition at line 47 of file cryptnet_main.c.

48 {
49  TRACE("\n");
53  cryptNet, "LdapProvOpenStore");
55  CERT_STORE_PROV_LDAP_W, cryptNet, "LdapProvOpenStore");
56  return S_OK;
57 }
BOOL WINAPI CryptRegisterOIDFunction(DWORD dwEncodingType, LPCSTR pszFuncName, LPCSTR pszOID, LPCWSTR pwszDll, LPCSTR pszOverrideFuncName)
Definition: oid.c:647
#define X509_ASN_ENCODING
Definition: wincrypt.h:2297
#define CRYPT_OID_VERIFY_REVOCATION_FUNC
Definition: wincrypt.h:2497
#define TRACE(s)
Definition: solgame.cpp:4
#define CRYPT_OID_OPEN_STORE_PROV_FUNC
Definition: wincrypt.h:2491
#define S_OK
Definition: intsafe.h:59
BOOL WINAPI CryptRegisterDefaultOIDFunction(DWORD dwEncodingType, LPCSTR pszFuncName, DWORD dwIndex, LPCWSTR pwszDll)
Definition: oid.c:1109
#define CERT_STORE_PROV_LDAP_W
Definition: wincrypt.h:2269
static const WCHAR cryptNet[]
Definition: cryptnet_main.c:41

◆ DllUnregisterServer()

HRESULT WINAPI DllUnregisterServer ( void  )

Definition at line 62 of file cryptnet_main.c.

63 {
64  TRACE("\n");
70  return S_OK;
71 }
BOOL WINAPI CryptUnregisterDefaultOIDFunction(DWORD dwEncodingType, LPCSTR pszFuncName, LPCWSTR pwszDll)
Definition: oid.c:1142
#define X509_ASN_ENCODING
Definition: wincrypt.h:2297
#define CRYPT_OID_VERIFY_REVOCATION_FUNC
Definition: wincrypt.h:2497
#define TRACE(s)
Definition: solgame.cpp:4
BOOL WINAPI CryptUnregisterOIDFunction(DWORD dwEncodingType, LPCSTR pszFuncName, LPCSTR pszOID)
Definition: oid.c:831
#define CRYPT_OID_OPEN_STORE_PROV_FUNC
Definition: wincrypt.h:2491
#define S_OK
Definition: intsafe.h:59
#define CERT_STORE_PROV_LDAP_W
Definition: wincrypt.h:2269
static const WCHAR cryptNet[]
Definition: cryptnet_main.c:41

◆ File_RetrieveEncodedObjectW()

static BOOL WINAPI File_RetrieveEncodedObjectW ( LPCWSTR  pszURL,
LPCSTR  pszObjectOid,
DWORD  dwRetrievalFlags,
DWORD  dwTimeout,
PCRYPT_BLOB_ARRAY  pObject,
PFN_FREE_ENCODED_OBJECT_FUNC ppfnFreeObject,
void **  ppvFreeContext,
HCRYPTASYNC  hAsyncRetrieve,
PCRYPT_CREDENTIALS  pCredentials,
PCRYPT_RETRIEVE_AUX_INFO  pAuxInfo 
)
static

Definition at line 980 of file cryptnet_main.c.

985 {
986  URL_COMPONENTSW components = { sizeof(components), 0 };
987  BOOL ret;
988 
989  TRACE("(%s, %s, %08x, %d, %p, %p, %p, %p, %p, %p)\n", debugstr_w(pszURL),
991  ppfnFreeObject, ppvFreeContext, hAsyncRetrieve, pCredentials, pAuxInfo);
992 
993  pObject->cBlob = 0;
994  pObject->rgBlob = NULL;
995  *ppfnFreeObject = CRYPT_FreeBlob;
996  *ppvFreeContext = NULL;
997 
998  components.lpszUrlPath = CryptMemAlloc(INTERNET_MAX_PATH_LENGTH * sizeof(WCHAR));
999  components.dwUrlPathLength = INTERNET_MAX_PATH_LENGTH;
1000  if (!components.lpszUrlPath)
1001  {
1003  return FALSE;
1004  }
1005 
1006  ret = InternetCrackUrlW(pszURL, 0, ICU_DECODE, &components);
1007  if (ret)
1008  {
1009  LPWSTR path;
1010 
1011  /* 3 == lstrlenW(L"c:") + 1 */
1012  path = CryptMemAlloc((components.dwUrlPathLength + 3) * sizeof(WCHAR));
1013  if (path)
1014  {
1015  HANDLE hFile;
1016 
1017  /* Try to create the file directly - Wine handles / in pathnames */
1018  lstrcpynW(path, components.lpszUrlPath,
1019  components.dwUrlPathLength + 1);
1022 #ifdef __REACTOS__
1023  if ((hFile == INVALID_HANDLE_VALUE) && (lstrlenW(components.lpszUrlPath) > 1) && (components.lpszUrlPath[1] != ':'))
1024 #else
1025  if (hFile == INVALID_HANDLE_VALUE)
1026 #endif
1027  {
1028  /* Try again on the current drive */
1029  GetCurrentDirectoryW(components.dwUrlPathLength, path);
1030  if (path[1] == ':')
1031  {
1032  lstrcpynW(path + 2, components.lpszUrlPath,
1033  components.dwUrlPathLength + 1);
1036  }
1037  if (hFile == INVALID_HANDLE_VALUE)
1038  {
1039  /* Try again on the Windows drive */
1040  GetWindowsDirectoryW(path, components.dwUrlPathLength);
1041  if (path[1] == ':')
1042  {
1043  lstrcpynW(path + 2, components.lpszUrlPath,
1044  components.dwUrlPathLength + 1);
1047  }
1048  }
1049  }
1050  if (hFile != INVALID_HANDLE_VALUE)
1051  {
1052  if ((ret = CRYPT_GetObjectFromFile(hFile, pObject)))
1053  {
1054  if (pAuxInfo && pAuxInfo->cbSize >=
1056  pLastSyncTime) + sizeof(PFILETIME) &&
1057  pAuxInfo->pLastSyncTime)
1059  pAuxInfo->pLastSyncTime);
1060  }
1061  CloseHandle(hFile);
1062  }
1063  else
1064  ret = FALSE;
1065  CryptMemFree(path);
1066  }
1067  else
1068  {
1070  ret = FALSE;
1071  }
1072  }
1073  CryptMemFree(components.lpszUrlPath);
1074  return ret;
1075 }
#define CloseHandle
Definition: compat.h:407
GLsizei const GLchar ** path
Definition: glext.h:7234
#define GetCurrentDirectoryW(x, y)
Definition: compat.h:422
#define INVALID_HANDLE_VALUE
Definition: compat.h:400
#define lstrlenW
Definition: compat.h:416
#define FILE_SHARE_READ
Definition: compat.h:125
#define lstrcpynW
Definition: compat.h:406
UINT WINAPI GetWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2351
LPVOID WINAPI CryptMemAlloc(ULONG cbSize)
Definition: main.c:131
PCRYPT_DATA_BLOB rgBlob
Definition: wincrypt.h:1569
unsigned int BOOL
Definition: ntddk_ex.h:94
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define offsetof(TYPE, MEMBER)
_In_opt_ LPCSTR _In_ DWORD _In_ DWORD _Outptr_ LPVOID _In_opt_ HCRYPTASYNC hAsyncRetrieve
Definition: wincrypt.h:6114
#define OPEN_EXISTING
Definition: compat.h:435
_In_opt_ LPCSTR pszObjectOid
Definition: wincrypt.h:6114
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
static BOOL CRYPT_GetObjectFromFile(HANDLE hFile, PCRYPT_BLOB_ARRAY pObject)
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD _Outptr_opt_ void _In_opt_ PCRYPT_CREDENTIALS pCredentials
Definition: wincrypt.h:6077
#define SetLastError(x)
Definition: compat.h:418
GLenum GLenum GLuint components
Definition: glext.h:9620
int ret
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
#define GENERIC_READ
Definition: compat.h:124
_In_ HANDLE hFile
Definition: mswsock.h:90
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD dwTimeout
Definition: wincrypt.h:6077
_In_opt_ LPCSTR _In_ DWORD _In_ DWORD _Outptr_ LPVOID _In_opt_ HCRYPTASYNC _In_opt_ PCRYPT_CREDENTIALS _In_opt_ LPVOID _Inout_opt_ PCRYPT_RETRIEVE_AUX_INFO pAuxInfo
Definition: wincrypt.h:6114
#define INTERNET_MAX_PATH_LENGTH
Definition: wininet.h:49
_In_opt_ LPCSTR _In_ DWORD dwRetrievalFlags
Definition: wincrypt.h:6114
#define CreateFileW
Definition: compat.h:409
VOID WINAPI CryptMemFree(LPVOID pv)
Definition: main.c:141
BOOL WINAPI InternetCrackUrlW(const WCHAR *lpszUrl, DWORD dwUrlLength, DWORD dwFlags, URL_COMPONENTSW *lpUC)
Definition: internet.c:1644
#define ICU_DECODE
Definition: winhttp.h:291
WCHAR * LPWSTR
Definition: xmlstorage.h:184
static void WINAPI CRYPT_FreeBlob(LPCSTR pszObjectOid, PCRYPT_BLOB_ARRAY pObject, void *pvFreeContext)
BOOL WINAPI GetFileTime(IN HANDLE hFile, OUT LPFILETIME lpCreationTime OPTIONAL, OUT LPFILETIME lpLastAccessTime OPTIONAL, OUT LPFILETIME lpLastWriteTime OPTIONAL)
Definition: fileinfo.c:1046
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13

Referenced by CRYPT_GetRetrieveFunction().

◆ FTP_RetrieveEncodedObjectW()

static BOOL WINAPI FTP_RetrieveEncodedObjectW ( LPCWSTR  pszURL,
LPCSTR  pszObjectOid,
DWORD  dwRetrievalFlags,
DWORD  dwTimeout,
PCRYPT_BLOB_ARRAY  pObject,
PFN_FREE_ENCODED_OBJECT_FUNC ppfnFreeObject,
void **  ppvFreeContext,
HCRYPTASYNC  hAsyncRetrieve,
PCRYPT_CREDENTIALS  pCredentials,
PCRYPT_RETRIEVE_AUX_INFO  pAuxInfo 
)
static

Definition at line 837 of file cryptnet_main.c.

842 {
843  FIXME("(%s, %s, %08x, %d, %p, %p, %p, %p, %p, %p)\n", debugstr_w(pszURL),
845  ppfnFreeObject, ppvFreeContext, hAsyncRetrieve, pCredentials, pAuxInfo);
846 
847  pObject->cBlob = 0;
848  pObject->rgBlob = NULL;
849  *ppfnFreeObject = CRYPT_FreeBlob;
850  *ppvFreeContext = NULL;
851  return FALSE;
852 }
PCRYPT_DATA_BLOB rgBlob
Definition: wincrypt.h:1569
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:111
smooth NULL
Definition: ftsmooth.c:416
_In_opt_ LPCSTR _In_ DWORD _In_ DWORD _Outptr_ LPVOID _In_opt_ HCRYPTASYNC hAsyncRetrieve
Definition: wincrypt.h:6114
_In_opt_ LPCSTR pszObjectOid
Definition: wincrypt.h:6114
#define debugstr_a
Definition: kernel32.h:31
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD _Outptr_opt_ void _In_opt_ PCRYPT_CREDENTIALS pCredentials
Definition: wincrypt.h:6077
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD dwTimeout
Definition: wincrypt.h:6077
_In_opt_ LPCSTR _In_ DWORD _In_ DWORD _Outptr_ LPVOID _In_opt_ HCRYPTASYNC _In_opt_ PCRYPT_CREDENTIALS _In_opt_ LPVOID _Inout_opt_ PCRYPT_RETRIEVE_AUX_INFO pAuxInfo
Definition: wincrypt.h:6114
_In_opt_ LPCSTR _In_ DWORD dwRetrievalFlags
Definition: wincrypt.h:6114
static void WINAPI CRYPT_FreeBlob(LPCSTR pszObjectOid, PCRYPT_BLOB_ARRAY pObject, void *pvFreeContext)

Referenced by CRYPT_GetRetrieveFunction().

◆ HTTP_RetrieveEncodedObjectW()

static BOOL WINAPI HTTP_RetrieveEncodedObjectW ( LPCWSTR  pszURL,
LPCSTR  pszObjectOid,
DWORD  dwRetrievalFlags,
DWORD  dwTimeout,
PCRYPT_BLOB_ARRAY  pObject,
PFN_FREE_ENCODED_OBJECT_FUNC ppfnFreeObject,
void **  ppvFreeContext,
HCRYPTASYNC  hAsyncRetrieve,
PCRYPT_CREDENTIALS  pCredentials,
PCRYPT_RETRIEVE_AUX_INFO  pAuxInfo 
)
static

Definition at line 876 of file cryptnet_main.c.

881 {
882  BOOL ret = FALSE;
883 
884  TRACE("(%s, %s, %08x, %d, %p, %p, %p, %p, %p, %p)\n", debugstr_w(pszURL),
886  ppfnFreeObject, ppvFreeContext, hAsyncRetrieve, pCredentials, pAuxInfo);
887 
888  pObject->cBlob = 0;
889  pObject->rgBlob = NULL;
890  *ppfnFreeObject = CRYPT_FreeBlob;
891  *ppvFreeContext = NULL;
892 
894  ret = CRYPT_GetObjectFromCache(pszURL, pObject, pAuxInfo);
897  {
899 
900  if ((ret = CRYPT_CrackUrl(pszURL, &components)))
901  {
902  HINTERNET hInt, hHost;
903  struct InetContext *context = NULL;
904 
905  if (dwTimeout)
908  &hHost);
909  if (ret)
910  {
911  static LPCWSTR types[] = { x509cacert, x509emailcert,
913  pkcs7sig, pkcs7mime, NULL };
914  HINTERNET hHttp = HttpOpenRequestW(hHost, NULL,
915  components.lpszUrlPath, NULL, NULL, types,
917  (DWORD_PTR)context);
918 
919  if (hHttp)
920  {
921  if (dwTimeout)
922  {
923  InternetSetOptionW(hHttp,
925  sizeof(dwTimeout));
927  &dwTimeout, sizeof(dwTimeout));
928  }
929  ret = HttpSendRequestExW(hHttp, NULL, NULL, 0,
930  (DWORD_PTR)context);
931  if (!ret && GetLastError() == ERROR_IO_PENDING)
932  {
934  context->timeout) == WAIT_TIMEOUT)
936  else
937  ret = TRUE;
938  }
939  if (ret &&
940  !(ret = HttpEndRequestW(hHttp, NULL, 0, (DWORD_PTR)context)) &&
942  {
944  context->timeout) == WAIT_TIMEOUT)
946  else
947  ret = TRUE;
948  }
949  if (ret)
951  context, pObject, pAuxInfo);
953  {
954  SYSTEMTIME st;
955  FILETIME ft;
956  DWORD len = sizeof(st);
957 
959  &st, &len, NULL) && SystemTimeToFileTime(&st, &ft))
960  CRYPT_CacheURL(pszURL, pObject, dwRetrievalFlags, ft);
961  }
962  InternetCloseHandle(hHttp);
963  }
964  InternetCloseHandle(hHost);
965  InternetCloseHandle(hInt);
966  }
967  if (context)
968  {
971  }
972  CryptMemFree(components.lpszUrlPath);
973  CryptMemFree(components.lpszHostName);
974  }
975  }
976  TRACE("returning %d\n", ret);
977  return ret;
978 }
static BOOL CRYPT_CrackUrl(LPCWSTR pszURL, URL_COMPONENTSW *components)
#define INTERNET_OPTION_RECEIVE_TIMEOUT
Definition: wininet.h:706
#define HTTP_QUERY_EXPIRES
Definition: wininet.h:1533
static const WCHAR pkixCRL[]
static const WCHAR pkcs7mime[]
static struct InetContext * CRYPT_MakeInetContext(DWORD dwTimeout)
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:407
#define INTERNET_OPTION_SEND_TIMEOUT
Definition: wininet.h:704
#define CRYPT_CACHE_ONLY_RETRIEVAL
Definition: wincrypt.h:1634
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
static const WCHAR pkcs7CRL[]
Definition: http.c:7094
#define ERROR_TIMEOUT
Definition: winerror.h:941
BOOL WINAPI InternetSetOptionW(HINTERNET hInternet, DWORD dwOption, LPVOID lpBuffer, DWORD dwBufferLength)
Definition: internet.c:2714
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BOOL WINAPI InternetCloseHandle(HINTERNET hInternet)
Definition: internet.c:1436
#define ERROR_IO_PENDING
Definition: dderror.h:15
static const WCHAR x509emailcert[]
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
PCRYPT_DATA_BLOB rgBlob
Definition: wincrypt.h:1569
HANDLE event
Definition: http.c:7096
unsigned int BOOL
Definition: ntddk_ex.h:94
#define debugstr_w
Definition: kernel32.h:32
static const WCHAR pkcs7sig[]
static BOOL CRYPT_GetObjectFromCache(LPCWSTR pszURL, PCRYPT_BLOB_ARRAY pObject, PCRYPT_RETRIEVE_AUX_INFO pAuxInfo)
smooth NULL
Definition: ftsmooth.c:416
_In_opt_ LPCSTR _In_ DWORD _In_ DWORD _Outptr_ LPVOID _In_opt_ HCRYPTASYNC hAsyncRetrieve
Definition: wincrypt.h:6114
BOOL WINAPI HttpSendRequestExW(HINTERNET hRequest, LPINTERNET_BUFFERSW lpBuffersIn, LPINTERNET_BUFFERSW lpBuffersOut, DWORD dwFlags, DWORD_PTR dwContext)
Definition: http.c:5536
_In_opt_ LPCSTR pszObjectOid
Definition: wincrypt.h:6114
#define TRACE(s)
Definition: solgame.cpp:4
Definition: cmds.c:130
#define debugstr_a
Definition: kernel32.h:31
static BOOL CRYPT_Connect(const URL_COMPONENTSW *components, struct InetContext *context, PCRYPT_CREDENTIALS pCredentials, HINTERNET *phInt, HINTERNET *phHost)
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD _Outptr_opt_ void _In_opt_ PCRYPT_CREDENTIALS pCredentials
Definition: wincrypt.h:6077
BOOL WINAPI HttpEndRequestW(HINTERNET hRequest, LPINTERNET_BUFFERSW lpBuffersOut, DWORD dwFlags, DWORD_PTR dwContext)
Definition: http.c:5425
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR x509servercert[]
#define SetLastError(x)
Definition: compat.h:418
#define HTTP_QUERY_FLAG_SYSTEMTIME
Definition: wininet.h:1605
#define WAIT_TIMEOUT
Definition: dderror.h:14
GLenum GLenum GLuint components
Definition: glext.h:9620
int ret
BOOL WINAPI HttpQueryInfoW(HINTERNET hHttpRequest, DWORD dwInfoLevel, LPVOID lpBuffer, LPDWORD lpdwBufferLength, LPDWORD lpdwIndex)
Definition: http.c:3883
GLenum GLsizei len
Definition: glext.h:6722
uint32_t DWORD_PTR
Definition: typedefs.h:64
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD dwTimeout
Definition: wincrypt.h:6077
_In_opt_ LPCSTR _In_ DWORD _In_ DWORD _Outptr_ LPVOID _In_opt_ HCRYPTASYNC _In_opt_ PCRYPT_CREDENTIALS _In_opt_ LPVOID _Inout_opt_ PCRYPT_RETRIEVE_AUX_INFO pAuxInfo
Definition: wincrypt.h:6114
#define INTERNET_FLAG_NO_UI
Definition: wininet.h:84
BOOL WINAPI SystemTimeToFileTime(IN CONST SYSTEMTIME *lpSystemTime, OUT LPFILETIME lpFileTime)
Definition: time.c:158
_In_opt_ LPCSTR _In_ DWORD dwRetrievalFlags
Definition: wincrypt.h:6114
static const WCHAR x509cacert[]
static const WCHAR pkcs7cert[]
#define CRYPT_WIRE_ONLY_RETRIEVAL
Definition: wincrypt.h:1635
#define CRYPT_DONT_CACHE_RESULT
Definition: wincrypt.h:1636
#define INTERNET_FLAG_NO_COOKIES
Definition: wininet.h:75
static const WCHAR x509usercert[]
VOID WINAPI CryptMemFree(LPVOID pv)
Definition: main.c:141
static void CRYPT_CacheURL(LPCWSTR pszURL, const CRYPT_BLOB_ARRAY *pObject, DWORD dwRetrievalFlags, FILETIME expires)
HINTERNET WINAPI HttpOpenRequestW(HINTERNET hHttpSession, LPCWSTR lpszVerb, LPCWSTR lpszObjectName, LPCWSTR lpszVersion, LPCWSTR lpszReferrer, LPCWSTR *lpszAcceptTypes, DWORD dwFlags, DWORD_PTR dwContext)
Definition: http.c:3481
static void WINAPI CRYPT_FreeBlob(LPCSTR pszObjectOid, PCRYPT_BLOB_ARRAY pObject, void *pvFreeContext)
static BOOL CRYPT_DownloadObject(DWORD dwRetrievalFlags, HINTERNET hHttp, struct InetContext *context, PCRYPT_BLOB_ARRAY pObject, PCRYPT_RETRIEVE_AUX_INFO pAuxInfo)

Referenced by CRYPT_GetRetrieveFunction().

◆ url_oid_to_str()

static const char* url_oid_to_str ( LPCSTR  oid)
static

Definition at line 73 of file cryptnet_main.c.

74 {
75  if (IS_INTOID(oid))
76  {
77  static char buf[10];
78 
79  switch (LOWORD(oid))
80  {
81 #define _x(oid) case LOWORD(oid): return #oid
90 #undef _x
91  default:
92  snprintf(buf, sizeof(buf), "%d", LOWORD(oid));
93  return buf;
94  }
95  }
96  else
97  return oid;
98 }
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define snprintf
Definition: wintirpc.h:48
#define URL_OID_CERTIFICATE_ISSUER
Definition: wincrypt.h:1524
#define URL_OID_CTL_ISSUER
Definition: wincrypt.h:1526
#define URL_OID_CRL_FRESHEST_CRL
Definition: wincrypt.h:1530
#define URL_OID_CERTIFICATE_CRL_DIST_POINT
Definition: wincrypt.h:1525
#define URL_OID_CERTIFICATE_FRESHEST_CRL
Definition: wincrypt.h:1529
#define _x(oid)
#define URL_OID_CTL_NEXT_UPDATE
Definition: wincrypt.h:1527
#define URL_OID_CROSS_CERT_DIST_POINT
Definition: wincrypt.h:1531
#define IS_INTOID(x)
Definition: cryptnet_main.c:39
#define URL_OID_CRL_ISSUER
Definition: wincrypt.h:1528
#define LOWORD(l)
Definition: pedump.c:82

Referenced by CryptGetObjectUrl().

◆ verify_cert_revocation()

static DWORD verify_cert_revocation ( PCCERT_CONTEXT  cert,
DWORD  index,
FILETIME pTime,
DWORD  dwFlags,
PCERT_REVOCATION_PARA  pRevPara,
PCERT_REVOCATION_STATUS  pRevStatus 
)
static

Definition at line 1715 of file cryptnet_main.c.

1718 {
1721 
1723  cert->pCertInfo->cExtension, cert->pCertInfo->rgExtension)))
1725  index, pTime, dwFlags, pRevPara, pRevStatus);
1727  cert->pCertInfo->cExtension, cert->pCertInfo->rgExtension)))
1729  index, pTime, dwFlags, pRevPara, pRevStatus);
1730  else
1731  {
1732  if (pRevPara && pRevPara->hCrlStore && pRevPara->pIssuerCert)
1733  {
1735  BOOL canSignCRLs;
1736 
1737  /* If the caller told us about the issuer, make sure the issuer
1738  * can sign CRLs before looking for one.
1739  */
1741  pRevPara->pIssuerCert->pCertInfo->cExtension,
1742  pRevPara->pIssuerCert->pCertInfo->rgExtension)))
1743  {
1745  DWORD size = sizeof(usage);
1746 
1747  if (!CryptDecodeObjectEx(cert->dwCertEncodingType, X509_BITS,
1748  ext->Value.pbData, ext->Value.cbData,
1750  canSignCRLs = FALSE;
1751  else if (usage.cbData > 2)
1752  {
1753  /* The key usage extension only defines 9 bits => no more
1754  * than 2 bytes are needed to encode all known usages.
1755  */
1756  canSignCRLs = FALSE;
1757  }
1758  else
1759  {
1760  BYTE usageBits = usage.pbData[usage.cbData - 1];
1761 
1762  canSignCRLs = usageBits & CERT_CRL_SIGN_KEY_USAGE;
1763  }
1764  }
1765  else
1766  canSignCRLs = TRUE;
1767  if (canSignCRLs)
1768  {
1769  /* If the caller was helpful enough to tell us where to find a
1770  * CRL for the cert, look for one and check it.
1771  */
1772  crl = CertFindCRLInStore(pRevPara->hCrlStore,
1773  cert->dwCertEncodingType,
1776  CRL_FIND_ISSUED_BY, pRevPara->pIssuerCert, NULL);
1777  }
1778  if (crl)
1779  {
1781  index, pTime, pRevStatus);
1783  }
1784  else
1785  {
1786  TRACE("no CRL found\n");
1788  pRevStatus->dwIndex = index;
1789  }
1790  }
1791  else
1792  {
1793  if (!pRevPara)
1794  WARN("no CERT_REVOCATION_PARA\n");
1795  else if (!pRevPara->hCrlStore)
1796  WARN("no dist points/aia extension and no CRL store\n");
1797  else if (!pRevPara->pIssuerCert)
1798  WARN("no dist points/aia extension and no issuer\n");
1800  pRevStatus->dwIndex = index;
1801  }
1802  }
1803  return error;
1804 }
#define szOID_KEY_USAGE
Definition: wincrypt.h:3185
#define TRUE
Definition: types.h:120
#define CRL_FIND_ISSUED_BY_SIGNATURE_FLAG
Definition: wincrypt.h:2933
static const BYTE crl[]
Definition: message.c:864
#define ERROR_SUCCESS
Definition: deptool.c:10
BOOL WINAPI CryptDecodeObjectEx(DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
Definition: decode.c:6286
#define error(str)
Definition: mkdosfs.c:1605
#define WARN(fmt,...)
Definition: debug.h:112
#define CRL_FIND_ISSUED_BY_AKI_FLAG
Definition: wincrypt.h:2932
unsigned int BOOL
Definition: ntddk_ex.h:94
PCERT_EXTENSION rgExtension
Definition: wincrypt.h:252
_In_ PCCERT_CONTEXT _In_opt_ LPFILETIME pTime
Definition: wincrypt.h:4836
smooth NULL
Definition: ftsmooth.c:416
char ext[3]
Definition: mkdosfs.c:358
static BYTE cert[]
Definition: msg.c:1437
GLuint index
Definition: glext.h:6031
#define szOID_CRL_DIST_POINTS
Definition: wincrypt.h:3196
static DWORD verify_cert_revocation_from_aia_ext(const CRYPT_DATA_BLOB *value, PCCERT_CONTEXT cert, DWORD index, FILETIME *pTime, DWORD dwFlags, PCERT_REVOCATION_PARA pRevPara, PCERT_REVOCATION_STATUS pRevStatus)
#define szOID_AUTHORITY_INFO_ACCESS
Definition: wincrypt.h:3290
#define TRACE(s)
Definition: solgame.cpp:4
PCERT_INFO pCertInfo
Definition: wincrypt.h:482
GLsizeiptr size
Definition: glext.h:5919
#define CRYPT_E_NO_REVOCATION_CHECK
Definition: winerror.h:3021
unsigned long DWORD
Definition: ntddk_ex.h:95
PCERT_EXTENSION WINAPI CertFindExtension(LPCSTR pszObjId, DWORD cExtensions, CERT_EXTENSION rgExtensions[])
Definition: cert.c:2028
#define index(s, c)
Definition: various.h:29
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
unsigned char BYTE
Definition: xxhash.c:193
PCCERT_CONTEXT pIssuerCert
Definition: wincrypt.h:804
#define CRYPT_DECODE_NOCOPY_FLAG
Definition: wincrypt.h:3450
HCERTSTORE hCrlStore
Definition: wincrypt.h:807
#define CRL_FIND_ISSUED_BY
Definition: wincrypt.h:2928
DWORD cExtension
Definition: wincrypt.h:251
static DWORD verify_cert_revocation_with_crl_offline(PCCERT_CONTEXT cert, PCCRL_CONTEXT crl, DWORD index, FILETIME *pTime, PCERT_REVOCATION_STATUS pRevStatus)
static DWORD verify_cert_revocation_from_dist_points_ext(const CRYPT_DATA_BLOB *value, PCCERT_CONTEXT cert, DWORD index, FILETIME *pTime, DWORD dwFlags, const CERT_REVOCATION_PARA *pRevPara, PCERT_REVOCATION_STATUS pRevStatus)
PCCRL_CONTEXT WINAPI CertFindCRLInStore(HCERTSTORE hCertStore, DWORD dwCertEncodingType, DWORD dwFindFlags, DWORD dwFindType, const void *pvFindPara, PCCRL_CONTEXT pPrevCrlContext)
Definition: crl.c:287
#define X509_BITS
Definition: wincrypt.h:3392
#define CERT_CRL_SIGN_KEY_USAGE
Definition: wincrypt.h:311
BOOL WINAPI CertFreeCRLContext(PCCRL_CONTEXT pCrlContext)
Definition: crl.c:386

Referenced by CertDllVerifyRevocation().

◆ verify_cert_revocation_from_aia_ext()

static DWORD verify_cert_revocation_from_aia_ext ( const CRYPT_DATA_BLOB value,
PCCERT_CONTEXT  cert,
DWORD  index,
FILETIME pTime,
DWORD  dwFlags,
PCERT_REVOCATION_PARA  pRevPara,
PCERT_REVOCATION_STATUS  pRevStatus 
)
static

Definition at line 1640 of file cryptnet_main.c.

1644 {
1645  BOOL ret;
1646  DWORD error, size;
1648 
1650  value->pbData, value->cbData, CRYPT_DECODE_ALLOC_FLAG, NULL, &aia, &size);
1651  if (ret)
1652  {
1653  DWORD i;
1654 
1655  for (i = 0; i < aia->cAccDescr; i++)
1656  if (!strcmp(aia->rgAccDescr[i].pszAccessMethod,
1657  szOID_PKIX_OCSP))
1658  {
1659  if (aia->rgAccDescr[i].AccessLocation.dwAltNameChoice ==
1661  FIXME("OCSP URL = %s\n",
1662  debugstr_w(aia->rgAccDescr[i].AccessLocation.u.pwszURL));
1663  else
1664  FIXME("unsupported AccessLocation type %d\n",
1665  aia->rgAccDescr[i].AccessLocation.dwAltNameChoice);
1666  }
1667  LocalFree(aia);
1668  /* FIXME: lie and pretend OCSP validated the cert */
1669  error = ERROR_SUCCESS;
1670  }
1671  else
1672  error = GetLastError();
1673  return error;
1674 }
#define ERROR_SUCCESS
Definition: deptool.c:10
BOOL WINAPI CryptDecodeObjectEx(DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
Definition: decode.c:6286
#define error(str)
Definition: mkdosfs.c:1605
#define CERT_ALT_NAME_URL
Definition: wincrypt.h:351
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define szOID_PKIX_OCSP
Definition: wincrypt.h:3326
#define X509_ASN_ENCODING
Definition: wincrypt.h:2297
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
unsigned int BOOL
Definition: ntddk_ex.h:94
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:111
#define X509_AUTHORITY_INFO_ACCESS
Definition: wincrypt.h:3399
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
static WCHAR aia[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1601
#define CRYPT_DECODE_ALLOC_FLAG
Definition: wincrypt.h:3454
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469

Referenced by verify_cert_revocation().

◆ verify_cert_revocation_from_dist_points_ext()

static DWORD verify_cert_revocation_from_dist_points_ext ( const CRYPT_DATA_BLOB value,
PCCERT_CONTEXT  cert,
DWORD  index,
FILETIME pTime,
DWORD  dwFlags,
const CERT_REVOCATION_PARA pRevPara,
PCERT_REVOCATION_STATUS  pRevStatus 
)
static

Definition at line 1563 of file cryptnet_main.c.

1567 {
1568  DWORD error = ERROR_SUCCESS, cbUrlArray;
1569 
1570  if (CRYPT_GetUrlFromCRLDistPointsExt(value, NULL, &cbUrlArray, NULL, NULL))
1571  {
1572  CRYPT_URL_ARRAY *urlArray = CryptMemAlloc(cbUrlArray);
1573 
1574  if (urlArray)
1575  {
1576  DWORD j, retrievalFlags = 0, startTime, endTime, timeout;
1577  BOOL ret;
1578 
1580  &cbUrlArray, NULL, NULL);
1582  retrievalFlags |= CRYPT_CACHE_ONLY_RETRIEVAL;
1584  pRevPara && pRevPara->cbSize >= offsetof(CERT_REVOCATION_PARA,
1585  dwUrlRetrievalTimeout) + sizeof(DWORD))
1586  {
1587  startTime = GetTickCount();
1588  endTime = startTime + pRevPara->dwUrlRetrievalTimeout;
1589  timeout = pRevPara->dwUrlRetrievalTimeout;
1590  }
1591  else
1592  endTime = timeout = 0;
1593  if (!ret)
1594  error = GetLastError();
1595  /* continue looping if one was offline; break if revoked or timed out */
1596  for (j = 0; (!error || error == CRYPT_E_REVOCATION_OFFLINE) && j < urlArray->cUrl; j++)
1597  {
1599 
1600  ret = CryptRetrieveObjectByUrlW(urlArray->rgwszUrl[j],
1601  CONTEXT_OID_CRL, retrievalFlags, timeout, (void **)&crl,
1602  NULL, NULL, NULL, NULL);
1603  if (ret)
1604  {
1606  index, pTime, pRevStatus);
1607  if (!error && timeout)
1608  {
1609  DWORD time = GetTickCount();
1610 
1611  if ((int)(endTime - time) <= 0)
1612  {
1613  error = ERROR_TIMEOUT;
1614  pRevStatus->dwIndex = index;
1615  }
1616  else
1617  timeout = endTime - time;
1618  }
1620  }
1621  else
1623  }
1624  CryptMemFree(urlArray);
1625  }
1626  else
1627  {
1629  pRevStatus->dwIndex = index;
1630  }
1631  }
1632  else
1633  {
1634  error = GetLastError();
1635  pRevStatus->dwIndex = index;
1636  }
1637  return error;
1638 }
#define CRYPT_E_REVOCATION_OFFLINE
Definition: winerror.h:3022
static const BYTE crl[]
Definition: message.c:864
#define CRYPT_CACHE_ONLY_RETRIEVAL
Definition: wincrypt.h:1634
#define ERROR_SUCCESS
Definition: deptool.c:10
#define error(str)
Definition: mkdosfs.c:1605
#define ERROR_TIMEOUT
Definition: winerror.h:941
static ULONGLONG startTime
Definition: main.c:113
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:455
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
Definition: dhcpd.h:245
__u16 time
Definition: mkdosfs.c:366
GLbitfield GLuint64 timeout
Definition: glext.h:7164
LPVOID WINAPI CryptMemAlloc(ULONG cbSize)
Definition: main.c:131
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI CryptRetrieveObjectByUrlW(LPCWSTR pszURL, LPCSTR pszObjectOid, DWORD dwRetrievalFlags, DWORD dwTimeout, LPVOID *ppvObject, HCRYPTASYNC hAsyncRetrieve, PCRYPT_CREDENTIALS pCredentials, LPVOID pvVerify, PCRYPT_RETRIEVE_AUX_INFO pAuxInfo)
_In_ PCCERT_CONTEXT _In_opt_ LPFILETIME pTime
Definition: wincrypt.h:4836
smooth NULL
Definition: ftsmooth.c:416
#define offsetof(TYPE, MEMBER)
static BYTE cert[]
Definition: msg.c:1437
GLuint index
Definition: glext.h:6031
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
static BOOL CRYPT_GetUrlFromCRLDistPointsExt(const CRYPT_DATA_BLOB *value, PCRYPT_URL_ARRAY pUrlArray, DWORD *pcbUrlArray, PCRYPT_URL_INFO pUrlInfo, DWORD *pcbUrlInfo)
LPWSTR * rgwszUrl
Definition: wincrypt.h:1514
static DWORD verify_cert_revocation_with_crl_online(PCCERT_CONTEXT cert, PCCRL_CONTEXT crl, DWORD index, FILETIME *pTime, PCERT_REVOCATION_STATUS pRevStatus)
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
#define index(s, c)
Definition: various.h:29
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define CERT_VERIFY_CACHE_ONLY_BASED_REVOCATION
Definition: wincrypt.h:820
VOID WINAPI CryptMemFree(LPVOID pv)
Definition: main.c:141
#define CERT_VERIFY_REV_ACCUMULATIVE_TIMEOUT_FLAG
Definition: wincrypt.h:821
#define CONTEXT_OID_CRL
Definition: wincrypt.h:1628
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
BOOL WINAPI CertFreeCRLContext(PCCRL_CONTEXT pCrlContext)
Definition: crl.c:386

Referenced by verify_cert_revocation().

◆ verify_cert_revocation_with_crl_offline()

static DWORD verify_cert_revocation_with_crl_offline ( PCCERT_CONTEXT  cert,
PCCRL_CONTEXT  crl,
DWORD  index,
FILETIME pTime,
PCERT_REVOCATION_STATUS  pRevStatus 
)
static

Definition at line 1676 of file cryptnet_main.c.

1679 {
1680  DWORD error;
1681  LONG valid;
1682 
1683  valid = CompareFileTime(pTime, &crl->pCrlInfo->ThisUpdate);
1684  if (valid <= 0)
1685  {
1686  /* If this CRL is not older than the time being verified, there's no
1687  * way to know whether the certificate was revoked.
1688  */
1689  TRACE("CRL not old enough\n");
1691  }
1692  else
1693  {
1694  PCRL_ENTRY entry = NULL;
1695 
1697  if (entry)
1698  {
1700  pRevStatus->dwIndex = index;
1701  }
1702  else
1703  {
1704  /* Since the CRL was not retrieved for the cert being checked,
1705  * there's no guarantee it's fresh, so the cert *might* be okay,
1706  * but it's safer not to guess.
1707  */
1708  TRACE("certificate not found\n");
1710  }
1711  }
1712  return error;
1713 }
#define CRYPT_E_REVOCATION_OFFLINE
Definition: winerror.h:3022
static const BYTE crl[]
Definition: message.c:864
#define error(str)
Definition: mkdosfs.c:1605
long LONG
Definition: pedump.c:60
_In_ PCCERT_CONTEXT _In_opt_ LPFILETIME pTime
Definition: wincrypt.h:4836
smooth NULL
Definition: ftsmooth.c:416
static BYTE cert[]
Definition: msg.c:1437
#define TRACE(s)
Definition: solgame.cpp:4
LONG WINAPI CompareFileTime(IN CONST FILETIME *lpFileTime1, IN CONST FILETIME *lpFileTime2)
Definition: time.c:106
unsigned long DWORD
Definition: ntddk_ex.h:95
#define index(s, c)
Definition: various.h:29
uint32_t entry
Definition: isohybrid.c:63
BOOL WINAPI CertFindCertificateInCRL(PCCERT_CONTEXT pCert, PCCRL_CONTEXT pCrlContext, DWORD dwFlags, void *pvReserved, PCRL_ENTRY *ppCrlEntry)
Definition: crl.c:750
#define CRYPT_E_REVOKED
Definition: winerror.h:3019
Definition: wincrypt.h:487

Referenced by verify_cert_revocation().

◆ verify_cert_revocation_with_crl_online()

static DWORD verify_cert_revocation_with_crl_online ( PCCERT_CONTEXT  cert,
PCCRL_CONTEXT  crl,
DWORD  index,
FILETIME pTime,
PCERT_REVOCATION_STATUS  pRevStatus 
)
static

Definition at line 1540 of file cryptnet_main.c.

1543 {
1544  DWORD error;
1545  PCRL_ENTRY entry = NULL;
1546 
1548  if (entry)
1549  {
1551  pRevStatus->dwIndex = index;
1552  }
1553  else
1554  {
1555  /* Since the CRL was retrieved for the cert being checked, then it's
1556  * guaranteed to be fresh, and the cert is not revoked.
1557  */
1558  error = ERROR_SUCCESS;
1559  }
1560  return error;
1561 }
static const BYTE crl[]
Definition: message.c:864
#define ERROR_SUCCESS
Definition: deptool.c:10
#define error(str)
Definition: mkdosfs.c:1605
smooth NULL
Definition: ftsmooth.c:416
static BYTE cert[]
Definition: msg.c:1437
unsigned long DWORD
Definition: ntddk_ex.h:95
#define index(s, c)
Definition: various.h:29
uint32_t entry
Definition: isohybrid.c:63
BOOL WINAPI CertFindCertificateInCRL(PCCERT_CONTEXT pCert, PCCRL_CONTEXT pCrlContext, DWORD dwFlags, void *pvReserved, PCRL_ENTRY *ppCrlEntry)
Definition: crl.c:750
#define CRYPT_E_REVOKED
Definition: winerror.h:3019
Definition: wincrypt.h:487

Referenced by verify_cert_revocation_from_dist_points_ext().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( cryptnet  )

Variable Documentation

◆ cryptNet

const WCHAR cryptNet[]
static
Initial value:
= { 'c','r','y','p','t','n','e','t','.',
'd','l','l',0 }

Definition at line 41 of file cryptnet_main.c.

Referenced by DllRegisterServer(), and DllUnregisterServer().

◆ pkcs7cert

const WCHAR pkcs7cert[]
static
Initial value:
= { 'a','p','p','l','i','c','a','t','i','o','n',
'/','x','-','p','k','c','s','7','-','c','e','r','t','i','f','c','a','t','e',
's',0 }

Definition at line 864 of file cryptnet_main.c.

Referenced by HTTP_RetrieveEncodedObjectW().

◆ pkcs7CRL

const WCHAR pkcs7CRL[]
static
Initial value:
= { 'a','p','p','l','i','c','a','t','i','o','n',
'/','x','-','p','k','c','s','7','-','c','r','l',0 }

Definition at line 869 of file cryptnet_main.c.

Referenced by HTTP_RetrieveEncodedObjectW().

◆ pkcs7mime

const WCHAR pkcs7mime[]
static
Initial value:
= { 'a','p','p','l','i','c','a','t','i','o','n',
'/','x','-','p','k','c','s','7','-','m','i','m','e',0 }

Definition at line 873 of file cryptnet_main.c.

Referenced by HTTP_RetrieveEncodedObjectW().

◆ pkcs7sig

const WCHAR pkcs7sig[]
static
Initial value:
= { 'a','p','p','l','i','c','a','t','i','o','n',
'/','x','-','p','k','c','s','7','-','s','i','g','n','a','t','u','r','e',0 }

Definition at line 871 of file cryptnet_main.c.

Referenced by HTTP_RetrieveEncodedObjectW().

◆ pkixCRL

const WCHAR pkixCRL[]
static
Initial value:
= { 'a','p','p','l','i','c','a','t','i','o','n',
'/','p','k','i','x','-','c','r','l',0 }

Definition at line 867 of file cryptnet_main.c.

Referenced by HTTP_RetrieveEncodedObjectW().

◆ x509cacert

const WCHAR x509cacert[]
static
Initial value:
= { 'a','p','p','l','i','c','a','t','i','o','n',
'/','x','-','x','5','0','9','-','c','a','-','c','e','r','t',0 }

Definition at line 854 of file cryptnet_main.c.

Referenced by HTTP_RetrieveEncodedObjectW().

◆ x509emailcert

const WCHAR x509emailcert[]
static
Initial value:
= { 'a','p','p','l','i','c','a','t','i','o',
'n','/','x','-','x','5','0','9','-','e','m','a','i','l','-','c','e','r','t',
0 }

Definition at line 856 of file cryptnet_main.c.

Referenced by HTTP_RetrieveEncodedObjectW().

◆ x509servercert

const WCHAR x509servercert[]
static
Initial value:
= { 'a','p','p','l','i','c','a','t','i','o',
'n','/','x','-','x','5','0','9','-','s','e','r','v','e','r','-','c','e','r',
't',0 }

Definition at line 859 of file cryptnet_main.c.

Referenced by HTTP_RetrieveEncodedObjectW().

◆ x509usercert

const WCHAR x509usercert[]
static
Initial value:
= { 'a','p','p','l','i','c','a','t','i','o',
'n','/','x','-','x','5','0','9','-','u','s','e','r','-','c','e','r','t',0 }

Definition at line 862 of file cryptnet_main.c.

Referenced by HTTP_RetrieveEncodedObjectW().