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.

7405 lines
239 KiB

  1. #include "krbprgma.h"
  2. #include <windows.h>
  3. #include "krb5.h"
  4. ASN1module_t KRB5_Module = NULL;
  5. static int ASN1CALL ASN1Enc_PKERB_AUTHORIZATION_DATA_LIST(ASN1encoding_t enc, ASN1uint32_t tag, PKERB_AUTHORIZATION_DATA_LIST *val);
  6. static int ASN1CALL ASN1Enc_PKERB_IF_RELEVANT_AUTH_DATA(ASN1encoding_t enc, ASN1uint32_t tag, PKERB_IF_RELEVANT_AUTH_DATA *val);
  7. static int ASN1CALL ASN1Enc_KERB_KDC_REQUEST_BODY_encryption_type(ASN1encoding_t enc, ASN1uint32_t tag, PKERB_KDC_REQUEST_BODY_encryption_type *val);
  8. static int ASN1CALL ASN1Enc_PKERB_TICKET_EXTENSIONS_Seq(ASN1encoding_t enc, ASN1uint32_t tag, PKERB_TICKET_EXTENSIONS_Seq *val);
  9. static int ASN1CALL ASN1Enc_KERB_PRINCIPAL_NAME_name_string(ASN1encoding_t enc, ASN1uint32_t tag, PKERB_PRINCIPAL_NAME_name_string *val);
  10. static int ASN1CALL ASN1Enc_PKERB_LAST_REQUEST_Seq(ASN1encoding_t enc, ASN1uint32_t tag, PKERB_LAST_REQUEST_Seq *val);
  11. static int ASN1CALL ASN1Enc_PKERB_AUTHORIZATION_DATA_Seq(ASN1encoding_t enc, ASN1uint32_t tag, PKERB_AUTHORIZATION_DATA_Seq *val);
  12. static int ASN1CALL ASN1Enc_PKERB_HOST_ADDRESSES_Seq(ASN1encoding_t enc, ASN1uint32_t tag, PKERB_HOST_ADDRESSES_Seq *val);
  13. static int ASN1CALL ASN1Enc_KERB_HOST_ADDRESS(ASN1encoding_t enc, ASN1uint32_t tag, KERB_HOST_ADDRESS *val);
  14. static int ASN1CALL ASN1Enc_PKERB_HOST_ADDRESSES(ASN1encoding_t enc, ASN1uint32_t tag, PPKERB_HOST_ADDRESSES *val);
  15. static int ASN1CALL ASN1Enc_PKERB_AUTHORIZATION_DATA(ASN1encoding_t enc, ASN1uint32_t tag, PPKERB_AUTHORIZATION_DATA *val);
  16. static int ASN1CALL ASN1Enc_PKERB_LAST_REQUEST(ASN1encoding_t enc, ASN1uint32_t tag, PPKERB_LAST_REQUEST *val);
  17. static int ASN1CALL ASN1Enc_KERB_PRINCIPAL_NAME(ASN1encoding_t enc, ASN1uint32_t tag, KERB_PRINCIPAL_NAME *val);
  18. static int ASN1CALL ASN1Enc_PKERB_TICKET_EXTENSIONS(ASN1encoding_t enc, ASN1uint32_t tag, PPKERB_TICKET_EXTENSIONS *val);
  19. static int ASN1CALL ASN1Enc_KERB_TRANSITED_ENCODING(ASN1encoding_t enc, ASN1uint32_t tag, KERB_TRANSITED_ENCODING *val);
  20. static int ASN1CALL ASN1Enc_KERB_PA_DATA(ASN1encoding_t enc, ASN1uint32_t tag, KERB_PA_DATA *val);
  21. static int ASN1CALL ASN1Enc_PKERB_PREAUTH_DATA_LIST(ASN1encoding_t enc, ASN1uint32_t tag, PPKERB_PREAUTH_DATA_LIST *val);
  22. static int ASN1CALL ASN1Enc_KERB_SAFE_BODY(ASN1encoding_t enc, ASN1uint32_t tag, KERB_SAFE_BODY *val);
  23. static int ASN1CALL ASN1Enc_KERB_ENCRYPTED_PRIV(ASN1encoding_t enc, ASN1uint32_t tag, KERB_ENCRYPTED_PRIV *val);
  24. static int ASN1CALL ASN1Enc_KERB_ENCRYPTED_CRED(ASN1encoding_t enc, ASN1uint32_t tag, KERB_ENCRYPTED_CRED *val);
  25. static int ASN1CALL ASN1Enc_KERB_ERROR(ASN1encoding_t enc, ASN1uint32_t tag, KERB_ERROR *val);
  26. static int ASN1CALL ASN1Enc_KERB_ENCRYPTED_DATA(ASN1encoding_t enc, ASN1uint32_t tag, KERB_ENCRYPTED_DATA *val);
  27. static int ASN1CALL ASN1Enc_KERB_ENCRYPTION_KEY(ASN1encoding_t enc, ASN1uint32_t tag, KERB_ENCRYPTION_KEY *val);
  28. static int ASN1CALL ASN1Enc_KERB_CHECKSUM(ASN1encoding_t enc, ASN1uint32_t tag, KERB_CHECKSUM *val);
  29. static int ASN1CALL ASN1Enc_KERB_ENCRYPTED_TIMESTAMP(ASN1encoding_t enc, ASN1uint32_t tag, KERB_ENCRYPTED_TIMESTAMP *val);
  30. static int ASN1CALL ASN1Enc_KERB_SALTED_ENCRYPTED_TIMESTAMP(ASN1encoding_t enc, ASN1uint32_t tag, KERB_SALTED_ENCRYPTED_TIMESTAMP *val);
  31. static int ASN1CALL ASN1Enc_KERB_ETYPE_INFO_ENTRY(ASN1encoding_t enc, ASN1uint32_t tag, KERB_ETYPE_INFO_ENTRY *val);
  32. static int ASN1CALL ASN1Enc_PKERB_ETYPE_INFO(ASN1encoding_t enc, ASN1uint32_t tag, PPKERB_ETYPE_INFO *val);
  33. static int ASN1CALL ASN1Enc_KERB_TGT_REQUEST(ASN1encoding_t enc, ASN1uint32_t tag, KERB_TGT_REQUEST *val);
  34. static int ASN1CALL ASN1Enc_KERB_PKCS_SIGNATURE(ASN1encoding_t enc, ASN1uint32_t tag, KERB_PKCS_SIGNATURE *val);
  35. static int ASN1CALL ASN1Enc_KERB_ALGORITHM_IDENTIFIER(ASN1encoding_t enc, ASN1uint32_t tag, KERB_ALGORITHM_IDENTIFIER *val);
  36. static int ASN1CALL ASN1Enc_KERB_SIGNATURE(ASN1encoding_t enc, ASN1uint32_t tag, KERB_SIGNATURE *val);
  37. static int ASN1CALL ASN1Enc_KERB_PA_PK_AS_REP(ASN1encoding_t enc, ASN1uint32_t tag, KERB_PA_PK_AS_REP *val);
  38. static int ASN1CALL ASN1Enc_KERB_ENVELOPED_KEY_PACKAGE(ASN1encoding_t enc, ASN1uint32_t tag, KERB_ENVELOPED_KEY_PACKAGE *val);
  39. static int ASN1CALL ASN1Enc_KERB_REPLY_KEY_PACKAGE2(ASN1encoding_t enc, ASN1uint32_t tag, KERB_REPLY_KEY_PACKAGE2 *val);
  40. static int ASN1CALL ASN1Enc_KERB_REPLY_KEY_PACKAGE(ASN1encoding_t enc, ASN1uint32_t tag, KERB_REPLY_KEY_PACKAGE *val);
  41. static int ASN1CALL ASN1Enc_KERB_KDC_DH_KEY_INFO(ASN1encoding_t enc, ASN1uint32_t tag, KERB_KDC_DH_KEY_INFO *val);
  42. static int ASN1CALL ASN1Enc_KERB_PA_PK_AS_REQ(ASN1encoding_t enc, ASN1uint32_t tag, KERB_PA_PK_AS_REQ *val);
  43. static int ASN1CALL ASN1Enc_KERB_KERBEROS_NAME(ASN1encoding_t enc, ASN1uint32_t tag, KERB_KERBEROS_NAME *val);
  44. static int ASN1CALL ASN1Enc_KERB_PK_AUTHENTICATOR(ASN1encoding_t enc, ASN1uint32_t tag, KERB_PK_AUTHENTICATOR *val);
  45. static int ASN1CALL ASN1Enc_KERB_SUBJECT_PUBLIC_KEY_INFO(ASN1encoding_t enc, ASN1uint32_t tag, KERB_SUBJECT_PUBLIC_KEY_INFO *val);
  46. static int ASN1CALL ASN1Enc_KERB_DH_PARAMTER(ASN1encoding_t enc, ASN1uint32_t tag, KERB_DH_PARAMTER *val);
  47. static int ASN1CALL ASN1Enc_KERB_CERTIFICATE(ASN1encoding_t enc, ASN1uint32_t tag, KERB_CERTIFICATE *val);
  48. static int ASN1CALL ASN1Enc_KERB_TYPED_DATA(ASN1encoding_t enc, ASN1uint32_t tag, KERB_TYPED_DATA *val);
  49. static int ASN1CALL ASN1Enc_KERB_KDC_ISSUED_AUTH_DATA(ASN1encoding_t enc, ASN1uint32_t tag, KERB_KDC_ISSUED_AUTH_DATA *val);
  50. static int ASN1CALL ASN1Enc_KERB_PA_SERV_REFERRAL(ASN1encoding_t enc, ASN1uint32_t tag, KERB_PA_SERV_REFERRAL *val);
  51. static int ASN1CALL ASN1Enc_KERB_PA_PAC_REQUEST(ASN1encoding_t enc, ASN1uint32_t tag, KERB_PA_PAC_REQUEST *val);
  52. static int ASN1CALL ASN1Enc_KERB_CHANGE_PASSWORD_DATA(ASN1encoding_t enc, ASN1uint32_t tag, KERB_CHANGE_PASSWORD_DATA *val);
  53. static int ASN1CALL ASN1Enc_KERB_ERROR_METHOD_DATA(ASN1encoding_t enc, ASN1uint32_t tag, KERB_ERROR_METHOD_DATA *val);
  54. static int ASN1CALL ASN1Enc_KERB_EXT_ERROR(ASN1encoding_t enc, ASN1uint32_t tag, KERB_EXT_ERROR *val);
  55. static int ASN1CALL ASN1Enc_TYPED_DATA(ASN1encoding_t enc, ASN1uint32_t tag, PTYPED_DATA *val);
  56. static int ASN1CALL ASN1Enc_KERB_PA_FOR_USER(ASN1encoding_t enc, ASN1uint32_t tag, KERB_PA_FOR_USER *val);
  57. static int ASN1CALL ASN1Enc_KERB_KDC_ISSUED_AUTH_DATA_elements(ASN1encoding_t enc, ASN1uint32_t tag, PKERB_KDC_ISSUED_AUTH_DATA_elements *val);
  58. static int ASN1CALL ASN1Enc_KERB_PA_PK_AS_REQ2_trusted_certifiers(ASN1encoding_t enc, ASN1uint32_t tag, PKERB_PA_PK_AS_REQ2_trusted_certifiers *val);
  59. static int ASN1CALL ASN1Enc_KERB_PA_PK_AS_REQ2_user_certs(ASN1encoding_t enc, ASN1uint32_t tag, PKERB_PA_PK_AS_REQ2_user_certs *val);
  60. static int ASN1CALL ASN1Enc_KERB_PA_PK_AS_REP2_kdc_cert(ASN1encoding_t enc, ASN1uint32_t tag, PKERB_PA_PK_AS_REP2_kdc_cert *val);
  61. static int ASN1CALL ASN1Enc_KERB_ENCRYPTED_KDC_REPLY_encrypted_pa_data(ASN1encoding_t enc, ASN1uint32_t tag, PKERB_ENCRYPTED_KDC_REPLY_encrypted_pa_data *val);
  62. static int ASN1CALL ASN1Enc_KERB_KDC_REPLY_preauth_data(ASN1encoding_t enc, ASN1uint32_t tag, PKERB_KDC_REPLY_preauth_data *val);
  63. static int ASN1CALL ASN1Enc_KERB_KDC_REQUEST_preauth_data(ASN1encoding_t enc, ASN1uint32_t tag, PKERB_KDC_REQUEST_preauth_data *val);
  64. static int ASN1CALL ASN1Enc_KERB_TICKET(ASN1encoding_t enc, ASN1uint32_t tag, KERB_TICKET *val);
  65. static int ASN1CALL ASN1Enc_KERB_ENCRYPTED_TICKET(ASN1encoding_t enc, ASN1uint32_t tag, KERB_ENCRYPTED_TICKET *val);
  66. static int ASN1CALL ASN1Enc_KERB_AUTHENTICATOR(ASN1encoding_t enc, ASN1uint32_t tag, KERB_AUTHENTICATOR *val);
  67. static int ASN1CALL ASN1Enc_KERB_KDC_REQUEST_BODY(ASN1encoding_t enc, ASN1uint32_t tag, KERB_KDC_REQUEST_BODY *val);
  68. static int ASN1CALL ASN1Enc_KERB_KDC_REPLY(ASN1encoding_t enc, ASN1uint32_t tag, KERB_KDC_REPLY *val);
  69. static int ASN1CALL ASN1Enc_KERB_ENCRYPTED_KDC_REPLY(ASN1encoding_t enc, ASN1uint32_t tag, KERB_ENCRYPTED_KDC_REPLY *val);
  70. static int ASN1CALL ASN1Enc_KERB_AP_REQUEST(ASN1encoding_t enc, ASN1uint32_t tag, KERB_AP_REQUEST *val);
  71. static int ASN1CALL ASN1Enc_KERB_AP_REPLY(ASN1encoding_t enc, ASN1uint32_t tag, KERB_AP_REPLY *val);
  72. static int ASN1CALL ASN1Enc_KERB_ENCRYPTED_AP_REPLY(ASN1encoding_t enc, ASN1uint32_t tag, KERB_ENCRYPTED_AP_REPLY *val);
  73. static int ASN1CALL ASN1Enc_KERB_SAFE_MESSAGE(ASN1encoding_t enc, ASN1uint32_t tag, KERB_SAFE_MESSAGE *val);
  74. static int ASN1CALL ASN1Enc_KERB_PRIV_MESSAGE(ASN1encoding_t enc, ASN1uint32_t tag, KERB_PRIV_MESSAGE *val);
  75. static int ASN1CALL ASN1Enc_KERB_CRED(ASN1encoding_t enc, ASN1uint32_t tag, KERB_CRED *val);
  76. static int ASN1CALL ASN1Enc_KERB_CRED_INFO(ASN1encoding_t enc, ASN1uint32_t tag, KERB_CRED_INFO *val);
  77. static int ASN1CALL ASN1Enc_KERB_TGT_REPLY(ASN1encoding_t enc, ASN1uint32_t tag, KERB_TGT_REPLY *val);
  78. static int ASN1CALL ASN1Enc_KERB_SIGNED_REPLY_KEY_PACKAGE(ASN1encoding_t enc, ASN1uint32_t tag, KERB_SIGNED_REPLY_KEY_PACKAGE *val);
  79. static int ASN1CALL ASN1Enc_KERB_SIGNED_KDC_PUBLIC_VALUE(ASN1encoding_t enc, ASN1uint32_t tag, KERB_SIGNED_KDC_PUBLIC_VALUE *val);
  80. static int ASN1CALL ASN1Enc_KERB_TRUSTED_CAS(ASN1encoding_t enc, ASN1uint32_t tag, KERB_TRUSTED_CAS *val);
  81. static int ASN1CALL ASN1Enc_KERB_AUTH_PACKAGE(ASN1encoding_t enc, ASN1uint32_t tag, KERB_AUTH_PACKAGE *val);
  82. static int ASN1CALL ASN1Enc_KERB_PA_PK_AS_REQ_trusted_certifiers(ASN1encoding_t enc, ASN1uint32_t tag, PKERB_PA_PK_AS_REQ_trusted_certifiers *val);
  83. static int ASN1CALL ASN1Enc_KERB_ENCRYPTED_CRED_ticket_info(ASN1encoding_t enc, ASN1uint32_t tag, PKERB_ENCRYPTED_CRED_ticket_info *val);
  84. static int ASN1CALL ASN1Enc_KERB_CRED_tickets(ASN1encoding_t enc, ASN1uint32_t tag, PKERB_CRED_tickets *val);
  85. static int ASN1CALL ASN1Enc_KERB_KDC_REQUEST_BODY_additional_tickets(ASN1encoding_t enc, ASN1uint32_t tag, PKERB_KDC_REQUEST_BODY_additional_tickets *val);
  86. static int ASN1CALL ASN1Enc_KERB_KDC_REQUEST(ASN1encoding_t enc, ASN1uint32_t tag, KERB_KDC_REQUEST *val);
  87. static int ASN1CALL ASN1Enc_KERB_MARSHALLED_REQUEST_BODY(ASN1encoding_t enc, ASN1uint32_t tag, KERB_MARSHALLED_REQUEST_BODY *val);
  88. static int ASN1CALL ASN1Enc_KERB_AS_REPLY(ASN1encoding_t enc, ASN1uint32_t tag, KERB_AS_REPLY *val);
  89. static int ASN1CALL ASN1Enc_KERB_TGS_REPLY(ASN1encoding_t enc, ASN1uint32_t tag, KERB_TGS_REPLY *val);
  90. static int ASN1CALL ASN1Enc_KERB_ENCRYPTED_AS_REPLY(ASN1encoding_t enc, ASN1uint32_t tag, KERB_ENCRYPTED_AS_REPLY *val);
  91. static int ASN1CALL ASN1Enc_KERB_ENCRYPTED_TGS_REPLY(ASN1encoding_t enc, ASN1uint32_t tag, KERB_ENCRYPTED_TGS_REPLY *val);
  92. static int ASN1CALL ASN1Enc_KERB_PA_PK_AS_REP2(ASN1encoding_t enc, ASN1uint32_t tag, KERB_PA_PK_AS_REP2 *val);
  93. static int ASN1CALL ASN1Enc_KERB_SIGNED_AUTH_PACKAGE(ASN1encoding_t enc, ASN1uint32_t tag, KERB_SIGNED_AUTH_PACKAGE *val);
  94. static int ASN1CALL ASN1Enc_KERB_AS_REQUEST(ASN1encoding_t enc, ASN1uint32_t tag, KERB_AS_REQUEST *val);
  95. static int ASN1CALL ASN1Enc_KERB_TGS_REQUEST(ASN1encoding_t enc, ASN1uint32_t tag, KERB_TGS_REQUEST *val);
  96. static int ASN1CALL ASN1Enc_KERB_PA_PK_AS_REQ2(ASN1encoding_t enc, ASN1uint32_t tag, KERB_PA_PK_AS_REQ2 *val);
  97. static int ASN1CALL ASN1Dec_PKERB_AUTHORIZATION_DATA_LIST(ASN1decoding_t dec, ASN1uint32_t tag, PKERB_AUTHORIZATION_DATA_LIST *val);
  98. static int ASN1CALL ASN1Dec_PKERB_IF_RELEVANT_AUTH_DATA(ASN1decoding_t dec, ASN1uint32_t tag, PKERB_IF_RELEVANT_AUTH_DATA *val);
  99. static int ASN1CALL ASN1Dec_KERB_KDC_REQUEST_BODY_encryption_type(ASN1decoding_t dec, ASN1uint32_t tag, PKERB_KDC_REQUEST_BODY_encryption_type *val);
  100. static int ASN1CALL ASN1Dec_PKERB_TICKET_EXTENSIONS_Seq(ASN1decoding_t dec, ASN1uint32_t tag, PKERB_TICKET_EXTENSIONS_Seq *val);
  101. static int ASN1CALL ASN1Dec_KERB_PRINCIPAL_NAME_name_string(ASN1decoding_t dec, ASN1uint32_t tag, PKERB_PRINCIPAL_NAME_name_string *val);
  102. static int ASN1CALL ASN1Dec_PKERB_LAST_REQUEST_Seq(ASN1decoding_t dec, ASN1uint32_t tag, PKERB_LAST_REQUEST_Seq *val);
  103. static int ASN1CALL ASN1Dec_PKERB_AUTHORIZATION_DATA_Seq(ASN1decoding_t dec, ASN1uint32_t tag, PKERB_AUTHORIZATION_DATA_Seq *val);
  104. static int ASN1CALL ASN1Dec_PKERB_HOST_ADDRESSES_Seq(ASN1decoding_t dec, ASN1uint32_t tag, PKERB_HOST_ADDRESSES_Seq *val);
  105. static int ASN1CALL ASN1Dec_KERB_HOST_ADDRESS(ASN1decoding_t dec, ASN1uint32_t tag, KERB_HOST_ADDRESS *val);
  106. static int ASN1CALL ASN1Dec_PKERB_HOST_ADDRESSES(ASN1decoding_t dec, ASN1uint32_t tag, PPKERB_HOST_ADDRESSES *val);
  107. static int ASN1CALL ASN1Dec_PKERB_AUTHORIZATION_DATA(ASN1decoding_t dec, ASN1uint32_t tag, PPKERB_AUTHORIZATION_DATA *val);
  108. static int ASN1CALL ASN1Dec_PKERB_LAST_REQUEST(ASN1decoding_t dec, ASN1uint32_t tag, PPKERB_LAST_REQUEST *val);
  109. static int ASN1CALL ASN1Dec_KERB_PRINCIPAL_NAME(ASN1decoding_t dec, ASN1uint32_t tag, KERB_PRINCIPAL_NAME *val);
  110. static int ASN1CALL ASN1Dec_PKERB_TICKET_EXTENSIONS(ASN1decoding_t dec, ASN1uint32_t tag, PPKERB_TICKET_EXTENSIONS *val);
  111. static int ASN1CALL ASN1Dec_KERB_TRANSITED_ENCODING(ASN1decoding_t dec, ASN1uint32_t tag, KERB_TRANSITED_ENCODING *val);
  112. static int ASN1CALL ASN1Dec_KERB_PA_DATA(ASN1decoding_t dec, ASN1uint32_t tag, KERB_PA_DATA *val);
  113. static int ASN1CALL ASN1Dec_PKERB_PREAUTH_DATA_LIST(ASN1decoding_t dec, ASN1uint32_t tag, PPKERB_PREAUTH_DATA_LIST *val);
  114. static int ASN1CALL ASN1Dec_KERB_SAFE_BODY(ASN1decoding_t dec, ASN1uint32_t tag, KERB_SAFE_BODY *val);
  115. static int ASN1CALL ASN1Dec_KERB_ENCRYPTED_PRIV(ASN1decoding_t dec, ASN1uint32_t tag, KERB_ENCRYPTED_PRIV *val);
  116. static int ASN1CALL ASN1Dec_KERB_ENCRYPTED_CRED(ASN1decoding_t dec, ASN1uint32_t tag, KERB_ENCRYPTED_CRED *val);
  117. static int ASN1CALL ASN1Dec_KERB_ERROR(ASN1decoding_t dec, ASN1uint32_t tag, KERB_ERROR *val);
  118. static int ASN1CALL ASN1Dec_KERB_ENCRYPTED_DATA(ASN1decoding_t dec, ASN1uint32_t tag, KERB_ENCRYPTED_DATA *val);
  119. static int ASN1CALL ASN1Dec_KERB_ENCRYPTION_KEY(ASN1decoding_t dec, ASN1uint32_t tag, KERB_ENCRYPTION_KEY *val);
  120. static int ASN1CALL ASN1Dec_KERB_CHECKSUM(ASN1decoding_t dec, ASN1uint32_t tag, KERB_CHECKSUM *val);
  121. static int ASN1CALL ASN1Dec_KERB_ENCRYPTED_TIMESTAMP(ASN1decoding_t dec, ASN1uint32_t tag, KERB_ENCRYPTED_TIMESTAMP *val);
  122. static int ASN1CALL ASN1Dec_KERB_SALTED_ENCRYPTED_TIMESTAMP(ASN1decoding_t dec, ASN1uint32_t tag, KERB_SALTED_ENCRYPTED_TIMESTAMP *val);
  123. static int ASN1CALL ASN1Dec_KERB_ETYPE_INFO_ENTRY(ASN1decoding_t dec, ASN1uint32_t tag, KERB_ETYPE_INFO_ENTRY *val);
  124. static int ASN1CALL ASN1Dec_PKERB_ETYPE_INFO(ASN1decoding_t dec, ASN1uint32_t tag, PPKERB_ETYPE_INFO *val);
  125. static int ASN1CALL ASN1Dec_KERB_TGT_REQUEST(ASN1decoding_t dec, ASN1uint32_t tag, KERB_TGT_REQUEST *val);
  126. static int ASN1CALL ASN1Dec_KERB_PKCS_SIGNATURE(ASN1decoding_t dec, ASN1uint32_t tag, KERB_PKCS_SIGNATURE *val);
  127. static int ASN1CALL ASN1Dec_KERB_ALGORITHM_IDENTIFIER(ASN1decoding_t dec, ASN1uint32_t tag, KERB_ALGORITHM_IDENTIFIER *val);
  128. static int ASN1CALL ASN1Dec_KERB_SIGNATURE(ASN1decoding_t dec, ASN1uint32_t tag, KERB_SIGNATURE *val);
  129. static int ASN1CALL ASN1Dec_KERB_PA_PK_AS_REP(ASN1decoding_t dec, ASN1uint32_t tag, KERB_PA_PK_AS_REP *val);
  130. static int ASN1CALL ASN1Dec_KERB_ENVELOPED_KEY_PACKAGE(ASN1decoding_t dec, ASN1uint32_t tag, KERB_ENVELOPED_KEY_PACKAGE *val);
  131. static int ASN1CALL ASN1Dec_KERB_REPLY_KEY_PACKAGE2(ASN1decoding_t dec, ASN1uint32_t tag, KERB_REPLY_KEY_PACKAGE2 *val);
  132. static int ASN1CALL ASN1Dec_KERB_REPLY_KEY_PACKAGE(ASN1decoding_t dec, ASN1uint32_t tag, KERB_REPLY_KEY_PACKAGE *val);
  133. static int ASN1CALL ASN1Dec_KERB_KDC_DH_KEY_INFO(ASN1decoding_t dec, ASN1uint32_t tag, KERB_KDC_DH_KEY_INFO *val);
  134. static int ASN1CALL ASN1Dec_KERB_PA_PK_AS_REQ(ASN1decoding_t dec, ASN1uint32_t tag, KERB_PA_PK_AS_REQ *val);
  135. static int ASN1CALL ASN1Dec_KERB_KERBEROS_NAME(ASN1decoding_t dec, ASN1uint32_t tag, KERB_KERBEROS_NAME *val);
  136. static int ASN1CALL ASN1Dec_KERB_PK_AUTHENTICATOR(ASN1decoding_t dec, ASN1uint32_t tag, KERB_PK_AUTHENTICATOR *val);
  137. static int ASN1CALL ASN1Dec_KERB_SUBJECT_PUBLIC_KEY_INFO(ASN1decoding_t dec, ASN1uint32_t tag, KERB_SUBJECT_PUBLIC_KEY_INFO *val);
  138. static int ASN1CALL ASN1Dec_KERB_DH_PARAMTER(ASN1decoding_t dec, ASN1uint32_t tag, KERB_DH_PARAMTER *val);
  139. static int ASN1CALL ASN1Dec_KERB_CERTIFICATE(ASN1decoding_t dec, ASN1uint32_t tag, KERB_CERTIFICATE *val);
  140. static int ASN1CALL ASN1Dec_KERB_TYPED_DATA(ASN1decoding_t dec, ASN1uint32_t tag, KERB_TYPED_DATA *val);
  141. static int ASN1CALL ASN1Dec_KERB_KDC_ISSUED_AUTH_DATA(ASN1decoding_t dec, ASN1uint32_t tag, KERB_KDC_ISSUED_AUTH_DATA *val);
  142. static int ASN1CALL ASN1Dec_KERB_PA_SERV_REFERRAL(ASN1decoding_t dec, ASN1uint32_t tag, KERB_PA_SERV_REFERRAL *val);
  143. static int ASN1CALL ASN1Dec_KERB_PA_PAC_REQUEST(ASN1decoding_t dec, ASN1uint32_t tag, KERB_PA_PAC_REQUEST *val);
  144. static int ASN1CALL ASN1Dec_KERB_CHANGE_PASSWORD_DATA(ASN1decoding_t dec, ASN1uint32_t tag, KERB_CHANGE_PASSWORD_DATA *val);
  145. static int ASN1CALL ASN1Dec_KERB_ERROR_METHOD_DATA(ASN1decoding_t dec, ASN1uint32_t tag, KERB_ERROR_METHOD_DATA *val);
  146. static int ASN1CALL ASN1Dec_KERB_EXT_ERROR(ASN1decoding_t dec, ASN1uint32_t tag, KERB_EXT_ERROR *val);
  147. static int ASN1CALL ASN1Dec_TYPED_DATA(ASN1decoding_t dec, ASN1uint32_t tag, PTYPED_DATA *val);
  148. static int ASN1CALL ASN1Dec_KERB_PA_FOR_USER(ASN1decoding_t dec, ASN1uint32_t tag, KERB_PA_FOR_USER *val);
  149. static int ASN1CALL ASN1Dec_KERB_KDC_ISSUED_AUTH_DATA_elements(ASN1decoding_t dec, ASN1uint32_t tag, PKERB_KDC_ISSUED_AUTH_DATA_elements *val);
  150. static int ASN1CALL ASN1Dec_KERB_PA_PK_AS_REQ2_trusted_certifiers(ASN1decoding_t dec, ASN1uint32_t tag, PKERB_PA_PK_AS_REQ2_trusted_certifiers *val);
  151. static int ASN1CALL ASN1Dec_KERB_PA_PK_AS_REQ2_user_certs(ASN1decoding_t dec, ASN1uint32_t tag, PKERB_PA_PK_AS_REQ2_user_certs *val);
  152. static int ASN1CALL ASN1Dec_KERB_PA_PK_AS_REP2_kdc_cert(ASN1decoding_t dec, ASN1uint32_t tag, PKERB_PA_PK_AS_REP2_kdc_cert *val);
  153. static int ASN1CALL ASN1Dec_KERB_ENCRYPTED_KDC_REPLY_encrypted_pa_data(ASN1decoding_t dec, ASN1uint32_t tag, PKERB_ENCRYPTED_KDC_REPLY_encrypted_pa_data *val);
  154. static int ASN1CALL ASN1Dec_KERB_KDC_REPLY_preauth_data(ASN1decoding_t dec, ASN1uint32_t tag, PKERB_KDC_REPLY_preauth_data *val);
  155. static int ASN1CALL ASN1Dec_KERB_KDC_REQUEST_preauth_data(ASN1decoding_t dec, ASN1uint32_t tag, PKERB_KDC_REQUEST_preauth_data *val);
  156. static int ASN1CALL ASN1Dec_KERB_TICKET(ASN1decoding_t dec, ASN1uint32_t tag, KERB_TICKET *val);
  157. static int ASN1CALL ASN1Dec_KERB_ENCRYPTED_TICKET(ASN1decoding_t dec, ASN1uint32_t tag, KERB_ENCRYPTED_TICKET *val);
  158. static int ASN1CALL ASN1Dec_KERB_AUTHENTICATOR(ASN1decoding_t dec, ASN1uint32_t tag, KERB_AUTHENTICATOR *val);
  159. static int ASN1CALL ASN1Dec_KERB_KDC_REQUEST_BODY(ASN1decoding_t dec, ASN1uint32_t tag, KERB_KDC_REQUEST_BODY *val);
  160. static int ASN1CALL ASN1Dec_KERB_KDC_REPLY(ASN1decoding_t dec, ASN1uint32_t tag, KERB_KDC_REPLY *val);
  161. static int ASN1CALL ASN1Dec_KERB_ENCRYPTED_KDC_REPLY(ASN1decoding_t dec, ASN1uint32_t tag, KERB_ENCRYPTED_KDC_REPLY *val);
  162. static int ASN1CALL ASN1Dec_KERB_AP_REQUEST(ASN1decoding_t dec, ASN1uint32_t tag, KERB_AP_REQUEST *val);
  163. static int ASN1CALL ASN1Dec_KERB_AP_REPLY(ASN1decoding_t dec, ASN1uint32_t tag, KERB_AP_REPLY *val);
  164. static int ASN1CALL ASN1Dec_KERB_ENCRYPTED_AP_REPLY(ASN1decoding_t dec, ASN1uint32_t tag, KERB_ENCRYPTED_AP_REPLY *val);
  165. static int ASN1CALL ASN1Dec_KERB_SAFE_MESSAGE(ASN1decoding_t dec, ASN1uint32_t tag, KERB_SAFE_MESSAGE *val);
  166. static int ASN1CALL ASN1Dec_KERB_PRIV_MESSAGE(ASN1decoding_t dec, ASN1uint32_t tag, KERB_PRIV_MESSAGE *val);
  167. static int ASN1CALL ASN1Dec_KERB_CRED(ASN1decoding_t dec, ASN1uint32_t tag, KERB_CRED *val);
  168. static int ASN1CALL ASN1Dec_KERB_CRED_INFO(ASN1decoding_t dec, ASN1uint32_t tag, KERB_CRED_INFO *val);
  169. static int ASN1CALL ASN1Dec_KERB_TGT_REPLY(ASN1decoding_t dec, ASN1uint32_t tag, KERB_TGT_REPLY *val);
  170. static int ASN1CALL ASN1Dec_KERB_SIGNED_REPLY_KEY_PACKAGE(ASN1decoding_t dec, ASN1uint32_t tag, KERB_SIGNED_REPLY_KEY_PACKAGE *val);
  171. static int ASN1CALL ASN1Dec_KERB_SIGNED_KDC_PUBLIC_VALUE(ASN1decoding_t dec, ASN1uint32_t tag, KERB_SIGNED_KDC_PUBLIC_VALUE *val);
  172. static int ASN1CALL ASN1Dec_KERB_TRUSTED_CAS(ASN1decoding_t dec, ASN1uint32_t tag, KERB_TRUSTED_CAS *val);
  173. static int ASN1CALL ASN1Dec_KERB_AUTH_PACKAGE(ASN1decoding_t dec, ASN1uint32_t tag, KERB_AUTH_PACKAGE *val);
  174. static int ASN1CALL ASN1Dec_KERB_PA_PK_AS_REQ_trusted_certifiers(ASN1decoding_t dec, ASN1uint32_t tag, PKERB_PA_PK_AS_REQ_trusted_certifiers *val);
  175. static int ASN1CALL ASN1Dec_KERB_ENCRYPTED_CRED_ticket_info(ASN1decoding_t dec, ASN1uint32_t tag, PKERB_ENCRYPTED_CRED_ticket_info *val);
  176. static int ASN1CALL ASN1Dec_KERB_CRED_tickets(ASN1decoding_t dec, ASN1uint32_t tag, PKERB_CRED_tickets *val);
  177. static int ASN1CALL ASN1Dec_KERB_KDC_REQUEST_BODY_additional_tickets(ASN1decoding_t dec, ASN1uint32_t tag, PKERB_KDC_REQUEST_BODY_additional_tickets *val);
  178. static int ASN1CALL ASN1Dec_KERB_KDC_REQUEST(ASN1decoding_t dec, ASN1uint32_t tag, KERB_KDC_REQUEST *val);
  179. static int ASN1CALL ASN1Dec_KERB_MARSHALLED_REQUEST_BODY(ASN1decoding_t dec, ASN1uint32_t tag, KERB_MARSHALLED_REQUEST_BODY *val);
  180. static int ASN1CALL ASN1Dec_KERB_AS_REPLY(ASN1decoding_t dec, ASN1uint32_t tag, KERB_AS_REPLY *val);
  181. static int ASN1CALL ASN1Dec_KERB_TGS_REPLY(ASN1decoding_t dec, ASN1uint32_t tag, KERB_TGS_REPLY *val);
  182. static int ASN1CALL ASN1Dec_KERB_ENCRYPTED_AS_REPLY(ASN1decoding_t dec, ASN1uint32_t tag, KERB_ENCRYPTED_AS_REPLY *val);
  183. static int ASN1CALL ASN1Dec_KERB_ENCRYPTED_TGS_REPLY(ASN1decoding_t dec, ASN1uint32_t tag, KERB_ENCRYPTED_TGS_REPLY *val);
  184. static int ASN1CALL ASN1Dec_KERB_PA_PK_AS_REP2(ASN1decoding_t dec, ASN1uint32_t tag, KERB_PA_PK_AS_REP2 *val);
  185. static int ASN1CALL ASN1Dec_KERB_SIGNED_AUTH_PACKAGE(ASN1decoding_t dec, ASN1uint32_t tag, KERB_SIGNED_AUTH_PACKAGE *val);
  186. static int ASN1CALL ASN1Dec_KERB_AS_REQUEST(ASN1decoding_t dec, ASN1uint32_t tag, KERB_AS_REQUEST *val);
  187. static int ASN1CALL ASN1Dec_KERB_TGS_REQUEST(ASN1decoding_t dec, ASN1uint32_t tag, KERB_TGS_REQUEST *val);
  188. static int ASN1CALL ASN1Dec_KERB_PA_PK_AS_REQ2(ASN1decoding_t dec, ASN1uint32_t tag, KERB_PA_PK_AS_REQ2 *val);
  189. static void ASN1CALL ASN1Free_PKERB_AUTHORIZATION_DATA_LIST(PKERB_AUTHORIZATION_DATA_LIST *val);
  190. static void ASN1CALL ASN1Free_PKERB_IF_RELEVANT_AUTH_DATA(PKERB_IF_RELEVANT_AUTH_DATA *val);
  191. static void ASN1CALL ASN1Free_KERB_KDC_REQUEST_BODY_encryption_type(PKERB_KDC_REQUEST_BODY_encryption_type *val);
  192. static void ASN1CALL ASN1Free_PKERB_TICKET_EXTENSIONS_Seq(PKERB_TICKET_EXTENSIONS_Seq *val);
  193. static void ASN1CALL ASN1Free_KERB_PRINCIPAL_NAME_name_string(PKERB_PRINCIPAL_NAME_name_string *val);
  194. static void ASN1CALL ASN1Free_PKERB_LAST_REQUEST_Seq(PKERB_LAST_REQUEST_Seq *val);
  195. static void ASN1CALL ASN1Free_PKERB_AUTHORIZATION_DATA_Seq(PKERB_AUTHORIZATION_DATA_Seq *val);
  196. static void ASN1CALL ASN1Free_PKERB_HOST_ADDRESSES_Seq(PKERB_HOST_ADDRESSES_Seq *val);
  197. static void ASN1CALL ASN1Free_KERB_HOST_ADDRESS(KERB_HOST_ADDRESS *val);
  198. static void ASN1CALL ASN1Free_PKERB_HOST_ADDRESSES(PPKERB_HOST_ADDRESSES *val);
  199. static void ASN1CALL ASN1Free_PKERB_AUTHORIZATION_DATA(PPKERB_AUTHORIZATION_DATA *val);
  200. static void ASN1CALL ASN1Free_PKERB_LAST_REQUEST(PPKERB_LAST_REQUEST *val);
  201. static void ASN1CALL ASN1Free_KERB_PRINCIPAL_NAME(KERB_PRINCIPAL_NAME *val);
  202. static void ASN1CALL ASN1Free_PKERB_TICKET_EXTENSIONS(PPKERB_TICKET_EXTENSIONS *val);
  203. static void ASN1CALL ASN1Free_KERB_TRANSITED_ENCODING(KERB_TRANSITED_ENCODING *val);
  204. static void ASN1CALL ASN1Free_KERB_PA_DATA(KERB_PA_DATA *val);
  205. static void ASN1CALL ASN1Free_PKERB_PREAUTH_DATA_LIST(PPKERB_PREAUTH_DATA_LIST *val);
  206. static void ASN1CALL ASN1Free_KERB_SAFE_BODY(KERB_SAFE_BODY *val);
  207. static void ASN1CALL ASN1Free_KERB_ENCRYPTED_PRIV(KERB_ENCRYPTED_PRIV *val);
  208. static void ASN1CALL ASN1Free_KERB_ENCRYPTED_CRED(KERB_ENCRYPTED_CRED *val);
  209. static void ASN1CALL ASN1Free_KERB_ERROR(KERB_ERROR *val);
  210. static void ASN1CALL ASN1Free_KERB_ENCRYPTED_DATA(KERB_ENCRYPTED_DATA *val);
  211. static void ASN1CALL ASN1Free_KERB_ENCRYPTION_KEY(KERB_ENCRYPTION_KEY *val);
  212. static void ASN1CALL ASN1Free_KERB_CHECKSUM(KERB_CHECKSUM *val);
  213. static void ASN1CALL ASN1Free_KERB_ENCRYPTED_TIMESTAMP(KERB_ENCRYPTED_TIMESTAMP *val);
  214. static void ASN1CALL ASN1Free_KERB_SALTED_ENCRYPTED_TIMESTAMP(KERB_SALTED_ENCRYPTED_TIMESTAMP *val);
  215. static void ASN1CALL ASN1Free_KERB_ETYPE_INFO_ENTRY(KERB_ETYPE_INFO_ENTRY *val);
  216. static void ASN1CALL ASN1Free_PKERB_ETYPE_INFO(PPKERB_ETYPE_INFO *val);
  217. static void ASN1CALL ASN1Free_KERB_TGT_REQUEST(KERB_TGT_REQUEST *val);
  218. static void ASN1CALL ASN1Free_KERB_PKCS_SIGNATURE(KERB_PKCS_SIGNATURE *val);
  219. static void ASN1CALL ASN1Free_KERB_ALGORITHM_IDENTIFIER(KERB_ALGORITHM_IDENTIFIER *val);
  220. static void ASN1CALL ASN1Free_KERB_SIGNATURE(KERB_SIGNATURE *val);
  221. static void ASN1CALL ASN1Free_KERB_PA_PK_AS_REP(KERB_PA_PK_AS_REP *val);
  222. static void ASN1CALL ASN1Free_KERB_ENVELOPED_KEY_PACKAGE(KERB_ENVELOPED_KEY_PACKAGE *val);
  223. static void ASN1CALL ASN1Free_KERB_REPLY_KEY_PACKAGE2(KERB_REPLY_KEY_PACKAGE2 *val);
  224. static void ASN1CALL ASN1Free_KERB_REPLY_KEY_PACKAGE(KERB_REPLY_KEY_PACKAGE *val);
  225. static void ASN1CALL ASN1Free_KERB_KDC_DH_KEY_INFO(KERB_KDC_DH_KEY_INFO *val);
  226. static void ASN1CALL ASN1Free_KERB_PA_PK_AS_REQ(KERB_PA_PK_AS_REQ *val);
  227. static void ASN1CALL ASN1Free_KERB_KERBEROS_NAME(KERB_KERBEROS_NAME *val);
  228. static void ASN1CALL ASN1Free_KERB_PK_AUTHENTICATOR(KERB_PK_AUTHENTICATOR *val);
  229. static void ASN1CALL ASN1Free_KERB_SUBJECT_PUBLIC_KEY_INFO(KERB_SUBJECT_PUBLIC_KEY_INFO *val);
  230. static void ASN1CALL ASN1Free_KERB_CERTIFICATE(KERB_CERTIFICATE *val);
  231. static void ASN1CALL ASN1Free_KERB_TYPED_DATA(KERB_TYPED_DATA *val);
  232. static void ASN1CALL ASN1Free_KERB_KDC_ISSUED_AUTH_DATA(KERB_KDC_ISSUED_AUTH_DATA *val);
  233. static void ASN1CALL ASN1Free_KERB_PA_SERV_REFERRAL(KERB_PA_SERV_REFERRAL *val);
  234. static void ASN1CALL ASN1Free_KERB_CHANGE_PASSWORD_DATA(KERB_CHANGE_PASSWORD_DATA *val);
  235. static void ASN1CALL ASN1Free_KERB_ERROR_METHOD_DATA(KERB_ERROR_METHOD_DATA *val);
  236. static void ASN1CALL ASN1Free_TYPED_DATA(PTYPED_DATA *val);
  237. static void ASN1CALL ASN1Free_KERB_PA_FOR_USER(KERB_PA_FOR_USER *val);
  238. static void ASN1CALL ASN1Free_KERB_KDC_ISSUED_AUTH_DATA_elements(PKERB_KDC_ISSUED_AUTH_DATA_elements *val);
  239. static void ASN1CALL ASN1Free_KERB_PA_PK_AS_REQ2_trusted_certifiers(PKERB_PA_PK_AS_REQ2_trusted_certifiers *val);
  240. static void ASN1CALL ASN1Free_KERB_PA_PK_AS_REQ2_user_certs(PKERB_PA_PK_AS_REQ2_user_certs *val);
  241. static void ASN1CALL ASN1Free_KERB_PA_PK_AS_REP2_kdc_cert(PKERB_PA_PK_AS_REP2_kdc_cert *val);
  242. static void ASN1CALL ASN1Free_KERB_ENCRYPTED_KDC_REPLY_encrypted_pa_data(PKERB_ENCRYPTED_KDC_REPLY_encrypted_pa_data *val);
  243. static void ASN1CALL ASN1Free_KERB_KDC_REPLY_preauth_data(PKERB_KDC_REPLY_preauth_data *val);
  244. static void ASN1CALL ASN1Free_KERB_KDC_REQUEST_preauth_data(PKERB_KDC_REQUEST_preauth_data *val);
  245. static void ASN1CALL ASN1Free_KERB_TICKET(KERB_TICKET *val);
  246. static void ASN1CALL ASN1Free_KERB_ENCRYPTED_TICKET(KERB_ENCRYPTED_TICKET *val);
  247. static void ASN1CALL ASN1Free_KERB_AUTHENTICATOR(KERB_AUTHENTICATOR *val);
  248. static void ASN1CALL ASN1Free_KERB_KDC_REQUEST_BODY(KERB_KDC_REQUEST_BODY *val);
  249. static void ASN1CALL ASN1Free_KERB_KDC_REPLY(KERB_KDC_REPLY *val);
  250. static void ASN1CALL ASN1Free_KERB_ENCRYPTED_KDC_REPLY(KERB_ENCRYPTED_KDC_REPLY *val);
  251. static void ASN1CALL ASN1Free_KERB_AP_REQUEST(KERB_AP_REQUEST *val);
  252. static void ASN1CALL ASN1Free_KERB_AP_REPLY(KERB_AP_REPLY *val);
  253. static void ASN1CALL ASN1Free_KERB_ENCRYPTED_AP_REPLY(KERB_ENCRYPTED_AP_REPLY *val);
  254. static void ASN1CALL ASN1Free_KERB_SAFE_MESSAGE(KERB_SAFE_MESSAGE *val);
  255. static void ASN1CALL ASN1Free_KERB_PRIV_MESSAGE(KERB_PRIV_MESSAGE *val);
  256. static void ASN1CALL ASN1Free_KERB_CRED(KERB_CRED *val);
  257. static void ASN1CALL ASN1Free_KERB_CRED_INFO(KERB_CRED_INFO *val);
  258. static void ASN1CALL ASN1Free_KERB_TGT_REPLY(KERB_TGT_REPLY *val);
  259. static void ASN1CALL ASN1Free_KERB_SIGNED_REPLY_KEY_PACKAGE(KERB_SIGNED_REPLY_KEY_PACKAGE *val);
  260. static void ASN1CALL ASN1Free_KERB_SIGNED_KDC_PUBLIC_VALUE(KERB_SIGNED_KDC_PUBLIC_VALUE *val);
  261. static void ASN1CALL ASN1Free_KERB_TRUSTED_CAS(KERB_TRUSTED_CAS *val);
  262. static void ASN1CALL ASN1Free_KERB_AUTH_PACKAGE(KERB_AUTH_PACKAGE *val);
  263. static void ASN1CALL ASN1Free_KERB_PA_PK_AS_REQ_trusted_certifiers(PKERB_PA_PK_AS_REQ_trusted_certifiers *val);
  264. static void ASN1CALL ASN1Free_KERB_ENCRYPTED_CRED_ticket_info(PKERB_ENCRYPTED_CRED_ticket_info *val);
  265. static void ASN1CALL ASN1Free_KERB_CRED_tickets(PKERB_CRED_tickets *val);
  266. static void ASN1CALL ASN1Free_KERB_KDC_REQUEST_BODY_additional_tickets(PKERB_KDC_REQUEST_BODY_additional_tickets *val);
  267. static void ASN1CALL ASN1Free_KERB_KDC_REQUEST(KERB_KDC_REQUEST *val);
  268. static void ASN1CALL ASN1Free_KERB_MARSHALLED_REQUEST_BODY(KERB_MARSHALLED_REQUEST_BODY *val);
  269. static void ASN1CALL ASN1Free_KERB_AS_REPLY(KERB_AS_REPLY *val);
  270. static void ASN1CALL ASN1Free_KERB_TGS_REPLY(KERB_TGS_REPLY *val);
  271. static void ASN1CALL ASN1Free_KERB_ENCRYPTED_AS_REPLY(KERB_ENCRYPTED_AS_REPLY *val);
  272. static void ASN1CALL ASN1Free_KERB_ENCRYPTED_TGS_REPLY(KERB_ENCRYPTED_TGS_REPLY *val);
  273. static void ASN1CALL ASN1Free_KERB_PA_PK_AS_REP2(KERB_PA_PK_AS_REP2 *val);
  274. static void ASN1CALL ASN1Free_KERB_SIGNED_AUTH_PACKAGE(KERB_SIGNED_AUTH_PACKAGE *val);
  275. static void ASN1CALL ASN1Free_KERB_AS_REQUEST(KERB_AS_REQUEST *val);
  276. static void ASN1CALL ASN1Free_KERB_TGS_REQUEST(KERB_TGS_REQUEST *val);
  277. static void ASN1CALL ASN1Free_KERB_PA_PK_AS_REQ2(KERB_PA_PK_AS_REQ2 *val);
  278. typedef ASN1BerEncFun_t ASN1EncFun_t;
  279. static const ASN1EncFun_t encfntab[49] = {
  280. (ASN1EncFun_t) ASN1Enc_PKERB_AUTHORIZATION_DATA_LIST,
  281. (ASN1EncFun_t) ASN1Enc_PKERB_IF_RELEVANT_AUTH_DATA,
  282. (ASN1EncFun_t) ASN1Enc_PKERB_PREAUTH_DATA_LIST,
  283. (ASN1EncFun_t) ASN1Enc_KERB_ENCRYPTED_PRIV,
  284. (ASN1EncFun_t) ASN1Enc_KERB_ENCRYPTED_CRED,
  285. (ASN1EncFun_t) ASN1Enc_KERB_ERROR,
  286. (ASN1EncFun_t) ASN1Enc_KERB_ENCRYPTED_DATA,
  287. (ASN1EncFun_t) ASN1Enc_KERB_ENCRYPTION_KEY,
  288. (ASN1EncFun_t) ASN1Enc_KERB_CHECKSUM,
  289. (ASN1EncFun_t) ASN1Enc_KERB_ENCRYPTED_TIMESTAMP,
  290. (ASN1EncFun_t) ASN1Enc_KERB_SALTED_ENCRYPTED_TIMESTAMP,
  291. (ASN1EncFun_t) ASN1Enc_PKERB_ETYPE_INFO,
  292. (ASN1EncFun_t) ASN1Enc_KERB_TGT_REQUEST,
  293. (ASN1EncFun_t) ASN1Enc_KERB_PKCS_SIGNATURE,
  294. (ASN1EncFun_t) ASN1Enc_KERB_PA_PK_AS_REP,
  295. (ASN1EncFun_t) ASN1Enc_KERB_REPLY_KEY_PACKAGE2,
  296. (ASN1EncFun_t) ASN1Enc_KERB_REPLY_KEY_PACKAGE,
  297. (ASN1EncFun_t) ASN1Enc_KERB_KDC_DH_KEY_INFO,
  298. (ASN1EncFun_t) ASN1Enc_KERB_PA_PK_AS_REQ,
  299. (ASN1EncFun_t) ASN1Enc_KERB_DH_PARAMTER,
  300. (ASN1EncFun_t) ASN1Enc_KERB_KDC_ISSUED_AUTH_DATA,
  301. (ASN1EncFun_t) ASN1Enc_KERB_PA_SERV_REFERRAL,
  302. (ASN1EncFun_t) ASN1Enc_KERB_PA_PAC_REQUEST,
  303. (ASN1EncFun_t) ASN1Enc_KERB_CHANGE_PASSWORD_DATA,
  304. (ASN1EncFun_t) ASN1Enc_KERB_ERROR_METHOD_DATA,
  305. (ASN1EncFun_t) ASN1Enc_KERB_EXT_ERROR,
  306. (ASN1EncFun_t) ASN1Enc_TYPED_DATA,
  307. (ASN1EncFun_t) ASN1Enc_KERB_PA_FOR_USER,
  308. (ASN1EncFun_t) ASN1Enc_KERB_TICKET,
  309. (ASN1EncFun_t) ASN1Enc_KERB_ENCRYPTED_TICKET,
  310. (ASN1EncFun_t) ASN1Enc_KERB_AUTHENTICATOR,
  311. (ASN1EncFun_t) ASN1Enc_KERB_AP_REQUEST,
  312. (ASN1EncFun_t) ASN1Enc_KERB_AP_REPLY,
  313. (ASN1EncFun_t) ASN1Enc_KERB_ENCRYPTED_AP_REPLY,
  314. (ASN1EncFun_t) ASN1Enc_KERB_SAFE_MESSAGE,
  315. (ASN1EncFun_t) ASN1Enc_KERB_PRIV_MESSAGE,
  316. (ASN1EncFun_t) ASN1Enc_KERB_CRED,
  317. (ASN1EncFun_t) ASN1Enc_KERB_TGT_REPLY,
  318. (ASN1EncFun_t) ASN1Enc_KERB_SIGNED_REPLY_KEY_PACKAGE,
  319. (ASN1EncFun_t) ASN1Enc_KERB_AUTH_PACKAGE,
  320. (ASN1EncFun_t) ASN1Enc_KERB_MARSHALLED_REQUEST_BODY,
  321. (ASN1EncFun_t) ASN1Enc_KERB_AS_REPLY,
  322. (ASN1EncFun_t) ASN1Enc_KERB_TGS_REPLY,
  323. (ASN1EncFun_t) ASN1Enc_KERB_ENCRYPTED_AS_REPLY,
  324. (ASN1EncFun_t) ASN1Enc_KERB_ENCRYPTED_TGS_REPLY,
  325. (ASN1EncFun_t) ASN1Enc_KERB_PA_PK_AS_REP2,
  326. (ASN1EncFun_t) ASN1Enc_KERB_AS_REQUEST,
  327. (ASN1EncFun_t) ASN1Enc_KERB_TGS_REQUEST,
  328. (ASN1EncFun_t) ASN1Enc_KERB_PA_PK_AS_REQ2,
  329. };
  330. typedef ASN1BerDecFun_t ASN1DecFun_t;
  331. static const ASN1DecFun_t decfntab[49] = {
  332. (ASN1DecFun_t) ASN1Dec_PKERB_AUTHORIZATION_DATA_LIST,
  333. (ASN1DecFun_t) ASN1Dec_PKERB_IF_RELEVANT_AUTH_DATA,
  334. (ASN1DecFun_t) ASN1Dec_PKERB_PREAUTH_DATA_LIST,
  335. (ASN1DecFun_t) ASN1Dec_KERB_ENCRYPTED_PRIV,
  336. (ASN1DecFun_t) ASN1Dec_KERB_ENCRYPTED_CRED,
  337. (ASN1DecFun_t) ASN1Dec_KERB_ERROR,
  338. (ASN1DecFun_t) ASN1Dec_KERB_ENCRYPTED_DATA,
  339. (ASN1DecFun_t) ASN1Dec_KERB_ENCRYPTION_KEY,
  340. (ASN1DecFun_t) ASN1Dec_KERB_CHECKSUM,
  341. (ASN1DecFun_t) ASN1Dec_KERB_ENCRYPTED_TIMESTAMP,
  342. (ASN1DecFun_t) ASN1Dec_KERB_SALTED_ENCRYPTED_TIMESTAMP,
  343. (ASN1DecFun_t) ASN1Dec_PKERB_ETYPE_INFO,
  344. (ASN1DecFun_t) ASN1Dec_KERB_TGT_REQUEST,
  345. (ASN1DecFun_t) ASN1Dec_KERB_PKCS_SIGNATURE,
  346. (ASN1DecFun_t) ASN1Dec_KERB_PA_PK_AS_REP,
  347. (ASN1DecFun_t) ASN1Dec_KERB_REPLY_KEY_PACKAGE2,
  348. (ASN1DecFun_t) ASN1Dec_KERB_REPLY_KEY_PACKAGE,
  349. (ASN1DecFun_t) ASN1Dec_KERB_KDC_DH_KEY_INFO,
  350. (ASN1DecFun_t) ASN1Dec_KERB_PA_PK_AS_REQ,
  351. (ASN1DecFun_t) ASN1Dec_KERB_DH_PARAMTER,
  352. (ASN1DecFun_t) ASN1Dec_KERB_KDC_ISSUED_AUTH_DATA,
  353. (ASN1DecFun_t) ASN1Dec_KERB_PA_SERV_REFERRAL,
  354. (ASN1DecFun_t) ASN1Dec_KERB_PA_PAC_REQUEST,
  355. (ASN1DecFun_t) ASN1Dec_KERB_CHANGE_PASSWORD_DATA,
  356. (ASN1DecFun_t) ASN1Dec_KERB_ERROR_METHOD_DATA,
  357. (ASN1DecFun_t) ASN1Dec_KERB_EXT_ERROR,
  358. (ASN1DecFun_t) ASN1Dec_TYPED_DATA,
  359. (ASN1DecFun_t) ASN1Dec_KERB_PA_FOR_USER,
  360. (ASN1DecFun_t) ASN1Dec_KERB_TICKET,
  361. (ASN1DecFun_t) ASN1Dec_KERB_ENCRYPTED_TICKET,
  362. (ASN1DecFun_t) ASN1Dec_KERB_AUTHENTICATOR,
  363. (ASN1DecFun_t) ASN1Dec_KERB_AP_REQUEST,
  364. (ASN1DecFun_t) ASN1Dec_KERB_AP_REPLY,
  365. (ASN1DecFun_t) ASN1Dec_KERB_ENCRYPTED_AP_REPLY,
  366. (ASN1DecFun_t) ASN1Dec_KERB_SAFE_MESSAGE,
  367. (ASN1DecFun_t) ASN1Dec_KERB_PRIV_MESSAGE,
  368. (ASN1DecFun_t) ASN1Dec_KERB_CRED,
  369. (ASN1DecFun_t) ASN1Dec_KERB_TGT_REPLY,
  370. (ASN1DecFun_t) ASN1Dec_KERB_SIGNED_REPLY_KEY_PACKAGE,
  371. (ASN1DecFun_t) ASN1Dec_KERB_AUTH_PACKAGE,
  372. (ASN1DecFun_t) ASN1Dec_KERB_MARSHALLED_REQUEST_BODY,
  373. (ASN1DecFun_t) ASN1Dec_KERB_AS_REPLY,
  374. (ASN1DecFun_t) ASN1Dec_KERB_TGS_REPLY,
  375. (ASN1DecFun_t) ASN1Dec_KERB_ENCRYPTED_AS_REPLY,
  376. (ASN1DecFun_t) ASN1Dec_KERB_ENCRYPTED_TGS_REPLY,
  377. (ASN1DecFun_t) ASN1Dec_KERB_PA_PK_AS_REP2,
  378. (ASN1DecFun_t) ASN1Dec_KERB_AS_REQUEST,
  379. (ASN1DecFun_t) ASN1Dec_KERB_TGS_REQUEST,
  380. (ASN1DecFun_t) ASN1Dec_KERB_PA_PK_AS_REQ2,
  381. };
  382. static const ASN1FreeFun_t freefntab[49] = {
  383. (ASN1FreeFun_t) ASN1Free_PKERB_AUTHORIZATION_DATA_LIST,
  384. (ASN1FreeFun_t) ASN1Free_PKERB_IF_RELEVANT_AUTH_DATA,
  385. (ASN1FreeFun_t) ASN1Free_PKERB_PREAUTH_DATA_LIST,
  386. (ASN1FreeFun_t) ASN1Free_KERB_ENCRYPTED_PRIV,
  387. (ASN1FreeFun_t) ASN1Free_KERB_ENCRYPTED_CRED,
  388. (ASN1FreeFun_t) ASN1Free_KERB_ERROR,
  389. (ASN1FreeFun_t) ASN1Free_KERB_ENCRYPTED_DATA,
  390. (ASN1FreeFun_t) ASN1Free_KERB_ENCRYPTION_KEY,
  391. (ASN1FreeFun_t) ASN1Free_KERB_CHECKSUM,
  392. (ASN1FreeFun_t) ASN1Free_KERB_ENCRYPTED_TIMESTAMP,
  393. (ASN1FreeFun_t) ASN1Free_KERB_SALTED_ENCRYPTED_TIMESTAMP,
  394. (ASN1FreeFun_t) ASN1Free_PKERB_ETYPE_INFO,
  395. (ASN1FreeFun_t) ASN1Free_KERB_TGT_REQUEST,
  396. (ASN1FreeFun_t) ASN1Free_KERB_PKCS_SIGNATURE,
  397. (ASN1FreeFun_t) ASN1Free_KERB_PA_PK_AS_REP,
  398. (ASN1FreeFun_t) ASN1Free_KERB_REPLY_KEY_PACKAGE2,
  399. (ASN1FreeFun_t) ASN1Free_KERB_REPLY_KEY_PACKAGE,
  400. (ASN1FreeFun_t) ASN1Free_KERB_KDC_DH_KEY_INFO,
  401. (ASN1FreeFun_t) ASN1Free_KERB_PA_PK_AS_REQ,
  402. (ASN1FreeFun_t) NULL,
  403. (ASN1FreeFun_t) ASN1Free_KERB_KDC_ISSUED_AUTH_DATA,
  404. (ASN1FreeFun_t) ASN1Free_KERB_PA_SERV_REFERRAL,
  405. (ASN1FreeFun_t) NULL,
  406. (ASN1FreeFun_t) ASN1Free_KERB_CHANGE_PASSWORD_DATA,
  407. (ASN1FreeFun_t) ASN1Free_KERB_ERROR_METHOD_DATA,
  408. (ASN1FreeFun_t) NULL,
  409. (ASN1FreeFun_t) ASN1Free_TYPED_DATA,
  410. (ASN1FreeFun_t) ASN1Free_KERB_PA_FOR_USER,
  411. (ASN1FreeFun_t) ASN1Free_KERB_TICKET,
  412. (ASN1FreeFun_t) ASN1Free_KERB_ENCRYPTED_TICKET,
  413. (ASN1FreeFun_t) ASN1Free_KERB_AUTHENTICATOR,
  414. (ASN1FreeFun_t) ASN1Free_KERB_AP_REQUEST,
  415. (ASN1FreeFun_t) ASN1Free_KERB_AP_REPLY,
  416. (ASN1FreeFun_t) ASN1Free_KERB_ENCRYPTED_AP_REPLY,
  417. (ASN1FreeFun_t) ASN1Free_KERB_SAFE_MESSAGE,
  418. (ASN1FreeFun_t) ASN1Free_KERB_PRIV_MESSAGE,
  419. (ASN1FreeFun_t) ASN1Free_KERB_CRED,
  420. (ASN1FreeFun_t) ASN1Free_KERB_TGT_REPLY,
  421. (ASN1FreeFun_t) ASN1Free_KERB_SIGNED_REPLY_KEY_PACKAGE,
  422. (ASN1FreeFun_t) ASN1Free_KERB_AUTH_PACKAGE,
  423. (ASN1FreeFun_t) ASN1Free_KERB_MARSHALLED_REQUEST_BODY,
  424. (ASN1FreeFun_t) ASN1Free_KERB_AS_REPLY,
  425. (ASN1FreeFun_t) ASN1Free_KERB_TGS_REPLY,
  426. (ASN1FreeFun_t) ASN1Free_KERB_ENCRYPTED_AS_REPLY,
  427. (ASN1FreeFun_t) ASN1Free_KERB_ENCRYPTED_TGS_REPLY,
  428. (ASN1FreeFun_t) ASN1Free_KERB_PA_PK_AS_REP2,
  429. (ASN1FreeFun_t) ASN1Free_KERB_AS_REQUEST,
  430. (ASN1FreeFun_t) ASN1Free_KERB_TGS_REQUEST,
  431. (ASN1FreeFun_t) ASN1Free_KERB_PA_PK_AS_REQ2,
  432. };
  433. static const ULONG sizetab[49] = {
  434. SIZE_KRB5_Module_PDU_0,
  435. SIZE_KRB5_Module_PDU_1,
  436. SIZE_KRB5_Module_PDU_2,
  437. SIZE_KRB5_Module_PDU_3,
  438. SIZE_KRB5_Module_PDU_4,
  439. SIZE_KRB5_Module_PDU_5,
  440. SIZE_KRB5_Module_PDU_6,
  441. SIZE_KRB5_Module_PDU_7,
  442. SIZE_KRB5_Module_PDU_8,
  443. SIZE_KRB5_Module_PDU_9,
  444. SIZE_KRB5_Module_PDU_10,
  445. SIZE_KRB5_Module_PDU_11,
  446. SIZE_KRB5_Module_PDU_12,
  447. SIZE_KRB5_Module_PDU_13,
  448. SIZE_KRB5_Module_PDU_14,
  449. SIZE_KRB5_Module_PDU_15,
  450. SIZE_KRB5_Module_PDU_16,
  451. SIZE_KRB5_Module_PDU_17,
  452. SIZE_KRB5_Module_PDU_18,
  453. SIZE_KRB5_Module_PDU_19,
  454. SIZE_KRB5_Module_PDU_20,
  455. SIZE_KRB5_Module_PDU_21,
  456. SIZE_KRB5_Module_PDU_22,
  457. SIZE_KRB5_Module_PDU_23,
  458. SIZE_KRB5_Module_PDU_24,
  459. SIZE_KRB5_Module_PDU_25,
  460. SIZE_KRB5_Module_PDU_26,
  461. SIZE_KRB5_Module_PDU_27,
  462. SIZE_KRB5_Module_PDU_28,
  463. SIZE_KRB5_Module_PDU_29,
  464. SIZE_KRB5_Module_PDU_30,
  465. SIZE_KRB5_Module_PDU_31,
  466. SIZE_KRB5_Module_PDU_32,
  467. SIZE_KRB5_Module_PDU_33,
  468. SIZE_KRB5_Module_PDU_34,
  469. SIZE_KRB5_Module_PDU_35,
  470. SIZE_KRB5_Module_PDU_36,
  471. SIZE_KRB5_Module_PDU_37,
  472. SIZE_KRB5_Module_PDU_38,
  473. SIZE_KRB5_Module_PDU_39,
  474. SIZE_KRB5_Module_PDU_40,
  475. SIZE_KRB5_Module_PDU_41,
  476. SIZE_KRB5_Module_PDU_42,
  477. SIZE_KRB5_Module_PDU_43,
  478. SIZE_KRB5_Module_PDU_44,
  479. SIZE_KRB5_Module_PDU_45,
  480. SIZE_KRB5_Module_PDU_46,
  481. SIZE_KRB5_Module_PDU_47,
  482. SIZE_KRB5_Module_PDU_48,
  483. };
  484. /* forward declarations of values: */
  485. /* definitions of value components: */
  486. /* definitions of values: */
  487. void ASN1CALL KRB5_Module_Startup(void)
  488. {
  489. KRB5_Module = ASN1_CreateModule(0x10000, ASN1_BER_RULE_DER, ASN1FLAGS_NOASSERT, 49, (const ASN1GenericFun_t *) encfntab, (const ASN1GenericFun_t *) decfntab, freefntab, sizetab, 0x3562726b);
  490. }
  491. void ASN1CALL KRB5_Module_Cleanup(void)
  492. {
  493. ASN1_CloseModule(KRB5_Module);
  494. KRB5_Module = NULL;
  495. }
  496. static int ASN1CALL ASN1Enc_PKERB_AUTHORIZATION_DATA_LIST(ASN1encoding_t enc, ASN1uint32_t tag, PKERB_AUTHORIZATION_DATA_LIST *val)
  497. {
  498. if (!ASN1Enc_PKERB_AUTHORIZATION_DATA(enc, tag, val))
  499. return 0;
  500. return 1;
  501. }
  502. static int ASN1CALL ASN1Dec_PKERB_AUTHORIZATION_DATA_LIST(ASN1decoding_t dec, ASN1uint32_t tag, PKERB_AUTHORIZATION_DATA_LIST *val)
  503. {
  504. if (!ASN1Dec_PKERB_AUTHORIZATION_DATA(dec, tag, val))
  505. return 0;
  506. return 1;
  507. }
  508. static void ASN1CALL ASN1Free_PKERB_AUTHORIZATION_DATA_LIST(PKERB_AUTHORIZATION_DATA_LIST *val)
  509. {
  510. if (val) {
  511. ASN1Free_PKERB_AUTHORIZATION_DATA(val);
  512. }
  513. }
  514. static int ASN1CALL ASN1Enc_PKERB_IF_RELEVANT_AUTH_DATA(ASN1encoding_t enc, ASN1uint32_t tag, PKERB_IF_RELEVANT_AUTH_DATA *val)
  515. {
  516. if (!ASN1Enc_PKERB_AUTHORIZATION_DATA(enc, tag, val))
  517. return 0;
  518. return 1;
  519. }
  520. static int ASN1CALL ASN1Dec_PKERB_IF_RELEVANT_AUTH_DATA(ASN1decoding_t dec, ASN1uint32_t tag, PKERB_IF_RELEVANT_AUTH_DATA *val)
  521. {
  522. if (!ASN1Dec_PKERB_AUTHORIZATION_DATA(dec, tag, val))
  523. return 0;
  524. return 1;
  525. }
  526. static void ASN1CALL ASN1Free_PKERB_IF_RELEVANT_AUTH_DATA(PKERB_IF_RELEVANT_AUTH_DATA *val)
  527. {
  528. if (val) {
  529. ASN1Free_PKERB_AUTHORIZATION_DATA(val);
  530. }
  531. }
  532. static int ASN1CALL ASN1Enc_KERB_KDC_REQUEST_BODY_encryption_type(ASN1encoding_t enc, ASN1uint32_t tag, PKERB_KDC_REQUEST_BODY_encryption_type *val)
  533. {
  534. ASN1uint32_t nLenOff0;
  535. PKERB_KDC_REQUEST_BODY_encryption_type f;
  536. ASN1uint32_t nLenOff;
  537. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x80000008, &nLenOff0))
  538. return 0;
  539. if (!ASN1BEREncExplicitTag(enc, 0x10, &nLenOff))
  540. return 0;
  541. for (f = *val; f; f = f->next) {
  542. if (!ASN1BEREncS32(enc, 0x2, f->value))
  543. return 0;
  544. }
  545. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  546. return 0;
  547. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  548. return 0;
  549. return 1;
  550. }
  551. static int ASN1CALL ASN1Dec_KERB_KDC_REQUEST_BODY_encryption_type(ASN1decoding_t dec, ASN1uint32_t tag, PKERB_KDC_REQUEST_BODY_encryption_type *val)
  552. {
  553. PKERB_KDC_REQUEST_BODY_encryption_type *f;
  554. ASN1decoding_t dd0;
  555. ASN1octet_t *di0;
  556. ASN1decoding_t dd;
  557. ASN1octet_t *di;
  558. ASN1uint32_t t;
  559. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x80000008, &dd0, &di0))
  560. return 0;
  561. if (!ASN1BERDecExplicitTag(dd0, 0x10, &dd, &di))
  562. return 0;
  563. f = val;
  564. while (ASN1BERDecNotEndOfContents(dd, di)) {
  565. if (!ASN1BERDecPeekTag(dd, &t))
  566. return 0;
  567. if (!(*f = (PKERB_KDC_REQUEST_BODY_encryption_type)ASN1DecAlloc(dd, sizeof(**f))))
  568. return 0;
  569. if (!ASN1BERDecS32Val(dd, 0x2, &(*f)->value))
  570. return 0;
  571. f = &(*f)->next;
  572. }
  573. *f = NULL;
  574. if (!ASN1BERDecEndOfContents(dd0, dd, di))
  575. return 0;
  576. if (!ASN1BERDecEndOfContents(dec, dd0, di0))
  577. return 0;
  578. return 1;
  579. }
  580. static void ASN1CALL ASN1Free_KERB_KDC_REQUEST_BODY_encryption_type(PKERB_KDC_REQUEST_BODY_encryption_type *val)
  581. {
  582. PKERB_KDC_REQUEST_BODY_encryption_type f, ff;
  583. if (val) {
  584. for (f = *val; f; f = ff) {
  585. ff = f->next;
  586. ASN1Free(f);
  587. }
  588. }
  589. }
  590. static int ASN1CALL ASN1Enc_PKERB_TICKET_EXTENSIONS_Seq(ASN1encoding_t enc, ASN1uint32_t tag, PKERB_TICKET_EXTENSIONS_Seq *val)
  591. {
  592. ASN1uint32_t nLenOff;
  593. ASN1uint32_t nLenOff0;
  594. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  595. return 0;
  596. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  597. return 0;
  598. if (!ASN1BEREncS32(enc, 0x2, (val)->te_type))
  599. return 0;
  600. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  601. return 0;
  602. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  603. return 0;
  604. if (!ASN1DEREncOctetString(enc, 0x4, ((val)->te_data).length, ((val)->te_data).value))
  605. return 0;
  606. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  607. return 0;
  608. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  609. return 0;
  610. return 1;
  611. }
  612. static int ASN1CALL ASN1Dec_PKERB_TICKET_EXTENSIONS_Seq(ASN1decoding_t dec, ASN1uint32_t tag, PKERB_TICKET_EXTENSIONS_Seq *val)
  613. {
  614. ASN1decoding_t dd;
  615. ASN1octet_t *di;
  616. ASN1decoding_t dd0;
  617. ASN1octet_t *di0;
  618. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  619. return 0;
  620. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  621. return 0;
  622. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->te_type))
  623. return 0;
  624. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  625. return 0;
  626. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  627. return 0;
  628. if (!ASN1BERDecOctetString(dd0, 0x4, &(val)->te_data))
  629. return 0;
  630. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  631. return 0;
  632. if (!ASN1BERDecEndOfContents(dec, dd, di))
  633. return 0;
  634. return 1;
  635. }
  636. static void ASN1CALL ASN1Free_PKERB_TICKET_EXTENSIONS_Seq(PKERB_TICKET_EXTENSIONS_Seq *val)
  637. {
  638. if (val) {
  639. ASN1octetstring_free(&(val)->te_data);
  640. }
  641. }
  642. static int ASN1CALL ASN1Enc_KERB_PRINCIPAL_NAME_name_string(ASN1encoding_t enc, ASN1uint32_t tag, PKERB_PRINCIPAL_NAME_name_string *val)
  643. {
  644. ASN1uint32_t nLenOff0;
  645. PKERB_PRINCIPAL_NAME_name_string f;
  646. ASN1uint32_t nLenOff;
  647. ASN1uint32_t t;
  648. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x80000001, &nLenOff0))
  649. return 0;
  650. if (!ASN1BEREncExplicitTag(enc, 0x10, &nLenOff))
  651. return 0;
  652. for (f = *val; f; f = f->next) {
  653. t = lstrlenA(f->value);
  654. if (!ASN1DEREncCharString(enc, 0x1b, t, f->value))
  655. return 0;
  656. }
  657. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  658. return 0;
  659. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  660. return 0;
  661. return 1;
  662. }
  663. static int ASN1CALL ASN1Dec_KERB_PRINCIPAL_NAME_name_string(ASN1decoding_t dec, ASN1uint32_t tag, PKERB_PRINCIPAL_NAME_name_string *val)
  664. {
  665. PKERB_PRINCIPAL_NAME_name_string *f;
  666. ASN1decoding_t dd0;
  667. ASN1octet_t *di0;
  668. ASN1decoding_t dd;
  669. ASN1octet_t *di;
  670. ASN1uint32_t t;
  671. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x80000001, &dd0, &di0))
  672. return 0;
  673. if (!ASN1BERDecExplicitTag(dd0, 0x10, &dd, &di))
  674. return 0;
  675. f = val;
  676. while (ASN1BERDecNotEndOfContents(dd, di)) {
  677. if (!ASN1BERDecPeekTag(dd, &t))
  678. return 0;
  679. if (!(*f = (PKERB_PRINCIPAL_NAME_name_string)ASN1DecAlloc(dd, sizeof(**f))))
  680. return 0;
  681. if (!ASN1BERDecZeroCharString(dd, 0x1b, &(*f)->value))
  682. return 0;
  683. f = &(*f)->next;
  684. }
  685. *f = NULL;
  686. if (!ASN1BERDecEndOfContents(dd0, dd, di))
  687. return 0;
  688. if (!ASN1BERDecEndOfContents(dec, dd0, di0))
  689. return 0;
  690. return 1;
  691. }
  692. static void ASN1CALL ASN1Free_KERB_PRINCIPAL_NAME_name_string(PKERB_PRINCIPAL_NAME_name_string *val)
  693. {
  694. PKERB_PRINCIPAL_NAME_name_string f, ff;
  695. if (val) {
  696. for (f = *val; f; f = ff) {
  697. ASN1ztcharstring_free(f->value);
  698. ff = f->next;
  699. ASN1Free(f);
  700. }
  701. }
  702. }
  703. static int ASN1CALL ASN1Enc_PKERB_LAST_REQUEST_Seq(ASN1encoding_t enc, ASN1uint32_t tag, PKERB_LAST_REQUEST_Seq *val)
  704. {
  705. ASN1uint32_t nLenOff;
  706. ASN1uint32_t nLenOff0;
  707. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  708. return 0;
  709. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  710. return 0;
  711. if (!ASN1BEREncS32(enc, 0x2, (val)->last_request_type))
  712. return 0;
  713. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  714. return 0;
  715. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  716. return 0;
  717. if (!ASN1DEREncGeneralizedTime(enc, 0x18, &(val)->last_request_value))
  718. return 0;
  719. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  720. return 0;
  721. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  722. return 0;
  723. return 1;
  724. }
  725. static int ASN1CALL ASN1Dec_PKERB_LAST_REQUEST_Seq(ASN1decoding_t dec, ASN1uint32_t tag, PKERB_LAST_REQUEST_Seq *val)
  726. {
  727. ASN1decoding_t dd;
  728. ASN1octet_t *di;
  729. ASN1decoding_t dd0;
  730. ASN1octet_t *di0;
  731. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  732. return 0;
  733. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  734. return 0;
  735. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->last_request_type))
  736. return 0;
  737. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  738. return 0;
  739. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  740. return 0;
  741. if (!ASN1BERDecGeneralizedTime(dd0, 0x18, &(val)->last_request_value))
  742. return 0;
  743. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  744. return 0;
  745. if (!ASN1BERDecEndOfContents(dec, dd, di))
  746. return 0;
  747. return 1;
  748. }
  749. static void ASN1CALL ASN1Free_PKERB_LAST_REQUEST_Seq(PKERB_LAST_REQUEST_Seq *val)
  750. {
  751. if (val) {
  752. }
  753. }
  754. static int ASN1CALL ASN1Enc_PKERB_AUTHORIZATION_DATA_Seq(ASN1encoding_t enc, ASN1uint32_t tag, PKERB_AUTHORIZATION_DATA_Seq *val)
  755. {
  756. ASN1uint32_t nLenOff;
  757. ASN1uint32_t nLenOff0;
  758. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  759. return 0;
  760. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  761. return 0;
  762. if (!ASN1BEREncS32(enc, 0x2, (val)->auth_data_type))
  763. return 0;
  764. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  765. return 0;
  766. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  767. return 0;
  768. if (!ASN1DEREncOctetString(enc, 0x4, ((val)->auth_data).length, ((val)->auth_data).value))
  769. return 0;
  770. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  771. return 0;
  772. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  773. return 0;
  774. return 1;
  775. }
  776. static int ASN1CALL ASN1Dec_PKERB_AUTHORIZATION_DATA_Seq(ASN1decoding_t dec, ASN1uint32_t tag, PKERB_AUTHORIZATION_DATA_Seq *val)
  777. {
  778. ASN1decoding_t dd;
  779. ASN1octet_t *di;
  780. ASN1decoding_t dd0;
  781. ASN1octet_t *di0;
  782. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  783. return 0;
  784. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  785. return 0;
  786. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->auth_data_type))
  787. return 0;
  788. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  789. return 0;
  790. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  791. return 0;
  792. if (!ASN1BERDecOctetString(dd0, 0x4, &(val)->auth_data))
  793. return 0;
  794. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  795. return 0;
  796. if (!ASN1BERDecEndOfContents(dec, dd, di))
  797. return 0;
  798. return 1;
  799. }
  800. static void ASN1CALL ASN1Free_PKERB_AUTHORIZATION_DATA_Seq(PKERB_AUTHORIZATION_DATA_Seq *val)
  801. {
  802. if (val) {
  803. ASN1octetstring_free(&(val)->auth_data);
  804. }
  805. }
  806. static int ASN1CALL ASN1Enc_PKERB_HOST_ADDRESSES_Seq(ASN1encoding_t enc, ASN1uint32_t tag, PKERB_HOST_ADDRESSES_Seq *val)
  807. {
  808. ASN1uint32_t nLenOff;
  809. ASN1uint32_t nLenOff0;
  810. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  811. return 0;
  812. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  813. return 0;
  814. if (!ASN1BEREncS32(enc, 0x2, (val)->address_type))
  815. return 0;
  816. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  817. return 0;
  818. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  819. return 0;
  820. if (!ASN1DEREncOctetString(enc, 0x4, ((val)->address).length, ((val)->address).value))
  821. return 0;
  822. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  823. return 0;
  824. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  825. return 0;
  826. return 1;
  827. }
  828. static int ASN1CALL ASN1Dec_PKERB_HOST_ADDRESSES_Seq(ASN1decoding_t dec, ASN1uint32_t tag, PKERB_HOST_ADDRESSES_Seq *val)
  829. {
  830. ASN1decoding_t dd;
  831. ASN1octet_t *di;
  832. ASN1decoding_t dd0;
  833. ASN1octet_t *di0;
  834. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  835. return 0;
  836. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  837. return 0;
  838. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->address_type))
  839. return 0;
  840. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  841. return 0;
  842. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  843. return 0;
  844. if (!ASN1BERDecOctetString(dd0, 0x4, &(val)->address))
  845. return 0;
  846. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  847. return 0;
  848. if (!ASN1BERDecEndOfContents(dec, dd, di))
  849. return 0;
  850. return 1;
  851. }
  852. static void ASN1CALL ASN1Free_PKERB_HOST_ADDRESSES_Seq(PKERB_HOST_ADDRESSES_Seq *val)
  853. {
  854. if (val) {
  855. ASN1octetstring_free(&(val)->address);
  856. }
  857. }
  858. static int ASN1CALL ASN1Enc_KERB_HOST_ADDRESS(ASN1encoding_t enc, ASN1uint32_t tag, KERB_HOST_ADDRESS *val)
  859. {
  860. ASN1uint32_t nLenOff;
  861. ASN1uint32_t nLenOff0;
  862. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  863. return 0;
  864. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  865. return 0;
  866. if (!ASN1BEREncS32(enc, 0x2, (val)->addr_type))
  867. return 0;
  868. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  869. return 0;
  870. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  871. return 0;
  872. if (!ASN1DEREncOctetString(enc, 0x4, ((val)->address).length, ((val)->address).value))
  873. return 0;
  874. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  875. return 0;
  876. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  877. return 0;
  878. return 1;
  879. }
  880. static int ASN1CALL ASN1Dec_KERB_HOST_ADDRESS(ASN1decoding_t dec, ASN1uint32_t tag, KERB_HOST_ADDRESS *val)
  881. {
  882. ASN1decoding_t dd;
  883. ASN1octet_t *di;
  884. ASN1decoding_t dd0;
  885. ASN1octet_t *di0;
  886. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  887. return 0;
  888. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  889. return 0;
  890. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->addr_type))
  891. return 0;
  892. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  893. return 0;
  894. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  895. return 0;
  896. if (!ASN1BERDecOctetString(dd0, 0x4, &(val)->address))
  897. return 0;
  898. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  899. return 0;
  900. if (!ASN1BERDecEndOfContents(dec, dd, di))
  901. return 0;
  902. return 1;
  903. }
  904. static void ASN1CALL ASN1Free_KERB_HOST_ADDRESS(KERB_HOST_ADDRESS *val)
  905. {
  906. if (val) {
  907. ASN1octetstring_free(&(val)->address);
  908. }
  909. }
  910. static int ASN1CALL ASN1Enc_PKERB_HOST_ADDRESSES(ASN1encoding_t enc, ASN1uint32_t tag, PPKERB_HOST_ADDRESSES *val)
  911. {
  912. PPKERB_HOST_ADDRESSES f;
  913. ASN1uint32_t nLenOff;
  914. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  915. return 0;
  916. for (f = *val; f; f = f->next) {
  917. if (!ASN1Enc_PKERB_HOST_ADDRESSES_Seq(enc, 0, &f->value))
  918. return 0;
  919. }
  920. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  921. return 0;
  922. return 1;
  923. }
  924. static int ASN1CALL ASN1Dec_PKERB_HOST_ADDRESSES(ASN1decoding_t dec, ASN1uint32_t tag, PPKERB_HOST_ADDRESSES *val)
  925. {
  926. PPKERB_HOST_ADDRESSES *f;
  927. ASN1decoding_t dd;
  928. ASN1octet_t *di;
  929. ASN1uint32_t t;
  930. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  931. return 0;
  932. f = val;
  933. while (ASN1BERDecNotEndOfContents(dd, di)) {
  934. if (!ASN1BERDecPeekTag(dd, &t))
  935. return 0;
  936. if (!(*f = (PPKERB_HOST_ADDRESSES)ASN1DecAlloc(dd, sizeof(**f))))
  937. return 0;
  938. if (!ASN1Dec_PKERB_HOST_ADDRESSES_Seq(dd, 0, &(*f)->value))
  939. return 0;
  940. f = &(*f)->next;
  941. }
  942. *f = NULL;
  943. if (!ASN1BERDecEndOfContents(dec, dd, di))
  944. return 0;
  945. return 1;
  946. }
  947. static void ASN1CALL ASN1Free_PKERB_HOST_ADDRESSES(PPKERB_HOST_ADDRESSES *val)
  948. {
  949. PPKERB_HOST_ADDRESSES f, ff;
  950. if (val) {
  951. for (f = *val; f; f = ff) {
  952. ASN1Free_PKERB_HOST_ADDRESSES_Seq(&f->value);
  953. ff = f->next;
  954. ASN1Free(f);
  955. }
  956. }
  957. }
  958. static int ASN1CALL ASN1Enc_PKERB_AUTHORIZATION_DATA(ASN1encoding_t enc, ASN1uint32_t tag, PPKERB_AUTHORIZATION_DATA *val)
  959. {
  960. PPKERB_AUTHORIZATION_DATA f;
  961. ASN1uint32_t nLenOff;
  962. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  963. return 0;
  964. for (f = *val; f; f = f->next) {
  965. if (!ASN1Enc_PKERB_AUTHORIZATION_DATA_Seq(enc, 0, &f->value))
  966. return 0;
  967. }
  968. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  969. return 0;
  970. return 1;
  971. }
  972. static int ASN1CALL ASN1Dec_PKERB_AUTHORIZATION_DATA(ASN1decoding_t dec, ASN1uint32_t tag, PPKERB_AUTHORIZATION_DATA *val)
  973. {
  974. PPKERB_AUTHORIZATION_DATA *f;
  975. ASN1decoding_t dd;
  976. ASN1octet_t *di;
  977. ASN1uint32_t t;
  978. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  979. return 0;
  980. f = val;
  981. while (ASN1BERDecNotEndOfContents(dd, di)) {
  982. if (!ASN1BERDecPeekTag(dd, &t))
  983. return 0;
  984. if (!(*f = (PPKERB_AUTHORIZATION_DATA)ASN1DecAlloc(dd, sizeof(**f))))
  985. return 0;
  986. if (!ASN1Dec_PKERB_AUTHORIZATION_DATA_Seq(dd, 0, &(*f)->value))
  987. return 0;
  988. f = &(*f)->next;
  989. }
  990. *f = NULL;
  991. if (!ASN1BERDecEndOfContents(dec, dd, di))
  992. return 0;
  993. return 1;
  994. }
  995. static void ASN1CALL ASN1Free_PKERB_AUTHORIZATION_DATA(PPKERB_AUTHORIZATION_DATA *val)
  996. {
  997. PPKERB_AUTHORIZATION_DATA f, ff;
  998. if (val) {
  999. for (f = *val; f; f = ff) {
  1000. ASN1Free_PKERB_AUTHORIZATION_DATA_Seq(&f->value);
  1001. ff = f->next;
  1002. ASN1Free(f);
  1003. }
  1004. }
  1005. }
  1006. static int ASN1CALL ASN1Enc_PKERB_LAST_REQUEST(ASN1encoding_t enc, ASN1uint32_t tag, PPKERB_LAST_REQUEST *val)
  1007. {
  1008. PPKERB_LAST_REQUEST f;
  1009. ASN1uint32_t nLenOff;
  1010. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  1011. return 0;
  1012. for (f = *val; f; f = f->next) {
  1013. if (!ASN1Enc_PKERB_LAST_REQUEST_Seq(enc, 0, &f->value))
  1014. return 0;
  1015. }
  1016. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  1017. return 0;
  1018. return 1;
  1019. }
  1020. static int ASN1CALL ASN1Dec_PKERB_LAST_REQUEST(ASN1decoding_t dec, ASN1uint32_t tag, PPKERB_LAST_REQUEST *val)
  1021. {
  1022. PPKERB_LAST_REQUEST *f;
  1023. ASN1decoding_t dd;
  1024. ASN1octet_t *di;
  1025. ASN1uint32_t t;
  1026. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  1027. return 0;
  1028. f = val;
  1029. while (ASN1BERDecNotEndOfContents(dd, di)) {
  1030. if (!ASN1BERDecPeekTag(dd, &t))
  1031. return 0;
  1032. if (!(*f = (PPKERB_LAST_REQUEST)ASN1DecAlloc(dd, sizeof(**f))))
  1033. return 0;
  1034. if (!ASN1Dec_PKERB_LAST_REQUEST_Seq(dd, 0, &(*f)->value))
  1035. return 0;
  1036. f = &(*f)->next;
  1037. }
  1038. *f = NULL;
  1039. if (!ASN1BERDecEndOfContents(dec, dd, di))
  1040. return 0;
  1041. return 1;
  1042. }
  1043. static void ASN1CALL ASN1Free_PKERB_LAST_REQUEST(PPKERB_LAST_REQUEST *val)
  1044. {
  1045. PPKERB_LAST_REQUEST f, ff;
  1046. if (val) {
  1047. for (f = *val; f; f = ff) {
  1048. ASN1Free_PKERB_LAST_REQUEST_Seq(&f->value);
  1049. ff = f->next;
  1050. ASN1Free(f);
  1051. }
  1052. }
  1053. }
  1054. static int ASN1CALL ASN1Enc_KERB_PRINCIPAL_NAME(ASN1encoding_t enc, ASN1uint32_t tag, KERB_PRINCIPAL_NAME *val)
  1055. {
  1056. ASN1uint32_t nLenOff;
  1057. ASN1uint32_t nLenOff0;
  1058. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  1059. return 0;
  1060. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  1061. return 0;
  1062. if (!ASN1BEREncS32(enc, 0x2, (val)->name_type))
  1063. return 0;
  1064. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  1065. return 0;
  1066. if (!ASN1Enc_KERB_PRINCIPAL_NAME_name_string(enc, 0, &(val)->name_string))
  1067. return 0;
  1068. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  1069. return 0;
  1070. return 1;
  1071. }
  1072. static int ASN1CALL ASN1Dec_KERB_PRINCIPAL_NAME(ASN1decoding_t dec, ASN1uint32_t tag, KERB_PRINCIPAL_NAME *val)
  1073. {
  1074. ASN1decoding_t dd;
  1075. ASN1octet_t *di;
  1076. ASN1decoding_t dd0;
  1077. ASN1octet_t *di0;
  1078. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  1079. return 0;
  1080. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  1081. return 0;
  1082. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->name_type))
  1083. return 0;
  1084. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  1085. return 0;
  1086. if (!ASN1Dec_KERB_PRINCIPAL_NAME_name_string(dd, 0, &(val)->name_string))
  1087. return 0;
  1088. if (!ASN1BERDecEndOfContents(dec, dd, di))
  1089. return 0;
  1090. return 1;
  1091. }
  1092. static void ASN1CALL ASN1Free_KERB_PRINCIPAL_NAME(KERB_PRINCIPAL_NAME *val)
  1093. {
  1094. if (val) {
  1095. ASN1Free_KERB_PRINCIPAL_NAME_name_string(&(val)->name_string);
  1096. }
  1097. }
  1098. static int ASN1CALL ASN1Enc_PKERB_TICKET_EXTENSIONS(ASN1encoding_t enc, ASN1uint32_t tag, PPKERB_TICKET_EXTENSIONS *val)
  1099. {
  1100. PPKERB_TICKET_EXTENSIONS f;
  1101. ASN1uint32_t nLenOff;
  1102. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  1103. return 0;
  1104. for (f = *val; f; f = f->next) {
  1105. if (!ASN1Enc_PKERB_TICKET_EXTENSIONS_Seq(enc, 0, &f->value))
  1106. return 0;
  1107. }
  1108. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  1109. return 0;
  1110. return 1;
  1111. }
  1112. static int ASN1CALL ASN1Dec_PKERB_TICKET_EXTENSIONS(ASN1decoding_t dec, ASN1uint32_t tag, PPKERB_TICKET_EXTENSIONS *val)
  1113. {
  1114. PPKERB_TICKET_EXTENSIONS *f;
  1115. ASN1decoding_t dd;
  1116. ASN1octet_t *di;
  1117. ASN1uint32_t t;
  1118. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  1119. return 0;
  1120. f = val;
  1121. while (ASN1BERDecNotEndOfContents(dd, di)) {
  1122. if (!ASN1BERDecPeekTag(dd, &t))
  1123. return 0;
  1124. if (!(*f = (PPKERB_TICKET_EXTENSIONS)ASN1DecAlloc(dd, sizeof(**f))))
  1125. return 0;
  1126. if (!ASN1Dec_PKERB_TICKET_EXTENSIONS_Seq(dd, 0, &(*f)->value))
  1127. return 0;
  1128. f = &(*f)->next;
  1129. }
  1130. *f = NULL;
  1131. if (!ASN1BERDecEndOfContents(dec, dd, di))
  1132. return 0;
  1133. return 1;
  1134. }
  1135. static void ASN1CALL ASN1Free_PKERB_TICKET_EXTENSIONS(PPKERB_TICKET_EXTENSIONS *val)
  1136. {
  1137. PPKERB_TICKET_EXTENSIONS f, ff;
  1138. if (val) {
  1139. for (f = *val; f; f = ff) {
  1140. ASN1Free_PKERB_TICKET_EXTENSIONS_Seq(&f->value);
  1141. ff = f->next;
  1142. ASN1Free(f);
  1143. }
  1144. }
  1145. }
  1146. static int ASN1CALL ASN1Enc_KERB_TRANSITED_ENCODING(ASN1encoding_t enc, ASN1uint32_t tag, KERB_TRANSITED_ENCODING *val)
  1147. {
  1148. ASN1uint32_t nLenOff;
  1149. ASN1uint32_t nLenOff0;
  1150. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  1151. return 0;
  1152. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  1153. return 0;
  1154. if (!ASN1BEREncS32(enc, 0x2, (val)->transited_type))
  1155. return 0;
  1156. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  1157. return 0;
  1158. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  1159. return 0;
  1160. if (!ASN1DEREncOctetString(enc, 0x4, ((val)->contents).length, ((val)->contents).value))
  1161. return 0;
  1162. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  1163. return 0;
  1164. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  1165. return 0;
  1166. return 1;
  1167. }
  1168. static int ASN1CALL ASN1Dec_KERB_TRANSITED_ENCODING(ASN1decoding_t dec, ASN1uint32_t tag, KERB_TRANSITED_ENCODING *val)
  1169. {
  1170. ASN1decoding_t dd;
  1171. ASN1octet_t *di;
  1172. ASN1decoding_t dd0;
  1173. ASN1octet_t *di0;
  1174. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  1175. return 0;
  1176. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  1177. return 0;
  1178. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->transited_type))
  1179. return 0;
  1180. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  1181. return 0;
  1182. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  1183. return 0;
  1184. if (!ASN1BERDecOctetString(dd0, 0x4, &(val)->contents))
  1185. return 0;
  1186. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  1187. return 0;
  1188. if (!ASN1BERDecEndOfContents(dec, dd, di))
  1189. return 0;
  1190. return 1;
  1191. }
  1192. static void ASN1CALL ASN1Free_KERB_TRANSITED_ENCODING(KERB_TRANSITED_ENCODING *val)
  1193. {
  1194. if (val) {
  1195. ASN1octetstring_free(&(val)->contents);
  1196. }
  1197. }
  1198. static int ASN1CALL ASN1Enc_KERB_PA_DATA(ASN1encoding_t enc, ASN1uint32_t tag, KERB_PA_DATA *val)
  1199. {
  1200. ASN1uint32_t nLenOff;
  1201. ASN1uint32_t nLenOff0;
  1202. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  1203. return 0;
  1204. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  1205. return 0;
  1206. if (!ASN1BEREncS32(enc, 0x2, (val)->preauth_data_type))
  1207. return 0;
  1208. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  1209. return 0;
  1210. if (!ASN1BEREncExplicitTag(enc, 0x80000002, &nLenOff0))
  1211. return 0;
  1212. if (!ASN1DEREncOctetString(enc, 0x4, ((val)->preauth_data).length, ((val)->preauth_data).value))
  1213. return 0;
  1214. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  1215. return 0;
  1216. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  1217. return 0;
  1218. return 1;
  1219. }
  1220. static int ASN1CALL ASN1Dec_KERB_PA_DATA(ASN1decoding_t dec, ASN1uint32_t tag, KERB_PA_DATA *val)
  1221. {
  1222. ASN1decoding_t dd;
  1223. ASN1octet_t *di;
  1224. ASN1decoding_t dd0;
  1225. ASN1octet_t *di0;
  1226. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  1227. return 0;
  1228. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  1229. return 0;
  1230. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->preauth_data_type))
  1231. return 0;
  1232. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  1233. return 0;
  1234. if (!ASN1BERDecExplicitTag(dd, 0x80000002, &dd0, &di0))
  1235. return 0;
  1236. if (!ASN1BERDecOctetString(dd0, 0x4, &(val)->preauth_data))
  1237. return 0;
  1238. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  1239. return 0;
  1240. if (!ASN1BERDecEndOfContents(dec, dd, di))
  1241. return 0;
  1242. return 1;
  1243. }
  1244. static void ASN1CALL ASN1Free_KERB_PA_DATA(KERB_PA_DATA *val)
  1245. {
  1246. if (val) {
  1247. ASN1octetstring_free(&(val)->preauth_data);
  1248. }
  1249. }
  1250. static int ASN1CALL ASN1Enc_PKERB_PREAUTH_DATA_LIST(ASN1encoding_t enc, ASN1uint32_t tag, PPKERB_PREAUTH_DATA_LIST *val)
  1251. {
  1252. PPKERB_PREAUTH_DATA_LIST f;
  1253. ASN1uint32_t nLenOff;
  1254. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  1255. return 0;
  1256. for (f = *val; f; f = f->next) {
  1257. if (!ASN1Enc_KERB_PA_DATA(enc, 0, &f->value))
  1258. return 0;
  1259. }
  1260. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  1261. return 0;
  1262. return 1;
  1263. }
  1264. static int ASN1CALL ASN1Dec_PKERB_PREAUTH_DATA_LIST(ASN1decoding_t dec, ASN1uint32_t tag, PPKERB_PREAUTH_DATA_LIST *val)
  1265. {
  1266. PPKERB_PREAUTH_DATA_LIST *f;
  1267. ASN1decoding_t dd;
  1268. ASN1octet_t *di;
  1269. ASN1uint32_t t;
  1270. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  1271. return 0;
  1272. f = val;
  1273. while (ASN1BERDecNotEndOfContents(dd, di)) {
  1274. if (!ASN1BERDecPeekTag(dd, &t))
  1275. return 0;
  1276. if (!(*f = (PPKERB_PREAUTH_DATA_LIST)ASN1DecAlloc(dd, sizeof(**f))))
  1277. return 0;
  1278. if (!ASN1Dec_KERB_PA_DATA(dd, 0, &(*f)->value))
  1279. return 0;
  1280. f = &(*f)->next;
  1281. }
  1282. *f = NULL;
  1283. if (!ASN1BERDecEndOfContents(dec, dd, di))
  1284. return 0;
  1285. return 1;
  1286. }
  1287. static void ASN1CALL ASN1Free_PKERB_PREAUTH_DATA_LIST(PPKERB_PREAUTH_DATA_LIST *val)
  1288. {
  1289. PPKERB_PREAUTH_DATA_LIST f, ff;
  1290. if (val) {
  1291. for (f = *val; f; f = ff) {
  1292. ASN1Free_KERB_PA_DATA(&f->value);
  1293. ff = f->next;
  1294. ASN1Free(f);
  1295. }
  1296. }
  1297. }
  1298. static int ASN1CALL ASN1Enc_KERB_SAFE_BODY(ASN1encoding_t enc, ASN1uint32_t tag, KERB_SAFE_BODY *val)
  1299. {
  1300. ASN1uint32_t nLenOff;
  1301. ASN1uint32_t nLenOff0;
  1302. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  1303. return 0;
  1304. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  1305. return 0;
  1306. if (!ASN1DEREncOctetString(enc, 0x4, ((val)->user_data).length, ((val)->user_data).value))
  1307. return 0;
  1308. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  1309. return 0;
  1310. if ((val)->o[0] & 0x80) {
  1311. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  1312. return 0;
  1313. if (!ASN1DEREncGeneralizedTime(enc, 0x18, &(val)->timestamp))
  1314. return 0;
  1315. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  1316. return 0;
  1317. }
  1318. if ((val)->o[0] & 0x40) {
  1319. if (!ASN1BEREncExplicitTag(enc, 0x80000002, &nLenOff0))
  1320. return 0;
  1321. if (!ASN1BEREncS32(enc, 0x2, (val)->usec))
  1322. return 0;
  1323. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  1324. return 0;
  1325. }
  1326. if ((val)->o[0] & 0x20) {
  1327. if (!ASN1BEREncExplicitTag(enc, 0x80000003, &nLenOff0))
  1328. return 0;
  1329. if (!ASN1BEREncU32(enc, 0x2, (val)->sequence_number))
  1330. return 0;
  1331. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  1332. return 0;
  1333. }
  1334. if (!ASN1BEREncExplicitTag(enc, 0x80000004, &nLenOff0))
  1335. return 0;
  1336. if (!ASN1Enc_KERB_HOST_ADDRESS(enc, 0, &(val)->sender_address))
  1337. return 0;
  1338. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  1339. return 0;
  1340. if ((val)->o[0] & 0x10) {
  1341. if (!ASN1BEREncExplicitTag(enc, 0x80000005, &nLenOff0))
  1342. return 0;
  1343. if (!ASN1Enc_KERB_HOST_ADDRESS(enc, 0, &(val)->recipient_address))
  1344. return 0;
  1345. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  1346. return 0;
  1347. }
  1348. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  1349. return 0;
  1350. return 1;
  1351. }
  1352. static int ASN1CALL ASN1Dec_KERB_SAFE_BODY(ASN1decoding_t dec, ASN1uint32_t tag, KERB_SAFE_BODY *val)
  1353. {
  1354. ASN1decoding_t dd;
  1355. ASN1octet_t *di;
  1356. ASN1decoding_t dd0;
  1357. ASN1octet_t *di0;
  1358. ASN1uint32_t t;
  1359. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  1360. return 0;
  1361. ZeroMemory((val)->o, 1);
  1362. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  1363. return 0;
  1364. if (!ASN1BERDecOctetString(dd0, 0x4, &(val)->user_data))
  1365. return 0;
  1366. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  1367. return 0;
  1368. ASN1BERDecPeekTag(dd, &t);
  1369. if (t == 0x80000001) {
  1370. (val)->o[0] |= 0x80;
  1371. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  1372. return 0;
  1373. if (!ASN1BERDecGeneralizedTime(dd0, 0x18, &(val)->timestamp))
  1374. return 0;
  1375. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  1376. return 0;
  1377. }
  1378. ASN1BERDecPeekTag(dd, &t);
  1379. if (t == 0x80000002) {
  1380. (val)->o[0] |= 0x40;
  1381. if (!ASN1BERDecExplicitTag(dd, 0x80000002, &dd0, &di0))
  1382. return 0;
  1383. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->usec))
  1384. return 0;
  1385. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  1386. return 0;
  1387. }
  1388. ASN1BERDecPeekTag(dd, &t);
  1389. if (t == 0x80000003) {
  1390. (val)->o[0] |= 0x20;
  1391. if (!ASN1BERDecExplicitTag(dd, 0x80000003, &dd0, &di0))
  1392. return 0;
  1393. if (!ASN1BERDecU32Val(dd0, 0x2, (ASN1uint32_t *) &(val)->sequence_number))
  1394. return 0;
  1395. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  1396. return 0;
  1397. }
  1398. if (!ASN1BERDecExplicitTag(dd, 0x80000004, &dd0, &di0))
  1399. return 0;
  1400. if (!ASN1Dec_KERB_HOST_ADDRESS(dd0, 0, &(val)->sender_address))
  1401. return 0;
  1402. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  1403. return 0;
  1404. ASN1BERDecPeekTag(dd, &t);
  1405. if (t == 0x80000005) {
  1406. (val)->o[0] |= 0x10;
  1407. if (!ASN1BERDecExplicitTag(dd, 0x80000005, &dd0, &di0))
  1408. return 0;
  1409. if (!ASN1Dec_KERB_HOST_ADDRESS(dd0, 0, &(val)->recipient_address))
  1410. return 0;
  1411. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  1412. return 0;
  1413. }
  1414. if (!ASN1BERDecEndOfContents(dec, dd, di))
  1415. return 0;
  1416. return 1;
  1417. }
  1418. static void ASN1CALL ASN1Free_KERB_SAFE_BODY(KERB_SAFE_BODY *val)
  1419. {
  1420. if (val) {
  1421. ASN1octetstring_free(&(val)->user_data);
  1422. if ((val)->o[0] & 0x80) {
  1423. }
  1424. ASN1Free_KERB_HOST_ADDRESS(&(val)->sender_address);
  1425. if ((val)->o[0] & 0x10) {
  1426. ASN1Free_KERB_HOST_ADDRESS(&(val)->recipient_address);
  1427. }
  1428. }
  1429. }
  1430. static int ASN1CALL ASN1Enc_KERB_ENCRYPTED_PRIV(ASN1encoding_t enc, ASN1uint32_t tag, KERB_ENCRYPTED_PRIV *val)
  1431. {
  1432. ASN1uint32_t nExplTagLenOff0;
  1433. ASN1uint32_t nLenOff;
  1434. ASN1uint32_t nLenOff0;
  1435. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x4000001c, &nExplTagLenOff0))
  1436. return 0;
  1437. if (!ASN1BEREncExplicitTag(enc, 0x10, &nLenOff))
  1438. return 0;
  1439. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  1440. return 0;
  1441. if (!ASN1DEREncOctetString(enc, 0x4, ((val)->user_data).length, ((val)->user_data).value))
  1442. return 0;
  1443. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  1444. return 0;
  1445. if ((val)->o[0] & 0x80) {
  1446. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  1447. return 0;
  1448. if (!ASN1DEREncGeneralizedTime(enc, 0x18, &(val)->timestamp))
  1449. return 0;
  1450. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  1451. return 0;
  1452. }
  1453. if ((val)->o[0] & 0x40) {
  1454. if (!ASN1BEREncExplicitTag(enc, 0x80000002, &nLenOff0))
  1455. return 0;
  1456. if (!ASN1BEREncS32(enc, 0x2, (val)->usec))
  1457. return 0;
  1458. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  1459. return 0;
  1460. }
  1461. if ((val)->o[0] & 0x20) {
  1462. if (!ASN1BEREncExplicitTag(enc, 0x80000003, &nLenOff0))
  1463. return 0;
  1464. if (!ASN1BEREncU32(enc, 0x2, (val)->sequence_number))
  1465. return 0;
  1466. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  1467. return 0;
  1468. }
  1469. if (!ASN1BEREncExplicitTag(enc, 0x80000004, &nLenOff0))
  1470. return 0;
  1471. if (!ASN1Enc_KERB_HOST_ADDRESS(enc, 0, &(val)->sender_address))
  1472. return 0;
  1473. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  1474. return 0;
  1475. if ((val)->o[0] & 0x10) {
  1476. if (!ASN1BEREncExplicitTag(enc, 0x80000005, &nLenOff0))
  1477. return 0;
  1478. if (!ASN1Enc_KERB_HOST_ADDRESS(enc, 0, &(val)->recipient_address))
  1479. return 0;
  1480. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  1481. return 0;
  1482. }
  1483. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  1484. return 0;
  1485. if (!ASN1BEREncEndOfContents(enc, nExplTagLenOff0))
  1486. return 0;
  1487. return 1;
  1488. }
  1489. static int ASN1CALL ASN1Dec_KERB_ENCRYPTED_PRIV(ASN1decoding_t dec, ASN1uint32_t tag, KERB_ENCRYPTED_PRIV *val)
  1490. {
  1491. ASN1decoding_t dd;
  1492. ASN1octet_t *di;
  1493. ASN1decoding_t pExplTagDec0;
  1494. ASN1octet_t *pbExplTagDataEnd0;
  1495. ASN1decoding_t dd0;
  1496. ASN1octet_t *di0;
  1497. ASN1uint32_t t;
  1498. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x4000001c, &pExplTagDec0, &pbExplTagDataEnd0))
  1499. return 0;
  1500. if (!ASN1BERDecExplicitTag(pExplTagDec0, 0x10, &dd, &di))
  1501. return 0;
  1502. ZeroMemory((val)->o, 1);
  1503. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  1504. return 0;
  1505. if (!ASN1BERDecOctetString(dd0, 0x4, &(val)->user_data))
  1506. return 0;
  1507. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  1508. return 0;
  1509. ASN1BERDecPeekTag(dd, &t);
  1510. if (t == 0x80000001) {
  1511. (val)->o[0] |= 0x80;
  1512. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  1513. return 0;
  1514. if (!ASN1BERDecGeneralizedTime(dd0, 0x18, &(val)->timestamp))
  1515. return 0;
  1516. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  1517. return 0;
  1518. }
  1519. ASN1BERDecPeekTag(dd, &t);
  1520. if (t == 0x80000002) {
  1521. (val)->o[0] |= 0x40;
  1522. if (!ASN1BERDecExplicitTag(dd, 0x80000002, &dd0, &di0))
  1523. return 0;
  1524. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->usec))
  1525. return 0;
  1526. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  1527. return 0;
  1528. }
  1529. ASN1BERDecPeekTag(dd, &t);
  1530. if (t == 0x80000003) {
  1531. (val)->o[0] |= 0x20;
  1532. if (!ASN1BERDecExplicitTag(dd, 0x80000003, &dd0, &di0))
  1533. return 0;
  1534. if (!ASN1BERDecU32Val(dd0, 0x2, (ASN1uint32_t *) &(val)->sequence_number))
  1535. return 0;
  1536. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  1537. return 0;
  1538. }
  1539. if (!ASN1BERDecExplicitTag(dd, 0x80000004, &dd0, &di0))
  1540. return 0;
  1541. if (!ASN1Dec_KERB_HOST_ADDRESS(dd0, 0, &(val)->sender_address))
  1542. return 0;
  1543. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  1544. return 0;
  1545. ASN1BERDecPeekTag(dd, &t);
  1546. if (t == 0x80000005) {
  1547. (val)->o[0] |= 0x10;
  1548. if (!ASN1BERDecExplicitTag(dd, 0x80000005, &dd0, &di0))
  1549. return 0;
  1550. if (!ASN1Dec_KERB_HOST_ADDRESS(dd0, 0, &(val)->recipient_address))
  1551. return 0;
  1552. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  1553. return 0;
  1554. }
  1555. if (!ASN1BERDecEndOfContents(pExplTagDec0, dd, di))
  1556. return 0;
  1557. if (!ASN1BERDecEndOfContents(dec, pExplTagDec0, pbExplTagDataEnd0))
  1558. return 0;
  1559. return 1;
  1560. }
  1561. static void ASN1CALL ASN1Free_KERB_ENCRYPTED_PRIV(KERB_ENCRYPTED_PRIV *val)
  1562. {
  1563. if (val) {
  1564. ASN1octetstring_free(&(val)->user_data);
  1565. if ((val)->o[0] & 0x80) {
  1566. }
  1567. ASN1Free_KERB_HOST_ADDRESS(&(val)->sender_address);
  1568. if ((val)->o[0] & 0x10) {
  1569. ASN1Free_KERB_HOST_ADDRESS(&(val)->recipient_address);
  1570. }
  1571. }
  1572. }
  1573. static int ASN1CALL ASN1Enc_KERB_ENCRYPTED_CRED(ASN1encoding_t enc, ASN1uint32_t tag, KERB_ENCRYPTED_CRED *val)
  1574. {
  1575. ASN1uint32_t nExplTagLenOff0;
  1576. ASN1uint32_t nLenOff;
  1577. ASN1uint32_t nLenOff0;
  1578. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x4000001d, &nExplTagLenOff0))
  1579. return 0;
  1580. if (!ASN1BEREncExplicitTag(enc, 0x10, &nLenOff))
  1581. return 0;
  1582. if (!ASN1Enc_KERB_ENCRYPTED_CRED_ticket_info(enc, 0, &(val)->ticket_info))
  1583. return 0;
  1584. if ((val)->o[0] & 0x80) {
  1585. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  1586. return 0;
  1587. if (!ASN1BEREncS32(enc, 0x2, (val)->nonce))
  1588. return 0;
  1589. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  1590. return 0;
  1591. }
  1592. if ((val)->o[0] & 0x40) {
  1593. if (!ASN1BEREncExplicitTag(enc, 0x80000002, &nLenOff0))
  1594. return 0;
  1595. if (!ASN1DEREncGeneralizedTime(enc, 0x18, &(val)->timestamp))
  1596. return 0;
  1597. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  1598. return 0;
  1599. }
  1600. if ((val)->o[0] & 0x20) {
  1601. if (!ASN1BEREncExplicitTag(enc, 0x80000003, &nLenOff0))
  1602. return 0;
  1603. if (!ASN1BEREncS32(enc, 0x2, (val)->usec))
  1604. return 0;
  1605. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  1606. return 0;
  1607. }
  1608. if ((val)->o[0] & 0x10) {
  1609. if (!ASN1BEREncExplicitTag(enc, 0x80000004, &nLenOff0))
  1610. return 0;
  1611. if (!ASN1Enc_KERB_HOST_ADDRESS(enc, 0, &(val)->sender_address))
  1612. return 0;
  1613. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  1614. return 0;
  1615. }
  1616. if ((val)->o[0] & 0x8) {
  1617. if (!ASN1BEREncExplicitTag(enc, 0x80000005, &nLenOff0))
  1618. return 0;
  1619. if (!ASN1Enc_KERB_HOST_ADDRESS(enc, 0, &(val)->recipient_address))
  1620. return 0;
  1621. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  1622. return 0;
  1623. }
  1624. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  1625. return 0;
  1626. if (!ASN1BEREncEndOfContents(enc, nExplTagLenOff0))
  1627. return 0;
  1628. return 1;
  1629. }
  1630. static int ASN1CALL ASN1Dec_KERB_ENCRYPTED_CRED(ASN1decoding_t dec, ASN1uint32_t tag, KERB_ENCRYPTED_CRED *val)
  1631. {
  1632. ASN1decoding_t dd;
  1633. ASN1octet_t *di;
  1634. ASN1decoding_t pExplTagDec0;
  1635. ASN1octet_t *pbExplTagDataEnd0;
  1636. ASN1uint32_t t;
  1637. ASN1decoding_t dd0;
  1638. ASN1octet_t *di0;
  1639. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x4000001d, &pExplTagDec0, &pbExplTagDataEnd0))
  1640. return 0;
  1641. if (!ASN1BERDecExplicitTag(pExplTagDec0, 0x10, &dd, &di))
  1642. return 0;
  1643. ZeroMemory((val)->o, 1);
  1644. if (!ASN1Dec_KERB_ENCRYPTED_CRED_ticket_info(dd, 0, &(val)->ticket_info))
  1645. return 0;
  1646. ASN1BERDecPeekTag(dd, &t);
  1647. if (t == 0x80000001) {
  1648. (val)->o[0] |= 0x80;
  1649. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  1650. return 0;
  1651. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->nonce))
  1652. return 0;
  1653. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  1654. return 0;
  1655. }
  1656. ASN1BERDecPeekTag(dd, &t);
  1657. if (t == 0x80000002) {
  1658. (val)->o[0] |= 0x40;
  1659. if (!ASN1BERDecExplicitTag(dd, 0x80000002, &dd0, &di0))
  1660. return 0;
  1661. if (!ASN1BERDecGeneralizedTime(dd0, 0x18, &(val)->timestamp))
  1662. return 0;
  1663. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  1664. return 0;
  1665. }
  1666. ASN1BERDecPeekTag(dd, &t);
  1667. if (t == 0x80000003) {
  1668. (val)->o[0] |= 0x20;
  1669. if (!ASN1BERDecExplicitTag(dd, 0x80000003, &dd0, &di0))
  1670. return 0;
  1671. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->usec))
  1672. return 0;
  1673. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  1674. return 0;
  1675. }
  1676. ASN1BERDecPeekTag(dd, &t);
  1677. if (t == 0x80000004) {
  1678. (val)->o[0] |= 0x10;
  1679. if (!ASN1BERDecExplicitTag(dd, 0x80000004, &dd0, &di0))
  1680. return 0;
  1681. if (!ASN1Dec_KERB_HOST_ADDRESS(dd0, 0, &(val)->sender_address))
  1682. return 0;
  1683. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  1684. return 0;
  1685. }
  1686. ASN1BERDecPeekTag(dd, &t);
  1687. if (t == 0x80000005) {
  1688. (val)->o[0] |= 0x8;
  1689. if (!ASN1BERDecExplicitTag(dd, 0x80000005, &dd0, &di0))
  1690. return 0;
  1691. if (!ASN1Dec_KERB_HOST_ADDRESS(dd0, 0, &(val)->recipient_address))
  1692. return 0;
  1693. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  1694. return 0;
  1695. }
  1696. if (!ASN1BERDecEndOfContents(pExplTagDec0, dd, di))
  1697. return 0;
  1698. if (!ASN1BERDecEndOfContents(dec, pExplTagDec0, pbExplTagDataEnd0))
  1699. return 0;
  1700. return 1;
  1701. }
  1702. static void ASN1CALL ASN1Free_KERB_ENCRYPTED_CRED(KERB_ENCRYPTED_CRED *val)
  1703. {
  1704. if (val) {
  1705. ASN1Free_KERB_ENCRYPTED_CRED_ticket_info(&(val)->ticket_info);
  1706. if ((val)->o[0] & 0x40) {
  1707. }
  1708. if ((val)->o[0] & 0x10) {
  1709. ASN1Free_KERB_HOST_ADDRESS(&(val)->sender_address);
  1710. }
  1711. if ((val)->o[0] & 0x8) {
  1712. ASN1Free_KERB_HOST_ADDRESS(&(val)->recipient_address);
  1713. }
  1714. }
  1715. }
  1716. static int ASN1CALL ASN1Enc_KERB_ERROR(ASN1encoding_t enc, ASN1uint32_t tag, KERB_ERROR *val)
  1717. {
  1718. ASN1uint32_t nExplTagLenOff0;
  1719. ASN1uint32_t nLenOff;
  1720. ASN1uint32_t nLenOff0;
  1721. ASN1uint32_t t;
  1722. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x4000001e, &nExplTagLenOff0))
  1723. return 0;
  1724. if (!ASN1BEREncExplicitTag(enc, 0x10, &nLenOff))
  1725. return 0;
  1726. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  1727. return 0;
  1728. if (!ASN1BEREncS32(enc, 0x2, (val)->version))
  1729. return 0;
  1730. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  1731. return 0;
  1732. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  1733. return 0;
  1734. if (!ASN1BEREncS32(enc, 0x2, (val)->message_type))
  1735. return 0;
  1736. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  1737. return 0;
  1738. if ((val)->o[0] & 0x80) {
  1739. if (!ASN1BEREncExplicitTag(enc, 0x80000002, &nLenOff0))
  1740. return 0;
  1741. if (!ASN1DEREncGeneralizedTime(enc, 0x18, &(val)->client_time))
  1742. return 0;
  1743. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  1744. return 0;
  1745. }
  1746. if ((val)->o[0] & 0x40) {
  1747. if (!ASN1BEREncExplicitTag(enc, 0x80000003, &nLenOff0))
  1748. return 0;
  1749. if (!ASN1BEREncS32(enc, 0x2, (val)->client_usec))
  1750. return 0;
  1751. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  1752. return 0;
  1753. }
  1754. if (!ASN1BEREncExplicitTag(enc, 0x80000004, &nLenOff0))
  1755. return 0;
  1756. if (!ASN1DEREncGeneralizedTime(enc, 0x18, &(val)->server_time))
  1757. return 0;
  1758. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  1759. return 0;
  1760. if (!ASN1BEREncExplicitTag(enc, 0x80000005, &nLenOff0))
  1761. return 0;
  1762. if (!ASN1BEREncS32(enc, 0x2, (val)->server_usec))
  1763. return 0;
  1764. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  1765. return 0;
  1766. if (!ASN1BEREncExplicitTag(enc, 0x80000006, &nLenOff0))
  1767. return 0;
  1768. if (!ASN1BEREncS32(enc, 0x2, (val)->error_code))
  1769. return 0;
  1770. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  1771. return 0;
  1772. if ((val)->o[0] & 0x20) {
  1773. t = lstrlenA((val)->client_realm);
  1774. if (!ASN1BEREncExplicitTag(enc, 0x80000007, &nLenOff0))
  1775. return 0;
  1776. if (!ASN1DEREncCharString(enc, 0x1b, t, (val)->client_realm))
  1777. return 0;
  1778. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  1779. return 0;
  1780. }
  1781. if ((val)->o[0] & 0x10) {
  1782. if (!ASN1BEREncExplicitTag(enc, 0x80000008, &nLenOff0))
  1783. return 0;
  1784. if (!ASN1Enc_KERB_PRINCIPAL_NAME(enc, 0, &(val)->client_name))
  1785. return 0;
  1786. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  1787. return 0;
  1788. }
  1789. t = lstrlenA((val)->realm);
  1790. if (!ASN1BEREncExplicitTag(enc, 0x80000009, &nLenOff0))
  1791. return 0;
  1792. if (!ASN1DEREncCharString(enc, 0x1b, t, (val)->realm))
  1793. return 0;
  1794. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  1795. return 0;
  1796. if (!ASN1BEREncExplicitTag(enc, 0x8000000a, &nLenOff0))
  1797. return 0;
  1798. if (!ASN1Enc_KERB_PRINCIPAL_NAME(enc, 0, &(val)->server_name))
  1799. return 0;
  1800. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  1801. return 0;
  1802. if ((val)->o[0] & 0x8) {
  1803. if (!ASN1BEREncExplicitTag(enc, 0x8000000b, &nLenOff0))
  1804. return 0;
  1805. if (!ASN1DEREncCharString(enc, 0x1b, ((val)->error_text).length, ((val)->error_text).value))
  1806. return 0;
  1807. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  1808. return 0;
  1809. }
  1810. if ((val)->o[0] & 0x4) {
  1811. if (!ASN1BEREncExplicitTag(enc, 0x8000000c, &nLenOff0))
  1812. return 0;
  1813. if (!ASN1DEREncOctetString(enc, 0x4, ((val)->error_data).length, ((val)->error_data).value))
  1814. return 0;
  1815. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  1816. return 0;
  1817. }
  1818. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  1819. return 0;
  1820. if (!ASN1BEREncEndOfContents(enc, nExplTagLenOff0))
  1821. return 0;
  1822. return 1;
  1823. }
  1824. static int ASN1CALL ASN1Dec_KERB_ERROR(ASN1decoding_t dec, ASN1uint32_t tag, KERB_ERROR *val)
  1825. {
  1826. ASN1decoding_t dd;
  1827. ASN1octet_t *di;
  1828. ASN1decoding_t pExplTagDec0;
  1829. ASN1octet_t *pbExplTagDataEnd0;
  1830. ASN1decoding_t dd0;
  1831. ASN1octet_t *di0;
  1832. ASN1uint32_t t;
  1833. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x4000001e, &pExplTagDec0, &pbExplTagDataEnd0))
  1834. return 0;
  1835. if (!ASN1BERDecExplicitTag(pExplTagDec0, 0x10, &dd, &di))
  1836. return 0;
  1837. ZeroMemory((val)->o, 1);
  1838. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  1839. return 0;
  1840. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->version))
  1841. return 0;
  1842. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  1843. return 0;
  1844. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  1845. return 0;
  1846. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->message_type))
  1847. return 0;
  1848. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  1849. return 0;
  1850. ASN1BERDecPeekTag(dd, &t);
  1851. if (t == 0x80000002) {
  1852. (val)->o[0] |= 0x80;
  1853. if (!ASN1BERDecExplicitTag(dd, 0x80000002, &dd0, &di0))
  1854. return 0;
  1855. if (!ASN1BERDecGeneralizedTime(dd0, 0x18, &(val)->client_time))
  1856. return 0;
  1857. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  1858. return 0;
  1859. }
  1860. ASN1BERDecPeekTag(dd, &t);
  1861. if (t == 0x80000003) {
  1862. (val)->o[0] |= 0x40;
  1863. if (!ASN1BERDecExplicitTag(dd, 0x80000003, &dd0, &di0))
  1864. return 0;
  1865. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->client_usec))
  1866. return 0;
  1867. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  1868. return 0;
  1869. }
  1870. if (!ASN1BERDecExplicitTag(dd, 0x80000004, &dd0, &di0))
  1871. return 0;
  1872. if (!ASN1BERDecGeneralizedTime(dd0, 0x18, &(val)->server_time))
  1873. return 0;
  1874. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  1875. return 0;
  1876. if (!ASN1BERDecExplicitTag(dd, 0x80000005, &dd0, &di0))
  1877. return 0;
  1878. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->server_usec))
  1879. return 0;
  1880. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  1881. return 0;
  1882. if (!ASN1BERDecExplicitTag(dd, 0x80000006, &dd0, &di0))
  1883. return 0;
  1884. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->error_code))
  1885. return 0;
  1886. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  1887. return 0;
  1888. ASN1BERDecPeekTag(dd, &t);
  1889. if (t == 0x80000007) {
  1890. (val)->o[0] |= 0x20;
  1891. if (!ASN1BERDecExplicitTag(dd, 0x80000007, &dd0, &di0))
  1892. return 0;
  1893. if (!ASN1BERDecZeroCharString(dd0, 0x1b, &(val)->client_realm))
  1894. return 0;
  1895. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  1896. return 0;
  1897. }
  1898. ASN1BERDecPeekTag(dd, &t);
  1899. if (t == 0x80000008) {
  1900. (val)->o[0] |= 0x10;
  1901. if (!ASN1BERDecExplicitTag(dd, 0x80000008, &dd0, &di0))
  1902. return 0;
  1903. if (!ASN1Dec_KERB_PRINCIPAL_NAME(dd0, 0, &(val)->client_name))
  1904. return 0;
  1905. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  1906. return 0;
  1907. }
  1908. if (!ASN1BERDecExplicitTag(dd, 0x80000009, &dd0, &di0))
  1909. return 0;
  1910. if (!ASN1BERDecZeroCharString(dd0, 0x1b, &(val)->realm))
  1911. return 0;
  1912. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  1913. return 0;
  1914. if (!ASN1BERDecExplicitTag(dd, 0x8000000a, &dd0, &di0))
  1915. return 0;
  1916. if (!ASN1Dec_KERB_PRINCIPAL_NAME(dd0, 0, &(val)->server_name))
  1917. return 0;
  1918. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  1919. return 0;
  1920. ASN1BERDecPeekTag(dd, &t);
  1921. if (t == 0x8000000b) {
  1922. (val)->o[0] |= 0x8;
  1923. if (!ASN1BERDecExplicitTag(dd, 0x8000000b, &dd0, &di0))
  1924. return 0;
  1925. if (!ASN1BERDecCharString(dd0, 0x1b, &(val)->error_text))
  1926. return 0;
  1927. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  1928. return 0;
  1929. }
  1930. ASN1BERDecPeekTag(dd, &t);
  1931. if (t == 0x8000000c) {
  1932. (val)->o[0] |= 0x4;
  1933. if (!ASN1BERDecExplicitTag(dd, 0x8000000c, &dd0, &di0))
  1934. return 0;
  1935. if (!ASN1BERDecOctetString(dd0, 0x4, &(val)->error_data))
  1936. return 0;
  1937. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  1938. return 0;
  1939. }
  1940. if (!ASN1BERDecEndOfContents(pExplTagDec0, dd, di))
  1941. return 0;
  1942. if (!ASN1BERDecEndOfContents(dec, pExplTagDec0, pbExplTagDataEnd0))
  1943. return 0;
  1944. return 1;
  1945. }
  1946. static void ASN1CALL ASN1Free_KERB_ERROR(KERB_ERROR *val)
  1947. {
  1948. if (val) {
  1949. if ((val)->o[0] & 0x80) {
  1950. }
  1951. if ((val)->o[0] & 0x20) {
  1952. ASN1ztcharstring_free((val)->client_realm);
  1953. }
  1954. if ((val)->o[0] & 0x10) {
  1955. ASN1Free_KERB_PRINCIPAL_NAME(&(val)->client_name);
  1956. }
  1957. ASN1ztcharstring_free((val)->realm);
  1958. ASN1Free_KERB_PRINCIPAL_NAME(&(val)->server_name);
  1959. if ((val)->o[0] & 0x8) {
  1960. ASN1charstring_free(&(val)->error_text);
  1961. }
  1962. if ((val)->o[0] & 0x4) {
  1963. ASN1octetstring_free(&(val)->error_data);
  1964. }
  1965. }
  1966. }
  1967. static int ASN1CALL ASN1Enc_KERB_ENCRYPTED_DATA(ASN1encoding_t enc, ASN1uint32_t tag, KERB_ENCRYPTED_DATA *val)
  1968. {
  1969. ASN1uint32_t nLenOff;
  1970. ASN1uint32_t nLenOff0;
  1971. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  1972. return 0;
  1973. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  1974. return 0;
  1975. if (!ASN1BEREncS32(enc, 0x2, (val)->encryption_type))
  1976. return 0;
  1977. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  1978. return 0;
  1979. if ((val)->o[0] & 0x80) {
  1980. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  1981. return 0;
  1982. if (!ASN1BEREncS32(enc, 0x2, (val)->version))
  1983. return 0;
  1984. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  1985. return 0;
  1986. }
  1987. if (!ASN1BEREncExplicitTag(enc, 0x80000002, &nLenOff0))
  1988. return 0;
  1989. if (!ASN1DEREncOctetString(enc, 0x4, ((val)->cipher_text).length, ((val)->cipher_text).value))
  1990. return 0;
  1991. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  1992. return 0;
  1993. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  1994. return 0;
  1995. return 1;
  1996. }
  1997. static int ASN1CALL ASN1Dec_KERB_ENCRYPTED_DATA(ASN1decoding_t dec, ASN1uint32_t tag, KERB_ENCRYPTED_DATA *val)
  1998. {
  1999. ASN1decoding_t dd;
  2000. ASN1octet_t *di;
  2001. ASN1decoding_t dd0;
  2002. ASN1octet_t *di0;
  2003. ASN1uint32_t t;
  2004. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  2005. return 0;
  2006. ZeroMemory((val)->o, 1);
  2007. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  2008. return 0;
  2009. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->encryption_type))
  2010. return 0;
  2011. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  2012. return 0;
  2013. ASN1BERDecPeekTag(dd, &t);
  2014. if (t == 0x80000001) {
  2015. (val)->o[0] |= 0x80;
  2016. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  2017. return 0;
  2018. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->version))
  2019. return 0;
  2020. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  2021. return 0;
  2022. }
  2023. if (!ASN1BERDecExplicitTag(dd, 0x80000002, &dd0, &di0))
  2024. return 0;
  2025. if (!ASN1BERDecOctetString(dd0, 0x4, &(val)->cipher_text))
  2026. return 0;
  2027. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  2028. return 0;
  2029. if (!ASN1BERDecEndOfContents(dec, dd, di))
  2030. return 0;
  2031. return 1;
  2032. }
  2033. static void ASN1CALL ASN1Free_KERB_ENCRYPTED_DATA(KERB_ENCRYPTED_DATA *val)
  2034. {
  2035. if (val) {
  2036. ASN1octetstring_free(&(val)->cipher_text);
  2037. }
  2038. }
  2039. static int ASN1CALL ASN1Enc_KERB_ENCRYPTION_KEY(ASN1encoding_t enc, ASN1uint32_t tag, KERB_ENCRYPTION_KEY *val)
  2040. {
  2041. ASN1uint32_t nLenOff;
  2042. ASN1uint32_t nLenOff0;
  2043. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  2044. return 0;
  2045. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  2046. return 0;
  2047. if (!ASN1BEREncS32(enc, 0x2, (val)->keytype))
  2048. return 0;
  2049. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  2050. return 0;
  2051. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  2052. return 0;
  2053. if (!ASN1DEREncOctetString(enc, 0x4, ((val)->keyvalue).length, ((val)->keyvalue).value))
  2054. return 0;
  2055. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  2056. return 0;
  2057. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  2058. return 0;
  2059. return 1;
  2060. }
  2061. static int ASN1CALL ASN1Dec_KERB_ENCRYPTION_KEY(ASN1decoding_t dec, ASN1uint32_t tag, KERB_ENCRYPTION_KEY *val)
  2062. {
  2063. ASN1decoding_t dd;
  2064. ASN1octet_t *di;
  2065. ASN1decoding_t dd0;
  2066. ASN1octet_t *di0;
  2067. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  2068. return 0;
  2069. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  2070. return 0;
  2071. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->keytype))
  2072. return 0;
  2073. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  2074. return 0;
  2075. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  2076. return 0;
  2077. if (!ASN1BERDecOctetString(dd0, 0x4, &(val)->keyvalue))
  2078. return 0;
  2079. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  2080. return 0;
  2081. if (!ASN1BERDecEndOfContents(dec, dd, di))
  2082. return 0;
  2083. return 1;
  2084. }
  2085. static void ASN1CALL ASN1Free_KERB_ENCRYPTION_KEY(KERB_ENCRYPTION_KEY *val)
  2086. {
  2087. if (val) {
  2088. ASN1octetstring_free(&(val)->keyvalue);
  2089. }
  2090. }
  2091. static int ASN1CALL ASN1Enc_KERB_CHECKSUM(ASN1encoding_t enc, ASN1uint32_t tag, KERB_CHECKSUM *val)
  2092. {
  2093. ASN1uint32_t nLenOff;
  2094. ASN1uint32_t nLenOff0;
  2095. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  2096. return 0;
  2097. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  2098. return 0;
  2099. if (!ASN1BEREncS32(enc, 0x2, (val)->checksum_type))
  2100. return 0;
  2101. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  2102. return 0;
  2103. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  2104. return 0;
  2105. if (!ASN1DEREncOctetString(enc, 0x4, ((val)->checksum).length, ((val)->checksum).value))
  2106. return 0;
  2107. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  2108. return 0;
  2109. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  2110. return 0;
  2111. return 1;
  2112. }
  2113. static int ASN1CALL ASN1Dec_KERB_CHECKSUM(ASN1decoding_t dec, ASN1uint32_t tag, KERB_CHECKSUM *val)
  2114. {
  2115. ASN1decoding_t dd;
  2116. ASN1octet_t *di;
  2117. ASN1decoding_t dd0;
  2118. ASN1octet_t *di0;
  2119. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  2120. return 0;
  2121. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  2122. return 0;
  2123. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->checksum_type))
  2124. return 0;
  2125. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  2126. return 0;
  2127. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  2128. return 0;
  2129. if (!ASN1BERDecOctetString(dd0, 0x4, &(val)->checksum))
  2130. return 0;
  2131. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  2132. return 0;
  2133. if (!ASN1BERDecEndOfContents(dec, dd, di))
  2134. return 0;
  2135. return 1;
  2136. }
  2137. static void ASN1CALL ASN1Free_KERB_CHECKSUM(KERB_CHECKSUM *val)
  2138. {
  2139. if (val) {
  2140. ASN1octetstring_free(&(val)->checksum);
  2141. }
  2142. }
  2143. static int ASN1CALL ASN1Enc_KERB_ENCRYPTED_TIMESTAMP(ASN1encoding_t enc, ASN1uint32_t tag, KERB_ENCRYPTED_TIMESTAMP *val)
  2144. {
  2145. ASN1uint32_t nLenOff;
  2146. ASN1uint32_t nLenOff0;
  2147. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  2148. return 0;
  2149. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  2150. return 0;
  2151. if (!ASN1DEREncGeneralizedTime(enc, 0x18, &(val)->timestamp))
  2152. return 0;
  2153. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  2154. return 0;
  2155. if ((val)->o[0] & 0x80) {
  2156. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  2157. return 0;
  2158. if (!ASN1BEREncS32(enc, 0x2, (val)->usec))
  2159. return 0;
  2160. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  2161. return 0;
  2162. }
  2163. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  2164. return 0;
  2165. return 1;
  2166. }
  2167. static int ASN1CALL ASN1Dec_KERB_ENCRYPTED_TIMESTAMP(ASN1decoding_t dec, ASN1uint32_t tag, KERB_ENCRYPTED_TIMESTAMP *val)
  2168. {
  2169. ASN1decoding_t dd;
  2170. ASN1octet_t *di;
  2171. ASN1decoding_t dd0;
  2172. ASN1octet_t *di0;
  2173. ASN1uint32_t t;
  2174. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  2175. return 0;
  2176. ZeroMemory((val)->o, 1);
  2177. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  2178. return 0;
  2179. if (!ASN1BERDecGeneralizedTime(dd0, 0x18, &(val)->timestamp))
  2180. return 0;
  2181. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  2182. return 0;
  2183. ASN1BERDecPeekTag(dd, &t);
  2184. if (t == 0x80000001) {
  2185. (val)->o[0] |= 0x80;
  2186. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  2187. return 0;
  2188. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->usec))
  2189. return 0;
  2190. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  2191. return 0;
  2192. }
  2193. if (!ASN1BERDecEndOfContents(dec, dd, di))
  2194. return 0;
  2195. return 1;
  2196. }
  2197. static void ASN1CALL ASN1Free_KERB_ENCRYPTED_TIMESTAMP(KERB_ENCRYPTED_TIMESTAMP *val)
  2198. {
  2199. if (val) {
  2200. }
  2201. }
  2202. static int ASN1CALL ASN1Enc_KERB_SALTED_ENCRYPTED_TIMESTAMP(ASN1encoding_t enc, ASN1uint32_t tag, KERB_SALTED_ENCRYPTED_TIMESTAMP *val)
  2203. {
  2204. ASN1uint32_t nLenOff;
  2205. ASN1uint32_t nLenOff0;
  2206. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  2207. return 0;
  2208. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  2209. return 0;
  2210. if (!ASN1DEREncGeneralizedTime(enc, 0x18, &(val)->timestamp))
  2211. return 0;
  2212. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  2213. return 0;
  2214. if ((val)->o[0] & 0x80) {
  2215. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  2216. return 0;
  2217. if (!ASN1BEREncS32(enc, 0x2, (val)->usec))
  2218. return 0;
  2219. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  2220. return 0;
  2221. }
  2222. if (!ASN1BEREncExplicitTag(enc, 0x80000002, &nLenOff0))
  2223. return 0;
  2224. if (!ASN1DEREncOctetString(enc, 0x4, ((val)->salt).length, ((val)->salt).value))
  2225. return 0;
  2226. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  2227. return 0;
  2228. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  2229. return 0;
  2230. return 1;
  2231. }
  2232. static int ASN1CALL ASN1Dec_KERB_SALTED_ENCRYPTED_TIMESTAMP(ASN1decoding_t dec, ASN1uint32_t tag, KERB_SALTED_ENCRYPTED_TIMESTAMP *val)
  2233. {
  2234. ASN1decoding_t dd;
  2235. ASN1octet_t *di;
  2236. ASN1decoding_t dd0;
  2237. ASN1octet_t *di0;
  2238. ASN1uint32_t t;
  2239. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  2240. return 0;
  2241. ZeroMemory((val)->o, 1);
  2242. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  2243. return 0;
  2244. if (!ASN1BERDecGeneralizedTime(dd0, 0x18, &(val)->timestamp))
  2245. return 0;
  2246. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  2247. return 0;
  2248. ASN1BERDecPeekTag(dd, &t);
  2249. if (t == 0x80000001) {
  2250. (val)->o[0] |= 0x80;
  2251. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  2252. return 0;
  2253. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->usec))
  2254. return 0;
  2255. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  2256. return 0;
  2257. }
  2258. if (!ASN1BERDecExplicitTag(dd, 0x80000002, &dd0, &di0))
  2259. return 0;
  2260. if (!ASN1BERDecOctetString(dd0, 0x4, &(val)->salt))
  2261. return 0;
  2262. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  2263. return 0;
  2264. if (!ASN1BERDecEndOfContents(dec, dd, di))
  2265. return 0;
  2266. return 1;
  2267. }
  2268. static void ASN1CALL ASN1Free_KERB_SALTED_ENCRYPTED_TIMESTAMP(KERB_SALTED_ENCRYPTED_TIMESTAMP *val)
  2269. {
  2270. if (val) {
  2271. ASN1octetstring_free(&(val)->salt);
  2272. }
  2273. }
  2274. static int ASN1CALL ASN1Enc_KERB_ETYPE_INFO_ENTRY(ASN1encoding_t enc, ASN1uint32_t tag, KERB_ETYPE_INFO_ENTRY *val)
  2275. {
  2276. ASN1uint32_t nLenOff;
  2277. ASN1uint32_t nLenOff0;
  2278. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  2279. return 0;
  2280. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  2281. return 0;
  2282. if (!ASN1BEREncS32(enc, 0x2, (val)->encryption_type))
  2283. return 0;
  2284. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  2285. return 0;
  2286. if ((val)->o[0] & 0x80) {
  2287. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  2288. return 0;
  2289. if (!ASN1DEREncOctetString(enc, 0x4, ((val)->salt).length, ((val)->salt).value))
  2290. return 0;
  2291. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  2292. return 0;
  2293. }
  2294. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  2295. return 0;
  2296. return 1;
  2297. }
  2298. static int ASN1CALL ASN1Dec_KERB_ETYPE_INFO_ENTRY(ASN1decoding_t dec, ASN1uint32_t tag, KERB_ETYPE_INFO_ENTRY *val)
  2299. {
  2300. ASN1decoding_t dd;
  2301. ASN1octet_t *di;
  2302. ASN1decoding_t dd0;
  2303. ASN1octet_t *di0;
  2304. ASN1uint32_t t;
  2305. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  2306. return 0;
  2307. ZeroMemory((val)->o, 1);
  2308. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  2309. return 0;
  2310. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->encryption_type))
  2311. return 0;
  2312. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  2313. return 0;
  2314. ASN1BERDecPeekTag(dd, &t);
  2315. if (t == 0x80000001) {
  2316. (val)->o[0] |= 0x80;
  2317. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  2318. return 0;
  2319. if (!ASN1BERDecOctetString(dd0, 0x4, &(val)->salt))
  2320. return 0;
  2321. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  2322. return 0;
  2323. }
  2324. if (!ASN1BERDecEndOfContents(dec, dd, di))
  2325. return 0;
  2326. return 1;
  2327. }
  2328. static void ASN1CALL ASN1Free_KERB_ETYPE_INFO_ENTRY(KERB_ETYPE_INFO_ENTRY *val)
  2329. {
  2330. if (val) {
  2331. if ((val)->o[0] & 0x80) {
  2332. ASN1octetstring_free(&(val)->salt);
  2333. }
  2334. }
  2335. }
  2336. static int ASN1CALL ASN1Enc_PKERB_ETYPE_INFO(ASN1encoding_t enc, ASN1uint32_t tag, PPKERB_ETYPE_INFO *val)
  2337. {
  2338. PPKERB_ETYPE_INFO f;
  2339. ASN1uint32_t nLenOff;
  2340. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  2341. return 0;
  2342. for (f = *val; f; f = f->next) {
  2343. if (!ASN1Enc_KERB_ETYPE_INFO_ENTRY(enc, 0, &f->value))
  2344. return 0;
  2345. }
  2346. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  2347. return 0;
  2348. return 1;
  2349. }
  2350. static int ASN1CALL ASN1Dec_PKERB_ETYPE_INFO(ASN1decoding_t dec, ASN1uint32_t tag, PPKERB_ETYPE_INFO *val)
  2351. {
  2352. PPKERB_ETYPE_INFO *f;
  2353. ASN1decoding_t dd;
  2354. ASN1octet_t *di;
  2355. ASN1uint32_t t;
  2356. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  2357. return 0;
  2358. f = val;
  2359. while (ASN1BERDecNotEndOfContents(dd, di)) {
  2360. if (!ASN1BERDecPeekTag(dd, &t))
  2361. return 0;
  2362. if (!(*f = (PPKERB_ETYPE_INFO)ASN1DecAlloc(dd, sizeof(**f))))
  2363. return 0;
  2364. if (!ASN1Dec_KERB_ETYPE_INFO_ENTRY(dd, 0, &(*f)->value))
  2365. return 0;
  2366. f = &(*f)->next;
  2367. }
  2368. *f = NULL;
  2369. if (!ASN1BERDecEndOfContents(dec, dd, di))
  2370. return 0;
  2371. return 1;
  2372. }
  2373. static void ASN1CALL ASN1Free_PKERB_ETYPE_INFO(PPKERB_ETYPE_INFO *val)
  2374. {
  2375. PPKERB_ETYPE_INFO f, ff;
  2376. if (val) {
  2377. for (f = *val; f; f = ff) {
  2378. ASN1Free_KERB_ETYPE_INFO_ENTRY(&f->value);
  2379. ff = f->next;
  2380. ASN1Free(f);
  2381. }
  2382. }
  2383. }
  2384. static int ASN1CALL ASN1Enc_KERB_TGT_REQUEST(ASN1encoding_t enc, ASN1uint32_t tag, KERB_TGT_REQUEST *val)
  2385. {
  2386. ASN1uint32_t nLenOff;
  2387. ASN1uint32_t nLenOff0;
  2388. ASN1uint32_t t;
  2389. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  2390. return 0;
  2391. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  2392. return 0;
  2393. if (!ASN1BEREncS32(enc, 0x2, (val)->version))
  2394. return 0;
  2395. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  2396. return 0;
  2397. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  2398. return 0;
  2399. if (!ASN1BEREncS32(enc, 0x2, (val)->message_type))
  2400. return 0;
  2401. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  2402. return 0;
  2403. if ((val)->o[0] & 0x80) {
  2404. if (!ASN1BEREncExplicitTag(enc, 0x80000002, &nLenOff0))
  2405. return 0;
  2406. if (!ASN1Enc_KERB_PRINCIPAL_NAME(enc, 0, &(val)->server_name))
  2407. return 0;
  2408. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  2409. return 0;
  2410. }
  2411. if ((val)->o[0] & 0x40) {
  2412. t = lstrlenA((val)->server_realm);
  2413. if (!ASN1BEREncExplicitTag(enc, 0x80000003, &nLenOff0))
  2414. return 0;
  2415. if (!ASN1DEREncCharString(enc, 0x1b, t, (val)->server_realm))
  2416. return 0;
  2417. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  2418. return 0;
  2419. }
  2420. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  2421. return 0;
  2422. return 1;
  2423. }
  2424. static int ASN1CALL ASN1Dec_KERB_TGT_REQUEST(ASN1decoding_t dec, ASN1uint32_t tag, KERB_TGT_REQUEST *val)
  2425. {
  2426. ASN1decoding_t dd;
  2427. ASN1octet_t *di;
  2428. ASN1decoding_t dd0;
  2429. ASN1octet_t *di0;
  2430. ASN1uint32_t t;
  2431. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  2432. return 0;
  2433. ZeroMemory((val)->o, 1);
  2434. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  2435. return 0;
  2436. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->version))
  2437. return 0;
  2438. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  2439. return 0;
  2440. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  2441. return 0;
  2442. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->message_type))
  2443. return 0;
  2444. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  2445. return 0;
  2446. ASN1BERDecPeekTag(dd, &t);
  2447. if (t == 0x80000002) {
  2448. (val)->o[0] |= 0x80;
  2449. if (!ASN1BERDecExplicitTag(dd, 0x80000002, &dd0, &di0))
  2450. return 0;
  2451. if (!ASN1Dec_KERB_PRINCIPAL_NAME(dd0, 0, &(val)->server_name))
  2452. return 0;
  2453. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  2454. return 0;
  2455. }
  2456. ASN1BERDecPeekTag(dd, &t);
  2457. if (t == 0x80000003) {
  2458. (val)->o[0] |= 0x40;
  2459. if (!ASN1BERDecExplicitTag(dd, 0x80000003, &dd0, &di0))
  2460. return 0;
  2461. if (!ASN1BERDecZeroCharString(dd0, 0x1b, &(val)->server_realm))
  2462. return 0;
  2463. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  2464. return 0;
  2465. }
  2466. if (!ASN1BERDecEndOfContents(dec, dd, di))
  2467. return 0;
  2468. return 1;
  2469. }
  2470. static void ASN1CALL ASN1Free_KERB_TGT_REQUEST(KERB_TGT_REQUEST *val)
  2471. {
  2472. if (val) {
  2473. if ((val)->o[0] & 0x80) {
  2474. ASN1Free_KERB_PRINCIPAL_NAME(&(val)->server_name);
  2475. }
  2476. if ((val)->o[0] & 0x40) {
  2477. ASN1ztcharstring_free((val)->server_realm);
  2478. }
  2479. }
  2480. }
  2481. static int ASN1CALL ASN1Enc_KERB_PKCS_SIGNATURE(ASN1encoding_t enc, ASN1uint32_t tag, KERB_PKCS_SIGNATURE *val)
  2482. {
  2483. ASN1uint32_t nLenOff;
  2484. ASN1uint32_t nLenOff0;
  2485. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  2486. return 0;
  2487. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  2488. return 0;
  2489. if (!ASN1BEREncS32(enc, 0x2, (val)->encryption_type))
  2490. return 0;
  2491. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  2492. return 0;
  2493. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  2494. return 0;
  2495. if (!ASN1DEREncOctetString(enc, 0x4, ((val)->signature).length, ((val)->signature).value))
  2496. return 0;
  2497. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  2498. return 0;
  2499. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  2500. return 0;
  2501. return 1;
  2502. }
  2503. static int ASN1CALL ASN1Dec_KERB_PKCS_SIGNATURE(ASN1decoding_t dec, ASN1uint32_t tag, KERB_PKCS_SIGNATURE *val)
  2504. {
  2505. ASN1decoding_t dd;
  2506. ASN1octet_t *di;
  2507. ASN1decoding_t dd0;
  2508. ASN1octet_t *di0;
  2509. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  2510. return 0;
  2511. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  2512. return 0;
  2513. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->encryption_type))
  2514. return 0;
  2515. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  2516. return 0;
  2517. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  2518. return 0;
  2519. if (!ASN1BERDecOctetString(dd0, 0x4, &(val)->signature))
  2520. return 0;
  2521. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  2522. return 0;
  2523. if (!ASN1BERDecEndOfContents(dec, dd, di))
  2524. return 0;
  2525. return 1;
  2526. }
  2527. static void ASN1CALL ASN1Free_KERB_PKCS_SIGNATURE(KERB_PKCS_SIGNATURE *val)
  2528. {
  2529. if (val) {
  2530. ASN1octetstring_free(&(val)->signature);
  2531. }
  2532. }
  2533. static int ASN1CALL ASN1Enc_KERB_ALGORITHM_IDENTIFIER(ASN1encoding_t enc, ASN1uint32_t tag, KERB_ALGORITHM_IDENTIFIER *val)
  2534. {
  2535. ASN1uint32_t nLenOff;
  2536. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  2537. return 0;
  2538. if (!ASN1BEREncObjectIdentifier(enc, 0x6, &(val)->algorithm))
  2539. return 0;
  2540. if ((val)->o[0] & 0x80) {
  2541. if (!ASN1BEREncOpenType(enc, &(val)->parameters))
  2542. return 0;
  2543. }
  2544. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  2545. return 0;
  2546. return 1;
  2547. }
  2548. static int ASN1CALL ASN1Dec_KERB_ALGORITHM_IDENTIFIER(ASN1decoding_t dec, ASN1uint32_t tag, KERB_ALGORITHM_IDENTIFIER *val)
  2549. {
  2550. ASN1decoding_t dd;
  2551. ASN1octet_t *di;
  2552. ASN1uint32_t t;
  2553. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  2554. return 0;
  2555. ZeroMemory((val)->o, 1);
  2556. if (!ASN1BERDecObjectIdentifier(dd, 0x6, &(val)->algorithm))
  2557. return 0;
  2558. if (ASN1BERDecPeekTag(dd, &t)) {
  2559. (val)->o[0] |= 0x80;
  2560. if (!ASN1BERDecOpenType2(dd, &(val)->parameters))
  2561. return 0;
  2562. }
  2563. if (!ASN1BERDecEndOfContents(dec, dd, di))
  2564. return 0;
  2565. return 1;
  2566. }
  2567. static void ASN1CALL ASN1Free_KERB_ALGORITHM_IDENTIFIER(KERB_ALGORITHM_IDENTIFIER *val)
  2568. {
  2569. if (val) {
  2570. ASN1objectidentifier_free(&(val)->algorithm);
  2571. if ((val)->o[0] & 0x80) {
  2572. }
  2573. }
  2574. }
  2575. static int ASN1CALL ASN1Enc_KERB_SIGNATURE(ASN1encoding_t enc, ASN1uint32_t tag, KERB_SIGNATURE *val)
  2576. {
  2577. ASN1uint32_t nLenOff;
  2578. ASN1uint32_t nLenOff0;
  2579. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  2580. return 0;
  2581. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  2582. return 0;
  2583. if (!ASN1Enc_KERB_ALGORITHM_IDENTIFIER(enc, 0, &(val)->signature_algorithm))
  2584. return 0;
  2585. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  2586. return 0;
  2587. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  2588. return 0;
  2589. if (!ASN1DEREncBitString(enc, 0x3, ((val)->pkcs_signature).length, ((val)->pkcs_signature).value))
  2590. return 0;
  2591. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  2592. return 0;
  2593. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  2594. return 0;
  2595. return 1;
  2596. }
  2597. static int ASN1CALL ASN1Dec_KERB_SIGNATURE(ASN1decoding_t dec, ASN1uint32_t tag, KERB_SIGNATURE *val)
  2598. {
  2599. ASN1decoding_t dd;
  2600. ASN1octet_t *di;
  2601. ASN1decoding_t dd0;
  2602. ASN1octet_t *di0;
  2603. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  2604. return 0;
  2605. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  2606. return 0;
  2607. if (!ASN1Dec_KERB_ALGORITHM_IDENTIFIER(dd0, 0, &(val)->signature_algorithm))
  2608. return 0;
  2609. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  2610. return 0;
  2611. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  2612. return 0;
  2613. if (!ASN1BERDecBitString(dd0, 0x3, &(val)->pkcs_signature))
  2614. return 0;
  2615. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  2616. return 0;
  2617. if (!ASN1BERDecEndOfContents(dec, dd, di))
  2618. return 0;
  2619. return 1;
  2620. }
  2621. static void ASN1CALL ASN1Free_KERB_SIGNATURE(KERB_SIGNATURE *val)
  2622. {
  2623. if (val) {
  2624. ASN1Free_KERB_ALGORITHM_IDENTIFIER(&(val)->signature_algorithm);
  2625. ASN1bitstring_free(&(val)->pkcs_signature);
  2626. }
  2627. }
  2628. static int ASN1CALL ASN1Enc_KERB_PA_PK_AS_REP(ASN1encoding_t enc, ASN1uint32_t tag, KERB_PA_PK_AS_REP *val)
  2629. {
  2630. switch ((val)->choice) {
  2631. case 1:
  2632. if (!ASN1DEREncOctetString(enc, 0x80000000, ((val)->u.dh_signed_data).length, ((val)->u.dh_signed_data).value))
  2633. return 0;
  2634. break;
  2635. case 2:
  2636. if (!ASN1DEREncOctetString(enc, 0x80000001, ((val)->u.key_package).length, ((val)->u.key_package).value))
  2637. return 0;
  2638. break;
  2639. }
  2640. return 1;
  2641. }
  2642. static int ASN1CALL ASN1Dec_KERB_PA_PK_AS_REP(ASN1decoding_t dec, ASN1uint32_t tag, KERB_PA_PK_AS_REP *val)
  2643. {
  2644. ASN1uint32_t t;
  2645. if (!ASN1BERDecPeekTag(dec, &t))
  2646. return 0;
  2647. switch (t) {
  2648. case 0x80000000:
  2649. (val)->choice = 1;
  2650. if (!ASN1BERDecOctetString(dec, 0x80000000, &(val)->u.dh_signed_data))
  2651. return 0;
  2652. break;
  2653. case 0x80000001:
  2654. (val)->choice = 2;
  2655. if (!ASN1BERDecOctetString(dec, 0x80000001, &(val)->u.key_package))
  2656. return 0;
  2657. break;
  2658. default:
  2659. ASN1DecSetError(dec, ASN1_ERR_CORRUPT);
  2660. return 0;
  2661. }
  2662. return 1;
  2663. }
  2664. static void ASN1CALL ASN1Free_KERB_PA_PK_AS_REP(KERB_PA_PK_AS_REP *val)
  2665. {
  2666. if (val) {
  2667. switch ((val)->choice) {
  2668. case 1:
  2669. ASN1octetstring_free(&(val)->u.dh_signed_data);
  2670. break;
  2671. case 2:
  2672. ASN1octetstring_free(&(val)->u.key_package);
  2673. break;
  2674. }
  2675. }
  2676. }
  2677. static int ASN1CALL ASN1Enc_KERB_ENVELOPED_KEY_PACKAGE(ASN1encoding_t enc, ASN1uint32_t tag, KERB_ENVELOPED_KEY_PACKAGE *val)
  2678. {
  2679. ASN1uint32_t nLenOff0;
  2680. switch ((val)->choice) {
  2681. case 1:
  2682. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  2683. return 0;
  2684. if (!ASN1Enc_KERB_ENCRYPTED_DATA(enc, 0, &(val)->u.encrypted_data))
  2685. return 0;
  2686. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  2687. return 0;
  2688. break;
  2689. case 2:
  2690. if (!ASN1DEREncOctetString(enc, 0x80000004, ((val)->u.pkinit_enveloped_data).length, ((val)->u.pkinit_enveloped_data).value))
  2691. return 0;
  2692. break;
  2693. }
  2694. return 1;
  2695. }
  2696. static int ASN1CALL ASN1Dec_KERB_ENVELOPED_KEY_PACKAGE(ASN1decoding_t dec, ASN1uint32_t tag, KERB_ENVELOPED_KEY_PACKAGE *val)
  2697. {
  2698. ASN1uint32_t t;
  2699. ASN1decoding_t dd0;
  2700. ASN1octet_t *di0;
  2701. if (!ASN1BERDecPeekTag(dec, &t))
  2702. return 0;
  2703. switch (t) {
  2704. case 0x80000001:
  2705. (val)->choice = 1;
  2706. if (!ASN1BERDecExplicitTag(dec, 0x80000001, &dd0, &di0))
  2707. return 0;
  2708. if (!ASN1Dec_KERB_ENCRYPTED_DATA(dd0, 0, &(val)->u.encrypted_data))
  2709. return 0;
  2710. if (!ASN1BERDecEndOfContents(dec, dd0, di0))
  2711. return 0;
  2712. break;
  2713. case 0x80000004:
  2714. (val)->choice = 2;
  2715. if (!ASN1BERDecOctetString(dec, 0x80000004, &(val)->u.pkinit_enveloped_data))
  2716. return 0;
  2717. break;
  2718. default:
  2719. ASN1DecSetError(dec, ASN1_ERR_CORRUPT);
  2720. return 0;
  2721. }
  2722. return 1;
  2723. }
  2724. static void ASN1CALL ASN1Free_KERB_ENVELOPED_KEY_PACKAGE(KERB_ENVELOPED_KEY_PACKAGE *val)
  2725. {
  2726. if (val) {
  2727. switch ((val)->choice) {
  2728. case 1:
  2729. ASN1Free_KERB_ENCRYPTED_DATA(&(val)->u.encrypted_data);
  2730. break;
  2731. case 2:
  2732. ASN1octetstring_free(&(val)->u.pkinit_enveloped_data);
  2733. break;
  2734. }
  2735. }
  2736. }
  2737. static int ASN1CALL ASN1Enc_KERB_REPLY_KEY_PACKAGE2(ASN1encoding_t enc, ASN1uint32_t tag, KERB_REPLY_KEY_PACKAGE2 *val)
  2738. {
  2739. ASN1uint32_t nLenOff;
  2740. ASN1uint32_t nLenOff0;
  2741. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  2742. return 0;
  2743. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  2744. return 0;
  2745. if (!ASN1Enc_KERB_ENCRYPTION_KEY(enc, 0, &(val)->reply_key))
  2746. return 0;
  2747. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  2748. return 0;
  2749. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  2750. return 0;
  2751. if (!ASN1BEREncS32(enc, 0x2, (val)->nonce))
  2752. return 0;
  2753. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  2754. return 0;
  2755. if ((val)->o[0] & 0x80) {
  2756. if (!ASN1BEREncExplicitTag(enc, 0x80000002, &nLenOff0))
  2757. return 0;
  2758. if (!ASN1DEREncBitString(enc, 0x3, ((val)->subject_public_key).length, ((val)->subject_public_key).value))
  2759. return 0;
  2760. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  2761. return 0;
  2762. }
  2763. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  2764. return 0;
  2765. return 1;
  2766. }
  2767. static int ASN1CALL ASN1Dec_KERB_REPLY_KEY_PACKAGE2(ASN1decoding_t dec, ASN1uint32_t tag, KERB_REPLY_KEY_PACKAGE2 *val)
  2768. {
  2769. ASN1decoding_t dd;
  2770. ASN1octet_t *di;
  2771. ASN1decoding_t dd0;
  2772. ASN1octet_t *di0;
  2773. ASN1uint32_t t;
  2774. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  2775. return 0;
  2776. ZeroMemory((val)->o, 1);
  2777. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  2778. return 0;
  2779. if (!ASN1Dec_KERB_ENCRYPTION_KEY(dd0, 0, &(val)->reply_key))
  2780. return 0;
  2781. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  2782. return 0;
  2783. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  2784. return 0;
  2785. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->nonce))
  2786. return 0;
  2787. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  2788. return 0;
  2789. ASN1BERDecPeekTag(dd, &t);
  2790. if (t == 0x80000002) {
  2791. (val)->o[0] |= 0x80;
  2792. if (!ASN1BERDecExplicitTag(dd, 0x80000002, &dd0, &di0))
  2793. return 0;
  2794. if (!ASN1BERDecBitString(dd0, 0x3, &(val)->subject_public_key))
  2795. return 0;
  2796. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  2797. return 0;
  2798. }
  2799. if (!ASN1BERDecEndOfContents(dec, dd, di))
  2800. return 0;
  2801. return 1;
  2802. }
  2803. static void ASN1CALL ASN1Free_KERB_REPLY_KEY_PACKAGE2(KERB_REPLY_KEY_PACKAGE2 *val)
  2804. {
  2805. if (val) {
  2806. ASN1Free_KERB_ENCRYPTION_KEY(&(val)->reply_key);
  2807. if ((val)->o[0] & 0x80) {
  2808. ASN1bitstring_free(&(val)->subject_public_key);
  2809. }
  2810. }
  2811. }
  2812. static int ASN1CALL ASN1Enc_KERB_REPLY_KEY_PACKAGE(ASN1encoding_t enc, ASN1uint32_t tag, KERB_REPLY_KEY_PACKAGE *val)
  2813. {
  2814. ASN1uint32_t nLenOff;
  2815. ASN1uint32_t nLenOff0;
  2816. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  2817. return 0;
  2818. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  2819. return 0;
  2820. if (!ASN1Enc_KERB_ENCRYPTION_KEY(enc, 0, &(val)->reply_key))
  2821. return 0;
  2822. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  2823. return 0;
  2824. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  2825. return 0;
  2826. if (!ASN1BEREncS32(enc, 0x2, (val)->nonce))
  2827. return 0;
  2828. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  2829. return 0;
  2830. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  2831. return 0;
  2832. return 1;
  2833. }
  2834. static int ASN1CALL ASN1Dec_KERB_REPLY_KEY_PACKAGE(ASN1decoding_t dec, ASN1uint32_t tag, KERB_REPLY_KEY_PACKAGE *val)
  2835. {
  2836. ASN1decoding_t dd;
  2837. ASN1octet_t *di;
  2838. ASN1decoding_t dd0;
  2839. ASN1octet_t *di0;
  2840. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  2841. return 0;
  2842. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  2843. return 0;
  2844. if (!ASN1Dec_KERB_ENCRYPTION_KEY(dd0, 0, &(val)->reply_key))
  2845. return 0;
  2846. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  2847. return 0;
  2848. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  2849. return 0;
  2850. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->nonce))
  2851. return 0;
  2852. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  2853. return 0;
  2854. if (!ASN1BERDecEndOfContents(dec, dd, di))
  2855. return 0;
  2856. return 1;
  2857. }
  2858. static void ASN1CALL ASN1Free_KERB_REPLY_KEY_PACKAGE(KERB_REPLY_KEY_PACKAGE *val)
  2859. {
  2860. if (val) {
  2861. ASN1Free_KERB_ENCRYPTION_KEY(&(val)->reply_key);
  2862. }
  2863. }
  2864. static int ASN1CALL ASN1Enc_KERB_KDC_DH_KEY_INFO(ASN1encoding_t enc, ASN1uint32_t tag, KERB_KDC_DH_KEY_INFO *val)
  2865. {
  2866. ASN1uint32_t nLenOff;
  2867. ASN1uint32_t nLenOff0;
  2868. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  2869. return 0;
  2870. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  2871. return 0;
  2872. if (!ASN1BEREncS32(enc, 0x2, (val)->nonce))
  2873. return 0;
  2874. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  2875. return 0;
  2876. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  2877. return 0;
  2878. if (!ASN1DEREncBitString(enc, 0x3, ((val)->subject_public_key).length, ((val)->subject_public_key).value))
  2879. return 0;
  2880. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  2881. return 0;
  2882. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  2883. return 0;
  2884. return 1;
  2885. }
  2886. static int ASN1CALL ASN1Dec_KERB_KDC_DH_KEY_INFO(ASN1decoding_t dec, ASN1uint32_t tag, KERB_KDC_DH_KEY_INFO *val)
  2887. {
  2888. ASN1decoding_t dd;
  2889. ASN1octet_t *di;
  2890. ASN1decoding_t dd0;
  2891. ASN1octet_t *di0;
  2892. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  2893. return 0;
  2894. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  2895. return 0;
  2896. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->nonce))
  2897. return 0;
  2898. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  2899. return 0;
  2900. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  2901. return 0;
  2902. if (!ASN1BERDecBitString(dd0, 0x3, &(val)->subject_public_key))
  2903. return 0;
  2904. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  2905. return 0;
  2906. if (!ASN1BERDecEndOfContents(dec, dd, di))
  2907. return 0;
  2908. return 1;
  2909. }
  2910. static void ASN1CALL ASN1Free_KERB_KDC_DH_KEY_INFO(KERB_KDC_DH_KEY_INFO *val)
  2911. {
  2912. if (val) {
  2913. ASN1bitstring_free(&(val)->subject_public_key);
  2914. }
  2915. }
  2916. static int ASN1CALL ASN1Enc_KERB_PA_PK_AS_REQ(ASN1encoding_t enc, ASN1uint32_t tag, KERB_PA_PK_AS_REQ *val)
  2917. {
  2918. ASN1uint32_t nLenOff;
  2919. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  2920. return 0;
  2921. if (!ASN1DEREncOctetString(enc, 0x80000000, ((val)->signed_auth_pack).length, ((val)->signed_auth_pack).value))
  2922. return 0;
  2923. if ((val)->o[0] & 0x80) {
  2924. if (!ASN1Enc_KERB_PA_PK_AS_REQ_trusted_certifiers(enc, 0, &(val)->trusted_certifiers))
  2925. return 0;
  2926. }
  2927. if ((val)->o[0] & 0x40) {
  2928. if (!ASN1DEREncOctetString(enc, 0x80000003, ((val)->kdc_cert).length, ((val)->kdc_cert).value))
  2929. return 0;
  2930. }
  2931. if ((val)->o[0] & 0x20) {
  2932. if (!ASN1DEREncOctetString(enc, 0x80000004, ((val)->encryption_cert).length, ((val)->encryption_cert).value))
  2933. return 0;
  2934. }
  2935. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  2936. return 0;
  2937. return 1;
  2938. }
  2939. static int ASN1CALL ASN1Dec_KERB_PA_PK_AS_REQ(ASN1decoding_t dec, ASN1uint32_t tag, KERB_PA_PK_AS_REQ *val)
  2940. {
  2941. ASN1decoding_t dd;
  2942. ASN1octet_t *di;
  2943. ASN1uint32_t t;
  2944. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  2945. return 0;
  2946. ZeroMemory((val)->o, 1);
  2947. if (!ASN1BERDecOctetString(dd, 0x80000000, &(val)->signed_auth_pack))
  2948. return 0;
  2949. ASN1BERDecPeekTag(dd, &t);
  2950. if (t == 0x80000002) {
  2951. (val)->o[0] |= 0x80;
  2952. if (!ASN1Dec_KERB_PA_PK_AS_REQ_trusted_certifiers(dd, 0, &(val)->trusted_certifiers))
  2953. return 0;
  2954. }
  2955. ASN1BERDecPeekTag(dd, &t);
  2956. if (t == 0x80000003) {
  2957. (val)->o[0] |= 0x40;
  2958. if (!ASN1BERDecOctetString(dd, 0x80000003, &(val)->kdc_cert))
  2959. return 0;
  2960. }
  2961. ASN1BERDecPeekTag(dd, &t);
  2962. if (t == 0x80000004) {
  2963. (val)->o[0] |= 0x20;
  2964. if (!ASN1BERDecOctetString(dd, 0x80000004, &(val)->encryption_cert))
  2965. return 0;
  2966. }
  2967. if (!ASN1BERDecEndOfContents(dec, dd, di))
  2968. return 0;
  2969. return 1;
  2970. }
  2971. static void ASN1CALL ASN1Free_KERB_PA_PK_AS_REQ(KERB_PA_PK_AS_REQ *val)
  2972. {
  2973. if (val) {
  2974. ASN1octetstring_free(&(val)->signed_auth_pack);
  2975. if ((val)->o[0] & 0x80) {
  2976. ASN1Free_KERB_PA_PK_AS_REQ_trusted_certifiers(&(val)->trusted_certifiers);
  2977. }
  2978. if ((val)->o[0] & 0x40) {
  2979. ASN1octetstring_free(&(val)->kdc_cert);
  2980. }
  2981. if ((val)->o[0] & 0x20) {
  2982. ASN1octetstring_free(&(val)->encryption_cert);
  2983. }
  2984. }
  2985. }
  2986. static int ASN1CALL ASN1Enc_KERB_KERBEROS_NAME(ASN1encoding_t enc, ASN1uint32_t tag, KERB_KERBEROS_NAME *val)
  2987. {
  2988. ASN1uint32_t nLenOff;
  2989. ASN1uint32_t t;
  2990. ASN1uint32_t nLenOff0;
  2991. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  2992. return 0;
  2993. t = lstrlenA((val)->realm);
  2994. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  2995. return 0;
  2996. if (!ASN1DEREncCharString(enc, 0x1b, t, (val)->realm))
  2997. return 0;
  2998. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  2999. return 0;
  3000. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  3001. return 0;
  3002. if (!ASN1Enc_KERB_PRINCIPAL_NAME(enc, 0, &(val)->principal_name))
  3003. return 0;
  3004. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  3005. return 0;
  3006. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  3007. return 0;
  3008. return 1;
  3009. }
  3010. static int ASN1CALL ASN1Dec_KERB_KERBEROS_NAME(ASN1decoding_t dec, ASN1uint32_t tag, KERB_KERBEROS_NAME *val)
  3011. {
  3012. ASN1decoding_t dd;
  3013. ASN1octet_t *di;
  3014. ASN1decoding_t dd0;
  3015. ASN1octet_t *di0;
  3016. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  3017. return 0;
  3018. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  3019. return 0;
  3020. if (!ASN1BERDecZeroCharString(dd0, 0x1b, &(val)->realm))
  3021. return 0;
  3022. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  3023. return 0;
  3024. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  3025. return 0;
  3026. if (!ASN1Dec_KERB_PRINCIPAL_NAME(dd0, 0, &(val)->principal_name))
  3027. return 0;
  3028. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  3029. return 0;
  3030. if (!ASN1BERDecEndOfContents(dec, dd, di))
  3031. return 0;
  3032. return 1;
  3033. }
  3034. static void ASN1CALL ASN1Free_KERB_KERBEROS_NAME(KERB_KERBEROS_NAME *val)
  3035. {
  3036. if (val) {
  3037. ASN1ztcharstring_free((val)->realm);
  3038. ASN1Free_KERB_PRINCIPAL_NAME(&(val)->principal_name);
  3039. }
  3040. }
  3041. static int ASN1CALL ASN1Enc_KERB_PK_AUTHENTICATOR(ASN1encoding_t enc, ASN1uint32_t tag, KERB_PK_AUTHENTICATOR *val)
  3042. {
  3043. ASN1uint32_t nLenOff;
  3044. ASN1uint32_t nLenOff0;
  3045. ASN1uint32_t t;
  3046. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  3047. return 0;
  3048. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  3049. return 0;
  3050. if (!ASN1Enc_KERB_PRINCIPAL_NAME(enc, 0, &(val)->kdc_name))
  3051. return 0;
  3052. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  3053. return 0;
  3054. t = lstrlenA((val)->kdc_realm);
  3055. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  3056. return 0;
  3057. if (!ASN1DEREncCharString(enc, 0x1b, t, (val)->kdc_realm))
  3058. return 0;
  3059. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  3060. return 0;
  3061. if (!ASN1BEREncExplicitTag(enc, 0x80000002, &nLenOff0))
  3062. return 0;
  3063. if (!ASN1BEREncS32(enc, 0x2, (val)->cusec))
  3064. return 0;
  3065. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  3066. return 0;
  3067. if (!ASN1BEREncExplicitTag(enc, 0x80000003, &nLenOff0))
  3068. return 0;
  3069. if (!ASN1DEREncGeneralizedTime(enc, 0x18, &(val)->client_time))
  3070. return 0;
  3071. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  3072. return 0;
  3073. if (!ASN1BEREncExplicitTag(enc, 0x80000004, &nLenOff0))
  3074. return 0;
  3075. if (!ASN1BEREncS32(enc, 0x2, (val)->nonce))
  3076. return 0;
  3077. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  3078. return 0;
  3079. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  3080. return 0;
  3081. return 1;
  3082. }
  3083. static int ASN1CALL ASN1Dec_KERB_PK_AUTHENTICATOR(ASN1decoding_t dec, ASN1uint32_t tag, KERB_PK_AUTHENTICATOR *val)
  3084. {
  3085. ASN1decoding_t dd;
  3086. ASN1octet_t *di;
  3087. ASN1decoding_t dd0;
  3088. ASN1octet_t *di0;
  3089. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  3090. return 0;
  3091. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  3092. return 0;
  3093. if (!ASN1Dec_KERB_PRINCIPAL_NAME(dd0, 0, &(val)->kdc_name))
  3094. return 0;
  3095. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  3096. return 0;
  3097. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  3098. return 0;
  3099. if (!ASN1BERDecZeroCharString(dd0, 0x1b, &(val)->kdc_realm))
  3100. return 0;
  3101. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  3102. return 0;
  3103. if (!ASN1BERDecExplicitTag(dd, 0x80000002, &dd0, &di0))
  3104. return 0;
  3105. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->cusec))
  3106. return 0;
  3107. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  3108. return 0;
  3109. if (!ASN1BERDecExplicitTag(dd, 0x80000003, &dd0, &di0))
  3110. return 0;
  3111. if (!ASN1BERDecGeneralizedTime(dd0, 0x18, &(val)->client_time))
  3112. return 0;
  3113. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  3114. return 0;
  3115. if (!ASN1BERDecExplicitTag(dd, 0x80000004, &dd0, &di0))
  3116. return 0;
  3117. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->nonce))
  3118. return 0;
  3119. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  3120. return 0;
  3121. if (!ASN1BERDecEndOfContents(dec, dd, di))
  3122. return 0;
  3123. return 1;
  3124. }
  3125. static void ASN1CALL ASN1Free_KERB_PK_AUTHENTICATOR(KERB_PK_AUTHENTICATOR *val)
  3126. {
  3127. if (val) {
  3128. ASN1Free_KERB_PRINCIPAL_NAME(&(val)->kdc_name);
  3129. ASN1ztcharstring_free((val)->kdc_realm);
  3130. }
  3131. }
  3132. static int ASN1CALL ASN1Enc_KERB_SUBJECT_PUBLIC_KEY_INFO(ASN1encoding_t enc, ASN1uint32_t tag, KERB_SUBJECT_PUBLIC_KEY_INFO *val)
  3133. {
  3134. ASN1uint32_t nLenOff;
  3135. ASN1uint32_t nLenOff0;
  3136. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  3137. return 0;
  3138. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  3139. return 0;
  3140. if (!ASN1Enc_KERB_ALGORITHM_IDENTIFIER(enc, 0, &(val)->algorithm))
  3141. return 0;
  3142. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  3143. return 0;
  3144. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  3145. return 0;
  3146. if (!ASN1DEREncBitString(enc, 0x3, ((val)->subjectPublicKey).length, ((val)->subjectPublicKey).value))
  3147. return 0;
  3148. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  3149. return 0;
  3150. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  3151. return 0;
  3152. return 1;
  3153. }
  3154. static int ASN1CALL ASN1Dec_KERB_SUBJECT_PUBLIC_KEY_INFO(ASN1decoding_t dec, ASN1uint32_t tag, KERB_SUBJECT_PUBLIC_KEY_INFO *val)
  3155. {
  3156. ASN1decoding_t dd;
  3157. ASN1octet_t *di;
  3158. ASN1decoding_t dd0;
  3159. ASN1octet_t *di0;
  3160. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  3161. return 0;
  3162. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  3163. return 0;
  3164. if (!ASN1Dec_KERB_ALGORITHM_IDENTIFIER(dd0, 0, &(val)->algorithm))
  3165. return 0;
  3166. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  3167. return 0;
  3168. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  3169. return 0;
  3170. if (!ASN1BERDecBitString(dd0, 0x3, &(val)->subjectPublicKey))
  3171. return 0;
  3172. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  3173. return 0;
  3174. if (!ASN1BERDecEndOfContents(dec, dd, di))
  3175. return 0;
  3176. return 1;
  3177. }
  3178. static void ASN1CALL ASN1Free_KERB_SUBJECT_PUBLIC_KEY_INFO(KERB_SUBJECT_PUBLIC_KEY_INFO *val)
  3179. {
  3180. if (val) {
  3181. ASN1Free_KERB_ALGORITHM_IDENTIFIER(&(val)->algorithm);
  3182. ASN1bitstring_free(&(val)->subjectPublicKey);
  3183. }
  3184. }
  3185. static int ASN1CALL ASN1Enc_KERB_DH_PARAMTER(ASN1encoding_t enc, ASN1uint32_t tag, KERB_DH_PARAMTER *val)
  3186. {
  3187. ASN1uint32_t nLenOff;
  3188. ASN1uint32_t nLenOff0;
  3189. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  3190. return 0;
  3191. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  3192. return 0;
  3193. if (!ASN1BEREncS32(enc, 0x2, (val)->prime))
  3194. return 0;
  3195. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  3196. return 0;
  3197. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  3198. return 0;
  3199. if (!ASN1BEREncS32(enc, 0x2, (val)->base))
  3200. return 0;
  3201. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  3202. return 0;
  3203. if ((val)->o[0] & 0x80) {
  3204. if (!ASN1BEREncExplicitTag(enc, 0x80000002, &nLenOff0))
  3205. return 0;
  3206. if (!ASN1BEREncS32(enc, 0x2, (val)->private_value_length))
  3207. return 0;
  3208. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  3209. return 0;
  3210. }
  3211. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  3212. return 0;
  3213. return 1;
  3214. }
  3215. static int ASN1CALL ASN1Dec_KERB_DH_PARAMTER(ASN1decoding_t dec, ASN1uint32_t tag, KERB_DH_PARAMTER *val)
  3216. {
  3217. ASN1decoding_t dd;
  3218. ASN1octet_t *di;
  3219. ASN1decoding_t dd0;
  3220. ASN1octet_t *di0;
  3221. ASN1uint32_t t;
  3222. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  3223. return 0;
  3224. ZeroMemory((val)->o, 1);
  3225. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  3226. return 0;
  3227. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->prime))
  3228. return 0;
  3229. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  3230. return 0;
  3231. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  3232. return 0;
  3233. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->base))
  3234. return 0;
  3235. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  3236. return 0;
  3237. ASN1BERDecPeekTag(dd, &t);
  3238. if (t == 0x80000002) {
  3239. (val)->o[0] |= 0x80;
  3240. if (!ASN1BERDecExplicitTag(dd, 0x80000002, &dd0, &di0))
  3241. return 0;
  3242. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->private_value_length))
  3243. return 0;
  3244. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  3245. return 0;
  3246. }
  3247. if (!ASN1BERDecEndOfContents(dec, dd, di))
  3248. return 0;
  3249. return 1;
  3250. }
  3251. static int ASN1CALL ASN1Enc_KERB_CERTIFICATE(ASN1encoding_t enc, ASN1uint32_t tag, KERB_CERTIFICATE *val)
  3252. {
  3253. ASN1uint32_t nLenOff;
  3254. ASN1uint32_t nLenOff0;
  3255. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  3256. return 0;
  3257. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  3258. return 0;
  3259. if (!ASN1BEREncS32(enc, 0x2, (val)->cert_type))
  3260. return 0;
  3261. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  3262. return 0;
  3263. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  3264. return 0;
  3265. if (!ASN1DEREncOctetString(enc, 0x4, ((val)->cert_data).length, ((val)->cert_data).value))
  3266. return 0;
  3267. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  3268. return 0;
  3269. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  3270. return 0;
  3271. return 1;
  3272. }
  3273. static int ASN1CALL ASN1Dec_KERB_CERTIFICATE(ASN1decoding_t dec, ASN1uint32_t tag, KERB_CERTIFICATE *val)
  3274. {
  3275. ASN1decoding_t dd;
  3276. ASN1octet_t *di;
  3277. ASN1decoding_t dd0;
  3278. ASN1octet_t *di0;
  3279. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  3280. return 0;
  3281. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  3282. return 0;
  3283. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->cert_type))
  3284. return 0;
  3285. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  3286. return 0;
  3287. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  3288. return 0;
  3289. if (!ASN1BERDecOctetString(dd0, 0x4, &(val)->cert_data))
  3290. return 0;
  3291. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  3292. return 0;
  3293. if (!ASN1BERDecEndOfContents(dec, dd, di))
  3294. return 0;
  3295. return 1;
  3296. }
  3297. static void ASN1CALL ASN1Free_KERB_CERTIFICATE(KERB_CERTIFICATE *val)
  3298. {
  3299. if (val) {
  3300. ASN1octetstring_free(&(val)->cert_data);
  3301. }
  3302. }
  3303. static int ASN1CALL ASN1Enc_KERB_TYPED_DATA(ASN1encoding_t enc, ASN1uint32_t tag, KERB_TYPED_DATA *val)
  3304. {
  3305. ASN1uint32_t nLenOff;
  3306. ASN1uint32_t nLenOff0;
  3307. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  3308. return 0;
  3309. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  3310. return 0;
  3311. if (!ASN1BEREncS32(enc, 0x2, (val)->data_type))
  3312. return 0;
  3313. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  3314. return 0;
  3315. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  3316. return 0;
  3317. if (!ASN1DEREncOctetString(enc, 0x4, ((val)->data_value).length, ((val)->data_value).value))
  3318. return 0;
  3319. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  3320. return 0;
  3321. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  3322. return 0;
  3323. return 1;
  3324. }
  3325. static int ASN1CALL ASN1Dec_KERB_TYPED_DATA(ASN1decoding_t dec, ASN1uint32_t tag, KERB_TYPED_DATA *val)
  3326. {
  3327. ASN1decoding_t dd;
  3328. ASN1octet_t *di;
  3329. ASN1decoding_t dd0;
  3330. ASN1octet_t *di0;
  3331. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  3332. return 0;
  3333. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  3334. return 0;
  3335. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->data_type))
  3336. return 0;
  3337. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  3338. return 0;
  3339. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  3340. return 0;
  3341. if (!ASN1BERDecOctetString(dd0, 0x4, &(val)->data_value))
  3342. return 0;
  3343. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  3344. return 0;
  3345. if (!ASN1BERDecEndOfContents(dec, dd, di))
  3346. return 0;
  3347. return 1;
  3348. }
  3349. static void ASN1CALL ASN1Free_KERB_TYPED_DATA(KERB_TYPED_DATA *val)
  3350. {
  3351. if (val) {
  3352. ASN1octetstring_free(&(val)->data_value);
  3353. }
  3354. }
  3355. static int ASN1CALL ASN1Enc_KERB_KDC_ISSUED_AUTH_DATA(ASN1encoding_t enc, ASN1uint32_t tag, KERB_KDC_ISSUED_AUTH_DATA *val)
  3356. {
  3357. ASN1uint32_t nLenOff;
  3358. ASN1uint32_t nLenOff0;
  3359. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  3360. return 0;
  3361. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  3362. return 0;
  3363. if (!ASN1Enc_KERB_SIGNATURE(enc, 0, &(val)->checksum))
  3364. return 0;
  3365. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  3366. return 0;
  3367. if (!ASN1Enc_KERB_KDC_ISSUED_AUTH_DATA_elements(enc, 0, &(val)->elements))
  3368. return 0;
  3369. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  3370. return 0;
  3371. return 1;
  3372. }
  3373. static int ASN1CALL ASN1Dec_KERB_KDC_ISSUED_AUTH_DATA(ASN1decoding_t dec, ASN1uint32_t tag, KERB_KDC_ISSUED_AUTH_DATA *val)
  3374. {
  3375. ASN1decoding_t dd;
  3376. ASN1octet_t *di;
  3377. ASN1decoding_t dd0;
  3378. ASN1octet_t *di0;
  3379. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  3380. return 0;
  3381. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  3382. return 0;
  3383. if (!ASN1Dec_KERB_SIGNATURE(dd0, 0, &(val)->checksum))
  3384. return 0;
  3385. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  3386. return 0;
  3387. if (!ASN1Dec_KERB_KDC_ISSUED_AUTH_DATA_elements(dd, 0, &(val)->elements))
  3388. return 0;
  3389. if (!ASN1BERDecEndOfContents(dec, dd, di))
  3390. return 0;
  3391. return 1;
  3392. }
  3393. static void ASN1CALL ASN1Free_KERB_KDC_ISSUED_AUTH_DATA(KERB_KDC_ISSUED_AUTH_DATA *val)
  3394. {
  3395. if (val) {
  3396. ASN1Free_KERB_SIGNATURE(&(val)->checksum);
  3397. ASN1Free_KERB_KDC_ISSUED_AUTH_DATA_elements(&(val)->elements);
  3398. }
  3399. }
  3400. static int ASN1CALL ASN1Enc_KERB_PA_SERV_REFERRAL(ASN1encoding_t enc, ASN1uint32_t tag, KERB_PA_SERV_REFERRAL *val)
  3401. {
  3402. ASN1uint32_t nLenOff;
  3403. ASN1uint32_t nLenOff0;
  3404. ASN1uint32_t t;
  3405. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  3406. return 0;
  3407. if ((val)->o[0] & 0x80) {
  3408. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  3409. return 0;
  3410. if (!ASN1Enc_KERB_PRINCIPAL_NAME(enc, 0, &(val)->referred_server_name))
  3411. return 0;
  3412. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  3413. return 0;
  3414. }
  3415. t = lstrlenA((val)->referred_server_realm);
  3416. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  3417. return 0;
  3418. if (!ASN1DEREncCharString(enc, 0x1b, t, (val)->referred_server_realm))
  3419. return 0;
  3420. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  3421. return 0;
  3422. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  3423. return 0;
  3424. return 1;
  3425. }
  3426. static int ASN1CALL ASN1Dec_KERB_PA_SERV_REFERRAL(ASN1decoding_t dec, ASN1uint32_t tag, KERB_PA_SERV_REFERRAL *val)
  3427. {
  3428. ASN1decoding_t dd;
  3429. ASN1octet_t *di;
  3430. ASN1uint32_t t;
  3431. ASN1decoding_t dd0;
  3432. ASN1octet_t *di0;
  3433. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  3434. return 0;
  3435. ZeroMemory((val)->o, 1);
  3436. ASN1BERDecPeekTag(dd, &t);
  3437. if (t == 0x80000001) {
  3438. (val)->o[0] |= 0x80;
  3439. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  3440. return 0;
  3441. if (!ASN1Dec_KERB_PRINCIPAL_NAME(dd0, 0, &(val)->referred_server_name))
  3442. return 0;
  3443. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  3444. return 0;
  3445. }
  3446. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  3447. return 0;
  3448. if (!ASN1BERDecZeroCharString(dd0, 0x1b, &(val)->referred_server_realm))
  3449. return 0;
  3450. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  3451. return 0;
  3452. if (!ASN1BERDecEndOfContents(dec, dd, di))
  3453. return 0;
  3454. return 1;
  3455. }
  3456. static void ASN1CALL ASN1Free_KERB_PA_SERV_REFERRAL(KERB_PA_SERV_REFERRAL *val)
  3457. {
  3458. if (val) {
  3459. if ((val)->o[0] & 0x80) {
  3460. ASN1Free_KERB_PRINCIPAL_NAME(&(val)->referred_server_name);
  3461. }
  3462. ASN1ztcharstring_free((val)->referred_server_realm);
  3463. }
  3464. }
  3465. static int ASN1CALL ASN1Enc_KERB_PA_PAC_REQUEST(ASN1encoding_t enc, ASN1uint32_t tag, KERB_PA_PAC_REQUEST *val)
  3466. {
  3467. ASN1uint32_t nLenOff;
  3468. ASN1uint32_t nLenOff0;
  3469. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  3470. return 0;
  3471. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  3472. return 0;
  3473. if (!ASN1BEREncBool(enc, 0x1, (val)->include_pac))
  3474. return 0;
  3475. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  3476. return 0;
  3477. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  3478. return 0;
  3479. return 1;
  3480. }
  3481. static int ASN1CALL ASN1Dec_KERB_PA_PAC_REQUEST(ASN1decoding_t dec, ASN1uint32_t tag, KERB_PA_PAC_REQUEST *val)
  3482. {
  3483. ASN1decoding_t dd;
  3484. ASN1octet_t *di;
  3485. ASN1decoding_t dd0;
  3486. ASN1octet_t *di0;
  3487. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  3488. return 0;
  3489. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  3490. return 0;
  3491. if (!ASN1BERDecBool(dd0, 0x1, &(val)->include_pac))
  3492. return 0;
  3493. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  3494. return 0;
  3495. if (!ASN1BERDecEndOfContents(dec, dd, di))
  3496. return 0;
  3497. return 1;
  3498. }
  3499. static int ASN1CALL ASN1Enc_KERB_CHANGE_PASSWORD_DATA(ASN1encoding_t enc, ASN1uint32_t tag, KERB_CHANGE_PASSWORD_DATA *val)
  3500. {
  3501. ASN1uint32_t nLenOff;
  3502. ASN1uint32_t nLenOff0;
  3503. ASN1uint32_t t;
  3504. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  3505. return 0;
  3506. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  3507. return 0;
  3508. if (!ASN1DEREncOctetString(enc, 0x4, ((val)->new_password).length, ((val)->new_password).value))
  3509. return 0;
  3510. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  3511. return 0;
  3512. if ((val)->o[0] & 0x80) {
  3513. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  3514. return 0;
  3515. if (!ASN1Enc_KERB_PRINCIPAL_NAME(enc, 0, &(val)->target_name))
  3516. return 0;
  3517. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  3518. return 0;
  3519. }
  3520. if ((val)->o[0] & 0x40) {
  3521. t = lstrlenA((val)->target_realm);
  3522. if (!ASN1BEREncExplicitTag(enc, 0x80000002, &nLenOff0))
  3523. return 0;
  3524. if (!ASN1DEREncCharString(enc, 0x1b, t, (val)->target_realm))
  3525. return 0;
  3526. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  3527. return 0;
  3528. }
  3529. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  3530. return 0;
  3531. return 1;
  3532. }
  3533. static int ASN1CALL ASN1Dec_KERB_CHANGE_PASSWORD_DATA(ASN1decoding_t dec, ASN1uint32_t tag, KERB_CHANGE_PASSWORD_DATA *val)
  3534. {
  3535. ASN1decoding_t dd;
  3536. ASN1octet_t *di;
  3537. ASN1decoding_t dd0;
  3538. ASN1octet_t *di0;
  3539. ASN1uint32_t t;
  3540. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  3541. return 0;
  3542. ZeroMemory((val)->o, 1);
  3543. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  3544. return 0;
  3545. if (!ASN1BERDecOctetString(dd0, 0x4, &(val)->new_password))
  3546. return 0;
  3547. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  3548. return 0;
  3549. ASN1BERDecPeekTag(dd, &t);
  3550. if (t == 0x80000001) {
  3551. (val)->o[0] |= 0x80;
  3552. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  3553. return 0;
  3554. if (!ASN1Dec_KERB_PRINCIPAL_NAME(dd0, 0, &(val)->target_name))
  3555. return 0;
  3556. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  3557. return 0;
  3558. }
  3559. ASN1BERDecPeekTag(dd, &t);
  3560. if (t == 0x80000002) {
  3561. (val)->o[0] |= 0x40;
  3562. if (!ASN1BERDecExplicitTag(dd, 0x80000002, &dd0, &di0))
  3563. return 0;
  3564. if (!ASN1BERDecZeroCharString(dd0, 0x1b, &(val)->target_realm))
  3565. return 0;
  3566. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  3567. return 0;
  3568. }
  3569. if (!ASN1BERDecEndOfContents(dec, dd, di))
  3570. return 0;
  3571. return 1;
  3572. }
  3573. static void ASN1CALL ASN1Free_KERB_CHANGE_PASSWORD_DATA(KERB_CHANGE_PASSWORD_DATA *val)
  3574. {
  3575. if (val) {
  3576. ASN1octetstring_free(&(val)->new_password);
  3577. if ((val)->o[0] & 0x80) {
  3578. ASN1Free_KERB_PRINCIPAL_NAME(&(val)->target_name);
  3579. }
  3580. if ((val)->o[0] & 0x40) {
  3581. ASN1ztcharstring_free((val)->target_realm);
  3582. }
  3583. }
  3584. }
  3585. static int ASN1CALL ASN1Enc_KERB_ERROR_METHOD_DATA(ASN1encoding_t enc, ASN1uint32_t tag, KERB_ERROR_METHOD_DATA *val)
  3586. {
  3587. ASN1uint32_t nLenOff;
  3588. ASN1uint32_t nLenOff0;
  3589. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  3590. return 0;
  3591. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  3592. return 0;
  3593. if (!ASN1BEREncS32(enc, 0x2, (val)->data_type))
  3594. return 0;
  3595. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  3596. return 0;
  3597. if ((val)->o[0] & 0x80) {
  3598. if (!ASN1BEREncExplicitTag(enc, 0x80000002, &nLenOff0))
  3599. return 0;
  3600. if (!ASN1DEREncOctetString(enc, 0x4, ((val)->data_value).length, ((val)->data_value).value))
  3601. return 0;
  3602. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  3603. return 0;
  3604. }
  3605. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  3606. return 0;
  3607. return 1;
  3608. }
  3609. static int ASN1CALL ASN1Dec_KERB_ERROR_METHOD_DATA(ASN1decoding_t dec, ASN1uint32_t tag, KERB_ERROR_METHOD_DATA *val)
  3610. {
  3611. ASN1decoding_t dd;
  3612. ASN1octet_t *di;
  3613. ASN1decoding_t dd0;
  3614. ASN1octet_t *di0;
  3615. ASN1uint32_t t;
  3616. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  3617. return 0;
  3618. ZeroMemory((val)->o, 1);
  3619. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  3620. return 0;
  3621. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->data_type))
  3622. return 0;
  3623. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  3624. return 0;
  3625. ASN1BERDecPeekTag(dd, &t);
  3626. if (t == 0x80000002) {
  3627. (val)->o[0] |= 0x80;
  3628. if (!ASN1BERDecExplicitTag(dd, 0x80000002, &dd0, &di0))
  3629. return 0;
  3630. if (!ASN1BERDecOctetString(dd0, 0x4, &(val)->data_value))
  3631. return 0;
  3632. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  3633. return 0;
  3634. }
  3635. if (!ASN1BERDecEndOfContents(dec, dd, di))
  3636. return 0;
  3637. return 1;
  3638. }
  3639. static void ASN1CALL ASN1Free_KERB_ERROR_METHOD_DATA(KERB_ERROR_METHOD_DATA *val)
  3640. {
  3641. if (val) {
  3642. if ((val)->o[0] & 0x80) {
  3643. ASN1octetstring_free(&(val)->data_value);
  3644. }
  3645. }
  3646. }
  3647. static int ASN1CALL ASN1Enc_KERB_EXT_ERROR(ASN1encoding_t enc, ASN1uint32_t tag, KERB_EXT_ERROR *val)
  3648. {
  3649. ASN1uint32_t nLenOff;
  3650. ASN1uint32_t nLenOff0;
  3651. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  3652. return 0;
  3653. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  3654. return 0;
  3655. if (!ASN1BEREncS32(enc, 0x2, (val)->status))
  3656. return 0;
  3657. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  3658. return 0;
  3659. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  3660. return 0;
  3661. if (!ASN1BEREncS32(enc, 0x2, (val)->klininfo))
  3662. return 0;
  3663. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  3664. return 0;
  3665. if (!ASN1BEREncExplicitTag(enc, 0x80000002, &nLenOff0))
  3666. return 0;
  3667. if (!ASN1BEREncS32(enc, 0x2, (val)->flags))
  3668. return 0;
  3669. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  3670. return 0;
  3671. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  3672. return 0;
  3673. return 1;
  3674. }
  3675. static int ASN1CALL ASN1Dec_KERB_EXT_ERROR(ASN1decoding_t dec, ASN1uint32_t tag, KERB_EXT_ERROR *val)
  3676. {
  3677. ASN1decoding_t dd;
  3678. ASN1octet_t *di;
  3679. ASN1decoding_t dd0;
  3680. ASN1octet_t *di0;
  3681. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  3682. return 0;
  3683. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  3684. return 0;
  3685. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->status))
  3686. return 0;
  3687. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  3688. return 0;
  3689. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  3690. return 0;
  3691. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->klininfo))
  3692. return 0;
  3693. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  3694. return 0;
  3695. if (!ASN1BERDecExplicitTag(dd, 0x80000002, &dd0, &di0))
  3696. return 0;
  3697. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->flags))
  3698. return 0;
  3699. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  3700. return 0;
  3701. if (!ASN1BERDecEndOfContents(dec, dd, di))
  3702. return 0;
  3703. return 1;
  3704. }
  3705. static int ASN1CALL ASN1Enc_TYPED_DATA(ASN1encoding_t enc, ASN1uint32_t tag, PTYPED_DATA *val)
  3706. {
  3707. PTYPED_DATA f;
  3708. ASN1uint32_t nLenOff;
  3709. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  3710. return 0;
  3711. for (f = *val; f; f = f->next) {
  3712. if (!ASN1Enc_KERB_TYPED_DATA(enc, 0, &f->value))
  3713. return 0;
  3714. }
  3715. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  3716. return 0;
  3717. return 1;
  3718. }
  3719. static int ASN1CALL ASN1Dec_TYPED_DATA(ASN1decoding_t dec, ASN1uint32_t tag, PTYPED_DATA *val)
  3720. {
  3721. PTYPED_DATA *f;
  3722. ASN1decoding_t dd;
  3723. ASN1octet_t *di;
  3724. ASN1uint32_t t;
  3725. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  3726. return 0;
  3727. f = val;
  3728. while (ASN1BERDecNotEndOfContents(dd, di)) {
  3729. if (!ASN1BERDecPeekTag(dd, &t))
  3730. return 0;
  3731. if (!(*f = (PTYPED_DATA)ASN1DecAlloc(dd, sizeof(**f))))
  3732. return 0;
  3733. if (!ASN1Dec_KERB_TYPED_DATA(dd, 0, &(*f)->value))
  3734. return 0;
  3735. f = &(*f)->next;
  3736. }
  3737. *f = NULL;
  3738. if (!ASN1BERDecEndOfContents(dec, dd, di))
  3739. return 0;
  3740. return 1;
  3741. }
  3742. static void ASN1CALL ASN1Free_TYPED_DATA(PTYPED_DATA *val)
  3743. {
  3744. PTYPED_DATA f, ff;
  3745. if (val) {
  3746. for (f = *val; f; f = ff) {
  3747. ASN1Free_KERB_TYPED_DATA(&f->value);
  3748. ff = f->next;
  3749. ASN1Free(f);
  3750. }
  3751. }
  3752. }
  3753. static int ASN1CALL ASN1Enc_KERB_PA_FOR_USER(ASN1encoding_t enc, ASN1uint32_t tag, KERB_PA_FOR_USER *val)
  3754. {
  3755. ASN1uint32_t nLenOff;
  3756. ASN1uint32_t t;
  3757. ASN1uint32_t nLenOff0;
  3758. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  3759. return 0;
  3760. t = lstrlenA((val)->client_realm);
  3761. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  3762. return 0;
  3763. if (!ASN1DEREncCharString(enc, 0x1b, t, (val)->client_realm))
  3764. return 0;
  3765. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  3766. return 0;
  3767. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  3768. return 0;
  3769. if (!ASN1Enc_KERB_PRINCIPAL_NAME(enc, 0, &(val)->client_name))
  3770. return 0;
  3771. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  3772. return 0;
  3773. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  3774. return 0;
  3775. return 1;
  3776. }
  3777. static int ASN1CALL ASN1Dec_KERB_PA_FOR_USER(ASN1decoding_t dec, ASN1uint32_t tag, KERB_PA_FOR_USER *val)
  3778. {
  3779. ASN1decoding_t dd;
  3780. ASN1octet_t *di;
  3781. ASN1decoding_t dd0;
  3782. ASN1octet_t *di0;
  3783. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  3784. return 0;
  3785. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  3786. return 0;
  3787. if (!ASN1BERDecZeroCharString(dd0, 0x1b, &(val)->client_realm))
  3788. return 0;
  3789. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  3790. return 0;
  3791. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  3792. return 0;
  3793. if (!ASN1Dec_KERB_PRINCIPAL_NAME(dd0, 0, &(val)->client_name))
  3794. return 0;
  3795. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  3796. return 0;
  3797. if (!ASN1BERDecEndOfContents(dec, dd, di))
  3798. return 0;
  3799. return 1;
  3800. }
  3801. static void ASN1CALL ASN1Free_KERB_PA_FOR_USER(KERB_PA_FOR_USER *val)
  3802. {
  3803. if (val) {
  3804. ASN1ztcharstring_free((val)->client_realm);
  3805. ASN1Free_KERB_PRINCIPAL_NAME(&(val)->client_name);
  3806. }
  3807. }
  3808. static int ASN1CALL ASN1Enc_KERB_KDC_ISSUED_AUTH_DATA_elements(ASN1encoding_t enc, ASN1uint32_t tag, PKERB_KDC_ISSUED_AUTH_DATA_elements *val)
  3809. {
  3810. ASN1uint32_t nLenOff0;
  3811. PKERB_KDC_ISSUED_AUTH_DATA_elements f;
  3812. ASN1uint32_t nLenOff;
  3813. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x80000001, &nLenOff0))
  3814. return 0;
  3815. if (!ASN1BEREncExplicitTag(enc, 0x10, &nLenOff))
  3816. return 0;
  3817. for (f = *val; f; f = f->next) {
  3818. if (!ASN1Enc_KERB_PA_DATA(enc, 0, &f->value))
  3819. return 0;
  3820. }
  3821. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  3822. return 0;
  3823. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  3824. return 0;
  3825. return 1;
  3826. }
  3827. static int ASN1CALL ASN1Dec_KERB_KDC_ISSUED_AUTH_DATA_elements(ASN1decoding_t dec, ASN1uint32_t tag, PKERB_KDC_ISSUED_AUTH_DATA_elements *val)
  3828. {
  3829. PKERB_KDC_ISSUED_AUTH_DATA_elements *f;
  3830. ASN1decoding_t dd0;
  3831. ASN1octet_t *di0;
  3832. ASN1decoding_t dd;
  3833. ASN1octet_t *di;
  3834. ASN1uint32_t t;
  3835. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x80000001, &dd0, &di0))
  3836. return 0;
  3837. if (!ASN1BERDecExplicitTag(dd0, 0x10, &dd, &di))
  3838. return 0;
  3839. f = val;
  3840. while (ASN1BERDecNotEndOfContents(dd, di)) {
  3841. if (!ASN1BERDecPeekTag(dd, &t))
  3842. return 0;
  3843. if (!(*f = (PKERB_KDC_ISSUED_AUTH_DATA_elements)ASN1DecAlloc(dd, sizeof(**f))))
  3844. return 0;
  3845. if (!ASN1Dec_KERB_PA_DATA(dd, 0, &(*f)->value))
  3846. return 0;
  3847. f = &(*f)->next;
  3848. }
  3849. *f = NULL;
  3850. if (!ASN1BERDecEndOfContents(dd0, dd, di))
  3851. return 0;
  3852. if (!ASN1BERDecEndOfContents(dec, dd0, di0))
  3853. return 0;
  3854. return 1;
  3855. }
  3856. static void ASN1CALL ASN1Free_KERB_KDC_ISSUED_AUTH_DATA_elements(PKERB_KDC_ISSUED_AUTH_DATA_elements *val)
  3857. {
  3858. PKERB_KDC_ISSUED_AUTH_DATA_elements f, ff;
  3859. if (val) {
  3860. for (f = *val; f; f = ff) {
  3861. ASN1Free_KERB_PA_DATA(&f->value);
  3862. ff = f->next;
  3863. ASN1Free(f);
  3864. }
  3865. }
  3866. }
  3867. static int ASN1CALL ASN1Enc_KERB_PA_PK_AS_REQ2_trusted_certifiers(ASN1encoding_t enc, ASN1uint32_t tag, PKERB_PA_PK_AS_REQ2_trusted_certifiers *val)
  3868. {
  3869. ASN1uint32_t nLenOff0;
  3870. PKERB_PA_PK_AS_REQ2_trusted_certifiers f;
  3871. ASN1uint32_t nLenOff;
  3872. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x80000002, &nLenOff0))
  3873. return 0;
  3874. if (!ASN1BEREncExplicitTag(enc, 0x10, &nLenOff))
  3875. return 0;
  3876. for (f = *val; f; f = f->next) {
  3877. if (!ASN1Enc_KERB_PRINCIPAL_NAME(enc, 0, &f->value))
  3878. return 0;
  3879. }
  3880. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  3881. return 0;
  3882. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  3883. return 0;
  3884. return 1;
  3885. }
  3886. static int ASN1CALL ASN1Dec_KERB_PA_PK_AS_REQ2_trusted_certifiers(ASN1decoding_t dec, ASN1uint32_t tag, PKERB_PA_PK_AS_REQ2_trusted_certifiers *val)
  3887. {
  3888. PKERB_PA_PK_AS_REQ2_trusted_certifiers *f;
  3889. ASN1decoding_t dd0;
  3890. ASN1octet_t *di0;
  3891. ASN1decoding_t dd;
  3892. ASN1octet_t *di;
  3893. ASN1uint32_t t;
  3894. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x80000002, &dd0, &di0))
  3895. return 0;
  3896. if (!ASN1BERDecExplicitTag(dd0, 0x10, &dd, &di))
  3897. return 0;
  3898. f = val;
  3899. while (ASN1BERDecNotEndOfContents(dd, di)) {
  3900. if (!ASN1BERDecPeekTag(dd, &t))
  3901. return 0;
  3902. if (!(*f = (PKERB_PA_PK_AS_REQ2_trusted_certifiers)ASN1DecAlloc(dd, sizeof(**f))))
  3903. return 0;
  3904. if (!ASN1Dec_KERB_PRINCIPAL_NAME(dd, 0, &(*f)->value))
  3905. return 0;
  3906. f = &(*f)->next;
  3907. }
  3908. *f = NULL;
  3909. if (!ASN1BERDecEndOfContents(dd0, dd, di))
  3910. return 0;
  3911. if (!ASN1BERDecEndOfContents(dec, dd0, di0))
  3912. return 0;
  3913. return 1;
  3914. }
  3915. static void ASN1CALL ASN1Free_KERB_PA_PK_AS_REQ2_trusted_certifiers(PKERB_PA_PK_AS_REQ2_trusted_certifiers *val)
  3916. {
  3917. PKERB_PA_PK_AS_REQ2_trusted_certifiers f, ff;
  3918. if (val) {
  3919. for (f = *val; f; f = ff) {
  3920. ASN1Free_KERB_PRINCIPAL_NAME(&f->value);
  3921. ff = f->next;
  3922. ASN1Free(f);
  3923. }
  3924. }
  3925. }
  3926. static int ASN1CALL ASN1Enc_KERB_PA_PK_AS_REQ2_user_certs(ASN1encoding_t enc, ASN1uint32_t tag, PKERB_PA_PK_AS_REQ2_user_certs *val)
  3927. {
  3928. ASN1uint32_t nLenOff0;
  3929. PKERB_PA_PK_AS_REQ2_user_certs f;
  3930. ASN1uint32_t nLenOff;
  3931. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x80000001, &nLenOff0))
  3932. return 0;
  3933. if (!ASN1BEREncExplicitTag(enc, 0x10, &nLenOff))
  3934. return 0;
  3935. for (f = *val; f; f = f->next) {
  3936. if (!ASN1Enc_KERB_CERTIFICATE(enc, 0, &f->value))
  3937. return 0;
  3938. }
  3939. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  3940. return 0;
  3941. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  3942. return 0;
  3943. return 1;
  3944. }
  3945. static int ASN1CALL ASN1Dec_KERB_PA_PK_AS_REQ2_user_certs(ASN1decoding_t dec, ASN1uint32_t tag, PKERB_PA_PK_AS_REQ2_user_certs *val)
  3946. {
  3947. PKERB_PA_PK_AS_REQ2_user_certs *f;
  3948. ASN1decoding_t dd0;
  3949. ASN1octet_t *di0;
  3950. ASN1decoding_t dd;
  3951. ASN1octet_t *di;
  3952. ASN1uint32_t t;
  3953. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x80000001, &dd0, &di0))
  3954. return 0;
  3955. if (!ASN1BERDecExplicitTag(dd0, 0x10, &dd, &di))
  3956. return 0;
  3957. f = val;
  3958. while (ASN1BERDecNotEndOfContents(dd, di)) {
  3959. if (!ASN1BERDecPeekTag(dd, &t))
  3960. return 0;
  3961. if (!(*f = (PKERB_PA_PK_AS_REQ2_user_certs)ASN1DecAlloc(dd, sizeof(**f))))
  3962. return 0;
  3963. if (!ASN1Dec_KERB_CERTIFICATE(dd, 0, &(*f)->value))
  3964. return 0;
  3965. f = &(*f)->next;
  3966. }
  3967. *f = NULL;
  3968. if (!ASN1BERDecEndOfContents(dd0, dd, di))
  3969. return 0;
  3970. if (!ASN1BERDecEndOfContents(dec, dd0, di0))
  3971. return 0;
  3972. return 1;
  3973. }
  3974. static void ASN1CALL ASN1Free_KERB_PA_PK_AS_REQ2_user_certs(PKERB_PA_PK_AS_REQ2_user_certs *val)
  3975. {
  3976. PKERB_PA_PK_AS_REQ2_user_certs f, ff;
  3977. if (val) {
  3978. for (f = *val; f; f = ff) {
  3979. ASN1Free_KERB_CERTIFICATE(&f->value);
  3980. ff = f->next;
  3981. ASN1Free(f);
  3982. }
  3983. }
  3984. }
  3985. static int ASN1CALL ASN1Enc_KERB_PA_PK_AS_REP2_kdc_cert(ASN1encoding_t enc, ASN1uint32_t tag, PKERB_PA_PK_AS_REP2_kdc_cert *val)
  3986. {
  3987. ASN1uint32_t nLenOff0;
  3988. PKERB_PA_PK_AS_REP2_kdc_cert f;
  3989. ASN1uint32_t nLenOff;
  3990. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x80000003, &nLenOff0))
  3991. return 0;
  3992. if (!ASN1BEREncExplicitTag(enc, 0x10, &nLenOff))
  3993. return 0;
  3994. for (f = *val; f; f = f->next) {
  3995. if (!ASN1Enc_KERB_CERTIFICATE(enc, 0, &f->value))
  3996. return 0;
  3997. }
  3998. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  3999. return 0;
  4000. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4001. return 0;
  4002. return 1;
  4003. }
  4004. static int ASN1CALL ASN1Dec_KERB_PA_PK_AS_REP2_kdc_cert(ASN1decoding_t dec, ASN1uint32_t tag, PKERB_PA_PK_AS_REP2_kdc_cert *val)
  4005. {
  4006. PKERB_PA_PK_AS_REP2_kdc_cert *f;
  4007. ASN1decoding_t dd0;
  4008. ASN1octet_t *di0;
  4009. ASN1decoding_t dd;
  4010. ASN1octet_t *di;
  4011. ASN1uint32_t t;
  4012. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x80000003, &dd0, &di0))
  4013. return 0;
  4014. if (!ASN1BERDecExplicitTag(dd0, 0x10, &dd, &di))
  4015. return 0;
  4016. f = val;
  4017. while (ASN1BERDecNotEndOfContents(dd, di)) {
  4018. if (!ASN1BERDecPeekTag(dd, &t))
  4019. return 0;
  4020. if (!(*f = (PKERB_PA_PK_AS_REP2_kdc_cert)ASN1DecAlloc(dd, sizeof(**f))))
  4021. return 0;
  4022. if (!ASN1Dec_KERB_CERTIFICATE(dd, 0, &(*f)->value))
  4023. return 0;
  4024. f = &(*f)->next;
  4025. }
  4026. *f = NULL;
  4027. if (!ASN1BERDecEndOfContents(dd0, dd, di))
  4028. return 0;
  4029. if (!ASN1BERDecEndOfContents(dec, dd0, di0))
  4030. return 0;
  4031. return 1;
  4032. }
  4033. static void ASN1CALL ASN1Free_KERB_PA_PK_AS_REP2_kdc_cert(PKERB_PA_PK_AS_REP2_kdc_cert *val)
  4034. {
  4035. PKERB_PA_PK_AS_REP2_kdc_cert f, ff;
  4036. if (val) {
  4037. for (f = *val; f; f = ff) {
  4038. ASN1Free_KERB_CERTIFICATE(&f->value);
  4039. ff = f->next;
  4040. ASN1Free(f);
  4041. }
  4042. }
  4043. }
  4044. static int ASN1CALL ASN1Enc_KERB_ENCRYPTED_KDC_REPLY_encrypted_pa_data(ASN1encoding_t enc, ASN1uint32_t tag, PKERB_ENCRYPTED_KDC_REPLY_encrypted_pa_data *val)
  4045. {
  4046. ASN1uint32_t nLenOff0;
  4047. PKERB_ENCRYPTED_KDC_REPLY_encrypted_pa_data f;
  4048. ASN1uint32_t nLenOff;
  4049. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x8000000c, &nLenOff0))
  4050. return 0;
  4051. if (!ASN1BEREncExplicitTag(enc, 0x10, &nLenOff))
  4052. return 0;
  4053. for (f = *val; f; f = f->next) {
  4054. if (!ASN1Enc_KERB_PA_DATA(enc, 0, &f->value))
  4055. return 0;
  4056. }
  4057. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  4058. return 0;
  4059. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4060. return 0;
  4061. return 1;
  4062. }
  4063. static int ASN1CALL ASN1Dec_KERB_ENCRYPTED_KDC_REPLY_encrypted_pa_data(ASN1decoding_t dec, ASN1uint32_t tag, PKERB_ENCRYPTED_KDC_REPLY_encrypted_pa_data *val)
  4064. {
  4065. PKERB_ENCRYPTED_KDC_REPLY_encrypted_pa_data *f;
  4066. ASN1decoding_t dd0;
  4067. ASN1octet_t *di0;
  4068. ASN1decoding_t dd;
  4069. ASN1octet_t *di;
  4070. ASN1uint32_t t;
  4071. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x8000000c, &dd0, &di0))
  4072. return 0;
  4073. if (!ASN1BERDecExplicitTag(dd0, 0x10, &dd, &di))
  4074. return 0;
  4075. f = val;
  4076. while (ASN1BERDecNotEndOfContents(dd, di)) {
  4077. if (!ASN1BERDecPeekTag(dd, &t))
  4078. return 0;
  4079. if (!(*f = (PKERB_ENCRYPTED_KDC_REPLY_encrypted_pa_data)ASN1DecAlloc(dd, sizeof(**f))))
  4080. return 0;
  4081. if (!ASN1Dec_KERB_PA_DATA(dd, 0, &(*f)->value))
  4082. return 0;
  4083. f = &(*f)->next;
  4084. }
  4085. *f = NULL;
  4086. if (!ASN1BERDecEndOfContents(dd0, dd, di))
  4087. return 0;
  4088. if (!ASN1BERDecEndOfContents(dec, dd0, di0))
  4089. return 0;
  4090. return 1;
  4091. }
  4092. static void ASN1CALL ASN1Free_KERB_ENCRYPTED_KDC_REPLY_encrypted_pa_data(PKERB_ENCRYPTED_KDC_REPLY_encrypted_pa_data *val)
  4093. {
  4094. PKERB_ENCRYPTED_KDC_REPLY_encrypted_pa_data f, ff;
  4095. if (val) {
  4096. for (f = *val; f; f = ff) {
  4097. ASN1Free_KERB_PA_DATA(&f->value);
  4098. ff = f->next;
  4099. ASN1Free(f);
  4100. }
  4101. }
  4102. }
  4103. static int ASN1CALL ASN1Enc_KERB_KDC_REPLY_preauth_data(ASN1encoding_t enc, ASN1uint32_t tag, PKERB_KDC_REPLY_preauth_data *val)
  4104. {
  4105. ASN1uint32_t nLenOff0;
  4106. PKERB_KDC_REPLY_preauth_data f;
  4107. ASN1uint32_t nLenOff;
  4108. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x80000002, &nLenOff0))
  4109. return 0;
  4110. if (!ASN1BEREncExplicitTag(enc, 0x10, &nLenOff))
  4111. return 0;
  4112. for (f = *val; f; f = f->next) {
  4113. if (!ASN1Enc_KERB_PA_DATA(enc, 0, &f->value))
  4114. return 0;
  4115. }
  4116. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  4117. return 0;
  4118. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4119. return 0;
  4120. return 1;
  4121. }
  4122. static int ASN1CALL ASN1Dec_KERB_KDC_REPLY_preauth_data(ASN1decoding_t dec, ASN1uint32_t tag, PKERB_KDC_REPLY_preauth_data *val)
  4123. {
  4124. PKERB_KDC_REPLY_preauth_data *f;
  4125. ASN1decoding_t dd0;
  4126. ASN1octet_t *di0;
  4127. ASN1decoding_t dd;
  4128. ASN1octet_t *di;
  4129. ASN1uint32_t t;
  4130. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x80000002, &dd0, &di0))
  4131. return 0;
  4132. if (!ASN1BERDecExplicitTag(dd0, 0x10, &dd, &di))
  4133. return 0;
  4134. f = val;
  4135. while (ASN1BERDecNotEndOfContents(dd, di)) {
  4136. if (!ASN1BERDecPeekTag(dd, &t))
  4137. return 0;
  4138. if (!(*f = (PKERB_KDC_REPLY_preauth_data)ASN1DecAlloc(dd, sizeof(**f))))
  4139. return 0;
  4140. if (!ASN1Dec_KERB_PA_DATA(dd, 0, &(*f)->value))
  4141. return 0;
  4142. f = &(*f)->next;
  4143. }
  4144. *f = NULL;
  4145. if (!ASN1BERDecEndOfContents(dd0, dd, di))
  4146. return 0;
  4147. if (!ASN1BERDecEndOfContents(dec, dd0, di0))
  4148. return 0;
  4149. return 1;
  4150. }
  4151. static void ASN1CALL ASN1Free_KERB_KDC_REPLY_preauth_data(PKERB_KDC_REPLY_preauth_data *val)
  4152. {
  4153. PKERB_KDC_REPLY_preauth_data f, ff;
  4154. if (val) {
  4155. for (f = *val; f; f = ff) {
  4156. ASN1Free_KERB_PA_DATA(&f->value);
  4157. ff = f->next;
  4158. ASN1Free(f);
  4159. }
  4160. }
  4161. }
  4162. static int ASN1CALL ASN1Enc_KERB_KDC_REQUEST_preauth_data(ASN1encoding_t enc, ASN1uint32_t tag, PKERB_KDC_REQUEST_preauth_data *val)
  4163. {
  4164. ASN1uint32_t nLenOff0;
  4165. PKERB_KDC_REQUEST_preauth_data f;
  4166. ASN1uint32_t nLenOff;
  4167. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x80000003, &nLenOff0))
  4168. return 0;
  4169. if (!ASN1BEREncExplicitTag(enc, 0x10, &nLenOff))
  4170. return 0;
  4171. for (f = *val; f; f = f->next) {
  4172. if (!ASN1Enc_KERB_PA_DATA(enc, 0, &f->value))
  4173. return 0;
  4174. }
  4175. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  4176. return 0;
  4177. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4178. return 0;
  4179. return 1;
  4180. }
  4181. static int ASN1CALL ASN1Dec_KERB_KDC_REQUEST_preauth_data(ASN1decoding_t dec, ASN1uint32_t tag, PKERB_KDC_REQUEST_preauth_data *val)
  4182. {
  4183. PKERB_KDC_REQUEST_preauth_data *f;
  4184. ASN1decoding_t dd0;
  4185. ASN1octet_t *di0;
  4186. ASN1decoding_t dd;
  4187. ASN1octet_t *di;
  4188. ASN1uint32_t t;
  4189. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x80000003, &dd0, &di0))
  4190. return 0;
  4191. if (!ASN1BERDecExplicitTag(dd0, 0x10, &dd, &di))
  4192. return 0;
  4193. f = val;
  4194. while (ASN1BERDecNotEndOfContents(dd, di)) {
  4195. if (!ASN1BERDecPeekTag(dd, &t))
  4196. return 0;
  4197. if (!(*f = (PKERB_KDC_REQUEST_preauth_data)ASN1DecAlloc(dd, sizeof(**f))))
  4198. return 0;
  4199. if (!ASN1Dec_KERB_PA_DATA(dd, 0, &(*f)->value))
  4200. return 0;
  4201. f = &(*f)->next;
  4202. }
  4203. *f = NULL;
  4204. if (!ASN1BERDecEndOfContents(dd0, dd, di))
  4205. return 0;
  4206. if (!ASN1BERDecEndOfContents(dec, dd0, di0))
  4207. return 0;
  4208. return 1;
  4209. }
  4210. static void ASN1CALL ASN1Free_KERB_KDC_REQUEST_preauth_data(PKERB_KDC_REQUEST_preauth_data *val)
  4211. {
  4212. PKERB_KDC_REQUEST_preauth_data f, ff;
  4213. if (val) {
  4214. for (f = *val; f; f = ff) {
  4215. ASN1Free_KERB_PA_DATA(&f->value);
  4216. ff = f->next;
  4217. ASN1Free(f);
  4218. }
  4219. }
  4220. }
  4221. static int ASN1CALL ASN1Enc_KERB_TICKET(ASN1encoding_t enc, ASN1uint32_t tag, KERB_TICKET *val)
  4222. {
  4223. ASN1uint32_t nExplTagLenOff0;
  4224. ASN1uint32_t nLenOff;
  4225. ASN1uint32_t nLenOff0;
  4226. ASN1uint32_t t;
  4227. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x40000001, &nExplTagLenOff0))
  4228. return 0;
  4229. if (!ASN1BEREncExplicitTag(enc, 0x10, &nLenOff))
  4230. return 0;
  4231. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  4232. return 0;
  4233. if (!ASN1BEREncS32(enc, 0x2, (val)->ticket_version))
  4234. return 0;
  4235. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4236. return 0;
  4237. t = lstrlenA((val)->realm);
  4238. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  4239. return 0;
  4240. if (!ASN1DEREncCharString(enc, 0x1b, t, (val)->realm))
  4241. return 0;
  4242. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4243. return 0;
  4244. if (!ASN1BEREncExplicitTag(enc, 0x80000002, &nLenOff0))
  4245. return 0;
  4246. if (!ASN1Enc_KERB_PRINCIPAL_NAME(enc, 0, &(val)->server_name))
  4247. return 0;
  4248. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4249. return 0;
  4250. if (!ASN1BEREncExplicitTag(enc, 0x80000003, &nLenOff0))
  4251. return 0;
  4252. if (!ASN1Enc_KERB_ENCRYPTED_DATA(enc, 0, &(val)->encrypted_part))
  4253. return 0;
  4254. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4255. return 0;
  4256. if ((val)->o[0] & 0x80) {
  4257. if (!ASN1BEREncExplicitTag(enc, 0x80000004, &nLenOff0))
  4258. return 0;
  4259. if (!ASN1Enc_PKERB_TICKET_EXTENSIONS(enc, 0, &(val)->ticket_extensions))
  4260. return 0;
  4261. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4262. return 0;
  4263. }
  4264. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  4265. return 0;
  4266. if (!ASN1BEREncEndOfContents(enc, nExplTagLenOff0))
  4267. return 0;
  4268. return 1;
  4269. }
  4270. static int ASN1CALL ASN1Dec_KERB_TICKET(ASN1decoding_t dec, ASN1uint32_t tag, KERB_TICKET *val)
  4271. {
  4272. ASN1decoding_t dd;
  4273. ASN1octet_t *di;
  4274. ASN1decoding_t pExplTagDec0;
  4275. ASN1octet_t *pbExplTagDataEnd0;
  4276. ASN1decoding_t dd0;
  4277. ASN1octet_t *di0;
  4278. ASN1uint32_t t;
  4279. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x40000001, &pExplTagDec0, &pbExplTagDataEnd0))
  4280. return 0;
  4281. if (!ASN1BERDecExplicitTag(pExplTagDec0, 0x10, &dd, &di))
  4282. return 0;
  4283. ZeroMemory((val)->o, 1);
  4284. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  4285. return 0;
  4286. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->ticket_version))
  4287. return 0;
  4288. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4289. return 0;
  4290. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  4291. return 0;
  4292. if (!ASN1BERDecZeroCharString(dd0, 0x1b, &(val)->realm))
  4293. return 0;
  4294. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4295. return 0;
  4296. if (!ASN1BERDecExplicitTag(dd, 0x80000002, &dd0, &di0))
  4297. return 0;
  4298. if (!ASN1Dec_KERB_PRINCIPAL_NAME(dd0, 0, &(val)->server_name))
  4299. return 0;
  4300. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4301. return 0;
  4302. if (!ASN1BERDecExplicitTag(dd, 0x80000003, &dd0, &di0))
  4303. return 0;
  4304. if (!ASN1Dec_KERB_ENCRYPTED_DATA(dd0, 0, &(val)->encrypted_part))
  4305. return 0;
  4306. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4307. return 0;
  4308. ASN1BERDecPeekTag(dd, &t);
  4309. if (t == 0x80000004) {
  4310. (val)->o[0] |= 0x80;
  4311. if (!ASN1BERDecExplicitTag(dd, 0x80000004, &dd0, &di0))
  4312. return 0;
  4313. if (!ASN1Dec_PKERB_TICKET_EXTENSIONS(dd0, 0, &(val)->ticket_extensions))
  4314. return 0;
  4315. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4316. return 0;
  4317. }
  4318. if (!ASN1BERDecEndOfContents(pExplTagDec0, dd, di))
  4319. return 0;
  4320. if (!ASN1BERDecEndOfContents(dec, pExplTagDec0, pbExplTagDataEnd0))
  4321. return 0;
  4322. return 1;
  4323. }
  4324. static void ASN1CALL ASN1Free_KERB_TICKET(KERB_TICKET *val)
  4325. {
  4326. if (val) {
  4327. ASN1ztcharstring_free((val)->realm);
  4328. ASN1Free_KERB_PRINCIPAL_NAME(&(val)->server_name);
  4329. ASN1Free_KERB_ENCRYPTED_DATA(&(val)->encrypted_part);
  4330. if ((val)->o[0] & 0x80) {
  4331. ASN1Free_PKERB_TICKET_EXTENSIONS(&(val)->ticket_extensions);
  4332. }
  4333. }
  4334. }
  4335. static int ASN1CALL ASN1Enc_KERB_ENCRYPTED_TICKET(ASN1encoding_t enc, ASN1uint32_t tag, KERB_ENCRYPTED_TICKET *val)
  4336. {
  4337. ASN1uint32_t nExplTagLenOff0;
  4338. ASN1uint32_t nLenOff;
  4339. ASN1uint32_t nLenOff0;
  4340. ASN1uint32_t t;
  4341. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x40000003, &nExplTagLenOff0))
  4342. return 0;
  4343. if (!ASN1BEREncExplicitTag(enc, 0x10, &nLenOff))
  4344. return 0;
  4345. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  4346. return 0;
  4347. if (!ASN1DEREncBitString(enc, 0x3, ((val)->flags).length, ((val)->flags).value))
  4348. return 0;
  4349. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4350. return 0;
  4351. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  4352. return 0;
  4353. if (!ASN1Enc_KERB_ENCRYPTION_KEY(enc, 0, &(val)->key))
  4354. return 0;
  4355. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4356. return 0;
  4357. t = lstrlenA((val)->client_realm);
  4358. if (!ASN1BEREncExplicitTag(enc, 0x80000002, &nLenOff0))
  4359. return 0;
  4360. if (!ASN1DEREncCharString(enc, 0x1b, t, (val)->client_realm))
  4361. return 0;
  4362. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4363. return 0;
  4364. if (!ASN1BEREncExplicitTag(enc, 0x80000003, &nLenOff0))
  4365. return 0;
  4366. if (!ASN1Enc_KERB_PRINCIPAL_NAME(enc, 0, &(val)->client_name))
  4367. return 0;
  4368. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4369. return 0;
  4370. if (!ASN1BEREncExplicitTag(enc, 0x80000004, &nLenOff0))
  4371. return 0;
  4372. if (!ASN1Enc_KERB_TRANSITED_ENCODING(enc, 0, &(val)->transited))
  4373. return 0;
  4374. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4375. return 0;
  4376. if (!ASN1BEREncExplicitTag(enc, 0x80000005, &nLenOff0))
  4377. return 0;
  4378. if (!ASN1DEREncGeneralizedTime(enc, 0x18, &(val)->authtime))
  4379. return 0;
  4380. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4381. return 0;
  4382. if ((val)->o[0] & 0x80) {
  4383. if (!ASN1BEREncExplicitTag(enc, 0x80000006, &nLenOff0))
  4384. return 0;
  4385. if (!ASN1DEREncGeneralizedTime(enc, 0x18, &(val)->starttime))
  4386. return 0;
  4387. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4388. return 0;
  4389. }
  4390. if (!ASN1BEREncExplicitTag(enc, 0x80000007, &nLenOff0))
  4391. return 0;
  4392. if (!ASN1DEREncGeneralizedTime(enc, 0x18, &(val)->endtime))
  4393. return 0;
  4394. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4395. return 0;
  4396. if ((val)->o[0] & 0x40) {
  4397. if (!ASN1BEREncExplicitTag(enc, 0x80000008, &nLenOff0))
  4398. return 0;
  4399. if (!ASN1DEREncGeneralizedTime(enc, 0x18, &(val)->renew_until))
  4400. return 0;
  4401. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4402. return 0;
  4403. }
  4404. if ((val)->o[0] & 0x20) {
  4405. if (!ASN1BEREncExplicitTag(enc, 0x80000009, &nLenOff0))
  4406. return 0;
  4407. if (!ASN1Enc_PKERB_HOST_ADDRESSES(enc, 0, &(val)->client_addresses))
  4408. return 0;
  4409. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4410. return 0;
  4411. }
  4412. if ((val)->o[0] & 0x10) {
  4413. if (!ASN1BEREncExplicitTag(enc, 0x8000000a, &nLenOff0))
  4414. return 0;
  4415. if (!ASN1Enc_PKERB_AUTHORIZATION_DATA(enc, 0, &(val)->authorization_data))
  4416. return 0;
  4417. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4418. return 0;
  4419. }
  4420. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  4421. return 0;
  4422. if (!ASN1BEREncEndOfContents(enc, nExplTagLenOff0))
  4423. return 0;
  4424. return 1;
  4425. }
  4426. static int ASN1CALL ASN1Dec_KERB_ENCRYPTED_TICKET(ASN1decoding_t dec, ASN1uint32_t tag, KERB_ENCRYPTED_TICKET *val)
  4427. {
  4428. ASN1decoding_t dd;
  4429. ASN1octet_t *di;
  4430. ASN1decoding_t pExplTagDec0;
  4431. ASN1octet_t *pbExplTagDataEnd0;
  4432. ASN1decoding_t dd0;
  4433. ASN1octet_t *di0;
  4434. ASN1uint32_t t;
  4435. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x40000003, &pExplTagDec0, &pbExplTagDataEnd0))
  4436. return 0;
  4437. if (!ASN1BERDecExplicitTag(pExplTagDec0, 0x10, &dd, &di))
  4438. return 0;
  4439. ZeroMemory((val)->o, 1);
  4440. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  4441. return 0;
  4442. if (!ASN1BERDecBitString(dd0, 0x3, &(val)->flags))
  4443. return 0;
  4444. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4445. return 0;
  4446. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  4447. return 0;
  4448. if (!ASN1Dec_KERB_ENCRYPTION_KEY(dd0, 0, &(val)->key))
  4449. return 0;
  4450. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4451. return 0;
  4452. if (!ASN1BERDecExplicitTag(dd, 0x80000002, &dd0, &di0))
  4453. return 0;
  4454. if (!ASN1BERDecZeroCharString(dd0, 0x1b, &(val)->client_realm))
  4455. return 0;
  4456. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4457. return 0;
  4458. if (!ASN1BERDecExplicitTag(dd, 0x80000003, &dd0, &di0))
  4459. return 0;
  4460. if (!ASN1Dec_KERB_PRINCIPAL_NAME(dd0, 0, &(val)->client_name))
  4461. return 0;
  4462. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4463. return 0;
  4464. if (!ASN1BERDecExplicitTag(dd, 0x80000004, &dd0, &di0))
  4465. return 0;
  4466. if (!ASN1Dec_KERB_TRANSITED_ENCODING(dd0, 0, &(val)->transited))
  4467. return 0;
  4468. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4469. return 0;
  4470. if (!ASN1BERDecExplicitTag(dd, 0x80000005, &dd0, &di0))
  4471. return 0;
  4472. if (!ASN1BERDecGeneralizedTime(dd0, 0x18, &(val)->authtime))
  4473. return 0;
  4474. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4475. return 0;
  4476. ASN1BERDecPeekTag(dd, &t);
  4477. if (t == 0x80000006) {
  4478. (val)->o[0] |= 0x80;
  4479. if (!ASN1BERDecExplicitTag(dd, 0x80000006, &dd0, &di0))
  4480. return 0;
  4481. if (!ASN1BERDecGeneralizedTime(dd0, 0x18, &(val)->starttime))
  4482. return 0;
  4483. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4484. return 0;
  4485. }
  4486. if (!ASN1BERDecExplicitTag(dd, 0x80000007, &dd0, &di0))
  4487. return 0;
  4488. if (!ASN1BERDecGeneralizedTime(dd0, 0x18, &(val)->endtime))
  4489. return 0;
  4490. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4491. return 0;
  4492. ASN1BERDecPeekTag(dd, &t);
  4493. if (t == 0x80000008) {
  4494. (val)->o[0] |= 0x40;
  4495. if (!ASN1BERDecExplicitTag(dd, 0x80000008, &dd0, &di0))
  4496. return 0;
  4497. if (!ASN1BERDecGeneralizedTime(dd0, 0x18, &(val)->renew_until))
  4498. return 0;
  4499. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4500. return 0;
  4501. }
  4502. ASN1BERDecPeekTag(dd, &t);
  4503. if (t == 0x80000009) {
  4504. (val)->o[0] |= 0x20;
  4505. if (!ASN1BERDecExplicitTag(dd, 0x80000009, &dd0, &di0))
  4506. return 0;
  4507. if (!ASN1Dec_PKERB_HOST_ADDRESSES(dd0, 0, &(val)->client_addresses))
  4508. return 0;
  4509. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4510. return 0;
  4511. }
  4512. ASN1BERDecPeekTag(dd, &t);
  4513. if (t == 0x8000000a) {
  4514. (val)->o[0] |= 0x10;
  4515. if (!ASN1BERDecExplicitTag(dd, 0x8000000a, &dd0, &di0))
  4516. return 0;
  4517. if (!ASN1Dec_PKERB_AUTHORIZATION_DATA(dd0, 0, &(val)->authorization_data))
  4518. return 0;
  4519. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4520. return 0;
  4521. }
  4522. if (!ASN1BERDecEndOfContents(pExplTagDec0, dd, di))
  4523. return 0;
  4524. if (!ASN1BERDecEndOfContents(dec, pExplTagDec0, pbExplTagDataEnd0))
  4525. return 0;
  4526. return 1;
  4527. }
  4528. static void ASN1CALL ASN1Free_KERB_ENCRYPTED_TICKET(KERB_ENCRYPTED_TICKET *val)
  4529. {
  4530. if (val) {
  4531. ASN1bitstring_free(&(val)->flags);
  4532. ASN1Free_KERB_ENCRYPTION_KEY(&(val)->key);
  4533. ASN1ztcharstring_free((val)->client_realm);
  4534. ASN1Free_KERB_PRINCIPAL_NAME(&(val)->client_name);
  4535. ASN1Free_KERB_TRANSITED_ENCODING(&(val)->transited);
  4536. if ((val)->o[0] & 0x80) {
  4537. }
  4538. if ((val)->o[0] & 0x40) {
  4539. }
  4540. if ((val)->o[0] & 0x20) {
  4541. ASN1Free_PKERB_HOST_ADDRESSES(&(val)->client_addresses);
  4542. }
  4543. if ((val)->o[0] & 0x10) {
  4544. ASN1Free_PKERB_AUTHORIZATION_DATA(&(val)->authorization_data);
  4545. }
  4546. }
  4547. }
  4548. static int ASN1CALL ASN1Enc_KERB_AUTHENTICATOR(ASN1encoding_t enc, ASN1uint32_t tag, KERB_AUTHENTICATOR *val)
  4549. {
  4550. ASN1uint32_t nExplTagLenOff0;
  4551. ASN1uint32_t nLenOff;
  4552. ASN1uint32_t nLenOff0;
  4553. ASN1uint32_t t;
  4554. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x40000002, &nExplTagLenOff0))
  4555. return 0;
  4556. if (!ASN1BEREncExplicitTag(enc, 0x10, &nLenOff))
  4557. return 0;
  4558. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  4559. return 0;
  4560. if (!ASN1BEREncS32(enc, 0x2, (val)->authenticator_version))
  4561. return 0;
  4562. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4563. return 0;
  4564. t = lstrlenA((val)->client_realm);
  4565. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  4566. return 0;
  4567. if (!ASN1DEREncCharString(enc, 0x1b, t, (val)->client_realm))
  4568. return 0;
  4569. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4570. return 0;
  4571. if (!ASN1BEREncExplicitTag(enc, 0x80000002, &nLenOff0))
  4572. return 0;
  4573. if (!ASN1Enc_KERB_PRINCIPAL_NAME(enc, 0, &(val)->client_name))
  4574. return 0;
  4575. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4576. return 0;
  4577. if ((val)->o[0] & 0x80) {
  4578. if (!ASN1BEREncExplicitTag(enc, 0x80000003, &nLenOff0))
  4579. return 0;
  4580. if (!ASN1Enc_KERB_CHECKSUM(enc, 0, &(val)->checksum))
  4581. return 0;
  4582. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4583. return 0;
  4584. }
  4585. if (!ASN1BEREncExplicitTag(enc, 0x80000004, &nLenOff0))
  4586. return 0;
  4587. if (!ASN1BEREncS32(enc, 0x2, (val)->client_usec))
  4588. return 0;
  4589. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4590. return 0;
  4591. if (!ASN1BEREncExplicitTag(enc, 0x80000005, &nLenOff0))
  4592. return 0;
  4593. if (!ASN1DEREncGeneralizedTime(enc, 0x18, &(val)->client_time))
  4594. return 0;
  4595. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4596. return 0;
  4597. if ((val)->o[0] & 0x40) {
  4598. if (!ASN1BEREncExplicitTag(enc, 0x80000006, &nLenOff0))
  4599. return 0;
  4600. if (!ASN1Enc_KERB_ENCRYPTION_KEY(enc, 0, &(val)->subkey))
  4601. return 0;
  4602. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4603. return 0;
  4604. }
  4605. if ((val)->o[0] & 0x20) {
  4606. if (!ASN1BEREncExplicitTag(enc, 0x80000007, &nLenOff0))
  4607. return 0;
  4608. if (!ASN1BEREncSX(enc, 0x2, &(val)->sequence_number))
  4609. return 0;
  4610. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4611. return 0;
  4612. }
  4613. if ((val)->o[0] & 0x10) {
  4614. if (!ASN1BEREncExplicitTag(enc, 0x80000008, &nLenOff0))
  4615. return 0;
  4616. if (!ASN1Enc_PKERB_AUTHORIZATION_DATA(enc, 0, &(val)->authorization_data))
  4617. return 0;
  4618. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4619. return 0;
  4620. }
  4621. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  4622. return 0;
  4623. if (!ASN1BEREncEndOfContents(enc, nExplTagLenOff0))
  4624. return 0;
  4625. return 1;
  4626. }
  4627. static int ASN1CALL ASN1Dec_KERB_AUTHENTICATOR(ASN1decoding_t dec, ASN1uint32_t tag, KERB_AUTHENTICATOR *val)
  4628. {
  4629. ASN1decoding_t dd;
  4630. ASN1octet_t *di;
  4631. ASN1decoding_t pExplTagDec0;
  4632. ASN1octet_t *pbExplTagDataEnd0;
  4633. ASN1decoding_t dd0;
  4634. ASN1octet_t *di0;
  4635. ASN1uint32_t t;
  4636. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x40000002, &pExplTagDec0, &pbExplTagDataEnd0))
  4637. return 0;
  4638. if (!ASN1BERDecExplicitTag(pExplTagDec0, 0x10, &dd, &di))
  4639. return 0;
  4640. ZeroMemory((val)->o, 1);
  4641. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  4642. return 0;
  4643. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->authenticator_version))
  4644. return 0;
  4645. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4646. return 0;
  4647. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  4648. return 0;
  4649. if (!ASN1BERDecZeroCharString(dd0, 0x1b, &(val)->client_realm))
  4650. return 0;
  4651. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4652. return 0;
  4653. if (!ASN1BERDecExplicitTag(dd, 0x80000002, &dd0, &di0))
  4654. return 0;
  4655. if (!ASN1Dec_KERB_PRINCIPAL_NAME(dd0, 0, &(val)->client_name))
  4656. return 0;
  4657. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4658. return 0;
  4659. ASN1BERDecPeekTag(dd, &t);
  4660. if (t == 0x80000003) {
  4661. (val)->o[0] |= 0x80;
  4662. if (!ASN1BERDecExplicitTag(dd, 0x80000003, &dd0, &di0))
  4663. return 0;
  4664. if (!ASN1Dec_KERB_CHECKSUM(dd0, 0, &(val)->checksum))
  4665. return 0;
  4666. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4667. return 0;
  4668. }
  4669. if (!ASN1BERDecExplicitTag(dd, 0x80000004, &dd0, &di0))
  4670. return 0;
  4671. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->client_usec))
  4672. return 0;
  4673. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4674. return 0;
  4675. if (!ASN1BERDecExplicitTag(dd, 0x80000005, &dd0, &di0))
  4676. return 0;
  4677. if (!ASN1BERDecGeneralizedTime(dd0, 0x18, &(val)->client_time))
  4678. return 0;
  4679. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4680. return 0;
  4681. ASN1BERDecPeekTag(dd, &t);
  4682. if (t == 0x80000006) {
  4683. (val)->o[0] |= 0x40;
  4684. if (!ASN1BERDecExplicitTag(dd, 0x80000006, &dd0, &di0))
  4685. return 0;
  4686. if (!ASN1Dec_KERB_ENCRYPTION_KEY(dd0, 0, &(val)->subkey))
  4687. return 0;
  4688. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4689. return 0;
  4690. }
  4691. ASN1BERDecPeekTag(dd, &t);
  4692. if (t == 0x80000007) {
  4693. (val)->o[0] |= 0x20;
  4694. if (!ASN1BERDecExplicitTag(dd, 0x80000007, &dd0, &di0))
  4695. return 0;
  4696. if (!ASN1BERDecSXVal(dd0, 0x2, &(val)->sequence_number))
  4697. return 0;
  4698. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4699. return 0;
  4700. }
  4701. ASN1BERDecPeekTag(dd, &t);
  4702. if (t == 0x80000008) {
  4703. (val)->o[0] |= 0x10;
  4704. if (!ASN1BERDecExplicitTag(dd, 0x80000008, &dd0, &di0))
  4705. return 0;
  4706. if (!ASN1Dec_PKERB_AUTHORIZATION_DATA(dd0, 0, &(val)->authorization_data))
  4707. return 0;
  4708. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4709. return 0;
  4710. }
  4711. if (!ASN1BERDecEndOfContents(pExplTagDec0, dd, di))
  4712. return 0;
  4713. if (!ASN1BERDecEndOfContents(dec, pExplTagDec0, pbExplTagDataEnd0))
  4714. return 0;
  4715. return 1;
  4716. }
  4717. static void ASN1CALL ASN1Free_KERB_AUTHENTICATOR(KERB_AUTHENTICATOR *val)
  4718. {
  4719. if (val) {
  4720. ASN1ztcharstring_free((val)->client_realm);
  4721. ASN1Free_KERB_PRINCIPAL_NAME(&(val)->client_name);
  4722. if ((val)->o[0] & 0x80) {
  4723. ASN1Free_KERB_CHECKSUM(&(val)->checksum);
  4724. }
  4725. if ((val)->o[0] & 0x40) {
  4726. ASN1Free_KERB_ENCRYPTION_KEY(&(val)->subkey);
  4727. }
  4728. if ((val)->o[0] & 0x20) {
  4729. ASN1intx_free(&(val)->sequence_number);
  4730. }
  4731. if ((val)->o[0] & 0x10) {
  4732. ASN1Free_PKERB_AUTHORIZATION_DATA(&(val)->authorization_data);
  4733. }
  4734. }
  4735. }
  4736. static int ASN1CALL ASN1Enc_KERB_KDC_REQUEST_BODY(ASN1encoding_t enc, ASN1uint32_t tag, KERB_KDC_REQUEST_BODY *val)
  4737. {
  4738. ASN1uint32_t nLenOff;
  4739. ASN1uint32_t nLenOff0;
  4740. ASN1uint32_t t;
  4741. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  4742. return 0;
  4743. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  4744. return 0;
  4745. if (!ASN1DEREncBitString(enc, 0x3, ((val)->kdc_options).length, ((val)->kdc_options).value))
  4746. return 0;
  4747. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4748. return 0;
  4749. if ((val)->o[0] & 0x80) {
  4750. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  4751. return 0;
  4752. if (!ASN1Enc_KERB_PRINCIPAL_NAME(enc, 0, &(val)->client_name))
  4753. return 0;
  4754. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4755. return 0;
  4756. }
  4757. t = lstrlenA((val)->realm);
  4758. if (!ASN1BEREncExplicitTag(enc, 0x80000002, &nLenOff0))
  4759. return 0;
  4760. if (!ASN1DEREncCharString(enc, 0x1b, t, (val)->realm))
  4761. return 0;
  4762. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4763. return 0;
  4764. if ((val)->o[0] & 0x40) {
  4765. if (!ASN1BEREncExplicitTag(enc, 0x80000003, &nLenOff0))
  4766. return 0;
  4767. if (!ASN1Enc_KERB_PRINCIPAL_NAME(enc, 0, &(val)->server_name))
  4768. return 0;
  4769. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4770. return 0;
  4771. }
  4772. if ((val)->o[0] & 0x20) {
  4773. if (!ASN1BEREncExplicitTag(enc, 0x80000004, &nLenOff0))
  4774. return 0;
  4775. if (!ASN1DEREncGeneralizedTime(enc, 0x18, &(val)->starttime))
  4776. return 0;
  4777. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4778. return 0;
  4779. }
  4780. if (!ASN1BEREncExplicitTag(enc, 0x80000005, &nLenOff0))
  4781. return 0;
  4782. if (!ASN1DEREncGeneralizedTime(enc, 0x18, &(val)->endtime))
  4783. return 0;
  4784. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4785. return 0;
  4786. if ((val)->o[0] & 0x10) {
  4787. if (!ASN1BEREncExplicitTag(enc, 0x80000006, &nLenOff0))
  4788. return 0;
  4789. if (!ASN1DEREncGeneralizedTime(enc, 0x18, &(val)->renew_until))
  4790. return 0;
  4791. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4792. return 0;
  4793. }
  4794. if (!ASN1BEREncExplicitTag(enc, 0x80000007, &nLenOff0))
  4795. return 0;
  4796. if (!ASN1BEREncS32(enc, 0x2, (val)->nonce))
  4797. return 0;
  4798. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4799. return 0;
  4800. if (!ASN1Enc_KERB_KDC_REQUEST_BODY_encryption_type(enc, 0, &(val)->encryption_type))
  4801. return 0;
  4802. if ((val)->o[0] & 0x8) {
  4803. if (!ASN1BEREncExplicitTag(enc, 0x80000009, &nLenOff0))
  4804. return 0;
  4805. if (!ASN1Enc_PKERB_HOST_ADDRESSES(enc, 0, &(val)->addresses))
  4806. return 0;
  4807. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4808. return 0;
  4809. }
  4810. if ((val)->o[0] & 0x4) {
  4811. if (!ASN1BEREncExplicitTag(enc, 0x8000000a, &nLenOff0))
  4812. return 0;
  4813. if (!ASN1Enc_KERB_ENCRYPTED_DATA(enc, 0, &(val)->enc_authorization_data))
  4814. return 0;
  4815. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4816. return 0;
  4817. }
  4818. if ((val)->o[0] & 0x2) {
  4819. if (!ASN1Enc_KERB_KDC_REQUEST_BODY_additional_tickets(enc, 0, &(val)->additional_tickets))
  4820. return 0;
  4821. }
  4822. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  4823. return 0;
  4824. return 1;
  4825. }
  4826. static int ASN1CALL ASN1Dec_KERB_KDC_REQUEST_BODY(ASN1decoding_t dec, ASN1uint32_t tag, KERB_KDC_REQUEST_BODY *val)
  4827. {
  4828. ASN1decoding_t dd;
  4829. ASN1octet_t *di;
  4830. ASN1decoding_t dd0;
  4831. ASN1octet_t *di0;
  4832. ASN1uint32_t t;
  4833. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  4834. return 0;
  4835. ZeroMemory((val)->o, 1);
  4836. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  4837. return 0;
  4838. if (!ASN1BERDecBitString(dd0, 0x3, &(val)->kdc_options))
  4839. return 0;
  4840. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4841. return 0;
  4842. ASN1BERDecPeekTag(dd, &t);
  4843. if (t == 0x80000001) {
  4844. (val)->o[0] |= 0x80;
  4845. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  4846. return 0;
  4847. if (!ASN1Dec_KERB_PRINCIPAL_NAME(dd0, 0, &(val)->client_name))
  4848. return 0;
  4849. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4850. return 0;
  4851. }
  4852. if (!ASN1BERDecExplicitTag(dd, 0x80000002, &dd0, &di0))
  4853. return 0;
  4854. if (!ASN1BERDecZeroCharString(dd0, 0x1b, &(val)->realm))
  4855. return 0;
  4856. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4857. return 0;
  4858. ASN1BERDecPeekTag(dd, &t);
  4859. if (t == 0x80000003) {
  4860. (val)->o[0] |= 0x40;
  4861. if (!ASN1BERDecExplicitTag(dd, 0x80000003, &dd0, &di0))
  4862. return 0;
  4863. if (!ASN1Dec_KERB_PRINCIPAL_NAME(dd0, 0, &(val)->server_name))
  4864. return 0;
  4865. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4866. return 0;
  4867. }
  4868. ASN1BERDecPeekTag(dd, &t);
  4869. if (t == 0x80000004) {
  4870. (val)->o[0] |= 0x20;
  4871. if (!ASN1BERDecExplicitTag(dd, 0x80000004, &dd0, &di0))
  4872. return 0;
  4873. if (!ASN1BERDecGeneralizedTime(dd0, 0x18, &(val)->starttime))
  4874. return 0;
  4875. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4876. return 0;
  4877. }
  4878. if (!ASN1BERDecExplicitTag(dd, 0x80000005, &dd0, &di0))
  4879. return 0;
  4880. if (!ASN1BERDecGeneralizedTime(dd0, 0x18, &(val)->endtime))
  4881. return 0;
  4882. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4883. return 0;
  4884. ASN1BERDecPeekTag(dd, &t);
  4885. if (t == 0x80000006) {
  4886. (val)->o[0] |= 0x10;
  4887. if (!ASN1BERDecExplicitTag(dd, 0x80000006, &dd0, &di0))
  4888. return 0;
  4889. if (!ASN1BERDecGeneralizedTime(dd0, 0x18, &(val)->renew_until))
  4890. return 0;
  4891. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4892. return 0;
  4893. }
  4894. if (!ASN1BERDecExplicitTag(dd, 0x80000007, &dd0, &di0))
  4895. return 0;
  4896. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->nonce))
  4897. return 0;
  4898. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4899. return 0;
  4900. if (!ASN1Dec_KERB_KDC_REQUEST_BODY_encryption_type(dd, 0, &(val)->encryption_type))
  4901. return 0;
  4902. ASN1BERDecPeekTag(dd, &t);
  4903. if (t == 0x80000009) {
  4904. (val)->o[0] |= 0x8;
  4905. if (!ASN1BERDecExplicitTag(dd, 0x80000009, &dd0, &di0))
  4906. return 0;
  4907. if (!ASN1Dec_PKERB_HOST_ADDRESSES(dd0, 0, &(val)->addresses))
  4908. return 0;
  4909. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4910. return 0;
  4911. }
  4912. ASN1BERDecPeekTag(dd, &t);
  4913. if (t == 0x8000000a) {
  4914. (val)->o[0] |= 0x4;
  4915. if (!ASN1BERDecExplicitTag(dd, 0x8000000a, &dd0, &di0))
  4916. return 0;
  4917. if (!ASN1Dec_KERB_ENCRYPTED_DATA(dd0, 0, &(val)->enc_authorization_data))
  4918. return 0;
  4919. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4920. return 0;
  4921. }
  4922. ASN1BERDecPeekTag(dd, &t);
  4923. if (t == 0x8000000b) {
  4924. (val)->o[0] |= 0x2;
  4925. if (!ASN1Dec_KERB_KDC_REQUEST_BODY_additional_tickets(dd, 0, &(val)->additional_tickets))
  4926. return 0;
  4927. }
  4928. if (!ASN1BERDecEndOfContents(dec, dd, di))
  4929. return 0;
  4930. return 1;
  4931. }
  4932. static void ASN1CALL ASN1Free_KERB_KDC_REQUEST_BODY(KERB_KDC_REQUEST_BODY *val)
  4933. {
  4934. if (val) {
  4935. ASN1bitstring_free(&(val)->kdc_options);
  4936. if ((val)->o[0] & 0x80) {
  4937. ASN1Free_KERB_PRINCIPAL_NAME(&(val)->client_name);
  4938. }
  4939. ASN1ztcharstring_free((val)->realm);
  4940. if ((val)->o[0] & 0x40) {
  4941. ASN1Free_KERB_PRINCIPAL_NAME(&(val)->server_name);
  4942. }
  4943. if ((val)->o[0] & 0x20) {
  4944. }
  4945. if ((val)->o[0] & 0x10) {
  4946. }
  4947. ASN1Free_KERB_KDC_REQUEST_BODY_encryption_type(&(val)->encryption_type);
  4948. if ((val)->o[0] & 0x8) {
  4949. ASN1Free_PKERB_HOST_ADDRESSES(&(val)->addresses);
  4950. }
  4951. if ((val)->o[0] & 0x4) {
  4952. ASN1Free_KERB_ENCRYPTED_DATA(&(val)->enc_authorization_data);
  4953. }
  4954. if ((val)->o[0] & 0x2) {
  4955. ASN1Free_KERB_KDC_REQUEST_BODY_additional_tickets(&(val)->additional_tickets);
  4956. }
  4957. }
  4958. }
  4959. static int ASN1CALL ASN1Enc_KERB_KDC_REPLY(ASN1encoding_t enc, ASN1uint32_t tag, KERB_KDC_REPLY *val)
  4960. {
  4961. ASN1uint32_t nLenOff;
  4962. ASN1uint32_t nLenOff0;
  4963. ASN1uint32_t t;
  4964. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  4965. return 0;
  4966. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  4967. return 0;
  4968. if (!ASN1BEREncS32(enc, 0x2, (val)->version))
  4969. return 0;
  4970. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4971. return 0;
  4972. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  4973. return 0;
  4974. if (!ASN1BEREncS32(enc, 0x2, (val)->message_type))
  4975. return 0;
  4976. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4977. return 0;
  4978. if ((val)->o[0] & 0x80) {
  4979. if (!ASN1Enc_KERB_KDC_REPLY_preauth_data(enc, 0, &(val)->preauth_data))
  4980. return 0;
  4981. }
  4982. t = lstrlenA((val)->client_realm);
  4983. if (!ASN1BEREncExplicitTag(enc, 0x80000003, &nLenOff0))
  4984. return 0;
  4985. if (!ASN1DEREncCharString(enc, 0x1b, t, (val)->client_realm))
  4986. return 0;
  4987. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4988. return 0;
  4989. if (!ASN1BEREncExplicitTag(enc, 0x80000004, &nLenOff0))
  4990. return 0;
  4991. if (!ASN1Enc_KERB_PRINCIPAL_NAME(enc, 0, &(val)->client_name))
  4992. return 0;
  4993. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4994. return 0;
  4995. if (!ASN1BEREncExplicitTag(enc, 0x80000005, &nLenOff0))
  4996. return 0;
  4997. if (!ASN1Enc_KERB_TICKET(enc, 0, &(val)->ticket))
  4998. return 0;
  4999. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5000. return 0;
  5001. if (!ASN1BEREncExplicitTag(enc, 0x80000006, &nLenOff0))
  5002. return 0;
  5003. if (!ASN1Enc_KERB_ENCRYPTED_DATA(enc, 0, &(val)->encrypted_part))
  5004. return 0;
  5005. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5006. return 0;
  5007. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  5008. return 0;
  5009. return 1;
  5010. }
  5011. static int ASN1CALL ASN1Dec_KERB_KDC_REPLY(ASN1decoding_t dec, ASN1uint32_t tag, KERB_KDC_REPLY *val)
  5012. {
  5013. ASN1decoding_t dd;
  5014. ASN1octet_t *di;
  5015. ASN1decoding_t dd0;
  5016. ASN1octet_t *di0;
  5017. ASN1uint32_t t;
  5018. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  5019. return 0;
  5020. ZeroMemory((val)->o, 1);
  5021. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  5022. return 0;
  5023. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->version))
  5024. return 0;
  5025. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5026. return 0;
  5027. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  5028. return 0;
  5029. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->message_type))
  5030. return 0;
  5031. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5032. return 0;
  5033. ASN1BERDecPeekTag(dd, &t);
  5034. if (t == 0x80000002) {
  5035. (val)->o[0] |= 0x80;
  5036. if (!ASN1Dec_KERB_KDC_REPLY_preauth_data(dd, 0, &(val)->preauth_data))
  5037. return 0;
  5038. }
  5039. if (!ASN1BERDecExplicitTag(dd, 0x80000003, &dd0, &di0))
  5040. return 0;
  5041. if (!ASN1BERDecZeroCharString(dd0, 0x1b, &(val)->client_realm))
  5042. return 0;
  5043. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5044. return 0;
  5045. if (!ASN1BERDecExplicitTag(dd, 0x80000004, &dd0, &di0))
  5046. return 0;
  5047. if (!ASN1Dec_KERB_PRINCIPAL_NAME(dd0, 0, &(val)->client_name))
  5048. return 0;
  5049. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5050. return 0;
  5051. if (!ASN1BERDecExplicitTag(dd, 0x80000005, &dd0, &di0))
  5052. return 0;
  5053. if (!ASN1Dec_KERB_TICKET(dd0, 0, &(val)->ticket))
  5054. return 0;
  5055. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5056. return 0;
  5057. if (!ASN1BERDecExplicitTag(dd, 0x80000006, &dd0, &di0))
  5058. return 0;
  5059. if (!ASN1Dec_KERB_ENCRYPTED_DATA(dd0, 0, &(val)->encrypted_part))
  5060. return 0;
  5061. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5062. return 0;
  5063. if (!ASN1BERDecEndOfContents(dec, dd, di))
  5064. return 0;
  5065. return 1;
  5066. }
  5067. static void ASN1CALL ASN1Free_KERB_KDC_REPLY(KERB_KDC_REPLY *val)
  5068. {
  5069. if (val) {
  5070. if ((val)->o[0] & 0x80) {
  5071. ASN1Free_KERB_KDC_REPLY_preauth_data(&(val)->preauth_data);
  5072. }
  5073. ASN1ztcharstring_free((val)->client_realm);
  5074. ASN1Free_KERB_PRINCIPAL_NAME(&(val)->client_name);
  5075. ASN1Free_KERB_TICKET(&(val)->ticket);
  5076. ASN1Free_KERB_ENCRYPTED_DATA(&(val)->encrypted_part);
  5077. }
  5078. }
  5079. static int ASN1CALL ASN1Enc_KERB_ENCRYPTED_KDC_REPLY(ASN1encoding_t enc, ASN1uint32_t tag, KERB_ENCRYPTED_KDC_REPLY *val)
  5080. {
  5081. ASN1uint32_t nLenOff;
  5082. ASN1uint32_t nLenOff0;
  5083. ASN1uint32_t t;
  5084. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  5085. return 0;
  5086. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  5087. return 0;
  5088. if (!ASN1Enc_KERB_ENCRYPTION_KEY(enc, 0, &(val)->session_key))
  5089. return 0;
  5090. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5091. return 0;
  5092. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  5093. return 0;
  5094. if (!ASN1Enc_PKERB_LAST_REQUEST(enc, 0, &(val)->last_request))
  5095. return 0;
  5096. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5097. return 0;
  5098. if (!ASN1BEREncExplicitTag(enc, 0x80000002, &nLenOff0))
  5099. return 0;
  5100. if (!ASN1BEREncS32(enc, 0x2, (val)->nonce))
  5101. return 0;
  5102. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5103. return 0;
  5104. if ((val)->o[0] & 0x80) {
  5105. if (!ASN1BEREncExplicitTag(enc, 0x80000003, &nLenOff0))
  5106. return 0;
  5107. if (!ASN1DEREncGeneralizedTime(enc, 0x18, &(val)->key_expiration))
  5108. return 0;
  5109. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5110. return 0;
  5111. }
  5112. if (!ASN1BEREncExplicitTag(enc, 0x80000004, &nLenOff0))
  5113. return 0;
  5114. if (!ASN1DEREncBitString(enc, 0x3, ((val)->flags).length, ((val)->flags).value))
  5115. return 0;
  5116. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5117. return 0;
  5118. if (!ASN1BEREncExplicitTag(enc, 0x80000005, &nLenOff0))
  5119. return 0;
  5120. if (!ASN1DEREncGeneralizedTime(enc, 0x18, &(val)->authtime))
  5121. return 0;
  5122. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5123. return 0;
  5124. if ((val)->o[0] & 0x40) {
  5125. if (!ASN1BEREncExplicitTag(enc, 0x80000006, &nLenOff0))
  5126. return 0;
  5127. if (!ASN1DEREncGeneralizedTime(enc, 0x18, &(val)->starttime))
  5128. return 0;
  5129. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5130. return 0;
  5131. }
  5132. if (!ASN1BEREncExplicitTag(enc, 0x80000007, &nLenOff0))
  5133. return 0;
  5134. if (!ASN1DEREncGeneralizedTime(enc, 0x18, &(val)->endtime))
  5135. return 0;
  5136. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5137. return 0;
  5138. if ((val)->o[0] & 0x20) {
  5139. if (!ASN1BEREncExplicitTag(enc, 0x80000008, &nLenOff0))
  5140. return 0;
  5141. if (!ASN1DEREncGeneralizedTime(enc, 0x18, &(val)->renew_until))
  5142. return 0;
  5143. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5144. return 0;
  5145. }
  5146. t = lstrlenA((val)->server_realm);
  5147. if (!ASN1BEREncExplicitTag(enc, 0x80000009, &nLenOff0))
  5148. return 0;
  5149. if (!ASN1DEREncCharString(enc, 0x1b, t, (val)->server_realm))
  5150. return 0;
  5151. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5152. return 0;
  5153. if (!ASN1BEREncExplicitTag(enc, 0x8000000a, &nLenOff0))
  5154. return 0;
  5155. if (!ASN1Enc_KERB_PRINCIPAL_NAME(enc, 0, &(val)->server_name))
  5156. return 0;
  5157. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5158. return 0;
  5159. if ((val)->o[0] & 0x10) {
  5160. if (!ASN1BEREncExplicitTag(enc, 0x8000000b, &nLenOff0))
  5161. return 0;
  5162. if (!ASN1Enc_PKERB_HOST_ADDRESSES(enc, 0, &(val)->client_addresses))
  5163. return 0;
  5164. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5165. return 0;
  5166. }
  5167. if ((val)->o[0] & 0x8) {
  5168. if (!ASN1Enc_KERB_ENCRYPTED_KDC_REPLY_encrypted_pa_data(enc, 0, &(val)->encrypted_pa_data))
  5169. return 0;
  5170. }
  5171. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  5172. return 0;
  5173. return 1;
  5174. }
  5175. static int ASN1CALL ASN1Dec_KERB_ENCRYPTED_KDC_REPLY(ASN1decoding_t dec, ASN1uint32_t tag, KERB_ENCRYPTED_KDC_REPLY *val)
  5176. {
  5177. ASN1decoding_t dd;
  5178. ASN1octet_t *di;
  5179. ASN1decoding_t dd0;
  5180. ASN1octet_t *di0;
  5181. ASN1uint32_t t;
  5182. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  5183. return 0;
  5184. ZeroMemory((val)->o, 1);
  5185. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  5186. return 0;
  5187. if (!ASN1Dec_KERB_ENCRYPTION_KEY(dd0, 0, &(val)->session_key))
  5188. return 0;
  5189. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5190. return 0;
  5191. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  5192. return 0;
  5193. if (!ASN1Dec_PKERB_LAST_REQUEST(dd0, 0, &(val)->last_request))
  5194. return 0;
  5195. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5196. return 0;
  5197. if (!ASN1BERDecExplicitTag(dd, 0x80000002, &dd0, &di0))
  5198. return 0;
  5199. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->nonce))
  5200. return 0;
  5201. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5202. return 0;
  5203. ASN1BERDecPeekTag(dd, &t);
  5204. if (t == 0x80000003) {
  5205. (val)->o[0] |= 0x80;
  5206. if (!ASN1BERDecExplicitTag(dd, 0x80000003, &dd0, &di0))
  5207. return 0;
  5208. if (!ASN1BERDecGeneralizedTime(dd0, 0x18, &(val)->key_expiration))
  5209. return 0;
  5210. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5211. return 0;
  5212. }
  5213. if (!ASN1BERDecExplicitTag(dd, 0x80000004, &dd0, &di0))
  5214. return 0;
  5215. if (!ASN1BERDecBitString(dd0, 0x3, &(val)->flags))
  5216. return 0;
  5217. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5218. return 0;
  5219. if (!ASN1BERDecExplicitTag(dd, 0x80000005, &dd0, &di0))
  5220. return 0;
  5221. if (!ASN1BERDecGeneralizedTime(dd0, 0x18, &(val)->authtime))
  5222. return 0;
  5223. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5224. return 0;
  5225. ASN1BERDecPeekTag(dd, &t);
  5226. if (t == 0x80000006) {
  5227. (val)->o[0] |= 0x40;
  5228. if (!ASN1BERDecExplicitTag(dd, 0x80000006, &dd0, &di0))
  5229. return 0;
  5230. if (!ASN1BERDecGeneralizedTime(dd0, 0x18, &(val)->starttime))
  5231. return 0;
  5232. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5233. return 0;
  5234. }
  5235. if (!ASN1BERDecExplicitTag(dd, 0x80000007, &dd0, &di0))
  5236. return 0;
  5237. if (!ASN1BERDecGeneralizedTime(dd0, 0x18, &(val)->endtime))
  5238. return 0;
  5239. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5240. return 0;
  5241. ASN1BERDecPeekTag(dd, &t);
  5242. if (t == 0x80000008) {
  5243. (val)->o[0] |= 0x20;
  5244. if (!ASN1BERDecExplicitTag(dd, 0x80000008, &dd0, &di0))
  5245. return 0;
  5246. if (!ASN1BERDecGeneralizedTime(dd0, 0x18, &(val)->renew_until))
  5247. return 0;
  5248. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5249. return 0;
  5250. }
  5251. if (!ASN1BERDecExplicitTag(dd, 0x80000009, &dd0, &di0))
  5252. return 0;
  5253. if (!ASN1BERDecZeroCharString(dd0, 0x1b, &(val)->server_realm))
  5254. return 0;
  5255. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5256. return 0;
  5257. if (!ASN1BERDecExplicitTag(dd, 0x8000000a, &dd0, &di0))
  5258. return 0;
  5259. if (!ASN1Dec_KERB_PRINCIPAL_NAME(dd0, 0, &(val)->server_name))
  5260. return 0;
  5261. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5262. return 0;
  5263. ASN1BERDecPeekTag(dd, &t);
  5264. if (t == 0x8000000b) {
  5265. (val)->o[0] |= 0x10;
  5266. if (!ASN1BERDecExplicitTag(dd, 0x8000000b, &dd0, &di0))
  5267. return 0;
  5268. if (!ASN1Dec_PKERB_HOST_ADDRESSES(dd0, 0, &(val)->client_addresses))
  5269. return 0;
  5270. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5271. return 0;
  5272. }
  5273. ASN1BERDecPeekTag(dd, &t);
  5274. if (t == 0x8000000c) {
  5275. (val)->o[0] |= 0x8;
  5276. if (!ASN1Dec_KERB_ENCRYPTED_KDC_REPLY_encrypted_pa_data(dd, 0, &(val)->encrypted_pa_data))
  5277. return 0;
  5278. }
  5279. if (!ASN1BERDecEndOfContents(dec, dd, di))
  5280. return 0;
  5281. return 1;
  5282. }
  5283. static void ASN1CALL ASN1Free_KERB_ENCRYPTED_KDC_REPLY(KERB_ENCRYPTED_KDC_REPLY *val)
  5284. {
  5285. if (val) {
  5286. ASN1Free_KERB_ENCRYPTION_KEY(&(val)->session_key);
  5287. ASN1Free_PKERB_LAST_REQUEST(&(val)->last_request);
  5288. if ((val)->o[0] & 0x80) {
  5289. }
  5290. ASN1bitstring_free(&(val)->flags);
  5291. if ((val)->o[0] & 0x40) {
  5292. }
  5293. if ((val)->o[0] & 0x20) {
  5294. }
  5295. ASN1ztcharstring_free((val)->server_realm);
  5296. ASN1Free_KERB_PRINCIPAL_NAME(&(val)->server_name);
  5297. if ((val)->o[0] & 0x10) {
  5298. ASN1Free_PKERB_HOST_ADDRESSES(&(val)->client_addresses);
  5299. }
  5300. if ((val)->o[0] & 0x8) {
  5301. ASN1Free_KERB_ENCRYPTED_KDC_REPLY_encrypted_pa_data(&(val)->encrypted_pa_data);
  5302. }
  5303. }
  5304. }
  5305. static int ASN1CALL ASN1Enc_KERB_AP_REQUEST(ASN1encoding_t enc, ASN1uint32_t tag, KERB_AP_REQUEST *val)
  5306. {
  5307. ASN1uint32_t nExplTagLenOff0;
  5308. ASN1uint32_t nLenOff;
  5309. ASN1uint32_t nLenOff0;
  5310. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x4000000e, &nExplTagLenOff0))
  5311. return 0;
  5312. if (!ASN1BEREncExplicitTag(enc, 0x10, &nLenOff))
  5313. return 0;
  5314. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  5315. return 0;
  5316. if (!ASN1BEREncS32(enc, 0x2, (val)->version))
  5317. return 0;
  5318. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5319. return 0;
  5320. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  5321. return 0;
  5322. if (!ASN1BEREncS32(enc, 0x2, (val)->message_type))
  5323. return 0;
  5324. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5325. return 0;
  5326. if (!ASN1BEREncExplicitTag(enc, 0x80000002, &nLenOff0))
  5327. return 0;
  5328. if (!ASN1DEREncBitString(enc, 0x3, ((val)->ap_options).length, ((val)->ap_options).value))
  5329. return 0;
  5330. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5331. return 0;
  5332. if (!ASN1BEREncExplicitTag(enc, 0x80000003, &nLenOff0))
  5333. return 0;
  5334. if (!ASN1Enc_KERB_TICKET(enc, 0, &(val)->ticket))
  5335. return 0;
  5336. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5337. return 0;
  5338. if (!ASN1BEREncExplicitTag(enc, 0x80000004, &nLenOff0))
  5339. return 0;
  5340. if (!ASN1Enc_KERB_ENCRYPTED_DATA(enc, 0, &(val)->authenticator))
  5341. return 0;
  5342. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5343. return 0;
  5344. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  5345. return 0;
  5346. if (!ASN1BEREncEndOfContents(enc, nExplTagLenOff0))
  5347. return 0;
  5348. return 1;
  5349. }
  5350. static int ASN1CALL ASN1Dec_KERB_AP_REQUEST(ASN1decoding_t dec, ASN1uint32_t tag, KERB_AP_REQUEST *val)
  5351. {
  5352. ASN1decoding_t dd;
  5353. ASN1octet_t *di;
  5354. ASN1decoding_t pExplTagDec0;
  5355. ASN1octet_t *pbExplTagDataEnd0;
  5356. ASN1decoding_t dd0;
  5357. ASN1octet_t *di0;
  5358. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x4000000e, &pExplTagDec0, &pbExplTagDataEnd0))
  5359. return 0;
  5360. if (!ASN1BERDecExplicitTag(pExplTagDec0, 0x10, &dd, &di))
  5361. return 0;
  5362. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  5363. return 0;
  5364. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->version))
  5365. return 0;
  5366. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5367. return 0;
  5368. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  5369. return 0;
  5370. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->message_type))
  5371. return 0;
  5372. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5373. return 0;
  5374. if (!ASN1BERDecExplicitTag(dd, 0x80000002, &dd0, &di0))
  5375. return 0;
  5376. if (!ASN1BERDecBitString(dd0, 0x3, &(val)->ap_options))
  5377. return 0;
  5378. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5379. return 0;
  5380. if (!ASN1BERDecExplicitTag(dd, 0x80000003, &dd0, &di0))
  5381. return 0;
  5382. if (!ASN1Dec_KERB_TICKET(dd0, 0, &(val)->ticket))
  5383. return 0;
  5384. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5385. return 0;
  5386. if (!ASN1BERDecExplicitTag(dd, 0x80000004, &dd0, &di0))
  5387. return 0;
  5388. if (!ASN1Dec_KERB_ENCRYPTED_DATA(dd0, 0, &(val)->authenticator))
  5389. return 0;
  5390. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5391. return 0;
  5392. if (!ASN1BERDecEndOfContents(pExplTagDec0, dd, di))
  5393. return 0;
  5394. if (!ASN1BERDecEndOfContents(dec, pExplTagDec0, pbExplTagDataEnd0))
  5395. return 0;
  5396. return 1;
  5397. }
  5398. static void ASN1CALL ASN1Free_KERB_AP_REQUEST(KERB_AP_REQUEST *val)
  5399. {
  5400. if (val) {
  5401. ASN1bitstring_free(&(val)->ap_options);
  5402. ASN1Free_KERB_TICKET(&(val)->ticket);
  5403. ASN1Free_KERB_ENCRYPTED_DATA(&(val)->authenticator);
  5404. }
  5405. }
  5406. static int ASN1CALL ASN1Enc_KERB_AP_REPLY(ASN1encoding_t enc, ASN1uint32_t tag, KERB_AP_REPLY *val)
  5407. {
  5408. ASN1uint32_t nExplTagLenOff0;
  5409. ASN1uint32_t nLenOff;
  5410. ASN1uint32_t nLenOff0;
  5411. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x4000000f, &nExplTagLenOff0))
  5412. return 0;
  5413. if (!ASN1BEREncExplicitTag(enc, 0x10, &nLenOff))
  5414. return 0;
  5415. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  5416. return 0;
  5417. if (!ASN1BEREncS32(enc, 0x2, (val)->version))
  5418. return 0;
  5419. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5420. return 0;
  5421. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  5422. return 0;
  5423. if (!ASN1BEREncS32(enc, 0x2, (val)->message_type))
  5424. return 0;
  5425. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5426. return 0;
  5427. if (!ASN1BEREncExplicitTag(enc, 0x80000002, &nLenOff0))
  5428. return 0;
  5429. if (!ASN1Enc_KERB_ENCRYPTED_DATA(enc, 0, &(val)->encrypted_part))
  5430. return 0;
  5431. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5432. return 0;
  5433. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  5434. return 0;
  5435. if (!ASN1BEREncEndOfContents(enc, nExplTagLenOff0))
  5436. return 0;
  5437. return 1;
  5438. }
  5439. static int ASN1CALL ASN1Dec_KERB_AP_REPLY(ASN1decoding_t dec, ASN1uint32_t tag, KERB_AP_REPLY *val)
  5440. {
  5441. ASN1decoding_t dd;
  5442. ASN1octet_t *di;
  5443. ASN1decoding_t pExplTagDec0;
  5444. ASN1octet_t *pbExplTagDataEnd0;
  5445. ASN1decoding_t dd0;
  5446. ASN1octet_t *di0;
  5447. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x4000000f, &pExplTagDec0, &pbExplTagDataEnd0))
  5448. return 0;
  5449. if (!ASN1BERDecExplicitTag(pExplTagDec0, 0x10, &dd, &di))
  5450. return 0;
  5451. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  5452. return 0;
  5453. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->version))
  5454. return 0;
  5455. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5456. return 0;
  5457. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  5458. return 0;
  5459. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->message_type))
  5460. return 0;
  5461. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5462. return 0;
  5463. if (!ASN1BERDecExplicitTag(dd, 0x80000002, &dd0, &di0))
  5464. return 0;
  5465. if (!ASN1Dec_KERB_ENCRYPTED_DATA(dd0, 0, &(val)->encrypted_part))
  5466. return 0;
  5467. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5468. return 0;
  5469. if (!ASN1BERDecEndOfContents(pExplTagDec0, dd, di))
  5470. return 0;
  5471. if (!ASN1BERDecEndOfContents(dec, pExplTagDec0, pbExplTagDataEnd0))
  5472. return 0;
  5473. return 1;
  5474. }
  5475. static void ASN1CALL ASN1Free_KERB_AP_REPLY(KERB_AP_REPLY *val)
  5476. {
  5477. if (val) {
  5478. ASN1Free_KERB_ENCRYPTED_DATA(&(val)->encrypted_part);
  5479. }
  5480. }
  5481. static int ASN1CALL ASN1Enc_KERB_ENCRYPTED_AP_REPLY(ASN1encoding_t enc, ASN1uint32_t tag, KERB_ENCRYPTED_AP_REPLY *val)
  5482. {
  5483. ASN1uint32_t nExplTagLenOff0;
  5484. ASN1uint32_t nLenOff;
  5485. ASN1uint32_t nLenOff0;
  5486. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x4000001b, &nExplTagLenOff0))
  5487. return 0;
  5488. if (!ASN1BEREncExplicitTag(enc, 0x10, &nLenOff))
  5489. return 0;
  5490. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  5491. return 0;
  5492. if (!ASN1DEREncGeneralizedTime(enc, 0x18, &(val)->client_time))
  5493. return 0;
  5494. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5495. return 0;
  5496. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  5497. return 0;
  5498. if (!ASN1BEREncS32(enc, 0x2, (val)->client_usec))
  5499. return 0;
  5500. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5501. return 0;
  5502. if ((val)->o[0] & 0x80) {
  5503. if (!ASN1BEREncExplicitTag(enc, 0x80000002, &nLenOff0))
  5504. return 0;
  5505. if (!ASN1Enc_KERB_ENCRYPTION_KEY(enc, 0, &(val)->subkey))
  5506. return 0;
  5507. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5508. return 0;
  5509. }
  5510. if ((val)->o[0] & 0x40) {
  5511. if (!ASN1BEREncExplicitTag(enc, 0x80000003, &nLenOff0))
  5512. return 0;
  5513. if (!ASN1BEREncU32(enc, 0x2, (val)->sequence_number))
  5514. return 0;
  5515. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5516. return 0;
  5517. }
  5518. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  5519. return 0;
  5520. if (!ASN1BEREncEndOfContents(enc, nExplTagLenOff0))
  5521. return 0;
  5522. return 1;
  5523. }
  5524. static int ASN1CALL ASN1Dec_KERB_ENCRYPTED_AP_REPLY(ASN1decoding_t dec, ASN1uint32_t tag, KERB_ENCRYPTED_AP_REPLY *val)
  5525. {
  5526. ASN1decoding_t dd;
  5527. ASN1octet_t *di;
  5528. ASN1decoding_t pExplTagDec0;
  5529. ASN1octet_t *pbExplTagDataEnd0;
  5530. ASN1decoding_t dd0;
  5531. ASN1octet_t *di0;
  5532. ASN1uint32_t t;
  5533. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x4000001b, &pExplTagDec0, &pbExplTagDataEnd0))
  5534. return 0;
  5535. if (!ASN1BERDecExplicitTag(pExplTagDec0, 0x10, &dd, &di))
  5536. return 0;
  5537. ZeroMemory((val)->o, 1);
  5538. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  5539. return 0;
  5540. if (!ASN1BERDecGeneralizedTime(dd0, 0x18, &(val)->client_time))
  5541. return 0;
  5542. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5543. return 0;
  5544. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  5545. return 0;
  5546. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->client_usec))
  5547. return 0;
  5548. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5549. return 0;
  5550. ASN1BERDecPeekTag(dd, &t);
  5551. if (t == 0x80000002) {
  5552. (val)->o[0] |= 0x80;
  5553. if (!ASN1BERDecExplicitTag(dd, 0x80000002, &dd0, &di0))
  5554. return 0;
  5555. if (!ASN1Dec_KERB_ENCRYPTION_KEY(dd0, 0, &(val)->subkey))
  5556. return 0;
  5557. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5558. return 0;
  5559. }
  5560. ASN1BERDecPeekTag(dd, &t);
  5561. if (t == 0x80000003) {
  5562. (val)->o[0] |= 0x40;
  5563. if (!ASN1BERDecExplicitTag(dd, 0x80000003, &dd0, &di0))
  5564. return 0;
  5565. if (!ASN1BERDecU32Val(dd0, 0x2, (ASN1uint32_t *) &(val)->sequence_number))
  5566. return 0;
  5567. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5568. return 0;
  5569. }
  5570. if (!ASN1BERDecEndOfContents(pExplTagDec0, dd, di))
  5571. return 0;
  5572. if (!ASN1BERDecEndOfContents(dec, pExplTagDec0, pbExplTagDataEnd0))
  5573. return 0;
  5574. return 1;
  5575. }
  5576. static void ASN1CALL ASN1Free_KERB_ENCRYPTED_AP_REPLY(KERB_ENCRYPTED_AP_REPLY *val)
  5577. {
  5578. if (val) {
  5579. if ((val)->o[0] & 0x80) {
  5580. ASN1Free_KERB_ENCRYPTION_KEY(&(val)->subkey);
  5581. }
  5582. }
  5583. }
  5584. static int ASN1CALL ASN1Enc_KERB_SAFE_MESSAGE(ASN1encoding_t enc, ASN1uint32_t tag, KERB_SAFE_MESSAGE *val)
  5585. {
  5586. ASN1uint32_t nExplTagLenOff0;
  5587. ASN1uint32_t nLenOff;
  5588. ASN1uint32_t nLenOff0;
  5589. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x40000014, &nExplTagLenOff0))
  5590. return 0;
  5591. if (!ASN1BEREncExplicitTag(enc, 0x10, &nLenOff))
  5592. return 0;
  5593. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  5594. return 0;
  5595. if (!ASN1BEREncS32(enc, 0x2, (val)->version))
  5596. return 0;
  5597. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5598. return 0;
  5599. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  5600. return 0;
  5601. if (!ASN1BEREncS32(enc, 0x2, (val)->message_type))
  5602. return 0;
  5603. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5604. return 0;
  5605. if (!ASN1BEREncExplicitTag(enc, 0x80000002, &nLenOff0))
  5606. return 0;
  5607. if (!ASN1Enc_KERB_SAFE_BODY(enc, 0, &(val)->safe_body))
  5608. return 0;
  5609. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5610. return 0;
  5611. if (!ASN1BEREncExplicitTag(enc, 0x80000003, &nLenOff0))
  5612. return 0;
  5613. if (!ASN1Enc_KERB_CHECKSUM(enc, 0, &(val)->checksum))
  5614. return 0;
  5615. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5616. return 0;
  5617. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  5618. return 0;
  5619. if (!ASN1BEREncEndOfContents(enc, nExplTagLenOff0))
  5620. return 0;
  5621. return 1;
  5622. }
  5623. static int ASN1CALL ASN1Dec_KERB_SAFE_MESSAGE(ASN1decoding_t dec, ASN1uint32_t tag, KERB_SAFE_MESSAGE *val)
  5624. {
  5625. ASN1decoding_t dd;
  5626. ASN1octet_t *di;
  5627. ASN1decoding_t pExplTagDec0;
  5628. ASN1octet_t *pbExplTagDataEnd0;
  5629. ASN1decoding_t dd0;
  5630. ASN1octet_t *di0;
  5631. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x40000014, &pExplTagDec0, &pbExplTagDataEnd0))
  5632. return 0;
  5633. if (!ASN1BERDecExplicitTag(pExplTagDec0, 0x10, &dd, &di))
  5634. return 0;
  5635. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  5636. return 0;
  5637. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->version))
  5638. return 0;
  5639. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5640. return 0;
  5641. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  5642. return 0;
  5643. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->message_type))
  5644. return 0;
  5645. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5646. return 0;
  5647. if (!ASN1BERDecExplicitTag(dd, 0x80000002, &dd0, &di0))
  5648. return 0;
  5649. if (!ASN1Dec_KERB_SAFE_BODY(dd0, 0, &(val)->safe_body))
  5650. return 0;
  5651. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5652. return 0;
  5653. if (!ASN1BERDecExplicitTag(dd, 0x80000003, &dd0, &di0))
  5654. return 0;
  5655. if (!ASN1Dec_KERB_CHECKSUM(dd0, 0, &(val)->checksum))
  5656. return 0;
  5657. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5658. return 0;
  5659. if (!ASN1BERDecEndOfContents(pExplTagDec0, dd, di))
  5660. return 0;
  5661. if (!ASN1BERDecEndOfContents(dec, pExplTagDec0, pbExplTagDataEnd0))
  5662. return 0;
  5663. return 1;
  5664. }
  5665. static void ASN1CALL ASN1Free_KERB_SAFE_MESSAGE(KERB_SAFE_MESSAGE *val)
  5666. {
  5667. if (val) {
  5668. ASN1Free_KERB_SAFE_BODY(&(val)->safe_body);
  5669. ASN1Free_KERB_CHECKSUM(&(val)->checksum);
  5670. }
  5671. }
  5672. static int ASN1CALL ASN1Enc_KERB_PRIV_MESSAGE(ASN1encoding_t enc, ASN1uint32_t tag, KERB_PRIV_MESSAGE *val)
  5673. {
  5674. ASN1uint32_t nExplTagLenOff0;
  5675. ASN1uint32_t nLenOff;
  5676. ASN1uint32_t nLenOff0;
  5677. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x40000015, &nExplTagLenOff0))
  5678. return 0;
  5679. if (!ASN1BEREncExplicitTag(enc, 0x10, &nLenOff))
  5680. return 0;
  5681. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  5682. return 0;
  5683. if (!ASN1BEREncS32(enc, 0x2, (val)->version))
  5684. return 0;
  5685. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5686. return 0;
  5687. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  5688. return 0;
  5689. if (!ASN1BEREncS32(enc, 0x2, (val)->message_type))
  5690. return 0;
  5691. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5692. return 0;
  5693. if (!ASN1BEREncExplicitTag(enc, 0x80000003, &nLenOff0))
  5694. return 0;
  5695. if (!ASN1Enc_KERB_ENCRYPTED_DATA(enc, 0, &(val)->encrypted_part))
  5696. return 0;
  5697. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5698. return 0;
  5699. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  5700. return 0;
  5701. if (!ASN1BEREncEndOfContents(enc, nExplTagLenOff0))
  5702. return 0;
  5703. return 1;
  5704. }
  5705. static int ASN1CALL ASN1Dec_KERB_PRIV_MESSAGE(ASN1decoding_t dec, ASN1uint32_t tag, KERB_PRIV_MESSAGE *val)
  5706. {
  5707. ASN1decoding_t dd;
  5708. ASN1octet_t *di;
  5709. ASN1decoding_t pExplTagDec0;
  5710. ASN1octet_t *pbExplTagDataEnd0;
  5711. ASN1decoding_t dd0;
  5712. ASN1octet_t *di0;
  5713. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x40000015, &pExplTagDec0, &pbExplTagDataEnd0))
  5714. return 0;
  5715. if (!ASN1BERDecExplicitTag(pExplTagDec0, 0x10, &dd, &di))
  5716. return 0;
  5717. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  5718. return 0;
  5719. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->version))
  5720. return 0;
  5721. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5722. return 0;
  5723. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  5724. return 0;
  5725. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->message_type))
  5726. return 0;
  5727. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5728. return 0;
  5729. if (!ASN1BERDecExplicitTag(dd, 0x80000003, &dd0, &di0))
  5730. return 0;
  5731. if (!ASN1Dec_KERB_ENCRYPTED_DATA(dd0, 0, &(val)->encrypted_part))
  5732. return 0;
  5733. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5734. return 0;
  5735. if (!ASN1BERDecEndOfContents(pExplTagDec0, dd, di))
  5736. return 0;
  5737. if (!ASN1BERDecEndOfContents(dec, pExplTagDec0, pbExplTagDataEnd0))
  5738. return 0;
  5739. return 1;
  5740. }
  5741. static void ASN1CALL ASN1Free_KERB_PRIV_MESSAGE(KERB_PRIV_MESSAGE *val)
  5742. {
  5743. if (val) {
  5744. ASN1Free_KERB_ENCRYPTED_DATA(&(val)->encrypted_part);
  5745. }
  5746. }
  5747. static int ASN1CALL ASN1Enc_KERB_CRED(ASN1encoding_t enc, ASN1uint32_t tag, KERB_CRED *val)
  5748. {
  5749. ASN1uint32_t nExplTagLenOff0;
  5750. ASN1uint32_t nLenOff;
  5751. ASN1uint32_t nLenOff0;
  5752. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x40000016, &nExplTagLenOff0))
  5753. return 0;
  5754. if (!ASN1BEREncExplicitTag(enc, 0x10, &nLenOff))
  5755. return 0;
  5756. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  5757. return 0;
  5758. if (!ASN1BEREncS32(enc, 0x2, (val)->version))
  5759. return 0;
  5760. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5761. return 0;
  5762. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  5763. return 0;
  5764. if (!ASN1BEREncS32(enc, 0x2, (val)->message_type))
  5765. return 0;
  5766. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5767. return 0;
  5768. if (!ASN1Enc_KERB_CRED_tickets(enc, 0, &(val)->tickets))
  5769. return 0;
  5770. if (!ASN1BEREncExplicitTag(enc, 0x80000003, &nLenOff0))
  5771. return 0;
  5772. if (!ASN1Enc_KERB_ENCRYPTED_DATA(enc, 0, &(val)->encrypted_part))
  5773. return 0;
  5774. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5775. return 0;
  5776. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  5777. return 0;
  5778. if (!ASN1BEREncEndOfContents(enc, nExplTagLenOff0))
  5779. return 0;
  5780. return 1;
  5781. }
  5782. static int ASN1CALL ASN1Dec_KERB_CRED(ASN1decoding_t dec, ASN1uint32_t tag, KERB_CRED *val)
  5783. {
  5784. ASN1decoding_t dd;
  5785. ASN1octet_t *di;
  5786. ASN1decoding_t pExplTagDec0;
  5787. ASN1octet_t *pbExplTagDataEnd0;
  5788. ASN1decoding_t dd0;
  5789. ASN1octet_t *di0;
  5790. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x40000016, &pExplTagDec0, &pbExplTagDataEnd0))
  5791. return 0;
  5792. if (!ASN1BERDecExplicitTag(pExplTagDec0, 0x10, &dd, &di))
  5793. return 0;
  5794. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  5795. return 0;
  5796. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->version))
  5797. return 0;
  5798. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5799. return 0;
  5800. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  5801. return 0;
  5802. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->message_type))
  5803. return 0;
  5804. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5805. return 0;
  5806. if (!ASN1Dec_KERB_CRED_tickets(dd, 0, &(val)->tickets))
  5807. return 0;
  5808. if (!ASN1BERDecExplicitTag(dd, 0x80000003, &dd0, &di0))
  5809. return 0;
  5810. if (!ASN1Dec_KERB_ENCRYPTED_DATA(dd0, 0, &(val)->encrypted_part))
  5811. return 0;
  5812. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5813. return 0;
  5814. if (!ASN1BERDecEndOfContents(pExplTagDec0, dd, di))
  5815. return 0;
  5816. if (!ASN1BERDecEndOfContents(dec, pExplTagDec0, pbExplTagDataEnd0))
  5817. return 0;
  5818. return 1;
  5819. }
  5820. static void ASN1CALL ASN1Free_KERB_CRED(KERB_CRED *val)
  5821. {
  5822. if (val) {
  5823. ASN1Free_KERB_CRED_tickets(&(val)->tickets);
  5824. ASN1Free_KERB_ENCRYPTED_DATA(&(val)->encrypted_part);
  5825. }
  5826. }
  5827. static int ASN1CALL ASN1Enc_KERB_CRED_INFO(ASN1encoding_t enc, ASN1uint32_t tag, KERB_CRED_INFO *val)
  5828. {
  5829. ASN1uint32_t nLenOff;
  5830. ASN1uint32_t nLenOff0;
  5831. ASN1uint32_t t;
  5832. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  5833. return 0;
  5834. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  5835. return 0;
  5836. if (!ASN1Enc_KERB_ENCRYPTION_KEY(enc, 0, &(val)->key))
  5837. return 0;
  5838. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5839. return 0;
  5840. if ((val)->o[0] & 0x80) {
  5841. t = lstrlenA((val)->principal_realm);
  5842. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  5843. return 0;
  5844. if (!ASN1DEREncCharString(enc, 0x1b, t, (val)->principal_realm))
  5845. return 0;
  5846. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5847. return 0;
  5848. }
  5849. if ((val)->o[0] & 0x40) {
  5850. if (!ASN1BEREncExplicitTag(enc, 0x80000002, &nLenOff0))
  5851. return 0;
  5852. if (!ASN1Enc_KERB_PRINCIPAL_NAME(enc, 0, &(val)->principal_name))
  5853. return 0;
  5854. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5855. return 0;
  5856. }
  5857. if ((val)->o[0] & 0x20) {
  5858. if (!ASN1BEREncExplicitTag(enc, 0x80000003, &nLenOff0))
  5859. return 0;
  5860. if (!ASN1DEREncBitString(enc, 0x3, ((val)->flags).length, ((val)->flags).value))
  5861. return 0;
  5862. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5863. return 0;
  5864. }
  5865. if ((val)->o[0] & 0x10) {
  5866. if (!ASN1BEREncExplicitTag(enc, 0x80000004, &nLenOff0))
  5867. return 0;
  5868. if (!ASN1DEREncGeneralizedTime(enc, 0x18, &(val)->authtime))
  5869. return 0;
  5870. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5871. return 0;
  5872. }
  5873. if ((val)->o[0] & 0x8) {
  5874. if (!ASN1BEREncExplicitTag(enc, 0x80000005, &nLenOff0))
  5875. return 0;
  5876. if (!ASN1DEREncGeneralizedTime(enc, 0x18, &(val)->starttime))
  5877. return 0;
  5878. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5879. return 0;
  5880. }
  5881. if ((val)->o[0] & 0x4) {
  5882. if (!ASN1BEREncExplicitTag(enc, 0x80000006, &nLenOff0))
  5883. return 0;
  5884. if (!ASN1DEREncGeneralizedTime(enc, 0x18, &(val)->endtime))
  5885. return 0;
  5886. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5887. return 0;
  5888. }
  5889. if ((val)->o[0] & 0x2) {
  5890. if (!ASN1BEREncExplicitTag(enc, 0x80000007, &nLenOff0))
  5891. return 0;
  5892. if (!ASN1DEREncGeneralizedTime(enc, 0x18, &(val)->renew_until))
  5893. return 0;
  5894. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5895. return 0;
  5896. }
  5897. if ((val)->o[0] & 0x1) {
  5898. t = lstrlenA((val)->service_realm);
  5899. if (!ASN1BEREncExplicitTag(enc, 0x80000008, &nLenOff0))
  5900. return 0;
  5901. if (!ASN1DEREncCharString(enc, 0x1b, t, (val)->service_realm))
  5902. return 0;
  5903. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5904. return 0;
  5905. }
  5906. if ((val)->o[1] & 0x80) {
  5907. if (!ASN1BEREncExplicitTag(enc, 0x80000009, &nLenOff0))
  5908. return 0;
  5909. if (!ASN1Enc_KERB_PRINCIPAL_NAME(enc, 0, &(val)->service_name))
  5910. return 0;
  5911. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5912. return 0;
  5913. }
  5914. if ((val)->o[1] & 0x40) {
  5915. if (!ASN1BEREncExplicitTag(enc, 0x8000000a, &nLenOff0))
  5916. return 0;
  5917. if (!ASN1Enc_PKERB_HOST_ADDRESSES(enc, 0, &(val)->client_addresses))
  5918. return 0;
  5919. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5920. return 0;
  5921. }
  5922. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  5923. return 0;
  5924. return 1;
  5925. }
  5926. static int ASN1CALL ASN1Dec_KERB_CRED_INFO(ASN1decoding_t dec, ASN1uint32_t tag, KERB_CRED_INFO *val)
  5927. {
  5928. ASN1decoding_t dd;
  5929. ASN1octet_t *di;
  5930. ASN1decoding_t dd0;
  5931. ASN1octet_t *di0;
  5932. ASN1uint32_t t;
  5933. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  5934. return 0;
  5935. ZeroMemory((val)->o, 2);
  5936. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  5937. return 0;
  5938. if (!ASN1Dec_KERB_ENCRYPTION_KEY(dd0, 0, &(val)->key))
  5939. return 0;
  5940. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5941. return 0;
  5942. ASN1BERDecPeekTag(dd, &t);
  5943. if (t == 0x80000001) {
  5944. (val)->o[0] |= 0x80;
  5945. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  5946. return 0;
  5947. if (!ASN1BERDecZeroCharString(dd0, 0x1b, &(val)->principal_realm))
  5948. return 0;
  5949. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5950. return 0;
  5951. }
  5952. ASN1BERDecPeekTag(dd, &t);
  5953. if (t == 0x80000002) {
  5954. (val)->o[0] |= 0x40;
  5955. if (!ASN1BERDecExplicitTag(dd, 0x80000002, &dd0, &di0))
  5956. return 0;
  5957. if (!ASN1Dec_KERB_PRINCIPAL_NAME(dd0, 0, &(val)->principal_name))
  5958. return 0;
  5959. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5960. return 0;
  5961. }
  5962. ASN1BERDecPeekTag(dd, &t);
  5963. if (t == 0x80000003) {
  5964. (val)->o[0] |= 0x20;
  5965. if (!ASN1BERDecExplicitTag(dd, 0x80000003, &dd0, &di0))
  5966. return 0;
  5967. if (!ASN1BERDecBitString(dd0, 0x3, &(val)->flags))
  5968. return 0;
  5969. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5970. return 0;
  5971. }
  5972. ASN1BERDecPeekTag(dd, &t);
  5973. if (t == 0x80000004) {
  5974. (val)->o[0] |= 0x10;
  5975. if (!ASN1BERDecExplicitTag(dd, 0x80000004, &dd0, &di0))
  5976. return 0;
  5977. if (!ASN1BERDecGeneralizedTime(dd0, 0x18, &(val)->authtime))
  5978. return 0;
  5979. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5980. return 0;
  5981. }
  5982. ASN1BERDecPeekTag(dd, &t);
  5983. if (t == 0x80000005) {
  5984. (val)->o[0] |= 0x8;
  5985. if (!ASN1BERDecExplicitTag(dd, 0x80000005, &dd0, &di0))
  5986. return 0;
  5987. if (!ASN1BERDecGeneralizedTime(dd0, 0x18, &(val)->starttime))
  5988. return 0;
  5989. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5990. return 0;
  5991. }
  5992. ASN1BERDecPeekTag(dd, &t);
  5993. if (t == 0x80000006) {
  5994. (val)->o[0] |= 0x4;
  5995. if (!ASN1BERDecExplicitTag(dd, 0x80000006, &dd0, &di0))
  5996. return 0;
  5997. if (!ASN1BERDecGeneralizedTime(dd0, 0x18, &(val)->endtime))
  5998. return 0;
  5999. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  6000. return 0;
  6001. }
  6002. ASN1BERDecPeekTag(dd, &t);
  6003. if (t == 0x80000007) {
  6004. (val)->o[0] |= 0x2;
  6005. if (!ASN1BERDecExplicitTag(dd, 0x80000007, &dd0, &di0))
  6006. return 0;
  6007. if (!ASN1BERDecGeneralizedTime(dd0, 0x18, &(val)->renew_until))
  6008. return 0;
  6009. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  6010. return 0;
  6011. }
  6012. ASN1BERDecPeekTag(dd, &t);
  6013. if (t == 0x80000008) {
  6014. (val)->o[0] |= 0x1;
  6015. if (!ASN1BERDecExplicitTag(dd, 0x80000008, &dd0, &di0))
  6016. return 0;
  6017. if (!ASN1BERDecZeroCharString(dd0, 0x1b, &(val)->service_realm))
  6018. return 0;
  6019. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  6020. return 0;
  6021. }
  6022. ASN1BERDecPeekTag(dd, &t);
  6023. if (t == 0x80000009) {
  6024. (val)->o[1] |= 0x80;
  6025. if (!ASN1BERDecExplicitTag(dd, 0x80000009, &dd0, &di0))
  6026. return 0;
  6027. if (!ASN1Dec_KERB_PRINCIPAL_NAME(dd0, 0, &(val)->service_name))
  6028. return 0;
  6029. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  6030. return 0;
  6031. }
  6032. ASN1BERDecPeekTag(dd, &t);
  6033. if (t == 0x8000000a) {
  6034. (val)->o[1] |= 0x40;
  6035. if (!ASN1BERDecExplicitTag(dd, 0x8000000a, &dd0, &di0))
  6036. return 0;
  6037. if (!ASN1Dec_PKERB_HOST_ADDRESSES(dd0, 0, &(val)->client_addresses))
  6038. return 0;
  6039. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  6040. return 0;
  6041. }
  6042. if (!ASN1BERDecEndOfContents(dec, dd, di))
  6043. return 0;
  6044. return 1;
  6045. }
  6046. static void ASN1CALL ASN1Free_KERB_CRED_INFO(KERB_CRED_INFO *val)
  6047. {
  6048. if (val) {
  6049. ASN1Free_KERB_ENCRYPTION_KEY(&(val)->key);
  6050. if ((val)->o[0] & 0x80) {
  6051. ASN1ztcharstring_free((val)->principal_realm);
  6052. }
  6053. if ((val)->o[0] & 0x40) {
  6054. ASN1Free_KERB_PRINCIPAL_NAME(&(val)->principal_name);
  6055. }
  6056. if ((val)->o[0] & 0x20) {
  6057. ASN1bitstring_free(&(val)->flags);
  6058. }
  6059. if ((val)->o[0] & 0x10) {
  6060. }
  6061. if ((val)->o[0] & 0x8) {
  6062. }
  6063. if ((val)->o[0] & 0x4) {
  6064. }
  6065. if ((val)->o[0] & 0x2) {
  6066. }
  6067. if ((val)->o[0] & 0x1) {
  6068. ASN1ztcharstring_free((val)->service_realm);
  6069. }
  6070. if ((val)->o[1] & 0x80) {
  6071. ASN1Free_KERB_PRINCIPAL_NAME(&(val)->service_name);
  6072. }
  6073. if ((val)->o[1] & 0x40) {
  6074. ASN1Free_PKERB_HOST_ADDRESSES(&(val)->client_addresses);
  6075. }
  6076. }
  6077. }
  6078. static int ASN1CALL ASN1Enc_KERB_TGT_REPLY(ASN1encoding_t enc, ASN1uint32_t tag, KERB_TGT_REPLY *val)
  6079. {
  6080. ASN1uint32_t nLenOff;
  6081. ASN1uint32_t nLenOff0;
  6082. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  6083. return 0;
  6084. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  6085. return 0;
  6086. if (!ASN1BEREncS32(enc, 0x2, (val)->version))
  6087. return 0;
  6088. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  6089. return 0;
  6090. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  6091. return 0;
  6092. if (!ASN1BEREncS32(enc, 0x2, (val)->message_type))
  6093. return 0;
  6094. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  6095. return 0;
  6096. if (!ASN1BEREncExplicitTag(enc, 0x80000002, &nLenOff0))
  6097. return 0;
  6098. if (!ASN1Enc_KERB_TICKET(enc, 0, &(val)->ticket))
  6099. return 0;
  6100. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  6101. return 0;
  6102. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  6103. return 0;
  6104. return 1;
  6105. }
  6106. static int ASN1CALL ASN1Dec_KERB_TGT_REPLY(ASN1decoding_t dec, ASN1uint32_t tag, KERB_TGT_REPLY *val)
  6107. {
  6108. ASN1decoding_t dd;
  6109. ASN1octet_t *di;
  6110. ASN1decoding_t dd0;
  6111. ASN1octet_t *di0;
  6112. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  6113. return 0;
  6114. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  6115. return 0;
  6116. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->version))
  6117. return 0;
  6118. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  6119. return 0;
  6120. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  6121. return 0;
  6122. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->message_type))
  6123. return 0;
  6124. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  6125. return 0;
  6126. if (!ASN1BERDecExplicitTag(dd, 0x80000002, &dd0, &di0))
  6127. return 0;
  6128. if (!ASN1Dec_KERB_TICKET(dd0, 0, &(val)->ticket))
  6129. return 0;
  6130. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  6131. return 0;
  6132. if (!ASN1BERDecEndOfContents(dec, dd, di))
  6133. return 0;
  6134. return 1;
  6135. }
  6136. static void ASN1CALL ASN1Free_KERB_TGT_REPLY(KERB_TGT_REPLY *val)
  6137. {
  6138. if (val) {
  6139. ASN1Free_KERB_TICKET(&(val)->ticket);
  6140. }
  6141. }
  6142. static int ASN1CALL ASN1Enc_KERB_SIGNED_REPLY_KEY_PACKAGE(ASN1encoding_t enc, ASN1uint32_t tag, KERB_SIGNED_REPLY_KEY_PACKAGE *val)
  6143. {
  6144. ASN1uint32_t nLenOff;
  6145. ASN1uint32_t nLenOff0;
  6146. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  6147. return 0;
  6148. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  6149. return 0;
  6150. if (!ASN1Enc_KERB_REPLY_KEY_PACKAGE2(enc, 0, &(val)->reply_key_package))
  6151. return 0;
  6152. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  6153. return 0;
  6154. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  6155. return 0;
  6156. if (!ASN1Enc_KERB_SIGNATURE(enc, 0, &(val)->reply_key_signature))
  6157. return 0;
  6158. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  6159. return 0;
  6160. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  6161. return 0;
  6162. return 1;
  6163. }
  6164. static int ASN1CALL ASN1Dec_KERB_SIGNED_REPLY_KEY_PACKAGE(ASN1decoding_t dec, ASN1uint32_t tag, KERB_SIGNED_REPLY_KEY_PACKAGE *val)
  6165. {
  6166. ASN1decoding_t dd;
  6167. ASN1octet_t *di;
  6168. ASN1decoding_t dd0;
  6169. ASN1octet_t *di0;
  6170. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  6171. return 0;
  6172. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  6173. return 0;
  6174. if (!ASN1Dec_KERB_REPLY_KEY_PACKAGE2(dd0, 0, &(val)->reply_key_package))
  6175. return 0;
  6176. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  6177. return 0;
  6178. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  6179. return 0;
  6180. if (!ASN1Dec_KERB_SIGNATURE(dd0, 0, &(val)->reply_key_signature))
  6181. return 0;
  6182. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  6183. return 0;
  6184. if (!ASN1BERDecEndOfContents(dec, dd, di))
  6185. return 0;
  6186. return 1;
  6187. }
  6188. static void ASN1CALL ASN1Free_KERB_SIGNED_REPLY_KEY_PACKAGE(KERB_SIGNED_REPLY_KEY_PACKAGE *val)
  6189. {
  6190. if (val) {
  6191. ASN1Free_KERB_REPLY_KEY_PACKAGE2(&(val)->reply_key_package);
  6192. ASN1Free_KERB_SIGNATURE(&(val)->reply_key_signature);
  6193. }
  6194. }
  6195. static int ASN1CALL ASN1Enc_KERB_SIGNED_KDC_PUBLIC_VALUE(ASN1encoding_t enc, ASN1uint32_t tag, KERB_SIGNED_KDC_PUBLIC_VALUE *val)
  6196. {
  6197. ASN1uint32_t nLenOff;
  6198. ASN1uint32_t nLenOff0;
  6199. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  6200. return 0;
  6201. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  6202. return 0;
  6203. if (!ASN1Enc_KERB_SUBJECT_PUBLIC_KEY_INFO(enc, 0, &(val)->kdc_public_value))
  6204. return 0;
  6205. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  6206. return 0;
  6207. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  6208. return 0;
  6209. if (!ASN1Enc_KERB_SIGNATURE(enc, 0, &(val)->kdc_public_value_sig))
  6210. return 0;
  6211. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  6212. return 0;
  6213. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  6214. return 0;
  6215. return 1;
  6216. }
  6217. static int ASN1CALL ASN1Dec_KERB_SIGNED_KDC_PUBLIC_VALUE(ASN1decoding_t dec, ASN1uint32_t tag, KERB_SIGNED_KDC_PUBLIC_VALUE *val)
  6218. {
  6219. ASN1decoding_t dd;
  6220. ASN1octet_t *di;
  6221. ASN1decoding_t dd0;
  6222. ASN1octet_t *di0;
  6223. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  6224. return 0;
  6225. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  6226. return 0;
  6227. if (!ASN1Dec_KERB_SUBJECT_PUBLIC_KEY_INFO(dd0, 0, &(val)->kdc_public_value))
  6228. return 0;
  6229. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  6230. return 0;
  6231. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  6232. return 0;
  6233. if (!ASN1Dec_KERB_SIGNATURE(dd0, 0, &(val)->kdc_public_value_sig))
  6234. return 0;
  6235. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  6236. return 0;
  6237. if (!ASN1BERDecEndOfContents(dec, dd, di))
  6238. return 0;
  6239. return 1;
  6240. }
  6241. static void ASN1CALL ASN1Free_KERB_SIGNED_KDC_PUBLIC_VALUE(KERB_SIGNED_KDC_PUBLIC_VALUE *val)
  6242. {
  6243. if (val) {
  6244. ASN1Free_KERB_SUBJECT_PUBLIC_KEY_INFO(&(val)->kdc_public_value);
  6245. ASN1Free_KERB_SIGNATURE(&(val)->kdc_public_value_sig);
  6246. }
  6247. }
  6248. static int ASN1CALL ASN1Enc_KERB_TRUSTED_CAS(ASN1encoding_t enc, ASN1uint32_t tag, KERB_TRUSTED_CAS *val)
  6249. {
  6250. ASN1uint32_t nLenOff0;
  6251. switch ((val)->choice) {
  6252. case 1:
  6253. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  6254. return 0;
  6255. if (!ASN1Enc_KERB_KERBEROS_NAME(enc, 0, &(val)->u.principal_name))
  6256. return 0;
  6257. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  6258. return 0;
  6259. break;
  6260. case 2:
  6261. if (!ASN1DEREncOctetString(enc, 0x80000001, ((val)->u.ca_name).length, ((val)->u.ca_name).value))
  6262. return 0;
  6263. break;
  6264. case 3:
  6265. if (!ASN1DEREncOctetString(enc, 0x80000002, ((val)->u.issuer_and_serial).length, ((val)->u.issuer_and_serial).value))
  6266. return 0;
  6267. break;
  6268. }
  6269. return 1;
  6270. }
  6271. static int ASN1CALL ASN1Dec_KERB_TRUSTED_CAS(ASN1decoding_t dec, ASN1uint32_t tag, KERB_TRUSTED_CAS *val)
  6272. {
  6273. ASN1uint32_t t;
  6274. ASN1decoding_t dd0;
  6275. ASN1octet_t *di0;
  6276. if (!ASN1BERDecPeekTag(dec, &t))
  6277. return 0;
  6278. switch (t) {
  6279. case 0x80000000:
  6280. (val)->choice = 1;
  6281. if (!ASN1BERDecExplicitTag(dec, 0x80000000, &dd0, &di0))
  6282. return 0;
  6283. if (!ASN1Dec_KERB_KERBEROS_NAME(dd0, 0, &(val)->u.principal_name))
  6284. return 0;
  6285. if (!ASN1BERDecEndOfContents(dec, dd0, di0))
  6286. return 0;
  6287. break;
  6288. case 0x80000001:
  6289. (val)->choice = 2;
  6290. if (!ASN1BERDecOctetString(dec, 0x80000001, &(val)->u.ca_name))
  6291. return 0;
  6292. break;
  6293. case 0x80000002:
  6294. (val)->choice = 3;
  6295. if (!ASN1BERDecOctetString(dec, 0x80000002, &(val)->u.issuer_and_serial))
  6296. return 0;
  6297. break;
  6298. default:
  6299. ASN1DecSetError(dec, ASN1_ERR_CORRUPT);
  6300. return 0;
  6301. }
  6302. return 1;
  6303. }
  6304. static void ASN1CALL ASN1Free_KERB_TRUSTED_CAS(KERB_TRUSTED_CAS *val)
  6305. {
  6306. if (val) {
  6307. switch ((val)->choice) {
  6308. case 1:
  6309. ASN1Free_KERB_KERBEROS_NAME(&(val)->u.principal_name);
  6310. break;
  6311. case 2:
  6312. ASN1octetstring_free(&(val)->u.ca_name);
  6313. break;
  6314. case 3:
  6315. ASN1octetstring_free(&(val)->u.issuer_and_serial);
  6316. break;
  6317. }
  6318. }
  6319. }
  6320. static int ASN1CALL ASN1Enc_KERB_AUTH_PACKAGE(ASN1encoding_t enc, ASN1uint32_t tag, KERB_AUTH_PACKAGE *val)
  6321. {
  6322. ASN1uint32_t nLenOff;
  6323. ASN1uint32_t nLenOff0;
  6324. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  6325. return 0;
  6326. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  6327. return 0;
  6328. if (!ASN1Enc_KERB_PK_AUTHENTICATOR(enc, 0, &(val)->pk_authenticator))
  6329. return 0;
  6330. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  6331. return 0;
  6332. if ((val)->o[0] & 0x80) {
  6333. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  6334. return 0;
  6335. if (!ASN1Enc_KERB_SUBJECT_PUBLIC_KEY_INFO(enc, 0, &(val)->client_public_value))
  6336. return 0;
  6337. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  6338. return 0;
  6339. }
  6340. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  6341. return 0;
  6342. return 1;
  6343. }
  6344. static int ASN1CALL ASN1Dec_KERB_AUTH_PACKAGE(ASN1decoding_t dec, ASN1uint32_t tag, KERB_AUTH_PACKAGE *val)
  6345. {
  6346. ASN1decoding_t dd;
  6347. ASN1octet_t *di;
  6348. ASN1decoding_t dd0;
  6349. ASN1octet_t *di0;
  6350. ASN1uint32_t t;
  6351. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  6352. return 0;
  6353. ZeroMemory((val)->o, 1);
  6354. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  6355. return 0;
  6356. if (!ASN1Dec_KERB_PK_AUTHENTICATOR(dd0, 0, &(val)->pk_authenticator))
  6357. return 0;
  6358. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  6359. return 0;
  6360. ASN1BERDecPeekTag(dd, &t);
  6361. if (t == 0x80000001) {
  6362. (val)->o[0] |= 0x80;
  6363. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  6364. return 0;
  6365. if (!ASN1Dec_KERB_SUBJECT_PUBLIC_KEY_INFO(dd0, 0, &(val)->client_public_value))
  6366. return 0;
  6367. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  6368. return 0;
  6369. }
  6370. if (!ASN1BERDecEndOfContents(dec, dd, di))
  6371. return 0;
  6372. return 1;
  6373. }
  6374. static void ASN1CALL ASN1Free_KERB_AUTH_PACKAGE(KERB_AUTH_PACKAGE *val)
  6375. {
  6376. if (val) {
  6377. ASN1Free_KERB_PK_AUTHENTICATOR(&(val)->pk_authenticator);
  6378. if ((val)->o[0] & 0x80) {
  6379. ASN1Free_KERB_SUBJECT_PUBLIC_KEY_INFO(&(val)->client_public_value);
  6380. }
  6381. }
  6382. }
  6383. static int ASN1CALL ASN1Enc_KERB_PA_PK_AS_REQ_trusted_certifiers(ASN1encoding_t enc, ASN1uint32_t tag, PKERB_PA_PK_AS_REQ_trusted_certifiers *val)
  6384. {
  6385. ASN1uint32_t nLenOff0;
  6386. PKERB_PA_PK_AS_REQ_trusted_certifiers f;
  6387. ASN1uint32_t nLenOff;
  6388. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x80000002, &nLenOff0))
  6389. return 0;
  6390. if (!ASN1BEREncExplicitTag(enc, 0x10, &nLenOff))
  6391. return 0;
  6392. for (f = *val; f; f = f->next) {
  6393. if (!ASN1Enc_KERB_TRUSTED_CAS(enc, 0, &f->value))
  6394. return 0;
  6395. }
  6396. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  6397. return 0;
  6398. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  6399. return 0;
  6400. return 1;
  6401. }
  6402. static int ASN1CALL ASN1Dec_KERB_PA_PK_AS_REQ_trusted_certifiers(ASN1decoding_t dec, ASN1uint32_t tag, PKERB_PA_PK_AS_REQ_trusted_certifiers *val)
  6403. {
  6404. PKERB_PA_PK_AS_REQ_trusted_certifiers *f;
  6405. ASN1decoding_t dd0;
  6406. ASN1octet_t *di0;
  6407. ASN1decoding_t dd;
  6408. ASN1octet_t *di;
  6409. ASN1uint32_t t;
  6410. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x80000002, &dd0, &di0))
  6411. return 0;
  6412. if (!ASN1BERDecExplicitTag(dd0, 0x10, &dd, &di))
  6413. return 0;
  6414. f = val;
  6415. while (ASN1BERDecNotEndOfContents(dd, di)) {
  6416. if (!ASN1BERDecPeekTag(dd, &t))
  6417. return 0;
  6418. if (!(*f = (PKERB_PA_PK_AS_REQ_trusted_certifiers)ASN1DecAlloc(dd, sizeof(**f))))
  6419. return 0;
  6420. if (!ASN1Dec_KERB_TRUSTED_CAS(dd, 0, &(*f)->value))
  6421. return 0;
  6422. f = &(*f)->next;
  6423. }
  6424. *f = NULL;
  6425. if (!ASN1BERDecEndOfContents(dd0, dd, di))
  6426. return 0;
  6427. if (!ASN1BERDecEndOfContents(dec, dd0, di0))
  6428. return 0;
  6429. return 1;
  6430. }
  6431. static void ASN1CALL ASN1Free_KERB_PA_PK_AS_REQ_trusted_certifiers(PKERB_PA_PK_AS_REQ_trusted_certifiers *val)
  6432. {
  6433. PKERB_PA_PK_AS_REQ_trusted_certifiers f, ff;
  6434. if (val) {
  6435. for (f = *val; f; f = ff) {
  6436. ASN1Free_KERB_TRUSTED_CAS(&f->value);
  6437. ff = f->next;
  6438. ASN1Free(f);
  6439. }
  6440. }
  6441. }
  6442. static int ASN1CALL ASN1Enc_KERB_ENCRYPTED_CRED_ticket_info(ASN1encoding_t enc, ASN1uint32_t tag, PKERB_ENCRYPTED_CRED_ticket_info *val)
  6443. {
  6444. ASN1uint32_t nLenOff0;
  6445. PKERB_ENCRYPTED_CRED_ticket_info f;
  6446. ASN1uint32_t nLenOff;
  6447. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x80000000, &nLenOff0))
  6448. return 0;
  6449. if (!ASN1BEREncExplicitTag(enc, 0x10, &nLenOff))
  6450. return 0;
  6451. for (f = *val; f; f = f->next) {
  6452. if (!ASN1Enc_KERB_CRED_INFO(enc, 0, &f->value))
  6453. return 0;
  6454. }
  6455. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  6456. return 0;
  6457. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  6458. return 0;
  6459. return 1;
  6460. }
  6461. static int ASN1CALL ASN1Dec_KERB_ENCRYPTED_CRED_ticket_info(ASN1decoding_t dec, ASN1uint32_t tag, PKERB_ENCRYPTED_CRED_ticket_info *val)
  6462. {
  6463. PKERB_ENCRYPTED_CRED_ticket_info *f;
  6464. ASN1decoding_t dd0;
  6465. ASN1octet_t *di0;
  6466. ASN1decoding_t dd;
  6467. ASN1octet_t *di;
  6468. ASN1uint32_t t;
  6469. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x80000000, &dd0, &di0))
  6470. return 0;
  6471. if (!ASN1BERDecExplicitTag(dd0, 0x10, &dd, &di))
  6472. return 0;
  6473. f = val;
  6474. while (ASN1BERDecNotEndOfContents(dd, di)) {
  6475. if (!ASN1BERDecPeekTag(dd, &t))
  6476. return 0;
  6477. if (!(*f = (PKERB_ENCRYPTED_CRED_ticket_info)ASN1DecAlloc(dd, sizeof(**f))))
  6478. return 0;
  6479. if (!ASN1Dec_KERB_CRED_INFO(dd, 0, &(*f)->value))
  6480. return 0;
  6481. f = &(*f)->next;
  6482. }
  6483. *f = NULL;
  6484. if (!ASN1BERDecEndOfContents(dd0, dd, di))
  6485. return 0;
  6486. if (!ASN1BERDecEndOfContents(dec, dd0, di0))
  6487. return 0;
  6488. return 1;
  6489. }
  6490. static void ASN1CALL ASN1Free_KERB_ENCRYPTED_CRED_ticket_info(PKERB_ENCRYPTED_CRED_ticket_info *val)
  6491. {
  6492. PKERB_ENCRYPTED_CRED_ticket_info f, ff;
  6493. if (val) {
  6494. for (f = *val; f; f = ff) {
  6495. ASN1Free_KERB_CRED_INFO(&f->value);
  6496. ff = f->next;
  6497. ASN1Free(f);
  6498. }
  6499. }
  6500. }
  6501. static int ASN1CALL ASN1Enc_KERB_CRED_tickets(ASN1encoding_t enc, ASN1uint32_t tag, PKERB_CRED_tickets *val)
  6502. {
  6503. ASN1uint32_t nLenOff0;
  6504. PKERB_CRED_tickets f;
  6505. ASN1uint32_t nLenOff;
  6506. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x80000002, &nLenOff0))
  6507. return 0;
  6508. if (!ASN1BEREncExplicitTag(enc, 0x10, &nLenOff))
  6509. return 0;
  6510. for (f = *val; f; f = f->next) {
  6511. if (!ASN1Enc_KERB_TICKET(enc, 0, &f->value))
  6512. return 0;
  6513. }
  6514. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  6515. return 0;
  6516. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  6517. return 0;
  6518. return 1;
  6519. }
  6520. static int ASN1CALL ASN1Dec_KERB_CRED_tickets(ASN1decoding_t dec, ASN1uint32_t tag, PKERB_CRED_tickets *val)
  6521. {
  6522. PKERB_CRED_tickets *f;
  6523. ASN1decoding_t dd0;
  6524. ASN1octet_t *di0;
  6525. ASN1decoding_t dd;
  6526. ASN1octet_t *di;
  6527. ASN1uint32_t t;
  6528. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x80000002, &dd0, &di0))
  6529. return 0;
  6530. if (!ASN1BERDecExplicitTag(dd0, 0x10, &dd, &di))
  6531. return 0;
  6532. f = val;
  6533. while (ASN1BERDecNotEndOfContents(dd, di)) {
  6534. if (!ASN1BERDecPeekTag(dd, &t))
  6535. return 0;
  6536. if (!(*f = (PKERB_CRED_tickets)ASN1DecAlloc(dd, sizeof(**f))))
  6537. return 0;
  6538. if (!ASN1Dec_KERB_TICKET(dd, 0, &(*f)->value))
  6539. return 0;
  6540. f = &(*f)->next;
  6541. }
  6542. *f = NULL;
  6543. if (!ASN1BERDecEndOfContents(dd0, dd, di))
  6544. return 0;
  6545. if (!ASN1BERDecEndOfContents(dec, dd0, di0))
  6546. return 0;
  6547. return 1;
  6548. }
  6549. static void ASN1CALL ASN1Free_KERB_CRED_tickets(PKERB_CRED_tickets *val)
  6550. {
  6551. PKERB_CRED_tickets f, ff;
  6552. if (val) {
  6553. for (f = *val; f; f = ff) {
  6554. ASN1Free_KERB_TICKET(&f->value);
  6555. ff = f->next;
  6556. ASN1Free(f);
  6557. }
  6558. }
  6559. }
  6560. static int ASN1CALL ASN1Enc_KERB_KDC_REQUEST_BODY_additional_tickets(ASN1encoding_t enc, ASN1uint32_t tag, PKERB_KDC_REQUEST_BODY_additional_tickets *val)
  6561. {
  6562. ASN1uint32_t nLenOff0;
  6563. PKERB_KDC_REQUEST_BODY_additional_tickets f;
  6564. ASN1uint32_t nLenOff;
  6565. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x8000000b, &nLenOff0))
  6566. return 0;
  6567. if (!ASN1BEREncExplicitTag(enc, 0x10, &nLenOff))
  6568. return 0;
  6569. for (f = *val; f; f = f->next) {
  6570. if (!ASN1Enc_KERB_TICKET(enc, 0, &f->value))
  6571. return 0;
  6572. }
  6573. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  6574. return 0;
  6575. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  6576. return 0;
  6577. return 1;
  6578. }
  6579. static int ASN1CALL ASN1Dec_KERB_KDC_REQUEST_BODY_additional_tickets(ASN1decoding_t dec, ASN1uint32_t tag, PKERB_KDC_REQUEST_BODY_additional_tickets *val)
  6580. {
  6581. PKERB_KDC_REQUEST_BODY_additional_tickets *f;
  6582. ASN1decoding_t dd0;
  6583. ASN1octet_t *di0;
  6584. ASN1decoding_t dd;
  6585. ASN1octet_t *di;
  6586. ASN1uint32_t t;
  6587. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x8000000b, &dd0, &di0))
  6588. return 0;
  6589. if (!ASN1BERDecExplicitTag(dd0, 0x10, &dd, &di))
  6590. return 0;
  6591. f = val;
  6592. while (ASN1BERDecNotEndOfContents(dd, di)) {
  6593. if (!ASN1BERDecPeekTag(dd, &t))
  6594. return 0;
  6595. if (!(*f = (PKERB_KDC_REQUEST_BODY_additional_tickets)ASN1DecAlloc(dd, sizeof(**f))))
  6596. return 0;
  6597. if (!ASN1Dec_KERB_TICKET(dd, 0, &(*f)->value))
  6598. return 0;
  6599. f = &(*f)->next;
  6600. }
  6601. *f = NULL;
  6602. if (!ASN1BERDecEndOfContents(dd0, dd, di))
  6603. return 0;
  6604. if (!ASN1BERDecEndOfContents(dec, dd0, di0))
  6605. return 0;
  6606. return 1;
  6607. }
  6608. static void ASN1CALL ASN1Free_KERB_KDC_REQUEST_BODY_additional_tickets(PKERB_KDC_REQUEST_BODY_additional_tickets *val)
  6609. {
  6610. PKERB_KDC_REQUEST_BODY_additional_tickets f, ff;
  6611. if (val) {
  6612. for (f = *val; f; f = ff) {
  6613. ASN1Free_KERB_TICKET(&f->value);
  6614. ff = f->next;
  6615. ASN1Free(f);
  6616. }
  6617. }
  6618. }
  6619. static int ASN1CALL ASN1Enc_KERB_KDC_REQUEST(ASN1encoding_t enc, ASN1uint32_t tag, KERB_KDC_REQUEST *val)
  6620. {
  6621. ASN1uint32_t nLenOff;
  6622. ASN1uint32_t nLenOff0;
  6623. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  6624. return 0;
  6625. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  6626. return 0;
  6627. if (!ASN1BEREncS32(enc, 0x2, (val)->version))
  6628. return 0;
  6629. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  6630. return 0;
  6631. if (!ASN1BEREncExplicitTag(enc, 0x80000002, &nLenOff0))
  6632. return 0;
  6633. if (!ASN1BEREncS32(enc, 0x2, (val)->message_type))
  6634. return 0;
  6635. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  6636. return 0;
  6637. if ((val)->o[0] & 0x80) {
  6638. if (!ASN1Enc_KERB_KDC_REQUEST_preauth_data(enc, 0, &(val)->preauth_data))
  6639. return 0;
  6640. }
  6641. if (!ASN1BEREncExplicitTag(enc, 0x80000004, &nLenOff0))
  6642. return 0;
  6643. if (!ASN1Enc_KERB_KDC_REQUEST_BODY(enc, 0, &(val)->request_body))
  6644. return 0;
  6645. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  6646. return 0;
  6647. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  6648. return 0;
  6649. return 1;
  6650. }
  6651. static int ASN1CALL ASN1Dec_KERB_KDC_REQUEST(ASN1decoding_t dec, ASN1uint32_t tag, KERB_KDC_REQUEST *val)
  6652. {
  6653. ASN1decoding_t dd;
  6654. ASN1octet_t *di;
  6655. ASN1decoding_t dd0;
  6656. ASN1octet_t *di0;
  6657. ASN1uint32_t t;
  6658. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  6659. return 0;
  6660. ZeroMemory((val)->o, 1);
  6661. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  6662. return 0;
  6663. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->version))
  6664. return 0;
  6665. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  6666. return 0;
  6667. if (!ASN1BERDecExplicitTag(dd, 0x80000002, &dd0, &di0))
  6668. return 0;
  6669. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->message_type))
  6670. return 0;
  6671. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  6672. return 0;
  6673. ASN1BERDecPeekTag(dd, &t);
  6674. if (t == 0x80000003) {
  6675. (val)->o[0] |= 0x80;
  6676. if (!ASN1Dec_KERB_KDC_REQUEST_preauth_data(dd, 0, &(val)->preauth_data))
  6677. return 0;
  6678. }
  6679. if (!ASN1BERDecExplicitTag(dd, 0x80000004, &dd0, &di0))
  6680. return 0;
  6681. if (!ASN1Dec_KERB_KDC_REQUEST_BODY(dd0, 0, &(val)->request_body))
  6682. return 0;
  6683. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  6684. return 0;
  6685. if (!ASN1BERDecEndOfContents(dec, dd, di))
  6686. return 0;
  6687. return 1;
  6688. }
  6689. static void ASN1CALL ASN1Free_KERB_KDC_REQUEST(KERB_KDC_REQUEST *val)
  6690. {
  6691. if (val) {
  6692. if ((val)->o[0] & 0x80) {
  6693. ASN1Free_KERB_KDC_REQUEST_preauth_data(&(val)->preauth_data);
  6694. }
  6695. ASN1Free_KERB_KDC_REQUEST_BODY(&(val)->request_body);
  6696. }
  6697. }
  6698. static int ASN1CALL ASN1Enc_KERB_MARSHALLED_REQUEST_BODY(ASN1encoding_t enc, ASN1uint32_t tag, KERB_MARSHALLED_REQUEST_BODY *val)
  6699. {
  6700. if (!ASN1Enc_KERB_KDC_REQUEST_BODY(enc, tag, val))
  6701. return 0;
  6702. return 1;
  6703. }
  6704. static int ASN1CALL ASN1Dec_KERB_MARSHALLED_REQUEST_BODY(ASN1decoding_t dec, ASN1uint32_t tag, KERB_MARSHALLED_REQUEST_BODY *val)
  6705. {
  6706. if (!ASN1Dec_KERB_KDC_REQUEST_BODY(dec, tag, val))
  6707. return 0;
  6708. return 1;
  6709. }
  6710. static void ASN1CALL ASN1Free_KERB_MARSHALLED_REQUEST_BODY(KERB_MARSHALLED_REQUEST_BODY *val)
  6711. {
  6712. if (val) {
  6713. ASN1Free_KERB_KDC_REQUEST_BODY(val);
  6714. }
  6715. }
  6716. static int ASN1CALL ASN1Enc_KERB_AS_REPLY(ASN1encoding_t enc, ASN1uint32_t tag, KERB_AS_REPLY *val)
  6717. {
  6718. ASN1uint32_t nLenOff0;
  6719. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x4000000b, &nLenOff0))
  6720. return 0;
  6721. if (!ASN1Enc_KERB_KDC_REPLY(enc, 0, val))
  6722. return 0;
  6723. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  6724. return 0;
  6725. return 1;
  6726. }
  6727. static int ASN1CALL ASN1Dec_KERB_AS_REPLY(ASN1decoding_t dec, ASN1uint32_t tag, KERB_AS_REPLY *val)
  6728. {
  6729. ASN1decoding_t dd0;
  6730. ASN1octet_t *di0;
  6731. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x4000000b, &dd0, &di0))
  6732. return 0;
  6733. if (!ASN1Dec_KERB_KDC_REPLY(dd0, 0, val))
  6734. return 0;
  6735. if (!ASN1BERDecEndOfContents(dec, dd0, di0))
  6736. return 0;
  6737. return 1;
  6738. }
  6739. static void ASN1CALL ASN1Free_KERB_AS_REPLY(KERB_AS_REPLY *val)
  6740. {
  6741. if (val) {
  6742. ASN1Free_KERB_KDC_REPLY(val);
  6743. }
  6744. }
  6745. static int ASN1CALL ASN1Enc_KERB_TGS_REPLY(ASN1encoding_t enc, ASN1uint32_t tag, KERB_TGS_REPLY *val)
  6746. {
  6747. ASN1uint32_t nLenOff0;
  6748. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x4000000d, &nLenOff0))
  6749. return 0;
  6750. if (!ASN1Enc_KERB_KDC_REPLY(enc, 0, val))
  6751. return 0;
  6752. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  6753. return 0;
  6754. return 1;
  6755. }
  6756. static int ASN1CALL ASN1Dec_KERB_TGS_REPLY(ASN1decoding_t dec, ASN1uint32_t tag, KERB_TGS_REPLY *val)
  6757. {
  6758. ASN1decoding_t dd0;
  6759. ASN1octet_t *di0;
  6760. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x4000000d, &dd0, &di0))
  6761. return 0;
  6762. if (!ASN1Dec_KERB_KDC_REPLY(dd0, 0, val))
  6763. return 0;
  6764. if (!ASN1BERDecEndOfContents(dec, dd0, di0))
  6765. return 0;
  6766. return 1;
  6767. }
  6768. static void ASN1CALL ASN1Free_KERB_TGS_REPLY(KERB_TGS_REPLY *val)
  6769. {
  6770. if (val) {
  6771. ASN1Free_KERB_KDC_REPLY(val);
  6772. }
  6773. }
  6774. static int ASN1CALL ASN1Enc_KERB_ENCRYPTED_AS_REPLY(ASN1encoding_t enc, ASN1uint32_t tag, KERB_ENCRYPTED_AS_REPLY *val)
  6775. {
  6776. ASN1uint32_t nLenOff0;
  6777. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x40000019, &nLenOff0))
  6778. return 0;
  6779. if (!ASN1Enc_KERB_ENCRYPTED_KDC_REPLY(enc, 0, val))
  6780. return 0;
  6781. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  6782. return 0;
  6783. return 1;
  6784. }
  6785. static int ASN1CALL ASN1Dec_KERB_ENCRYPTED_AS_REPLY(ASN1decoding_t dec, ASN1uint32_t tag, KERB_ENCRYPTED_AS_REPLY *val)
  6786. {
  6787. ASN1decoding_t dd0;
  6788. ASN1octet_t *di0;
  6789. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x40000019, &dd0, &di0))
  6790. return 0;
  6791. if (!ASN1Dec_KERB_ENCRYPTED_KDC_REPLY(dd0, 0, val))
  6792. return 0;
  6793. if (!ASN1BERDecEndOfContents(dec, dd0, di0))
  6794. return 0;
  6795. return 1;
  6796. }
  6797. static void ASN1CALL ASN1Free_KERB_ENCRYPTED_AS_REPLY(KERB_ENCRYPTED_AS_REPLY *val)
  6798. {
  6799. if (val) {
  6800. ASN1Free_KERB_ENCRYPTED_KDC_REPLY(val);
  6801. }
  6802. }
  6803. static int ASN1CALL ASN1Enc_KERB_ENCRYPTED_TGS_REPLY(ASN1encoding_t enc, ASN1uint32_t tag, KERB_ENCRYPTED_TGS_REPLY *val)
  6804. {
  6805. ASN1uint32_t nLenOff0;
  6806. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x4000001a, &nLenOff0))
  6807. return 0;
  6808. if (!ASN1Enc_KERB_ENCRYPTED_KDC_REPLY(enc, 0, val))
  6809. return 0;
  6810. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  6811. return 0;
  6812. return 1;
  6813. }
  6814. static int ASN1CALL ASN1Dec_KERB_ENCRYPTED_TGS_REPLY(ASN1decoding_t dec, ASN1uint32_t tag, KERB_ENCRYPTED_TGS_REPLY *val)
  6815. {
  6816. ASN1decoding_t dd0;
  6817. ASN1octet_t *di0;
  6818. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x4000001a, &dd0, &di0))
  6819. return 0;
  6820. if (!ASN1Dec_KERB_ENCRYPTED_KDC_REPLY(dd0, 0, val))
  6821. return 0;
  6822. if (!ASN1BERDecEndOfContents(dec, dd0, di0))
  6823. return 0;
  6824. return 1;
  6825. }
  6826. static void ASN1CALL ASN1Free_KERB_ENCRYPTED_TGS_REPLY(KERB_ENCRYPTED_TGS_REPLY *val)
  6827. {
  6828. if (val) {
  6829. ASN1Free_KERB_ENCRYPTED_KDC_REPLY(val);
  6830. }
  6831. }
  6832. static int ASN1CALL ASN1Enc_KERB_PA_PK_AS_REP2(ASN1encoding_t enc, ASN1uint32_t tag, KERB_PA_PK_AS_REP2 *val)
  6833. {
  6834. ASN1uint32_t nLenOff;
  6835. ASN1uint32_t nLenOff0;
  6836. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  6837. return 0;
  6838. if ((val)->o[0] & 0x80) {
  6839. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  6840. return 0;
  6841. if (!ASN1Enc_KERB_ENCRYPTED_DATA(enc, 0, &(val)->key_package))
  6842. return 0;
  6843. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  6844. return 0;
  6845. }
  6846. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  6847. return 0;
  6848. if (!ASN1Enc_KERB_ENVELOPED_KEY_PACKAGE(enc, 0, &(val)->temp_key_package))
  6849. return 0;
  6850. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  6851. return 0;
  6852. if ((val)->o[0] & 0x40) {
  6853. if (!ASN1BEREncExplicitTag(enc, 0x80000002, &nLenOff0))
  6854. return 0;
  6855. if (!ASN1Enc_KERB_SIGNED_KDC_PUBLIC_VALUE(enc, 0, &(val)->signed_kdc_public_value))
  6856. return 0;
  6857. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  6858. return 0;
  6859. }
  6860. if ((val)->o[0] & 0x20) {
  6861. if (!ASN1Enc_KERB_PA_PK_AS_REP2_kdc_cert(enc, 0, &(val)->kdc_cert))
  6862. return 0;
  6863. }
  6864. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  6865. return 0;
  6866. return 1;
  6867. }
  6868. static int ASN1CALL ASN1Dec_KERB_PA_PK_AS_REP2(ASN1decoding_t dec, ASN1uint32_t tag, KERB_PA_PK_AS_REP2 *val)
  6869. {
  6870. ASN1decoding_t dd;
  6871. ASN1octet_t *di;
  6872. ASN1uint32_t t;
  6873. ASN1decoding_t dd0;
  6874. ASN1octet_t *di0;
  6875. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  6876. return 0;
  6877. ZeroMemory((val)->o, 1);
  6878. ASN1BERDecPeekTag(dd, &t);
  6879. if (t == 0x80000000) {
  6880. (val)->o[0] |= 0x80;
  6881. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  6882. return 0;
  6883. if (!ASN1Dec_KERB_ENCRYPTED_DATA(dd0, 0, &(val)->key_package))
  6884. return 0;
  6885. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  6886. return 0;
  6887. }
  6888. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  6889. return 0;
  6890. if (!ASN1Dec_KERB_ENVELOPED_KEY_PACKAGE(dd0, 0, &(val)->temp_key_package))
  6891. return 0;
  6892. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  6893. return 0;
  6894. ASN1BERDecPeekTag(dd, &t);
  6895. if (t == 0x80000002) {
  6896. (val)->o[0] |= 0x40;
  6897. if (!ASN1BERDecExplicitTag(dd, 0x80000002, &dd0, &di0))
  6898. return 0;
  6899. if (!ASN1Dec_KERB_SIGNED_KDC_PUBLIC_VALUE(dd0, 0, &(val)->signed_kdc_public_value))
  6900. return 0;
  6901. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  6902. return 0;
  6903. }
  6904. ASN1BERDecPeekTag(dd, &t);
  6905. if (t == 0x80000003) {
  6906. (val)->o[0] |= 0x20;
  6907. if (!ASN1Dec_KERB_PA_PK_AS_REP2_kdc_cert(dd, 0, &(val)->kdc_cert))
  6908. return 0;
  6909. }
  6910. if (!ASN1BERDecEndOfContents(dec, dd, di))
  6911. return 0;
  6912. return 1;
  6913. }
  6914. static void ASN1CALL ASN1Free_KERB_PA_PK_AS_REP2(KERB_PA_PK_AS_REP2 *val)
  6915. {
  6916. if (val) {
  6917. if ((val)->o[0] & 0x80) {
  6918. ASN1Free_KERB_ENCRYPTED_DATA(&(val)->key_package);
  6919. }
  6920. ASN1Free_KERB_ENVELOPED_KEY_PACKAGE(&(val)->temp_key_package);
  6921. if ((val)->o[0] & 0x40) {
  6922. ASN1Free_KERB_SIGNED_KDC_PUBLIC_VALUE(&(val)->signed_kdc_public_value);
  6923. }
  6924. if ((val)->o[0] & 0x20) {
  6925. ASN1Free_KERB_PA_PK_AS_REP2_kdc_cert(&(val)->kdc_cert);
  6926. }
  6927. }
  6928. }
  6929. static int ASN1CALL ASN1Enc_KERB_SIGNED_AUTH_PACKAGE(ASN1encoding_t enc, ASN1uint32_t tag, KERB_SIGNED_AUTH_PACKAGE *val)
  6930. {
  6931. ASN1uint32_t nLenOff;
  6932. ASN1uint32_t nLenOff0;
  6933. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  6934. return 0;
  6935. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  6936. return 0;
  6937. if (!ASN1Enc_KERB_AUTH_PACKAGE(enc, 0, &(val)->auth_package))
  6938. return 0;
  6939. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  6940. return 0;
  6941. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  6942. return 0;
  6943. if (!ASN1Enc_KERB_SIGNATURE(enc, 0, &(val)->auth_package_signature))
  6944. return 0;
  6945. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  6946. return 0;
  6947. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  6948. return 0;
  6949. return 1;
  6950. }
  6951. static int ASN1CALL ASN1Dec_KERB_SIGNED_AUTH_PACKAGE(ASN1decoding_t dec, ASN1uint32_t tag, KERB_SIGNED_AUTH_PACKAGE *val)
  6952. {
  6953. ASN1decoding_t dd;
  6954. ASN1octet_t *di;
  6955. ASN1decoding_t dd0;
  6956. ASN1octet_t *di0;
  6957. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  6958. return 0;
  6959. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  6960. return 0;
  6961. if (!ASN1Dec_KERB_AUTH_PACKAGE(dd0, 0, &(val)->auth_package))
  6962. return 0;
  6963. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  6964. return 0;
  6965. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  6966. return 0;
  6967. if (!ASN1Dec_KERB_SIGNATURE(dd0, 0, &(val)->auth_package_signature))
  6968. return 0;
  6969. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  6970. return 0;
  6971. if (!ASN1BERDecEndOfContents(dec, dd, di))
  6972. return 0;
  6973. return 1;
  6974. }
  6975. static void ASN1CALL ASN1Free_KERB_SIGNED_AUTH_PACKAGE(KERB_SIGNED_AUTH_PACKAGE *val)
  6976. {
  6977. if (val) {
  6978. ASN1Free_KERB_AUTH_PACKAGE(&(val)->auth_package);
  6979. ASN1Free_KERB_SIGNATURE(&(val)->auth_package_signature);
  6980. }
  6981. }
  6982. static int ASN1CALL ASN1Enc_KERB_AS_REQUEST(ASN1encoding_t enc, ASN1uint32_t tag, KERB_AS_REQUEST *val)
  6983. {
  6984. ASN1uint32_t nLenOff0;
  6985. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x4000000a, &nLenOff0))
  6986. return 0;
  6987. if (!ASN1Enc_KERB_KDC_REQUEST(enc, 0, val))
  6988. return 0;
  6989. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  6990. return 0;
  6991. return 1;
  6992. }
  6993. static int ASN1CALL ASN1Dec_KERB_AS_REQUEST(ASN1decoding_t dec, ASN1uint32_t tag, KERB_AS_REQUEST *val)
  6994. {
  6995. ASN1decoding_t dd0;
  6996. ASN1octet_t *di0;
  6997. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x4000000a, &dd0, &di0))
  6998. return 0;
  6999. if (!ASN1Dec_KERB_KDC_REQUEST(dd0, 0, val))
  7000. return 0;
  7001. if (!ASN1BERDecEndOfContents(dec, dd0, di0))
  7002. return 0;
  7003. return 1;
  7004. }
  7005. static void ASN1CALL ASN1Free_KERB_AS_REQUEST(KERB_AS_REQUEST *val)
  7006. {
  7007. if (val) {
  7008. ASN1Free_KERB_KDC_REQUEST(val);
  7009. }
  7010. }
  7011. static int ASN1CALL ASN1Enc_KERB_TGS_REQUEST(ASN1encoding_t enc, ASN1uint32_t tag, KERB_TGS_REQUEST *val)
  7012. {
  7013. ASN1uint32_t nLenOff0;
  7014. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x4000000c, &nLenOff0))
  7015. return 0;
  7016. if (!ASN1Enc_KERB_KDC_REQUEST(enc, 0, val))
  7017. return 0;
  7018. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  7019. return 0;
  7020. return 1;
  7021. }
  7022. static int ASN1CALL ASN1Dec_KERB_TGS_REQUEST(ASN1decoding_t dec, ASN1uint32_t tag, KERB_TGS_REQUEST *val)
  7023. {
  7024. ASN1decoding_t dd0;
  7025. ASN1octet_t *di0;
  7026. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x4000000c, &dd0, &di0))
  7027. return 0;
  7028. if (!ASN1Dec_KERB_KDC_REQUEST(dd0, 0, val))
  7029. return 0;
  7030. if (!ASN1BERDecEndOfContents(dec, dd0, di0))
  7031. return 0;
  7032. return 1;
  7033. }
  7034. static void ASN1CALL ASN1Free_KERB_TGS_REQUEST(KERB_TGS_REQUEST *val)
  7035. {
  7036. if (val) {
  7037. ASN1Free_KERB_KDC_REQUEST(val);
  7038. }
  7039. }
  7040. static int ASN1CALL ASN1Enc_KERB_PA_PK_AS_REQ2(ASN1encoding_t enc, ASN1uint32_t tag, KERB_PA_PK_AS_REQ2 *val)
  7041. {
  7042. ASN1uint32_t nLenOff;
  7043. ASN1uint32_t nLenOff0;
  7044. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  7045. return 0;
  7046. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  7047. return 0;
  7048. if (!ASN1Enc_KERB_SIGNED_AUTH_PACKAGE(enc, 0, &(val)->signed_auth_pack))
  7049. return 0;
  7050. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  7051. return 0;
  7052. if ((val)->o[0] & 0x80) {
  7053. if (!ASN1Enc_KERB_PA_PK_AS_REQ2_user_certs(enc, 0, &(val)->user_certs))
  7054. return 0;
  7055. }
  7056. if ((val)->o[0] & 0x40) {
  7057. if (!ASN1Enc_KERB_PA_PK_AS_REQ2_trusted_certifiers(enc, 0, &(val)->trusted_certifiers))
  7058. return 0;
  7059. }
  7060. if ((val)->o[0] & 0x20) {
  7061. if (!ASN1BEREncExplicitTag(enc, 0x80000003, &nLenOff0))
  7062. return 0;
  7063. if (!ASN1BEREncS32(enc, 0x2, (val)->serial_number))
  7064. return 0;
  7065. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  7066. return 0;
  7067. }
  7068. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  7069. return 0;
  7070. return 1;
  7071. }
  7072. static int ASN1CALL ASN1Dec_KERB_PA_PK_AS_REQ2(ASN1decoding_t dec, ASN1uint32_t tag, KERB_PA_PK_AS_REQ2 *val)
  7073. {
  7074. ASN1decoding_t dd;
  7075. ASN1octet_t *di;
  7076. ASN1decoding_t dd0;
  7077. ASN1octet_t *di0;
  7078. ASN1uint32_t t;
  7079. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  7080. return 0;
  7081. ZeroMemory((val)->o, 1);
  7082. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  7083. return 0;
  7084. if (!ASN1Dec_KERB_SIGNED_AUTH_PACKAGE(dd0, 0, &(val)->signed_auth_pack))
  7085. return 0;
  7086. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  7087. return 0;
  7088. ASN1BERDecPeekTag(dd, &t);
  7089. if (t == 0x80000001) {
  7090. (val)->o[0] |= 0x80;
  7091. if (!ASN1Dec_KERB_PA_PK_AS_REQ2_user_certs(dd, 0, &(val)->user_certs))
  7092. return 0;
  7093. }
  7094. ASN1BERDecPeekTag(dd, &t);
  7095. if (t == 0x80000002) {
  7096. (val)->o[0] |= 0x40;
  7097. if (!ASN1Dec_KERB_PA_PK_AS_REQ2_trusted_certifiers(dd, 0, &(val)->trusted_certifiers))
  7098. return 0;
  7099. }
  7100. ASN1BERDecPeekTag(dd, &t);
  7101. if (t == 0x80000003) {
  7102. (val)->o[0] |= 0x20;
  7103. if (!ASN1BERDecExplicitTag(dd, 0x80000003, &dd0, &di0))
  7104. return 0;
  7105. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->serial_number))
  7106. return 0;
  7107. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  7108. return 0;
  7109. }
  7110. if (!ASN1BERDecEndOfContents(dec, dd, di))
  7111. return 0;
  7112. return 1;
  7113. }
  7114. static void ASN1CALL ASN1Free_KERB_PA_PK_AS_REQ2(KERB_PA_PK_AS_REQ2 *val)
  7115. {
  7116. if (val) {
  7117. ASN1Free_KERB_SIGNED_AUTH_PACKAGE(&(val)->signed_auth_pack);
  7118. if ((val)->o[0] & 0x80) {
  7119. ASN1Free_KERB_PA_PK_AS_REQ2_user_certs(&(val)->user_certs);
  7120. }
  7121. if ((val)->o[0] & 0x40) {
  7122. ASN1Free_KERB_PA_PK_AS_REQ2_trusted_certifiers(&(val)->trusted_certifiers);
  7123. }
  7124. }
  7125. }