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.

123 lines
5.1 KiB

  1. /* Copyright (C) Boris Nikolaus, Germany, 1996-1997. All rights reserved. */
  2. /* Copyright (C) Microsoft Corporation, 1997-1998. All rights reserved. */
  3. #ifndef _ASN1_CINTERN_H_
  4. #define _ASN1_CINTERN_H_
  5. typedef struct ASN1INTERNencoding_s *ASN1INTERNencoding_t;
  6. typedef struct ASN1INTERNdecoding_s *ASN1INTERNdecoding_t;
  7. // lonchanc: this is really bad to duplicate the definitions of ASN1encoding_s
  8. // and ASN1decoding_s here. We sould simply use them as components in
  9. // the following ASN1INTERNencoding_s and ASN1INTERNdecoding_s.
  10. struct ASN1INTERNencoding_s {
  11. // public view of encoding structure
  12. struct ASN1encoding_s info;
  13. // private portion of encoding structure
  14. ASN1INTERNencoding_t parent;
  15. ASN1INTERNencoding_t child;
  16. #ifdef ENABLE_EXTRA_INFO
  17. ASN1uint32_t memlength;
  18. ASN1uint32_t memsize;
  19. void** mem;
  20. ASN1uint32_t epilength;
  21. ASN1uint32_t episize;
  22. ASN1embeddedpdv_identification_t** epi;
  23. ASN1uint32_t csilength;
  24. ASN1uint32_t csisize;
  25. ASN1characterstring_identification_t** csi;
  26. #endif // ENABLE_EXTRA_INFO
  27. };
  28. struct ASN1INTERNdecoding_s {
  29. // public view of decoding structure
  30. struct ASN1decoding_s info;
  31. // private portion of decoding structure
  32. ASN1INTERNdecoding_t parent;
  33. ASN1INTERNdecoding_t child;
  34. #ifdef ENABLE_EXTRA_INFO
  35. ASN1uint32_t memlength;
  36. ASN1uint32_t memsize;
  37. void** mem;
  38. ASN1uint32_t epilength;
  39. ASN1uint32_t episize;
  40. ASN1embeddedpdv_identification_t** epi;
  41. ASN1uint32_t csilength;
  42. ASN1uint32_t csisize;
  43. ASN1characterstring_identification_t** csi;
  44. #endif // ENABLE_EXTRA_INFO
  45. // decoded into an external buffer
  46. ASN1uint32_t fExtBuf;
  47. void* lpOrigExtBuf; // original buffer pointer
  48. ASN1uint32_t cbOrigExtBufSize;// original buffer size
  49. ASN1uint8_t* lpRemExtBuf; // remaining buffer pointer
  50. ASN1uint32_t cbRemExtBufSize; // remaining buffer size
  51. ASN1uint32_t cbLinearBufSize; // linear buffer size to hold the data
  52. };
  53. extern ASN1_PUBLIC void ASN1API ASN1DecAbort(ASN1decoding_t dec);
  54. extern ASN1_PUBLIC void ASN1API ASN1DecDone(ASN1decoding_t dec);
  55. extern ASN1_PUBLIC void ASN1API ASN1EncAbort(ASN1encoding_t enc);
  56. extern ASN1_PUBLIC void ASN1API ASN1EncDone(ASN1encoding_t enc);
  57. #ifdef ENABLE_GENERALIZED_CHAR_STR
  58. int ASN1EncSearchCharacterStringIdentification(ASN1INTERNencoding_t e, ASN1characterstring_identification_t *identification, ASN1uint32_t *index, ASN1uint32_t *flag);
  59. int ASN1DecAddCharacterStringIdentification(ASN1INTERNdecoding_t d, ASN1characterstring_identification_t *identification);
  60. ASN1characterstring_identification_t *ASN1DecGetCharacterStringIdentification(ASN1INTERNdecoding_t d, ASN1uint32_t index);
  61. #endif // ENABLE_GENERALIZED_CHAR_STR
  62. #ifdef ENABLE_EMBEDDED_PDV
  63. int ASN1EncSearchEmbeddedPdvIdentification(ASN1INTERNencoding_t e, ASN1embeddedpdv_identification_t *identification, ASN1uint32_t *index, ASN1uint32_t *flag);
  64. int ASN1DecAddEmbeddedPdvIdentification(ASN1INTERNdecoding_t d, ASN1embeddedpdv_identification_t *identification);
  65. ASN1embeddedpdv_identification_t *ASN1DecGetEmbeddedPdvIdentification(ASN1INTERNdecoding_t d, ASN1uint32_t index);
  66. #endif // ENABLE_EMBEDDED_PDV
  67. int ASN1DecDupObjectIdentifier(ASN1decoding_t dec, ASN1objectidentifier_t *dst, ASN1objectidentifier_t *src);
  68. ASN1uint32_t GetObjectIdentifierCount(ASN1objectidentifier_t val);
  69. ASN1uint32_t CopyObjectIdentifier(ASN1objectidentifier_t dst, ASN1objectidentifier_t src);
  70. ASN1objectidentifier_t DecAllocObjectIdentifier(ASN1decoding_t dec, ASN1uint32_t cObjIds);
  71. void DecFreeObjectIdentifier(ASN1decoding_t dec, ASN1objectidentifier_t p);
  72. /* ------ perencod.c ------ */
  73. int ASN1EncCheck(ASN1encoding_t enc, ASN1uint32_t noctets);
  74. __inline int ASN1PEREncCheck(ASN1encoding_t enc, ASN1uint32_t noctets)
  75. {
  76. return ASN1EncCheck(enc, noctets);
  77. }
  78. __inline int ASN1BEREncCheck(ASN1encoding_t enc, ASN1uint32_t noctets)
  79. {
  80. return ASN1EncCheck(enc, noctets);
  81. }
  82. /* ------ bit.c ------ */
  83. int ASN1is32space(ASN1char32_t);
  84. int ASN1str32len(ASN1char32_t *);
  85. int ASN1is16space(ASN1char16_t);
  86. int ASN1str16len(ASN1char16_t *);
  87. int My_lstrlenA(char *p);
  88. int My_lstrlenW(WCHAR *p);
  89. void ASN1bitcpy(ASN1octet_t *dst, ASN1uint32_t dstbit, ASN1octet_t *src, ASN1uint32_t srcbit, ASN1uint32_t nbits);
  90. void ASN1bitclr(ASN1octet_t *dst, ASN1uint32_t dstbit, ASN1uint32_t nbits);
  91. void ASN1bitset(ASN1octet_t *dst, ASN1uint32_t dstbit, ASN1uint32_t nbits);
  92. void ASN1bitput(ASN1octet_t *dst, ASN1uint32_t dstbit, ASN1uint32_t val, ASN1uint32_t nbits);
  93. ASN1uint32_t ASN1bitgetu(ASN1octet_t *src, ASN1uint32_t srcbit, ASN1uint32_t nbits);
  94. ASN1int32_t ASN1bitget(ASN1octet_t *src, ASN1uint32_t srcbit, ASN1uint32_t nbits);
  95. ASN1uint32_t ASN1bitcount(ASN1octet_t *src, ASN1uint32_t srcbit, ASN1uint32_t nbits);
  96. void ASN1octetput(ASN1octet_t *dst, ASN1uint32_t val, ASN1uint32_t noctets);
  97. ASN1uint32_t ASN1octetget(ASN1octet_t *src, ASN1uint32_t noctets);
  98. #endif /* _ASN1_CINTERN_H_ */