ReactOS  0.4.14-dev-55-g2da92ac
cryptnet_main.c File Reference
#include "config.h"
#include "wine/port.h"
#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 25 of file cryptnet_main.c.

◆ IS_INTOID

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

Definition at line 42 of file cryptnet_main.c.

◆ NONAMELESSUNION

#define NONAMELESSUNION

Definition at line 24 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 1187 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 1419 of file cryptnet_main.c.

◆ OLD_CERT_REVOCATION_STATUS

◆ SchemeDllRetrieveEncodedObjectW

Definition at line 1080 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 103 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 1828 of file cryptnet_main.c.

1831 {
1832  DWORD error = 0, i;
1833  FILETIME now;
1834  LPFILETIME pTime = NULL;
1835 
1836  TRACE("(%08x, %d, %d, %p, %08x, %p, %p)\n", dwEncodingType, dwRevType,
1837  cContext, rgpvContext, dwFlags, pRevPara, pRevStatus);
1838 
1839  if (pRevStatus->cbSize != sizeof(OLD_CERT_REVOCATION_STATUS) &&
1840  pRevStatus->cbSize != sizeof(CERT_REVOCATION_STATUS))
1841  {
1843  return FALSE;
1844  }
1845  if (!cContext)
1846  {
1848  return FALSE;
1849  }
1850  if (pRevPara && pRevPara->cbSize >=
1852  pTime = pRevPara->pftTimeToUse;
1853  if (!pTime)
1854  {
1856  pTime = &now;
1857  }
1858  memset(&pRevStatus->dwIndex, 0, pRevStatus->cbSize - sizeof(DWORD));
1859  if (dwRevType != CERT_CONTEXT_REVOCATION_TYPE)
1861  else
1862  {
1863  for (i = 0; !error && i < cContext; i++)
1864  error = verify_cert_revocation(rgpvContext[i], i, pTime, dwFlags,
1865  pRevPara, pRevStatus);
1866  }
1867  if (error)
1868  {
1870  pRevStatus->dwError = error;
1871  }
1872  TRACE("returning %d (%08x)\n", !error, error);
1873  return !error;
1874 }
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:4629
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:4840
#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:409
_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 715 of file cryptnet_main.c.

717 {
718  WCHAR cacheFileName[MAX_PATH];
719  HANDLE hCacheFile;
720  DWORD size = 0, entryType;
721  FILETIME ft;
722 
723  GetUrlCacheEntryInfoW(pszURL, NULL, &size);
725  {
727 
728  if (!info)
729  {
730  ERR("out of memory\n");
731  return;
732  }
733 
734  if (GetUrlCacheEntryInfoW(pszURL, info, &size))
735  {
736  lstrcpyW(cacheFileName, info->lpszLocalFileName);
737  /* Check if the existing cache entry is up to date. If it isn't,
738  * remove the existing cache entry, and create a new one with the
739  * new value.
740  */
742  if (CompareFileTime(&info->ExpireTime, &ft) < 0)
743  {
744  DeleteUrlCacheEntryW(pszURL);
745  }
746  else
747  {
748  info->ExpireTime = expires;
751  return;
752  }
753  }
755  }
756 
757  if (!CreateUrlCacheEntryW(pszURL, pObject->rgBlob[0].cbData, NULL, cacheFileName, 0))
758  return;
759 
760  hCacheFile = CreateFileW(cacheFileName, GENERIC_WRITE, 0,
762  if(hCacheFile == INVALID_HANDLE_VALUE)
763  return;
764 
765  WriteFile(hCacheFile, pObject->rgBlob[0].pbData,
766  pObject->rgBlob[0].cbData, &size, NULL);
767  CloseHandle(hCacheFile);
768 
770  entryType = NORMAL_CACHE_ENTRY;
771  else
772  entryType = STICKY_CACHE_ENTRY;
773  memset(&ft, 0, sizeof(ft));
774  CommitUrlCacheEntryW(pszURL, cacheFileName, expires, ft, entryType,
775  NULL, 0, NULL, NULL);
776 }
BOOL WINAPI CreateUrlCacheEntryW(LPCWSTR lpszUrlName, DWORD dwExpectedFileSize, LPCWSTR lpszFileExtension, LPWSTR lpszFileName, DWORD dwReserved)
Definition: urlcache.c:2826
#define CACHE_ENTRY_EXPTIME_FC
Definition: wininet.h:2295
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:398
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
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:2087
#define GENERIC_WRITE
Definition: nt_native.h:90
smooth NULL
Definition: ftsmooth.c:416
#define OPEN_EXISTING
Definition: compat.h:426
#define NORMAL_CACHE_ENTRY
Definition: wininet.h:2086
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:3096
__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:2021
#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:109
#define lstrcpyW
Definition: compat.h:406
_In_opt_ LPCSTR _In_ DWORD dwRetrievalFlags
Definition: wincrypt.h:6118
#define CreateFileW
Definition: compat.h:400
VOID WINAPI CryptMemFree(LPVOID pv)
Definition: main.c:141
BOOL WINAPI SetUrlCacheEntryInfoW(LPCWSTR lpszUrl, LPINTERNET_CACHE_ENTRY_INFOW lpCacheEntryInfo, DWORD dwFieldControl)
Definition: urlcache.c:2088
#define memset(x, y, z)
Definition: compat.h:39
BOOL WINAPI DeleteUrlCacheEntryW(LPCWSTR lpszUrlName)
Definition: urlcache.c:3355
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
Definition: wininet.h:2126

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 793 of file cryptnet_main.c.

796 {
797  BOOL ret;
798 
799  TRACE("(%s:%d, %p, %p, %p, %p)\n", debugstr_w(components->lpszHostName),
800  components->nPort, context, pCredentials, phInt, phInt);
801 
802  *phHost = NULL;
805  if (*phInt)
806  {
807  DWORD service;
808 
809  if (context)
811  switch (components->nScheme)
812  {
813  case INTERNET_SCHEME_FTP:
814  service = INTERNET_SERVICE_FTP;
815  break;
817  service = INTERNET_SERVICE_HTTP;
818  break;
819  default:
820  service = 0;
821  }
822  /* FIXME: use pCredentials for username/password */
823  *phHost = InternetConnectW(*phInt, components->lpszHostName,
824  components->nPort, NULL, NULL, service, 0, (DWORD_PTR)context);
825  if (!*phHost)
826  {
827  InternetCloseHandle(*phInt);
828  *phInt = NULL;
829  ret = FALSE;
830  }
831  else
832  ret = TRUE;
833  }
834  else
835  ret = FALSE;
836  TRACE("returning %d\n", ret);
837  return ret;
838 }
#define TRUE
Definition: types.h:120
Definition: http.c:6587
BOOL WINAPI InternetCloseHandle(HINTERNET hInternet)
Definition: internet.c:1437
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:2098
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD _Outptr_opt_ void _In_opt_ PCRYPT_CREDENTIALS pCredentials
Definition: wincrypt.h:6081
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:63
#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:1281
HINTERNET WINAPI InternetOpenW(LPCWSTR lpszAgent, DWORD dwAccessType, LPCWSTR lpszProxy, LPCWSTR lpszProxyBypass, DWORD dwFlags)
Definition: internet.c:1002
#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 561 of file cryptnet_main.c.

562 {
563  BOOL ret;
564 
565  TRACE("(%s, %p)\n", debugstr_w(pszURL), components);
566 
567  memset(components, 0, sizeof(*components));
568  components->dwStructSize = sizeof(*components);
569  components->lpszHostName = CryptMemAlloc(INTERNET_MAX_HOST_NAME_LENGTH * sizeof(WCHAR));
570  components->dwHostNameLength = INTERNET_MAX_HOST_NAME_LENGTH;
571  if (!components->lpszHostName)
572  {
574  return FALSE;
575  }
576  components->lpszUrlPath = CryptMemAlloc(INTERNET_MAX_PATH_LENGTH * sizeof(WCHAR));
577  components->dwUrlPathLength = INTERNET_MAX_PATH_LENGTH;
578  if (!components->lpszUrlPath)
579  {
580  CryptMemFree(components->lpszHostName);
582  return FALSE;
583  }
584 
586  if (ret)
587  {
588  switch (components->nScheme)
589  {
590  case INTERNET_SCHEME_FTP:
591  if (!components->nPort)
593  break;
595  if (!components->nPort)
597  break;
598  default:
599  ; /* do nothing */
600  }
601  }
602  TRACE("returning %d\n", ret);
603  return ret;
604 }
#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:409
#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:1645
#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 1329 of file cryptnet_main.c.

1331 {
1332  BOOL ret;
1333 
1334  if (!pObject->cBlob)
1335  {
1337  *ppvContext = NULL;
1338  ret = FALSE;
1339  }
1340  else
1341  {
1344 
1345  if (store)
1346  {
1349 
1350  if (memStore)
1351  {
1352  CertAddStoreToCollection(store, memStore,
1354  CertCloseStore(memStore, 0);
1355  }
1356  else
1357  {
1358  CertCloseStore(store, 0);
1359  store = NULL;
1360  }
1361  }
1362  if (store)
1363  {
1364  DWORD i;
1365 
1366  ret = TRUE;
1367  for (i = 0; i < pObject->cBlob; i++)
1368  {
1369  DWORD contentType, expectedContentTypes =
1375  HCERTSTORE contextStore;
1376  const void *context;
1377 
1379  &pObject->rgBlob[i], expectedContentTypes,
1380  CERT_QUERY_FORMAT_FLAG_BINARY, 0, NULL, &contentType, NULL,
1381  &contextStore, NULL, &context))
1382  {
1383  switch (contentType)
1384  {
1388  ret = FALSE;
1390  break;
1392  if (!CertAddCRLContextToStore(store,
1394  ret = FALSE;
1396  break;
1398  if (!CertAddCTLContextToStore(store,
1400  ret = FALSE;
1402  break;
1403  default:
1404  CertAddStoreToCollection(store, contextStore, 0, 0);
1405  }
1406  CertCloseStore(contextStore, 0);
1407  }
1408  else
1409  ret = FALSE;
1410  }
1411  }
1412  else
1413  ret = FALSE;
1414  *ppvContext = store;
1415  }
1416  return ret;
1417 }
#define TRUE
Definition: types.h:120
Definition: http.c:6587
#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:5092
#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:409
#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 1152 of file cryptnet_main.c.

1154 {
1155  DWORD size, i;
1157  BOOL ret = FALSE;
1158 
1159  size = sizeof(CRYPT_BLOB_ARRAY) + pObject->cBlob * sizeof(CRYPT_DATA_BLOB);
1160  for (i = 0; i < pObject->cBlob; i++)
1161  size += pObject->rgBlob[i].cbData;
1163  if (context)
1164  {
1165  LPBYTE nextData;
1166 
1167  context->cBlob = 0;
1168  context->rgBlob =
1170  nextData =
1171  (LPBYTE)context->rgBlob + pObject->cBlob * sizeof(CRYPT_DATA_BLOB);
1172  for (i = 0; i < pObject->cBlob; i++)
1173  {
1174  memcpy(nextData, pObject->rgBlob[i].pbData,
1175  pObject->rgBlob[i].cbData);
1176  context->rgBlob[i].pbData = nextData;
1177  context->rgBlob[i].cbData = pObject->rgBlob[i].cbData;
1178  nextData += pObject->rgBlob[i].cbData;
1179  context->cBlob++;
1180  }
1181  *ppvContext = context;
1182  ret = TRUE;
1183  }
1184  return ret;
1185 }
#define TRUE
Definition: types.h:120
Definition: http.c:6587
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:52
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:5092
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 1284 of file cryptnet_main.c.

1286 {
1289 }
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:5092
#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 1206 of file cryptnet_main.c.

1208 {
1209  BOOL ret = TRUE;
1211 
1212  if (!pObject->cBlob)
1213  {
1215  *ppvContext = NULL;
1216  ret = FALSE;
1217  }
1218  else if (pObject->cBlob == 1)
1219  {
1220  if (decode_base64_blob(&pObject->rgBlob[0], &blob))
1221  {
1223  dwExpectedContentTypeFlags, CERT_QUERY_FORMAT_FLAG_BINARY, 0,
1224  NULL, NULL, NULL, NULL, NULL, (const void **)ppvContext);
1225  CryptMemFree(blob.pbData);
1226  }
1227  else
1228  {
1230  dwExpectedContentTypeFlags, CERT_QUERY_FORMAT_FLAG_BINARY, 0,
1231  NULL, NULL, NULL, NULL, NULL, (const void **)ppvContext);
1232  }
1233  if (!ret)
1234  {
1236  ret = FALSE;
1237  }
1238  }
1239  else
1240  {
1243 
1244  if (store)
1245  {
1246  DWORD i;
1247  const void *context;
1248 
1249  for (i = 0; i < pObject->cBlob; i++)
1250  {
1251  if (decode_base64_blob(&pObject->rgBlob[i], &blob))
1252  {
1254  dwExpectedContentTypeFlags, CERT_QUERY_FORMAT_FLAG_BINARY,
1255  0, NULL, NULL, NULL, NULL, NULL, &context);
1256  CryptMemFree(blob.pbData);
1257  }
1258  else
1259  {
1261  &pObject->rgBlob[i], dwExpectedContentTypeFlags,
1263  NULL, &context);
1264  }
1265  if (ret)
1266  {
1267  if (!addFunc(store, context, CERT_STORE_ADD_ALWAYS, NULL))
1268  ret = FALSE;
1269  }
1270  else
1271  {
1273  ret = FALSE;
1274  }
1275  }
1276  }
1277  else
1278  ret = FALSE;
1279  *ppvContext = store;
1280  }
1281  return ret;
1282 }
#define TRUE
Definition: types.h:120
Definition: image.c:133
Definition: http.c:6587
#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
#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:5092
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:409
#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 1291 of file cryptnet_main.c.

1293 {
1296 }
#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:5092
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 1298 of file cryptnet_main.c.

1300 {
1303 }
_In_ DWORD _In_ DWORD _In_ DWORD _In_ DWORD _Out_opt_ DWORD _Outptr_opt_ const void ** ppvContext
Definition: wincrypt.h:5092
#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 1305 of file cryptnet_main.c.

1307 {
1308  BOOL ret;
1309 
1310  if (!pObject->cBlob)
1311  {
1313  *ppvContext = NULL;
1314  ret = FALSE;
1315  }
1316  else if (pObject->cBlob == 1)
1320  0, NULL, NULL, NULL, ppvContext, NULL, NULL);
1321  else
1322  {
1323  FIXME("multiple messages unimplemented\n");
1324  ret = FALSE;
1325  }
1326  return ret;
1327 }
#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:110
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:5092
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:409
#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 634 of file cryptnet_main.c.

637 {
638  CRYPT_DATA_BLOB object = { 0, NULL };
639  DWORD bytesAvailable;
640  BOOL ret;
641 
642  do {
643  if ((ret = InternetQueryDataAvailable(hHttp, &bytesAvailable, 0, 0)))
644  {
645  if (bytesAvailable)
646  {
647  if (object.pbData)
648  object.pbData = CryptMemRealloc(object.pbData,
649  object.cbData + bytesAvailable);
650  else
651  object.pbData = CryptMemAlloc(bytesAvailable);
652  if (object.pbData)
653  {
654  INTERNET_BUFFERSA buffer = { sizeof(buffer), 0 };
655 
656  buffer.dwBufferLength = bytesAvailable;
657  buffer.lpvBuffer = object.pbData + object.cbData;
658  if (!(ret = InternetReadFileExA(hHttp, &buffer, IRF_NO_WAIT,
659  (DWORD_PTR)context)))
660  {
662  {
664  context->timeout) == WAIT_TIMEOUT)
666  else if (context->error)
667  SetLastError(context->error);
668  else
669  ret = TRUE;
670  }
671  }
672  if (ret)
673  object.cbData += buffer.dwBufferLength;
674  }
675  else
676  {
678  ret = FALSE;
679  }
680  }
681  }
682  else if (GetLastError() == ERROR_IO_PENDING)
683  {
684  if (WaitForSingleObject(context->event, context->timeout) ==
685  WAIT_TIMEOUT)
687  else
688  ret = TRUE;
689  }
690  } while (ret && bytesAvailable);
691  if (ret)
692  {
693  pObject->rgBlob = CryptMemAlloc(sizeof(CRYPT_DATA_BLOB));
694  if (!pObject->rgBlob)
695  {
696  CryptMemFree(object.pbData);
698  ret = FALSE;
699  }
700  else
701  {
702  pObject->rgBlob[0].cbData = object.cbData;
703  pObject->rgBlob[0].pbData = object.pbData;
704  pObject->cBlob = 1;
705  }
706  }
707  TRACE("returning %d\n", ret);
708  return ret;
709 }
#define TRUE
Definition: types.h:120
Definition: http.c:6587
#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:6589
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:3845
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:409
#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:63
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:2232
_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 436 of file cryptnet_main.c.

438 {
439  DWORD i;
440 
441  for (i = 0; i < pObject->cBlob; i++)
442  CryptMemFree(pObject->rgBlob[i].pbData);
443  CryptMemFree(pObject->rgBlob);
444 }
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 1422 of file cryptnet_main.c.

1424 {
1425  BOOL ret = TRUE;
1426 
1427  TRACE("(%s, %p, %p)\n", debugstr_a(pszObjectOid), pFunc, phFunc);
1428 
1429  *pFunc = NULL;
1430  *phFunc = 0;
1431  if (IS_INTOID(pszObjectOid))
1432  {
1433  switch (LOWORD(pszObjectOid))
1434  {
1435  case 0:
1436  *pFunc = CRYPT_CreateBlob;
1437  break;
1439  *pFunc = CRYPT_CreateCert;
1440  break;
1441  case LOWORD(CONTEXT_OID_CRL):
1442  *pFunc = CRYPT_CreateCRL;
1443  break;
1444  case LOWORD(CONTEXT_OID_CTL):
1445  *pFunc = CRYPT_CreateCTL;
1446  break;
1447  case LOWORD(CONTEXT_OID_PKCS7):
1448  *pFunc = CRYPT_CreatePKCS7;
1449  break;
1451  *pFunc = CRYPT_CreateAny;
1452  break;
1453  }
1454  }
1455  if (!*pFunc)
1456  {
1457  static HCRYPTOIDFUNCSET set = NULL;
1458 
1459  if (!set)
1463  0, (void **)pFunc, phFunc);
1464  }
1465  TRACE("returning %d\n", ret);
1466  return ret;
1467 }
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:6118
#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:42
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 1469 of file cryptnet_main.c.

1470 {
1471  if (!IS_INTOID(pszObjectOid))
1472  return FALSE;
1473 
1474  switch (LOWORD(pszObjectOid)) {
1476  *expiration = ((const CERT_CONTEXT*)object)->pCertInfo->NotAfter;
1477  return TRUE;
1478  case LOWORD(CONTEXT_OID_CRL):
1479  *expiration = ((const CRL_CONTEXT*)object)->pCrlInfo->NextUpdate;
1480  return TRUE;
1481  case LOWORD(CONTEXT_OID_CTL):
1482  *expiration = ((const CTL_CONTEXT*)object)->pCtlInfo->NextUpdate;
1483  return TRUE;
1484  }
1485 
1486  return FALSE;
1487 }
#define TRUE
Definition: types.h:120
_In_opt_ LPCSTR pszObjectOid
Definition: wincrypt.h:6118
#define CONTEXT_OID_CERTIFICATE
Definition: wincrypt.h:1627
#define IS_INTOID(x)
Definition: cryptnet_main.c:42
#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 495 of file cryptnet_main.c.

497 {
498  BOOL ret = FALSE;
499  INTERNET_CACHE_ENTRY_INFOW *pCacheInfo = NULL;
500  DWORD size = 0;
501 
502  TRACE("(%s, %p, %p)\n", debugstr_w(pszURL), pObject, pAuxInfo);
503 
504  RetrieveUrlCacheEntryFileW(pszURL, NULL, &size, 0);
506  return FALSE;
507 
508  pCacheInfo = CryptMemAlloc(size);
509  if (!pCacheInfo)
510  {
512  return FALSE;
513  }
514 
515  if ((ret = RetrieveUrlCacheEntryFileW(pszURL, pCacheInfo, &size, 0)))
516  {
517  FILETIME ft;
518 
520  if (CompareFileTime(&pCacheInfo->ExpireTime, &ft) >= 0)
521  {
524 
526  {
527  if ((ret = CRYPT_GetObjectFromFile(hFile, pObject)))
528  {
529  if (pAuxInfo && pAuxInfo->cbSize >=
531  pLastSyncTime) + sizeof(PFILETIME) &&
532  pAuxInfo->pLastSyncTime)
533  memcpy(pAuxInfo->pLastSyncTime,
534  &pCacheInfo->LastSyncTime,
535  sizeof(FILETIME));
536  }
538  }
539  else
540  {
541  DeleteUrlCacheEntryW(pszURL);
542  ret = FALSE;
543  }
544  }
545  else
546  {
547  DeleteUrlCacheEntryW(pszURL);
548  ret = FALSE;
549  }
550  UnlockUrlCacheEntryFileW(pszURL, 0);
551  }
552  CryptMemFree(pCacheInfo);
553  TRACE("returning %d\n", ret);
554  return ret;
555 }
VOID WINAPI GetSystemTimeAsFileTime(OUT PFILETIME lpFileTime)
Definition: time.c:128
#define CloseHandle
Definition: compat.h:398
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
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:2194
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:2630
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define offsetof(TYPE, MEMBER)
#define OPEN_EXISTING
Definition: compat.h:426
#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:2136
LPWSTR lpszLocalFileName
Definition: wininet.h:2129
static BOOL CRYPT_GetObjectFromFile(HANDLE hFile, PCRYPT_BLOB_ARRAY pObject)
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:409
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:6118
FILETIME LastSyncTime
Definition: wininet.h:2138
#define CreateFileW
Definition: compat.h:400
VOID WINAPI CryptMemFree(LPVOID pv)
Definition: main.c:141
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
BOOL WINAPI DeleteUrlCacheEntryW(LPCWSTR lpszUrlName)
Definition: urlcache.c:3355
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
Definition: wininet.h:2126

Referenced by HTTP_RetrieveEncodedObjectW().

◆ CRYPT_GetObjectFromFile()

static BOOL CRYPT_GetObjectFromFile ( HANDLE  hFile,
PCRYPT_BLOB_ARRAY  pObject 
)
static

Definition at line 446 of file cryptnet_main.c.

447 {
448  BOOL ret;
450 
451  if ((ret = GetFileSizeEx(hFile, &size)))
452  {
453  if (size.u.HighPart)
454  {
455  WARN("file too big\n");
457  ret = FALSE;
458  }
459  else
460  {
462 
463  blob.pbData = CryptMemAlloc(size.u.LowPart);
464  if (blob.pbData)
465  {
466  ret = ReadFile(hFile, blob.pbData, size.u.LowPart, &blob.cbData,
467  NULL);
468  if (ret)
469  {
470  pObject->rgBlob = CryptMemAlloc(sizeof(CRYPT_DATA_BLOB));
471  if (pObject->rgBlob)
472  {
473  pObject->cBlob = 1;
474  memcpy(pObject->rgBlob, &blob, sizeof(CRYPT_DATA_BLOB));
475  }
476  else
477  {
479  ret = FALSE;
480  }
481  }
482  if (!ret)
483  CryptMemFree(blob.pbData);
484  }
485  else
486  {
488  ret = FALSE;
489  }
490  }
491  }
492  return ret;
493 }
Definition: image.c:133
#define WARN(fmt,...)
Definition: debug.h:111
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
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919
#define SetLastError(x)
Definition: compat.h:409
#define GetFileSizeEx
Definition: compat.h:414
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 1086 of file cryptnet_main.c.

1088 {
1089  URL_COMPONENTSW components = { sizeof(components), 0 };
1090  BOOL ret;
1091 
1092  TRACE("(%s, %p, %p)\n", debugstr_w(pszURL), pFunc, phFunc);
1093 
1094  *pFunc = NULL;
1095  *phFunc = 0;
1096  components.dwSchemeLength = 1;
1097  ret = InternetCrackUrlW(pszURL, 0, 0, &components);
1098  if (ret)
1099  {
1100  /* Microsoft always uses CryptInitOIDFunctionSet/
1101  * CryptGetOIDFunctionAddress, but there doesn't seem to be a pressing
1102  * reason to do so for builtin schemes.
1103  */
1104  switch (components.nScheme)
1105  {
1106  case INTERNET_SCHEME_FTP:
1107  *pFunc = FTP_RetrieveEncodedObjectW;
1108  break;
1109  case INTERNET_SCHEME_HTTP:
1110  *pFunc = HTTP_RetrieveEncodedObjectW;
1111  break;
1112  case INTERNET_SCHEME_FILE:
1113  *pFunc = File_RetrieveEncodedObjectW;
1114  break;
1115  default:
1116  {
1117  int len = WideCharToMultiByte(CP_ACP, 0, components.lpszScheme,
1118  components.dwSchemeLength, NULL, 0, NULL, NULL);
1119 
1120  if (len)
1121  {
1123 
1124  if (scheme)
1125  {
1126  static HCRYPTOIDFUNCSET set = NULL;
1127 
1128  if (!set)
1131  WideCharToMultiByte(CP_ACP, 0, components.lpszScheme,
1132  components.dwSchemeLength, scheme, len, NULL, NULL);
1134  scheme, 0, (void **)pFunc, phFunc);
1136  }
1137  else
1138  {
1140  ret = FALSE;
1141  }
1142  }
1143  else
1144  ret = FALSE;
1145  }
1146  }
1147  }
1148  TRACE("returning %d\n", ret);
1149  return ret;
1150 }
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:409
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:1645
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 328 of file cryptnet_main.c.

331 {
334  BOOL ret = FALSE;
335 
336  /* The only applicable flag is CRYPT_GET_URL_FROM_EXTENSION */
338  {
340  return FALSE;
341  }
343  cert->pCertInfo->cExtension, cert->pCertInfo->rgExtension)))
344  ret = CRYPT_GetUrlFromCRLDistPointsExt(&ext->Value, pUrlArray,
345  pcbUrlArray, pUrlInfo, pcbUrlInfo);
346  else
348  return ret;
349 }
#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:409
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:6081

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 106 of file cryptnet_main.c.

109 {
112  BOOL ret = FALSE;
113 
114  /* The only applicable flag is CRYPT_GET_URL_FROM_EXTENSION */
116  {
118  return FALSE;
119  }
121  cert->pCertInfo->cExtension, cert->pCertInfo->rgExtension)))
122  {
124  DWORD size;
125 
127  ext->Value.pbData, ext->Value.cbData, CRYPT_DECODE_ALLOC_FLAG, NULL,
128  &aia, &size);
129  if (ret)
130  {
131  DWORD i, cUrl, bytesNeeded = sizeof(CRYPT_URL_ARRAY);
132 
133  for (i = 0, cUrl = 0; i < aia->cAccDescr; i++)
134  if (!strcmp(aia->rgAccDescr[i].pszAccessMethod,
136  {
137  if (aia->rgAccDescr[i].AccessLocation.dwAltNameChoice ==
139  {
140  if (aia->rgAccDescr[i].AccessLocation.u.pwszURL)
141  {
142  cUrl++;
143  bytesNeeded += sizeof(LPWSTR) +
144  (lstrlenW(aia->rgAccDescr[i].AccessLocation.u.
145  pwszURL) + 1) * sizeof(WCHAR);
146  }
147  }
148  else
149  FIXME("unsupported alt name type %d\n",
150  aia->rgAccDescr[i].AccessLocation.dwAltNameChoice);
151  }
152  if (!pcbUrlArray)
153  {
155  ret = FALSE;
156  }
157  else if (!pUrlArray)
158  *pcbUrlArray = bytesNeeded;
159  else if (*pcbUrlArray < bytesNeeded)
160  {
162  *pcbUrlArray = bytesNeeded;
163  ret = FALSE;
164  }
165  else
166  {
167  LPWSTR nextUrl;
168 
169  *pcbUrlArray = bytesNeeded;
170  pUrlArray->cUrl = 0;
171  pUrlArray->rgwszUrl =
172  (LPWSTR *)((BYTE *)pUrlArray + sizeof(CRYPT_URL_ARRAY));
173  nextUrl = (LPWSTR)((BYTE *)pUrlArray + sizeof(CRYPT_URL_ARRAY)
174  + cUrl * sizeof(LPWSTR));
175  for (i = 0; i < aia->cAccDescr; i++)
176  if (!strcmp(aia->rgAccDescr[i].pszAccessMethod,
178  {
179  if (aia->rgAccDescr[i].AccessLocation.dwAltNameChoice
181  {
182  if (aia->rgAccDescr[i].AccessLocation.u.pwszURL)
183  {
184  lstrcpyW(nextUrl,
185  aia->rgAccDescr[i].AccessLocation.u.pwszURL);
186  pUrlArray->rgwszUrl[pUrlArray->cUrl++] =
187  nextUrl;
188  nextUrl += (lstrlenW(nextUrl) + 1);
189  }
190  }
191  }
192  }
193  if (ret)
194  {
195  if (pcbUrlInfo)
196  {
197  FIXME("url info: stub\n");
198  if (!pUrlInfo)
199  *pcbUrlInfo = sizeof(CRYPT_URL_INFO);
200  else if (*pcbUrlInfo < sizeof(CRYPT_URL_INFO))
201  {
202  *pcbUrlInfo = sizeof(CRYPT_URL_INFO);
204  ret = FALSE;
205  }
206  else
207  {
208  *pcbUrlInfo = sizeof(CRYPT_URL_INFO);
209  memset(pUrlInfo, 0, sizeof(CRYPT_URL_INFO));
210  }
211  }
212  }
213  LocalFree(aia);
214  }
215  }
216  else
218  return ret;
219 }
#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:407
#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:110
#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:409
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
unsigned char BYTE
Definition: mem.h:68
#define ERROR_MORE_DATA
Definition: dderror.h:13
#define lstrcpyW
Definition: compat.h:406
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:6081
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 221 of file cryptnet_main.c.

224 {
225  BOOL ret;
227  DWORD size;
228 
230  value->pbData, value->cbData, CRYPT_DECODE_ALLOC_FLAG, NULL, &info, &size);
231  if (ret)
232  {
233  DWORD i, cUrl, bytesNeeded = sizeof(CRYPT_URL_ARRAY);
234 
235  for (i = 0, cUrl = 0; i < info->cDistPoint; i++)
236  if (info->rgDistPoint[i].DistPointName.dwDistPointNameChoice
238  {
239  DWORD j;
241  &info->rgDistPoint[i].DistPointName.u.FullName;
242 
243  for (j = 0; j < name->cAltEntry; j++)
244  if (name->rgAltEntry[j].dwAltNameChoice ==
246  {
247  if (name->rgAltEntry[j].u.pwszURL)
248  {
249  cUrl++;
250  bytesNeeded += sizeof(LPWSTR) +
251  (lstrlenW(name->rgAltEntry[j].u.pwszURL) + 1)
252  * sizeof(WCHAR);
253  }
254  }
255  }
256  if (!pcbUrlArray)
257  {
259  ret = FALSE;
260  }
261  else if (!pUrlArray)
262  *pcbUrlArray = bytesNeeded;
263  else if (*pcbUrlArray < bytesNeeded)
264  {
266  *pcbUrlArray = bytesNeeded;
267  ret = FALSE;
268  }
269  else
270  {
271  LPWSTR nextUrl;
272 
273  *pcbUrlArray = bytesNeeded;
274  pUrlArray->cUrl = 0;
275  pUrlArray->rgwszUrl =
276  (LPWSTR *)((BYTE *)pUrlArray + sizeof(CRYPT_URL_ARRAY));
277  nextUrl = (LPWSTR)((BYTE *)pUrlArray + sizeof(CRYPT_URL_ARRAY)
278  + cUrl * sizeof(LPWSTR));
279  for (i = 0; i < info->cDistPoint; i++)
280  if (info->rgDistPoint[i].DistPointName.dwDistPointNameChoice
282  {
283  DWORD j;
285  &info->rgDistPoint[i].DistPointName.u.FullName;
286 
287  for (j = 0; j < name->cAltEntry; j++)
288  if (name->rgAltEntry[j].dwAltNameChoice ==
290  {
291  if (name->rgAltEntry[j].u.pwszURL)
292  {
293  lstrcpyW(nextUrl,
294  name->rgAltEntry[j].u.pwszURL);
295  pUrlArray->rgwszUrl[pUrlArray->cUrl++] =
296  nextUrl;
297  nextUrl +=
298  (lstrlenW(name->rgAltEntry[j].u.pwszURL) + 1);
299  }
300  }
301  }
302  }
303  if (ret)
304  {
305  if (pcbUrlInfo)
306  {
307  FIXME("url info: stub\n");
308  if (!pUrlInfo)
309  *pcbUrlInfo = sizeof(CRYPT_URL_INFO);
310  else if (*pcbUrlInfo < sizeof(CRYPT_URL_INFO))
311  {
312  *pcbUrlInfo = sizeof(CRYPT_URL_INFO);
314  ret = FALSE;
315  }
316  else
317  {
318  *pcbUrlInfo = sizeof(CRYPT_URL_INFO);
319  memset(pUrlInfo, 0, sizeof(CRYPT_URL_INFO));
320  }
321  }
322  }
323  LocalFree(info);
324  }
325  return ret;
326 }
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:407
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:110
#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:409
int ret
unsigned char BYTE
Definition: mem.h:68
#define ERROR_MORE_DATA
Definition: dderror.h:13
#define lstrcpyW
Definition: compat.h:406
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
Definition: name.c:36
#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 778 of file cryptnet_main.c.

780 {
781  struct InetContext *context = (struct InetContext *)dwContext;
783 
784  switch (status)
785  {
787  result = statusInfo;
788  context->error = result->dwError;
790  }
791 }
Definition: http.c:6587
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
HANDLE event
Definition: http.c:6589
#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 613 of file cryptnet_main.c.

614 {
615  struct InetContext *context = CryptMemAlloc(sizeof(struct InetContext));
616 
617  if (context)
618  {
620  if (!context->event)
621  {
623  context = NULL;
624  }
625  else
626  {
627  context->timeout = dwTimeout;
628  context->error = ERROR_SUCCESS;
629  }
630  }
631  return context;
632 }
#define ERROR_SUCCESS
Definition: deptool.c:10
Definition: http.c:6587
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:6589
smooth NULL
Definition: ftsmooth.c:416
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD dwTimeout
Definition: wincrypt.h:6081
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 354 of file cryptnet_main.c.

357 {
359  HCRYPTOIDFUNCADDR hFunc = NULL;
360  BOOL ret = FALSE;
361 
362  TRACE("(%s, %p, %08x, %p, %p, %p, %p, %p)\n", debugstr_a(pszUrlOid),
363  pvPara, dwFlags, pUrlArray, pcbUrlArray, pUrlInfo, pcbUrlInfo, pvReserved);
364 
365  if (IS_INTOID(pszUrlOid))
366  {
367  switch (LOWORD(pszUrlOid))
368  {
371  break;
374  break;
375  default:
376  FIXME("unimplemented for %s\n", url_oid_to_str(pszUrlOid));
378  }
379  }
380  else
381  {
382  static HCRYPTOIDFUNCSET set = NULL;
383 
384  if (!set)
387  (void **)&func, &hFunc);
388  }
389  if (func)
390  ret = func(pszUrlOid, pvPara, dwFlags, pUrlArray, pcbUrlArray,
391  pUrlInfo, pcbUrlInfo, pvReserved);
392  if (hFunc)
393  CryptFreeOIDFunctionAddress(hFunc, 0);
394  return ret;
395 }
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:110
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:76
#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:409
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:42
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:6081
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 400 of file cryptnet_main.c.

404 {
405  BOOL ret = FALSE;
406  int len;
407 
408  TRACE("(%s, %s, %08x, %d, %p, %p, %p, %p, %p)\n", debugstr_a(pszURL),
411 
412  if (!pszURL)
413  {
415  return FALSE;
416  }
417  len = MultiByteToWideChar(CP_ACP, 0, pszURL, -1, NULL, 0);
418  if (len)
419  {
420  LPWSTR url = CryptMemAlloc(len * sizeof(WCHAR));
421 
422  if (url)
423  {
424  MultiByteToWideChar(CP_ACP, 0, pszURL, -1, url, len);
428  CryptMemFree(url);
429  }
430  else
432  }
433  return ret;
434 }
#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:6118
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:6118
_In_opt_ LPCSTR pszObjectOid
Definition: wincrypt.h:6118
#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:6081
#define SetLastError(x)
Definition: compat.h:409
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:6081
_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:6118
_In_opt_ LPCSTR _In_ DWORD dwRetrievalFlags
Definition: wincrypt.h:6118
#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 1492 of file cryptnet_main.c.

1496 {
1497  BOOL ret;
1500  HCRYPTOIDFUNCADDR hRetrieve = 0, hCreate = 0;
1501 
1502  TRACE("(%s, %s, %08x, %d, %p, %p, %p, %p, %p)\n", debugstr_w(pszURL),
1505 
1506  if (!pszURL)
1507  {
1509  return FALSE;
1510  }
1511  ret = CRYPT_GetRetrieveFunction(pszURL, &retrieve, &hRetrieve);
1512  if (ret)
1514  if (ret)
1515  {
1516  CRYPT_BLOB_ARRAY object = { 0, NULL };
1517  PFN_FREE_ENCODED_OBJECT_FUNC freeObject;
1518  void *freeContext;
1519  FILETIME expires;
1520 
1521  ret = retrieve(pszURL, pszObjectOid, dwRetrievalFlags, dwTimeout,
1522  &object, &freeObject, &freeContext, hAsyncRetrieve, pCredentials,
1523  pAuxInfo);
1524  if (ret)
1525  {
1529  {
1530  CRYPT_CacheURL(pszURL, &object, dwRetrievalFlags, expires);
1531  }
1532  freeObject(pszObjectOid, &object, freeContext);
1533  }
1534  }
1535  if (hCreate)
1536  CryptFreeOIDFunctionAddress(hCreate, 0);
1537  if (hRetrieve)
1538  CryptFreeOIDFunctionAddress(hRetrieve, 0);
1539  TRACE("returning %d\n", ret);
1540  return ret;
1541 }
#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:6118
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:6118
_In_opt_ LPCSTR pszObjectOid
Definition: wincrypt.h:6118
#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:6081
#define SetLastError(x)
Definition: compat.h:409
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:6081
_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:6118
BOOL WINAPI CryptFreeOIDFunctionAddress(HCRYPTOIDFUNCADDR hFuncAddr, DWORD dwFlags)
Definition: oid.c:468
_In_opt_ LPCSTR _In_ DWORD dwRetrievalFlags
Definition: wincrypt.h:6118
#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 1190 of file cryptnet_main.c.

1191 {
1192  BOOL ret;
1193  DWORD len = in->cbData;
1194 
1195  while (len && !in->pbData[len - 1]) len--;
1196  if (!CryptStringToBinaryA( (char *)in->pbData, len, CRYPT_STRING_BASE64_ANY,
1197  NULL, &out->cbData, NULL, NULL )) return FALSE;
1198 
1199  if (!(out->pbData = CryptMemAlloc( out->cbData ))) return FALSE;
1200  ret = CryptStringToBinaryA( (char *)in->pbData, len, CRYPT_STRING_BASE64_ANY,
1201  out->pbData, &out->cbData, NULL, NULL );
1202  if (!ret) CryptMemFree( out->pbData );
1203  return ret;
1204 }
#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 50 of file cryptnet_main.c.

51 {
52  TRACE("\n");
56  cryptNet, "LdapProvOpenStore");
58  CERT_STORE_PROV_LDAP_W, cryptNet, "LdapProvOpenStore");
59  return S_OK;
60 }
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:44

◆ DllUnregisterServer()

HRESULT WINAPI DllUnregisterServer ( void  )

Definition at line 65 of file cryptnet_main.c.

66 {
67  TRACE("\n");
73  return S_OK;
74 }
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:44

◆ 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 983 of file cryptnet_main.c.

988 {
989  URL_COMPONENTSW components = { sizeof(components), 0 };
990  BOOL ret;
991 
992  TRACE("(%s, %s, %08x, %d, %p, %p, %p, %p, %p, %p)\n", debugstr_w(pszURL),
994  ppfnFreeObject, ppvFreeContext, hAsyncRetrieve, pCredentials, pAuxInfo);
995 
996  pObject->cBlob = 0;
997  pObject->rgBlob = NULL;
998  *ppfnFreeObject = CRYPT_FreeBlob;
999  *ppvFreeContext = NULL;
1000 
1001  components.lpszUrlPath = CryptMemAlloc(INTERNET_MAX_PATH_LENGTH * sizeof(WCHAR));
1002  components.dwUrlPathLength = INTERNET_MAX_PATH_LENGTH;
1003  if (!components.lpszUrlPath)
1004  {
1006  return FALSE;
1007  }
1008 
1009  ret = InternetCrackUrlW(pszURL, 0, ICU_DECODE, &components);
1010  if (ret)
1011  {
1012  LPWSTR path;
1013 
1014  /* 3 == lstrlenW(L"c:") + 1 */
1015  path = CryptMemAlloc((components.dwUrlPathLength + 3) * sizeof(WCHAR));
1016  if (path)
1017  {
1018  HANDLE hFile;
1019 
1020  /* Try to create the file directly - Wine handles / in pathnames */
1021  lstrcpynW(path, components.lpszUrlPath,
1022  components.dwUrlPathLength + 1);
1025 #ifdef __REACTOS__
1026  if ((hFile == INVALID_HANDLE_VALUE) && (lstrlenW(components.lpszUrlPath) > 1) && (components.lpszUrlPath[1] != ':'))
1027 #else
1028  if (hFile == INVALID_HANDLE_VALUE)
1029 #endif
1030  {
1031  /* Try again on the current drive */
1032  GetCurrentDirectoryW(components.dwUrlPathLength, path);
1033  if (path[1] == ':')
1034  {
1035  lstrcpynW(path + 2, components.lpszUrlPath,
1036  components.dwUrlPathLength + 1);
1039  }
1040  if (hFile == INVALID_HANDLE_VALUE)
1041  {
1042  /* Try again on the Windows drive */
1043  GetWindowsDirectoryW(path, components.dwUrlPathLength);
1044  if (path[1] == ':')
1045  {
1046  lstrcpynW(path + 2, components.lpszUrlPath,
1047  components.dwUrlPathLength + 1);
1050  }
1051  }
1052  }
1053  if (hFile != INVALID_HANDLE_VALUE)
1054  {
1055  if ((ret = CRYPT_GetObjectFromFile(hFile, pObject)))
1056  {
1057  if (pAuxInfo && pAuxInfo->cbSize >=
1059  pLastSyncTime) + sizeof(PFILETIME) &&
1060  pAuxInfo->pLastSyncTime)
1062  pAuxInfo->pLastSyncTime);
1063  }
1064  CloseHandle(hFile);
1065  }
1066  else
1067  ret = FALSE;
1068  CryptMemFree(path);
1069  }
1070  else
1071  {
1073  ret = FALSE;
1074  }
1075  }
1076  CryptMemFree(components.lpszUrlPath);
1077  return ret;
1078 }
#define CloseHandle
Definition: compat.h:398
GLsizei const GLchar ** path
Definition: glext.h:7234
#define GetCurrentDirectoryW(x, y)
Definition: compat.h:413
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
#define lstrlenW
Definition: compat.h:407
#define FILE_SHARE_READ
Definition: compat.h:125
#define lstrcpynW
Definition: compat.h:397
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:6118
#define OPEN_EXISTING
Definition: compat.h:426
_In_opt_ LPCSTR pszObjectOid
Definition: wincrypt.h:6118
#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:6081
#define SetLastError(x)
Definition: compat.h:409
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:6081
_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:6118
#define INTERNET_MAX_PATH_LENGTH
Definition: wininet.h:49
Definition: services.c:325
_In_opt_ LPCSTR _In_ DWORD dwRetrievalFlags
Definition: wincrypt.h:6118
#define CreateFileW
Definition: compat.h:400
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:1645
#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 840 of file cryptnet_main.c.

845 {
846  FIXME("(%s, %s, %08x, %d, %p, %p, %p, %p, %p, %p)\n", debugstr_w(pszURL),
848  ppfnFreeObject, ppvFreeContext, hAsyncRetrieve, pCredentials, pAuxInfo);
849 
850  pObject->cBlob = 0;
851  pObject->rgBlob = NULL;
852  *ppfnFreeObject = CRYPT_FreeBlob;
853  *ppvFreeContext = NULL;
854  return FALSE;
855 }
PCRYPT_DATA_BLOB rgBlob
Definition: wincrypt.h:1569
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
_In_opt_ LPCSTR _In_ DWORD _In_ DWORD _Outptr_ LPVOID _In_opt_ HCRYPTASYNC hAsyncRetrieve
Definition: wincrypt.h:6118
_In_opt_ LPCSTR pszObjectOid
Definition: wincrypt.h:6118
#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:6081
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD dwTimeout
Definition: wincrypt.h:6081
_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:6118
_In_opt_ LPCSTR _In_ DWORD dwRetrievalFlags
Definition: wincrypt.h:6118
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 879 of file cryptnet_main.c.

884 {
885  BOOL ret = FALSE;
886 
887  TRACE("(%s, %s, %08x, %d, %p, %p, %p, %p, %p, %p)\n", debugstr_w(pszURL),
889  ppfnFreeObject, ppvFreeContext, hAsyncRetrieve, pCredentials, pAuxInfo);
890 
891  pObject->cBlob = 0;
892  pObject->rgBlob = NULL;
893  *ppfnFreeObject = CRYPT_FreeBlob;
894  *ppvFreeContext = NULL;
895 
897  ret = CRYPT_GetObjectFromCache(pszURL, pObject, pAuxInfo);
900  {
902 
903  if ((ret = CRYPT_CrackUrl(pszURL, &components)))
904  {
905  HINTERNET hInt, hHost;
906  struct InetContext *context = NULL;
907 
908  if (dwTimeout)
911  &hHost);
912  if (ret)
913  {
914  static LPCWSTR types[] = { x509cacert, x509emailcert,
916  pkcs7sig, pkcs7mime, NULL };
917  HINTERNET hHttp = HttpOpenRequestW(hHost, NULL,
918  components.lpszUrlPath, NULL, NULL, types,
920  (DWORD_PTR)context);
921 
922  if (hHttp)
923  {
924  if (dwTimeout)
925  {
926  InternetSetOptionW(hHttp,
928  sizeof(dwTimeout));
930  &dwTimeout, sizeof(dwTimeout));
931  }
932  ret = HttpSendRequestExW(hHttp, NULL, NULL, 0,
933  (DWORD_PTR)context);
934  if (!ret && GetLastError() == ERROR_IO_PENDING)
935  {
937  context->timeout) == WAIT_TIMEOUT)
939  else
940  ret = TRUE;
941  }
942  if (ret &&
943  !(ret = HttpEndRequestW(hHttp, NULL, 0, (DWORD_PTR)context)) &&
945  {
947  context->timeout) == WAIT_TIMEOUT)
949  else
950  ret = TRUE;
951  }
952  if (ret)
954  context, pObject, pAuxInfo);
956  {
957  SYSTEMTIME st;
958  FILETIME ft;
959  DWORD len = sizeof(st);
960 
962  &st, &len, NULL) && SystemTimeToFileTime(&st, &ft))
963  CRYPT_CacheURL(pszURL, pObject, dwRetrievalFlags, ft);
964  }
965  InternetCloseHandle(hHttp);
966  }
967  InternetCloseHandle(hHost);
968  InternetCloseHandle(hInt);
969  }
970  if (context)
971  {
974  }
975  CryptMemFree(components.lpszUrlPath);
976  CryptMemFree(components.lpszHostName);
977  }
978  }
979  TRACE("returning %d\n", ret);
980  return ret;
981 }
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:398
#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:6587
#define ERROR_TIMEOUT
Definition: winerror.h:941
BOOL WINAPI InternetSetOptionW(HINTERNET hInternet, DWORD dwOption, LPVOID lpBuffer, DWORD dwBufferLength)
Definition: internet.c:2716
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BOOL WINAPI InternetCloseHandle(HINTERNET hInternet)
Definition: internet.c:1437
#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:6589
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:6118
BOOL WINAPI HttpSendRequestExW(HINTERNET hRequest, LPINTERNET_BUFFERSW lpBuffersIn, LPINTERNET_BUFFERSW lpBuffersOut, DWORD dwFlags, DWORD_PTR dwContext)
Definition: http.c:5470
_In_opt_ LPCSTR pszObjectOid
Definition: wincrypt.h:6118
#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:6081
BOOL WINAPI HttpEndRequestW(HINTERNET hRequest, LPINTERNET_BUFFERSW lpBuffersOut, DWORD dwFlags, DWORD_PTR dwContext)
Definition: http.c:5359
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR x509servercert[]
#define SetLastError(x)
Definition: compat.h:409
#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:3807
GLenum GLsizei len
Definition: glext.h:6722
uint32_t DWORD_PTR
Definition: typedefs.h:63
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD dwTimeout
Definition: wincrypt.h:6081
_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:6118
#define INTERNET_FLAG_NO_UI
Definition: wininet.h:84
BOOL WINAPI SystemTimeToFileTime(IN CONST SYSTEMTIME *lpSystemTime, OUT LPFILETIME lpFileTime)
Definition: time.c:148
_In_opt_ LPCSTR _In_ DWORD dwRetrievalFlags
Definition: wincrypt.h:6118
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:3419
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 76 of file cryptnet_main.c.

77 {
78  if (IS_INTOID(oid))
79  {
80  static char buf[10];
81 
82  switch (LOWORD(oid))
83  {
84 #define _x(oid) case LOWORD(oid): return #oid
93 #undef _x
94  default:
95  snprintf(buf, sizeof(buf), "%d", LOWORD(oid));
96  return buf;
97  }
98  }
99  else
100  return oid;
101 }
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:42
#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 1718 of file cryptnet_main.c.

1721 {
1724 
1726  cert->pCertInfo->cExtension, cert->pCertInfo->rgExtension)))
1728  index, pTime, dwFlags, pRevPara, pRevStatus);
1730  cert->pCertInfo->cExtension, cert->pCertInfo->rgExtension)))
1732  index, pTime, dwFlags, pRevPara, pRevStatus);
1733  else
1734  {
1735  if (pRevPara && pRevPara->hCrlStore && pRevPara->pIssuerCert)
1736  {
1738  BOOL canSignCRLs;
1739 
1740  /* If the caller told us about the issuer, make sure the issuer
1741  * can sign CRLs before looking for one.
1742  */
1744  pRevPara->pIssuerCert->pCertInfo->cExtension,
1745  pRevPara->pIssuerCert->pCertInfo->rgExtension)))
1746  {
1748  DWORD size = sizeof(usage);
1749 
1750  if (!CryptDecodeObjectEx(cert->dwCertEncodingType, X509_BITS,
1751  ext->Value.pbData, ext->Value.cbData,
1753  canSignCRLs = FALSE;
1754  else if (usage.cbData > 2)
1755  {
1756  /* The key usage extension only defines 9 bits => no more
1757  * than 2 bytes are needed to encode all known usages.
1758  */
1759  canSignCRLs = FALSE;
1760  }
1761  else
1762  {
1763  BYTE usageBits = usage.pbData[usage.cbData - 1];
1764 
1765  canSignCRLs = usageBits & CERT_CRL_SIGN_KEY_USAGE;
1766  }
1767  }
1768  else
1769  canSignCRLs = TRUE;
1770  if (canSignCRLs)
1771  {
1772  /* If the caller was helpful enough to tell us where to find a
1773  * CRL for the cert, look for one and check it.
1774  */
1775  crl = CertFindCRLInStore(pRevPara->hCrlStore,
1776  cert->dwCertEncodingType,
1779  CRL_FIND_ISSUED_BY, pRevPara->pIssuerCert, NULL);
1780  }
1781  if (crl)
1782  {
1784  index, pTime, pRevStatus);
1786  }
1787  else
1788  {
1789  TRACE("no CRL found\n");
1791  pRevStatus->dwIndex = index;
1792  }
1793  }
1794  else
1795  {
1796  if (!pRevPara)
1797  WARN("no CERT_REVOCATION_PARA\n");
1798  else if (!pRevPara->hCrlStore)
1799  WARN("no dist points/aia extension and no CRL store\n");
1800  else if (!pRevPara->pIssuerCert)
1801  WARN("no dist points/aia extension and no issuer\n");
1803  pRevStatus->dwIndex = index;
1804  }
1805  }
1806  return error;
1807 }
#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:111
#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:4840
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: mem.h:68
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 1643 of file cryptnet_main.c.

1647 {
1648  BOOL ret;
1649  DWORD error, size;
1651 
1653  value->pbData, value->cbData, CRYPT_DECODE_ALLOC_FLAG, NULL, &aia, &size);
1654  if (ret)
1655  {
1656  DWORD i;
1657 
1658  for (i = 0; i < aia->cAccDescr; i++)
1659  if (!strcmp(aia->rgAccDescr[i].pszAccessMethod,
1660  szOID_PKIX_OCSP))
1661  {
1662  if (aia->rgAccDescr[i].AccessLocation.dwAltNameChoice ==
1664  FIXME("OCSP URL = %s\n",
1665  debugstr_w(aia->rgAccDescr[i].AccessLocation.u.pwszURL));
1666  else
1667  FIXME("unsupported AccessLocation type %d\n",
1668  aia->rgAccDescr[i].AccessLocation.dwAltNameChoice);
1669  }
1670  LocalFree(aia);
1671  /* FIXME: lie and pretend OCSP validated the cert */
1672  error = ERROR_SUCCESS;
1673  }
1674  else
1675  error = GetLastError();
1676  return error;
1677 }
#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:110
#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 1566 of file cryptnet_main.c.

1570 {
1571  DWORD error = ERROR_SUCCESS, cbUrlArray;
1572 
1573  if (CRYPT_GetUrlFromCRLDistPointsExt(value, NULL, &cbUrlArray, NULL, NULL))
1574  {
1575  CRYPT_URL_ARRAY *urlArray = CryptMemAlloc(cbUrlArray);
1576 
1577  if (urlArray)
1578  {
1579  DWORD j, retrievalFlags = 0, startTime, endTime, timeout;
1580  BOOL ret;
1581 
1583  &cbUrlArray, NULL, NULL);
1585  retrievalFlags |= CRYPT_CACHE_ONLY_RETRIEVAL;
1587  pRevPara && pRevPara->cbSize >= offsetof(CERT_REVOCATION_PARA,
1588  dwUrlRetrievalTimeout) + sizeof(DWORD))
1589  {
1590  startTime = GetTickCount();
1591  endTime = startTime + pRevPara->dwUrlRetrievalTimeout;
1592  timeout = pRevPara->dwUrlRetrievalTimeout;
1593  }
1594  else
1595  endTime = timeout = 0;
1596  if (!ret)
1597  error = GetLastError();
1598  /* continue looping if one was offline; break if revoked or timed out */
1599  for (j = 0; (!error || error == CRYPT_E_REVOCATION_OFFLINE) && j < urlArray->cUrl; j++)
1600  {
1602 
1603  ret = CryptRetrieveObjectByUrlW(urlArray->rgwszUrl[j],
1604  CONTEXT_OID_CRL, retrievalFlags, timeout, (void **)&crl,
1605  NULL, NULL, NULL, NULL);
1606  if (ret)
1607  {
1609  index, pTime, pRevStatus);
1610  if (!error && timeout)
1611  {
1612  DWORD time = GetTickCount();
1613 
1614  if ((int)(endTime - time) <= 0)
1615  {
1616  error = ERROR_TIMEOUT;
1617  pRevStatus->dwIndex = index;
1618  }
1619  else
1620  timeout = endTime - time;
1621  }
1623  }
1624  else
1626  }
1627  CryptMemFree(urlArray);
1628  }
1629  else
1630  {
1632  pRevStatus->dwIndex = index;
1633  }
1634  }
1635  else
1636  {
1637  error = GetLastError();
1638  pRevStatus->dwIndex = index;
1639  }
1640  return error;
1641 }
#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:115
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:445
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:4840
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 1679 of file cryptnet_main.c.

1682 {
1683  DWORD error;
1684  LONG valid;
1685 
1686  valid = CompareFileTime(pTime, &crl->pCrlInfo->ThisUpdate);
1687  if (valid <= 0)
1688  {
1689  /* If this CRL is not older than the time being verified, there's no
1690  * way to know whether the certificate was revoked.
1691  */
1692  TRACE("CRL not old enough\n");
1694  }
1695  else
1696  {
1697  PCRL_ENTRY entry = NULL;
1698 
1700  if (entry)
1701  {
1703  pRevStatus->dwIndex = index;
1704  }
1705  else
1706  {
1707  /* Since the CRL was not retrieved for the cert being checked,
1708  * there's no guarantee it's fresh, so the cert *might* be okay,
1709  * but it's safer not to guess.
1710  */
1711  TRACE("certificate not found\n");
1713  }
1714  }
1715  return error;
1716 }
#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:4840
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 1543 of file cryptnet_main.c.

1546 {
1547  DWORD error;
1548  PCRL_ENTRY entry = NULL;
1549 
1551  if (entry)
1552  {
1554  pRevStatus->dwIndex = index;
1555  }
1556  else
1557  {
1558  /* Since the CRL was retrieved for the cert being checked, then it's
1559  * guaranteed to be fresh, and the cert is not revoked.
1560  */
1561  error = ERROR_SUCCESS;
1562  }
1563  return error;
1564 }
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 44 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 867 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 872 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 876 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 874 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 870 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 857 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 859 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 862 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 865 of file cryptnet_main.c.

Referenced by HTTP_RetrieveEncodedObjectW().