Source code of Windows XP (NT5)
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.

148 lines
7.3 KiB

  1. /* Copyright (C) Boris Nikolaus, Germany, 1996-1997. All rights reserved. */
  2. /* Copyright (C) Microsoft Corporation 1997-1998, All rights reserved. */
  3. #ifndef __ASN1C_LIB_ASN1_H__
  4. #define __ASN1C_LIB_ASN1_H__
  5. #include <msasn1.h>
  6. #ifdef __cplusplus
  7. extern "C" {
  8. #endif
  9. // THE FOLLOWING IS FROM MS_CORE.H
  10. /*
  11. * This file contains operating system specific defines:
  12. *
  13. * Dynamic link library support:
  14. * Define DllExport as declspec for exported functions and
  15. * DllImport as declspec for imported functions.
  16. *
  17. * Floating point encoding support:
  18. * For encoding floating point values either
  19. * - finite()+isinf()+copysign()+frexp() or
  20. * - finite()+fpclass()+FP_PINF+FP_NINF+frexp()
  21. * is needed. Define HAS_ISINF for the former case or HAS_FPCLASS for
  22. * the latter case.
  23. * Define HAS_IEEEFP_H for inclusion of <ieeefp.h> or HAS_FLOAT_H for
  24. * inclusion of <float.h> if required.
  25. *
  26. * Integer type support
  27. * [u]int{8,16,32}_t must specify an integral (unsigned iff u-prefixed)
  28. * type of the specified size (in bits).
  29. */
  30. /* MS-Windows 95/MS-Windows NT */
  31. #define THIRTYTWO_BITS 1
  32. // #define HAS_SIXTYFOUR_BITS 1
  33. #define HAS_FLOAT_H 1
  34. #define HAS_FPCLASS 1
  35. #define fpclass(_d) _fpclass(_d)
  36. #define finite(_d) _finite(_d)
  37. #define isnan(_d) _isnan(_d)
  38. #define FP_PINF _FPCLASS_PINF
  39. #define FP_NINF _FPCLASS_NINF
  40. // #define HAS_STRICMP 1
  41. #define DBL_PINF {0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x7f}
  42. #define DBL_MINF {0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0xff}
  43. extern ASN1_PUBLIC ASN1intx_t ASN1intx_0, ASN1intx_1, ASN1intx_2, ASN1intx_16, ASN1intx_256, ASN1intx_64K, ASN1intx_1G;
  44. // extern ASN1_PUBLIC ASN1stringtable_t ASN1NumericStringTable;
  45. extern ASN1_PUBLIC void ASN1API ASN1intx_addoctet(ASN1intx_t *, ASN1intx_t *, ASN1octet_t);
  46. extern ASN1_PUBLIC void ASN1API ASN1intx_suboctet(ASN1intx_t *, ASN1intx_t *, ASN1octet_t);
  47. extern ASN1_PUBLIC void ASN1API ASN1intx_muloctet(ASN1intx_t *, ASN1intx_t *, ASN1octet_t);
  48. extern ASN1_PUBLIC void ASN1API ASN1intx_inc(ASN1intx_t *);
  49. extern ASN1_PUBLIC void ASN1API ASN1intx_dec(ASN1intx_t *);
  50. extern ASN1_PUBLIC void ASN1API ASN1intx_neg(ASN1intx_t *, ASN1intx_t *);
  51. extern ASN1_PUBLIC ASN1uint32_t ASN1API ASN1intx_log2(ASN1intx_t *);
  52. extern ASN1_PUBLIC ASN1uint32_t ASN1API ASN1intx_log256(ASN1intx_t *);
  53. extern ASN1_PUBLIC ASN1int32_t ASN1API ASN1intx_cmp(ASN1intx_t *, ASN1intx_t *);
  54. extern ASN1_PUBLIC void ASN1API ASN1intx_dup(ASN1intx_t *, ASN1intx_t *);
  55. extern ASN1_PUBLIC void ASN1API ASN1intx_setuint32(ASN1intx_t *, ASN1uint32_t);
  56. extern ASN1_PUBLIC void ASN1API ASN1intx_setint32(ASN1intx_t *, ASN1int32_t);
  57. extern ASN1_PUBLIC int ASN1API ASN1intxisuint64(ASN1intx_t *);
  58. extern ASN1_PUBLIC int ASN1API ASN1intxisint64(ASN1intx_t *);
  59. extern ASN1_PUBLIC int ASN1API ASN1intxisuint32(ASN1intx_t *);
  60. extern ASN1_PUBLIC int ASN1API ASN1intxisint32(ASN1intx_t *);
  61. extern ASN1_PUBLIC int ASN1API ASN1intxisuint16(ASN1intx_t *);
  62. extern ASN1_PUBLIC int ASN1API ASN1intxisint16(ASN1intx_t *);
  63. extern ASN1_PUBLIC int ASN1API ASN1intxisuint8(ASN1intx_t *);
  64. extern ASN1_PUBLIC int ASN1API ASN1intxisint8(ASN1intx_t *);
  65. #ifdef HAS_SIXTYFOUR_BITS
  66. extern ASN1_PUBLIC ASN1uint64_t ASN1API ASN1intx2uint64(ASN1intx_t *);
  67. extern ASN1_PUBLIC ASN1int64_t ASN1API ASN1intx2int64(ASN1intx_t *);
  68. #endif
  69. extern ASN1_PUBLIC ASN1uint32_t ASN1API ASN1intx2uint32(ASN1intx_t *);
  70. extern ASN1_PUBLIC ASN1int32_t ASN1API ASN1intx2int32(ASN1intx_t *);
  71. extern ASN1_PUBLIC ASN1uint16_t ASN1API ASN1intx2uint16(ASN1intx_t *);
  72. extern ASN1_PUBLIC ASN1int16_t ASN1API ASN1intx2int16(ASN1intx_t *);
  73. extern ASN1_PUBLIC ASN1uint8_t ASN1API ASN1intx2uint8(ASN1intx_t *);
  74. extern ASN1_PUBLIC ASN1int8_t ASN1API ASN1intx2int8(ASN1intx_t *);
  75. extern ASN1_PUBLIC ASN1uint32_t ASN1API ASN1intx_octets(ASN1intx_t *);
  76. extern ASN1_PUBLIC ASN1uint32_t ASN1API ASN1uint32_log2(ASN1uint32_t);
  77. extern ASN1_PUBLIC ASN1uint32_t ASN1API ASN1uint32_log256(ASN1uint32_t);
  78. extern ASN1_PUBLIC ASN1uint32_t ASN1API ASN1uint32_octets(ASN1uint32_t);
  79. extern ASN1_PUBLIC ASN1uint32_t ASN1API ASN1uint32_uoctets(ASN1uint32_t);
  80. extern ASN1_PUBLIC ASN1uint32_t ASN1API ASN1int32_octets(ASN1int32_t);
  81. extern ASN1_PUBLIC double ASN1API ASN1intx2double(ASN1intx_t *);
  82. extern ASN1_PUBLIC double ASN1API ASN1real2double(ASN1real_t *);
  83. extern ASN1_PUBLIC double ASN1API ASN1double_minf();
  84. extern ASN1_PUBLIC double ASN1API ASN1double_pinf();
  85. extern ASN1_PUBLIC int ASN1API ASN1double_isminf(double);
  86. extern ASN1_PUBLIC int ASN1API ASN1double_ispinf(double);
  87. extern ASN1_PUBLIC int ASN1API ASN1generalizedtime2string(char *, ASN1generalizedtime_t *);
  88. extern ASN1_PUBLIC int ASN1API ASN1utctime2string(char *, ASN1utctime_t *);
  89. extern ASN1_PUBLIC int ASN1API ASN1string2generalizedtime(ASN1generalizedtime_t *, char *);
  90. extern ASN1_PUBLIC int ASN1API ASN1string2utctime(ASN1utctime_t *, char *);
  91. /* ------ Memory Free APIs ------ */
  92. extern ASN1_PUBLIC void ASN1API ASN1real_free(ASN1real_t *);
  93. extern ASN1_PUBLIC void ASN1API ASN1bitstring_free(ASN1bitstring_t *);
  94. extern ASN1_PUBLIC void ASN1API ASN1octetstring_free(ASN1octetstring_t *);
  95. extern ASN1_PUBLIC void ASN1API ASN1objectidentifier_free(ASN1objectidentifier_t *);
  96. extern ASN1_PUBLIC void ASN1API ASN1charstring_free(ASN1charstring_t *);
  97. extern ASN1_PUBLIC void ASN1API ASN1char16string_free(ASN1char16string_t *);
  98. extern ASN1_PUBLIC void ASN1API ASN1char32string_free(ASN1char32string_t *);
  99. extern ASN1_PUBLIC void ASN1API ASN1ztcharstring_free(ASN1ztcharstring_t);
  100. extern ASN1_PUBLIC void ASN1API ASN1ztchar16string_free(ASN1ztchar16string_t);
  101. extern ASN1_PUBLIC void ASN1API ASN1ztchar32string_free(ASN1ztchar32string_t);
  102. extern ASN1_PUBLIC void ASN1API ASN1external_free(ASN1external_t *);
  103. extern ASN1_PUBLIC void ASN1API ASN1embeddedpdv_free(ASN1embeddedpdv_t *);
  104. extern ASN1_PUBLIC void ASN1API ASN1characterstring_free(ASN1characterstring_t *);
  105. extern ASN1_PUBLIC void ASN1API ASN1open_free(ASN1open_t *);
  106. /* ------ Comparison APIs ------ */
  107. extern ASN1_PUBLIC long ASN1API ASN1double_cmp(double, double);
  108. extern ASN1_PUBLIC long ASN1API ASN1real_cmp(ASN1real_t *, ASN1real_t *);
  109. extern ASN1_PUBLIC long ASN1API ASN1external_cmp(ASN1external_t *, ASN1external_t *);
  110. extern ASN1_PUBLIC long ASN1API ASN1embeddedpdv_cmp(ASN1embeddedpdv_t *, ASN1embeddedpdv_t *);
  111. extern ASN1_PUBLIC long ASN1API ASN1characterstring_cmp(ASN1characterstring_t *, ASN1characterstring_t *);
  112. extern ASN1_PUBLIC long ASN1API ASN1sequenceoflengthpointer_cmp(ASN1uint32_t, void *, ASN1uint32_t, void *, ASN1uint32_t, int (*)(void *, void *));
  113. extern ASN1_PUBLIC long ASN1API ASN1sequenceofsinglylinkedlist_cmp(void *, void *, ASN1uint32_t, int (*)(void *, void *));
  114. extern ASN1_PUBLIC long ASN1API ASN1sequenceofdoublylinkedlist_cmp(void *, void *, ASN1uint32_t, int (*)(void *, void *));
  115. extern ASN1_PUBLIC long ASN1API ASN1setoflengthpointer_cmp(ASN1uint32_t, void *, ASN1uint32_t, void *, ASN1uint32_t, int (*)(void *, void *));
  116. extern ASN1_PUBLIC long ASN1API ASN1setofsinglylinkedlist_cmp(void *, void *, ASN1uint32_t, int (*)(void *, void *));
  117. extern ASN1_PUBLIC long ASN1API ASN1setofdoublylinkedlist_cmp(void *, void *, ASN1uint32_t, int (*)(void *, void *));
  118. #define ASN1BITSET(_val, _bitnr) \
  119. ((_val)[(_bitnr) >> 3] |= 0x80 >> ((_bitnr) & 7))
  120. #define ASN1BITCLR(_val, _bitnr) \
  121. ((_val)[(_bitnr) >> 3] &= ~(0x80 >> ((_bitnr) & 7)))
  122. #define ASN1BITTEST(_val, _bitnr) \
  123. ((_val)[(_bitnr) >> 3] & (0x80 >> ((_bitnr) & 7)))
  124. #ifdef __cplusplus
  125. }
  126. #endif
  127. #endif // __ASN1C_LIB_ASN1_H__