asn1.py 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. # This file is dual licensed under the terms of the Apache License, Version
  2. # 2.0, and the BSD License. See the LICENSE file in the root of this repository
  3. # for complete details.
  4. from __future__ import absolute_import, division, print_function
  5. INCLUDES = """
  6. #include <openssl/asn1.h>
  7. """
  8. TYPES = """
  9. typedef int... time_t;
  10. typedef ... ASN1_INTEGER;
  11. struct asn1_string_st {
  12. int length;
  13. int type;
  14. unsigned char *data;
  15. long flags;
  16. };
  17. typedef struct asn1_string_st ASN1_OCTET_STRING;
  18. typedef struct asn1_string_st ASN1_IA5STRING;
  19. typedef struct asn1_string_st ASN1_BIT_STRING;
  20. typedef struct asn1_string_st ASN1_TIME;
  21. typedef ... ASN1_OBJECT;
  22. typedef struct asn1_string_st ASN1_STRING;
  23. typedef struct asn1_string_st ASN1_UTF8STRING;
  24. typedef struct {
  25. int type;
  26. ...;
  27. } ASN1_TYPE;
  28. typedef ... ASN1_GENERALIZEDTIME;
  29. typedef ... ASN1_ENUMERATED;
  30. typedef ... ASN1_NULL;
  31. static const int V_ASN1_GENERALIZEDTIME;
  32. static const int MBSTRING_UTF8;
  33. """
  34. FUNCTIONS = """
  35. void ASN1_OBJECT_free(ASN1_OBJECT *);
  36. /* ASN1 STRING */
  37. unsigned char *ASN1_STRING_data(ASN1_STRING *);
  38. int ASN1_STRING_set(ASN1_STRING *, const void *, int);
  39. /* ASN1 OCTET STRING */
  40. ASN1_OCTET_STRING *ASN1_OCTET_STRING_new(void);
  41. void ASN1_OCTET_STRING_free(ASN1_OCTET_STRING *);
  42. int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *, const unsigned char *, int);
  43. /* ASN1 IA5STRING */
  44. ASN1_IA5STRING *ASN1_IA5STRING_new(void);
  45. /* ASN1 INTEGER */
  46. void ASN1_INTEGER_free(ASN1_INTEGER *);
  47. int ASN1_INTEGER_set(ASN1_INTEGER *, long);
  48. /* ASN1 TIME */
  49. ASN1_TIME *ASN1_TIME_new(void);
  50. void ASN1_TIME_free(ASN1_TIME *);
  51. int ASN1_TIME_set_string(ASN1_TIME *, const char *);
  52. /* ASN1 GENERALIZEDTIME */
  53. ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *, time_t);
  54. void ASN1_GENERALIZEDTIME_free(ASN1_GENERALIZEDTIME *);
  55. /* ASN1 ENUMERATED */
  56. ASN1_ENUMERATED *ASN1_ENUMERATED_new(void);
  57. void ASN1_ENUMERATED_free(ASN1_ENUMERATED *);
  58. int ASN1_ENUMERATED_set(ASN1_ENUMERATED *, long);
  59. int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *, int, int);
  60. /* These became const ASN1_* in 1.1.0 */
  61. int ASN1_STRING_type(ASN1_STRING *);
  62. int ASN1_STRING_to_UTF8(unsigned char **, ASN1_STRING *);
  63. long ASN1_ENUMERATED_get(ASN1_ENUMERATED *);
  64. int i2a_ASN1_INTEGER(BIO *, ASN1_INTEGER *);
  65. /* This became const ASN1_TIME in 1.1.0f */
  66. ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *,
  67. ASN1_GENERALIZEDTIME **);
  68. ASN1_UTF8STRING *ASN1_UTF8STRING_new(void);
  69. void ASN1_UTF8STRING_free(ASN1_UTF8STRING *);
  70. ASN1_BIT_STRING *ASN1_BIT_STRING_new(void);
  71. void ASN1_BIT_STRING_free(ASN1_BIT_STRING *);
  72. /* This is not a macro, but is const on some versions of OpenSSL */
  73. int ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *, int);
  74. int ASN1_STRING_length(ASN1_STRING *);
  75. int ASN1_STRING_set_default_mask_asc(char *);
  76. BIGNUM *ASN1_INTEGER_to_BN(ASN1_INTEGER *, BIGNUM *);
  77. ASN1_INTEGER *BN_to_ASN1_INTEGER(BIGNUM *, ASN1_INTEGER *);
  78. int i2d_ASN1_TYPE(ASN1_TYPE *, unsigned char **);
  79. ASN1_TYPE *d2i_ASN1_TYPE(ASN1_TYPE **, const unsigned char **, long);
  80. ASN1_NULL *ASN1_NULL_new(void);
  81. """
  82. CUSTOMIZATIONS = """
  83. """