Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1046 lines
34 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1998 - 1999
  6. //
  7. // File: thunks.cpp
  8. //
  9. //--------------------------------------------------------------------------
  10. #define _CRYPT32_
  11. #include <windows.h>
  12. #include "unicode.h"
  13. #include "crypthlp.h"
  14. #include <stdlib.h>
  15. #include <assert.h>
  16. typedef PCCERT_CONTEXT
  17. (WINAPI * PFNCertCreateSelfSignCertificate) (
  18. IN HCRYPTPROV hProv,
  19. IN PCERT_NAME_BLOB pSubjectIssuerBlob,
  20. IN DWORD dwFlags,
  21. OPTIONAL PCRYPT_KEY_PROV_INFO pKeyProvInfo,
  22. OPTIONAL PCRYPT_ALGORITHM_IDENTIFIER pSignatureAlgorithm,
  23. OPTIONAL PSYSTEMTIME pStartTime,
  24. OPTIONAL PSYSTEMTIME pEndTime,
  25. OPTIONAL PCERT_EXTENSIONS pExtensions
  26. );
  27. PFNCertCreateSelfSignCertificate pfnCertCreateSelfSignCertificate = CertCreateSelfSignCertificate;
  28. typedef PCCRYPT_OID_INFO
  29. (WINAPI * PFNCryptFindOIDInfo) (
  30. IN DWORD dwKeyType,
  31. IN void *pvKey,
  32. IN DWORD dwGroupId // 0 => any group
  33. );
  34. PFNCryptFindOIDInfo pfnCryptFindOIDInfo = CryptFindOIDInfo;
  35. typedef BOOL
  36. (WINAPI * PFNCryptQueryObject) (DWORD dwObjectType,
  37. const void *pvObject,
  38. DWORD dwExpectedContentTypeFlags,
  39. DWORD dwExpectedFormatTypeFlags,
  40. DWORD dwFlags,
  41. DWORD *pdwMsgAndCertEncodingType,
  42. DWORD *pdwContentType,
  43. DWORD *pdwFormatType,
  44. HCERTSTORE *phCertStore,
  45. HCRYPTMSG *phMsg,
  46. const void **ppvContext);
  47. PFNCryptQueryObject pfnCryptQueryObject = CryptQueryObject;
  48. typedef BOOL
  49. (WINAPI * PFNCertStrToNameW) (
  50. IN DWORD dwCertEncodingType,
  51. IN LPCWSTR pwszX500,
  52. IN DWORD dwStrType,
  53. IN OPTIONAL void *pvReserved,
  54. OUT BYTE *pbEncoded,
  55. IN OUT DWORD *pcbEncoded,
  56. OUT OPTIONAL LPCWSTR *ppwszError
  57. );
  58. PFNCertStrToNameW pfnCertStrToNameW = CertStrToNameW;
  59. typedef BOOL
  60. (WINAPI * PFNCryptVerifyMessageSignature)
  61. (IN PCRYPT_VERIFY_MESSAGE_PARA pVerifyPara,
  62. IN DWORD dwSignerIndex,
  63. IN BYTE const *pbSignedBlob,
  64. IN DWORD cbSignedBlob,
  65. OUT BYTE *pbDecoded,
  66. IN OUT DWORD *pcbDecoded,
  67. OUT OPTIONAL PCCERT_CONTEXT *ppSignerCert);
  68. PFNCryptVerifyMessageSignature pfnCryptVerifyMessageSignature = CryptVerifyMessageSignature;
  69. BOOL
  70. WINAPI
  71. PFXIsPFXBlob(
  72. CRYPT_DATA_BLOB* /*pPFX*/)
  73. {
  74. return FALSE;
  75. }
  76. // Stubs to functions called from oidinfo.cpp
  77. BOOL WINAPI
  78. ChainIsConnected()
  79. {
  80. return(FALSE);
  81. }
  82. BOOL WINAPI
  83. ChainRetrieveObjectByUrlW (
  84. IN LPCWSTR /*pszUrl*/,
  85. IN LPCSTR /*pszObjectOid*/,
  86. IN DWORD /*dwRetrievalFlags*/,
  87. IN DWORD /*dwTimeout*/,
  88. OUT LPVOID* /*ppvObject*/,
  89. IN HCRYPTASYNC /*hAsyncRetrieve*/,
  90. IN PCRYPT_CREDENTIALS /*pCredentials*/,
  91. IN LPVOID /*pvVerify*/,
  92. IN OPTIONAL PCRYPT_RETRIEVE_AUX_INFO /*pAuxInfo*/
  93. )
  94. {
  95. SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
  96. return(FALSE);
  97. }
  98. extern "C" {
  99. BOOL
  100. WINAPI
  101. CertAddEncodedCTLToStore(
  102. IN HCERTSTORE /*hCertStore*/,
  103. IN DWORD /*dwMsgAndCertEncodingType*/,
  104. IN const BYTE * /*pbCtlEncoded*/,
  105. IN DWORD /*cbCtlEncoded*/,
  106. IN DWORD /*dwAddDisposition*/,
  107. OUT OPTIONAL PCCTL_CONTEXT * /*ppCtlContext*/
  108. ) {
  109. SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
  110. return(FALSE);
  111. }
  112. BOOL
  113. WINAPI
  114. CertFreeCTLContext(
  115. IN PCCTL_CONTEXT /*pCtlContext*/
  116. )
  117. {
  118. SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
  119. return(FALSE);
  120. }
  121. BOOL
  122. WINAPI
  123. CryptSIPLoad(
  124. const GUID * /*pgSubject*/,
  125. DWORD /*dwFlags*/,
  126. void * /*psSipTable*/
  127. )
  128. {
  129. SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
  130. return(FALSE);
  131. }
  132. BOOL
  133. WINAPI
  134. CryptSIPRetrieveSubjectGuid(
  135. IN LPCWSTR /*FileName*/,
  136. IN OPTIONAL HANDLE /*hFileIn*/,
  137. OUT GUID * /*pgSubject*/)
  138. {
  139. SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
  140. return(FALSE);
  141. }
  142. } // end of extern C
  143. // Thunk routines for function not in IE3.02Upd
  144. PCCERT_CONTEXT
  145. WINAPI
  146. MyCertCreateSelfSignCertificate(
  147. IN HCRYPTPROV hProv,
  148. IN PCERT_NAME_BLOB pSubjectIssuerBlob,
  149. IN DWORD dwFlags,
  150. OPTIONAL PCRYPT_KEY_PROV_INFO pKeyProvInfo,
  151. OPTIONAL PCRYPT_ALGORITHM_IDENTIFIER pSignatureAlgorithm,
  152. OPTIONAL PSYSTEMTIME pStartTime,
  153. OPTIONAL PSYSTEMTIME pEndTime,
  154. OPTIONAL PCERT_EXTENSIONS pExtensions
  155. )
  156. {
  157. return(pfnCertCreateSelfSignCertificate(
  158. hProv,
  159. pSubjectIssuerBlob,
  160. dwFlags,
  161. pKeyProvInfo,
  162. pSignatureAlgorithm,
  163. pStartTime,
  164. pEndTime,
  165. pExtensions));
  166. }
  167. PCCRYPT_OID_INFO
  168. WINAPI
  169. xeCryptFindOIDInfo(
  170. IN DWORD dwKeyType,
  171. IN void *pvKey,
  172. IN DWORD dwGroupId // 0 => any group
  173. )
  174. {
  175. return(pfnCryptFindOIDInfo(
  176. dwKeyType,
  177. pvKey,
  178. dwGroupId));
  179. }
  180. BOOL
  181. WINAPI
  182. MyCryptQueryObject(DWORD dwObjectType,
  183. const void *pvObject,
  184. DWORD dwExpectedContentTypeFlags,
  185. DWORD dwExpectedFormatTypeFlags,
  186. DWORD dwFlags,
  187. DWORD *pdwMsgAndCertEncodingType,
  188. DWORD *pdwContentType,
  189. DWORD *pdwFormatType,
  190. HCERTSTORE *phCertStore,
  191. HCRYPTMSG *phMsg,
  192. const void **ppvContext)
  193. {
  194. return(pfnCryptQueryObject(
  195. dwObjectType,
  196. pvObject,
  197. dwExpectedContentTypeFlags,
  198. dwExpectedFormatTypeFlags,
  199. dwFlags,
  200. pdwMsgAndCertEncodingType,
  201. pdwContentType,
  202. pdwFormatType,
  203. phCertStore,
  204. phMsg,
  205. ppvContext));
  206. }
  207. BOOL
  208. WINAPI
  209. MyCertStrToNameW(
  210. IN DWORD dwCertEncodingType,
  211. IN LPCWSTR pwszX500,
  212. IN DWORD dwStrType,
  213. IN OPTIONAL void * pvReserved,
  214. OUT BYTE * pbEncoded,
  215. IN OUT DWORD * pcbEncoded,
  216. OUT OPTIONAL LPCWSTR * ppwszError
  217. )
  218. {
  219. return(pfnCertStrToNameW(
  220. dwCertEncodingType,
  221. pwszX500,
  222. dwStrType,
  223. pvReserved,
  224. pbEncoded,
  225. pcbEncoded,
  226. ppwszError));
  227. }
  228. BOOL
  229. WINAPI
  230. MyCryptVerifyMessageSignature
  231. (IN PCRYPT_VERIFY_MESSAGE_PARA pVerifyPara,
  232. IN DWORD dwSignerIndex,
  233. IN BYTE const *pbSignedBlob,
  234. IN DWORD cbSignedBlob,
  235. OUT BYTE *pbDecoded,
  236. IN OUT DWORD *pcbDecoded,
  237. OUT OPTIONAL PCCERT_CONTEXT *ppSignerCert)
  238. {
  239. return pfnCryptVerifyMessageSignature
  240. (pVerifyPara,
  241. dwSignerIndex,
  242. pbSignedBlob,
  243. cbSignedBlob,
  244. pbDecoded,
  245. pcbDecoded,
  246. ppSignerCert);
  247. }
  248. extern "C"
  249. BOOL WINAPI InitIE302UpdThunks(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
  250. {
  251. HMODULE hModCrypt32 = NULL;
  252. FARPROC fproc;
  253. DWORD verCrypt32MS;
  254. DWORD verCrypt32LS;
  255. DWORD verXEnrollMS;
  256. DWORD verXEnrollLS;
  257. char szFileName[_MAX_PATH];
  258. LPWSTR wszFilePathCrypt32 = NULL;
  259. LPWSTR wszFilePathXEnroll = NULL;
  260. if (dwReason == DLL_PROCESS_ATTACH) {
  261. // this can't fail because it is already loaded
  262. hModCrypt32 = GetModuleHandleA("Crypt32.dll");
  263. assert(hModCrypt32);
  264. // Get Filever of crypt32 and XEnroll, only copy go to crypt32 if it is newer than xenroll
  265. if( 0 != GetModuleFileNameA(hModCrypt32, szFileName, sizeof(szFileName)) &&
  266. NULL != (wszFilePathCrypt32 = MkWStr(szFileName)) &&
  267. I_CryptGetFileVersion(wszFilePathCrypt32, &verCrypt32MS, &verCrypt32LS) &&
  268. 0 != GetModuleFileNameA(hInstance, szFileName, sizeof(szFileName)) &&
  269. NULL != (wszFilePathXEnroll = MkWStr(szFileName)) &&
  270. I_CryptGetFileVersion(wszFilePathXEnroll, &verXEnrollMS, &verXEnrollLS) &&
  271. ( (verCrypt32MS > verXEnrollMS) ||
  272. ((verCrypt32MS == verXEnrollMS) && verCrypt32LS >= verXEnrollLS) ) ) {
  273. // crypt32 must be newer, use his functions
  274. if(NULL != (fproc = GetProcAddress(hModCrypt32, "CertCreateSelfSignCertificate")))
  275. pfnCertCreateSelfSignCertificate = (PFNCertCreateSelfSignCertificate) fproc;
  276. if(NULL != (fproc = GetProcAddress(hModCrypt32, "CryptFindOIDInfo")))
  277. pfnCryptFindOIDInfo = (PFNCryptFindOIDInfo) fproc;
  278. if(NULL != (fproc = GetProcAddress(hModCrypt32, "CryptQueryObject")))
  279. pfnCryptQueryObject = (PFNCryptQueryObject) fproc;
  280. if(NULL != (fproc = GetProcAddress(hModCrypt32, "CertStrToNameW")))
  281. pfnCertStrToNameW = (PFNCertStrToNameW) fproc;
  282. if(NULL != (fproc = GetProcAddress(hModCrypt32, "CryptVerifyMessageSignature")))
  283. pfnCryptVerifyMessageSignature = (PFNCryptVerifyMessageSignature) fproc;
  284. }
  285. // free allocated handles
  286. if(wszFilePathCrypt32 != NULL)
  287. FreeWStr(wszFilePathCrypt32);
  288. if(wszFilePathXEnroll != NULL)
  289. FreeWStr(wszFilePathXEnroll);
  290. }
  291. return(TRUE);
  292. }
  293. BOOL
  294. MyCryptStringToBinaryA(
  295. IN LPCSTR pszString,
  296. IN DWORD cchString,
  297. IN DWORD dwFlags,
  298. IN BYTE *pbBinary,
  299. IN OUT DWORD *pcbBinary,
  300. OUT DWORD *pdwSkip, //OPTIONAL
  301. OUT DWORD *pdwFlags //OPTIONAL
  302. )
  303. {
  304. return CryptStringToBinaryA(
  305. pszString,
  306. cchString,
  307. dwFlags,
  308. pbBinary,
  309. pcbBinary,
  310. pdwSkip,
  311. pdwFlags);
  312. }
  313. BOOL
  314. MyCryptStringToBinaryW(
  315. IN LPCWSTR pszString,
  316. IN DWORD cchString,
  317. IN DWORD dwFlags,
  318. IN BYTE *pbBinary,
  319. IN OUT DWORD *pcbBinary,
  320. OUT DWORD *pdwSkip, //OPTIONAL
  321. OUT DWORD *pdwFlags //OPTIONAL
  322. )
  323. {
  324. return CryptStringToBinaryW(
  325. pszString,
  326. cchString,
  327. dwFlags,
  328. pbBinary,
  329. pcbBinary,
  330. pdwSkip,
  331. pdwFlags);
  332. }
  333. BOOL
  334. MyCryptBinaryToStringA(
  335. IN CONST BYTE *pbBinary,
  336. IN DWORD cbBinary,
  337. IN DWORD dwFlags,
  338. IN LPSTR pszString,
  339. IN OUT DWORD *pcchString
  340. )
  341. {
  342. return CryptBinaryToStringA(
  343. pbBinary,
  344. cbBinary,
  345. dwFlags,
  346. pszString,
  347. pcchString);
  348. }
  349. BOOL
  350. MyCryptBinaryToStringW(
  351. IN CONST BYTE *pbBinary,
  352. IN DWORD cbBinary,
  353. IN DWORD dwFlags,
  354. IN LPWSTR pszString,
  355. IN OUT DWORD *pcchString
  356. )
  357. {
  358. return CryptBinaryToStringW(
  359. pbBinary,
  360. cbBinary,
  361. dwFlags,
  362. pszString,
  363. pcchString);
  364. }
  365. #ifdef _X86_
  366. #define ASN1C
  367. #include "msber.h"
  368. static HMODULE hmsasn1=NULL;
  369. typedef ASN1module_t (__stdcall * ASN1_CREATEMODULE)(
  370. ASN1uint32_t version,
  371. ASN1encodingrule_e eEncodingRule,
  372. ASN1uint32_t dwFlags,
  373. ASN1uint32_t cPDUs,
  374. const ASN1GenericFun_t apfnEncoder[],
  375. const ASN1GenericFun_t apfnDecoder[],
  376. const ASN1FreeFun_t apfnFreeMemory[],
  377. const ASN1uint32_t acbStructSize[],
  378. ASN1magic_t nModuleName
  379. );
  380. typedef void (__stdcall * ASN1_CLOSEMODULE)( ASN1module_t pModule );
  381. typedef int (__stdcall * ASN1BERENCENDOFCONTENTS)( ASN1encoding_t enc, ASN1uint32_t nLenOff );
  382. typedef int (__stdcall * ASN1BERENCOBJECTIDENTIFIER2)( ASN1encoding_t enc, ASN1uint32_t tag, ASN1objectidentifier2_t *val );
  383. typedef int (__stdcall * ASN1BERENCEXPLICITTAG)( ASN1encoding_t enc, ASN1uint32_t tag, ASN1uint32_t *pnLenOff );
  384. typedef int (__stdcall * ASN1BERDECENDOFCONTENTS)( ASN1decoding_t dec, ASN1decoding_t dd, ASN1octet_t *pBufEnd );
  385. typedef int (__stdcall * ASN1BERDECOBJECTIDENTIFIER2)( ASN1decoding_t dec, ASN1uint32_t tag, ASN1objectidentifier2_t *val );
  386. typedef LPVOID (__stdcall * ASN1DECREALLOC)( ASN1decoding_t dec, LPVOID ptr, ASN1uint32_t size );
  387. typedef int (__stdcall * ASN1BERDECPEEKTAG)( ASN1decoding_t dec, ASN1uint32_t *tag );
  388. typedef int (__stdcall * ASN1BERDECNOTENDOFCONTENTS)( ASN1decoding_t dec, ASN1octet_t *pBufEnd );
  389. typedef int (__stdcall * ASN1BERDECEXPLICITTAG)( ASN1decoding_t dec, ASN1uint32_t tag, ASN1decoding_t *dd, ASN1octet_t **ppBufEnd );
  390. typedef void (__stdcall * ASN1FREE)( LPVOID ptr );
  391. typedef int (__stdcall * ASN1BERENCS32)( ASN1encoding_t enc, ASN1uint32_t tag, ASN1int32_t val );
  392. typedef int (__stdcall * ASN1BERENCBOOL)( ASN1encoding_t enc, ASN1uint32_t tag, ASN1bool_t val );
  393. typedef int (__stdcall * ASN1BERDECS32VAL)( ASN1decoding_t dec, ASN1uint32_t tag, ASN1int32_t *val );
  394. typedef int (__stdcall * ASN1BERDECBOOL)( ASN1decoding_t dec, ASN1uint32_t tag, ASN1bool_t *val );
  395. typedef int (__stdcall * ASN1BERENCCHAR16STRING)( ASN1encoding_t enc, ASN1uint32_t tag, ASN1uint32_t len, ASN1char16_t *val );
  396. typedef int (__stdcall * ASN1BERENCBITSTRING)( ASN1encoding_t enc, ASN1uint32_t tag, ASN1uint32_t len, ASN1octet_t *val );
  397. typedef int (__stdcall * ASN1BERDECBITSTRING2)( ASN1decoding_t dec, ASN1uint32_t tag, ASN1bitstring_t *val );
  398. typedef int (__stdcall * ASN1BERDECCHAR16STRING)( ASN1decoding_t dec, ASN1uint32_t tag, ASN1char16string_t *val );
  399. typedef void (__stdcall * ASN1CHAR16STRING_FREE)( ASN1char16string_t *val );
  400. typedef int (__stdcall * ASN1BERENCU32)( ASN1encoding_t enc, ASN1uint32_t tag, ASN1uint32_t val );
  401. typedef int (__stdcall * ASN1BERENCOCTETSTRING)( ASN1encoding_t enc, ASN1uint32_t tag, ASN1uint32_t len, ASN1octet_t *val );
  402. typedef int (__stdcall * ASN1BERDECU32VAL)( ASN1decoding_t dec, ASN1uint32_t tag, ASN1uint32_t *val );
  403. typedef int (__stdcall * ASN1BERDECOCTETSTRING2)( ASN1decoding_t dec, ASN1uint32_t tag, ASN1octetstring_t *val );
  404. typedef int (__stdcall * ASN1CERENCBEGINBLK)( ASN1encoding_t enc, ASN1blocktype_e eBlkType, void **ppBlk_ );
  405. typedef int (__stdcall * ASN1CERENCNEWBLKELEMENT)( void *pBlk_, ASN1encoding_t *enc2 );
  406. typedef int (__stdcall * ASN1CERENCFLUSHBLKELEMENT)( void *pBlk_ );
  407. typedef int (__stdcall * ASN1CERENCENDBLK)( void *pBlk_ );
  408. typedef int (__stdcall * ASN1BERENCOPENTYPE)( ASN1encoding_t enc, ASN1open_t *val );
  409. typedef int (__stdcall * ASN1BERDECOPENTYPE2)( ASN1decoding_t dec, ASN1open_t *val );
  410. typedef ASN1error_e (__stdcall * ASN1DECSETERROR)( ASN1decoding_t dec, ASN1error_e err );
  411. typedef int (__stdcall * ASN1BERENCUTF8STRING)( ASN1encoding_t enc, ASN1uint32_t tag, ASN1uint32_t length, WCHAR *value );
  412. typedef int (__stdcall * ASN1BERDECGENERALIZEDTIME)( ASN1decoding_t dec, ASN1uint32_t tag, ASN1generalizedtime_t *val );
  413. typedef void (__stdcall * ASN1UTF8STRING_FREE)( ASN1wstring_t *val );
  414. typedef void (__stdcall * ASN1_FREEDECODED)( ASN1decoding_t dec, void *val, ASN1uint32_t id );
  415. typedef ASN1error_e (__stdcall * ASN1_ENCODE)(
  416. ASN1encoding_t enc,
  417. void *value,
  418. ASN1uint32_t id,
  419. ASN1uint32_t flags,
  420. ASN1octet_t *pbBuf,
  421. ASN1uint32_t cbBufSize
  422. );
  423. typedef ASN1error_e (__stdcall * ASN1_DECODE)(
  424. ASN1decoding_t dec,
  425. void **valref,
  426. ASN1uint32_t id,
  427. ASN1uint32_t flags,
  428. ASN1octet_t *pbBuf,
  429. ASN1uint32_t cbBufSize
  430. );
  431. typedef ASN1error_e (__stdcall * ASN1_SETENCODEROPTION)( ASN1encoding_t enc, ASN1optionparam_t *pOptParam );
  432. typedef ASN1error_e (__stdcall * ASN1_GETENCODEROPTION)( ASN1encoding_t enc, ASN1optionparam_t *pOptParam );
  433. typedef void (__stdcall * ASN1_FREEENCODED)( ASN1encoding_t enc, void *val );
  434. typedef int (__stdcall * ASN1BERDECUTF8STRING)( ASN1decoding_t dec, ASN1uint32_t tag, ASN1wstring_t *val );
  435. typedef int (__stdcall * ASN1CERENCGENERALIZEDTIME)( ASN1encoding_t enc, ASN1uint32_t tag, ASN1generalizedtime_t *val );
  436. static ASN1_CREATEMODULE pfnASN1_CreateModule = NULL;
  437. static ASN1_CLOSEMODULE pfnASN1_CloseModule = NULL;
  438. static ASN1BERENCENDOFCONTENTS pfnASN1BEREncEndOfContents = NULL;
  439. static ASN1BERENCOBJECTIDENTIFIER2 pfnASN1BEREncObjectIdentifier2 = NULL;
  440. static ASN1BERENCEXPLICITTAG pfnASN1BEREncExplicitTag = NULL;
  441. static ASN1BERDECENDOFCONTENTS pfnASN1BERDecEndOfContents = NULL;
  442. static ASN1BERDECOBJECTIDENTIFIER2 pfnASN1BERDecObjectIdentifier2 = NULL;
  443. static ASN1DECREALLOC pfnASN1DecRealloc = NULL;
  444. static ASN1BERDECPEEKTAG pfnASN1BERDecPeekTag = NULL;
  445. static ASN1BERDECNOTENDOFCONTENTS pfnASN1BERDecNotEndOfContents = NULL;
  446. static ASN1BERDECEXPLICITTAG pfnASN1BERDecExplicitTag = NULL;
  447. static ASN1FREE pfnASN1Free = NULL;
  448. static ASN1BERENCS32 pfnASN1BEREncS32 = NULL;
  449. static ASN1BERENCBOOL pfnASN1BEREncBool = NULL;
  450. static ASN1BERDECS32VAL pfnASN1BERDecS32Val = NULL;
  451. static ASN1BERDECBOOL pfnASN1BERDecBool = NULL;
  452. static ASN1BERENCCHAR16STRING pfnASN1BEREncChar16String = NULL;
  453. static ASN1BERENCBITSTRING pfnASN1BEREncBitString = NULL;
  454. static ASN1BERDECBITSTRING2 pfnASN1BERDecBitString2 = NULL;
  455. static ASN1BERDECCHAR16STRING pfnASN1BERDecChar16String = NULL;
  456. static ASN1CHAR16STRING_FREE pfnASN1char16string_free = NULL;
  457. static ASN1BERENCU32 pfnASN1BEREncU32 = NULL;
  458. static ASN1BERENCOCTETSTRING pfnASN1BEREncOctetString = NULL;
  459. static ASN1BERDECU32VAL pfnASN1BERDecU32Val = NULL;
  460. static ASN1BERDECOCTETSTRING2 pfnASN1BERDecOctetString2 = NULL;
  461. static ASN1CERENCBEGINBLK pfnASN1CEREncBeginBlk = NULL;
  462. static ASN1CERENCNEWBLKELEMENT pfnASN1CEREncNewBlkElement = NULL;
  463. static ASN1CERENCFLUSHBLKELEMENT pfnASN1CEREncFlushBlkElement = NULL;
  464. static ASN1CERENCENDBLK pfnASN1CEREncEndBlk = NULL;
  465. static ASN1BERENCOPENTYPE pfnASN1BEREncOpenType = NULL;
  466. static ASN1BERDECOPENTYPE2 pfnASN1BERDecOpenType2 = NULL;
  467. static ASN1DECSETERROR pfnASN1DecSetError = NULL;
  468. static ASN1BERENCUTF8STRING pfnASN1BEREncUTF8String = NULL;
  469. static ASN1BERDECGENERALIZEDTIME pfnASN1BERDecGeneralizedTime = NULL;
  470. static ASN1UTF8STRING_FREE pfnASN1utf8string_free = NULL;
  471. static ASN1_FREEDECODED pfnASN1_FreeDecoded = NULL;
  472. static ASN1_ENCODE pfnASN1_Encode = NULL;
  473. static ASN1_DECODE pfnASN1_Decode = NULL;
  474. static ASN1_SETENCODEROPTION pfnASN1_SetEncoderOption = NULL;
  475. static ASN1_GETENCODEROPTION pfnASN1_GetEncoderOption = NULL;
  476. static ASN1_FREEENCODED pfnASN1_FreeEncoded = NULL;
  477. static ASN1BERDECUTF8STRING pfnASN1BERDecUTF8String = NULL;
  478. static ASN1CERENCGENERALIZEDTIME pfnASN1CEREncGeneralizedTime = NULL;
  479. #define LOAD_ASN1_THUNK_PROC( _pfn, _procType, _proc ) \
  480. { \
  481. \
  482. if ( !hmsasn1 ) { \
  483. hmsasn1 = LoadLibrary( "msasn1.dll" ); \
  484. } \
  485. \
  486. if ( hmsasn1 && !_pfn ) { \
  487. (_pfn) = (_procType) GetProcAddress( hmsasn1, _proc ); \
  488. } \
  489. }
  490. extern ASN1module_t __stdcall ASN1_CreateModule(
  491. ASN1uint32_t version,
  492. ASN1encodingrule_e eEncodingRule,
  493. ASN1uint32_t dwFlags,
  494. ASN1uint32_t cPDUs,
  495. const ASN1GenericFun_t apfnEncoder[],
  496. const ASN1GenericFun_t apfnDecoder[],
  497. const ASN1FreeFun_t apfnFreeMemory[],
  498. const ASN1uint32_t acbStructSize[],
  499. ASN1magic_t nModuleName
  500. ) {
  501. LOAD_ASN1_THUNK_PROC( pfnASN1_CreateModule, ASN1_CREATEMODULE, "ASN1_CreateModule" );
  502. if ( hmsasn1 && pfnASN1_CreateModule ) {
  503. return pfnASN1_CreateModule(
  504. version, eEncodingRule, dwFlags, cPDUs, apfnEncoder, apfnDecoder, apfnFreeMemory, acbStructSize, nModuleName );
  505. }
  506. return NULL;
  507. }
  508. extern void __stdcall ASN1_CloseModule( ASN1module_t pModule ) {
  509. LOAD_ASN1_THUNK_PROC( pfnASN1_CloseModule, ASN1_CLOSEMODULE, "ASN1_CloseModule" );
  510. if ( hmsasn1 && pfnASN1_CloseModule ) {
  511. return pfnASN1_CloseModule( pModule );
  512. }
  513. return ;
  514. }
  515. extern int __stdcall ASN1BEREncEndOfContents( ASN1encoding_t enc, ASN1uint32_t nLenOff ) {
  516. LOAD_ASN1_THUNK_PROC( pfnASN1BEREncEndOfContents, ASN1BERENCENDOFCONTENTS, "ASN1BEREncEndOfContents" );
  517. if ( hmsasn1 && pfnASN1BEREncEndOfContents ) {
  518. return pfnASN1BEREncEndOfContents( enc, nLenOff);
  519. }
  520. return 0;
  521. }
  522. extern int __stdcall ASN1BEREncObjectIdentifier2( ASN1encoding_t enc, ASN1uint32_t tag, ASN1objectidentifier2_t *val ) {
  523. LOAD_ASN1_THUNK_PROC( pfnASN1BEREncObjectIdentifier2, ASN1BERENCOBJECTIDENTIFIER2, "ASN1BEREncObjectIdentifier2" );
  524. if ( hmsasn1 && pfnASN1BEREncObjectIdentifier2 ) {
  525. return pfnASN1BEREncObjectIdentifier2( enc, tag, val );
  526. }
  527. return 0;
  528. }
  529. extern int __stdcall ASN1BEREncExplicitTag( ASN1encoding_t enc, ASN1uint32_t tag, ASN1uint32_t *pnLenOff ) {
  530. LOAD_ASN1_THUNK_PROC( pfnASN1BEREncExplicitTag, ASN1BERENCEXPLICITTAG, "ASN1BEREncExplicitTag" );
  531. if ( hmsasn1 && pfnASN1BEREncExplicitTag ) {
  532. return pfnASN1BEREncExplicitTag( enc, tag, pnLenOff );
  533. }
  534. return 0;
  535. }
  536. extern int __stdcall ASN1BERDecEndOfContents( ASN1decoding_t dec, ASN1decoding_t dd, ASN1octet_t *pBufEnd ) {
  537. LOAD_ASN1_THUNK_PROC( pfnASN1BERDecEndOfContents, ASN1BERDECENDOFCONTENTS, "ASN1BERDecEndOfContents" );
  538. if ( hmsasn1 && pfnASN1BERDecEndOfContents ) {
  539. return pfnASN1BERDecEndOfContents( dec, dd, pBufEnd );
  540. }
  541. return 0;
  542. }
  543. extern int __stdcall ASN1BERDecObjectIdentifier2( ASN1decoding_t dec, ASN1uint32_t tag, ASN1objectidentifier2_t *val ) {
  544. LOAD_ASN1_THUNK_PROC( pfnASN1BERDecObjectIdentifier2, ASN1BERDECOBJECTIDENTIFIER2, "ASN1BERDecObjectIdentifier2" );
  545. if ( hmsasn1 && pfnASN1BERDecObjectIdentifier2 ) {
  546. return pfnASN1BERDecObjectIdentifier2( dec, tag, val );
  547. }
  548. return 0;
  549. }
  550. extern LPVOID __stdcall ASN1DecRealloc( ASN1decoding_t dec, LPVOID ptr, ASN1uint32_t size ) {
  551. LOAD_ASN1_THUNK_PROC( pfnASN1DecRealloc, ASN1DECREALLOC, "ASN1DecRealloc" );
  552. if ( hmsasn1 && pfnASN1DecRealloc ) {
  553. return pfnASN1DecRealloc( dec, ptr, size );
  554. }
  555. return NULL;
  556. }
  557. extern int __stdcall ASN1BERDecPeekTag( ASN1decoding_t dec, ASN1uint32_t *tag ) {
  558. LOAD_ASN1_THUNK_PROC( pfnASN1BERDecPeekTag, ASN1BERDECPEEKTAG, "ASN1BERDecPeekTag" );
  559. if ( hmsasn1 && pfnASN1BERDecPeekTag ) {
  560. return pfnASN1BERDecPeekTag( dec, tag );
  561. }
  562. return 0;
  563. }
  564. extern int __stdcall ASN1BERDecNotEndOfContents( ASN1decoding_t dec, ASN1octet_t *pBufEnd ) {
  565. LOAD_ASN1_THUNK_PROC( pfnASN1BERDecNotEndOfContents, ASN1BERDECNOTENDOFCONTENTS, "ASN1BERDecNotEndOfContents" );
  566. if ( hmsasn1 && pfnASN1BERDecNotEndOfContents ) {
  567. return pfnASN1BERDecNotEndOfContents( dec, pBufEnd );
  568. }
  569. return 0;
  570. }
  571. extern int __stdcall ASN1BERDecExplicitTag( ASN1decoding_t dec, ASN1uint32_t tag, ASN1decoding_t *dd, ASN1octet_t **ppBufEnd ) {
  572. LOAD_ASN1_THUNK_PROC( pfnASN1BERDecExplicitTag, ASN1BERDECEXPLICITTAG, "ASN1BERDecExplicitTag" );
  573. if ( hmsasn1 && pfnASN1BERDecExplicitTag ) {
  574. return pfnASN1BERDecExplicitTag( dec, tag, dd, ppBufEnd );
  575. }
  576. return 0;
  577. }
  578. extern void __stdcall ASN1Free( LPVOID ptr ) {
  579. LOAD_ASN1_THUNK_PROC( pfnASN1Free, ASN1FREE, "ASN1Free" );
  580. if ( hmsasn1 && pfnASN1Free ) {
  581. return pfnASN1Free( ptr );
  582. }
  583. return ;
  584. }
  585. extern int __stdcall ASN1BEREncS32( ASN1encoding_t enc, ASN1uint32_t tag, ASN1int32_t val ) {
  586. LOAD_ASN1_THUNK_PROC( pfnASN1BEREncS32, ASN1BERENCS32, "ASN1BEREncS32" );
  587. if ( hmsasn1 && pfnASN1BEREncS32 ) {
  588. return pfnASN1BEREncS32( enc, tag, val );
  589. }
  590. return 0;
  591. }
  592. extern int __stdcall ASN1BEREncBool( ASN1encoding_t enc, ASN1uint32_t tag, ASN1bool_t val ) {
  593. LOAD_ASN1_THUNK_PROC( pfnASN1BEREncBool, ASN1BERENCBOOL, "ASN1BEREncBool" );
  594. if ( hmsasn1 && pfnASN1BEREncBool ) {
  595. return pfnASN1BEREncBool( enc, tag, val );
  596. }
  597. return 0;
  598. }
  599. extern int __stdcall ASN1BERDecS32Val( ASN1decoding_t dec, ASN1uint32_t tag, ASN1int32_t *val ) {
  600. LOAD_ASN1_THUNK_PROC( pfnASN1BERDecS32Val, ASN1BERDECS32VAL, "ASN1BERDecS32Val" );
  601. if ( hmsasn1 && pfnASN1BERDecS32Val ) {
  602. return pfnASN1BERDecS32Val( dec, tag, val);
  603. }
  604. return 0;
  605. }
  606. extern int __stdcall ASN1BERDecBool( ASN1decoding_t dec, ASN1uint32_t tag, ASN1bool_t *val ) {
  607. LOAD_ASN1_THUNK_PROC( pfnASN1BERDecBool, ASN1BERDECBOOL, "ASN1BERDecBool" );
  608. if ( hmsasn1 && pfnASN1BERDecBool ) {
  609. return pfnASN1BERDecBool( dec, tag, val);
  610. }
  611. return 0;
  612. }
  613. extern int __stdcall ASN1BEREncChar16String( ASN1encoding_t enc, ASN1uint32_t tag, ASN1uint32_t len, ASN1char16_t *val ) {
  614. LOAD_ASN1_THUNK_PROC( pfnASN1BEREncChar16String, ASN1BERENCCHAR16STRING, "ASN1BEREncChar16String" );
  615. if ( hmsasn1 && pfnASN1BEREncChar16String ) {
  616. return pfnASN1BEREncChar16String( enc, tag, len, val );
  617. }
  618. return 0;
  619. }
  620. extern int __stdcall ASN1BEREncBitString( ASN1encoding_t enc, ASN1uint32_t tag, ASN1uint32_t len, ASN1octet_t *val ) {
  621. LOAD_ASN1_THUNK_PROC( pfnASN1BEREncBitString, ASN1BERENCBITSTRING, "ASN1BEREncBitString" );
  622. if ( hmsasn1 && pfnASN1BEREncBitString ) {
  623. return pfnASN1BEREncBitString( enc, tag, len, val );
  624. }
  625. return 0;
  626. }
  627. extern int __stdcall ASN1BERDecBitString2( ASN1decoding_t dec, ASN1uint32_t tag, ASN1bitstring_t *val ) {
  628. LOAD_ASN1_THUNK_PROC( pfnASN1BERDecBitString2, ASN1BERDECBITSTRING2, "ASN1BERDecBitString2" );
  629. if ( hmsasn1 && pfnASN1BERDecBitString2 ) {
  630. return pfnASN1BERDecBitString2( dec, tag, val );
  631. }
  632. return 0;
  633. }
  634. extern int __stdcall ASN1BERDecChar16String( ASN1decoding_t dec, ASN1uint32_t tag, ASN1char16string_t *val ) {
  635. LOAD_ASN1_THUNK_PROC( pfnASN1BERDecChar16String, ASN1BERDECCHAR16STRING, "ASN1BERDecChar16String" );
  636. if ( hmsasn1 && pfnASN1BERDecChar16String ) {
  637. return pfnASN1BERDecChar16String( dec, tag, val );
  638. }
  639. return 0;
  640. }
  641. extern void __stdcall ASN1char16string_free( ASN1char16string_t *val ) {
  642. LOAD_ASN1_THUNK_PROC( pfnASN1char16string_free, ASN1CHAR16STRING_FREE, "ASN1char16string_free" );
  643. if ( hmsasn1 && pfnASN1char16string_free ) {
  644. return pfnASN1char16string_free( val );
  645. }
  646. return ;
  647. }
  648. extern int __stdcall ASN1BEREncU32( ASN1encoding_t enc, ASN1uint32_t tag, ASN1uint32_t val ) {
  649. LOAD_ASN1_THUNK_PROC( pfnASN1BEREncU32, ASN1BERENCU32, "ASN1BEREncU32" );
  650. if ( hmsasn1 && pfnASN1BEREncU32 ) {
  651. return pfnASN1BEREncU32( enc, tag, val );
  652. }
  653. return 0;
  654. }
  655. extern int __stdcall ASN1BEREncOctetString( ASN1encoding_t enc, ASN1uint32_t tag, ASN1uint32_t len, ASN1octet_t *val ) {
  656. LOAD_ASN1_THUNK_PROC( pfnASN1BEREncOctetString, ASN1BERENCOCTETSTRING, "ASN1BEREncOctetString" );
  657. if ( hmsasn1 && pfnASN1BEREncOctetString ) {
  658. return pfnASN1BEREncOctetString( enc, tag, len, val );
  659. }
  660. return 0;
  661. }
  662. extern int __stdcall ASN1BERDecU32Val( ASN1decoding_t dec, ASN1uint32_t tag, ASN1uint32_t *val ) {
  663. LOAD_ASN1_THUNK_PROC( pfnASN1BERDecU32Val, ASN1BERDECU32VAL, "ASN1BERDecU32Val" );
  664. if ( hmsasn1 && pfnASN1BERDecU32Val ) {
  665. return pfnASN1BERDecU32Val( dec, tag, val );
  666. }
  667. return 0;
  668. }
  669. extern int __stdcall ASN1BERDecOctetString2( ASN1decoding_t dec, ASN1uint32_t tag, ASN1octetstring_t *val ) {
  670. LOAD_ASN1_THUNK_PROC( pfnASN1BERDecOctetString2, ASN1BERDECOCTETSTRING2, "ASN1BERDecOctetString2" );
  671. if ( hmsasn1 && pfnASN1BERDecOctetString2 ) {
  672. return pfnASN1BERDecOctetString2( dec, tag, val );
  673. }
  674. return 0;
  675. }
  676. extern int __stdcall ASN1CEREncBeginBlk( ASN1encoding_t enc, ASN1blocktype_e eBlkType, void **ppBlk_ ) {
  677. LOAD_ASN1_THUNK_PROC( pfnASN1CEREncBeginBlk, ASN1CERENCBEGINBLK, "ASN1CEREncBeginBlk" );
  678. if ( hmsasn1 && pfnASN1CEREncBeginBlk ) {
  679. return pfnASN1CEREncBeginBlk( enc, eBlkType, ppBlk_ );
  680. }
  681. return 0;
  682. }
  683. extern int __stdcall ASN1CEREncNewBlkElement( void *pBlk_, ASN1encoding_t *enc2 ) {
  684. LOAD_ASN1_THUNK_PROC( pfnASN1CEREncNewBlkElement, ASN1CERENCNEWBLKELEMENT, "ASN1CEREncNewBlkElement" );
  685. if ( hmsasn1 && pfnASN1CEREncNewBlkElement ) {
  686. return pfnASN1CEREncNewBlkElement( pBlk_, enc2 );
  687. }
  688. return 0;
  689. }
  690. extern int __stdcall ASN1CEREncFlushBlkElement( void *pBlk_ ) {
  691. LOAD_ASN1_THUNK_PROC( pfnASN1CEREncFlushBlkElement, ASN1CERENCFLUSHBLKELEMENT, "ASN1CEREncFlushBlkElement" );
  692. if ( hmsasn1 && pfnASN1CEREncFlushBlkElement ) {
  693. return pfnASN1CEREncFlushBlkElement( pBlk_ );
  694. }
  695. return 0;
  696. }
  697. extern int __stdcall ASN1CEREncEndBlk( void *pBlk_ ) {
  698. LOAD_ASN1_THUNK_PROC( pfnASN1CEREncEndBlk, ASN1CERENCENDBLK, "ASN1CEREncEndBlk" );
  699. if ( hmsasn1 && pfnASN1CEREncEndBlk ) {
  700. return pfnASN1CEREncEndBlk( pBlk_ );
  701. }
  702. return 0;
  703. }
  704. extern int __stdcall ASN1BEREncOpenType( ASN1encoding_t enc, ASN1open_t *val ) {
  705. LOAD_ASN1_THUNK_PROC( pfnASN1BEREncOpenType, ASN1BERENCOPENTYPE, "ASN1BEREncOpenType" );
  706. if ( hmsasn1 && pfnASN1BEREncOpenType ) {
  707. return pfnASN1BEREncOpenType( enc, val );
  708. }
  709. return 0;
  710. }
  711. extern int __stdcall ASN1BERDecOpenType2( ASN1decoding_t dec, ASN1open_t *val ) {
  712. LOAD_ASN1_THUNK_PROC( pfnASN1BERDecOpenType2, ASN1BERDECOPENTYPE2, "ASN1BERDecOpenType2" );
  713. if ( hmsasn1 && pfnASN1BERDecOpenType2 ) {
  714. return pfnASN1BERDecOpenType2( dec, val );
  715. }
  716. return 0;
  717. }
  718. extern ASN1error_e __stdcall ASN1DecSetError( ASN1decoding_t dec, ASN1error_e err ) {
  719. LOAD_ASN1_THUNK_PROC( pfnASN1DecSetError, ASN1DECSETERROR, "ASN1DecSetError" );
  720. if ( hmsasn1 && pfnASN1DecSetError ) {
  721. return pfnASN1DecSetError( dec, err );
  722. }
  723. return ASN1_ERR_INTERNAL;
  724. }
  725. extern int __stdcall ASN1BEREncUTF8String( ASN1encoding_t enc, ASN1uint32_t tag, ASN1uint32_t length, WCHAR *value ) {
  726. LOAD_ASN1_THUNK_PROC( pfnASN1BEREncUTF8String, ASN1BERENCUTF8STRING, "ASN1BEREncUTF8String" );
  727. if ( hmsasn1 && pfnASN1BEREncUTF8String ) {
  728. return pfnASN1BEREncUTF8String( enc, tag, length, value );
  729. }
  730. return 0;
  731. }
  732. extern int __stdcall ASN1BERDecGeneralizedTime( ASN1decoding_t dec, ASN1uint32_t tag, ASN1generalizedtime_t *val ) {
  733. LOAD_ASN1_THUNK_PROC( pfnASN1BERDecGeneralizedTime, ASN1BERDECGENERALIZEDTIME, "ASN1BERDecGeneralizedTime" );
  734. if ( hmsasn1 && pfnASN1BERDecGeneralizedTime ) {
  735. return pfnASN1BERDecGeneralizedTime( dec, tag, val );
  736. }
  737. return 0;
  738. }
  739. extern void __stdcall ASN1utf8string_free( ASN1wstring_t *val ) {
  740. LOAD_ASN1_THUNK_PROC( pfnASN1utf8string_free, ASN1UTF8STRING_FREE, "ASN1utf8string_free" );
  741. if ( hmsasn1 && pfnASN1utf8string_free ) {
  742. return pfnASN1utf8string_free( val );
  743. }
  744. return ;
  745. }
  746. extern void __stdcall ASN1_FreeDecoded( ASN1decoding_t dec, void *val, ASN1uint32_t id ) {
  747. LOAD_ASN1_THUNK_PROC( pfnASN1_FreeDecoded, ASN1_FREEDECODED, "ASN1_FreeDecoded" );
  748. if ( hmsasn1&& pfnASN1_FreeDecoded ) {
  749. return pfnASN1_FreeDecoded( dec, val, id );
  750. }
  751. return ;
  752. }
  753. extern ASN1error_e __stdcall ASN1_Encode(
  754. ASN1encoding_t enc,
  755. void *value,
  756. ASN1uint32_t id,
  757. ASN1uint32_t flags,
  758. ASN1octet_t *pbBuf,
  759. ASN1uint32_t cbBufSize
  760. ) {
  761. LOAD_ASN1_THUNK_PROC( pfnASN1_Encode, ASN1_ENCODE, "ASN1_Encode" );
  762. if ( hmsasn1 && pfnASN1_Encode ) {
  763. return pfnASN1_Encode( enc, value, id, flags, pbBuf, cbBufSize );
  764. }
  765. return ASN1_ERR_INTERNAL;
  766. }
  767. extern ASN1error_e __stdcall ASN1_Decode(
  768. ASN1decoding_t dec,
  769. void **valref,
  770. ASN1uint32_t id,
  771. ASN1uint32_t flags,
  772. ASN1octet_t *pbBuf,
  773. ASN1uint32_t cbBufSize
  774. ) {
  775. LOAD_ASN1_THUNK_PROC( pfnASN1_Decode, ASN1_DECODE, "ASN1_Decode" );
  776. if ( hmsasn1 && pfnASN1_Decode ) {
  777. return pfnASN1_Decode( dec, valref, id, flags, pbBuf, cbBufSize );
  778. }
  779. return ASN1_ERR_INTERNAL;
  780. }
  781. extern ASN1error_e __stdcall ASN1_SetEncoderOption( ASN1encoding_t enc, ASN1optionparam_t *pOptParam ) {
  782. LOAD_ASN1_THUNK_PROC( pfnASN1_SetEncoderOption, ASN1_SETENCODEROPTION, "ASN1_SetEncoderOption" );
  783. if ( hmsasn1 && pfnASN1_SetEncoderOption ) {
  784. return pfnASN1_SetEncoderOption( enc, pOptParam );
  785. }
  786. return ASN1_ERR_INTERNAL;
  787. }
  788. extern ASN1error_e __stdcall ASN1_GetEncoderOption( ASN1encoding_t enc, ASN1optionparam_t *pOptParam) {
  789. LOAD_ASN1_THUNK_PROC( pfnASN1_GetEncoderOption, ASN1_GETENCODEROPTION, "ASN1_GetEncoderOption" );
  790. if ( hmsasn1 && pfnASN1_GetEncoderOption ) {
  791. return pfnASN1_GetEncoderOption( enc, pOptParam );
  792. }
  793. return ASN1_ERR_INTERNAL;
  794. }
  795. extern void __stdcall ASN1_FreeEncoded( ASN1encoding_t enc, void *val ) {
  796. LOAD_ASN1_THUNK_PROC( pfnASN1_FreeEncoded, ASN1_FREEENCODED, "ASN1_FreeEncoded" );
  797. if ( hmsasn1 && pfnASN1_FreeEncoded ) {
  798. return pfnASN1_FreeEncoded( enc, val );
  799. }
  800. return ;
  801. }
  802. extern int __stdcall ASN1BERDecUTF8String( ASN1decoding_t dec, ASN1uint32_t tag, ASN1wstring_t *val ) {
  803. LOAD_ASN1_THUNK_PROC( pfnASN1BERDecUTF8String, ASN1BERDECUTF8STRING, "ASN1BERDecUTF8String" );
  804. if ( hmsasn1 && pfnASN1BERDecUTF8String ) {
  805. return pfnASN1BERDecUTF8String( dec, tag, val );
  806. }
  807. return 0;
  808. }
  809. extern int __stdcall ASN1CEREncGeneralizedTime( ASN1encoding_t enc, ASN1uint32_t tag, ASN1generalizedtime_t *val ) {
  810. LOAD_ASN1_THUNK_PROC( pfnASN1CEREncGeneralizedTime, ASN1CERENCGENERALIZEDTIME, "ASN1CEREncGeneralizedTime" );
  811. if ( hmsasn1 && pfnASN1CEREncGeneralizedTime ) {
  812. return pfnASN1CEREncGeneralizedTime( enc, tag, val );
  813. }
  814. return 0;
  815. }
  816. #endif // _X86_