Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

7459 lines
257 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 nLenOff0;
  3757. ASN1uint32_t t;
  3758. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  3759. return 0;
  3760. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  3761. return 0;
  3762. if (!ASN1Enc_KERB_PRINCIPAL_NAME(enc, 0, &(val)->userName))
  3763. return 0;
  3764. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  3765. return 0;
  3766. t = lstrlenA((val)->userRealm);
  3767. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  3768. return 0;
  3769. if (!ASN1DEREncCharString(enc, 0x1b, t, (val)->userRealm))
  3770. return 0;
  3771. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  3772. return 0;
  3773. if (!ASN1BEREncExplicitTag(enc, 0x80000002, &nLenOff0))
  3774. return 0;
  3775. if (!ASN1Enc_KERB_CHECKSUM(enc, 0, &(val)->cksum))
  3776. return 0;
  3777. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  3778. return 0;
  3779. t = lstrlenA((val)->authentication_package);
  3780. if (!ASN1BEREncExplicitTag(enc, 0x80000003, &nLenOff0))
  3781. return 0;
  3782. if (!ASN1DEREncCharString(enc, 0x1b, t, (val)->authentication_package))
  3783. return 0;
  3784. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  3785. return 0;
  3786. if ((val)->o[0] & 0x80) {
  3787. if (!ASN1BEREncExplicitTag(enc, 0x80000004, &nLenOff0))
  3788. return 0;
  3789. if (!ASN1DEREncOctetString(enc, 0x4, ((val)->authorization_data).length, ((val)->authorization_data).value))
  3790. return 0;
  3791. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  3792. return 0;
  3793. }
  3794. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  3795. return 0;
  3796. return 1;
  3797. }
  3798. static int ASN1CALL ASN1Dec_KERB_PA_FOR_USER(ASN1decoding_t dec, ASN1uint32_t tag, KERB_PA_FOR_USER *val)
  3799. {
  3800. ASN1decoding_t dd;
  3801. ASN1octet_t *di;
  3802. ASN1decoding_t dd0;
  3803. ASN1octet_t *di0;
  3804. ASN1uint32_t t;
  3805. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  3806. return 0;
  3807. ZeroMemory((val)->o, 1);
  3808. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  3809. return 0;
  3810. if (!ASN1Dec_KERB_PRINCIPAL_NAME(dd0, 0, &(val)->userName))
  3811. return 0;
  3812. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  3813. return 0;
  3814. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  3815. return 0;
  3816. if (!ASN1BERDecZeroCharString(dd0, 0x1b, &(val)->userRealm))
  3817. return 0;
  3818. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  3819. return 0;
  3820. if (!ASN1BERDecExplicitTag(dd, 0x80000002, &dd0, &di0))
  3821. return 0;
  3822. if (!ASN1Dec_KERB_CHECKSUM(dd0, 0, &(val)->cksum))
  3823. return 0;
  3824. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  3825. return 0;
  3826. if (!ASN1BERDecExplicitTag(dd, 0x80000003, &dd0, &di0))
  3827. return 0;
  3828. if (!ASN1BERDecZeroCharString(dd0, 0x1b, &(val)->authentication_package))
  3829. return 0;
  3830. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  3831. return 0;
  3832. ASN1BERDecPeekTag(dd, &t);
  3833. if (t == 0x80000004) {
  3834. (val)->o[0] |= 0x80;
  3835. if (!ASN1BERDecExplicitTag(dd, 0x80000004, &dd0, &di0))
  3836. return 0;
  3837. if (!ASN1BERDecOctetString(dd0, 0x4, &(val)->authorization_data))
  3838. return 0;
  3839. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  3840. return 0;
  3841. }
  3842. while (ASN1BERDecNotEndOfContents(dd, di)) {
  3843. if (!ASN1BERDecSkip(dd))
  3844. return 0;
  3845. }
  3846. if (!ASN1BERDecEndOfContents(dec, dd, di))
  3847. return 0;
  3848. return 1;
  3849. }
  3850. static void ASN1CALL ASN1Free_KERB_PA_FOR_USER(KERB_PA_FOR_USER *val)
  3851. {
  3852. if (val) {
  3853. ASN1Free_KERB_PRINCIPAL_NAME(&(val)->userName);
  3854. ASN1ztcharstring_free((val)->userRealm);
  3855. ASN1Free_KERB_CHECKSUM(&(val)->cksum);
  3856. ASN1ztcharstring_free((val)->authentication_package);
  3857. if ((val)->o[0] & 0x80) {
  3858. ASN1octetstring_free(&(val)->authorization_data);
  3859. }
  3860. }
  3861. }
  3862. static int ASN1CALL ASN1Enc_KERB_KDC_ISSUED_AUTH_DATA_elements(ASN1encoding_t enc, ASN1uint32_t tag, PKERB_KDC_ISSUED_AUTH_DATA_elements *val)
  3863. {
  3864. ASN1uint32_t nLenOff0;
  3865. PKERB_KDC_ISSUED_AUTH_DATA_elements f;
  3866. ASN1uint32_t nLenOff;
  3867. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x80000001, &nLenOff0))
  3868. return 0;
  3869. if (!ASN1BEREncExplicitTag(enc, 0x10, &nLenOff))
  3870. return 0;
  3871. for (f = *val; f; f = f->next) {
  3872. if (!ASN1Enc_KERB_PA_DATA(enc, 0, &f->value))
  3873. return 0;
  3874. }
  3875. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  3876. return 0;
  3877. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  3878. return 0;
  3879. return 1;
  3880. }
  3881. static int ASN1CALL ASN1Dec_KERB_KDC_ISSUED_AUTH_DATA_elements(ASN1decoding_t dec, ASN1uint32_t tag, PKERB_KDC_ISSUED_AUTH_DATA_elements *val)
  3882. {
  3883. PKERB_KDC_ISSUED_AUTH_DATA_elements *f;
  3884. ASN1decoding_t dd0;
  3885. ASN1octet_t *di0;
  3886. ASN1decoding_t dd;
  3887. ASN1octet_t *di;
  3888. ASN1uint32_t t;
  3889. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x80000001, &dd0, &di0))
  3890. return 0;
  3891. if (!ASN1BERDecExplicitTag(dd0, 0x10, &dd, &di))
  3892. return 0;
  3893. f = val;
  3894. while (ASN1BERDecNotEndOfContents(dd, di)) {
  3895. if (!ASN1BERDecPeekTag(dd, &t))
  3896. return 0;
  3897. if (!(*f = (PKERB_KDC_ISSUED_AUTH_DATA_elements)ASN1DecAlloc(dd, sizeof(**f))))
  3898. return 0;
  3899. if (!ASN1Dec_KERB_PA_DATA(dd, 0, &(*f)->value))
  3900. return 0;
  3901. f = &(*f)->next;
  3902. }
  3903. *f = NULL;
  3904. if (!ASN1BERDecEndOfContents(dd0, dd, di))
  3905. return 0;
  3906. if (!ASN1BERDecEndOfContents(dec, dd0, di0))
  3907. return 0;
  3908. return 1;
  3909. }
  3910. static void ASN1CALL ASN1Free_KERB_KDC_ISSUED_AUTH_DATA_elements(PKERB_KDC_ISSUED_AUTH_DATA_elements *val)
  3911. {
  3912. PKERB_KDC_ISSUED_AUTH_DATA_elements f, ff;
  3913. if (val) {
  3914. for (f = *val; f; f = ff) {
  3915. ASN1Free_KERB_PA_DATA(&f->value);
  3916. ff = f->next;
  3917. ASN1Free(f);
  3918. }
  3919. }
  3920. }
  3921. 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)
  3922. {
  3923. ASN1uint32_t nLenOff0;
  3924. PKERB_PA_PK_AS_REQ2_trusted_certifiers f;
  3925. ASN1uint32_t nLenOff;
  3926. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x80000002, &nLenOff0))
  3927. return 0;
  3928. if (!ASN1BEREncExplicitTag(enc, 0x10, &nLenOff))
  3929. return 0;
  3930. for (f = *val; f; f = f->next) {
  3931. if (!ASN1Enc_KERB_PRINCIPAL_NAME(enc, 0, &f->value))
  3932. return 0;
  3933. }
  3934. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  3935. return 0;
  3936. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  3937. return 0;
  3938. return 1;
  3939. }
  3940. 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)
  3941. {
  3942. PKERB_PA_PK_AS_REQ2_trusted_certifiers *f;
  3943. ASN1decoding_t dd0;
  3944. ASN1octet_t *di0;
  3945. ASN1decoding_t dd;
  3946. ASN1octet_t *di;
  3947. ASN1uint32_t t;
  3948. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x80000002, &dd0, &di0))
  3949. return 0;
  3950. if (!ASN1BERDecExplicitTag(dd0, 0x10, &dd, &di))
  3951. return 0;
  3952. f = val;
  3953. while (ASN1BERDecNotEndOfContents(dd, di)) {
  3954. if (!ASN1BERDecPeekTag(dd, &t))
  3955. return 0;
  3956. if (!(*f = (PKERB_PA_PK_AS_REQ2_trusted_certifiers)ASN1DecAlloc(dd, sizeof(**f))))
  3957. return 0;
  3958. if (!ASN1Dec_KERB_PRINCIPAL_NAME(dd, 0, &(*f)->value))
  3959. return 0;
  3960. f = &(*f)->next;
  3961. }
  3962. *f = NULL;
  3963. if (!ASN1BERDecEndOfContents(dd0, dd, di))
  3964. return 0;
  3965. if (!ASN1BERDecEndOfContents(dec, dd0, di0))
  3966. return 0;
  3967. return 1;
  3968. }
  3969. static void ASN1CALL ASN1Free_KERB_PA_PK_AS_REQ2_trusted_certifiers(PKERB_PA_PK_AS_REQ2_trusted_certifiers *val)
  3970. {
  3971. PKERB_PA_PK_AS_REQ2_trusted_certifiers f, ff;
  3972. if (val) {
  3973. for (f = *val; f; f = ff) {
  3974. ASN1Free_KERB_PRINCIPAL_NAME(&f->value);
  3975. ff = f->next;
  3976. ASN1Free(f);
  3977. }
  3978. }
  3979. }
  3980. 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)
  3981. {
  3982. ASN1uint32_t nLenOff0;
  3983. PKERB_PA_PK_AS_REQ2_user_certs f;
  3984. ASN1uint32_t nLenOff;
  3985. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x80000001, &nLenOff0))
  3986. return 0;
  3987. if (!ASN1BEREncExplicitTag(enc, 0x10, &nLenOff))
  3988. return 0;
  3989. for (f = *val; f; f = f->next) {
  3990. if (!ASN1Enc_KERB_CERTIFICATE(enc, 0, &f->value))
  3991. return 0;
  3992. }
  3993. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  3994. return 0;
  3995. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  3996. return 0;
  3997. return 1;
  3998. }
  3999. 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)
  4000. {
  4001. PKERB_PA_PK_AS_REQ2_user_certs *f;
  4002. ASN1decoding_t dd0;
  4003. ASN1octet_t *di0;
  4004. ASN1decoding_t dd;
  4005. ASN1octet_t *di;
  4006. ASN1uint32_t t;
  4007. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x80000001, &dd0, &di0))
  4008. return 0;
  4009. if (!ASN1BERDecExplicitTag(dd0, 0x10, &dd, &di))
  4010. return 0;
  4011. f = val;
  4012. while (ASN1BERDecNotEndOfContents(dd, di)) {
  4013. if (!ASN1BERDecPeekTag(dd, &t))
  4014. return 0;
  4015. if (!(*f = (PKERB_PA_PK_AS_REQ2_user_certs)ASN1DecAlloc(dd, sizeof(**f))))
  4016. return 0;
  4017. if (!ASN1Dec_KERB_CERTIFICATE(dd, 0, &(*f)->value))
  4018. return 0;
  4019. f = &(*f)->next;
  4020. }
  4021. *f = NULL;
  4022. if (!ASN1BERDecEndOfContents(dd0, dd, di))
  4023. return 0;
  4024. if (!ASN1BERDecEndOfContents(dec, dd0, di0))
  4025. return 0;
  4026. return 1;
  4027. }
  4028. static void ASN1CALL ASN1Free_KERB_PA_PK_AS_REQ2_user_certs(PKERB_PA_PK_AS_REQ2_user_certs *val)
  4029. {
  4030. PKERB_PA_PK_AS_REQ2_user_certs f, ff;
  4031. if (val) {
  4032. for (f = *val; f; f = ff) {
  4033. ASN1Free_KERB_CERTIFICATE(&f->value);
  4034. ff = f->next;
  4035. ASN1Free(f);
  4036. }
  4037. }
  4038. }
  4039. 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)
  4040. {
  4041. ASN1uint32_t nLenOff0;
  4042. PKERB_PA_PK_AS_REP2_kdc_cert f;
  4043. ASN1uint32_t nLenOff;
  4044. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x80000003, &nLenOff0))
  4045. return 0;
  4046. if (!ASN1BEREncExplicitTag(enc, 0x10, &nLenOff))
  4047. return 0;
  4048. for (f = *val; f; f = f->next) {
  4049. if (!ASN1Enc_KERB_CERTIFICATE(enc, 0, &f->value))
  4050. return 0;
  4051. }
  4052. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  4053. return 0;
  4054. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4055. return 0;
  4056. return 1;
  4057. }
  4058. 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)
  4059. {
  4060. PKERB_PA_PK_AS_REP2_kdc_cert *f;
  4061. ASN1decoding_t dd0;
  4062. ASN1octet_t *di0;
  4063. ASN1decoding_t dd;
  4064. ASN1octet_t *di;
  4065. ASN1uint32_t t;
  4066. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x80000003, &dd0, &di0))
  4067. return 0;
  4068. if (!ASN1BERDecExplicitTag(dd0, 0x10, &dd, &di))
  4069. return 0;
  4070. f = val;
  4071. while (ASN1BERDecNotEndOfContents(dd, di)) {
  4072. if (!ASN1BERDecPeekTag(dd, &t))
  4073. return 0;
  4074. if (!(*f = (PKERB_PA_PK_AS_REP2_kdc_cert)ASN1DecAlloc(dd, sizeof(**f))))
  4075. return 0;
  4076. if (!ASN1Dec_KERB_CERTIFICATE(dd, 0, &(*f)->value))
  4077. return 0;
  4078. f = &(*f)->next;
  4079. }
  4080. *f = NULL;
  4081. if (!ASN1BERDecEndOfContents(dd0, dd, di))
  4082. return 0;
  4083. if (!ASN1BERDecEndOfContents(dec, dd0, di0))
  4084. return 0;
  4085. return 1;
  4086. }
  4087. static void ASN1CALL ASN1Free_KERB_PA_PK_AS_REP2_kdc_cert(PKERB_PA_PK_AS_REP2_kdc_cert *val)
  4088. {
  4089. PKERB_PA_PK_AS_REP2_kdc_cert f, ff;
  4090. if (val) {
  4091. for (f = *val; f; f = ff) {
  4092. ASN1Free_KERB_CERTIFICATE(&f->value);
  4093. ff = f->next;
  4094. ASN1Free(f);
  4095. }
  4096. }
  4097. }
  4098. 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)
  4099. {
  4100. ASN1uint32_t nLenOff0;
  4101. PKERB_ENCRYPTED_KDC_REPLY_encrypted_pa_data f;
  4102. ASN1uint32_t nLenOff;
  4103. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x8000000c, &nLenOff0))
  4104. return 0;
  4105. if (!ASN1BEREncExplicitTag(enc, 0x10, &nLenOff))
  4106. return 0;
  4107. for (f = *val; f; f = f->next) {
  4108. if (!ASN1Enc_KERB_PA_DATA(enc, 0, &f->value))
  4109. return 0;
  4110. }
  4111. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  4112. return 0;
  4113. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4114. return 0;
  4115. return 1;
  4116. }
  4117. 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)
  4118. {
  4119. PKERB_ENCRYPTED_KDC_REPLY_encrypted_pa_data *f;
  4120. ASN1decoding_t dd0;
  4121. ASN1octet_t *di0;
  4122. ASN1decoding_t dd;
  4123. ASN1octet_t *di;
  4124. ASN1uint32_t t;
  4125. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x8000000c, &dd0, &di0))
  4126. return 0;
  4127. if (!ASN1BERDecExplicitTag(dd0, 0x10, &dd, &di))
  4128. return 0;
  4129. f = val;
  4130. while (ASN1BERDecNotEndOfContents(dd, di)) {
  4131. if (!ASN1BERDecPeekTag(dd, &t))
  4132. return 0;
  4133. if (!(*f = (PKERB_ENCRYPTED_KDC_REPLY_encrypted_pa_data)ASN1DecAlloc(dd, sizeof(**f))))
  4134. return 0;
  4135. if (!ASN1Dec_KERB_PA_DATA(dd, 0, &(*f)->value))
  4136. return 0;
  4137. f = &(*f)->next;
  4138. }
  4139. *f = NULL;
  4140. if (!ASN1BERDecEndOfContents(dd0, dd, di))
  4141. return 0;
  4142. if (!ASN1BERDecEndOfContents(dec, dd0, di0))
  4143. return 0;
  4144. return 1;
  4145. }
  4146. static void ASN1CALL ASN1Free_KERB_ENCRYPTED_KDC_REPLY_encrypted_pa_data(PKERB_ENCRYPTED_KDC_REPLY_encrypted_pa_data *val)
  4147. {
  4148. PKERB_ENCRYPTED_KDC_REPLY_encrypted_pa_data f, ff;
  4149. if (val) {
  4150. for (f = *val; f; f = ff) {
  4151. ASN1Free_KERB_PA_DATA(&f->value);
  4152. ff = f->next;
  4153. ASN1Free(f);
  4154. }
  4155. }
  4156. }
  4157. static int ASN1CALL ASN1Enc_KERB_KDC_REPLY_preauth_data(ASN1encoding_t enc, ASN1uint32_t tag, PKERB_KDC_REPLY_preauth_data *val)
  4158. {
  4159. ASN1uint32_t nLenOff0;
  4160. PKERB_KDC_REPLY_preauth_data f;
  4161. ASN1uint32_t nLenOff;
  4162. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x80000002, &nLenOff0))
  4163. return 0;
  4164. if (!ASN1BEREncExplicitTag(enc, 0x10, &nLenOff))
  4165. return 0;
  4166. for (f = *val; f; f = f->next) {
  4167. if (!ASN1Enc_KERB_PA_DATA(enc, 0, &f->value))
  4168. return 0;
  4169. }
  4170. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  4171. return 0;
  4172. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4173. return 0;
  4174. return 1;
  4175. }
  4176. static int ASN1CALL ASN1Dec_KERB_KDC_REPLY_preauth_data(ASN1decoding_t dec, ASN1uint32_t tag, PKERB_KDC_REPLY_preauth_data *val)
  4177. {
  4178. PKERB_KDC_REPLY_preauth_data *f;
  4179. ASN1decoding_t dd0;
  4180. ASN1octet_t *di0;
  4181. ASN1decoding_t dd;
  4182. ASN1octet_t *di;
  4183. ASN1uint32_t t;
  4184. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x80000002, &dd0, &di0))
  4185. return 0;
  4186. if (!ASN1BERDecExplicitTag(dd0, 0x10, &dd, &di))
  4187. return 0;
  4188. f = val;
  4189. while (ASN1BERDecNotEndOfContents(dd, di)) {
  4190. if (!ASN1BERDecPeekTag(dd, &t))
  4191. return 0;
  4192. if (!(*f = (PKERB_KDC_REPLY_preauth_data)ASN1DecAlloc(dd, sizeof(**f))))
  4193. return 0;
  4194. if (!ASN1Dec_KERB_PA_DATA(dd, 0, &(*f)->value))
  4195. return 0;
  4196. f = &(*f)->next;
  4197. }
  4198. *f = NULL;
  4199. if (!ASN1BERDecEndOfContents(dd0, dd, di))
  4200. return 0;
  4201. if (!ASN1BERDecEndOfContents(dec, dd0, di0))
  4202. return 0;
  4203. return 1;
  4204. }
  4205. static void ASN1CALL ASN1Free_KERB_KDC_REPLY_preauth_data(PKERB_KDC_REPLY_preauth_data *val)
  4206. {
  4207. PKERB_KDC_REPLY_preauth_data f, ff;
  4208. if (val) {
  4209. for (f = *val; f; f = ff) {
  4210. ASN1Free_KERB_PA_DATA(&f->value);
  4211. ff = f->next;
  4212. ASN1Free(f);
  4213. }
  4214. }
  4215. }
  4216. static int ASN1CALL ASN1Enc_KERB_KDC_REQUEST_preauth_data(ASN1encoding_t enc, ASN1uint32_t tag, PKERB_KDC_REQUEST_preauth_data *val)
  4217. {
  4218. ASN1uint32_t nLenOff0;
  4219. PKERB_KDC_REQUEST_preauth_data f;
  4220. ASN1uint32_t nLenOff;
  4221. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x80000003, &nLenOff0))
  4222. return 0;
  4223. if (!ASN1BEREncExplicitTag(enc, 0x10, &nLenOff))
  4224. return 0;
  4225. for (f = *val; f; f = f->next) {
  4226. if (!ASN1Enc_KERB_PA_DATA(enc, 0, &f->value))
  4227. return 0;
  4228. }
  4229. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  4230. return 0;
  4231. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4232. return 0;
  4233. return 1;
  4234. }
  4235. static int ASN1CALL ASN1Dec_KERB_KDC_REQUEST_preauth_data(ASN1decoding_t dec, ASN1uint32_t tag, PKERB_KDC_REQUEST_preauth_data *val)
  4236. {
  4237. PKERB_KDC_REQUEST_preauth_data *f;
  4238. ASN1decoding_t dd0;
  4239. ASN1octet_t *di0;
  4240. ASN1decoding_t dd;
  4241. ASN1octet_t *di;
  4242. ASN1uint32_t t;
  4243. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x80000003, &dd0, &di0))
  4244. return 0;
  4245. if (!ASN1BERDecExplicitTag(dd0, 0x10, &dd, &di))
  4246. return 0;
  4247. f = val;
  4248. while (ASN1BERDecNotEndOfContents(dd, di)) {
  4249. if (!ASN1BERDecPeekTag(dd, &t))
  4250. return 0;
  4251. if (!(*f = (PKERB_KDC_REQUEST_preauth_data)ASN1DecAlloc(dd, sizeof(**f))))
  4252. return 0;
  4253. if (!ASN1Dec_KERB_PA_DATA(dd, 0, &(*f)->value))
  4254. return 0;
  4255. f = &(*f)->next;
  4256. }
  4257. *f = NULL;
  4258. if (!ASN1BERDecEndOfContents(dd0, dd, di))
  4259. return 0;
  4260. if (!ASN1BERDecEndOfContents(dec, dd0, di0))
  4261. return 0;
  4262. return 1;
  4263. }
  4264. static void ASN1CALL ASN1Free_KERB_KDC_REQUEST_preauth_data(PKERB_KDC_REQUEST_preauth_data *val)
  4265. {
  4266. PKERB_KDC_REQUEST_preauth_data f, ff;
  4267. if (val) {
  4268. for (f = *val; f; f = ff) {
  4269. ASN1Free_KERB_PA_DATA(&f->value);
  4270. ff = f->next;
  4271. ASN1Free(f);
  4272. }
  4273. }
  4274. }
  4275. static int ASN1CALL ASN1Enc_KERB_TICKET(ASN1encoding_t enc, ASN1uint32_t tag, KERB_TICKET *val)
  4276. {
  4277. ASN1uint32_t nExplTagLenOff0;
  4278. ASN1uint32_t nLenOff;
  4279. ASN1uint32_t nLenOff0;
  4280. ASN1uint32_t t;
  4281. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x40000001, &nExplTagLenOff0))
  4282. return 0;
  4283. if (!ASN1BEREncExplicitTag(enc, 0x10, &nLenOff))
  4284. return 0;
  4285. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  4286. return 0;
  4287. if (!ASN1BEREncS32(enc, 0x2, (val)->ticket_version))
  4288. return 0;
  4289. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4290. return 0;
  4291. t = lstrlenA((val)->realm);
  4292. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  4293. return 0;
  4294. if (!ASN1DEREncCharString(enc, 0x1b, t, (val)->realm))
  4295. return 0;
  4296. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4297. return 0;
  4298. if (!ASN1BEREncExplicitTag(enc, 0x80000002, &nLenOff0))
  4299. return 0;
  4300. if (!ASN1Enc_KERB_PRINCIPAL_NAME(enc, 0, &(val)->server_name))
  4301. return 0;
  4302. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4303. return 0;
  4304. if (!ASN1BEREncExplicitTag(enc, 0x80000003, &nLenOff0))
  4305. return 0;
  4306. if (!ASN1Enc_KERB_ENCRYPTED_DATA(enc, 0, &(val)->encrypted_part))
  4307. return 0;
  4308. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4309. return 0;
  4310. if ((val)->o[0] & 0x80) {
  4311. if (!ASN1BEREncExplicitTag(enc, 0x80000004, &nLenOff0))
  4312. return 0;
  4313. if (!ASN1Enc_PKERB_TICKET_EXTENSIONS(enc, 0, &(val)->ticket_extensions))
  4314. return 0;
  4315. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4316. return 0;
  4317. }
  4318. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  4319. return 0;
  4320. if (!ASN1BEREncEndOfContents(enc, nExplTagLenOff0))
  4321. return 0;
  4322. return 1;
  4323. }
  4324. static int ASN1CALL ASN1Dec_KERB_TICKET(ASN1decoding_t dec, ASN1uint32_t tag, KERB_TICKET *val)
  4325. {
  4326. ASN1decoding_t dd;
  4327. ASN1octet_t *di;
  4328. ASN1decoding_t pExplTagDec0;
  4329. ASN1octet_t *pbExplTagDataEnd0;
  4330. ASN1decoding_t dd0;
  4331. ASN1octet_t *di0;
  4332. ASN1uint32_t t;
  4333. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x40000001, &pExplTagDec0, &pbExplTagDataEnd0))
  4334. return 0;
  4335. if (!ASN1BERDecExplicitTag(pExplTagDec0, 0x10, &dd, &di))
  4336. return 0;
  4337. ZeroMemory((val)->o, 1);
  4338. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  4339. return 0;
  4340. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->ticket_version))
  4341. return 0;
  4342. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4343. return 0;
  4344. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  4345. return 0;
  4346. if (!ASN1BERDecZeroCharString(dd0, 0x1b, &(val)->realm))
  4347. return 0;
  4348. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4349. return 0;
  4350. if (!ASN1BERDecExplicitTag(dd, 0x80000002, &dd0, &di0))
  4351. return 0;
  4352. if (!ASN1Dec_KERB_PRINCIPAL_NAME(dd0, 0, &(val)->server_name))
  4353. return 0;
  4354. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4355. return 0;
  4356. if (!ASN1BERDecExplicitTag(dd, 0x80000003, &dd0, &di0))
  4357. return 0;
  4358. if (!ASN1Dec_KERB_ENCRYPTED_DATA(dd0, 0, &(val)->encrypted_part))
  4359. return 0;
  4360. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4361. return 0;
  4362. ASN1BERDecPeekTag(dd, &t);
  4363. if (t == 0x80000004) {
  4364. (val)->o[0] |= 0x80;
  4365. if (!ASN1BERDecExplicitTag(dd, 0x80000004, &dd0, &di0))
  4366. return 0;
  4367. if (!ASN1Dec_PKERB_TICKET_EXTENSIONS(dd0, 0, &(val)->ticket_extensions))
  4368. return 0;
  4369. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4370. return 0;
  4371. }
  4372. if (!ASN1BERDecEndOfContents(pExplTagDec0, dd, di))
  4373. return 0;
  4374. if (!ASN1BERDecEndOfContents(dec, pExplTagDec0, pbExplTagDataEnd0))
  4375. return 0;
  4376. return 1;
  4377. }
  4378. static void ASN1CALL ASN1Free_KERB_TICKET(KERB_TICKET *val)
  4379. {
  4380. if (val) {
  4381. ASN1ztcharstring_free((val)->realm);
  4382. ASN1Free_KERB_PRINCIPAL_NAME(&(val)->server_name);
  4383. ASN1Free_KERB_ENCRYPTED_DATA(&(val)->encrypted_part);
  4384. if ((val)->o[0] & 0x80) {
  4385. ASN1Free_PKERB_TICKET_EXTENSIONS(&(val)->ticket_extensions);
  4386. }
  4387. }
  4388. }
  4389. static int ASN1CALL ASN1Enc_KERB_ENCRYPTED_TICKET(ASN1encoding_t enc, ASN1uint32_t tag, KERB_ENCRYPTED_TICKET *val)
  4390. {
  4391. ASN1uint32_t nExplTagLenOff0;
  4392. ASN1uint32_t nLenOff;
  4393. ASN1uint32_t nLenOff0;
  4394. ASN1uint32_t t;
  4395. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x40000003, &nExplTagLenOff0))
  4396. return 0;
  4397. if (!ASN1BEREncExplicitTag(enc, 0x10, &nLenOff))
  4398. return 0;
  4399. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  4400. return 0;
  4401. if (!ASN1DEREncBitString(enc, 0x3, ((val)->flags).length, ((val)->flags).value))
  4402. return 0;
  4403. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4404. return 0;
  4405. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  4406. return 0;
  4407. if (!ASN1Enc_KERB_ENCRYPTION_KEY(enc, 0, &(val)->key))
  4408. return 0;
  4409. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4410. return 0;
  4411. t = lstrlenA((val)->client_realm);
  4412. if (!ASN1BEREncExplicitTag(enc, 0x80000002, &nLenOff0))
  4413. return 0;
  4414. if (!ASN1DEREncCharString(enc, 0x1b, t, (val)->client_realm))
  4415. return 0;
  4416. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4417. return 0;
  4418. if (!ASN1BEREncExplicitTag(enc, 0x80000003, &nLenOff0))
  4419. return 0;
  4420. if (!ASN1Enc_KERB_PRINCIPAL_NAME(enc, 0, &(val)->client_name))
  4421. return 0;
  4422. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4423. return 0;
  4424. if (!ASN1BEREncExplicitTag(enc, 0x80000004, &nLenOff0))
  4425. return 0;
  4426. if (!ASN1Enc_KERB_TRANSITED_ENCODING(enc, 0, &(val)->transited))
  4427. return 0;
  4428. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4429. return 0;
  4430. if (!ASN1BEREncExplicitTag(enc, 0x80000005, &nLenOff0))
  4431. return 0;
  4432. if (!ASN1DEREncGeneralizedTime(enc, 0x18, &(val)->authtime))
  4433. return 0;
  4434. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4435. return 0;
  4436. if ((val)->o[0] & 0x80) {
  4437. if (!ASN1BEREncExplicitTag(enc, 0x80000006, &nLenOff0))
  4438. return 0;
  4439. if (!ASN1DEREncGeneralizedTime(enc, 0x18, &(val)->starttime))
  4440. return 0;
  4441. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4442. return 0;
  4443. }
  4444. if (!ASN1BEREncExplicitTag(enc, 0x80000007, &nLenOff0))
  4445. return 0;
  4446. if (!ASN1DEREncGeneralizedTime(enc, 0x18, &(val)->endtime))
  4447. return 0;
  4448. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4449. return 0;
  4450. if ((val)->o[0] & 0x40) {
  4451. if (!ASN1BEREncExplicitTag(enc, 0x80000008, &nLenOff0))
  4452. return 0;
  4453. if (!ASN1DEREncGeneralizedTime(enc, 0x18, &(val)->renew_until))
  4454. return 0;
  4455. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4456. return 0;
  4457. }
  4458. if ((val)->o[0] & 0x20) {
  4459. if (!ASN1BEREncExplicitTag(enc, 0x80000009, &nLenOff0))
  4460. return 0;
  4461. if (!ASN1Enc_PKERB_HOST_ADDRESSES(enc, 0, &(val)->client_addresses))
  4462. return 0;
  4463. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4464. return 0;
  4465. }
  4466. if ((val)->o[0] & 0x10) {
  4467. if (!ASN1BEREncExplicitTag(enc, 0x8000000a, &nLenOff0))
  4468. return 0;
  4469. if (!ASN1Enc_PKERB_AUTHORIZATION_DATA(enc, 0, &(val)->authorization_data))
  4470. return 0;
  4471. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4472. return 0;
  4473. }
  4474. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  4475. return 0;
  4476. if (!ASN1BEREncEndOfContents(enc, nExplTagLenOff0))
  4477. return 0;
  4478. return 1;
  4479. }
  4480. static int ASN1CALL ASN1Dec_KERB_ENCRYPTED_TICKET(ASN1decoding_t dec, ASN1uint32_t tag, KERB_ENCRYPTED_TICKET *val)
  4481. {
  4482. ASN1decoding_t dd;
  4483. ASN1octet_t *di;
  4484. ASN1decoding_t pExplTagDec0;
  4485. ASN1octet_t *pbExplTagDataEnd0;
  4486. ASN1decoding_t dd0;
  4487. ASN1octet_t *di0;
  4488. ASN1uint32_t t;
  4489. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x40000003, &pExplTagDec0, &pbExplTagDataEnd0))
  4490. return 0;
  4491. if (!ASN1BERDecExplicitTag(pExplTagDec0, 0x10, &dd, &di))
  4492. return 0;
  4493. ZeroMemory((val)->o, 1);
  4494. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  4495. return 0;
  4496. if (!ASN1BERDecBitString(dd0, 0x3, &(val)->flags))
  4497. return 0;
  4498. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4499. return 0;
  4500. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  4501. return 0;
  4502. if (!ASN1Dec_KERB_ENCRYPTION_KEY(dd0, 0, &(val)->key))
  4503. return 0;
  4504. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4505. return 0;
  4506. if (!ASN1BERDecExplicitTag(dd, 0x80000002, &dd0, &di0))
  4507. return 0;
  4508. if (!ASN1BERDecZeroCharString(dd0, 0x1b, &(val)->client_realm))
  4509. return 0;
  4510. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4511. return 0;
  4512. if (!ASN1BERDecExplicitTag(dd, 0x80000003, &dd0, &di0))
  4513. return 0;
  4514. if (!ASN1Dec_KERB_PRINCIPAL_NAME(dd0, 0, &(val)->client_name))
  4515. return 0;
  4516. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4517. return 0;
  4518. if (!ASN1BERDecExplicitTag(dd, 0x80000004, &dd0, &di0))
  4519. return 0;
  4520. if (!ASN1Dec_KERB_TRANSITED_ENCODING(dd0, 0, &(val)->transited))
  4521. return 0;
  4522. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4523. return 0;
  4524. if (!ASN1BERDecExplicitTag(dd, 0x80000005, &dd0, &di0))
  4525. return 0;
  4526. if (!ASN1BERDecGeneralizedTime(dd0, 0x18, &(val)->authtime))
  4527. return 0;
  4528. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4529. return 0;
  4530. ASN1BERDecPeekTag(dd, &t);
  4531. if (t == 0x80000006) {
  4532. (val)->o[0] |= 0x80;
  4533. if (!ASN1BERDecExplicitTag(dd, 0x80000006, &dd0, &di0))
  4534. return 0;
  4535. if (!ASN1BERDecGeneralizedTime(dd0, 0x18, &(val)->starttime))
  4536. return 0;
  4537. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4538. return 0;
  4539. }
  4540. if (!ASN1BERDecExplicitTag(dd, 0x80000007, &dd0, &di0))
  4541. return 0;
  4542. if (!ASN1BERDecGeneralizedTime(dd0, 0x18, &(val)->endtime))
  4543. return 0;
  4544. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4545. return 0;
  4546. ASN1BERDecPeekTag(dd, &t);
  4547. if (t == 0x80000008) {
  4548. (val)->o[0] |= 0x40;
  4549. if (!ASN1BERDecExplicitTag(dd, 0x80000008, &dd0, &di0))
  4550. return 0;
  4551. if (!ASN1BERDecGeneralizedTime(dd0, 0x18, &(val)->renew_until))
  4552. return 0;
  4553. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4554. return 0;
  4555. }
  4556. ASN1BERDecPeekTag(dd, &t);
  4557. if (t == 0x80000009) {
  4558. (val)->o[0] |= 0x20;
  4559. if (!ASN1BERDecExplicitTag(dd, 0x80000009, &dd0, &di0))
  4560. return 0;
  4561. if (!ASN1Dec_PKERB_HOST_ADDRESSES(dd0, 0, &(val)->client_addresses))
  4562. return 0;
  4563. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4564. return 0;
  4565. }
  4566. ASN1BERDecPeekTag(dd, &t);
  4567. if (t == 0x8000000a) {
  4568. (val)->o[0] |= 0x10;
  4569. if (!ASN1BERDecExplicitTag(dd, 0x8000000a, &dd0, &di0))
  4570. return 0;
  4571. if (!ASN1Dec_PKERB_AUTHORIZATION_DATA(dd0, 0, &(val)->authorization_data))
  4572. return 0;
  4573. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4574. return 0;
  4575. }
  4576. if (!ASN1BERDecEndOfContents(pExplTagDec0, dd, di))
  4577. return 0;
  4578. if (!ASN1BERDecEndOfContents(dec, pExplTagDec0, pbExplTagDataEnd0))
  4579. return 0;
  4580. return 1;
  4581. }
  4582. static void ASN1CALL ASN1Free_KERB_ENCRYPTED_TICKET(KERB_ENCRYPTED_TICKET *val)
  4583. {
  4584. if (val) {
  4585. ASN1bitstring_free(&(val)->flags);
  4586. ASN1Free_KERB_ENCRYPTION_KEY(&(val)->key);
  4587. ASN1ztcharstring_free((val)->client_realm);
  4588. ASN1Free_KERB_PRINCIPAL_NAME(&(val)->client_name);
  4589. ASN1Free_KERB_TRANSITED_ENCODING(&(val)->transited);
  4590. if ((val)->o[0] & 0x80) {
  4591. }
  4592. if ((val)->o[0] & 0x40) {
  4593. }
  4594. if ((val)->o[0] & 0x20) {
  4595. ASN1Free_PKERB_HOST_ADDRESSES(&(val)->client_addresses);
  4596. }
  4597. if ((val)->o[0] & 0x10) {
  4598. ASN1Free_PKERB_AUTHORIZATION_DATA(&(val)->authorization_data);
  4599. }
  4600. }
  4601. }
  4602. static int ASN1CALL ASN1Enc_KERB_AUTHENTICATOR(ASN1encoding_t enc, ASN1uint32_t tag, KERB_AUTHENTICATOR *val)
  4603. {
  4604. ASN1uint32_t nExplTagLenOff0;
  4605. ASN1uint32_t nLenOff;
  4606. ASN1uint32_t nLenOff0;
  4607. ASN1uint32_t t;
  4608. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x40000002, &nExplTagLenOff0))
  4609. return 0;
  4610. if (!ASN1BEREncExplicitTag(enc, 0x10, &nLenOff))
  4611. return 0;
  4612. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  4613. return 0;
  4614. if (!ASN1BEREncS32(enc, 0x2, (val)->authenticator_version))
  4615. return 0;
  4616. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4617. return 0;
  4618. t = lstrlenA((val)->client_realm);
  4619. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  4620. return 0;
  4621. if (!ASN1DEREncCharString(enc, 0x1b, t, (val)->client_realm))
  4622. return 0;
  4623. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4624. return 0;
  4625. if (!ASN1BEREncExplicitTag(enc, 0x80000002, &nLenOff0))
  4626. return 0;
  4627. if (!ASN1Enc_KERB_PRINCIPAL_NAME(enc, 0, &(val)->client_name))
  4628. return 0;
  4629. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4630. return 0;
  4631. if ((val)->o[0] & 0x80) {
  4632. if (!ASN1BEREncExplicitTag(enc, 0x80000003, &nLenOff0))
  4633. return 0;
  4634. if (!ASN1Enc_KERB_CHECKSUM(enc, 0, &(val)->checksum))
  4635. return 0;
  4636. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4637. return 0;
  4638. }
  4639. if (!ASN1BEREncExplicitTag(enc, 0x80000004, &nLenOff0))
  4640. return 0;
  4641. if (!ASN1BEREncS32(enc, 0x2, (val)->client_usec))
  4642. return 0;
  4643. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4644. return 0;
  4645. if (!ASN1BEREncExplicitTag(enc, 0x80000005, &nLenOff0))
  4646. return 0;
  4647. if (!ASN1DEREncGeneralizedTime(enc, 0x18, &(val)->client_time))
  4648. return 0;
  4649. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4650. return 0;
  4651. if ((val)->o[0] & 0x40) {
  4652. if (!ASN1BEREncExplicitTag(enc, 0x80000006, &nLenOff0))
  4653. return 0;
  4654. if (!ASN1Enc_KERB_ENCRYPTION_KEY(enc, 0, &(val)->subkey))
  4655. return 0;
  4656. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4657. return 0;
  4658. }
  4659. if ((val)->o[0] & 0x20) {
  4660. if (!ASN1BEREncExplicitTag(enc, 0x80000007, &nLenOff0))
  4661. return 0;
  4662. if (!ASN1BEREncSX(enc, 0x2, &(val)->sequence_number))
  4663. return 0;
  4664. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4665. return 0;
  4666. }
  4667. if ((val)->o[0] & 0x10) {
  4668. if (!ASN1BEREncExplicitTag(enc, 0x80000008, &nLenOff0))
  4669. return 0;
  4670. if (!ASN1Enc_PKERB_AUTHORIZATION_DATA(enc, 0, &(val)->authorization_data))
  4671. return 0;
  4672. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4673. return 0;
  4674. }
  4675. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  4676. return 0;
  4677. if (!ASN1BEREncEndOfContents(enc, nExplTagLenOff0))
  4678. return 0;
  4679. return 1;
  4680. }
  4681. static int ASN1CALL ASN1Dec_KERB_AUTHENTICATOR(ASN1decoding_t dec, ASN1uint32_t tag, KERB_AUTHENTICATOR *val)
  4682. {
  4683. ASN1decoding_t dd;
  4684. ASN1octet_t *di;
  4685. ASN1decoding_t pExplTagDec0;
  4686. ASN1octet_t *pbExplTagDataEnd0;
  4687. ASN1decoding_t dd0;
  4688. ASN1octet_t *di0;
  4689. ASN1uint32_t t;
  4690. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x40000002, &pExplTagDec0, &pbExplTagDataEnd0))
  4691. return 0;
  4692. if (!ASN1BERDecExplicitTag(pExplTagDec0, 0x10, &dd, &di))
  4693. return 0;
  4694. ZeroMemory((val)->o, 1);
  4695. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  4696. return 0;
  4697. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->authenticator_version))
  4698. return 0;
  4699. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4700. return 0;
  4701. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  4702. return 0;
  4703. if (!ASN1BERDecZeroCharString(dd0, 0x1b, &(val)->client_realm))
  4704. return 0;
  4705. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4706. return 0;
  4707. if (!ASN1BERDecExplicitTag(dd, 0x80000002, &dd0, &di0))
  4708. return 0;
  4709. if (!ASN1Dec_KERB_PRINCIPAL_NAME(dd0, 0, &(val)->client_name))
  4710. return 0;
  4711. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4712. return 0;
  4713. ASN1BERDecPeekTag(dd, &t);
  4714. if (t == 0x80000003) {
  4715. (val)->o[0] |= 0x80;
  4716. if (!ASN1BERDecExplicitTag(dd, 0x80000003, &dd0, &di0))
  4717. return 0;
  4718. if (!ASN1Dec_KERB_CHECKSUM(dd0, 0, &(val)->checksum))
  4719. return 0;
  4720. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4721. return 0;
  4722. }
  4723. if (!ASN1BERDecExplicitTag(dd, 0x80000004, &dd0, &di0))
  4724. return 0;
  4725. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->client_usec))
  4726. return 0;
  4727. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4728. return 0;
  4729. if (!ASN1BERDecExplicitTag(dd, 0x80000005, &dd0, &di0))
  4730. return 0;
  4731. if (!ASN1BERDecGeneralizedTime(dd0, 0x18, &(val)->client_time))
  4732. return 0;
  4733. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4734. return 0;
  4735. ASN1BERDecPeekTag(dd, &t);
  4736. if (t == 0x80000006) {
  4737. (val)->o[0] |= 0x40;
  4738. if (!ASN1BERDecExplicitTag(dd, 0x80000006, &dd0, &di0))
  4739. return 0;
  4740. if (!ASN1Dec_KERB_ENCRYPTION_KEY(dd0, 0, &(val)->subkey))
  4741. return 0;
  4742. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4743. return 0;
  4744. }
  4745. ASN1BERDecPeekTag(dd, &t);
  4746. if (t == 0x80000007) {
  4747. (val)->o[0] |= 0x20;
  4748. if (!ASN1BERDecExplicitTag(dd, 0x80000007, &dd0, &di0))
  4749. return 0;
  4750. if (!ASN1BERDecSXVal(dd0, 0x2, &(val)->sequence_number))
  4751. return 0;
  4752. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4753. return 0;
  4754. }
  4755. ASN1BERDecPeekTag(dd, &t);
  4756. if (t == 0x80000008) {
  4757. (val)->o[0] |= 0x10;
  4758. if (!ASN1BERDecExplicitTag(dd, 0x80000008, &dd0, &di0))
  4759. return 0;
  4760. if (!ASN1Dec_PKERB_AUTHORIZATION_DATA(dd0, 0, &(val)->authorization_data))
  4761. return 0;
  4762. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4763. return 0;
  4764. }
  4765. if (!ASN1BERDecEndOfContents(pExplTagDec0, dd, di))
  4766. return 0;
  4767. if (!ASN1BERDecEndOfContents(dec, pExplTagDec0, pbExplTagDataEnd0))
  4768. return 0;
  4769. return 1;
  4770. }
  4771. static void ASN1CALL ASN1Free_KERB_AUTHENTICATOR(KERB_AUTHENTICATOR *val)
  4772. {
  4773. if (val) {
  4774. ASN1ztcharstring_free((val)->client_realm);
  4775. ASN1Free_KERB_PRINCIPAL_NAME(&(val)->client_name);
  4776. if ((val)->o[0] & 0x80) {
  4777. ASN1Free_KERB_CHECKSUM(&(val)->checksum);
  4778. }
  4779. if ((val)->o[0] & 0x40) {
  4780. ASN1Free_KERB_ENCRYPTION_KEY(&(val)->subkey);
  4781. }
  4782. if ((val)->o[0] & 0x20) {
  4783. ASN1intx_free(&(val)->sequence_number);
  4784. }
  4785. if ((val)->o[0] & 0x10) {
  4786. ASN1Free_PKERB_AUTHORIZATION_DATA(&(val)->authorization_data);
  4787. }
  4788. }
  4789. }
  4790. static int ASN1CALL ASN1Enc_KERB_KDC_REQUEST_BODY(ASN1encoding_t enc, ASN1uint32_t tag, KERB_KDC_REQUEST_BODY *val)
  4791. {
  4792. ASN1uint32_t nLenOff;
  4793. ASN1uint32_t nLenOff0;
  4794. ASN1uint32_t t;
  4795. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  4796. return 0;
  4797. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  4798. return 0;
  4799. if (!ASN1DEREncBitString(enc, 0x3, ((val)->kdc_options).length, ((val)->kdc_options).value))
  4800. return 0;
  4801. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4802. return 0;
  4803. if ((val)->o[0] & 0x80) {
  4804. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  4805. return 0;
  4806. if (!ASN1Enc_KERB_PRINCIPAL_NAME(enc, 0, &(val)->client_name))
  4807. return 0;
  4808. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4809. return 0;
  4810. }
  4811. t = lstrlenA((val)->realm);
  4812. if (!ASN1BEREncExplicitTag(enc, 0x80000002, &nLenOff0))
  4813. return 0;
  4814. if (!ASN1DEREncCharString(enc, 0x1b, t, (val)->realm))
  4815. return 0;
  4816. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4817. return 0;
  4818. if ((val)->o[0] & 0x40) {
  4819. if (!ASN1BEREncExplicitTag(enc, 0x80000003, &nLenOff0))
  4820. return 0;
  4821. if (!ASN1Enc_KERB_PRINCIPAL_NAME(enc, 0, &(val)->server_name))
  4822. return 0;
  4823. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4824. return 0;
  4825. }
  4826. if ((val)->o[0] & 0x20) {
  4827. if (!ASN1BEREncExplicitTag(enc, 0x80000004, &nLenOff0))
  4828. return 0;
  4829. if (!ASN1DEREncGeneralizedTime(enc, 0x18, &(val)->starttime))
  4830. return 0;
  4831. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4832. return 0;
  4833. }
  4834. if (!ASN1BEREncExplicitTag(enc, 0x80000005, &nLenOff0))
  4835. return 0;
  4836. if (!ASN1DEREncGeneralizedTime(enc, 0x18, &(val)->endtime))
  4837. return 0;
  4838. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4839. return 0;
  4840. if ((val)->o[0] & 0x10) {
  4841. if (!ASN1BEREncExplicitTag(enc, 0x80000006, &nLenOff0))
  4842. return 0;
  4843. if (!ASN1DEREncGeneralizedTime(enc, 0x18, &(val)->renew_until))
  4844. return 0;
  4845. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4846. return 0;
  4847. }
  4848. if (!ASN1BEREncExplicitTag(enc, 0x80000007, &nLenOff0))
  4849. return 0;
  4850. if (!ASN1BEREncS32(enc, 0x2, (val)->nonce))
  4851. return 0;
  4852. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4853. return 0;
  4854. if (!ASN1Enc_KERB_KDC_REQUEST_BODY_encryption_type(enc, 0, &(val)->encryption_type))
  4855. return 0;
  4856. if ((val)->o[0] & 0x8) {
  4857. if (!ASN1BEREncExplicitTag(enc, 0x80000009, &nLenOff0))
  4858. return 0;
  4859. if (!ASN1Enc_PKERB_HOST_ADDRESSES(enc, 0, &(val)->addresses))
  4860. return 0;
  4861. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4862. return 0;
  4863. }
  4864. if ((val)->o[0] & 0x4) {
  4865. if (!ASN1BEREncExplicitTag(enc, 0x8000000a, &nLenOff0))
  4866. return 0;
  4867. if (!ASN1Enc_KERB_ENCRYPTED_DATA(enc, 0, &(val)->enc_authorization_data))
  4868. return 0;
  4869. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  4870. return 0;
  4871. }
  4872. if ((val)->o[0] & 0x2) {
  4873. if (!ASN1Enc_KERB_KDC_REQUEST_BODY_additional_tickets(enc, 0, &(val)->additional_tickets))
  4874. return 0;
  4875. }
  4876. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  4877. return 0;
  4878. return 1;
  4879. }
  4880. static int ASN1CALL ASN1Dec_KERB_KDC_REQUEST_BODY(ASN1decoding_t dec, ASN1uint32_t tag, KERB_KDC_REQUEST_BODY *val)
  4881. {
  4882. ASN1decoding_t dd;
  4883. ASN1octet_t *di;
  4884. ASN1decoding_t dd0;
  4885. ASN1octet_t *di0;
  4886. ASN1uint32_t t;
  4887. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  4888. return 0;
  4889. ZeroMemory((val)->o, 1);
  4890. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  4891. return 0;
  4892. if (!ASN1BERDecBitString(dd0, 0x3, &(val)->kdc_options))
  4893. return 0;
  4894. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4895. return 0;
  4896. ASN1BERDecPeekTag(dd, &t);
  4897. if (t == 0x80000001) {
  4898. (val)->o[0] |= 0x80;
  4899. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  4900. return 0;
  4901. if (!ASN1Dec_KERB_PRINCIPAL_NAME(dd0, 0, &(val)->client_name))
  4902. return 0;
  4903. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4904. return 0;
  4905. }
  4906. if (!ASN1BERDecExplicitTag(dd, 0x80000002, &dd0, &di0))
  4907. return 0;
  4908. if (!ASN1BERDecZeroCharString(dd0, 0x1b, &(val)->realm))
  4909. return 0;
  4910. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4911. return 0;
  4912. ASN1BERDecPeekTag(dd, &t);
  4913. if (t == 0x80000003) {
  4914. (val)->o[0] |= 0x40;
  4915. if (!ASN1BERDecExplicitTag(dd, 0x80000003, &dd0, &di0))
  4916. return 0;
  4917. if (!ASN1Dec_KERB_PRINCIPAL_NAME(dd0, 0, &(val)->server_name))
  4918. return 0;
  4919. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4920. return 0;
  4921. }
  4922. ASN1BERDecPeekTag(dd, &t);
  4923. if (t == 0x80000004) {
  4924. (val)->o[0] |= 0x20;
  4925. if (!ASN1BERDecExplicitTag(dd, 0x80000004, &dd0, &di0))
  4926. return 0;
  4927. if (!ASN1BERDecGeneralizedTime(dd0, 0x18, &(val)->starttime))
  4928. return 0;
  4929. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4930. return 0;
  4931. }
  4932. if (!ASN1BERDecExplicitTag(dd, 0x80000005, &dd0, &di0))
  4933. return 0;
  4934. if (!ASN1BERDecGeneralizedTime(dd0, 0x18, &(val)->endtime))
  4935. return 0;
  4936. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4937. return 0;
  4938. ASN1BERDecPeekTag(dd, &t);
  4939. if (t == 0x80000006) {
  4940. (val)->o[0] |= 0x10;
  4941. if (!ASN1BERDecExplicitTag(dd, 0x80000006, &dd0, &di0))
  4942. return 0;
  4943. if (!ASN1BERDecGeneralizedTime(dd0, 0x18, &(val)->renew_until))
  4944. return 0;
  4945. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4946. return 0;
  4947. }
  4948. if (!ASN1BERDecExplicitTag(dd, 0x80000007, &dd0, &di0))
  4949. return 0;
  4950. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->nonce))
  4951. return 0;
  4952. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4953. return 0;
  4954. if (!ASN1Dec_KERB_KDC_REQUEST_BODY_encryption_type(dd, 0, &(val)->encryption_type))
  4955. return 0;
  4956. ASN1BERDecPeekTag(dd, &t);
  4957. if (t == 0x80000009) {
  4958. (val)->o[0] |= 0x8;
  4959. if (!ASN1BERDecExplicitTag(dd, 0x80000009, &dd0, &di0))
  4960. return 0;
  4961. if (!ASN1Dec_PKERB_HOST_ADDRESSES(dd0, 0, &(val)->addresses))
  4962. return 0;
  4963. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4964. return 0;
  4965. }
  4966. ASN1BERDecPeekTag(dd, &t);
  4967. if (t == 0x8000000a) {
  4968. (val)->o[0] |= 0x4;
  4969. if (!ASN1BERDecExplicitTag(dd, 0x8000000a, &dd0, &di0))
  4970. return 0;
  4971. if (!ASN1Dec_KERB_ENCRYPTED_DATA(dd0, 0, &(val)->enc_authorization_data))
  4972. return 0;
  4973. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  4974. return 0;
  4975. }
  4976. ASN1BERDecPeekTag(dd, &t);
  4977. if (t == 0x8000000b) {
  4978. (val)->o[0] |= 0x2;
  4979. if (!ASN1Dec_KERB_KDC_REQUEST_BODY_additional_tickets(dd, 0, &(val)->additional_tickets))
  4980. return 0;
  4981. }
  4982. if (!ASN1BERDecEndOfContents(dec, dd, di))
  4983. return 0;
  4984. return 1;
  4985. }
  4986. static void ASN1CALL ASN1Free_KERB_KDC_REQUEST_BODY(KERB_KDC_REQUEST_BODY *val)
  4987. {
  4988. if (val) {
  4989. ASN1bitstring_free(&(val)->kdc_options);
  4990. if ((val)->o[0] & 0x80) {
  4991. ASN1Free_KERB_PRINCIPAL_NAME(&(val)->client_name);
  4992. }
  4993. ASN1ztcharstring_free((val)->realm);
  4994. if ((val)->o[0] & 0x40) {
  4995. ASN1Free_KERB_PRINCIPAL_NAME(&(val)->server_name);
  4996. }
  4997. if ((val)->o[0] & 0x20) {
  4998. }
  4999. if ((val)->o[0] & 0x10) {
  5000. }
  5001. ASN1Free_KERB_KDC_REQUEST_BODY_encryption_type(&(val)->encryption_type);
  5002. if ((val)->o[0] & 0x8) {
  5003. ASN1Free_PKERB_HOST_ADDRESSES(&(val)->addresses);
  5004. }
  5005. if ((val)->o[0] & 0x4) {
  5006. ASN1Free_KERB_ENCRYPTED_DATA(&(val)->enc_authorization_data);
  5007. }
  5008. if ((val)->o[0] & 0x2) {
  5009. ASN1Free_KERB_KDC_REQUEST_BODY_additional_tickets(&(val)->additional_tickets);
  5010. }
  5011. }
  5012. }
  5013. static int ASN1CALL ASN1Enc_KERB_KDC_REPLY(ASN1encoding_t enc, ASN1uint32_t tag, KERB_KDC_REPLY *val)
  5014. {
  5015. ASN1uint32_t nLenOff;
  5016. ASN1uint32_t nLenOff0;
  5017. ASN1uint32_t t;
  5018. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  5019. return 0;
  5020. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  5021. return 0;
  5022. if (!ASN1BEREncS32(enc, 0x2, (val)->version))
  5023. return 0;
  5024. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5025. return 0;
  5026. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  5027. return 0;
  5028. if (!ASN1BEREncS32(enc, 0x2, (val)->message_type))
  5029. return 0;
  5030. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5031. return 0;
  5032. if ((val)->o[0] & 0x80) {
  5033. if (!ASN1Enc_KERB_KDC_REPLY_preauth_data(enc, 0, &(val)->preauth_data))
  5034. return 0;
  5035. }
  5036. t = lstrlenA((val)->client_realm);
  5037. if (!ASN1BEREncExplicitTag(enc, 0x80000003, &nLenOff0))
  5038. return 0;
  5039. if (!ASN1DEREncCharString(enc, 0x1b, t, (val)->client_realm))
  5040. return 0;
  5041. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5042. return 0;
  5043. if (!ASN1BEREncExplicitTag(enc, 0x80000004, &nLenOff0))
  5044. return 0;
  5045. if (!ASN1Enc_KERB_PRINCIPAL_NAME(enc, 0, &(val)->client_name))
  5046. return 0;
  5047. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5048. return 0;
  5049. if (!ASN1BEREncExplicitTag(enc, 0x80000005, &nLenOff0))
  5050. return 0;
  5051. if (!ASN1Enc_KERB_TICKET(enc, 0, &(val)->ticket))
  5052. return 0;
  5053. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5054. return 0;
  5055. if (!ASN1BEREncExplicitTag(enc, 0x80000006, &nLenOff0))
  5056. return 0;
  5057. if (!ASN1Enc_KERB_ENCRYPTED_DATA(enc, 0, &(val)->encrypted_part))
  5058. return 0;
  5059. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5060. return 0;
  5061. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  5062. return 0;
  5063. return 1;
  5064. }
  5065. static int ASN1CALL ASN1Dec_KERB_KDC_REPLY(ASN1decoding_t dec, ASN1uint32_t tag, KERB_KDC_REPLY *val)
  5066. {
  5067. ASN1decoding_t dd;
  5068. ASN1octet_t *di;
  5069. ASN1decoding_t dd0;
  5070. ASN1octet_t *di0;
  5071. ASN1uint32_t t;
  5072. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  5073. return 0;
  5074. ZeroMemory((val)->o, 1);
  5075. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  5076. return 0;
  5077. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->version))
  5078. return 0;
  5079. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5080. return 0;
  5081. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  5082. return 0;
  5083. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->message_type))
  5084. return 0;
  5085. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5086. return 0;
  5087. ASN1BERDecPeekTag(dd, &t);
  5088. if (t == 0x80000002) {
  5089. (val)->o[0] |= 0x80;
  5090. if (!ASN1Dec_KERB_KDC_REPLY_preauth_data(dd, 0, &(val)->preauth_data))
  5091. return 0;
  5092. }
  5093. if (!ASN1BERDecExplicitTag(dd, 0x80000003, &dd0, &di0))
  5094. return 0;
  5095. if (!ASN1BERDecZeroCharString(dd0, 0x1b, &(val)->client_realm))
  5096. return 0;
  5097. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5098. return 0;
  5099. if (!ASN1BERDecExplicitTag(dd, 0x80000004, &dd0, &di0))
  5100. return 0;
  5101. if (!ASN1Dec_KERB_PRINCIPAL_NAME(dd0, 0, &(val)->client_name))
  5102. return 0;
  5103. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5104. return 0;
  5105. if (!ASN1BERDecExplicitTag(dd, 0x80000005, &dd0, &di0))
  5106. return 0;
  5107. if (!ASN1Dec_KERB_TICKET(dd0, 0, &(val)->ticket))
  5108. return 0;
  5109. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5110. return 0;
  5111. if (!ASN1BERDecExplicitTag(dd, 0x80000006, &dd0, &di0))
  5112. return 0;
  5113. if (!ASN1Dec_KERB_ENCRYPTED_DATA(dd0, 0, &(val)->encrypted_part))
  5114. return 0;
  5115. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5116. return 0;
  5117. if (!ASN1BERDecEndOfContents(dec, dd, di))
  5118. return 0;
  5119. return 1;
  5120. }
  5121. static void ASN1CALL ASN1Free_KERB_KDC_REPLY(KERB_KDC_REPLY *val)
  5122. {
  5123. if (val) {
  5124. if ((val)->o[0] & 0x80) {
  5125. ASN1Free_KERB_KDC_REPLY_preauth_data(&(val)->preauth_data);
  5126. }
  5127. ASN1ztcharstring_free((val)->client_realm);
  5128. ASN1Free_KERB_PRINCIPAL_NAME(&(val)->client_name);
  5129. ASN1Free_KERB_TICKET(&(val)->ticket);
  5130. ASN1Free_KERB_ENCRYPTED_DATA(&(val)->encrypted_part);
  5131. }
  5132. }
  5133. static int ASN1CALL ASN1Enc_KERB_ENCRYPTED_KDC_REPLY(ASN1encoding_t enc, ASN1uint32_t tag, KERB_ENCRYPTED_KDC_REPLY *val)
  5134. {
  5135. ASN1uint32_t nLenOff;
  5136. ASN1uint32_t nLenOff0;
  5137. ASN1uint32_t t;
  5138. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  5139. return 0;
  5140. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  5141. return 0;
  5142. if (!ASN1Enc_KERB_ENCRYPTION_KEY(enc, 0, &(val)->session_key))
  5143. return 0;
  5144. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5145. return 0;
  5146. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  5147. return 0;
  5148. if (!ASN1Enc_PKERB_LAST_REQUEST(enc, 0, &(val)->last_request))
  5149. return 0;
  5150. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5151. return 0;
  5152. if (!ASN1BEREncExplicitTag(enc, 0x80000002, &nLenOff0))
  5153. return 0;
  5154. if (!ASN1BEREncS32(enc, 0x2, (val)->nonce))
  5155. return 0;
  5156. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5157. return 0;
  5158. if ((val)->o[0] & 0x80) {
  5159. if (!ASN1BEREncExplicitTag(enc, 0x80000003, &nLenOff0))
  5160. return 0;
  5161. if (!ASN1DEREncGeneralizedTime(enc, 0x18, &(val)->key_expiration))
  5162. return 0;
  5163. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5164. return 0;
  5165. }
  5166. if (!ASN1BEREncExplicitTag(enc, 0x80000004, &nLenOff0))
  5167. return 0;
  5168. if (!ASN1DEREncBitString(enc, 0x3, ((val)->flags).length, ((val)->flags).value))
  5169. return 0;
  5170. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5171. return 0;
  5172. if (!ASN1BEREncExplicitTag(enc, 0x80000005, &nLenOff0))
  5173. return 0;
  5174. if (!ASN1DEREncGeneralizedTime(enc, 0x18, &(val)->authtime))
  5175. return 0;
  5176. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5177. return 0;
  5178. if ((val)->o[0] & 0x40) {
  5179. if (!ASN1BEREncExplicitTag(enc, 0x80000006, &nLenOff0))
  5180. return 0;
  5181. if (!ASN1DEREncGeneralizedTime(enc, 0x18, &(val)->starttime))
  5182. return 0;
  5183. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5184. return 0;
  5185. }
  5186. if (!ASN1BEREncExplicitTag(enc, 0x80000007, &nLenOff0))
  5187. return 0;
  5188. if (!ASN1DEREncGeneralizedTime(enc, 0x18, &(val)->endtime))
  5189. return 0;
  5190. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5191. return 0;
  5192. if ((val)->o[0] & 0x20) {
  5193. if (!ASN1BEREncExplicitTag(enc, 0x80000008, &nLenOff0))
  5194. return 0;
  5195. if (!ASN1DEREncGeneralizedTime(enc, 0x18, &(val)->renew_until))
  5196. return 0;
  5197. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5198. return 0;
  5199. }
  5200. t = lstrlenA((val)->server_realm);
  5201. if (!ASN1BEREncExplicitTag(enc, 0x80000009, &nLenOff0))
  5202. return 0;
  5203. if (!ASN1DEREncCharString(enc, 0x1b, t, (val)->server_realm))
  5204. return 0;
  5205. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5206. return 0;
  5207. if (!ASN1BEREncExplicitTag(enc, 0x8000000a, &nLenOff0))
  5208. return 0;
  5209. if (!ASN1Enc_KERB_PRINCIPAL_NAME(enc, 0, &(val)->server_name))
  5210. return 0;
  5211. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5212. return 0;
  5213. if ((val)->o[0] & 0x10) {
  5214. if (!ASN1BEREncExplicitTag(enc, 0x8000000b, &nLenOff0))
  5215. return 0;
  5216. if (!ASN1Enc_PKERB_HOST_ADDRESSES(enc, 0, &(val)->client_addresses))
  5217. return 0;
  5218. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5219. return 0;
  5220. }
  5221. if ((val)->o[0] & 0x8) {
  5222. if (!ASN1Enc_KERB_ENCRYPTED_KDC_REPLY_encrypted_pa_data(enc, 0, &(val)->encrypted_pa_data))
  5223. return 0;
  5224. }
  5225. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  5226. return 0;
  5227. return 1;
  5228. }
  5229. static int ASN1CALL ASN1Dec_KERB_ENCRYPTED_KDC_REPLY(ASN1decoding_t dec, ASN1uint32_t tag, KERB_ENCRYPTED_KDC_REPLY *val)
  5230. {
  5231. ASN1decoding_t dd;
  5232. ASN1octet_t *di;
  5233. ASN1decoding_t dd0;
  5234. ASN1octet_t *di0;
  5235. ASN1uint32_t t;
  5236. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  5237. return 0;
  5238. ZeroMemory((val)->o, 1);
  5239. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  5240. return 0;
  5241. if (!ASN1Dec_KERB_ENCRYPTION_KEY(dd0, 0, &(val)->session_key))
  5242. return 0;
  5243. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5244. return 0;
  5245. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  5246. return 0;
  5247. if (!ASN1Dec_PKERB_LAST_REQUEST(dd0, 0, &(val)->last_request))
  5248. return 0;
  5249. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5250. return 0;
  5251. if (!ASN1BERDecExplicitTag(dd, 0x80000002, &dd0, &di0))
  5252. return 0;
  5253. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->nonce))
  5254. return 0;
  5255. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5256. return 0;
  5257. ASN1BERDecPeekTag(dd, &t);
  5258. if (t == 0x80000003) {
  5259. (val)->o[0] |= 0x80;
  5260. if (!ASN1BERDecExplicitTag(dd, 0x80000003, &dd0, &di0))
  5261. return 0;
  5262. if (!ASN1BERDecGeneralizedTime(dd0, 0x18, &(val)->key_expiration))
  5263. return 0;
  5264. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5265. return 0;
  5266. }
  5267. if (!ASN1BERDecExplicitTag(dd, 0x80000004, &dd0, &di0))
  5268. return 0;
  5269. if (!ASN1BERDecBitString(dd0, 0x3, &(val)->flags))
  5270. return 0;
  5271. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5272. return 0;
  5273. if (!ASN1BERDecExplicitTag(dd, 0x80000005, &dd0, &di0))
  5274. return 0;
  5275. if (!ASN1BERDecGeneralizedTime(dd0, 0x18, &(val)->authtime))
  5276. return 0;
  5277. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5278. return 0;
  5279. ASN1BERDecPeekTag(dd, &t);
  5280. if (t == 0x80000006) {
  5281. (val)->o[0] |= 0x40;
  5282. if (!ASN1BERDecExplicitTag(dd, 0x80000006, &dd0, &di0))
  5283. return 0;
  5284. if (!ASN1BERDecGeneralizedTime(dd0, 0x18, &(val)->starttime))
  5285. return 0;
  5286. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5287. return 0;
  5288. }
  5289. if (!ASN1BERDecExplicitTag(dd, 0x80000007, &dd0, &di0))
  5290. return 0;
  5291. if (!ASN1BERDecGeneralizedTime(dd0, 0x18, &(val)->endtime))
  5292. return 0;
  5293. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5294. return 0;
  5295. ASN1BERDecPeekTag(dd, &t);
  5296. if (t == 0x80000008) {
  5297. (val)->o[0] |= 0x20;
  5298. if (!ASN1BERDecExplicitTag(dd, 0x80000008, &dd0, &di0))
  5299. return 0;
  5300. if (!ASN1BERDecGeneralizedTime(dd0, 0x18, &(val)->renew_until))
  5301. return 0;
  5302. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5303. return 0;
  5304. }
  5305. if (!ASN1BERDecExplicitTag(dd, 0x80000009, &dd0, &di0))
  5306. return 0;
  5307. if (!ASN1BERDecZeroCharString(dd0, 0x1b, &(val)->server_realm))
  5308. return 0;
  5309. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5310. return 0;
  5311. if (!ASN1BERDecExplicitTag(dd, 0x8000000a, &dd0, &di0))
  5312. return 0;
  5313. if (!ASN1Dec_KERB_PRINCIPAL_NAME(dd0, 0, &(val)->server_name))
  5314. return 0;
  5315. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5316. return 0;
  5317. ASN1BERDecPeekTag(dd, &t);
  5318. if (t == 0x8000000b) {
  5319. (val)->o[0] |= 0x10;
  5320. if (!ASN1BERDecExplicitTag(dd, 0x8000000b, &dd0, &di0))
  5321. return 0;
  5322. if (!ASN1Dec_PKERB_HOST_ADDRESSES(dd0, 0, &(val)->client_addresses))
  5323. return 0;
  5324. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5325. return 0;
  5326. }
  5327. ASN1BERDecPeekTag(dd, &t);
  5328. if (t == 0x8000000c) {
  5329. (val)->o[0] |= 0x8;
  5330. if (!ASN1Dec_KERB_ENCRYPTED_KDC_REPLY_encrypted_pa_data(dd, 0, &(val)->encrypted_pa_data))
  5331. return 0;
  5332. }
  5333. if (!ASN1BERDecEndOfContents(dec, dd, di))
  5334. return 0;
  5335. return 1;
  5336. }
  5337. static void ASN1CALL ASN1Free_KERB_ENCRYPTED_KDC_REPLY(KERB_ENCRYPTED_KDC_REPLY *val)
  5338. {
  5339. if (val) {
  5340. ASN1Free_KERB_ENCRYPTION_KEY(&(val)->session_key);
  5341. ASN1Free_PKERB_LAST_REQUEST(&(val)->last_request);
  5342. if ((val)->o[0] & 0x80) {
  5343. }
  5344. ASN1bitstring_free(&(val)->flags);
  5345. if ((val)->o[0] & 0x40) {
  5346. }
  5347. if ((val)->o[0] & 0x20) {
  5348. }
  5349. ASN1ztcharstring_free((val)->server_realm);
  5350. ASN1Free_KERB_PRINCIPAL_NAME(&(val)->server_name);
  5351. if ((val)->o[0] & 0x10) {
  5352. ASN1Free_PKERB_HOST_ADDRESSES(&(val)->client_addresses);
  5353. }
  5354. if ((val)->o[0] & 0x8) {
  5355. ASN1Free_KERB_ENCRYPTED_KDC_REPLY_encrypted_pa_data(&(val)->encrypted_pa_data);
  5356. }
  5357. }
  5358. }
  5359. static int ASN1CALL ASN1Enc_KERB_AP_REQUEST(ASN1encoding_t enc, ASN1uint32_t tag, KERB_AP_REQUEST *val)
  5360. {
  5361. ASN1uint32_t nExplTagLenOff0;
  5362. ASN1uint32_t nLenOff;
  5363. ASN1uint32_t nLenOff0;
  5364. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x4000000e, &nExplTagLenOff0))
  5365. return 0;
  5366. if (!ASN1BEREncExplicitTag(enc, 0x10, &nLenOff))
  5367. return 0;
  5368. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  5369. return 0;
  5370. if (!ASN1BEREncS32(enc, 0x2, (val)->version))
  5371. return 0;
  5372. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5373. return 0;
  5374. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  5375. return 0;
  5376. if (!ASN1BEREncS32(enc, 0x2, (val)->message_type))
  5377. return 0;
  5378. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5379. return 0;
  5380. if (!ASN1BEREncExplicitTag(enc, 0x80000002, &nLenOff0))
  5381. return 0;
  5382. if (!ASN1DEREncBitString(enc, 0x3, ((val)->ap_options).length, ((val)->ap_options).value))
  5383. return 0;
  5384. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5385. return 0;
  5386. if (!ASN1BEREncExplicitTag(enc, 0x80000003, &nLenOff0))
  5387. return 0;
  5388. if (!ASN1Enc_KERB_TICKET(enc, 0, &(val)->ticket))
  5389. return 0;
  5390. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5391. return 0;
  5392. if (!ASN1BEREncExplicitTag(enc, 0x80000004, &nLenOff0))
  5393. return 0;
  5394. if (!ASN1Enc_KERB_ENCRYPTED_DATA(enc, 0, &(val)->authenticator))
  5395. return 0;
  5396. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5397. return 0;
  5398. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  5399. return 0;
  5400. if (!ASN1BEREncEndOfContents(enc, nExplTagLenOff0))
  5401. return 0;
  5402. return 1;
  5403. }
  5404. static int ASN1CALL ASN1Dec_KERB_AP_REQUEST(ASN1decoding_t dec, ASN1uint32_t tag, KERB_AP_REQUEST *val)
  5405. {
  5406. ASN1decoding_t dd;
  5407. ASN1octet_t *di;
  5408. ASN1decoding_t pExplTagDec0;
  5409. ASN1octet_t *pbExplTagDataEnd0;
  5410. ASN1decoding_t dd0;
  5411. ASN1octet_t *di0;
  5412. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x4000000e, &pExplTagDec0, &pbExplTagDataEnd0))
  5413. return 0;
  5414. if (!ASN1BERDecExplicitTag(pExplTagDec0, 0x10, &dd, &di))
  5415. return 0;
  5416. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  5417. return 0;
  5418. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->version))
  5419. return 0;
  5420. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5421. return 0;
  5422. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  5423. return 0;
  5424. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->message_type))
  5425. return 0;
  5426. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5427. return 0;
  5428. if (!ASN1BERDecExplicitTag(dd, 0x80000002, &dd0, &di0))
  5429. return 0;
  5430. if (!ASN1BERDecBitString(dd0, 0x3, &(val)->ap_options))
  5431. return 0;
  5432. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5433. return 0;
  5434. if (!ASN1BERDecExplicitTag(dd, 0x80000003, &dd0, &di0))
  5435. return 0;
  5436. if (!ASN1Dec_KERB_TICKET(dd0, 0, &(val)->ticket))
  5437. return 0;
  5438. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5439. return 0;
  5440. if (!ASN1BERDecExplicitTag(dd, 0x80000004, &dd0, &di0))
  5441. return 0;
  5442. if (!ASN1Dec_KERB_ENCRYPTED_DATA(dd0, 0, &(val)->authenticator))
  5443. return 0;
  5444. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5445. return 0;
  5446. if (!ASN1BERDecEndOfContents(pExplTagDec0, dd, di))
  5447. return 0;
  5448. if (!ASN1BERDecEndOfContents(dec, pExplTagDec0, pbExplTagDataEnd0))
  5449. return 0;
  5450. return 1;
  5451. }
  5452. static void ASN1CALL ASN1Free_KERB_AP_REQUEST(KERB_AP_REQUEST *val)
  5453. {
  5454. if (val) {
  5455. ASN1bitstring_free(&(val)->ap_options);
  5456. ASN1Free_KERB_TICKET(&(val)->ticket);
  5457. ASN1Free_KERB_ENCRYPTED_DATA(&(val)->authenticator);
  5458. }
  5459. }
  5460. static int ASN1CALL ASN1Enc_KERB_AP_REPLY(ASN1encoding_t enc, ASN1uint32_t tag, KERB_AP_REPLY *val)
  5461. {
  5462. ASN1uint32_t nExplTagLenOff0;
  5463. ASN1uint32_t nLenOff;
  5464. ASN1uint32_t nLenOff0;
  5465. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x4000000f, &nExplTagLenOff0))
  5466. return 0;
  5467. if (!ASN1BEREncExplicitTag(enc, 0x10, &nLenOff))
  5468. return 0;
  5469. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  5470. return 0;
  5471. if (!ASN1BEREncS32(enc, 0x2, (val)->version))
  5472. return 0;
  5473. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5474. return 0;
  5475. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  5476. return 0;
  5477. if (!ASN1BEREncS32(enc, 0x2, (val)->message_type))
  5478. return 0;
  5479. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5480. return 0;
  5481. if (!ASN1BEREncExplicitTag(enc, 0x80000002, &nLenOff0))
  5482. return 0;
  5483. if (!ASN1Enc_KERB_ENCRYPTED_DATA(enc, 0, &(val)->encrypted_part))
  5484. return 0;
  5485. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5486. return 0;
  5487. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  5488. return 0;
  5489. if (!ASN1BEREncEndOfContents(enc, nExplTagLenOff0))
  5490. return 0;
  5491. return 1;
  5492. }
  5493. static int ASN1CALL ASN1Dec_KERB_AP_REPLY(ASN1decoding_t dec, ASN1uint32_t tag, KERB_AP_REPLY *val)
  5494. {
  5495. ASN1decoding_t dd;
  5496. ASN1octet_t *di;
  5497. ASN1decoding_t pExplTagDec0;
  5498. ASN1octet_t *pbExplTagDataEnd0;
  5499. ASN1decoding_t dd0;
  5500. ASN1octet_t *di0;
  5501. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x4000000f, &pExplTagDec0, &pbExplTagDataEnd0))
  5502. return 0;
  5503. if (!ASN1BERDecExplicitTag(pExplTagDec0, 0x10, &dd, &di))
  5504. return 0;
  5505. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  5506. return 0;
  5507. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->version))
  5508. return 0;
  5509. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5510. return 0;
  5511. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  5512. return 0;
  5513. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->message_type))
  5514. return 0;
  5515. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5516. return 0;
  5517. if (!ASN1BERDecExplicitTag(dd, 0x80000002, &dd0, &di0))
  5518. return 0;
  5519. if (!ASN1Dec_KERB_ENCRYPTED_DATA(dd0, 0, &(val)->encrypted_part))
  5520. return 0;
  5521. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5522. return 0;
  5523. if (!ASN1BERDecEndOfContents(pExplTagDec0, dd, di))
  5524. return 0;
  5525. if (!ASN1BERDecEndOfContents(dec, pExplTagDec0, pbExplTagDataEnd0))
  5526. return 0;
  5527. return 1;
  5528. }
  5529. static void ASN1CALL ASN1Free_KERB_AP_REPLY(KERB_AP_REPLY *val)
  5530. {
  5531. if (val) {
  5532. ASN1Free_KERB_ENCRYPTED_DATA(&(val)->encrypted_part);
  5533. }
  5534. }
  5535. static int ASN1CALL ASN1Enc_KERB_ENCRYPTED_AP_REPLY(ASN1encoding_t enc, ASN1uint32_t tag, KERB_ENCRYPTED_AP_REPLY *val)
  5536. {
  5537. ASN1uint32_t nExplTagLenOff0;
  5538. ASN1uint32_t nLenOff;
  5539. ASN1uint32_t nLenOff0;
  5540. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x4000001b, &nExplTagLenOff0))
  5541. return 0;
  5542. if (!ASN1BEREncExplicitTag(enc, 0x10, &nLenOff))
  5543. return 0;
  5544. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  5545. return 0;
  5546. if (!ASN1DEREncGeneralizedTime(enc, 0x18, &(val)->client_time))
  5547. return 0;
  5548. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5549. return 0;
  5550. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  5551. return 0;
  5552. if (!ASN1BEREncS32(enc, 0x2, (val)->client_usec))
  5553. return 0;
  5554. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5555. return 0;
  5556. if ((val)->o[0] & 0x80) {
  5557. if (!ASN1BEREncExplicitTag(enc, 0x80000002, &nLenOff0))
  5558. return 0;
  5559. if (!ASN1Enc_KERB_ENCRYPTION_KEY(enc, 0, &(val)->subkey))
  5560. return 0;
  5561. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5562. return 0;
  5563. }
  5564. if ((val)->o[0] & 0x40) {
  5565. if (!ASN1BEREncExplicitTag(enc, 0x80000003, &nLenOff0))
  5566. return 0;
  5567. if (!ASN1BEREncU32(enc, 0x2, (val)->sequence_number))
  5568. return 0;
  5569. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5570. return 0;
  5571. }
  5572. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  5573. return 0;
  5574. if (!ASN1BEREncEndOfContents(enc, nExplTagLenOff0))
  5575. return 0;
  5576. return 1;
  5577. }
  5578. static int ASN1CALL ASN1Dec_KERB_ENCRYPTED_AP_REPLY(ASN1decoding_t dec, ASN1uint32_t tag, KERB_ENCRYPTED_AP_REPLY *val)
  5579. {
  5580. ASN1decoding_t dd;
  5581. ASN1octet_t *di;
  5582. ASN1decoding_t pExplTagDec0;
  5583. ASN1octet_t *pbExplTagDataEnd0;
  5584. ASN1decoding_t dd0;
  5585. ASN1octet_t *di0;
  5586. ASN1uint32_t t;
  5587. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x4000001b, &pExplTagDec0, &pbExplTagDataEnd0))
  5588. return 0;
  5589. if (!ASN1BERDecExplicitTag(pExplTagDec0, 0x10, &dd, &di))
  5590. return 0;
  5591. ZeroMemory((val)->o, 1);
  5592. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  5593. return 0;
  5594. if (!ASN1BERDecGeneralizedTime(dd0, 0x18, &(val)->client_time))
  5595. return 0;
  5596. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5597. return 0;
  5598. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  5599. return 0;
  5600. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->client_usec))
  5601. return 0;
  5602. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5603. return 0;
  5604. ASN1BERDecPeekTag(dd, &t);
  5605. if (t == 0x80000002) {
  5606. (val)->o[0] |= 0x80;
  5607. if (!ASN1BERDecExplicitTag(dd, 0x80000002, &dd0, &di0))
  5608. return 0;
  5609. if (!ASN1Dec_KERB_ENCRYPTION_KEY(dd0, 0, &(val)->subkey))
  5610. return 0;
  5611. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5612. return 0;
  5613. }
  5614. ASN1BERDecPeekTag(dd, &t);
  5615. if (t == 0x80000003) {
  5616. (val)->o[0] |= 0x40;
  5617. if (!ASN1BERDecExplicitTag(dd, 0x80000003, &dd0, &di0))
  5618. return 0;
  5619. if (!ASN1BERDecU32Val(dd0, 0x2, (ASN1uint32_t *) &(val)->sequence_number))
  5620. return 0;
  5621. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5622. return 0;
  5623. }
  5624. if (!ASN1BERDecEndOfContents(pExplTagDec0, dd, di))
  5625. return 0;
  5626. if (!ASN1BERDecEndOfContents(dec, pExplTagDec0, pbExplTagDataEnd0))
  5627. return 0;
  5628. return 1;
  5629. }
  5630. static void ASN1CALL ASN1Free_KERB_ENCRYPTED_AP_REPLY(KERB_ENCRYPTED_AP_REPLY *val)
  5631. {
  5632. if (val) {
  5633. if ((val)->o[0] & 0x80) {
  5634. ASN1Free_KERB_ENCRYPTION_KEY(&(val)->subkey);
  5635. }
  5636. }
  5637. }
  5638. static int ASN1CALL ASN1Enc_KERB_SAFE_MESSAGE(ASN1encoding_t enc, ASN1uint32_t tag, KERB_SAFE_MESSAGE *val)
  5639. {
  5640. ASN1uint32_t nExplTagLenOff0;
  5641. ASN1uint32_t nLenOff;
  5642. ASN1uint32_t nLenOff0;
  5643. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x40000014, &nExplTagLenOff0))
  5644. return 0;
  5645. if (!ASN1BEREncExplicitTag(enc, 0x10, &nLenOff))
  5646. return 0;
  5647. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  5648. return 0;
  5649. if (!ASN1BEREncS32(enc, 0x2, (val)->version))
  5650. return 0;
  5651. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5652. return 0;
  5653. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  5654. return 0;
  5655. if (!ASN1BEREncS32(enc, 0x2, (val)->message_type))
  5656. return 0;
  5657. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5658. return 0;
  5659. if (!ASN1BEREncExplicitTag(enc, 0x80000002, &nLenOff0))
  5660. return 0;
  5661. if (!ASN1Enc_KERB_SAFE_BODY(enc, 0, &(val)->safe_body))
  5662. return 0;
  5663. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5664. return 0;
  5665. if (!ASN1BEREncExplicitTag(enc, 0x80000003, &nLenOff0))
  5666. return 0;
  5667. if (!ASN1Enc_KERB_CHECKSUM(enc, 0, &(val)->checksum))
  5668. return 0;
  5669. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5670. return 0;
  5671. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  5672. return 0;
  5673. if (!ASN1BEREncEndOfContents(enc, nExplTagLenOff0))
  5674. return 0;
  5675. return 1;
  5676. }
  5677. static int ASN1CALL ASN1Dec_KERB_SAFE_MESSAGE(ASN1decoding_t dec, ASN1uint32_t tag, KERB_SAFE_MESSAGE *val)
  5678. {
  5679. ASN1decoding_t dd;
  5680. ASN1octet_t *di;
  5681. ASN1decoding_t pExplTagDec0;
  5682. ASN1octet_t *pbExplTagDataEnd0;
  5683. ASN1decoding_t dd0;
  5684. ASN1octet_t *di0;
  5685. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x40000014, &pExplTagDec0, &pbExplTagDataEnd0))
  5686. return 0;
  5687. if (!ASN1BERDecExplicitTag(pExplTagDec0, 0x10, &dd, &di))
  5688. return 0;
  5689. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  5690. return 0;
  5691. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->version))
  5692. return 0;
  5693. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5694. return 0;
  5695. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  5696. return 0;
  5697. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->message_type))
  5698. return 0;
  5699. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5700. return 0;
  5701. if (!ASN1BERDecExplicitTag(dd, 0x80000002, &dd0, &di0))
  5702. return 0;
  5703. if (!ASN1Dec_KERB_SAFE_BODY(dd0, 0, &(val)->safe_body))
  5704. return 0;
  5705. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5706. return 0;
  5707. if (!ASN1BERDecExplicitTag(dd, 0x80000003, &dd0, &di0))
  5708. return 0;
  5709. if (!ASN1Dec_KERB_CHECKSUM(dd0, 0, &(val)->checksum))
  5710. return 0;
  5711. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5712. return 0;
  5713. if (!ASN1BERDecEndOfContents(pExplTagDec0, dd, di))
  5714. return 0;
  5715. if (!ASN1BERDecEndOfContents(dec, pExplTagDec0, pbExplTagDataEnd0))
  5716. return 0;
  5717. return 1;
  5718. }
  5719. static void ASN1CALL ASN1Free_KERB_SAFE_MESSAGE(KERB_SAFE_MESSAGE *val)
  5720. {
  5721. if (val) {
  5722. ASN1Free_KERB_SAFE_BODY(&(val)->safe_body);
  5723. ASN1Free_KERB_CHECKSUM(&(val)->checksum);
  5724. }
  5725. }
  5726. static int ASN1CALL ASN1Enc_KERB_PRIV_MESSAGE(ASN1encoding_t enc, ASN1uint32_t tag, KERB_PRIV_MESSAGE *val)
  5727. {
  5728. ASN1uint32_t nExplTagLenOff0;
  5729. ASN1uint32_t nLenOff;
  5730. ASN1uint32_t nLenOff0;
  5731. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x40000015, &nExplTagLenOff0))
  5732. return 0;
  5733. if (!ASN1BEREncExplicitTag(enc, 0x10, &nLenOff))
  5734. return 0;
  5735. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  5736. return 0;
  5737. if (!ASN1BEREncS32(enc, 0x2, (val)->version))
  5738. return 0;
  5739. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5740. return 0;
  5741. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  5742. return 0;
  5743. if (!ASN1BEREncS32(enc, 0x2, (val)->message_type))
  5744. return 0;
  5745. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5746. return 0;
  5747. if (!ASN1BEREncExplicitTag(enc, 0x80000003, &nLenOff0))
  5748. return 0;
  5749. if (!ASN1Enc_KERB_ENCRYPTED_DATA(enc, 0, &(val)->encrypted_part))
  5750. return 0;
  5751. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5752. return 0;
  5753. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  5754. return 0;
  5755. if (!ASN1BEREncEndOfContents(enc, nExplTagLenOff0))
  5756. return 0;
  5757. return 1;
  5758. }
  5759. static int ASN1CALL ASN1Dec_KERB_PRIV_MESSAGE(ASN1decoding_t dec, ASN1uint32_t tag, KERB_PRIV_MESSAGE *val)
  5760. {
  5761. ASN1decoding_t dd;
  5762. ASN1octet_t *di;
  5763. ASN1decoding_t pExplTagDec0;
  5764. ASN1octet_t *pbExplTagDataEnd0;
  5765. ASN1decoding_t dd0;
  5766. ASN1octet_t *di0;
  5767. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x40000015, &pExplTagDec0, &pbExplTagDataEnd0))
  5768. return 0;
  5769. if (!ASN1BERDecExplicitTag(pExplTagDec0, 0x10, &dd, &di))
  5770. return 0;
  5771. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  5772. return 0;
  5773. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->version))
  5774. return 0;
  5775. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5776. return 0;
  5777. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  5778. return 0;
  5779. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->message_type))
  5780. return 0;
  5781. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5782. return 0;
  5783. if (!ASN1BERDecExplicitTag(dd, 0x80000003, &dd0, &di0))
  5784. return 0;
  5785. if (!ASN1Dec_KERB_ENCRYPTED_DATA(dd0, 0, &(val)->encrypted_part))
  5786. return 0;
  5787. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5788. return 0;
  5789. if (!ASN1BERDecEndOfContents(pExplTagDec0, dd, di))
  5790. return 0;
  5791. if (!ASN1BERDecEndOfContents(dec, pExplTagDec0, pbExplTagDataEnd0))
  5792. return 0;
  5793. return 1;
  5794. }
  5795. static void ASN1CALL ASN1Free_KERB_PRIV_MESSAGE(KERB_PRIV_MESSAGE *val)
  5796. {
  5797. if (val) {
  5798. ASN1Free_KERB_ENCRYPTED_DATA(&(val)->encrypted_part);
  5799. }
  5800. }
  5801. static int ASN1CALL ASN1Enc_KERB_CRED(ASN1encoding_t enc, ASN1uint32_t tag, KERB_CRED *val)
  5802. {
  5803. ASN1uint32_t nExplTagLenOff0;
  5804. ASN1uint32_t nLenOff;
  5805. ASN1uint32_t nLenOff0;
  5806. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x40000016, &nExplTagLenOff0))
  5807. return 0;
  5808. if (!ASN1BEREncExplicitTag(enc, 0x10, &nLenOff))
  5809. return 0;
  5810. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  5811. return 0;
  5812. if (!ASN1BEREncS32(enc, 0x2, (val)->version))
  5813. return 0;
  5814. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5815. return 0;
  5816. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  5817. return 0;
  5818. if (!ASN1BEREncS32(enc, 0x2, (val)->message_type))
  5819. return 0;
  5820. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5821. return 0;
  5822. if (!ASN1Enc_KERB_CRED_tickets(enc, 0, &(val)->tickets))
  5823. return 0;
  5824. if (!ASN1BEREncExplicitTag(enc, 0x80000003, &nLenOff0))
  5825. return 0;
  5826. if (!ASN1Enc_KERB_ENCRYPTED_DATA(enc, 0, &(val)->encrypted_part))
  5827. return 0;
  5828. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5829. return 0;
  5830. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  5831. return 0;
  5832. if (!ASN1BEREncEndOfContents(enc, nExplTagLenOff0))
  5833. return 0;
  5834. return 1;
  5835. }
  5836. static int ASN1CALL ASN1Dec_KERB_CRED(ASN1decoding_t dec, ASN1uint32_t tag, KERB_CRED *val)
  5837. {
  5838. ASN1decoding_t dd;
  5839. ASN1octet_t *di;
  5840. ASN1decoding_t pExplTagDec0;
  5841. ASN1octet_t *pbExplTagDataEnd0;
  5842. ASN1decoding_t dd0;
  5843. ASN1octet_t *di0;
  5844. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x40000016, &pExplTagDec0, &pbExplTagDataEnd0))
  5845. return 0;
  5846. if (!ASN1BERDecExplicitTag(pExplTagDec0, 0x10, &dd, &di))
  5847. return 0;
  5848. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  5849. return 0;
  5850. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->version))
  5851. return 0;
  5852. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5853. return 0;
  5854. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  5855. return 0;
  5856. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->message_type))
  5857. return 0;
  5858. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5859. return 0;
  5860. if (!ASN1Dec_KERB_CRED_tickets(dd, 0, &(val)->tickets))
  5861. return 0;
  5862. if (!ASN1BERDecExplicitTag(dd, 0x80000003, &dd0, &di0))
  5863. return 0;
  5864. if (!ASN1Dec_KERB_ENCRYPTED_DATA(dd0, 0, &(val)->encrypted_part))
  5865. return 0;
  5866. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5867. return 0;
  5868. if (!ASN1BERDecEndOfContents(pExplTagDec0, dd, di))
  5869. return 0;
  5870. if (!ASN1BERDecEndOfContents(dec, pExplTagDec0, pbExplTagDataEnd0))
  5871. return 0;
  5872. return 1;
  5873. }
  5874. static void ASN1CALL ASN1Free_KERB_CRED(KERB_CRED *val)
  5875. {
  5876. if (val) {
  5877. ASN1Free_KERB_CRED_tickets(&(val)->tickets);
  5878. ASN1Free_KERB_ENCRYPTED_DATA(&(val)->encrypted_part);
  5879. }
  5880. }
  5881. static int ASN1CALL ASN1Enc_KERB_CRED_INFO(ASN1encoding_t enc, ASN1uint32_t tag, KERB_CRED_INFO *val)
  5882. {
  5883. ASN1uint32_t nLenOff;
  5884. ASN1uint32_t nLenOff0;
  5885. ASN1uint32_t t;
  5886. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  5887. return 0;
  5888. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  5889. return 0;
  5890. if (!ASN1Enc_KERB_ENCRYPTION_KEY(enc, 0, &(val)->key))
  5891. return 0;
  5892. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5893. return 0;
  5894. if ((val)->o[0] & 0x80) {
  5895. t = lstrlenA((val)->principal_realm);
  5896. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  5897. return 0;
  5898. if (!ASN1DEREncCharString(enc, 0x1b, t, (val)->principal_realm))
  5899. return 0;
  5900. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5901. return 0;
  5902. }
  5903. if ((val)->o[0] & 0x40) {
  5904. if (!ASN1BEREncExplicitTag(enc, 0x80000002, &nLenOff0))
  5905. return 0;
  5906. if (!ASN1Enc_KERB_PRINCIPAL_NAME(enc, 0, &(val)->principal_name))
  5907. return 0;
  5908. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5909. return 0;
  5910. }
  5911. if ((val)->o[0] & 0x20) {
  5912. if (!ASN1BEREncExplicitTag(enc, 0x80000003, &nLenOff0))
  5913. return 0;
  5914. if (!ASN1DEREncBitString(enc, 0x3, ((val)->flags).length, ((val)->flags).value))
  5915. return 0;
  5916. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5917. return 0;
  5918. }
  5919. if ((val)->o[0] & 0x10) {
  5920. if (!ASN1BEREncExplicitTag(enc, 0x80000004, &nLenOff0))
  5921. return 0;
  5922. if (!ASN1DEREncGeneralizedTime(enc, 0x18, &(val)->authtime))
  5923. return 0;
  5924. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5925. return 0;
  5926. }
  5927. if ((val)->o[0] & 0x8) {
  5928. if (!ASN1BEREncExplicitTag(enc, 0x80000005, &nLenOff0))
  5929. return 0;
  5930. if (!ASN1DEREncGeneralizedTime(enc, 0x18, &(val)->starttime))
  5931. return 0;
  5932. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5933. return 0;
  5934. }
  5935. if ((val)->o[0] & 0x4) {
  5936. if (!ASN1BEREncExplicitTag(enc, 0x80000006, &nLenOff0))
  5937. return 0;
  5938. if (!ASN1DEREncGeneralizedTime(enc, 0x18, &(val)->endtime))
  5939. return 0;
  5940. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5941. return 0;
  5942. }
  5943. if ((val)->o[0] & 0x2) {
  5944. if (!ASN1BEREncExplicitTag(enc, 0x80000007, &nLenOff0))
  5945. return 0;
  5946. if (!ASN1DEREncGeneralizedTime(enc, 0x18, &(val)->renew_until))
  5947. return 0;
  5948. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5949. return 0;
  5950. }
  5951. if ((val)->o[0] & 0x1) {
  5952. t = lstrlenA((val)->service_realm);
  5953. if (!ASN1BEREncExplicitTag(enc, 0x80000008, &nLenOff0))
  5954. return 0;
  5955. if (!ASN1DEREncCharString(enc, 0x1b, t, (val)->service_realm))
  5956. return 0;
  5957. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5958. return 0;
  5959. }
  5960. if ((val)->o[1] & 0x80) {
  5961. if (!ASN1BEREncExplicitTag(enc, 0x80000009, &nLenOff0))
  5962. return 0;
  5963. if (!ASN1Enc_KERB_PRINCIPAL_NAME(enc, 0, &(val)->service_name))
  5964. return 0;
  5965. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5966. return 0;
  5967. }
  5968. if ((val)->o[1] & 0x40) {
  5969. if (!ASN1BEREncExplicitTag(enc, 0x8000000a, &nLenOff0))
  5970. return 0;
  5971. if (!ASN1Enc_PKERB_HOST_ADDRESSES(enc, 0, &(val)->client_addresses))
  5972. return 0;
  5973. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  5974. return 0;
  5975. }
  5976. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  5977. return 0;
  5978. return 1;
  5979. }
  5980. static int ASN1CALL ASN1Dec_KERB_CRED_INFO(ASN1decoding_t dec, ASN1uint32_t tag, KERB_CRED_INFO *val)
  5981. {
  5982. ASN1decoding_t dd;
  5983. ASN1octet_t *di;
  5984. ASN1decoding_t dd0;
  5985. ASN1octet_t *di0;
  5986. ASN1uint32_t t;
  5987. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  5988. return 0;
  5989. ZeroMemory((val)->o, 2);
  5990. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  5991. return 0;
  5992. if (!ASN1Dec_KERB_ENCRYPTION_KEY(dd0, 0, &(val)->key))
  5993. return 0;
  5994. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  5995. return 0;
  5996. ASN1BERDecPeekTag(dd, &t);
  5997. if (t == 0x80000001) {
  5998. (val)->o[0] |= 0x80;
  5999. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  6000. return 0;
  6001. if (!ASN1BERDecZeroCharString(dd0, 0x1b, &(val)->principal_realm))
  6002. return 0;
  6003. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  6004. return 0;
  6005. }
  6006. ASN1BERDecPeekTag(dd, &t);
  6007. if (t == 0x80000002) {
  6008. (val)->o[0] |= 0x40;
  6009. if (!ASN1BERDecExplicitTag(dd, 0x80000002, &dd0, &di0))
  6010. return 0;
  6011. if (!ASN1Dec_KERB_PRINCIPAL_NAME(dd0, 0, &(val)->principal_name))
  6012. return 0;
  6013. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  6014. return 0;
  6015. }
  6016. ASN1BERDecPeekTag(dd, &t);
  6017. if (t == 0x80000003) {
  6018. (val)->o[0] |= 0x20;
  6019. if (!ASN1BERDecExplicitTag(dd, 0x80000003, &dd0, &di0))
  6020. return 0;
  6021. if (!ASN1BERDecBitString(dd0, 0x3, &(val)->flags))
  6022. return 0;
  6023. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  6024. return 0;
  6025. }
  6026. ASN1BERDecPeekTag(dd, &t);
  6027. if (t == 0x80000004) {
  6028. (val)->o[0] |= 0x10;
  6029. if (!ASN1BERDecExplicitTag(dd, 0x80000004, &dd0, &di0))
  6030. return 0;
  6031. if (!ASN1BERDecGeneralizedTime(dd0, 0x18, &(val)->authtime))
  6032. return 0;
  6033. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  6034. return 0;
  6035. }
  6036. ASN1BERDecPeekTag(dd, &t);
  6037. if (t == 0x80000005) {
  6038. (val)->o[0] |= 0x8;
  6039. if (!ASN1BERDecExplicitTag(dd, 0x80000005, &dd0, &di0))
  6040. return 0;
  6041. if (!ASN1BERDecGeneralizedTime(dd0, 0x18, &(val)->starttime))
  6042. return 0;
  6043. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  6044. return 0;
  6045. }
  6046. ASN1BERDecPeekTag(dd, &t);
  6047. if (t == 0x80000006) {
  6048. (val)->o[0] |= 0x4;
  6049. if (!ASN1BERDecExplicitTag(dd, 0x80000006, &dd0, &di0))
  6050. return 0;
  6051. if (!ASN1BERDecGeneralizedTime(dd0, 0x18, &(val)->endtime))
  6052. return 0;
  6053. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  6054. return 0;
  6055. }
  6056. ASN1BERDecPeekTag(dd, &t);
  6057. if (t == 0x80000007) {
  6058. (val)->o[0] |= 0x2;
  6059. if (!ASN1BERDecExplicitTag(dd, 0x80000007, &dd0, &di0))
  6060. return 0;
  6061. if (!ASN1BERDecGeneralizedTime(dd0, 0x18, &(val)->renew_until))
  6062. return 0;
  6063. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  6064. return 0;
  6065. }
  6066. ASN1BERDecPeekTag(dd, &t);
  6067. if (t == 0x80000008) {
  6068. (val)->o[0] |= 0x1;
  6069. if (!ASN1BERDecExplicitTag(dd, 0x80000008, &dd0, &di0))
  6070. return 0;
  6071. if (!ASN1BERDecZeroCharString(dd0, 0x1b, &(val)->service_realm))
  6072. return 0;
  6073. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  6074. return 0;
  6075. }
  6076. ASN1BERDecPeekTag(dd, &t);
  6077. if (t == 0x80000009) {
  6078. (val)->o[1] |= 0x80;
  6079. if (!ASN1BERDecExplicitTag(dd, 0x80000009, &dd0, &di0))
  6080. return 0;
  6081. if (!ASN1Dec_KERB_PRINCIPAL_NAME(dd0, 0, &(val)->service_name))
  6082. return 0;
  6083. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  6084. return 0;
  6085. }
  6086. ASN1BERDecPeekTag(dd, &t);
  6087. if (t == 0x8000000a) {
  6088. (val)->o[1] |= 0x40;
  6089. if (!ASN1BERDecExplicitTag(dd, 0x8000000a, &dd0, &di0))
  6090. return 0;
  6091. if (!ASN1Dec_PKERB_HOST_ADDRESSES(dd0, 0, &(val)->client_addresses))
  6092. return 0;
  6093. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  6094. return 0;
  6095. }
  6096. if (!ASN1BERDecEndOfContents(dec, dd, di))
  6097. return 0;
  6098. return 1;
  6099. }
  6100. static void ASN1CALL ASN1Free_KERB_CRED_INFO(KERB_CRED_INFO *val)
  6101. {
  6102. if (val) {
  6103. ASN1Free_KERB_ENCRYPTION_KEY(&(val)->key);
  6104. if ((val)->o[0] & 0x80) {
  6105. ASN1ztcharstring_free((val)->principal_realm);
  6106. }
  6107. if ((val)->o[0] & 0x40) {
  6108. ASN1Free_KERB_PRINCIPAL_NAME(&(val)->principal_name);
  6109. }
  6110. if ((val)->o[0] & 0x20) {
  6111. ASN1bitstring_free(&(val)->flags);
  6112. }
  6113. if ((val)->o[0] & 0x10) {
  6114. }
  6115. if ((val)->o[0] & 0x8) {
  6116. }
  6117. if ((val)->o[0] & 0x4) {
  6118. }
  6119. if ((val)->o[0] & 0x2) {
  6120. }
  6121. if ((val)->o[0] & 0x1) {
  6122. ASN1ztcharstring_free((val)->service_realm);
  6123. }
  6124. if ((val)->o[1] & 0x80) {
  6125. ASN1Free_KERB_PRINCIPAL_NAME(&(val)->service_name);
  6126. }
  6127. if ((val)->o[1] & 0x40) {
  6128. ASN1Free_PKERB_HOST_ADDRESSES(&(val)->client_addresses);
  6129. }
  6130. }
  6131. }
  6132. static int ASN1CALL ASN1Enc_KERB_TGT_REPLY(ASN1encoding_t enc, ASN1uint32_t tag, KERB_TGT_REPLY *val)
  6133. {
  6134. ASN1uint32_t nLenOff;
  6135. ASN1uint32_t nLenOff0;
  6136. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  6137. return 0;
  6138. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  6139. return 0;
  6140. if (!ASN1BEREncS32(enc, 0x2, (val)->version))
  6141. return 0;
  6142. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  6143. return 0;
  6144. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  6145. return 0;
  6146. if (!ASN1BEREncS32(enc, 0x2, (val)->message_type))
  6147. return 0;
  6148. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  6149. return 0;
  6150. if (!ASN1BEREncExplicitTag(enc, 0x80000002, &nLenOff0))
  6151. return 0;
  6152. if (!ASN1Enc_KERB_TICKET(enc, 0, &(val)->ticket))
  6153. return 0;
  6154. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  6155. return 0;
  6156. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  6157. return 0;
  6158. return 1;
  6159. }
  6160. static int ASN1CALL ASN1Dec_KERB_TGT_REPLY(ASN1decoding_t dec, ASN1uint32_t tag, KERB_TGT_REPLY *val)
  6161. {
  6162. ASN1decoding_t dd;
  6163. ASN1octet_t *di;
  6164. ASN1decoding_t dd0;
  6165. ASN1octet_t *di0;
  6166. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  6167. return 0;
  6168. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  6169. return 0;
  6170. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->version))
  6171. return 0;
  6172. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  6173. return 0;
  6174. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  6175. return 0;
  6176. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->message_type))
  6177. return 0;
  6178. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  6179. return 0;
  6180. if (!ASN1BERDecExplicitTag(dd, 0x80000002, &dd0, &di0))
  6181. return 0;
  6182. if (!ASN1Dec_KERB_TICKET(dd0, 0, &(val)->ticket))
  6183. return 0;
  6184. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  6185. return 0;
  6186. if (!ASN1BERDecEndOfContents(dec, dd, di))
  6187. return 0;
  6188. return 1;
  6189. }
  6190. static void ASN1CALL ASN1Free_KERB_TGT_REPLY(KERB_TGT_REPLY *val)
  6191. {
  6192. if (val) {
  6193. ASN1Free_KERB_TICKET(&(val)->ticket);
  6194. }
  6195. }
  6196. static int ASN1CALL ASN1Enc_KERB_SIGNED_REPLY_KEY_PACKAGE(ASN1encoding_t enc, ASN1uint32_t tag, KERB_SIGNED_REPLY_KEY_PACKAGE *val)
  6197. {
  6198. ASN1uint32_t nLenOff;
  6199. ASN1uint32_t nLenOff0;
  6200. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  6201. return 0;
  6202. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  6203. return 0;
  6204. if (!ASN1Enc_KERB_REPLY_KEY_PACKAGE2(enc, 0, &(val)->reply_key_package))
  6205. return 0;
  6206. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  6207. return 0;
  6208. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  6209. return 0;
  6210. if (!ASN1Enc_KERB_SIGNATURE(enc, 0, &(val)->reply_key_signature))
  6211. return 0;
  6212. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  6213. return 0;
  6214. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  6215. return 0;
  6216. return 1;
  6217. }
  6218. static int ASN1CALL ASN1Dec_KERB_SIGNED_REPLY_KEY_PACKAGE(ASN1decoding_t dec, ASN1uint32_t tag, KERB_SIGNED_REPLY_KEY_PACKAGE *val)
  6219. {
  6220. ASN1decoding_t dd;
  6221. ASN1octet_t *di;
  6222. ASN1decoding_t dd0;
  6223. ASN1octet_t *di0;
  6224. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  6225. return 0;
  6226. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  6227. return 0;
  6228. if (!ASN1Dec_KERB_REPLY_KEY_PACKAGE2(dd0, 0, &(val)->reply_key_package))
  6229. return 0;
  6230. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  6231. return 0;
  6232. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  6233. return 0;
  6234. if (!ASN1Dec_KERB_SIGNATURE(dd0, 0, &(val)->reply_key_signature))
  6235. return 0;
  6236. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  6237. return 0;
  6238. if (!ASN1BERDecEndOfContents(dec, dd, di))
  6239. return 0;
  6240. return 1;
  6241. }
  6242. static void ASN1CALL ASN1Free_KERB_SIGNED_REPLY_KEY_PACKAGE(KERB_SIGNED_REPLY_KEY_PACKAGE *val)
  6243. {
  6244. if (val) {
  6245. ASN1Free_KERB_REPLY_KEY_PACKAGE2(&(val)->reply_key_package);
  6246. ASN1Free_KERB_SIGNATURE(&(val)->reply_key_signature);
  6247. }
  6248. }
  6249. static int ASN1CALL ASN1Enc_KERB_SIGNED_KDC_PUBLIC_VALUE(ASN1encoding_t enc, ASN1uint32_t tag, KERB_SIGNED_KDC_PUBLIC_VALUE *val)
  6250. {
  6251. ASN1uint32_t nLenOff;
  6252. ASN1uint32_t nLenOff0;
  6253. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  6254. return 0;
  6255. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  6256. return 0;
  6257. if (!ASN1Enc_KERB_SUBJECT_PUBLIC_KEY_INFO(enc, 0, &(val)->kdc_public_value))
  6258. return 0;
  6259. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  6260. return 0;
  6261. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  6262. return 0;
  6263. if (!ASN1Enc_KERB_SIGNATURE(enc, 0, &(val)->kdc_public_value_sig))
  6264. return 0;
  6265. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  6266. return 0;
  6267. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  6268. return 0;
  6269. return 1;
  6270. }
  6271. static int ASN1CALL ASN1Dec_KERB_SIGNED_KDC_PUBLIC_VALUE(ASN1decoding_t dec, ASN1uint32_t tag, KERB_SIGNED_KDC_PUBLIC_VALUE *val)
  6272. {
  6273. ASN1decoding_t dd;
  6274. ASN1octet_t *di;
  6275. ASN1decoding_t dd0;
  6276. ASN1octet_t *di0;
  6277. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  6278. return 0;
  6279. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  6280. return 0;
  6281. if (!ASN1Dec_KERB_SUBJECT_PUBLIC_KEY_INFO(dd0, 0, &(val)->kdc_public_value))
  6282. return 0;
  6283. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  6284. return 0;
  6285. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  6286. return 0;
  6287. if (!ASN1Dec_KERB_SIGNATURE(dd0, 0, &(val)->kdc_public_value_sig))
  6288. return 0;
  6289. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  6290. return 0;
  6291. if (!ASN1BERDecEndOfContents(dec, dd, di))
  6292. return 0;
  6293. return 1;
  6294. }
  6295. static void ASN1CALL ASN1Free_KERB_SIGNED_KDC_PUBLIC_VALUE(KERB_SIGNED_KDC_PUBLIC_VALUE *val)
  6296. {
  6297. if (val) {
  6298. ASN1Free_KERB_SUBJECT_PUBLIC_KEY_INFO(&(val)->kdc_public_value);
  6299. ASN1Free_KERB_SIGNATURE(&(val)->kdc_public_value_sig);
  6300. }
  6301. }
  6302. static int ASN1CALL ASN1Enc_KERB_TRUSTED_CAS(ASN1encoding_t enc, ASN1uint32_t tag, KERB_TRUSTED_CAS *val)
  6303. {
  6304. ASN1uint32_t nLenOff0;
  6305. switch ((val)->choice) {
  6306. case 1:
  6307. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  6308. return 0;
  6309. if (!ASN1Enc_KERB_KERBEROS_NAME(enc, 0, &(val)->u.principal_name))
  6310. return 0;
  6311. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  6312. return 0;
  6313. break;
  6314. case 2:
  6315. if (!ASN1DEREncOctetString(enc, 0x80000001, ((val)->u.ca_name).length, ((val)->u.ca_name).value))
  6316. return 0;
  6317. break;
  6318. case 3:
  6319. if (!ASN1DEREncOctetString(enc, 0x80000002, ((val)->u.issuer_and_serial).length, ((val)->u.issuer_and_serial).value))
  6320. return 0;
  6321. break;
  6322. }
  6323. return 1;
  6324. }
  6325. static int ASN1CALL ASN1Dec_KERB_TRUSTED_CAS(ASN1decoding_t dec, ASN1uint32_t tag, KERB_TRUSTED_CAS *val)
  6326. {
  6327. ASN1uint32_t t;
  6328. ASN1decoding_t dd0;
  6329. ASN1octet_t *di0;
  6330. if (!ASN1BERDecPeekTag(dec, &t))
  6331. return 0;
  6332. switch (t) {
  6333. case 0x80000000:
  6334. (val)->choice = 1;
  6335. if (!ASN1BERDecExplicitTag(dec, 0x80000000, &dd0, &di0))
  6336. return 0;
  6337. if (!ASN1Dec_KERB_KERBEROS_NAME(dd0, 0, &(val)->u.principal_name))
  6338. return 0;
  6339. if (!ASN1BERDecEndOfContents(dec, dd0, di0))
  6340. return 0;
  6341. break;
  6342. case 0x80000001:
  6343. (val)->choice = 2;
  6344. if (!ASN1BERDecOctetString(dec, 0x80000001, &(val)->u.ca_name))
  6345. return 0;
  6346. break;
  6347. case 0x80000002:
  6348. (val)->choice = 3;
  6349. if (!ASN1BERDecOctetString(dec, 0x80000002, &(val)->u.issuer_and_serial))
  6350. return 0;
  6351. break;
  6352. default:
  6353. ASN1DecSetError(dec, ASN1_ERR_CORRUPT);
  6354. return 0;
  6355. }
  6356. return 1;
  6357. }
  6358. static void ASN1CALL ASN1Free_KERB_TRUSTED_CAS(KERB_TRUSTED_CAS *val)
  6359. {
  6360. if (val) {
  6361. switch ((val)->choice) {
  6362. case 1:
  6363. ASN1Free_KERB_KERBEROS_NAME(&(val)->u.principal_name);
  6364. break;
  6365. case 2:
  6366. ASN1octetstring_free(&(val)->u.ca_name);
  6367. break;
  6368. case 3:
  6369. ASN1octetstring_free(&(val)->u.issuer_and_serial);
  6370. break;
  6371. }
  6372. }
  6373. }
  6374. static int ASN1CALL ASN1Enc_KERB_AUTH_PACKAGE(ASN1encoding_t enc, ASN1uint32_t tag, KERB_AUTH_PACKAGE *val)
  6375. {
  6376. ASN1uint32_t nLenOff;
  6377. ASN1uint32_t nLenOff0;
  6378. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  6379. return 0;
  6380. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  6381. return 0;
  6382. if (!ASN1Enc_KERB_PK_AUTHENTICATOR(enc, 0, &(val)->pk_authenticator))
  6383. return 0;
  6384. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  6385. return 0;
  6386. if ((val)->o[0] & 0x80) {
  6387. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  6388. return 0;
  6389. if (!ASN1Enc_KERB_SUBJECT_PUBLIC_KEY_INFO(enc, 0, &(val)->client_public_value))
  6390. return 0;
  6391. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  6392. return 0;
  6393. }
  6394. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  6395. return 0;
  6396. return 1;
  6397. }
  6398. static int ASN1CALL ASN1Dec_KERB_AUTH_PACKAGE(ASN1decoding_t dec, ASN1uint32_t tag, KERB_AUTH_PACKAGE *val)
  6399. {
  6400. ASN1decoding_t dd;
  6401. ASN1octet_t *di;
  6402. ASN1decoding_t dd0;
  6403. ASN1octet_t *di0;
  6404. ASN1uint32_t t;
  6405. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  6406. return 0;
  6407. ZeroMemory((val)->o, 1);
  6408. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  6409. return 0;
  6410. if (!ASN1Dec_KERB_PK_AUTHENTICATOR(dd0, 0, &(val)->pk_authenticator))
  6411. return 0;
  6412. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  6413. return 0;
  6414. ASN1BERDecPeekTag(dd, &t);
  6415. if (t == 0x80000001) {
  6416. (val)->o[0] |= 0x80;
  6417. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  6418. return 0;
  6419. if (!ASN1Dec_KERB_SUBJECT_PUBLIC_KEY_INFO(dd0, 0, &(val)->client_public_value))
  6420. return 0;
  6421. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  6422. return 0;
  6423. }
  6424. if (!ASN1BERDecEndOfContents(dec, dd, di))
  6425. return 0;
  6426. return 1;
  6427. }
  6428. static void ASN1CALL ASN1Free_KERB_AUTH_PACKAGE(KERB_AUTH_PACKAGE *val)
  6429. {
  6430. if (val) {
  6431. ASN1Free_KERB_PK_AUTHENTICATOR(&(val)->pk_authenticator);
  6432. if ((val)->o[0] & 0x80) {
  6433. ASN1Free_KERB_SUBJECT_PUBLIC_KEY_INFO(&(val)->client_public_value);
  6434. }
  6435. }
  6436. }
  6437. 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)
  6438. {
  6439. ASN1uint32_t nLenOff0;
  6440. PKERB_PA_PK_AS_REQ_trusted_certifiers f;
  6441. ASN1uint32_t nLenOff;
  6442. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x80000002, &nLenOff0))
  6443. return 0;
  6444. if (!ASN1BEREncExplicitTag(enc, 0x10, &nLenOff))
  6445. return 0;
  6446. for (f = *val; f; f = f->next) {
  6447. if (!ASN1Enc_KERB_TRUSTED_CAS(enc, 0, &f->value))
  6448. return 0;
  6449. }
  6450. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  6451. return 0;
  6452. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  6453. return 0;
  6454. return 1;
  6455. }
  6456. 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)
  6457. {
  6458. PKERB_PA_PK_AS_REQ_trusted_certifiers *f;
  6459. ASN1decoding_t dd0;
  6460. ASN1octet_t *di0;
  6461. ASN1decoding_t dd;
  6462. ASN1octet_t *di;
  6463. ASN1uint32_t t;
  6464. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x80000002, &dd0, &di0))
  6465. return 0;
  6466. if (!ASN1BERDecExplicitTag(dd0, 0x10, &dd, &di))
  6467. return 0;
  6468. f = val;
  6469. while (ASN1BERDecNotEndOfContents(dd, di)) {
  6470. if (!ASN1BERDecPeekTag(dd, &t))
  6471. return 0;
  6472. if (!(*f = (PKERB_PA_PK_AS_REQ_trusted_certifiers)ASN1DecAlloc(dd, sizeof(**f))))
  6473. return 0;
  6474. if (!ASN1Dec_KERB_TRUSTED_CAS(dd, 0, &(*f)->value))
  6475. return 0;
  6476. f = &(*f)->next;
  6477. }
  6478. *f = NULL;
  6479. if (!ASN1BERDecEndOfContents(dd0, dd, di))
  6480. return 0;
  6481. if (!ASN1BERDecEndOfContents(dec, dd0, di0))
  6482. return 0;
  6483. return 1;
  6484. }
  6485. static void ASN1CALL ASN1Free_KERB_PA_PK_AS_REQ_trusted_certifiers(PKERB_PA_PK_AS_REQ_trusted_certifiers *val)
  6486. {
  6487. PKERB_PA_PK_AS_REQ_trusted_certifiers f, ff;
  6488. if (val) {
  6489. for (f = *val; f; f = ff) {
  6490. ASN1Free_KERB_TRUSTED_CAS(&f->value);
  6491. ff = f->next;
  6492. ASN1Free(f);
  6493. }
  6494. }
  6495. }
  6496. static int ASN1CALL ASN1Enc_KERB_ENCRYPTED_CRED_ticket_info(ASN1encoding_t enc, ASN1uint32_t tag, PKERB_ENCRYPTED_CRED_ticket_info *val)
  6497. {
  6498. ASN1uint32_t nLenOff0;
  6499. PKERB_ENCRYPTED_CRED_ticket_info f;
  6500. ASN1uint32_t nLenOff;
  6501. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x80000000, &nLenOff0))
  6502. return 0;
  6503. if (!ASN1BEREncExplicitTag(enc, 0x10, &nLenOff))
  6504. return 0;
  6505. for (f = *val; f; f = f->next) {
  6506. if (!ASN1Enc_KERB_CRED_INFO(enc, 0, &f->value))
  6507. return 0;
  6508. }
  6509. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  6510. return 0;
  6511. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  6512. return 0;
  6513. return 1;
  6514. }
  6515. static int ASN1CALL ASN1Dec_KERB_ENCRYPTED_CRED_ticket_info(ASN1decoding_t dec, ASN1uint32_t tag, PKERB_ENCRYPTED_CRED_ticket_info *val)
  6516. {
  6517. PKERB_ENCRYPTED_CRED_ticket_info *f;
  6518. ASN1decoding_t dd0;
  6519. ASN1octet_t *di0;
  6520. ASN1decoding_t dd;
  6521. ASN1octet_t *di;
  6522. ASN1uint32_t t;
  6523. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x80000000, &dd0, &di0))
  6524. return 0;
  6525. if (!ASN1BERDecExplicitTag(dd0, 0x10, &dd, &di))
  6526. return 0;
  6527. f = val;
  6528. while (ASN1BERDecNotEndOfContents(dd, di)) {
  6529. if (!ASN1BERDecPeekTag(dd, &t))
  6530. return 0;
  6531. if (!(*f = (PKERB_ENCRYPTED_CRED_ticket_info)ASN1DecAlloc(dd, sizeof(**f))))
  6532. return 0;
  6533. if (!ASN1Dec_KERB_CRED_INFO(dd, 0, &(*f)->value))
  6534. return 0;
  6535. f = &(*f)->next;
  6536. }
  6537. *f = NULL;
  6538. if (!ASN1BERDecEndOfContents(dd0, dd, di))
  6539. return 0;
  6540. if (!ASN1BERDecEndOfContents(dec, dd0, di0))
  6541. return 0;
  6542. return 1;
  6543. }
  6544. static void ASN1CALL ASN1Free_KERB_ENCRYPTED_CRED_ticket_info(PKERB_ENCRYPTED_CRED_ticket_info *val)
  6545. {
  6546. PKERB_ENCRYPTED_CRED_ticket_info f, ff;
  6547. if (val) {
  6548. for (f = *val; f; f = ff) {
  6549. ASN1Free_KERB_CRED_INFO(&f->value);
  6550. ff = f->next;
  6551. ASN1Free(f);
  6552. }
  6553. }
  6554. }
  6555. static int ASN1CALL ASN1Enc_KERB_CRED_tickets(ASN1encoding_t enc, ASN1uint32_t tag, PKERB_CRED_tickets *val)
  6556. {
  6557. ASN1uint32_t nLenOff0;
  6558. PKERB_CRED_tickets f;
  6559. ASN1uint32_t nLenOff;
  6560. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x80000002, &nLenOff0))
  6561. return 0;
  6562. if (!ASN1BEREncExplicitTag(enc, 0x10, &nLenOff))
  6563. return 0;
  6564. for (f = *val; f; f = f->next) {
  6565. if (!ASN1Enc_KERB_TICKET(enc, 0, &f->value))
  6566. return 0;
  6567. }
  6568. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  6569. return 0;
  6570. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  6571. return 0;
  6572. return 1;
  6573. }
  6574. static int ASN1CALL ASN1Dec_KERB_CRED_tickets(ASN1decoding_t dec, ASN1uint32_t tag, PKERB_CRED_tickets *val)
  6575. {
  6576. PKERB_CRED_tickets *f;
  6577. ASN1decoding_t dd0;
  6578. ASN1octet_t *di0;
  6579. ASN1decoding_t dd;
  6580. ASN1octet_t *di;
  6581. ASN1uint32_t t;
  6582. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x80000002, &dd0, &di0))
  6583. return 0;
  6584. if (!ASN1BERDecExplicitTag(dd0, 0x10, &dd, &di))
  6585. return 0;
  6586. f = val;
  6587. while (ASN1BERDecNotEndOfContents(dd, di)) {
  6588. if (!ASN1BERDecPeekTag(dd, &t))
  6589. return 0;
  6590. if (!(*f = (PKERB_CRED_tickets)ASN1DecAlloc(dd, sizeof(**f))))
  6591. return 0;
  6592. if (!ASN1Dec_KERB_TICKET(dd, 0, &(*f)->value))
  6593. return 0;
  6594. f = &(*f)->next;
  6595. }
  6596. *f = NULL;
  6597. if (!ASN1BERDecEndOfContents(dd0, dd, di))
  6598. return 0;
  6599. if (!ASN1BERDecEndOfContents(dec, dd0, di0))
  6600. return 0;
  6601. return 1;
  6602. }
  6603. static void ASN1CALL ASN1Free_KERB_CRED_tickets(PKERB_CRED_tickets *val)
  6604. {
  6605. PKERB_CRED_tickets f, ff;
  6606. if (val) {
  6607. for (f = *val; f; f = ff) {
  6608. ASN1Free_KERB_TICKET(&f->value);
  6609. ff = f->next;
  6610. ASN1Free(f);
  6611. }
  6612. }
  6613. }
  6614. static int ASN1CALL ASN1Enc_KERB_KDC_REQUEST_BODY_additional_tickets(ASN1encoding_t enc, ASN1uint32_t tag, PKERB_KDC_REQUEST_BODY_additional_tickets *val)
  6615. {
  6616. ASN1uint32_t nLenOff0;
  6617. PKERB_KDC_REQUEST_BODY_additional_tickets f;
  6618. ASN1uint32_t nLenOff;
  6619. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x8000000b, &nLenOff0))
  6620. return 0;
  6621. if (!ASN1BEREncExplicitTag(enc, 0x10, &nLenOff))
  6622. return 0;
  6623. for (f = *val; f; f = f->next) {
  6624. if (!ASN1Enc_KERB_TICKET(enc, 0, &f->value))
  6625. return 0;
  6626. }
  6627. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  6628. return 0;
  6629. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  6630. return 0;
  6631. return 1;
  6632. }
  6633. static int ASN1CALL ASN1Dec_KERB_KDC_REQUEST_BODY_additional_tickets(ASN1decoding_t dec, ASN1uint32_t tag, PKERB_KDC_REQUEST_BODY_additional_tickets *val)
  6634. {
  6635. PKERB_KDC_REQUEST_BODY_additional_tickets *f;
  6636. ASN1decoding_t dd0;
  6637. ASN1octet_t *di0;
  6638. ASN1decoding_t dd;
  6639. ASN1octet_t *di;
  6640. ASN1uint32_t t;
  6641. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x8000000b, &dd0, &di0))
  6642. return 0;
  6643. if (!ASN1BERDecExplicitTag(dd0, 0x10, &dd, &di))
  6644. return 0;
  6645. f = val;
  6646. while (ASN1BERDecNotEndOfContents(dd, di)) {
  6647. if (!ASN1BERDecPeekTag(dd, &t))
  6648. return 0;
  6649. if (!(*f = (PKERB_KDC_REQUEST_BODY_additional_tickets)ASN1DecAlloc(dd, sizeof(**f))))
  6650. return 0;
  6651. if (!ASN1Dec_KERB_TICKET(dd, 0, &(*f)->value))
  6652. return 0;
  6653. f = &(*f)->next;
  6654. }
  6655. *f = NULL;
  6656. if (!ASN1BERDecEndOfContents(dd0, dd, di))
  6657. return 0;
  6658. if (!ASN1BERDecEndOfContents(dec, dd0, di0))
  6659. return 0;
  6660. return 1;
  6661. }
  6662. static void ASN1CALL ASN1Free_KERB_KDC_REQUEST_BODY_additional_tickets(PKERB_KDC_REQUEST_BODY_additional_tickets *val)
  6663. {
  6664. PKERB_KDC_REQUEST_BODY_additional_tickets f, ff;
  6665. if (val) {
  6666. for (f = *val; f; f = ff) {
  6667. ASN1Free_KERB_TICKET(&f->value);
  6668. ff = f->next;
  6669. ASN1Free(f);
  6670. }
  6671. }
  6672. }
  6673. static int ASN1CALL ASN1Enc_KERB_KDC_REQUEST(ASN1encoding_t enc, ASN1uint32_t tag, KERB_KDC_REQUEST *val)
  6674. {
  6675. ASN1uint32_t nLenOff;
  6676. ASN1uint32_t nLenOff0;
  6677. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  6678. return 0;
  6679. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  6680. return 0;
  6681. if (!ASN1BEREncS32(enc, 0x2, (val)->version))
  6682. return 0;
  6683. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  6684. return 0;
  6685. if (!ASN1BEREncExplicitTag(enc, 0x80000002, &nLenOff0))
  6686. return 0;
  6687. if (!ASN1BEREncS32(enc, 0x2, (val)->message_type))
  6688. return 0;
  6689. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  6690. return 0;
  6691. if ((val)->o[0] & 0x80) {
  6692. if (!ASN1Enc_KERB_KDC_REQUEST_preauth_data(enc, 0, &(val)->preauth_data))
  6693. return 0;
  6694. }
  6695. if (!ASN1BEREncExplicitTag(enc, 0x80000004, &nLenOff0))
  6696. return 0;
  6697. if (!ASN1Enc_KERB_KDC_REQUEST_BODY(enc, 0, &(val)->request_body))
  6698. return 0;
  6699. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  6700. return 0;
  6701. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  6702. return 0;
  6703. return 1;
  6704. }
  6705. static int ASN1CALL ASN1Dec_KERB_KDC_REQUEST(ASN1decoding_t dec, ASN1uint32_t tag, KERB_KDC_REQUEST *val)
  6706. {
  6707. ASN1decoding_t dd;
  6708. ASN1octet_t *di;
  6709. ASN1decoding_t dd0;
  6710. ASN1octet_t *di0;
  6711. ASN1uint32_t t;
  6712. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  6713. return 0;
  6714. ZeroMemory((val)->o, 1);
  6715. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  6716. return 0;
  6717. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->version))
  6718. return 0;
  6719. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  6720. return 0;
  6721. if (!ASN1BERDecExplicitTag(dd, 0x80000002, &dd0, &di0))
  6722. return 0;
  6723. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->message_type))
  6724. return 0;
  6725. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  6726. return 0;
  6727. ASN1BERDecPeekTag(dd, &t);
  6728. if (t == 0x80000003) {
  6729. (val)->o[0] |= 0x80;
  6730. if (!ASN1Dec_KERB_KDC_REQUEST_preauth_data(dd, 0, &(val)->preauth_data))
  6731. return 0;
  6732. }
  6733. if (!ASN1BERDecExplicitTag(dd, 0x80000004, &dd0, &di0))
  6734. return 0;
  6735. if (!ASN1Dec_KERB_KDC_REQUEST_BODY(dd0, 0, &(val)->request_body))
  6736. return 0;
  6737. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  6738. return 0;
  6739. if (!ASN1BERDecEndOfContents(dec, dd, di))
  6740. return 0;
  6741. return 1;
  6742. }
  6743. static void ASN1CALL ASN1Free_KERB_KDC_REQUEST(KERB_KDC_REQUEST *val)
  6744. {
  6745. if (val) {
  6746. if ((val)->o[0] & 0x80) {
  6747. ASN1Free_KERB_KDC_REQUEST_preauth_data(&(val)->preauth_data);
  6748. }
  6749. ASN1Free_KERB_KDC_REQUEST_BODY(&(val)->request_body);
  6750. }
  6751. }
  6752. static int ASN1CALL ASN1Enc_KERB_MARSHALLED_REQUEST_BODY(ASN1encoding_t enc, ASN1uint32_t tag, KERB_MARSHALLED_REQUEST_BODY *val)
  6753. {
  6754. if (!ASN1Enc_KERB_KDC_REQUEST_BODY(enc, tag, val))
  6755. return 0;
  6756. return 1;
  6757. }
  6758. static int ASN1CALL ASN1Dec_KERB_MARSHALLED_REQUEST_BODY(ASN1decoding_t dec, ASN1uint32_t tag, KERB_MARSHALLED_REQUEST_BODY *val)
  6759. {
  6760. if (!ASN1Dec_KERB_KDC_REQUEST_BODY(dec, tag, val))
  6761. return 0;
  6762. return 1;
  6763. }
  6764. static void ASN1CALL ASN1Free_KERB_MARSHALLED_REQUEST_BODY(KERB_MARSHALLED_REQUEST_BODY *val)
  6765. {
  6766. if (val) {
  6767. ASN1Free_KERB_KDC_REQUEST_BODY(val);
  6768. }
  6769. }
  6770. static int ASN1CALL ASN1Enc_KERB_AS_REPLY(ASN1encoding_t enc, ASN1uint32_t tag, KERB_AS_REPLY *val)
  6771. {
  6772. ASN1uint32_t nLenOff0;
  6773. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x4000000b, &nLenOff0))
  6774. return 0;
  6775. if (!ASN1Enc_KERB_KDC_REPLY(enc, 0, val))
  6776. return 0;
  6777. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  6778. return 0;
  6779. return 1;
  6780. }
  6781. static int ASN1CALL ASN1Dec_KERB_AS_REPLY(ASN1decoding_t dec, ASN1uint32_t tag, KERB_AS_REPLY *val)
  6782. {
  6783. ASN1decoding_t dd0;
  6784. ASN1octet_t *di0;
  6785. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x4000000b, &dd0, &di0))
  6786. return 0;
  6787. if (!ASN1Dec_KERB_KDC_REPLY(dd0, 0, val))
  6788. return 0;
  6789. if (!ASN1BERDecEndOfContents(dec, dd0, di0))
  6790. return 0;
  6791. return 1;
  6792. }
  6793. static void ASN1CALL ASN1Free_KERB_AS_REPLY(KERB_AS_REPLY *val)
  6794. {
  6795. if (val) {
  6796. ASN1Free_KERB_KDC_REPLY(val);
  6797. }
  6798. }
  6799. static int ASN1CALL ASN1Enc_KERB_TGS_REPLY(ASN1encoding_t enc, ASN1uint32_t tag, KERB_TGS_REPLY *val)
  6800. {
  6801. ASN1uint32_t nLenOff0;
  6802. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x4000000d, &nLenOff0))
  6803. return 0;
  6804. if (!ASN1Enc_KERB_KDC_REPLY(enc, 0, val))
  6805. return 0;
  6806. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  6807. return 0;
  6808. return 1;
  6809. }
  6810. static int ASN1CALL ASN1Dec_KERB_TGS_REPLY(ASN1decoding_t dec, ASN1uint32_t tag, KERB_TGS_REPLY *val)
  6811. {
  6812. ASN1decoding_t dd0;
  6813. ASN1octet_t *di0;
  6814. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x4000000d, &dd0, &di0))
  6815. return 0;
  6816. if (!ASN1Dec_KERB_KDC_REPLY(dd0, 0, val))
  6817. return 0;
  6818. if (!ASN1BERDecEndOfContents(dec, dd0, di0))
  6819. return 0;
  6820. return 1;
  6821. }
  6822. static void ASN1CALL ASN1Free_KERB_TGS_REPLY(KERB_TGS_REPLY *val)
  6823. {
  6824. if (val) {
  6825. ASN1Free_KERB_KDC_REPLY(val);
  6826. }
  6827. }
  6828. static int ASN1CALL ASN1Enc_KERB_ENCRYPTED_AS_REPLY(ASN1encoding_t enc, ASN1uint32_t tag, KERB_ENCRYPTED_AS_REPLY *val)
  6829. {
  6830. ASN1uint32_t nLenOff0;
  6831. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x40000019, &nLenOff0))
  6832. return 0;
  6833. if (!ASN1Enc_KERB_ENCRYPTED_KDC_REPLY(enc, 0, val))
  6834. return 0;
  6835. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  6836. return 0;
  6837. return 1;
  6838. }
  6839. static int ASN1CALL ASN1Dec_KERB_ENCRYPTED_AS_REPLY(ASN1decoding_t dec, ASN1uint32_t tag, KERB_ENCRYPTED_AS_REPLY *val)
  6840. {
  6841. ASN1decoding_t dd0;
  6842. ASN1octet_t *di0;
  6843. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x40000019, &dd0, &di0))
  6844. return 0;
  6845. if (!ASN1Dec_KERB_ENCRYPTED_KDC_REPLY(dd0, 0, val))
  6846. return 0;
  6847. if (!ASN1BERDecEndOfContents(dec, dd0, di0))
  6848. return 0;
  6849. return 1;
  6850. }
  6851. static void ASN1CALL ASN1Free_KERB_ENCRYPTED_AS_REPLY(KERB_ENCRYPTED_AS_REPLY *val)
  6852. {
  6853. if (val) {
  6854. ASN1Free_KERB_ENCRYPTED_KDC_REPLY(val);
  6855. }
  6856. }
  6857. static int ASN1CALL ASN1Enc_KERB_ENCRYPTED_TGS_REPLY(ASN1encoding_t enc, ASN1uint32_t tag, KERB_ENCRYPTED_TGS_REPLY *val)
  6858. {
  6859. ASN1uint32_t nLenOff0;
  6860. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x4000001a, &nLenOff0))
  6861. return 0;
  6862. if (!ASN1Enc_KERB_ENCRYPTED_KDC_REPLY(enc, 0, val))
  6863. return 0;
  6864. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  6865. return 0;
  6866. return 1;
  6867. }
  6868. static int ASN1CALL ASN1Dec_KERB_ENCRYPTED_TGS_REPLY(ASN1decoding_t dec, ASN1uint32_t tag, KERB_ENCRYPTED_TGS_REPLY *val)
  6869. {
  6870. ASN1decoding_t dd0;
  6871. ASN1octet_t *di0;
  6872. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x4000001a, &dd0, &di0))
  6873. return 0;
  6874. if (!ASN1Dec_KERB_ENCRYPTED_KDC_REPLY(dd0, 0, val))
  6875. return 0;
  6876. if (!ASN1BERDecEndOfContents(dec, dd0, di0))
  6877. return 0;
  6878. return 1;
  6879. }
  6880. static void ASN1CALL ASN1Free_KERB_ENCRYPTED_TGS_REPLY(KERB_ENCRYPTED_TGS_REPLY *val)
  6881. {
  6882. if (val) {
  6883. ASN1Free_KERB_ENCRYPTED_KDC_REPLY(val);
  6884. }
  6885. }
  6886. static int ASN1CALL ASN1Enc_KERB_PA_PK_AS_REP2(ASN1encoding_t enc, ASN1uint32_t tag, KERB_PA_PK_AS_REP2 *val)
  6887. {
  6888. ASN1uint32_t nLenOff;
  6889. ASN1uint32_t nLenOff0;
  6890. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  6891. return 0;
  6892. if ((val)->o[0] & 0x80) {
  6893. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  6894. return 0;
  6895. if (!ASN1Enc_KERB_ENCRYPTED_DATA(enc, 0, &(val)->key_package))
  6896. return 0;
  6897. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  6898. return 0;
  6899. }
  6900. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  6901. return 0;
  6902. if (!ASN1Enc_KERB_ENVELOPED_KEY_PACKAGE(enc, 0, &(val)->temp_key_package))
  6903. return 0;
  6904. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  6905. return 0;
  6906. if ((val)->o[0] & 0x40) {
  6907. if (!ASN1BEREncExplicitTag(enc, 0x80000002, &nLenOff0))
  6908. return 0;
  6909. if (!ASN1Enc_KERB_SIGNED_KDC_PUBLIC_VALUE(enc, 0, &(val)->signed_kdc_public_value))
  6910. return 0;
  6911. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  6912. return 0;
  6913. }
  6914. if ((val)->o[0] & 0x20) {
  6915. if (!ASN1Enc_KERB_PA_PK_AS_REP2_kdc_cert(enc, 0, &(val)->kdc_cert))
  6916. return 0;
  6917. }
  6918. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  6919. return 0;
  6920. return 1;
  6921. }
  6922. static int ASN1CALL ASN1Dec_KERB_PA_PK_AS_REP2(ASN1decoding_t dec, ASN1uint32_t tag, KERB_PA_PK_AS_REP2 *val)
  6923. {
  6924. ASN1decoding_t dd;
  6925. ASN1octet_t *di;
  6926. ASN1uint32_t t;
  6927. ASN1decoding_t dd0;
  6928. ASN1octet_t *di0;
  6929. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  6930. return 0;
  6931. ZeroMemory((val)->o, 1);
  6932. ASN1BERDecPeekTag(dd, &t);
  6933. if (t == 0x80000000) {
  6934. (val)->o[0] |= 0x80;
  6935. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  6936. return 0;
  6937. if (!ASN1Dec_KERB_ENCRYPTED_DATA(dd0, 0, &(val)->key_package))
  6938. return 0;
  6939. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  6940. return 0;
  6941. }
  6942. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  6943. return 0;
  6944. if (!ASN1Dec_KERB_ENVELOPED_KEY_PACKAGE(dd0, 0, &(val)->temp_key_package))
  6945. return 0;
  6946. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  6947. return 0;
  6948. ASN1BERDecPeekTag(dd, &t);
  6949. if (t == 0x80000002) {
  6950. (val)->o[0] |= 0x40;
  6951. if (!ASN1BERDecExplicitTag(dd, 0x80000002, &dd0, &di0))
  6952. return 0;
  6953. if (!ASN1Dec_KERB_SIGNED_KDC_PUBLIC_VALUE(dd0, 0, &(val)->signed_kdc_public_value))
  6954. return 0;
  6955. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  6956. return 0;
  6957. }
  6958. ASN1BERDecPeekTag(dd, &t);
  6959. if (t == 0x80000003) {
  6960. (val)->o[0] |= 0x20;
  6961. if (!ASN1Dec_KERB_PA_PK_AS_REP2_kdc_cert(dd, 0, &(val)->kdc_cert))
  6962. return 0;
  6963. }
  6964. if (!ASN1BERDecEndOfContents(dec, dd, di))
  6965. return 0;
  6966. return 1;
  6967. }
  6968. static void ASN1CALL ASN1Free_KERB_PA_PK_AS_REP2(KERB_PA_PK_AS_REP2 *val)
  6969. {
  6970. if (val) {
  6971. if ((val)->o[0] & 0x80) {
  6972. ASN1Free_KERB_ENCRYPTED_DATA(&(val)->key_package);
  6973. }
  6974. ASN1Free_KERB_ENVELOPED_KEY_PACKAGE(&(val)->temp_key_package);
  6975. if ((val)->o[0] & 0x40) {
  6976. ASN1Free_KERB_SIGNED_KDC_PUBLIC_VALUE(&(val)->signed_kdc_public_value);
  6977. }
  6978. if ((val)->o[0] & 0x20) {
  6979. ASN1Free_KERB_PA_PK_AS_REP2_kdc_cert(&(val)->kdc_cert);
  6980. }
  6981. }
  6982. }
  6983. static int ASN1CALL ASN1Enc_KERB_SIGNED_AUTH_PACKAGE(ASN1encoding_t enc, ASN1uint32_t tag, KERB_SIGNED_AUTH_PACKAGE *val)
  6984. {
  6985. ASN1uint32_t nLenOff;
  6986. ASN1uint32_t nLenOff0;
  6987. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  6988. return 0;
  6989. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  6990. return 0;
  6991. if (!ASN1Enc_KERB_AUTH_PACKAGE(enc, 0, &(val)->auth_package))
  6992. return 0;
  6993. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  6994. return 0;
  6995. if (!ASN1BEREncExplicitTag(enc, 0x80000001, &nLenOff0))
  6996. return 0;
  6997. if (!ASN1Enc_KERB_SIGNATURE(enc, 0, &(val)->auth_package_signature))
  6998. return 0;
  6999. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  7000. return 0;
  7001. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  7002. return 0;
  7003. return 1;
  7004. }
  7005. static int ASN1CALL ASN1Dec_KERB_SIGNED_AUTH_PACKAGE(ASN1decoding_t dec, ASN1uint32_t tag, KERB_SIGNED_AUTH_PACKAGE *val)
  7006. {
  7007. ASN1decoding_t dd;
  7008. ASN1octet_t *di;
  7009. ASN1decoding_t dd0;
  7010. ASN1octet_t *di0;
  7011. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  7012. return 0;
  7013. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  7014. return 0;
  7015. if (!ASN1Dec_KERB_AUTH_PACKAGE(dd0, 0, &(val)->auth_package))
  7016. return 0;
  7017. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  7018. return 0;
  7019. if (!ASN1BERDecExplicitTag(dd, 0x80000001, &dd0, &di0))
  7020. return 0;
  7021. if (!ASN1Dec_KERB_SIGNATURE(dd0, 0, &(val)->auth_package_signature))
  7022. return 0;
  7023. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  7024. return 0;
  7025. if (!ASN1BERDecEndOfContents(dec, dd, di))
  7026. return 0;
  7027. return 1;
  7028. }
  7029. static void ASN1CALL ASN1Free_KERB_SIGNED_AUTH_PACKAGE(KERB_SIGNED_AUTH_PACKAGE *val)
  7030. {
  7031. if (val) {
  7032. ASN1Free_KERB_AUTH_PACKAGE(&(val)->auth_package);
  7033. ASN1Free_KERB_SIGNATURE(&(val)->auth_package_signature);
  7034. }
  7035. }
  7036. static int ASN1CALL ASN1Enc_KERB_AS_REQUEST(ASN1encoding_t enc, ASN1uint32_t tag, KERB_AS_REQUEST *val)
  7037. {
  7038. ASN1uint32_t nLenOff0;
  7039. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x4000000a, &nLenOff0))
  7040. return 0;
  7041. if (!ASN1Enc_KERB_KDC_REQUEST(enc, 0, val))
  7042. return 0;
  7043. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  7044. return 0;
  7045. return 1;
  7046. }
  7047. static int ASN1CALL ASN1Dec_KERB_AS_REQUEST(ASN1decoding_t dec, ASN1uint32_t tag, KERB_AS_REQUEST *val)
  7048. {
  7049. ASN1decoding_t dd0;
  7050. ASN1octet_t *di0;
  7051. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x4000000a, &dd0, &di0))
  7052. return 0;
  7053. if (!ASN1Dec_KERB_KDC_REQUEST(dd0, 0, val))
  7054. return 0;
  7055. if (!ASN1BERDecEndOfContents(dec, dd0, di0))
  7056. return 0;
  7057. return 1;
  7058. }
  7059. static void ASN1CALL ASN1Free_KERB_AS_REQUEST(KERB_AS_REQUEST *val)
  7060. {
  7061. if (val) {
  7062. ASN1Free_KERB_KDC_REQUEST(val);
  7063. }
  7064. }
  7065. static int ASN1CALL ASN1Enc_KERB_TGS_REQUEST(ASN1encoding_t enc, ASN1uint32_t tag, KERB_TGS_REQUEST *val)
  7066. {
  7067. ASN1uint32_t nLenOff0;
  7068. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x4000000c, &nLenOff0))
  7069. return 0;
  7070. if (!ASN1Enc_KERB_KDC_REQUEST(enc, 0, val))
  7071. return 0;
  7072. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  7073. return 0;
  7074. return 1;
  7075. }
  7076. static int ASN1CALL ASN1Dec_KERB_TGS_REQUEST(ASN1decoding_t dec, ASN1uint32_t tag, KERB_TGS_REQUEST *val)
  7077. {
  7078. ASN1decoding_t dd0;
  7079. ASN1octet_t *di0;
  7080. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x4000000c, &dd0, &di0))
  7081. return 0;
  7082. if (!ASN1Dec_KERB_KDC_REQUEST(dd0, 0, val))
  7083. return 0;
  7084. if (!ASN1BERDecEndOfContents(dec, dd0, di0))
  7085. return 0;
  7086. return 1;
  7087. }
  7088. static void ASN1CALL ASN1Free_KERB_TGS_REQUEST(KERB_TGS_REQUEST *val)
  7089. {
  7090. if (val) {
  7091. ASN1Free_KERB_KDC_REQUEST(val);
  7092. }
  7093. }
  7094. static int ASN1CALL ASN1Enc_KERB_PA_PK_AS_REQ2(ASN1encoding_t enc, ASN1uint32_t tag, KERB_PA_PK_AS_REQ2 *val)
  7095. {
  7096. ASN1uint32_t nLenOff;
  7097. ASN1uint32_t nLenOff0;
  7098. if (!ASN1BEREncExplicitTag(enc, tag ? tag : 0x10, &nLenOff))
  7099. return 0;
  7100. if (!ASN1BEREncExplicitTag(enc, 0x80000000, &nLenOff0))
  7101. return 0;
  7102. if (!ASN1Enc_KERB_SIGNED_AUTH_PACKAGE(enc, 0, &(val)->signed_auth_pack))
  7103. return 0;
  7104. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  7105. return 0;
  7106. if ((val)->o[0] & 0x80) {
  7107. if (!ASN1Enc_KERB_PA_PK_AS_REQ2_user_certs(enc, 0, &(val)->user_certs))
  7108. return 0;
  7109. }
  7110. if ((val)->o[0] & 0x40) {
  7111. if (!ASN1Enc_KERB_PA_PK_AS_REQ2_trusted_certifiers(enc, 0, &(val)->trusted_certifiers))
  7112. return 0;
  7113. }
  7114. if ((val)->o[0] & 0x20) {
  7115. if (!ASN1BEREncExplicitTag(enc, 0x80000003, &nLenOff0))
  7116. return 0;
  7117. if (!ASN1BEREncS32(enc, 0x2, (val)->serial_number))
  7118. return 0;
  7119. if (!ASN1BEREncEndOfContents(enc, nLenOff0))
  7120. return 0;
  7121. }
  7122. if (!ASN1BEREncEndOfContents(enc, nLenOff))
  7123. return 0;
  7124. return 1;
  7125. }
  7126. static int ASN1CALL ASN1Dec_KERB_PA_PK_AS_REQ2(ASN1decoding_t dec, ASN1uint32_t tag, KERB_PA_PK_AS_REQ2 *val)
  7127. {
  7128. ASN1decoding_t dd;
  7129. ASN1octet_t *di;
  7130. ASN1decoding_t dd0;
  7131. ASN1octet_t *di0;
  7132. ASN1uint32_t t;
  7133. if (!ASN1BERDecExplicitTag(dec, tag ? tag : 0x10, &dd, &di))
  7134. return 0;
  7135. ZeroMemory((val)->o, 1);
  7136. if (!ASN1BERDecExplicitTag(dd, 0x80000000, &dd0, &di0))
  7137. return 0;
  7138. if (!ASN1Dec_KERB_SIGNED_AUTH_PACKAGE(dd0, 0, &(val)->signed_auth_pack))
  7139. return 0;
  7140. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  7141. return 0;
  7142. ASN1BERDecPeekTag(dd, &t);
  7143. if (t == 0x80000001) {
  7144. (val)->o[0] |= 0x80;
  7145. if (!ASN1Dec_KERB_PA_PK_AS_REQ2_user_certs(dd, 0, &(val)->user_certs))
  7146. return 0;
  7147. }
  7148. ASN1BERDecPeekTag(dd, &t);
  7149. if (t == 0x80000002) {
  7150. (val)->o[0] |= 0x40;
  7151. if (!ASN1Dec_KERB_PA_PK_AS_REQ2_trusted_certifiers(dd, 0, &(val)->trusted_certifiers))
  7152. return 0;
  7153. }
  7154. ASN1BERDecPeekTag(dd, &t);
  7155. if (t == 0x80000003) {
  7156. (val)->o[0] |= 0x20;
  7157. if (!ASN1BERDecExplicitTag(dd, 0x80000003, &dd0, &di0))
  7158. return 0;
  7159. if (!ASN1BERDecS32Val(dd0, 0x2, &(val)->serial_number))
  7160. return 0;
  7161. if (!ASN1BERDecEndOfContents(dd, dd0, di0))
  7162. return 0;
  7163. }
  7164. if (!ASN1BERDecEndOfContents(dec, dd, di))
  7165. return 0;
  7166. return 1;
  7167. }
  7168. static void ASN1CALL ASN1Free_KERB_PA_PK_AS_REQ2(KERB_PA_PK_AS_REQ2 *val)
  7169. {
  7170. if (val) {
  7171. ASN1Free_KERB_SIGNED_AUTH_PACKAGE(&(val)->signed_auth_pack);
  7172. if ((val)->o[0] & 0x80) {
  7173. ASN1Free_KERB_PA_PK_AS_REQ2_user_certs(&(val)->user_certs);
  7174. }
  7175. if ((val)->o[0] & 0x40) {
  7176. ASN1Free_KERB_PA_PK_AS_REQ2_trusted_certifiers(&(val)->trusted_certifiers);
  7177. }
  7178. }
  7179. }