X509Cert.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542
  1. /*
  2. * Copyright (C) 2011-2017 Intel Corporation. All rights reserved.
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions
  6. * are met:
  7. *
  8. * * Redistributions of source code must retain the above copyright
  9. * notice, this list of conditions and the following disclaimer.
  10. * * Redistributions in binary form must reproduce the above copyright
  11. * notice, this list of conditions and the following disclaimer in
  12. * the documentation and/or other materials provided with the
  13. * distribution.
  14. * * Neither the name of Intel Corporation nor the names of its
  15. * contributors may be used to endorse or promote products derived
  16. * from this software without specific prior written permission.
  17. *
  18. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  19. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  20. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  21. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  22. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  23. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  24. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  25. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  26. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  27. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  28. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  29. *
  30. */
  31. /**
  32. @file X509Cert.h
  33. @author Kapil Anantharaman
  34. @brief This file contains the data structures for the X509 certificates for verifier and EPID group .
  35. */
  36. #ifndef _X509CERT_H_
  37. #define _X509CERT_H_
  38. #ifndef WIN_TEST
  39. #include "typedef.h"
  40. #include "X509AlgoType.h"
  41. #include "pse_pr_sigma_1_1_defs.h"
  42. #else
  43. #include "special_defs.h"
  44. #endif
  45. typedef UINT32 Uint32 ;
  46. typedef UINT8 Uint8;
  47. typedef UINT16 Uint16;
  48. typedef void X509_PROTOCOL;
  49. typedef UINT32 STATUS;
  50. #define DER_ENCODING_BOOLEAN_ID 0x01
  51. #define DER_ENCODING_INTEGER_ID 0x02
  52. #define DER_ENCODING_BIT_STRING_ID 0x03
  53. #define DER_ENCODING_OCTET_STRING_ID 0x04
  54. #define DER_ENCODING_NULL_ID 0x05
  55. #define DER_ENCODING_OBJECT_ID 0x06
  56. #define DER_ENCODING_ENUMERATED_ID 0x0A
  57. #define DER_ENCODING_UTF8_ID 0x0C
  58. #define DER_ENCODING_PRINTABLE_STRING_ID 0x13
  59. #define DER_ENCODING_IA5_STRING_ID 0x16
  60. #define DER_ENCODING_UTC_TIME_ID 0x17
  61. #define DER_ENCODING_GENERALIZED_TIME_ID 0x18
  62. #define DER_ENCODING_SEQUENCE_ID 0x30
  63. #define DER_ENCODING_SET_ID 0x31
  64. #define X509_BIT0 128
  65. #define X509_BIT1 64
  66. #define X509_BIT2 32
  67. #define X509_BIT3 16
  68. #define X509_BIT4 8
  69. #define X509_BIT5 4
  70. #define X509_BIT6 2
  71. #define X509_BIT7 1
  72. #define MAX_SUPPORTED_VERSION 0x02
  73. #define MAX_HASH_LEN 20
  74. #define ECDSA_KEY_ELEMENT_SIZE 32 // applies for px and py
  75. #define ECDSA_KEY_SIZE 64
  76. #define IMPLICIT_TAG_ID 0x80
  77. #define EXPLICIT_TAG_ID 0xA0
  78. #define IMPLICIT_TAG_STRUCTURED_TYPE_ID 0xA0
  79. #define TAG_NUMBER_ISSUER_UNIQUE_ID 1
  80. #define TAG_NUMBER_SUBJECT_UNIQUE_ID 2
  81. #define TAG_NUMBER_EXTENSIONS 3
  82. #define TAG_NUMBER_AUTHORITY_KEY_ID 0
  83. #define TAG_NUMBER_AUTHORITY_CERT_ISSUER_ID 1
  84. #define TAG_NUMBER_AUTHORITY_CERT_SERIAL_NUMBER_ID 2
  85. #define DER_ENCODING_TRUE 0xFF
  86. #define DER_ENCODING_FALSE 0x00
  87. /* To supress thr warning on duplicate ECDSA_SIGANTURE_SIZE definition */
  88. #undef ECDSA_SIGNATURE_SIZE
  89. #define ECDSA_SIGNATURE_SIZE 64
  90. #define ECDSA_SIGNATURE_MAX_SIZE_R 32
  91. #define ECDSA_SIGNATURE_MAX_SIZE_S 32
  92. #define RSA_SIGNATURE_SIZE 256
  93. #define RSA_KEY_SIZE_2048_BYTES 256
  94. #define RSA_E_SIZE 4
  95. #define MAX_VERSION_LENGTH_SIZE_BYTES 4
  96. #define MAX_CERT_CHAIN_LENGTH 5
  97. #define SECONDS_IN_DAY 86400
  98. #define OCSP_DELAY_TOLERANCE_SECONDS 120
  99. typedef enum{
  100. v1 = 0,
  101. v2,
  102. v3,
  103. }CERTIFICATE_VERSIONS;
  104. /* CmlaOmaDataBuffer */
  105. typedef struct{
  106. Uint32 length;
  107. Uint8* buffer;
  108. } SessMgrDataBuffer;
  109. typedef enum{
  110. signature_algo,
  111. PublicKey_algo,
  112. Hash_algo
  113. }AlgorithmTypes;
  114. typedef X509SignAlgoType SessMgrSignAlgoType;
  115. typedef X509PublicKeyAlgoType SessMgrPublicKeyAlgoType;
  116. typedef enum{
  117. AuthorityKeyId = 0,
  118. SubjectKeyId,
  119. KeyUsage,
  120. BasicConstraint,
  121. CertificatePolicy,
  122. ExtendedKeyUsage,
  123. ProductType,
  124. Max_supported_CertExtensions
  125. }CertExtensions;
  126. typedef enum{
  127. Nonce = 0,
  128. Max_supported_OcspExtensions
  129. }OcspExtensions;
  130. /* name struct for issuer and subject */
  131. typedef enum{
  132. commonName = 0,
  133. organization,
  134. country,
  135. locality,
  136. state,
  137. organizationUnit,
  138. UserId,
  139. Max_NameId_Supported
  140. } NameStruct;
  141. /* name struct for issuer and subject */
  142. typedef struct{
  143. char *DistinguishedName;
  144. Uint32 DistinguishedNameSize;
  145. char* commonName; /* OID 2 5 4 3 */
  146. Uint32 commonNameSize;
  147. char* organization; /* OID 2 5 4 10 */
  148. Uint32 organizationSize;
  149. char* country; /* OID 2 5 4 6 */
  150. Uint32 countrySize;
  151. char* locality; /* OID 2 5 4 7 */
  152. Uint32 localitySize;
  153. char* state; /* OID 2 5 4 8 */
  154. Uint32 stateSize;
  155. char* organizationUnit; /* OID 2 5 4 11 */
  156. Uint32 organizationUnitSize;
  157. char* UserId; /* 0x09, 0x92, 0x26, 0x89, 0x93, 0xF2, 0x2C, 0x64, 0x01, 0x01 */
  158. Uint32 UserIdSize;
  159. } SessMgrX509Name;
  160. /* time */
  161. typedef union{
  162. Uint32 data;
  163. struct{
  164. Uint32 hour : 6; /* 0-23 */
  165. Uint32 minute : 6; /* 0-59 */
  166. Uint32 second : 6; /* 0-59 */
  167. Uint32 timezone_is_neg : 2;
  168. Uint32 timezone_hour : 6;
  169. Uint32 timezone_minute : 6;
  170. } hourMinuteSecond;
  171. } SessMgrTime;
  172. /* date */
  173. typedef union{
  174. Uint32 data;
  175. struct{
  176. Uint32 year : 16;/* 2000-2137 */
  177. Uint32 month : 4; /* 1-12 */
  178. Uint32 day : 6; /* 1-31 */
  179. Uint32 reserve : 6;
  180. } yearMonthDay;
  181. } SessMgrDate;
  182. typedef struct{
  183. SessMgrTime time;
  184. SessMgrDate date;
  185. } SessMgrDateTime;
  186. /*
  187. This enum is used so that caller can pass this argument to the ParseCertificateChain function. Based on this, we can do extra validation on each
  188. certificate
  189. */
  190. typedef enum{
  191. EpidGroupCertificate = 0,
  192. VerifierCertificate,
  193. OcspResponderCertificate,
  194. Others, // OMA DRM
  195. }CertificateType;
  196. typedef enum{
  197. root = 0,
  198. intermediate,
  199. leaf,
  200. }CertificateLevel;
  201. typedef enum{
  202. /* OID 1 2 840 10045 3 1 1 7 */
  203. curvePrime256v1 = 0,
  204. MaxElipticCurveOidSupported,
  205. unknownParameter = MaxElipticCurveOidSupported,
  206. } SessMgrEllipticCurveParameter;
  207. /* Definition of ECDSA public key */
  208. typedef struct{
  209. Uint8* px; /* always 32 bytes */
  210. Uint8* py; /* always 32 bytes */
  211. SessMgrEllipticCurveParameter eccParameter;
  212. } SessMgrEcdsaPublicKey;
  213. /* Definition of RSA key */
  214. typedef struct{
  215. SessMgrDataBuffer n;
  216. SessMgrDataBuffer p;
  217. SessMgrDataBuffer e;
  218. } SessMgrRsaKey;
  219. /* Definition of EPID group public key */
  220. typedef struct{
  221. Uint32 groupId;
  222. Uint8* h1x; /* always 32 bytes */
  223. Uint8* h1y; /* always 32 bytes */
  224. Uint8* h2x; /* always 32 bytes */
  225. Uint8* h2y; /* always 32 bytes */
  226. Uint8* wx0; /* always 32 bytes */
  227. Uint8* wx1; /* always 32 bytes */
  228. Uint8* wx2; /* always 32 bytes */
  229. Uint8* wy0; /* always 32 bytes */
  230. Uint8* wy1; /* always 32 bytes */
  231. Uint8* wy2; /* always 32 bytes */
  232. } SessMgrEpidGroupPublicKey;
  233. /* SessMgrKeyUsage */
  234. typedef union {
  235. Uint32 value;
  236. struct {
  237. Uint32 OCSPSign : 1;
  238. Uint32 reserved : 31;
  239. } usage;
  240. } SessMgrExtendedKeyUsage;
  241. /* SessMgrKeyUsage */
  242. typedef union {
  243. Uint16 value;
  244. struct {
  245. Uint16 digitalSignature: 1;
  246. Uint16 nonRepudiation: 1;
  247. Uint16 keyEncipherment: 1;
  248. Uint16 dataEncipherment: 1;
  249. Uint16 keyAgreement: 1;
  250. Uint16 keyCertSign: 1;
  251. Uint16 cRLSign: 1;
  252. Uint16 encipherOnly: 1;
  253. Uint16 decipherOnly: 1;
  254. Uint16 reserved: 7;
  255. } usage;
  256. } SessMgrKeyUsage;
  257. typedef struct _RsaPublicKey
  258. {
  259. /**
  260. * @brief Buffer for Key.e
  261. */
  262. UINT8 Ebuffer[RSA_E_SIZE];
  263. /**
  264. * @brief Buffer for Key.n
  265. */
  266. UINT8 Nbuffer[RSA_KEY_SIZE_2048_BYTES];
  267. } RsaPublicKey;
  268. typedef struct _PseEcdsaPublicKey
  269. {
  270. /**
  271. * @brief Buffer for px
  272. */
  273. UINT8 px[32];
  274. /**
  275. * @brief Buffer for py
  276. */
  277. UINT8 py[32];
  278. }PseEcdsaPublicKey;
  279. /* SessMgrProductType */
  280. typedef enum{
  281. reserved = 0,
  282. invalidProductType = reserved,
  283. mediaVault,
  284. identityProtectionTechnology,
  285. capabilityLicensingServices,
  286. intelDAtestCertificate,
  287. Max_ProductType
  288. } SessMgrProductType;
  289. /* SessMgrCertificatePolicy */
  290. typedef enum{
  291. intel_sigma_cert_policy = 0,
  292. Max_Certificatepolicy
  293. } SessMgrCertificatePolicyId;
  294. /* SessMgrCertificatePolicyQualifierId */
  295. typedef enum{
  296. internet_policy_qualifier = 0,
  297. Max_CertificatepolicyQualifierid
  298. } SessMgrCertificatePolicyQualifierId;
  299. /* SessMgrBasicConstraint */
  300. typedef struct{
  301. BOOL isBasicConstraintPresent;
  302. BOOL isCa; /* is subject a CA? */
  303. Uint32 pathLenConstraint; /* applicable only if isCa is TRUE */
  304. } SessMgrBasicConstraint;
  305. /* information extracted from certificate */
  306. /* !!!! if you change this, you MUST change the corresponding stucture in container.h !!!!*/
  307. typedef struct{
  308. Uint32 certificateVersion;
  309. SessMgrDataBuffer serialNumber;
  310. SessMgrPublicKeyAlgoType algorithmIdentifierForSubjectPublicKey;
  311. SessMgrSignAlgoType algorithmIdentifierForSignature;
  312. SessMgrX509Name issuer;
  313. SessMgrX509Name subject;
  314. SessMgrDateTime notValidBeforeTime;
  315. SessMgrDateTime notValidAfterTime;
  316. SessMgrDataBuffer subjectPublicKey;
  317. SessMgrDataBuffer EncodedSubjectPublicKey; // ptr to the encoding. This will be used to calculate the hash.
  318. SessMgrDataBuffer IssuerUniqueId;
  319. SessMgrDataBuffer SubjectUniqueId;
  320. SessMgrDataBuffer AuthorityKeyId;
  321. SessMgrDataBuffer SubjectKeyId;
  322. SessMgrKeyUsage keyUsage; /* not applicable to group cert */
  323. SessMgrExtendedKeyUsage ExtendedKeyUsage;
  324. SessMgrProductType productType; /* only applicable to Intel-signed cert OID 1 2 840 113741 1 9 2 */
  325. SessMgrDataBuffer CertificatePolicy;
  326. SessMgrBasicConstraint basicConstraint; /* only applicable to OCSP responder cert */
  327. SessMgrSignAlgoType TbsCertSignAlgoId;
  328. SessMgrDataBuffer signatureBuffer;
  329. SessMgrDataBuffer messageBuffer; /* aka tbsCertificate. everything that is signed */
  330. } SessMgrCertificateFields;
  331. /*
  332. The ISSUER_INFO is a data structure that is used to store interesting information about the issuer of the certificate. Because in a chain, the current certificate is the issuer
  333. of the next certificate in the chain, In most cases, this data structure will contain data (like public key, signature algo, hash etc) of the parent.
  334. For the root certificate, we have to calculate the hash of the issuer's public key from the hard coded value. The Hash of the key will be compared against the IssuerKeyHash in the OCSP response.
  335. */
  336. typedef struct{
  337. Uint32 length;
  338. Uint8* buffer;
  339. SessMgrSignAlgoType AlgoType;
  340. SessMgrDataBuffer EncodedPublicKeyHashBuffer;
  341. SessMgrDataBuffer CommonNameBuf;
  342. SessMgrProductType productType;
  343. } ISSUER_INFO;
  344. typedef enum{
  345. EXPLICIT_TAG_0_ID_VALUE = 0xa0,
  346. }DER_EXPLICIT_TAG_ID;
  347. typedef enum{
  348. X509_STATUS_SUCCESS = 0,
  349. X509_GENERAL_ERROR,
  350. X509_STATUS_INVALID_VERSION,
  351. X509_STATUS_UNSUPPORTED_ALGORITHM,
  352. X509_STATUS_ENCODING_ERROR,
  353. X509_STATUS_INVALID_ARGS,
  354. X509_STATUS_UNSUPPORTED_CRITICAL_EXTENSION,
  355. X509_STATUS_UNSUPPORTED_TYPE,
  356. X509_STATUS_OCSP_FAILURE,
  357. X509_INVALID_SIGNATURE,
  358. X509_STATUS_UNKNOWN_OID,
  359. X509_STATUS_NOT_FOUND,
  360. X509_STATUS_OCSP_VERIFICATION_FAILED,
  361. X509_STATUS_UNSUPPORTED_PARAMETER,
  362. X509_STATUS_EXPIRED_CERTIFICATE,
  363. X509_STATUS_INTERNAL_ERROR,
  364. X509_STATUS_BASIC_CONSTRAINTS_VIOLATION,
  365. X509_STATUS_MEMORY_ALLOCATION_ERROR,
  366. X509_STATUS_INVALID_PARAMS,
  367. }X509_Parser_Error_codes;
  368. typedef enum{
  369. explicit_tag = 0,
  370. implicit_tag,
  371. invalid_tag,
  372. }TAG_TYPE;
  373. /* only supports SHA1 and SHA256 */
  374. typedef enum{
  375. sessMgrHashSha1 = 0,
  376. sessMgrHashSha256
  377. } SessMgrHashTypes;
  378. typedef struct _OCSP_CERT_STATUS_TABLE{
  379. UINT8 serialNumber[20];
  380. UINT8 SerialNumberSize;
  381. SessMgrHashTypes HashAlgo;
  382. UINT8 issuerKeyHash[20];
  383. UINT8 issuerKeyHashSize;
  384. UINT8 issuerNameHash[20];
  385. UINT8 issuerNameHashSize;
  386. }OCSP_CERT_STATUS_TABLE;
  387. /* Macros */
  388. #define CHECK_ID(value, ExpectedId) { if(value != ExpectedId) { \
  389. DBG_ASSERT(0); \
  390. return X509_STATUS_ENCODING_ERROR; \
  391. } }
  392. #define CHECK_VALUE(value, ExpectedValue) { if(value != ExpectedValue) { \
  393. DBG_ASSERT(0); \
  394. return X509_STATUS_ENCODING_ERROR; \
  395. } }
  396. #define CHECK_ID_OPTIONAL(value, ExpectedId) (value == ExpectedId)
  397. #define FIND_TAG_TYPE(ptr, TagId, TagType) \
  398. { if(((*ptr & 0xF0) == 0xA0) && ((*ptr & 0x0F) == TagId)) \
  399. TagType = explicit_tag; \
  400. else if (((*ptr & 0xF0) == 0x80) && ((*ptr & 0x0F) == TagId)) \
  401. TagType = implicit_tag; \
  402. else \
  403. TagType = invalid_tag; }
  404. //STATUS ParseTime(UINT8 **ppCurrent, UINT8 *pEnd, SessMgrDateTime* DataTime);
  405. //STATUS ParseName(UINT8 **ppCurrent, UINT8 *pEnd, SessMgrX509Name* Name);
  406. //STATUS ParseAlgoIdentifier(UINT8 **ppCurrent, UINT8 *pEnd, UINT32* algoId, AlgorithmTypes Type, SessMgrEllipticCurveParameter* params);
  407. //STATUS ParseOID(UINT8 **ppCurrent, UINT8 *pEnd, UINT32 *EnumVal, const UINT8 *OidList, UINT32 Max_Entries, UINT32 EntrySize);
  408. //STATUS ParseAlgoParameters(UINT8 **ppCurrent, UINT8 *pEnd, UINT32 *param);
  409. //STATUS ParseSubjectPublicKeyInfo(UINT8 **ppCurrent, UINT8 *pEnd, UINT8 **pworkbuffer, SessMgrCertificateFields* certificateFields);
  410. //STATUS ParseEcdsaPublicKey(UINT8 **ppCurrent, UINT8 *pEnd, SessMgrEcdsaPublicKey * EcDsaKey, SessMgrEllipticCurveParameter params);
  411. //STATUS ParseEpidPublicKey(UINT8 **ppCurrent, UINT8 *pEnd, SessMgrEpidGroupPublicKey * EpidKey);
  412. //STATUS ParseCertExtensions(UINT8 **ppCurrent, UINT8 *pEnd, SessMgrCertificateFields* certificateFields);
  413. //STATUS ParseCertificatePolicy(UINT8 **ppCurrent, UINT8 *pEnd, SessMgrDataBuffer *CertificatePolicy);
  414. //STATUS ParseSignatureValue(UINT8 **ppCurrent, UINT8 *pEnd, UINT8 **pworkbuffer, UINT32 WorkBufferSize, SessMgrDataBuffer *SignatureValueBuf, UINT8 SignatureAlgoId);
  415. //STATUS ParseRsaPublicKey(UINT8 **ppCurrent, UINT8 *pEnd, SessMgrRsaKey * RsaKey);
  416. //STATUS ParseInteger(UINT8 **ppCurrent, UINT8 *pEnd, SessMgrDataBuffer* DataBuf, BOOL isOptional, BOOL MustBePositive, UINT32 *PaddingLen);
  417. //STATUS ParseIdAndLength(UINT8 **ppCurrent, UINT8 *pEnd, UINT8 ExpectedId, UINT32* Length, UINT8* EncodingBytes, BOOL Optional);
  418. //STATUS ParseBoolean(UINT8 **ppCurrent, UINT8 *pEnd, BOOL* Value, BOOL optional);
  419. //STATUS sessMgrParseDerCert
  420. //(
  421. // IN X509_PROTOCOL* X509Protocol,
  422. // IN Uint8* certificateDerEncoded,
  423. // IN UINT8* pCertificateEnd,
  424. // IN Uint8* workBuffer,
  425. // IN UINT32 workBufferSize,
  426. // OUT SessMgrCertificateFields* certificateFields,
  427. // IN ISSUER_INFO *IssuerInfo,
  428. // IN BOOL UseFacsimileEpid
  429. // );
  430. void PrintName(SessMgrX509Name *Name);
  431. void PrintValidity(SessMgrDateTime *Time);
  432. void PrintEcdsaPublicKey(SessMgrEcdsaPublicKey *Key);
  433. void PrintAlgo(UINT8 *AlgoId);
  434. void PrintDataBuffer(SessMgrDataBuffer *data);
  435. void PrintEpidKey(SessMgrEpidGroupPublicKey *Key);
  436. STATUS ParseCertificateChain(UINT8 *pCertChain,
  437. UINT32 CertChainLength,
  438. SessMgrCertificateFields *certificateFields,
  439. UINT8 *CertWorkBuffer,
  440. UINT32 CertWorkBufferLength,
  441. ISSUER_INFO *RootPublicKey,
  442. UINT8 NumberOfSingleResponses,
  443. OCSP_CERT_STATUS_TABLE *OcspCertStatusTable,
  444. CertificateType CertType,
  445. BOOL UseFacsimileEpid);
  446. //STATUS ParseOcspResponseChain(UINT8* OcspRespBuffer,
  447. // UINT32 OcspRespBufferLength,
  448. // UINT8* workBuffer,
  449. // UINT32 workBufferSize,
  450. // ISSUER_INFO* OcspCertRootPublicKey,
  451. // OCSP_CERT_STATUS_TABLE *OcspCertStatusTable,
  452. // UINT8* NumberOfSingleResponses,
  453. // SessMgrDataBuffer Nonce,
  454. // OCSP_REQ_TYPE OcspReqType,
  455. // BOOL UseFacsimileEpid);
  456. //STATUS DecodeLength(UINT8* Buffer, UINT8* BufferEnd, UINT32* Length, UINT8* EncodingBytes);
  457. //UINT32 DecodeTime(UINT8 *current_ptr, UINT8 length);
  458. //void SwapEndian(UINT8* Ptr, int length);
  459. //int Pow(int num, int exp);
  460. //STATUS swapendian_memcpy(UINT8 *DestPtr, UINT32 DestLen, UINT8 *SrcPtr, UINT32 SrcLen);
  461. //BOOL VerifySha1Hash(SessMgrDataBuffer *HashData, UINT8 *Expectedhash, UINT32 ExpectedHashLength);
  462. #endif