PageRenderTime 104ms CodeModel.GetById 17ms RepoModel.GetById 1ms app.codeStats 1ms

/epan/dissectors/packet-isakmp.c

https://github.com/labx-technologies-llc/wireshark
C | 6199 lines | 5379 code | 582 blank | 238 comment | 348 complexity | 8e8e73ee6b27b4299323a4cf5d832ef8 MD5 | raw file
Possible License(s): GPL-2.0, BSD-3-Clause
  1. /* packet-isakmp.c
  2. * Routines for the Internet Security Association and Key Management Protocol
  3. * (ISAKMP) (RFC 2408) and the Internet IP Security Domain of Interpretation
  4. * for ISAKMP (RFC 2407)
  5. * Brad Robel-Forrest <brad.robel-forrest@watchguard.com>
  6. *
  7. * Added routines for the Internet Key Exchange (IKEv2) Protocol
  8. * (draft-ietf-ipsec-ikev2-17.txt)
  9. * Shoichi Sakane <sakane@tanu.org>
  10. *
  11. * Added routines for RFC3947 Negotiation of NAT-Traversal in the IKE
  12. * ronnie sahlberg
  13. *
  14. * 04/2009 Added routines for decryption of IKEv2 Encrypted Payload
  15. * Naoyoshi Ueda <piyomaru3141@gmail.com>
  16. *
  17. * $Id$
  18. *
  19. * Wireshark - Network traffic analyzer
  20. * By Gerald Combs <gerald@wireshark.org>
  21. * Copyright 1998 Gerald Combs
  22. *
  23. * This program is free software; you can redistribute it and/or
  24. * modify it under the terms of the GNU General Public License
  25. * as published by the Free Software Foundation; either version 2
  26. * of the License, or (at your option) any later version.
  27. *
  28. * This program is distributed in the hope that it will be useful,
  29. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  30. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  31. * GNU General Public License for more details.
  32. *
  33. * You should have received a copy of the GNU General Public License
  34. * along with this program; if not, write to the Free Software
  35. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  36. *
  37. * References:
  38. * IKEv2 http://www.ietf.org/rfc/rfc4306.txt?number=4306
  39. * IKEv2bis http://www.ietf.org/rfc/rfc5996.txt?number=5996
  40. *
  41. * http://www.iana.org/assignments/isakmp-registry (last updated 2011-11-07)
  42. * http://www.iana.org/assignments/ipsec-registry (last updated 2011-03-14)
  43. * http://www.iana.org/assignments/ikev2-parameters (last updated 2011-12-19)
  44. */
  45. #include "config.h"
  46. #include <glib.h>
  47. #include <epan/packet.h>
  48. #include <epan/ipproto.h>
  49. #include <epan/asn1.h>
  50. #include <epan/reassemble.h>
  51. #include <epan/dissectors/packet-x509if.h>
  52. #include <epan/dissectors/packet-x509af.h>
  53. #include <epan/dissectors/packet-isakmp.h>
  54. #include <epan/prefs.h>
  55. #include <epan/expert.h>
  56. #ifdef HAVE_LIBGCRYPT
  57. #include <wsutil/wsgcrypt.h>
  58. #include <epan/strutil.h>
  59. #include <epan/uat.h>
  60. #endif
  61. /* Struct for the byte_to_str, match_bytestr_idx, and match_bytestr functions */
  62. typedef struct _byte_string {
  63. const gchar *value;
  64. const guint16 len;
  65. const gchar *strptr;
  66. } byte_string;
  67. static int proto_isakmp = -1;
  68. static int hf_isakmp_nat_keepalive = -1;
  69. static int hf_isakmp_nat_hash = -1;
  70. static int hf_isakmp_nat_original_address_ipv6 = -1;
  71. static int hf_isakmp_nat_original_address_ipv4 = -1;
  72. static int hf_isakmp_ispi = -1;
  73. static int hf_isakmp_rspi = -1;
  74. static int hf_isakmp_typepayload = -1;
  75. static int hf_isakmp_nextpayload = -1;
  76. static int hf_isakmp_criticalpayload = -1;
  77. static int hf_isakmp_datapayload = -1;
  78. static int hf_isakmp_extradata = -1;
  79. static int hf_isakmp_version = -1;
  80. static int hf_isakmp_mjver = -1;
  81. static int hf_isakmp_mnver = -1;
  82. static int hf_isakmp_exchangetype_v1 = -1;
  83. static int hf_isakmp_exchangetype_v2 = -1;
  84. static int hf_isakmp_flags = -1;
  85. static int hf_isakmp_flag_e = -1;
  86. static int hf_isakmp_flag_c = -1;
  87. static int hf_isakmp_flag_a = -1;
  88. static int hf_isakmp_flag_i = -1;
  89. static int hf_isakmp_flag_v = -1;
  90. static int hf_isakmp_flag_r = -1;
  91. static int hf_isakmp_messageid = -1;
  92. static int hf_isakmp_length = -1;
  93. static int hf_isakmp_payloadlen = -1;
  94. static int hf_isakmp_sa_doi = -1;
  95. static int hf_isakmp_sa_situation = -1;
  96. static int hf_isakmp_sa_situation_identity_only = -1;
  97. static int hf_isakmp_sa_situation_secrecy = -1;
  98. static int hf_isakmp_sa_situation_integrity = -1;
  99. static int hf_isakmp_prop_protoid_v1 = -1;
  100. static int hf_isakmp_prop_protoid_v2 = -1;
  101. static int hf_isakmp_prop_number = -1;
  102. static int hf_isakmp_prop_transforms = -1;
  103. static int hf_isakmp_spisize = -1;
  104. static int hf_isakmp_spi = -1;
  105. static int hf_isakmp_trans_number = -1;
  106. static int hf_isakmp_trans_id = -1;
  107. static int hf_isakmp_id_type_v1 = -1;
  108. static int hf_isakmp_id_type_v2 = -1;
  109. static int hf_isakmp_id_protoid = -1;
  110. static int hf_isakmp_id_port = -1;
  111. static int hf_isakmp_id_data = -1;
  112. static int hf_isakmp_id_data_ipv4_addr = -1;
  113. static int hf_isakmp_id_data_fqdn = -1;
  114. static int hf_isakmp_id_data_user_fqdn = -1;
  115. static int hf_isakmp_id_data_ipv4_subnet = -1;
  116. static int hf_isakmp_id_data_ipv4_range_start = -1;
  117. static int hf_isakmp_id_data_ipv4_range_end = -1;
  118. static int hf_isakmp_id_data_ipv6_addr = -1;
  119. static int hf_isakmp_id_data_ipv6_subnet = -1;
  120. static int hf_isakmp_id_data_ipv6_range_start = -1;
  121. static int hf_isakmp_id_data_ipv6_range_end = -1;
  122. static int hf_isakmp_id_data_key_id = -1;
  123. static int hf_isakmp_id_data_cert = -1;
  124. static int hf_isakmp_cert_encoding_v1 = -1;
  125. static int hf_isakmp_cert_encoding_v2 = -1;
  126. static int hf_isakmp_cert_data = -1;
  127. static int hf_isakmp_certreq_type_v1 = -1;
  128. static int hf_isakmp_certreq_type_v2 = -1;
  129. static int hf_isakmp_certreq_authority_v1 = -1;
  130. static int hf_isakmp_certreq_authority_v2 = -1;
  131. static int hf_isakmp_certreq_authority_sig = -1;
  132. static int hf_isakmp_auth_meth = -1;
  133. static int hf_isakmp_auth_data = -1;
  134. static int hf_isakmp_notify_doi = -1;
  135. static int hf_isakmp_notify_protoid_v1 = -1;
  136. static int hf_isakmp_notify_protoid_v2 = -1;
  137. static int hf_isakmp_notify_msgtype_v1 = -1;
  138. static int hf_isakmp_notify_msgtype_v2 = -1;
  139. static int hf_isakmp_notify_data = -1;
  140. static int hf_isakmp_notify_data_dpd_are_you_there = -1;
  141. static int hf_isakmp_notify_data_dpd_are_you_there_ack = -1;
  142. static int hf_isakmp_notify_data_unity_load_balance = -1;
  143. static int hf_isakmp_notify_data_ipcomp_cpi = -1;
  144. static int hf_isakmp_notify_data_ipcomp_transform_id = -1;
  145. static int hf_isakmp_notify_data_redirect_gw_ident_type = -1;
  146. static int hf_isakmp_notify_data_redirect_gw_ident_len = -1;
  147. static int hf_isakmp_notify_data_redirect_new_resp_gw_ident_ipv4 = -1;
  148. static int hf_isakmp_notify_data_redirect_new_resp_gw_ident_ipv6 = -1;
  149. static int hf_isakmp_notify_data_redirect_new_resp_gw_ident_fqdn = -1;
  150. static int hf_isakmp_notify_data_redirect_new_resp_gw_ident = -1;
  151. static int hf_isakmp_notify_data_redirect_nonce_data = -1;
  152. static int hf_isakmp_notify_data_redirect_org_resp_gw_ident_ipv4 = -1;
  153. static int hf_isakmp_notify_data_redirect_org_resp_gw_ident_ipv6 = -1;
  154. static int hf_isakmp_notify_data_redirect_org_resp_gw_ident = -1;
  155. static int hf_isakmp_notify_data_ticket_lifetime = -1;
  156. static int hf_isakmp_notify_data_ticket_data = -1;
  157. static int hf_isakmp_notify_data_rohc_attr = -1;
  158. static int hf_isakmp_notify_data_rohc_attr_type = -1;
  159. static int hf_isakmp_notify_data_rohc_attr_format = -1;
  160. static int hf_isakmp_notify_data_rohc_attr_length = -1;
  161. static int hf_isakmp_notify_data_rohc_attr_value = -1;
  162. static int hf_isakmp_notify_data_rohc_attr_max_cid = -1;
  163. static int hf_isakmp_notify_data_rohc_attr_profile = -1;
  164. static int hf_isakmp_notify_data_rohc_attr_integ = -1;
  165. static int hf_isakmp_notify_data_rohc_attr_icv_len = -1;
  166. static int hf_isakmp_notify_data_rohc_attr_mrru = -1;
  167. static int hf_isakmp_notify_data_qcd_token_secret_data = -1;
  168. static int hf_isakmp_notify_data_ha_nonce_data = -1;
  169. static int hf_isakmp_notify_data_ha_expected_send_req_msg_id = -1;
  170. static int hf_isakmp_notify_data_ha_expected_recv_req_msg_id = -1;
  171. static int hf_isakmp_notify_data_ha_incoming_ipsec_sa_delta_value = -1;
  172. static int hf_isakmp_notify_data_secure_password_methods = -1;
  173. static int hf_isakmp_delete_doi = -1;
  174. static int hf_isakmp_delete_protoid_v1 = -1;
  175. static int hf_isakmp_delete_protoid_v2 = -1;
  176. static int hf_isakmp_delete_spi = -1;
  177. static int hf_isakmp_vid_bytes = -1;
  178. static int hf_isakmp_vid_string = -1;
  179. static int hf_isakmp_vid_cp_product = -1;
  180. static int hf_isakmp_vid_cp_version = -1;
  181. static int hf_isakmp_vid_cp_timestamp = -1;
  182. static int hf_isakmp_vid_cp_reserved = -1;
  183. static int hf_isakmp_vid_cp_features = -1;
  184. static int hf_isakmp_vid_cisco_unity_major = -1;
  185. static int hf_isakmp_vid_cisco_unity_minor = -1;
  186. static int hf_isakmp_vid_ms_nt5_isakmpoakley = -1;
  187. static int hf_isakmp_vid_aruba_via_auth_profile = -1;
  188. static int hf_isakmp_ts_number_of_ts = -1;
  189. static int hf_isakmp_ts_type = -1;
  190. static int hf_isakmp_ts_protoid = -1;
  191. static int hf_isakmp_ts_selector_length = -1;
  192. static int hf_isakmp_ts_start_port = -1;
  193. static int hf_isakmp_ts_end_port = -1;
  194. static int hf_isakmp_ts_start_addr_ipv4 = -1;
  195. static int hf_isakmp_ts_end_addr_ipv4 = -1;
  196. static int hf_isakmp_ts_start_addr_ipv6 = -1;
  197. static int hf_isakmp_ts_end_addr_ipv6 = -1;
  198. static int hf_isakmp_ts_start_addr_fc = -1;
  199. static int hf_isakmp_ts_end_addr_fc = -1;
  200. static int hf_isakmp_ts_start_r_ctl = -1;
  201. static int hf_isakmp_ts_end_r_ctl = -1;
  202. static int hf_isakmp_ts_start_type = -1;
  203. static int hf_isakmp_ts_end_type = -1;
  204. static int hf_isakmp_ts_data = -1;
  205. static int hf_isakmp_num_spis = -1;
  206. static int hf_isakmp_hash = -1;
  207. static int hf_isakmp_sig = -1;
  208. static int hf_isakmp_nonce = -1;
  209. static int hf_isakmp_tf_attr = -1;
  210. static int hf_isakmp_tf_attr_type_v1 = -1;
  211. static int hf_isakmp_tf_attr_format = -1;
  212. static int hf_isakmp_tf_attr_length = -1;
  213. static int hf_isakmp_tf_attr_value = -1;
  214. static int hf_isakmp_tf_attr_life_type = -1;
  215. static int hf_isakmp_tf_attr_life_duration_uint32 = -1;
  216. static int hf_isakmp_tf_attr_life_duration_uint64 = -1;
  217. static int hf_isakmp_tf_attr_life_duration_bytes = -1;
  218. static int hf_isakmp_tf_attr_group_description = -1;
  219. static int hf_isakmp_tf_attr_encap_mode = -1;
  220. static int hf_isakmp_tf_attr_auth_algorithm = -1;
  221. static int hf_isakmp_tf_attr_key_length = -1;
  222. static int hf_isakmp_tf_attr_key_rounds = -1;
  223. static int hf_isakmp_tf_attr_cmpr_dict_size = -1;
  224. static int hf_isakmp_tf_attr_cmpr_algorithm = -1;
  225. static int hf_isakmp_tf_attr_ecn_tunnel = -1;
  226. static int hf_isakmp_tf_attr_ext_seq_nbr = -1;
  227. static int hf_isakmp_tf_attr_auth_key_length = -1;
  228. static int hf_isakmp_tf_attr_sig_enco_algorithm = -1;
  229. static int hf_isakmp_tf_attr_addr_preservation = -1;
  230. static int hf_isakmp_tf_attr_sa_direction = -1;
  231. static int hf_isakmp_ike_attr = -1;
  232. static int hf_isakmp_ike_attr_type = -1;
  233. static int hf_isakmp_ike_attr_format = -1;
  234. static int hf_isakmp_ike_attr_length = -1;
  235. static int hf_isakmp_ike_attr_value = -1;
  236. static int hf_isakmp_ike_attr_encryption_algorithm = -1;
  237. static int hf_isakmp_ike_attr_hash_algorithm = -1;
  238. static int hf_isakmp_ike_attr_authentication_method = -1;
  239. static int hf_isakmp_ike_attr_group_description = -1;
  240. static int hf_isakmp_ike_attr_group_type = -1;
  241. static int hf_isakmp_ike_attr_group_prime = -1;
  242. static int hf_isakmp_ike_attr_group_generator_one = -1;
  243. static int hf_isakmp_ike_attr_group_generator_two = -1;
  244. static int hf_isakmp_ike_attr_group_curve_a = -1;
  245. static int hf_isakmp_ike_attr_group_curve_b = -1;
  246. static int hf_isakmp_ike_attr_life_type = -1;
  247. static int hf_isakmp_ike_attr_life_duration_uint32 = -1;
  248. static int hf_isakmp_ike_attr_life_duration_uint64 = -1;
  249. static int hf_isakmp_ike_attr_life_duration_bytes = -1;
  250. static int hf_isakmp_ike_attr_prf = -1;
  251. static int hf_isakmp_ike_attr_key_length = -1;
  252. static int hf_isakmp_ike_attr_field_size = -1;
  253. static int hf_isakmp_ike_attr_group_order = -1;
  254. static int hf_isakmp_trans_type = -1;
  255. static int hf_isakmp_trans_encr = -1;
  256. static int hf_isakmp_trans_prf = -1;
  257. static int hf_isakmp_trans_integ = -1;
  258. static int hf_isakmp_trans_dh = -1;
  259. static int hf_isakmp_trans_esn = -1;
  260. static int hf_isakmp_trans_id_v2 = -1;
  261. static int hf_isakmp_ike2_attr = -1;
  262. static int hf_isakmp_ike2_attr_type = -1;
  263. static int hf_isakmp_ike2_attr_format = -1;
  264. static int hf_isakmp_ike2_attr_length = -1;
  265. static int hf_isakmp_ike2_attr_value = -1;
  266. static int hf_isakmp_ike2_attr_key_length = -1;
  267. static int hf_isakmp_fragments = -1;
  268. static int hf_isakmp_fragment = -1;
  269. static int hf_isakmp_fragment_overlap = -1;
  270. static int hf_isakmp_fragment_overlap_conflicts = -1;
  271. static int hf_isakmp_fragment_multiple_tails = -1;
  272. static int hf_isakmp_fragment_too_long_fragment = -1;
  273. static int hf_isakmp_fragment_error = -1;
  274. static int hf_isakmp_fragment_count = -1;
  275. static int hf_isakmp_reassembled_in = -1;
  276. static int hf_isakmp_reassembled_length = -1;
  277. static int hf_isakmp_cisco_frag_packetid = -1;
  278. static int hf_isakmp_cisco_frag_seq = -1;
  279. static int hf_isakmp_cisco_frag_last = -1;
  280. static int hf_isakmp_key_exch_dh_group = -1;
  281. static int hf_isakmp_key_exch_data = -1;
  282. static int hf_isakmp_eap_data = -1;
  283. static int hf_isakmp_gspm_data = -1;
  284. static int hf_isakmp_cfg_type_v1 = -1;
  285. static int hf_isakmp_cfg_identifier = -1;
  286. static int hf_isakmp_cfg_type_v2 = -1;
  287. static int hf_isakmp_cfg_attr = -1;
  288. static int hf_isakmp_cfg_attr_type_v1 = -1;
  289. static int hf_isakmp_cfg_attr_type_v2 = -1;
  290. static int hf_isakmp_cfg_attr_format = -1;
  291. static int hf_isakmp_cfg_attr_length = -1;
  292. static int hf_isakmp_cfg_attr_value = -1;
  293. static int hf_isakmp_cfg_attr_internal_ip4_address = -1;
  294. static int hf_isakmp_cfg_attr_internal_ip4_netmask = -1;
  295. static int hf_isakmp_cfg_attr_internal_ip4_dns = -1;
  296. static int hf_isakmp_cfg_attr_internal_ip4_nbns = -1;
  297. static int hf_isakmp_cfg_attr_internal_address_expiry = -1;
  298. static int hf_isakmp_cfg_attr_internal_ip4_dhcp = -1;
  299. static int hf_isakmp_cfg_attr_application_version = -1;
  300. static int hf_isakmp_cfg_attr_internal_ip6_address = -1;
  301. static int hf_isakmp_cfg_attr_internal_ip6_netmask = -1;
  302. static int hf_isakmp_cfg_attr_internal_ip6_dns = -1;
  303. static int hf_isakmp_cfg_attr_internal_ip6_nbns = -1;
  304. static int hf_isakmp_cfg_attr_internal_ip6_dhcp = -1;
  305. static int hf_isakmp_cfg_attr_internal_ip4_subnet_ip = -1;
  306. static int hf_isakmp_cfg_attr_internal_ip4_subnet_netmask = -1;
  307. static int hf_isakmp_cfg_attr_supported_attributes = -1;
  308. static int hf_isakmp_cfg_attr_internal_ip6_subnet_ip = -1;
  309. static int hf_isakmp_cfg_attr_internal_ip6_subnet_prefix = -1;
  310. static int hf_isakmp_cfg_attr_internal_ip6_link_interface = -1;
  311. static int hf_isakmp_cfg_attr_internal_ip6_link_id = -1;
  312. static int hf_isakmp_cfg_attr_internal_ip6_prefix_ip = -1;
  313. static int hf_isakmp_cfg_attr_internal_ip6_prefix_length = -1;
  314. static int hf_isakmp_cfg_attr_xauth_type = -1;
  315. static int hf_isakmp_cfg_attr_xauth_user_name = -1;
  316. static int hf_isakmp_cfg_attr_xauth_user_password = -1;
  317. static int hf_isakmp_cfg_attr_xauth_passcode = -1;
  318. static int hf_isakmp_cfg_attr_xauth_message = -1;
  319. static int hf_isakmp_cfg_attr_xauth_challenge = -1;
  320. static int hf_isakmp_cfg_attr_xauth_domain = -1;
  321. static int hf_isakmp_cfg_attr_xauth_status = -1;
  322. static int hf_isakmp_cfg_attr_xauth_next_pin = -1;
  323. static int hf_isakmp_cfg_attr_xauth_answer = -1;
  324. static int hf_isakmp_cfg_attr_unity_banner = -1;
  325. static int hf_isakmp_cfg_attr_unity_def_domain = -1;
  326. static int hf_isakmp_enc_decrypted_data = -1;
  327. static int hf_isakmp_enc_contained_data = -1;
  328. static int hf_isakmp_enc_pad_length= -1;
  329. static int hf_isakmp_enc_padding = -1;
  330. static int hf_isakmp_enc_data = -1;
  331. static int hf_isakmp_enc_iv = -1;
  332. static int hf_isakmp_enc_icd = -1;
  333. static gint ett_isakmp = -1;
  334. static gint ett_isakmp_version = -1;
  335. static gint ett_isakmp_flags = -1;
  336. static gint ett_isakmp_payload = -1;
  337. static gint ett_isakmp_fragment = -1;
  338. static gint ett_isakmp_fragments = -1;
  339. static gint ett_isakmp_sa = -1;
  340. static gint ett_isakmp_tf_attr = -1;
  341. static gint ett_isakmp_tf_ike_attr = -1;
  342. static gint ett_isakmp_tf_ike2_attr = -1;
  343. static gint ett_isakmp_id = -1;
  344. static gint ett_isakmp_cfg_attr = -1;
  345. static gint ett_isakmp_rohc_attr = -1;
  346. #ifdef HAVE_LIBGCRYPT
  347. /* For decrypted IKEv2 Encrypted payload*/
  348. static gint ett_isakmp_decrypted_data = -1;
  349. static gint ett_isakmp_decrypted_payloads = -1;
  350. #endif /* HAVE_LIBGCRYPT */
  351. static expert_field ei_isakmp_enc_iv = EI_INIT;
  352. static expert_field ei_isakmp_ikev2_integrity_checksum = EI_INIT;
  353. static expert_field ei_isakmp_enc_data_length_mult_block_size = EI_INIT;
  354. static expert_field ei_isakmp_enc_pad_length_big = EI_INIT;
  355. static dissector_handle_t eap_handle = NULL;
  356. static reassembly_table isakmp_reassembly_table;
  357. static const fragment_items isakmp_frag_items = {
  358. /* Fragment subtrees */
  359. &ett_isakmp_fragment,
  360. &ett_isakmp_fragments,
  361. /* Fragment fields */
  362. &hf_isakmp_fragments,
  363. &hf_isakmp_fragment,
  364. &hf_isakmp_fragment_overlap,
  365. &hf_isakmp_fragment_overlap_conflicts,
  366. &hf_isakmp_fragment_multiple_tails,
  367. &hf_isakmp_fragment_too_long_fragment,
  368. &hf_isakmp_fragment_error,
  369. &hf_isakmp_fragment_count,
  370. /* Reassembled in field */
  371. &hf_isakmp_reassembled_in,
  372. /* Reassembled length field */
  373. &hf_isakmp_reassembled_length,
  374. /* Reassembled data field */
  375. NULL,
  376. /* Tag */
  377. "Message fragments"
  378. };
  379. /* IKE port number assigned by IANA */
  380. #define UDP_PORT_ISAKMP 500
  381. #define TCP_PORT_ISAKMP 500
  382. /*
  383. * Identifier Type
  384. * RFC2407 for IKEv1
  385. * RFC3554 for ID_LIST
  386. * RFC4306 for IKEv2
  387. * RFC4595 for ID_FC_NAME
  388. */
  389. #define IKE_ID_IPV4_ADDR 1
  390. #define IKE_ID_FQDN 2
  391. #define IKE_ID_USER_FQDN 3
  392. #define IKE_ID_IPV4_ADDR_SUBNET 4
  393. #define IKE_ID_IPV6_ADDR 5
  394. #define IKE_ID_IPV6_ADDR_SUBNET 6
  395. #define IKE_ID_IPV4_ADDR_RANGE 7
  396. #define IKE_ID_IPV6_ADDR_RANGE 8
  397. #define IKE_ID_DER_ASN1_DN 9
  398. #define IKE_ID_DER_ASN1_GN 10
  399. #define IKE_ID_KEY_ID 11
  400. #define IKE_ID_LIST 12
  401. #define IKE_ID_FC_NAME 12
  402. #define IKE_ID_RFC822_ADDR 3
  403. /*
  404. * Traffic Selector Type
  405. * Not in use for IKEv1
  406. */
  407. #define IKEV2_TS_IPV4_ADDR_RANGE 7
  408. #define IKEV2_TS_IPV6_ADDR_RANGE 8
  409. #define IKEV2_TS_FC_ADDR_RANGE 9
  410. /*
  411. * Configuration Payload Attribute Types
  412. * draft-ietf-ipsec-isakmp-mode-cfg-05.txt for IKEv1
  413. * draft-ietf-ipsec-isakmp-xauth-06.txt and draft-beaulieu-ike-xauth-02.txt for XAUTH
  414. * RFC4306 for IKEv2
  415. * RFC5739 for INTERNAL_IP6_LINK and INTERNAL_IP6_PREFIX
  416. */
  417. #define INTERNAL_IP4_ADDRESS 1
  418. #define INTERNAL_IP4_NETMASK 2
  419. #define INTERNAL_IP4_DNS 3
  420. #define INTERNAL_IP4_NBNS 4
  421. #define INTERNAL_ADDRESS_EXPIRY 5
  422. #define INTERNAL_IP4_DHCP 6
  423. #define APPLICATION_VERSION 7
  424. #define INTERNAL_IP6_ADDRESS 8
  425. #define INTERNAL_IP6_NETMASK 9
  426. #define INTERNAL_IP6_DNS 10
  427. #define INTERNAL_IP6_NBNS 11
  428. #define INTERNAL_IP6_DHCP 12
  429. #define INTERNAL_IP4_SUBNET 13
  430. #define SUPPORTED_ATTRIBUTES 14
  431. #define INTERNAL_IP6_SUBNET 15
  432. #define MIP6_HOME_PREFIX 16
  433. #define INTERNAL_IP6_LINK 17
  434. #define INTERNAL_IP6_PREFIX 18
  435. /* checkpoint configuration attributes */
  436. #define CHKPT_DEF_DOMAIN 16387
  437. #define CHKPT_MAC_ADDRESS 16388
  438. #define CHKPT_MARCIPAN_REASON_CODE 16389
  439. #define CHKPT_UNKNOWN1 16400
  440. #define CHKPT_UNKNOWN2 16401
  441. #define CHKPT_UNKNOWN3 16402
  442. /* XAUTH configuration attributes */
  443. #define XAUTH_TYPE 16520
  444. #define XAUTH_USER_NAME 16521
  445. #define XAUTH_USER_PASSWORD 16522
  446. #define XAUTH_PASSCODE 16523
  447. #define XAUTH_MESSAGE 16524
  448. #define XAUTH_CHALLENGE 16525
  449. #define XAUTH_DOMAIN 16526
  450. #define XAUTH_STATUS 16527
  451. #define XAUTH_NEXT_PIN 16528
  452. #define XAUTH_ANSWER 16529
  453. /* unity (CISCO) configuration attributes */
  454. #define UNITY_BANNER 28672
  455. #define UNITY_SAVE_PASSWD 28673
  456. #define UNITY_DEF_DOMAIN 28674
  457. #define UNITY_SPLIT_DOMAIN 28675
  458. #define UNITY_SPLIT_INCLUDE 28676
  459. #define UNITY_NATT_PORT 28677
  460. #define UNITY_SPLIT_EXCLUDE 28678
  461. #define UNITY_PFS 28679
  462. #define UNITY_FW_TYPE 28680
  463. #define UNITY_BACKUP_SERVERS 28681
  464. #define UNITY_DDNS_HOSTNAME 28682
  465. /* Payload Type
  466. * RFC2408 / RFC3547 for IKEv1
  467. * RFC4306 for IKEv2
  468. */
  469. #define PLOAD_IKE_NONE 0
  470. #define PLOAD_IKE_SA 1
  471. #define PLOAD_IKE_P 2
  472. #define PLOAD_IKE_T 3
  473. #define PLOAD_IKE_KE 4
  474. #define PLOAD_IKE_ID 5
  475. #define PLOAD_IKE_CERT 6
  476. #define PLOAD_IKE_CR 7
  477. #define PLOAD_IKE_HASH 8
  478. #define PLOAD_IKE_SIG 9
  479. #define PLOAD_IKE_NONCE 10
  480. #define PLOAD_IKE_N 11
  481. #define PLOAD_IKE_D 12
  482. #define PLOAD_IKE_VID 13
  483. #define PLOAD_IKE_A 14
  484. #define PLOAD_IKE_NAT_D48 15
  485. #define PLOAD_IKE_NAT_OA58 16
  486. #define PLOAD_IKE_NAT_D 20
  487. #define PLOAD_IKE_NAT_OA 21
  488. #define PLOAD_IKE_GAP 22
  489. #define PLOAD_IKE2_SA 33
  490. #define PLOAD_IKE2_KE 34
  491. #define PLOAD_IKE2_IDI 35
  492. #define PLOAD_IKE2_IDR 36
  493. #define PLOAD_IKE2_CERT 37
  494. #define PLOAD_IKE2_CERTREQ 38
  495. #define PLOAD_IKE2_AUTH 39
  496. #define PLOAD_IKE2_NONCE 40
  497. #define PLOAD_IKE2_N 41
  498. #define PLOAD_IKE2_D 42
  499. #define PLOAD_IKE2_V 43
  500. #define PLOAD_IKE2_TSI 44
  501. #define PLOAD_IKE2_TSR 45
  502. #define PLOAD_IKE2_SK 46
  503. #define PLOAD_IKE2_CP 47
  504. #define PLOAD_IKE2_EAP 48
  505. #define PLOAD_IKE2_GSPM 49
  506. #define PLOAD_IKE_NAT_D13 130
  507. #define PLOAD_IKE_NAT_OA14 131
  508. #define PLOAD_IKE_CISCO_FRAG 132
  509. /*
  510. * IPSEC Situation Definition (RFC2407)
  511. */
  512. #define SIT_IDENTITY_ONLY 0x01
  513. #define SIT_SECRECY 0x02
  514. #define SIT_INTEGRITY 0x04
  515. static const value_string exchange_v1_type[] = {
  516. { 0, "NONE" },
  517. { 1, "Base" },
  518. { 2, "Identity Protection (Main Mode)" },
  519. { 3, "Authentication Only" },
  520. { 4, "Aggressive" },
  521. { 5, "Informational" },
  522. { 6, "Transaction (Config Mode)" },
  523. { 32, "Quick Mode" },
  524. { 33, "New Group Mode" },
  525. { 0, NULL },
  526. };
  527. static const value_string exchange_v2_type[] = {
  528. { 34, "IKE_SA_INIT" },
  529. { 35, "IKE_AUTH " },
  530. { 36, "CREATE_CHILD_SA" },
  531. { 37, "INFORMATIONAL" },
  532. { 38, "IKE_SESSION_RESUME" }, /* RFC5723 */
  533. { 0, NULL },
  534. };
  535. static const value_string frag_last_vals[] = {
  536. { 0, "More fragments" },
  537. { 1, "Last fragment" },
  538. { 0, NULL },
  539. };
  540. /* Ex vs_proto */
  541. static const value_string protoid_v1_type[] = {
  542. { 0, "RESERVED" },
  543. { 1, "ISAKMP" },
  544. { 2, "IPSEC_AH" },
  545. { 3, "IPSEC_ESP" },
  546. { 4, "IPCOMP" },
  547. { 5, "GIGABEAM_RADIO" }, /* RFC4705 */
  548. { 0, NULL },
  549. };
  550. static const value_string protoid_v2_type[] = {
  551. { 0, "RESERVED" },
  552. { 1, "IKE" },
  553. { 2, "AH" },
  554. { 3, "ESP" },
  555. { 4, "FC_ESP_HEADER" },
  556. { 5, "FC_CT_AUTHENTICATION" },
  557. { 0, NULL },
  558. };
  559. static const range_string payload_type[] = {
  560. { PLOAD_IKE_NONE,PLOAD_IKE_NONE, "NONE / No Next Payload " },
  561. { PLOAD_IKE_SA,PLOAD_IKE_SA, "Security Association" },
  562. { PLOAD_IKE_P,PLOAD_IKE_P, "Proposal" },
  563. { PLOAD_IKE_T,PLOAD_IKE_T, "Transform" },
  564. { PLOAD_IKE_KE,PLOAD_IKE_KE, "Key Exchange" },
  565. { PLOAD_IKE_ID,PLOAD_IKE_ID, "Identification" },
  566. { PLOAD_IKE_CERT,PLOAD_IKE_CERT, "Certificate" },
  567. { PLOAD_IKE_CR,PLOAD_IKE_CR, "Certificate Request" },
  568. { PLOAD_IKE_HASH,PLOAD_IKE_HASH, "Hash" },
  569. { PLOAD_IKE_SIG,PLOAD_IKE_SIG, "Signature" },
  570. { PLOAD_IKE_NONCE,PLOAD_IKE_NONCE, "Nonce" },
  571. { PLOAD_IKE_N,PLOAD_IKE_N, "Notification" },
  572. { PLOAD_IKE_D,PLOAD_IKE_D, "Delete" },
  573. { PLOAD_IKE_VID,PLOAD_IKE_VID, "Vendor ID" },
  574. { PLOAD_IKE_A,PLOAD_IKE_A, "Attributes" }, /* draft-ietf-ipsec-isakmp-mode-cfg-05.txt */
  575. { PLOAD_IKE_NAT_D48,PLOAD_IKE_NAT_D48, "NAT-Discovery" }, /* draft-ietf-ipsec-nat-t-ike-04 to 08 */
  576. { PLOAD_IKE_NAT_OA58,PLOAD_IKE_NAT_OA58, "NAT-Original Address"}, /* draft-ietf-ipsec-nat-t-ike-05 to 08*/
  577. { PLOAD_IKE_NAT_D,PLOAD_IKE_NAT_D, "NAT-D (RFC 3947)" },
  578. { PLOAD_IKE_NAT_OA,PLOAD_IKE_NAT_OA, "NAT-OA (RFC 3947)"},
  579. { PLOAD_IKE_GAP,PLOAD_IKE_GAP, "Group Associated Policy"},
  580. { PLOAD_IKE2_SA,PLOAD_IKE2_SA, "Security Association"},
  581. { PLOAD_IKE2_KE,PLOAD_IKE2_KE, "Key Exchange"},
  582. { PLOAD_IKE2_IDI,PLOAD_IKE2_IDI, "Identification - Initiator"},
  583. { PLOAD_IKE2_IDR,PLOAD_IKE2_IDR, "Identification - Responder"},
  584. { PLOAD_IKE2_CERT,PLOAD_IKE2_CERT, "Certificate"},
  585. { PLOAD_IKE2_CERTREQ,PLOAD_IKE2_CERTREQ, "Certificate Request"},
  586. { PLOAD_IKE2_AUTH,PLOAD_IKE2_AUTH, "Authentication"},
  587. { PLOAD_IKE2_NONCE,PLOAD_IKE2_NONCE, "Nonce"},
  588. { PLOAD_IKE2_N,PLOAD_IKE2_N, "Notify"},
  589. { PLOAD_IKE2_D,PLOAD_IKE2_D, "Delete"},
  590. { PLOAD_IKE2_V,PLOAD_IKE2_V, "Vendor ID"},
  591. { PLOAD_IKE2_TSI,PLOAD_IKE2_TSI, "Traffic Selector - Initiator"},
  592. { PLOAD_IKE2_TSR,PLOAD_IKE2_TSR, "Traffic Selector - Responder"},
  593. { PLOAD_IKE2_SK,PLOAD_IKE2_SK, "Encrypted and Authenticated"},
  594. { PLOAD_IKE2_CP,PLOAD_IKE2_CP, "Configuration"},
  595. { PLOAD_IKE2_EAP,PLOAD_IKE2_EAP, "Extensible Authentication"},
  596. { PLOAD_IKE2_GSPM,PLOAD_IKE2_GSPM, "Generic Secure Password Method"},
  597. { 50,127, "Unassigned" },
  598. { 128,129, "Private Use" },
  599. { PLOAD_IKE_NAT_D13,PLOAD_IKE_NAT_D13, "NAT-D (draft-ietf-ipsec-nat-t-ike-01 to 03)"},
  600. { PLOAD_IKE_NAT_OA14,PLOAD_IKE_NAT_OA14, "NAT-OA (draft-ietf-ipsec-nat-t-ike-01 to 03)"},
  601. { PLOAD_IKE_CISCO_FRAG,PLOAD_IKE_CISCO_FRAG, "Cisco-Fragmentation"},
  602. { 133,256, "Private Use" },
  603. { 0,0, NULL },
  604. };
  605. /*
  606. * ISAKMP Domain of Interpretation (DOI)
  607. * RFC2408 for ISAKMP
  608. * RFC2407 for IPSEC
  609. * RFC3547 for GDOI
  610. */
  611. static const value_string doi_type[] = {
  612. { 0, "ISAKMP" },
  613. { 1, "IPSEC" },
  614. { 2, "GDOI" },
  615. { 0, NULL },
  616. };
  617. /* Transform Type */
  618. #define ISAKMP_ATTR_LIFE_TYPE 1
  619. #define ISAKMP_ATTR_LIFE_DURATION 2
  620. #define ISAKMP_ATTR_GROUP_DESC 3
  621. #define ISAKMP_ATTR_ENCAP_MODE 4
  622. #define ISAKMP_ATTR_AUTH_ALGORITHM 5
  623. #define ISAKMP_ATTR_KEY_LENGTH 6
  624. #define ISAKMP_ATTR_KEY_ROUNDS 7
  625. #define ISAKMP_ATTR_CMPR_DICT_SIZE 8
  626. #define ISAKMP_ATTR_CMPR_ALGORITHM 9
  627. #define ISAKMP_ATTR_ECN_TUNNEL 10 /* [RFC3168] */
  628. #define ISAKMP_ATTR_EXT_SEQ_NBR 11 /* [RFC4304] */
  629. #define ISAKMP_ATTR_AUTH_KEY_LENGTH 12 /* [RFC4359] */
  630. #define ISAKMP_ATTR_SIG_ENCO_ALGORITHM 13 /* [RFC4359] */
  631. #define ISAKMP_ATTR_ADDR_PRESERVATION 14 /* [RFC6407] */
  632. #define ISAKMP_ATTR_SA_DIRECTION 15 /* [RFC6407] */
  633. static const value_string transform_isakmp_attr_type[] = {
  634. { ISAKMP_ATTR_LIFE_TYPE, "SA-Life-Type" },
  635. { ISAKMP_ATTR_LIFE_DURATION, "SA-Life-Duration" },
  636. { ISAKMP_ATTR_GROUP_DESC, "Group-Description" },
  637. { ISAKMP_ATTR_ENCAP_MODE, "Encapsulation-Mode" },
  638. { ISAKMP_ATTR_AUTH_ALGORITHM, "Authentication-Algorithm" },
  639. { ISAKMP_ATTR_KEY_LENGTH, "Key-Length" },
  640. { ISAKMP_ATTR_KEY_ROUNDS, "Key-Rounds" },
  641. { ISAKMP_ATTR_CMPR_DICT_SIZE, "Compress-Dictionary-Size" },
  642. { ISAKMP_ATTR_CMPR_ALGORITHM, "Compress-Private-Algorithm" },
  643. { ISAKMP_ATTR_ECN_TUNNEL, "ECN Tunnel" },
  644. { ISAKMP_ATTR_EXT_SEQ_NBR, "Extended (64-bit) Sequence Number" },
  645. { ISAKMP_ATTR_AUTH_KEY_LENGTH, "Authentication Key Length" },
  646. { ISAKMP_ATTR_SIG_ENCO_ALGORITHM, "Signature Encoding Algorithm" },
  647. { ISAKMP_ATTR_ADDR_PRESERVATION, "Address Preservation" },
  648. { ISAKMP_ATTR_SA_DIRECTION, "SA Direction" },
  649. { 0, NULL },
  650. };
  651. /* Transform IKE Type */
  652. #define IKE_ATTR_ENCRYPTION_ALGORITHM 1
  653. #define IKE_ATTR_HASH_ALGORITHM 2
  654. #define IKE_ATTR_AUTHENTICATION_METHOD 3
  655. #define IKE_ATTR_GROUP_DESCRIPTION 4
  656. #define IKE_ATTR_GROUP_TYPE 5
  657. #define IKE_ATTR_GROUP_PRIME 6
  658. #define IKE_ATTR_GROUP_GENERATOR_ONE 7
  659. #define IKE_ATTR_GROUP_GENERATOR_TWO 8
  660. #define IKE_ATTR_GROUP_CURVE_A 9
  661. #define IKE_ATTR_GROUP_CURVE_B 10
  662. #define IKE_ATTR_LIFE_TYPE 11
  663. #define IKE_ATTR_LIFE_DURATION 12
  664. #define IKE_ATTR_PRF 13
  665. #define IKE_ATTR_KEY_LENGTH 14
  666. #define IKE_ATTR_FIELD_SIZE 15
  667. #define IKE_ATTR_GROUP_ORDER 16
  668. static const value_string transform_ike_attr_type[] = {
  669. { IKE_ATTR_ENCRYPTION_ALGORITHM,"Encryption-Algorithm" },
  670. { IKE_ATTR_HASH_ALGORITHM, "Hash-Algorithm" },
  671. { IKE_ATTR_AUTHENTICATION_METHOD,"Authentication-Method" },
  672. { IKE_ATTR_GROUP_DESCRIPTION, "Group-Description" },
  673. { IKE_ATTR_GROUP_TYPE, "Group-Type" },
  674. { IKE_ATTR_GROUP_PRIME, "Group-Prime" },
  675. { IKE_ATTR_GROUP_GENERATOR_ONE,"Group-Generator-One" },
  676. { IKE_ATTR_GROUP_GENERATOR_TWO,"Group-Generator-Two" },
  677. { IKE_ATTR_GROUP_CURVE_A, "Group-Curve-A" },
  678. { IKE_ATTR_GROUP_CURVE_B, "Group-Curve-B" },
  679. { IKE_ATTR_LIFE_TYPE, "Life-Type" },
  680. { IKE_ATTR_LIFE_DURATION, "Life-Duration" },
  681. { IKE_ATTR_PRF, "PRF" },
  682. { IKE_ATTR_KEY_LENGTH, "Key-Length" },
  683. { IKE_ATTR_FIELD_SIZE, "Field-Size" },
  684. { IKE_ATTR_GROUP_ORDER, "Group-Order" },
  685. { 0, NULL },
  686. };
  687. static const value_string vs_v2_sttr[] = {
  688. { 1, "SA-Life-Type" },
  689. { 2, "SA-Life-Duration" },
  690. { 3, "Group-Description" },
  691. { 4, "Encapsulation-Mode" },
  692. { 5, "Authentication-Algorithm" },
  693. { 6, "Key-Length" },
  694. { 7, "Key-Rounds" },
  695. { 8, "Compress-Dictionary-Size" },
  696. { 9, "Compress-Private-Algorithm" },
  697. { 10, "ECN Tunnel" },
  698. { 0, NULL },
  699. };
  700. static const value_string vs_v1_trans_isakmp[] = {
  701. { 0, "RESERVED" },
  702. { 1, "KEY_IKE" },
  703. { 0, NULL },
  704. };
  705. static const value_string vs_v1_trans_ah[] = {
  706. { 0, "RESERVED" },
  707. { 1, "RESERVED" },
  708. { 2, "MD5" },
  709. { 3, "SHA" },
  710. { 4, "DES" },
  711. { 5, "SHA2-256" },
  712. { 6, "SHA2-384" },
  713. { 7, "SHA2-512" },
  714. { 0, NULL },
  715. };
  716. static const value_string vs_v1_trans_esp[] = {
  717. { 0, "RESERVED" },
  718. { 1, "DES-IV64" },
  719. { 2, "DES" },
  720. { 3, "3DES" },
  721. { 4, "RC5" },
  722. { 5, "IDEA" },
  723. { 6, "CAST" },
  724. { 7, "BLOWFISH" },
  725. { 8, "3IDEA" },
  726. { 9, "DES-IV32" },
  727. { 10, "RC4" },
  728. { 11, "NULL" },
  729. { 12, "AES" },
  730. { 0, NULL },
  731. };
  732. static const value_string transform_id_ipcomp[] = {
  733. { 0, "RESERVED" },
  734. { 1, "OUI" },
  735. { 2, "DEFLATE" },
  736. { 3, "LZS" },
  737. { 4, "LZJH" },
  738. { 0, NULL },
  739. };
  740. static const value_string redirect_gateway_identity_type[] = {
  741. { 1, "IPv4 address" },
  742. { 2, "IPv6 address" },
  743. { 3, "FQDN" },
  744. { 0, NULL },
  745. };
  746. static const value_string transform_attr_sa_life_type[] = {
  747. { 0, "RESERVED" },
  748. { 1, "Seconds" },
  749. { 2, "Kilobytes" },
  750. { 0, NULL },
  751. };
  752. static const value_string transform_attr_encap_type[] = {
  753. { 0, "RESERVED" },
  754. { 1, "Tunnel" },
  755. { 2, "Transport" },
  756. { 3, "UDP-Encapsulated-Tunnel" }, /* RFC3947 */
  757. { 4, "UDP-Encapsulated-Transport" }, /* RFC3947 */
  758. { 61440, "Check Point IPSec UDP Encapsulation" },
  759. { 61443, "UDP-Encapsulated-Tunnel (draft)" },
  760. { 61444, "UDP-Encapsulated-Transport (draft)" },
  761. { 0, NULL },
  762. };
  763. static const value_string transform_attr_auth_type[] = {
  764. { 0, "RESERVED" },
  765. { 1, "HMAC-MD5" },
  766. { 2, "HMAC-SHA" },
  767. { 3, "DES-MAC" },
  768. { 4, "KPDK" },
  769. { 5, "HMAC-SHA2-256" },
  770. { 6, "HMAC-SHA2-384" },
  771. { 7, "HMAC-SHA2-512" },
  772. { 8, "HMAC-RIPEMD" }, /* [RFC2857] */
  773. { 9, "AES-XCBC-MAC" }, /* [RFC3566] */
  774. { 10, "SIG-RSA" }, /* [RFC4359] */
  775. { 11, "AES-128-GMAC" }, /* [RFC4543][Errata1821] */
  776. { 12, "AES-192-GMAC" }, /* [RFC4543][Errata1821] */
  777. { 13, "AES-256-GMAC" }, /* [RFC4543][Errata1821] */
  778. /*
  779. Values 11-61439 are reserved to IANA. Values 61440-65535 are
  780. for private use.
  781. */
  782. { 0, NULL },
  783. };
  784. #define ENC_DES_CBC 1
  785. #define ENC_IDEA_CBC 2
  786. #define ENC_BLOWFISH_CBC 3
  787. #define ENC_RC5_R16_B64_CBC 4
  788. #define ENC_3DES_CBC 5
  789. #define ENC_CAST_CBC 6
  790. #define ENC_AES_CBC 7
  791. #define ENC_CAMELLIA_CBC 8
  792. static const value_string transform_attr_enc_type[] = {
  793. { 0, "RESERVED" },
  794. { ENC_DES_CBC, "DES-CBC" },
  795. { ENC_IDEA_CBC, "IDEA-CBC" },
  796. { ENC_BLOWFISH_CBC, "BLOWFISH-CBC" },
  797. { ENC_RC5_R16_B64_CBC, "RC5-R16-B64-CBC" },
  798. { ENC_3DES_CBC, "3DES-CBC" },
  799. { ENC_CAST_CBC, "CAST-CBC" },
  800. { ENC_AES_CBC, "AES-CBC" },
  801. { ENC_CAMELLIA_CBC, "CAMELLIA-CBC" },
  802. { 0, NULL },
  803. };
  804. #define HMAC_MD5 1
  805. #define HMAC_SHA 2
  806. #define HMAC_TIGER 3
  807. #define HMAC_SHA2_256 4
  808. #define HMAC_SHA2_384 5
  809. #define HMAC_SHA2_512 6
  810. static const value_string transform_attr_hash_type[] = {
  811. { 0, "RESERVED" },
  812. { HMAC_MD5, "MD5" },
  813. { HMAC_SHA, "SHA" },
  814. { HMAC_TIGER, "TIGER" },
  815. { HMAC_SHA2_256, "SHA2-256" },
  816. { HMAC_SHA2_384, "SHA2-384" },
  817. { HMAC_SHA2_512, "SHA2-512" },
  818. { 0, NULL },
  819. };
  820. static const value_string transform_attr_ecn_type[] = {
  821. { 0, "RESERVED" },
  822. { 1, "Allowed" },
  823. { 2, "Forbidden" },
  824. { 0, NULL },
  825. };
  826. static const value_string transform_attr_ext_seq_nbr_type[] = {
  827. { 0, "RESERVED" },
  828. { 1, "64-bit Sequence Number" },
  829. { 0, NULL },
  830. };
  831. static const value_string transform_attr_sig_enco_algo_type[] = {
  832. { 0, "RESERVED" },
  833. { 1, "RSASSA-PKCS1-v1_5" },
  834. { 2, "RSASSA-PSS" },
  835. { 0, NULL },
  836. };
  837. static const value_string transform_attr_addr_preservation_type[] = {
  838. { 0, "Reserved" },
  839. { 1, "None" },
  840. { 2, "Source-Only" },
  841. { 3, "Destination-Only" },
  842. { 4, "Source-and-Destination" },
  843. { 0, NULL },
  844. };
  845. static const value_string transform_attr_sa_direction_type[] = {
  846. { 0, "Reserved" },
  847. { 1, "Sender-Only" },
  848. { 2, "Receiver-Only" },
  849. { 3, "Symmetric" },
  850. { 0, NULL },
  851. };
  852. static const value_string transform_attr_authmeth_type[] = {
  853. { 0, "RESERVED" },
  854. { 1, "PSK" },
  855. { 2, "DSS-SIG" },
  856. { 3, "RSA-SIG" },
  857. { 4, "RSA-ENC" },
  858. { 5, "RSA-Revised-ENC" },
  859. { 6, "Encryption with El-Gamal" },
  860. { 7, "Revised encryption with El-Gamal" },
  861. { 8, "ECDSA signatures" },
  862. { 9, "AES-XCBC-MAC" },
  863. { 64221, "HybridInitRSA" },
  864. { 64222, "HybridRespRSA" },
  865. { 64223, "HybridInitDSS" },
  866. { 64224, "HybridRespDSS" },
  867. { 65001, "XAUTHInitPreShared" },
  868. { 65002, "XAUTHRespPreShared" },
  869. { 65003, "XAUTHInitDSS" },
  870. { 65004, "XAUTHRespDSS" },
  871. { 65005, "XAUTHInitRSA" },
  872. { 65006, "XAUTHRespRSA" },
  873. { 65007, "XAUTHInitRSAEncryption" },
  874. { 65008, "XAUTHRespRSAEncryption" },
  875. { 65009, "XAUTHInitRSARevisedEncryption" },
  876. { 65010, "XAUTHRespRSARevisedEncryption" },
  877. { 0, NULL },
  878. };
  879. static const value_string transform_dh_group_type[] = {
  880. { 0, "UNDEFINED - 0" },
  881. { 1, "Default 768-bit MODP group" },
  882. { 2, "Alternate 1024-bit MODP group" },
  883. { 3, "EC2N group on GP[2^155] group" },
  884. { 4, "EC2N group on GP[2^185] group" },
  885. { 5, "1536 bit MODP group" },
  886. { 6, "EC2N group over GF[2^163]" },
  887. { 7, "EC2N group over GF[2^163]" },
  888. { 8, "EC2N group over GF[2^283]" },
  889. { 9, "EC2N group over GF[2^283]" },
  890. { 10, "EC2N group over GF[2^409]" },
  891. { 11, "EC2N group over GF[2^409]" },
  892. { 12, "EC2N group over GF[2^571]" },
  893. { 13, "EC2N group over GF[2^571]" },
  894. { 14, "2048 bit MODP group" },
  895. { 15, "3072 bit MODP group" },
  896. { 16, "4096 bit MODP group" },
  897. { 17, "6144 bit MODP group" },
  898. { 18, "8192 bit MODP group" },
  899. { 19, "256-bit random ECP group" },
  900. { 20, "384-bit random ECP group" },
  901. { 21, "521-bit random ECP group" },
  902. { 22, "1024-bit MODP Group with 160-bit Prime Order Subgroup" },
  903. { 23, "2048-bit MODP Group with 224-bit Prime Order Subgroup" },
  904. { 24, "2048-bit MODP Group with 256-bit Prime Order Subgroup" },
  905. { 25, "192-bit Random ECP Group" },
  906. { 26, "224-bit Random ECP Group" },
  907. { 0, NULL }
  908. };
  909. static const value_string transform_attr_grp_type[] = {
  910. { 0, "UNDEFINED - 0" },
  911. { 1, "MODP" },
  912. { 2, "ECP" },
  913. { 3, "EC2N" },
  914. { 0, NULL },
  915. };
  916. #define TF_IKE2_ENCR 1
  917. #define TF_IKE2_PRF 2
  918. #define TF_IKE2_INTEG 3
  919. #define TF_IKE2_DH 4
  920. #define TF_IKE2_ESN 5
  921. static const range_string transform_ike2_type[] = {
  922. { 0,0, "RESERVED" },
  923. { TF_IKE2_ENCR,TF_IKE2_ENCR, "Encryption Algorithm (ENCR)" },
  924. { TF_IKE2_PRF,TF_IKE2_PRF, "Pseudo-random Function (PRF)"},
  925. { TF_IKE2_INTEG,TF_IKE2_INTEG,"Integrity Algorithm (INTEG)"},
  926. { TF_IKE2_DH,TF_IKE2_DH, "Diffie-Hellman Group (D-H)"},
  927. { TF_IKE2_ESN,TF_IKE2_ESN, "Extended Sequence Numbers (ESN)"},
  928. { 6,240, "Reserved to IANA"},
  929. { 241,255, "Private Use"},
  930. { 0,0, NULL },
  931. };
  932. /* For Transform Type 1 (Encryption Algorithm), defined Transform IDs */
  933. static const value_string transform_ike2_encr_type[] = {
  934. { 0, "RESERVED" },
  935. { 1, "ENCR_DES_IV64" },
  936. { 2, "ENCR_DES" },
  937. { 3, "ENCR_3DES" },
  938. { 4, "ENCR_RC5" },
  939. { 5, "ENCR_IDEA" },
  940. { 6, "ENCR_CAST" },
  941. { 7, "ENCR_BLOWFISH" },
  942. { 8, "ENCR_3IDEA" },
  943. { 9, "ENCR_DES_IV32" },
  944. { 10, "RESERVED" },
  945. { 11, "ENCR_NULL" },
  946. { 12, "ENCR_AES_CBC" },
  947. { 13, "ENCR_AES_CTR" }, /* [RFC3686] */
  948. { 14, "ENCR_AES-CCM_8" }, /* [RFC4309] */
  949. { 15, "ENCR-AES-CCM_12" }, /* [RFC4309] */
  950. { 16, "ENCR-AES-CCM_16" }, /* [RFC4309] */
  951. { 17, "UNASSIGNED" },
  952. { 18, "AES-GCM with a 8 octet ICV" }, /* [RFC4106] */
  953. { 19, "AES-GCM with a 12 octet ICV" }, /* [RFC4106] */
  954. { 20, "AES-GCM with a 16 octet ICV" }, /* [RFC4106] */
  955. { 21, "ENCR_NULL_AUTH_AES_GMAC" }, /* [RFC4543] */
  956. { 22, "Reserved for IEEE P1619 XTS-AES" }, /* [Ball] */
  957. { 23, "ENCR_CAMELLIA_CBC" }, /* [RFC5529] */
  958. { 24, "ENCR_CAMELLIA_CTR" }, /* [RFC5529] */
  959. { 25, "ENCR_CAMELLIA_CCM with an 8-octet ICV" }, /* [RFC5529] */
  960. { 26, "ENCR_CAMELLIA_CCM with a 12-octet ICV" }, /* [RFC5529] */
  961. { 27, "ENCR_CAMELLIA_CCM with a 16-octet ICV" }, /* [RFC5529] */
  962. /*
  963. * 28-1023 RESERVED TO IANA [RFC4306]
  964. * 1024-65535 PRIVATE USE [RFC4306]
  965. */
  966. { 0, NULL },
  967. };
  968. /* For Transform Type 2 (Pseudo-random Function), defined Transform IDs */
  969. static const value_string transform_ike2_prf_type[] = {
  970. { 0, "RESERVED" },
  971. { 1, "PRF_HMAC_MD5" },
  972. { 2, "PRF_HMAC_SHA1" },
  973. { 3, "PRF_HMAC_TIGER" },
  974. { 4, "PRF_AES128_CBC" },
  975. { 5, "PRF_HMAC_SHA2_256" }, /* [RFC4868] */
  976. { 6, "PRF_HMAC_SHA2_384" }, /* [RFC4868] */
  977. { 7, "PRF_HMAC_SHA2_512" }, /* [RFC4868] */
  978. { 8, "PRF_AES128_CMAC6" }, /* [RFC4615] */
  979. /*
  980. 9-1023 RESERVED TO IANA [RFC4306]
  981. 1024-65535 PRIVATE USE [RFC4306]
  982. */
  983. { 0, NULL },
  984. };
  985. /* For Transform Type 3 (Integrity Algorithm), defined Transform IDs */
  986. static const value_string transform_ike2_integ_type[] = {
  987. { 0, "NONE" },
  988. { 1, "AUTH_HMAC_MD5_96" },
  989. { 2, "AUTH_HMAC_SHA1_96" },
  990. { 3, "AUTH_DES_MAC" },
  991. { 4, "AUTH_KPDK_MD5" },
  992. { 5, "AUTH_AES_XCBC_96" },
  993. { 6, "AUTH_HMAC_MD5_128" }, /* [RFC4595] */
  994. { 7, "AUTH_HMAC_SHA1_160" }, /* [RFC4595] */
  995. { 8, "AUTH_AES_CMAC_96" }, /* [RFC4494] */
  996. { 9, "AUTH_AES_128_GMAC" }, /* [RFC4543] */
  997. { 10, "AUTH_AES_192_GMAC" }, /* [RFC4543] */
  998. { 11, "AUTH_AES_256_GMAC" }, /* [RFC4543] */
  999. { 12, "AUTH_HMAC_SHA2_256_128" }, /* [RFC4868] */
  1000. { 13, "AUTH_HMAC_SHA2_384_192" }, /* [RFC4868] */
  1001. { 14, "AUTH_HMAC_SHA2_512_256" }, /* [RFC4868] */
  1002. /*
  1003. 15-1023 RESERVED TO IANA [RFC4306]
  1004. 1024-65535 PRIVATE USE [RFC4306]
  1005. */
  1006. { 0, NULL },
  1007. };
  1008. /* For Transform Type 5 (Extended Sequence Numbers), defined Transform */
  1009. static const value_string transform_ike2_esn_type[] = {
  1010. { 0, "No Extended Sequence Numbers" },
  1011. { 1, "Extended Sequence Numbers" },
  1012. { 0, NULL },
  1013. };
  1014. /* Transform IKE2 Type */
  1015. #define IKE2_ATTR_KEY_LENGTH 14
  1016. static const value_string transform_ike2_attr_type[] = {
  1017. { IKE2_ATTR_KEY_LENGTH, "Key-Length" },
  1018. { 0, NULL },
  1019. };
  1020. static const range_string cert_v1_type[] = {
  1021. { 0,0, "NONE" },
  1022. { 1,1, "PKCS #7 wrapped X.509 certificate" },
  1023. { 2,2, "PGP Certificate" },
  1024. { 3,3, "DNS Signed Key" },
  1025. { 4,4, "X.509 Certificate - Signature" },
  1026. { 5,5, "X.509 Certificate - Key Exchange" },
  1027. { 6,6, "Kerberos Tokens" },
  1028. { 7,7, "Certificate Revocation List (CRL)" },
  1029. { 8,8, "Authority Revocation List (ARL)" },
  1030. { 9,9, "SPKI Certificate" },
  1031. { 10,10, "X.509 Certificate - Attribute" },
  1032. { 11,255, "RESERVED" },
  1033. { 0,0, NULL },
  1034. };
  1035. static const range_string cert_v2_type[] = {
  1036. { 0,0, "RESERVED" },
  1037. { 1,1, "PKCS #7 wrapped X.509 certificate" },
  1038. { 2,2, "PGP Certificate" },
  1039. { 3,3, "DNS Signed Key" },
  1040. { 4,4, "X.509 Certificate - Signature" },
  1041. { 5,5, "*undefined by any document*" },
  1042. { 6,6, "Kerberos Tokens" },
  1043. { 7,7, "Certificate Revocation List (CRL)" },
  1044. { 8,8, "Authority Revocation List (ARL)" },
  1045. { 9,9, "SPKI Certificate" },
  1046. { 10,10, "X.509 Certificate - Attribute" },
  1047. { 11,11, "Raw RSA Key" },
  1048. { 12,12, "Hash and URL of X.509 certificate" },
  1049. { 13,13, "Hash and URL of X.509 bundle" },
  1050. { 14,14, "OCSP Content" }, /* [RFC4806] */
  1051. { 15,200, "RESERVED to IANA" },
  1052. { 201,255, "PRIVATE USE" },
  1053. { 0,0, NULL },
  1054. };
  1055. static const range_string authmeth_v2_type[] = {
  1056. { 0,0, "RESERVED TO IANA" },
  1057. { 1,1, "RSA Digital Signature" },
  1058. { 2,2, "Shared Key Message Integrity Code" },
  1059. { 3,3, "DSS Digital Signature" },
  1060. { 4,8, "RESERVED TO IANA" },
  1061. { 9,9, "ECDSA with SHA-256 on the P-256 curve" }, /* RFC4754 */
  1062. { 10,10, "ECDSA with SHA-256 on the P-256 curve" }, /* RFC4754 */
  1063. { 11,11, "ECDSA with SHA-256 on the P-256 curve" }, /* RFC4754 */
  1064. { 12,12, "Generic Secure Password Authentication Method" }, /* RFC6467 */
  1065. { 13,200, "RESERVED TO IANA" },
  1066. { 201,255, "PRIVATE USE" },
  1067. { 0,0, NULL },
  1068. };
  1069. static const range_string notifmsg_v1_type[] = {
  1070. { 0,0, "<UNKNOWN>" },
  1071. { 1,1, "INVALID-PAYLOAD-TYPE" },
  1072. { 2,2, "DOI-NOT-SUPPORTED" },
  1073. { 3,3, "SITUATION-NOT-SUPPORTED" },
  1074. { 4,4, "INVALID-COOKIE" },
  1075. { 5,5, "INVALID-MAJOR-VERSION" },
  1076. { 6,6, "INVALID-MINOR-VERSION" },
  1077. { 7,7, "INVALID-EXCHANGE-TYPE" },
  1078. { 8,8, "INVALID-FLAGS" },
  1079. { 9,9, "INVALID-MESSAGE-ID" },
  1080. { 10,10, "INVALID-PROTOCOL-ID" },
  1081. { 11,11, "INVALID-SPI" },
  1082. { 12,12, "INVALID-TRANSFORM-ID" },
  1083. { 13,13, "ATTRIBUTES-NOT-SUPPORTED" },
  1084. { 14,14, "NO-PROPOSAL-CHOSEN" },
  1085. { 15,15, "BAD-PROPOSAL-SYNTAX" },
  1086. { 16,16, "PAYLOAD-MALFORMED" },
  1087. { 17,17, "INVALID-KEY-INFORMATION" },
  1088. { 18,18, "INVALID-ID-INFORMATION" },
  1089. { 19,19, "INVALID-CERT-ENCODING" },
  1090. { 20,20, "INVALID-CERTIFICATE" },
  1091. { 21,21, "CERT-TYPE-UNSUPPORTED" },
  1092. { 22,22, "INVALID-CERT-AUTHORITY" },
  1093. { 23,23, "INVALID-HASH-INFORMATION" },
  1094. { 24,24, "AUTHENTICATION-FAILED" },
  1095. { 25,25, "INVALID-SIGNATURE" },
  1096. { 26,26, "ADDRESS-NOTIFICATION" },
  1097. { 27,27, "NOTIFY-SA-LIFETIME" },
  1098. { 28,28, "CERTIFICATE-UNAVAILABLE" },
  1099. { 29,29, "UNSUPPORTED-EXCHANGE-TYPE" },
  1100. { 30,30, "UNEQUAL-PAYLOAD-LENGTHS" },
  1101. { 31,8191, "RESERVED (Future Use)" },
  1102. { 8192,16383, "Private Use" },
  1103. { 16384,16384,"CONNECTED" },
  1104. { 16385,24575,"RESERVED (Future Use)" },
  1105. { 24576,24576,"RESPONDER-LIFETIME" },
  1106. { 24577,24577,"REPLAY-STATUS" },
  1107. { 24578,24578,"INITIAL-CONTACT" },
  1108. { 24579,32767,"DOI-specific codes" },
  1109. { 32768,36135,"Private Use" },
  1110. { 36136,36136,"R-U-THERE" },
  1111. { 36137,36137,"R-U-THERE-ACK" },
  1112. { 36138,40500,"Private Use" },
  1113. { 40501,40501,"UNITY-LOAD-BALANCE" },
  1114. { 40502,40502,"UNITY-UNKNOWN" },
  1115. { 40503,40503,"UNITY-GROUP-HASH" },
  1116. { 40503,40959,"Private Use" },
  1117. { 40960,65535,"RESERVED (Future Use)" },
  1118. { 0,0, NULL },
  1119. };
  1120. static const range_string notifmsg_v2_type[] = {
  1121. { 0,0, "RESERVED" },
  1122. { 1,1, "UNSUPPORTED_CRITICAL_PAYLOAD" },
  1123. { 2,3, "RESERVED" },
  1124. { 4,4, "INVALID_IKE_SPI" },
  1125. { 5,5, "INVALID_MAJOR_VERSION" },
  1126. { 6,6, "RESERVED" },
  1127. { 7,7, "INVALID_SYNTAX" },
  1128. { 8,8, "RESERVED" },
  1129. { 9,9, "INVALID_MESSAGE_ID" },
  1130. { 10,10, "RESERVED" },
  1131. { 11,11, "INVALID_SPI" },
  1132. { 12,13, "RESERVED" },
  1133. { 14,14, "NO_PROPOSAL_CHOSEN" },
  1134. { 15,16, "RESERVED" },
  1135. { 17,17, "INVALID_KE_PAYLOAD" },
  1136. { 15,16, "RESERVED" },
  1137. { 24,24, "AUTHENTICATION_FAILED" },
  1138. { 25,33, "RESERVED" },
  1139. { 34,34, "SINGLE_PAIR_REQUIRED" },
  1140. { 35,35, "NO_ADDITIONAL_SAS" },
  1141. { 36,36, "INTERNAL_ADDRESS_FAILURE" },
  1142. { 37,37, "FAILED_CP_REQUIRED" },
  1143. { 38,38, "TS_UNACCEPTABLE" },
  1144. { 39,39, "INVALID_SELECTORS" },
  1145. { 40,40, "UNACCEPTABLE_ADDRESSES" }, /* RFC4555 */
  1146. { 41,41, "UNEXPECTED_NAT_DETECTED" }, /* RFC4555 */
  1147. { 42,42, "USE_ASSIGNED_HoA" }, /* RFC5026 */
  1148. { 43,43, "TEMPORARY_FAILURE" }, /* RFC5996 */
  1149. { 44,44, "CHILD_SA_NOT_FOUND" }, /* RFC5996 */
  1150. { 45,8191, "RESERVED TO IANA - Error types" },
  1151. { 8192,16383, "Private Use - Errors" },
  1152. { 16384,16384, "INITIAL_CONTACT" },
  1153. { 16385,16385, "SET_WINDOW_SIZE" },
  1154. { 16386,16386, "ADDITIONAL_TS_POSSIBLE" },
  1155. { 16387,16387, "IPCOMP_SUPPORTED" },
  1156. { 16388,16388, "NAT_DETECTION_SOURCE_IP" },
  1157. { 16389,16389, "NAT_DETECTION_DESTINATION_IP" },
  1158. { 16390,16390, "COOKIE" },
  1159. { 16391,16391, "USE_TRANSPORT_MODE" },
  1160. { 16392,16392, "HTTP_CERT_LOOKUP_SUPPORTED" },
  1161. { 16393,16393, "REKEY_SA" },
  1162. { 16394,16394, "ESP_TFC_PADDING_NOT_SUPPORTED" },
  1163. { 16395,16395, "NON_FIRST_FRAGMENTS_ALSO" },
  1164. { 16396,16396, "MOBIKE_SUPPORTED" }, /* RFC4555 */
  1165. { 16397,16397, "ADDITIONAL_IP4_ADDRESS" }, /* RFC4555 */
  1166. { 16398,16398, "ADDITIONAL_IP6_ADDRESS" }, /* RFC4555 */
  1167. { 16399,16399, "NO_ADDITIONAL_ADDRESSES" }, /* RFC4555 */
  1168. { 16400,16400, "UPDATE_SA_ADDRESSES" }, /* RFC4555 */
  1169. { 16401,16401, "COOKIE2" }, /* RFC4555 */
  1170. { 16402,16402, "NO_NATS_ALLOWED" }, /* RFC4555 */
  1171. { 16403,16403, "AUTH_LIFETIME" }, /* RFC4478 */
  1172. { 16404,16404, "MULTIPLE_AUTH_SUPPORTED" }, /* RFC4739 */
  1173. { 16405,16405, "ANOTHER_AUTH_FOLLOWS" }, /* RFC4739 */
  1174. { 16406,16406, "REDIRECT_SUPPORTED" }, /* RFC5685 */
  1175. { 16407,16407, "REDIRECT" }, /* RFC5685 */
  1176. { 16408,16408, "REDIRECTED_FROM" }, /* RFC5685 */
  1177. { 16409,16409, "TICKET_LT_OPAQUE" }, /* RFC5723 */
  1178. { 16410,16410, "TICKET_REQUEST" }, /* RFC5723 */
  1179. { 16411,16411, "TICKET_ACK" }, /* RFC5723 */
  1180. { 16412,16412, "TICKET_NACK" }, /* RFC5723 */
  1181. { 16413,16413, "TICKET_OPAQUE" }, /* RFC5723 */
  1182. { 16414,16414, "LINK_ID" }, /* RFC5739 */
  1183. { 16415,16415, "USE_WESP_MODE" }, /* RFC5840 */
  1184. { 16416,16416, "ROHC_SUPPORTED" }, /* RFC5857 */
  1185. { 16417,16417, "EAP_ONLY_AUTHENTICATION" }, /* RFC5998 */
  1186. { 16418,16418, "CHILDLESS_IKEV2_SUPPORTED" }, /* RFC6023 */
  1187. { 16419,16419, "QUICK_CRASH_DETECTION" }, /* RFC6290 */
  1188. { 16420,16420, "IKEV2_MESSAGE_ID_SYNC_SUPPORTED" }, /* RFC6311 */
  1189. { 16421,16421, "IPSEC_REPLAY_COUNTER_SYNC_SUPPORTED" },/* RFC6311 */
  1190. { 16422,16422, "IKEV2_MESSAGE_ID_SYNC" }, /* RFC6311 */
  1191. { 16423,16423, "IPSEC_REPLAY_COUNTER_SYNC" }, /* RFC6311 */
  1192. { 16424,16424, "SECURE_PASSWORD_METHODS" }, /* RFC6467 */
  1193. { 16425,40959, "RESERVED TO IANA - STATUS TYPES" },
  1194. { 40960,65535, "Private Use - STATUS TYPES" },
  1195. { 0,0, NULL },
  1196. };
  1197. static const range_string vs_v1_cfgtype[] = {
  1198. { 0,0, "Reserved" },
  1199. { 1,1, "ISAKMP_CFG_REQUEST" },
  1200. { 2,2, "ISAKMP_CFG_REPLY" },
  1201. { 3,3, "ISAKMP_CFG_SET" },
  1202. { 4,4, "ISAKMP_CFG_ACK" },
  1203. { 5,127, "Future use" },
  1204. { 128,256, "Private Use" },
  1205. { 0,0, NULL },
  1206. };
  1207. static const range_string vs_v2_cfgtype[] = {
  1208. { 0,0, "RESERVED" },
  1209. { 1,1, "CFG_REQUEST" },
  1210. { 2,2, "CFG_REPLY" },
  1211. { 3,3, "CFG_SET" },
  1212. { 4,4, "CFG_ACK" },
  1213. { 5,127, "Future use" },
  1214. { 128,256, "Private Use" },
  1215. { 0,0, NULL },
  1216. };
  1217. static const range_string vs_v1_cfgattr[] = {
  1218. { 0,0, "RESERVED" },
  1219. { 1,1, "INTERNAL_IP4_ADDRESS" },
  1220. { 2,2, "INTERNAL_IP4_NETMASK" },
  1221. { 3,3, "INTERNAL_IP4_DNS" },
  1222. { 4,4, "INTERNAL_IP4_NBNS" },
  1223. { 5,5, "INTERNAL_ADDRESS_EXPIREY" },
  1224. { 6,6, "INTERNAL_IP4_DHCP" },
  1225. { 7,7, "APPLICATION_VERSION" },
  1226. { 8,8, "INTERNAL_IP6_ADDRESS" },
  1227. { 9,9, "INTERNAL_IP6_NETMASK" },
  1228. { 10,10, "INTERNAL_IP6_DNS" },
  1229. { 11,11, "INTERNAL_IP6_NBNS" },
  1230. { 12,12, "INTERNAL_IP6_DHCP" },
  1231. { 13,13, "INTERNAL_IP4_SUBNET" },
  1232. { 14,14, "SUPPORTED_ATTRIBUTES" },
  1233. { 15,16383, "FUTURE USE"},
  1234. { 16384,16386, "PRIVATE USE"},
  1235. { 16387,16387, "CHKPT_DEF_DOMAIN" },
  1236. { 16388,16388, "CHKPT_MAC_ADDRESS" },
  1237. { 16389,16389, "CHKPT_MARCIPAN_REASON_CODE" },
  1238. { 16400,16400, "CHKPT_UNKNOWN1" },
  1239. { 16401,16401, "CHKPT_UNKNOWN2" },
  1240. { 16402,16402, "CHKPT_UNKNOWN3" },
  1241. { 16403,16519, "PRIVATE USE"},
  1242. { 16520,16520, "XAUTH_TYPE" },
  1243. { 16521,16521, "XAUTH_USER_NAME" },
  1244. { 16522,16522, "XAUTH_USER_PASSWORD" },
  1245. { 16523,16523, "XAUTH_PASSCODE" },
  1246. { 16524,16524, "XAUTH_MESSAGE" },
  1247. { 16525,16525, "XAUTH_CHALLANGE" },
  1248. { 16526,16526, "XAUTH_DOMAIN" },
  1249. { 16527,16527, "XAUTH_STATUS" },
  1250. { 16528,16528, "XAUTH_NEXT_PIN" },
  1251. { 16529,16529, "XAUTH_ANSWER" },
  1252. { 16530,28671, "PRIVATE USE"},
  1253. { 28672,28672, "UNITY_BANNER" },
  1254. { 28673,28673, "UNITY_SAVE_PASSWD" },
  1255. { 28674,28674, "UNITY_DEF_DOMAIN" },
  1256. { 28675,28675, "UNITY_SPLIT_DOMAIN" },
  1257. { 28676,28676, "UNITY_SPLIT_INCLUDE" },
  1258. { 28677,28677, "UNITY_NATT_PORT" },
  1259. { 28678,28678, "UNITY_SPLIT_EXCLUDE" },
  1260. { 28679,28679, "UNITY_PFS" },
  1261. { 28680,28680, "UNITY_FW_TYPE" },
  1262. { 28681,28681, "UNITY_BACKUP_SERVERS" },
  1263. { 28682,28682, "UNITY_DDNS_HOSTNAME" },
  1264. { 28683,32767, "PRIVATE USE"},
  1265. { 0,0, NULL },
  1266. };
  1267. static const range_string vs_v2_cfgattr[] = {
  1268. { 0,0, "RESERVED" },
  1269. { 1,1, "INTERNAL_IP4_ADDRESS" },
  1270. { 2,2, "INTERNAL_IP4_NETMASK" },
  1271. { 3,3, "INTERNAL_IP4_DNS" },
  1272. { 4,4, "INTERNAL_IP4_NBNS" },
  1273. { 5,5, "INTERNAL_ADDRESS_EXPIREY" }, /* OBSO */
  1274. { 6,6, "INTERNAL_IP4_DHCP" },
  1275. { 7,7, "APPLICATION_VERSION" },
  1276. { 8,8, "INTERNAL_IP6_ADDRESS" },
  1277. { 9,9, "RESERVED" },
  1278. { 10,10, "INTERNAL_IP6_DNS" },
  1279. { 11,11, "INTERNAL_IP6_NBNS" }, /* OBSO */
  1280. { 12,12, "INTERNAL_IP6_DHCP" },
  1281. { 13,13, "INTERNAL_IP4_SUBNET" },
  1282. { 14,14, "SUPPORTED_ATTRIBUTES" },
  1283. { 15,15, "INTERNAL_IP6_SUBNET" },
  1284. { 16,16, "MIP6_HOME_PREFIX" },
  1285. { 17,17, "INTERNAL_IP6_LINK" },
  1286. { 18,18, "INTERNAL_IP6_PREFIX" },
  1287. { 19,19, "HOME_AGENT_ADDRESS" }, /* 3GPP TS 24.302 http://www.3gpp.org/ftp/Specs/html-info/24302.htm */
  1288. { 20,16383, "RESERVED TO IANA"},
  1289. { 16384,32767, "PRIVATE USE"},
  1290. { 0,0, NULL },
  1291. };
  1292. static const range_string cfgattr_xauth_type[] = {
  1293. { 0,0, "Generic" },
  1294. { 1,1, "RADIUS-CHAP" },
  1295. { 2,2, "OTP" },
  1296. { 3,3, "S/KEY" },
  1297. { 4,32767, "Future use" },
  1298. { 32768,65535, "Private use" },
  1299. { 0,0, NULL },
  1300. };
  1301. static const value_string cfgattr_xauth_status[] = {
  1302. { 0, "Fail" },
  1303. { 1, "Success" },
  1304. { 0, NULL },
  1305. };
  1306. static const value_string cp_product[] = {
  1307. { 1, "Firewall-1" },
  1308. { 2, "SecuRemote/SecureClient" },
  1309. { 0, NULL },
  1310. };
  1311. static const value_string cp_version[] = {
  1312. { 2,"4.1" },
  1313. { 3,"4.1 SP-1" },
  1314. { 4002,"4.1 (SP-2 or above)" },
  1315. { 5000,"NG" },
  1316. { 5001,"NG Feature Pack 1" },
  1317. { 5002,"NG Feature Pack 2" },
  1318. { 5003,"NG Feature Pack 3" },
  1319. { 5004,"NG with Application Intelligence" },
  1320. { 5005,"NG with Application Intelligence R55" },
  1321. { 5006,"NG with Application Intelligence R56" },
  1322. { 0, NULL },
  1323. };
  1324. static const range_string traffic_selector_type[] = {
  1325. { 0,6, "Reserved" },
  1326. { 7,7, "TS_IPV4_ADDR_RANGE" },
  1327. { 8,8, "TS_IPV6_ADDR_RANGE" },
  1328. { 9,9, "TS_FC_ADDR_RANGE" },
  1329. { 10,240, "Future use" },
  1330. { 241,255, "Private use" },
  1331. { 0,0, NULL },
  1332. };
  1333. static const value_string ms_nt5_isakmpoakley_type[] = {
  1334. { 2, "Windows 2000" },
  1335. { 3, "Windows XP SP1" },
  1336. { 4, "Windows 2003 and Windows XP SP2" },
  1337. { 5, "Windows Vista" },
  1338. { 0, NULL }
  1339. };
  1340. static const range_string vs_v1_id_type[] = {
  1341. { 0,0, "RESERVED" },
  1342. { IKE_ID_IPV4_ADDR,IKE_ID_IPV4_ADDR, "IPV4_ADDR" },
  1343. { IKE_ID_FQDN,IKE_ID_FQDN, "FQDN" },
  1344. { IKE_ID_USER_FQDN,IKE_ID_USER_FQDN, "USER_FQDN" },
  1345. { IKE_ID_IPV4_ADDR_SUBNET,IKE_ID_IPV4_ADDR_SUBNET, "IPV4_ADDR_SUBNET" },
  1346. { IKE_ID_IPV6_ADDR,IKE_ID_IPV6_ADDR, "IPV6_ADDR" },
  1347. { IKE_ID_IPV6_ADDR_SUBNET,IKE_ID_IPV6_ADDR_SUBNET, "IPV6_ADDR_SUBNET" },
  1348. { IKE_ID_IPV4_ADDR_RANGE,IKE_ID_IPV4_ADDR_RANGE, "IPV4_ADDR_RANGE" },
  1349. { IKE_ID_IPV6_ADDR_RANGE,IKE_ID_IPV6_ADDR_RANGE, "IPV6_ADDR_RANGE" },
  1350. { IKE_ID_DER_ASN1_DN,IKE_ID_DER_ASN1_DN, "DER_ASN1_DN" },
  1351. { IKE_ID_DER_ASN1_GN,IKE_ID_DER_ASN1_GN, "DER_ASN1_GN" },
  1352. { IKE_ID_KEY_ID,IKE_ID_KEY_ID, "KEY_ID" },
  1353. { IKE_ID_LIST,IKE_ID_LIST, "KEY_LIST" },
  1354. { 13,248, "Future use" },
  1355. { 249,255, "Private Use" },
  1356. { 0,0, NULL },
  1357. };
  1358. static const range_string vs_v2_id_type[] = {
  1359. { 0,0, "RESERVED" },
  1360. { IKE_ID_IPV4_ADDR,IKE_ID_IPV4_ADDR, "IPV4_ADDR" },
  1361. { IKE_ID_FQDN,IKE_ID_FQDN, "FQDN" },
  1362. { IKE_ID_RFC822_ADDR,IKE_ID_RFC822_ADDR, "ID_RFC822_ADDR" },
  1363. { 4,4, "Unassigned" },
  1364. { IKE_ID_IPV6_ADDR,IKE_ID_IPV6_ADDR, "IPV6_ADDR" },
  1365. { 6,8, "Unassigned" },
  1366. { IKE_ID_DER_ASN1_DN,IKE_ID_DER_ASN1_DN, "DER_ASN1_DN" },
  1367. { IKE_ID_DER_ASN1_GN,IKE_ID_DER_ASN1_GN, "DER_ASN1_GN" },
  1368. { IKE_ID_KEY_ID,IKE_ID_KEY_ID, "KEY_ID" },
  1369. { IKE_ID_FC_NAME,IKE_ID_FC_NAME, "KEY_LIST" },
  1370. { 13,200, "Future use" },
  1371. { 201,255, "Private Use" },
  1372. { 0,0, NULL },
  1373. };
  1374. #define COOKIE_SIZE 8
  1375. typedef struct isakmp_hdr {
  1376. guint8 next_payload;
  1377. guint8 version;
  1378. guint8 exch_type;
  1379. guint8 flags;
  1380. #define E_FLAG 0x01
  1381. #define C_FLAG 0x02
  1382. #define A_FLAG 0x04
  1383. #define I_FLAG 0x08
  1384. #define V_FLAG 0x10
  1385. #define R_FLAG 0x20
  1386. guint32 message_id;
  1387. guint32 length;
  1388. } isakmp_hdr_t;
  1389. static const true_false_string criticalpayload = {
  1390. "Critical",
  1391. "Not Critical"
  1392. };
  1393. static const true_false_string attribute_format = {
  1394. "Type/Value (TV)",
  1395. "Type/Length/Value (TLV)"
  1396. };
  1397. static const true_false_string flag_e = {
  1398. "Encrypted",
  1399. "Not encrypted"
  1400. };
  1401. static const true_false_string flag_c = {
  1402. "Commit",
  1403. "No commit"
  1404. };
  1405. static const true_false_string flag_a = {
  1406. "Authentication",
  1407. "No authentication"
  1408. };
  1409. static const true_false_string flag_i = {
  1410. "Initiator",
  1411. "Responder"
  1412. };
  1413. static const true_false_string flag_v = {
  1414. "A higher version enabled",
  1415. "No higher version"
  1416. };
  1417. static const true_false_string flag_r = {
  1418. "Response",
  1419. "Request"
  1420. };
  1421. /* ROHC Attribute Type RFC5857 */
  1422. #define ROHC_MAX_CID 1
  1423. #define ROHC_PROFILE 2
  1424. #define ROHC_INTEG 3
  1425. #define ROHC_ICV_LEN 4
  1426. #define ROHC_MRRU 5
  1427. static const value_string rohc_attr_type[] = {
  1428. { ROHC_MAX_CID, "Maximum Context Identifier (MAX_CID)" },
  1429. { ROHC_PROFILE, "ROHC Profile (ROHC_PROFILE)" },
  1430. { ROHC_INTEG, "ROHC Integrity Algorithm (ROHC_INTEG)" },
  1431. { ROHC_ICV_LEN, "ROHC ICV Length in bytes (ROHC_ICV_LEN)" },
  1432. { ROHC_MRRU, "Maximum Reconstructed Reception Unit (MRRU)" },
  1433. { 0, NULL },
  1434. };
  1435. #define ISAKMP_HDR_SIZE ((int)sizeof(struct isakmp_hdr) + (2 * COOKIE_SIZE))
  1436. #ifdef HAVE_LIBGCRYPT
  1437. #define MAX_KEY_SIZE 256
  1438. #define MAX_DIGEST_SIZE 64
  1439. #define MAX_OAKLEY_KEY_LEN 32
  1440. typedef struct _ikev1_uat_data_key {
  1441. guchar *icookie;
  1442. guint icookie_len;
  1443. guchar *key;
  1444. guint key_len;
  1445. } ikev1_uat_data_key_t;
  1446. typedef struct iv_data {
  1447. guchar iv[MAX_DIGEST_SIZE];
  1448. guint iv_len;
  1449. guint32 frame_num;
  1450. } iv_data_t;
  1451. typedef struct decrypt_data {
  1452. gboolean is_psk;
  1453. address initiator;
  1454. guint encr_alg;
  1455. guint hash_alg;
  1456. guint group;
  1457. gchar *gi;
  1458. guint gi_len;
  1459. gchar *gr;
  1460. guint gr_len;
  1461. guchar secret[MAX_KEY_SIZE];
  1462. guint secret_len;
  1463. GList *iv_list;
  1464. gchar last_cbc[MAX_DIGEST_SIZE];
  1465. guint last_cbc_len;
  1466. gchar last_p1_cbc[MAX_DIGEST_SIZE];
  1467. guint last_p1_cbc_len;
  1468. guint32 last_message_id;
  1469. } decrypt_data_t;
  1470. static GHashTable *isakmp_hash = NULL;
  1471. static ikev1_uat_data_key_t* ikev1_uat_data = NULL;
  1472. static uat_t * ikev1_uat = NULL;
  1473. static guint num_ikev1_uat_data = 0;
  1474. /* Specifications of encryption algorithms for IKEv2 decryption */
  1475. typedef struct _ikev2_encr_alg_spec {
  1476. guint number;
  1477. /* Length of encryption key */
  1478. guint key_len;
  1479. /* Block size of the cipher */
  1480. guint block_len;
  1481. /* Length of initialization vector */
  1482. guint iv_len;
  1483. /* Encryption algorithm ID to be passed to gcry_cipher_open() */
  1484. gint gcry_alg;
  1485. /* Cipher mode to be passed to gcry_cipher_open() */
  1486. gint gcry_mode;
  1487. } ikev2_encr_alg_spec_t;
  1488. #define IKEV2_ENCR_NULL 1
  1489. #define IKEV2_ENCR_3DES 2
  1490. #define IKEV2_ENCR_AES_CBC_128 3
  1491. #define IKEV2_ENCR_AES_CBC_192 4
  1492. #define IKEV2_ENCR_AES_CBC_256 5
  1493. static ikev2_encr_alg_spec_t ikev2_encr_algs[] = {
  1494. {IKEV2_ENCR_NULL, 0, 1, 0, GCRY_CIPHER_NONE, GCRY_CIPHER_MODE_NONE},
  1495. {IKEV2_ENCR_3DES, 24, 8, 8, GCRY_CIPHER_3DES, GCRY_CIPHER_MODE_CBC},
  1496. {IKEV2_ENCR_AES_CBC_128, 16, 16, 16, GCRY_CIPHER_AES128, GCRY_CIPHER_MODE_CBC},
  1497. {IKEV2_ENCR_AES_CBC_192, 24, 16, 16, GCRY_CIPHER_AES192, GCRY_CIPHER_MODE_CBC},
  1498. {IKEV2_ENCR_AES_CBC_256, 32, 16, 16, GCRY_CIPHER_AES256, GCRY_CIPHER_MODE_CBC},
  1499. {0, 0, 0, 0, 0, 0}
  1500. };
  1501. /*
  1502. * Specifications of authentication algorithms for
  1503. * decryption and/or ICD (Integrity Checksum Data) checking of IKEv2
  1504. */
  1505. typedef struct _ikev2_auth_alg_spec {
  1506. guint number;
  1507. /* Output length of the hash algorithm */
  1508. guint output_len;
  1509. /* Length of the hash key */
  1510. guint key_len;
  1511. /* Actual ICD length after truncation */
  1512. guint trunc_len;
  1513. /* Hash algorithm ID to be passed to gcry_md_open() */
  1514. gint gcry_alg;
  1515. /* Flags to be passed to gcry_md_open() */
  1516. guint gcry_flag;
  1517. } ikev2_auth_alg_spec_t;
  1518. #define IKEV2_AUTH_NONE 1
  1519. #define IKEV2_AUTH_HMAC_MD5_96 2
  1520. #define IKEV2_AUTH_HMAC_SHA1_96 3
  1521. #define IKEV2_AUTH_HMAC_SHA2_256_96 4
  1522. #define IKEV2_AUTH_HMAC_SHA2_256_128 5
  1523. #define IKEV2_AUTH_HMAC_SHA2_384_192 6
  1524. #define IKEV2_AUTH_HMAC_SHA2_512_256 7
  1525. #define IKEV2_AUTH_ANY_96BITS 8
  1526. #define IKEV2_AUTH_ANY_128BITS 9
  1527. #define IKEV2_AUTH_ANY_160BITS 10
  1528. #define IKEV2_AUTH_ANY_192BITS 11
  1529. #define IKEV2_AUTH_ANY_256BITS 12
  1530. static ikev2_auth_alg_spec_t ikev2_auth_algs[] = {
  1531. /*{number, output_len, key_len, trunc_len, gcry_alg, gcry_flag}*/
  1532. {IKEV2_AUTH_NONE, 0, 0, 0, GCRY_MD_NONE, 0},
  1533. {IKEV2_AUTH_HMAC_MD5_96, 16, 16, 12, GCRY_MD_MD5, GCRY_MD_FLAG_HMAC},
  1534. {IKEV2_AUTH_HMAC_SHA1_96, 20, 20, 12, GCRY_MD_SHA1, GCRY_MD_FLAG_HMAC},
  1535. {IKEV2_AUTH_HMAC_SHA2_256_96, 32, 32, 12, GCRY_MD_SHA256, GCRY_MD_FLAG_HMAC},
  1536. {IKEV2_AUTH_HMAC_SHA2_256_128, 32, 32, 16, GCRY_MD_SHA256, GCRY_MD_FLAG_HMAC},
  1537. {IKEV2_AUTH_HMAC_SHA2_384_192, 48, 48, 24, GCRY_MD_SHA256, GCRY_MD_FLAG_HMAC},
  1538. {IKEV2_AUTH_HMAC_SHA2_512_256, 64, 64, 32, GCRY_MD_SHA256, GCRY_MD_FLAG_HMAC},
  1539. {IKEV2_AUTH_ANY_96BITS, 0, 0, 12, 0, 0},
  1540. {IKEV2_AUTH_ANY_128BITS, 0, 0, 16, 0, 0},
  1541. {IKEV2_AUTH_ANY_160BITS, 0, 0, 20, 0, 0},
  1542. {IKEV2_AUTH_ANY_192BITS, 0, 0, 24, 0, 0},
  1543. {IKEV2_AUTH_ANY_256BITS, 0, 0, 32, 0, 0},
  1544. {0, 0, 0, 0, 0, 0}
  1545. };
  1546. typedef struct _ikev2_decrypt_data {
  1547. guchar *encr_key;
  1548. guchar *auth_key;
  1549. ikev2_encr_alg_spec_t *encr_spec;
  1550. ikev2_auth_alg_spec_t *auth_spec;
  1551. } ikev2_decrypt_data_t;
  1552. typedef struct _ikev2_uat_data_key {
  1553. guchar *spii;
  1554. guint spii_len;
  1555. guchar *spir;
  1556. guint spir_len;
  1557. } ikev2_uat_data_key_t;
  1558. typedef struct _ikev2_uat_data {
  1559. ikev2_uat_data_key_t key;
  1560. guint encr_alg;
  1561. guint auth_alg;
  1562. guchar *sk_ei;
  1563. guint sk_ei_len;
  1564. guchar *sk_er;
  1565. guint sk_er_len;
  1566. guchar *sk_ai;
  1567. guint sk_ai_len;
  1568. guchar *sk_ar;
  1569. guint sk_ar_len;
  1570. ikev2_encr_alg_spec_t *encr_spec;
  1571. ikev2_auth_alg_spec_t *auth_spec;
  1572. } ikev2_uat_data_t;
  1573. static ikev2_uat_data_t* ikev2_uat_data = NULL;
  1574. static guint num_ikev2_uat_data = 0;
  1575. static uat_t* ikev2_uat;
  1576. static GHashTable *ikev2_key_hash = NULL;
  1577. #define IKEV2_ENCR_3DES_STR "3DES [RFC2451]"
  1578. static const value_string vs_ikev2_encr_algs[] = {
  1579. {IKEV2_ENCR_3DES, IKEV2_ENCR_3DES_STR},
  1580. {IKEV2_ENCR_AES_CBC_128, "AES-CBC-128 [RFC3602]"},
  1581. {IKEV2_ENCR_AES_CBC_192, "AES-CBC-192 [RFC3602]"},
  1582. {IKEV2_ENCR_AES_CBC_256, "AES-CBC-256 [RFC3602]"},
  1583. {IKEV2_ENCR_NULL, "NULL [RFC2410]"},
  1584. {0, NULL}
  1585. };
  1586. #define IKEV2_AUTH_HMAC_SHA1_96_STR "HMAC_SHA1_96 [RFC2404]"
  1587. static const value_string vs_ikev2_auth_algs[] = {
  1588. {IKEV2_AUTH_HMAC_MD5_96, "HMAC_MD5_96 [RFC2403]"},
  1589. {IKEV2_AUTH_HMAC_SHA1_96, IKEV2_AUTH_HMAC_SHA1_96_STR},
  1590. {IKEV2_AUTH_HMAC_SHA2_256_96, "HMAC_SHA2_256_96 [draft-ietf-ipsec-ciph-sha-256-00]"},
  1591. {IKEV2_AUTH_HMAC_SHA2_256_128, "HMAC_SHA2_256_128 [RFC4868]"},
  1592. {IKEV2_AUTH_HMAC_SHA2_384_192, "HMAC_SHA2_384_192 [RFC4868]"},
  1593. {IKEV2_AUTH_HMAC_SHA2_512_256, "HMAC_SHA2_512_256 [RFC4868]"},
  1594. {IKEV2_AUTH_NONE, "NONE [RFC4306]"},
  1595. {IKEV2_AUTH_ANY_96BITS, "ANY 96-bits of Authentication [No Checking]"},
  1596. {IKEV2_AUTH_ANY_128BITS, "ANY 128-bits of Authentication [No Checking]"},
  1597. {IKEV2_AUTH_ANY_160BITS, "ANY 160-bits of Authentication [No Checking]"},
  1598. {IKEV2_AUTH_ANY_192BITS, "ANY 192-bits of Authentication [No Checking]"},
  1599. {IKEV2_AUTH_ANY_256BITS, "ANY 256-bits of Authentication [No Checking]"},
  1600. {0, NULL}
  1601. };
  1602. static ikev2_encr_alg_spec_t* ikev2_decrypt_find_encr_spec(guint num) {
  1603. ikev2_encr_alg_spec_t *e;
  1604. for (e = ikev2_encr_algs; e->number != 0; e++) {
  1605. if (e->number == num) {
  1606. return e;
  1607. }
  1608. }
  1609. return NULL;
  1610. }
  1611. static ikev2_auth_alg_spec_t* ikev2_decrypt_find_auth_spec(guint num) {
  1612. ikev2_auth_alg_spec_t *a;
  1613. for (a = ikev2_auth_algs; a->number != 0; a++) {
  1614. if (a->number == num) {
  1615. return a;
  1616. }
  1617. }
  1618. return NULL;
  1619. }
  1620. static tvbuff_t *
  1621. decrypt_payload(tvbuff_t *tvb, packet_info *pinfo, const guint8 *buf, guint buf_len, isakmp_hdr_t *hdr) {
  1622. decrypt_data_t *decr = (decrypt_data_t *) pinfo->private_data;
  1623. guint8 *decrypted_data = NULL;
  1624. gint gcry_md_algo, gcry_cipher_algo;
  1625. gcry_md_hd_t md_ctx;
  1626. gcry_cipher_hd_t decr_ctx;
  1627. tvbuff_t *encr_tvb;
  1628. iv_data_t *ivd = NULL;
  1629. GList *ivl;
  1630. guchar iv[MAX_DIGEST_SIZE];
  1631. guint iv_len = 0;
  1632. guint32 message_id, cbc_block_size, digest_size;
  1633. if (!decr ||
  1634. decr->is_psk == FALSE ||
  1635. decr->gi_len == 0 ||
  1636. decr->gr_len == 0)
  1637. return NULL;
  1638. switch(decr->encr_alg) {
  1639. case ENC_3DES_CBC:
  1640. gcry_cipher_algo = GCRY_CIPHER_3DES;
  1641. break;
  1642. case ENC_DES_CBC:
  1643. gcry_cipher_algo = GCRY_CIPHER_DES;
  1644. break;
  1645. default:
  1646. return NULL;
  1647. break;
  1648. }
  1649. if (decr->secret_len < gcry_cipher_get_algo_keylen(gcry_cipher_algo))
  1650. return NULL;
  1651. cbc_block_size = (guint32) gcry_cipher_get_algo_blklen(gcry_cipher_algo);
  1652. if (cbc_block_size > MAX_DIGEST_SIZE) {
  1653. /* This shouldn't happen but we pass cbc_block_size to memcpy size below. */
  1654. return NULL;
  1655. }
  1656. switch(decr->hash_alg) {
  1657. case HMAC_MD5:
  1658. gcry_md_algo = GCRY_MD_MD5;
  1659. break;
  1660. case HMAC_SHA:
  1661. gcry_md_algo = GCRY_MD_SHA1;
  1662. break;
  1663. default:
  1664. return NULL;
  1665. break;
  1666. }
  1667. digest_size = gcry_md_get_algo_dlen(gcry_md_algo);
  1668. for (ivl = g_list_first(decr->iv_list); ivl != NULL; ivl = g_list_next(ivl)) {
  1669. ivd = (iv_data_t *) ivl->data;
  1670. if (ivd->frame_num == pinfo->fd->num) {
  1671. iv_len = ivd->iv_len;
  1672. memcpy(iv, ivd->iv, iv_len);
  1673. }
  1674. }
  1675. /*
  1676. * Set our initialization vector as follows:
  1677. * - If the IV list is empty, assume we have the first packet in a phase 1
  1678. * exchange. The IV is built from DH values.
  1679. * - If our message ID changes, assume we're entering a new mode. The IV
  1680. * is built from the message ID and the last phase 1 CBC.
  1681. * - Otherwise, use the last CBC.
  1682. */
  1683. if (iv_len == 0) {
  1684. if (gcry_md_open(&md_ctx, gcry_md_algo, 0) != GPG_ERR_NO_ERROR)
  1685. return NULL;
  1686. if (decr->iv_list == NULL) {
  1687. /* First packet */
  1688. ivd = (iv_data_t *)g_malloc(sizeof(iv_data_t));
  1689. ivd->frame_num = pinfo->fd->num;
  1690. ivd->iv_len = digest_size;
  1691. decr->last_message_id = hdr->message_id;
  1692. gcry_md_reset(md_ctx);
  1693. gcry_md_write(md_ctx, decr->gi, decr->gi_len);
  1694. gcry_md_write(md_ctx, decr->gr, decr->gr_len);
  1695. gcry_md_final(md_ctx);
  1696. memcpy(ivd->iv, gcry_md_read(md_ctx, gcry_md_algo), digest_size);
  1697. decr->iv_list = g_list_append(decr->iv_list, ivd);
  1698. iv_len = ivd->iv_len;
  1699. memcpy(iv, ivd->iv, iv_len);
  1700. } else if (decr->last_cbc_len >= cbc_block_size) {
  1701. ivd = (iv_data_t *)g_malloc(sizeof(iv_data_t));
  1702. ivd->frame_num = pinfo->fd->num;
  1703. if (hdr->message_id != decr->last_message_id) {
  1704. if (decr->last_p1_cbc_len == 0) {
  1705. memcpy(decr->last_p1_cbc, decr->last_cbc, cbc_block_size);
  1706. decr->last_p1_cbc_len = cbc_block_size;
  1707. }
  1708. ivd->iv_len = digest_size;
  1709. decr->last_message_id = hdr->message_id;
  1710. message_id = g_htonl(decr->last_message_id);
  1711. gcry_md_reset(md_ctx);
  1712. gcry_md_write(md_ctx, decr->last_p1_cbc, cbc_block_size);
  1713. gcry_md_write(md_ctx, &message_id, sizeof(message_id));
  1714. memcpy(ivd->iv, gcry_md_read(md_ctx, gcry_md_algo), digest_size);
  1715. } else {
  1716. ivd->iv_len = cbc_block_size;
  1717. memcpy(ivd->iv, decr->last_cbc, ivd->iv_len);
  1718. }
  1719. decr->iv_list = g_list_append(decr->iv_list, ivd);
  1720. iv_len = ivd->iv_len;
  1721. memcpy(iv, ivd->iv, iv_len);
  1722. }
  1723. gcry_md_close(md_ctx);
  1724. }
  1725. if (ivd == NULL) return NULL;
  1726. if (gcry_cipher_open(&decr_ctx, gcry_cipher_algo, GCRY_CIPHER_MODE_CBC, 0) != GPG_ERR_NO_ERROR)
  1727. return NULL;
  1728. if (iv_len > cbc_block_size)
  1729. iv_len = cbc_block_size; /* gcry warns otherwise */
  1730. if (gcry_cipher_setiv(decr_ctx, iv, iv_len))
  1731. return NULL;
  1732. if (gcry_cipher_setkey(decr_ctx, decr->secret, decr->secret_len))
  1733. return NULL;
  1734. decrypted_data = (guint8 *)g_malloc(buf_len);
  1735. if (gcry_cipher_decrypt(decr_ctx, decrypted_data, buf_len, buf, buf_len) != GPG_ERR_NO_ERROR) {
  1736. g_free(decrypted_data);
  1737. return NULL;
  1738. }
  1739. gcry_cipher_close(decr_ctx);
  1740. encr_tvb = tvb_new_child_real_data(tvb, decrypted_data, buf_len, buf_len);
  1741. tvb_set_free_cb(encr_tvb, g_free);
  1742. /* Add the decrypted data to the data source list. */
  1743. add_new_data_source(pinfo, encr_tvb, "Decrypted IKE");
  1744. /* Fill in the next IV */
  1745. if (tvb_length(tvb) > cbc_block_size) {
  1746. decr->last_cbc_len = cbc_block_size;
  1747. memcpy(decr->last_cbc, buf + buf_len - cbc_block_size, cbc_block_size);
  1748. } else {
  1749. decr->last_cbc_len = 0;
  1750. }
  1751. return encr_tvb;
  1752. }
  1753. #endif /* HAVE_LIBGCRYPT */
  1754. static proto_tree *dissect_payload_header(tvbuff_t *, int, int, int, guint8,
  1755. guint8 *, guint16 *, proto_tree *);
  1756. static void dissect_sa(tvbuff_t *, int, int, proto_tree *, int, packet_info *);
  1757. static void dissect_proposal(tvbuff_t *, int, int, proto_tree *, int, packet_info *);
  1758. static void dissect_transform(tvbuff_t *, int, int, proto_tree *, packet_info *, int, int);
  1759. static void dissect_key_exch(tvbuff_t *, int, int, proto_tree *, int, packet_info *);
  1760. static void dissect_id(tvbuff_t *, int, int, proto_tree *, int, packet_info *);
  1761. static void dissect_cert(tvbuff_t *, int, int, proto_tree *, int, packet_info *);
  1762. static void dissect_certreq(tvbuff_t *, int, int, proto_tree *, int, packet_info *);
  1763. static void dissect_auth(tvbuff_t *, int, int, proto_tree *);
  1764. static void dissect_hash(tvbuff_t *, int, int, proto_tree *);
  1765. static void dissect_sig(tvbuff_t *, int, int, proto_tree *);
  1766. static void dissect_nonce(tvbuff_t *, int, int, proto_tree *);
  1767. static void dissect_notif(tvbuff_t *, int, int, proto_tree *, int);
  1768. static void dissect_delete(tvbuff_t *, int, int, proto_tree *, int);
  1769. static int dissect_vid(tvbuff_t *, int, int, proto_tree *);
  1770. static void dissect_config(tvbuff_t *, int, int, proto_tree *, int);
  1771. static void dissect_nat_discovery(tvbuff_t *, int, int, proto_tree * );
  1772. static void dissect_nat_original_address(tvbuff_t *, int, int, proto_tree *, int );
  1773. static void dissect_ts(tvbuff_t *, int, int, proto_tree *);
  1774. static void dissect_enc(tvbuff_t *, int, int, proto_tree *, packet_info *, guint8);
  1775. static void dissect_eap(tvbuff_t *, int, int, proto_tree *, packet_info *);
  1776. static void dissect_gspm(tvbuff_t *, int, int, proto_tree *);
  1777. static void dissect_cisco_fragmentation(tvbuff_t *, int, int, proto_tree *, packet_info *);
  1778. static const guint8 VID_SSH_IPSEC_EXPRESS_1_1_0[] = { /* Ssh Communications Security IPSEC Express version 1.1.0 */
  1779. 0xfB, 0xF4, 0x76, 0x14, 0x98, 0x40, 0x31, 0xFA,
  1780. 0x8E, 0x3B, 0xB6, 0x19, 0x80, 0x89, 0xB2, 0x23
  1781. };
  1782. static const guint8 VID_SSH_IPSEC_EXPRESS_1_1_1[] = { /* Ssh Communications Security IPSEC Express version 1.1.1 */
  1783. 0x19, 0x52, 0xDC, 0x91, 0xAC, 0x20, 0xF6, 0x46,
  1784. 0xFB, 0x01, 0xCF, 0x42, 0xA3, 0x3A, 0xEE, 0x30
  1785. };
  1786. static const guint8 VID_SSH_IPSEC_EXPRESS_1_1_2[] = { /* Ssh Communications Security IPSEC Express version 1.1.2 */
  1787. 0xE8, 0xBF, 0xFA, 0x64, 0x3E, 0x5C, 0x8F, 0x2C,
  1788. 0xD1, 0x0F, 0xDA, 0x73, 0x70, 0xB6, 0xEB, 0xE5
  1789. };
  1790. static const guint8 VID_SSH_IPSEC_EXPRESS_1_2_1[] = { /* Ssh Communications Security IPSEC Express version 1.2.1 */
  1791. 0xC1, 0x11, 0x1B, 0x2D, 0xEE, 0x8C, 0xBC, 0x3D,
  1792. 0x62, 0x05, 0x73, 0xEC, 0x57, 0xAA, 0xB9, 0xCB
  1793. };
  1794. static const guint8 VID_SSH_IPSEC_EXPRESS_1_2_2[] = { /* Ssh Communications Security IPSEC Express version 1.2.2 */
  1795. 0x09, 0xEC, 0x27, 0xBF, 0xBC, 0x09, 0xC7, 0x58,
  1796. 0x23, 0xCF, 0xEC, 0xBF, 0xFE, 0x56, 0x5A, 0x2E
  1797. };
  1798. static const guint8 VID_SSH_IPSEC_EXPRESS_2_0_0[] = { /* SSH Communications Security IPSEC Express version 2.0.0 */
  1799. 0x7F, 0x21, 0xA5, 0x96, 0xE4, 0xE3, 0x18, 0xF0,
  1800. 0xB2, 0xF4, 0x94, 0x4C, 0x23, 0x84, 0xCB, 0x84
  1801. };
  1802. static const guint8 VID_SSH_IPSEC_EXPRESS_2_1_0[] = { /* SSH Communications Security IPSEC Express version 2.1.0 */
  1803. 0x28, 0x36, 0xD1, 0xFD, 0x28, 0x07, 0xBC, 0x9E,
  1804. 0x5A, 0xE3, 0x07, 0x86, 0x32, 0x04, 0x51, 0xEC
  1805. };
  1806. static const guint8 VID_SSH_IPSEC_EXPRESS_2_1_1[] = { /* SSH Communications Security IPSEC Express version 2.1.1 */
  1807. 0xA6, 0x8D, 0xE7, 0x56, 0xA9, 0xC5, 0x22, 0x9B,
  1808. 0xAE, 0x66, 0x49, 0x80, 0x40, 0x95, 0x1A, 0xD5
  1809. };
  1810. static const guint8 VID_SSH_IPSEC_EXPRESS_2_1_2[] = { /* SSH Communications Security IPSEC Express version 2.1.2 */
  1811. 0x3F, 0x23, 0x72, 0x86, 0x7E, 0x23, 0x7C, 0x1C,
  1812. 0xD8, 0x25, 0x0A, 0x75, 0x55, 0x9C, 0xAE, 0x20
  1813. };
  1814. static const guint8 VID_SSH_IPSEC_EXPRESS_3_0_0[] = { /* SSH Communications Security IPSEC Express version 3.0.0 */
  1815. 0x0E, 0x58, 0xD5, 0x77, 0x4D, 0xF6, 0x02, 0x00,
  1816. 0x7D, 0x0B, 0x02, 0x44, 0x36, 0x60, 0xF7, 0xEB
  1817. };
  1818. static const guint8 VID_SSH_IPSEC_EXPRESS_3_0_1[] = { /* SSH Communications Security IPSEC Express version 3.0.1 */
  1819. 0xF5, 0xCE, 0x31, 0xEB, 0xC2, 0x10, 0xF4, 0x43,
  1820. 0x50, 0xCF, 0x71, 0x26, 0x5B, 0x57, 0x38, 0x0F
  1821. };
  1822. static const guint8 VID_SSH_IPSEC_EXPRESS_4_0_0[] = { /* SSH Communications Security IPSEC Express version 4.0.0 */
  1823. 0xF6, 0x42, 0x60, 0xAF, 0x2E, 0x27, 0x42, 0xDA,
  1824. 0xDD, 0xD5, 0x69, 0x87, 0x06, 0x8A, 0x99, 0xA0
  1825. };
  1826. static const guint8 VID_SSH_IPSEC_EXPRESS_4_0_1[] = { /* SSH Communications Security IPSEC Express version 4.0.1 */
  1827. 0x7A, 0x54, 0xD3, 0xBD, 0xB3, 0xB1, 0xE6, 0xD9,
  1828. 0x23, 0x89, 0x20, 0x64, 0xBE, 0x2D, 0x98, 0x1C
  1829. };
  1830. static const guint8 VID_SSH_IPSEC_EXPRESS_4_1_0[] = { /* SSH Communications Security IPSEC Express version 4.1.0 */
  1831. 0x9A, 0xA1, 0xF3, 0xB4, 0x34, 0x72, 0xA4, 0x5D,
  1832. 0x5F, 0x50, 0x6A, 0xEB, 0x26, 0x0C, 0xF2, 0x14
  1833. };
  1834. static const guint8 VID_SSH_IPSEC_EXPRESS_4_1_1[] = { /* SSH Communications Security IPSEC Express version 4.1.1 */
  1835. 0x89, 0xF7, 0xB7, 0x60, 0xD8, 0x6B, 0x01, 0x2A,
  1836. 0xCF, 0x26, 0x33, 0x82, 0x39, 0x4D, 0x96, 0x2F
  1837. };
  1838. static const guint8 VID_SSH_IPSEC_EXPRESS_4_2_0[] = { /* SSH Communications Security IPSEC Express version 4.2.0 */
  1839. 0x68, 0x80, 0xC7, 0xD0, 0x26, 0x09, 0x91, 0x14,
  1840. 0xE4, 0x86, 0xC5, 0x54, 0x30, 0xE7, 0xAB, 0xEE
  1841. };
  1842. static const guint8 VID_SSH_IPSEC_EXPRESS_5_0[] = { /* SSH Communications Security IPSEC Express version 5.0 */
  1843. 0xB0, 0x37, 0xA2, 0x1A, 0xCE, 0xCC, 0xB5, 0x57,
  1844. 0x0F, 0x60, 0x25, 0x46, 0xF9, 0x7B, 0xDE, 0x8C
  1845. };
  1846. static const guint8 VID_SSH_IPSEC_EXPRESS_5_0_0[] = { /* SSH Communications Security IPSEC Express version 5.0.0 */
  1847. 0x2B, 0x2D, 0xAD, 0x97, 0xC4, 0xD1, 0x40, 0x93,
  1848. 0x00, 0x53, 0x28, 0x7F, 0x99, 0x68, 0x50, 0xB0
  1849. };
  1850. static const guint8 VID_SSH_IPSEC_EXPRESS_5_1_0[] = { /* SSH Communications Security IPSEC Express version 5.1.0 */
  1851. 0x45, 0xE1, 0x7F, 0x3A, 0xBE, 0x93, 0x94, 0x4C,
  1852. 0xB2, 0x02, 0x91, 0x0C, 0x59, 0xEF, 0x80, 0x6B
  1853. };
  1854. static const guint8 VID_SSH_IPSEC_EXPRESS_5_1_1[] = { /* SSH Communications Security IPSEC Express version 5.1.1 */
  1855. 0x59, 0x25, 0x85, 0x9F, 0x73, 0x77, 0xED, 0x78,
  1856. 0x16, 0xD2, 0xFB, 0x81, 0xC0, 0x1F, 0xA5, 0x51
  1857. };
  1858. static const guint8 VID_SSH_SENTINEL[] = { /* SSH Sentinel */
  1859. 0x05, 0x41, 0x82, 0xA0, 0x7C, 0x7A, 0xE2, 0x06,
  1860. 0xF9, 0xD2, 0xCF, 0x9D, 0x24, 0x32, 0xC4, 0x82
  1861. };
  1862. static const guint8 VID_SSH_SENTINEL_1_1[] = { /* SSH Sentinel 1.1 */
  1863. 0xB9, 0x16, 0x23, 0xE6, 0x93, 0xCA, 0x18, 0xA5,
  1864. 0x4C, 0x6A, 0x27, 0x78, 0x55, 0x23, 0x05, 0xE8
  1865. };
  1866. static const guint8 VID_SSH_SENTINEL_1_2[] = { /* SSH Sentinel 1.2 */
  1867. 0x54, 0x30, 0x88, 0x8D, 0xE0, 0x1A, 0x31, 0xA6,
  1868. 0xFA, 0x8F, 0x60, 0x22, 0x4E, 0x44, 0x99, 0x58
  1869. };
  1870. static const guint8 VID_SSH_SENTINEL_1_3[] = { /* SSH Sentinel 1.3 */
  1871. 0x7E, 0xE5, 0xCB, 0x85, 0xF7, 0x1C, 0xE2, 0x59,
  1872. 0xC9, 0x4A, 0x5C, 0x73, 0x1E, 0xE4, 0xE7, 0x52
  1873. };
  1874. static const guint8 VID_SSH_SENTINEL_1_4[] = { /* SSH Sentinel 1.4 */
  1875. 0x63, 0xD9, 0xA1, 0xA7, 0x00, 0x94, 0x91, 0xB5,
  1876. 0xA0, 0xA6, 0xFD, 0xEB, 0x2A, 0x82, 0x84, 0xF0
  1877. };
  1878. static const guint8 VID_SSH_SENTINEL_1_4_1[] = { /* SSH Sentinel 1.4.1 */
  1879. 0xEB, 0x4B, 0x0D, 0x96, 0x27, 0x6B, 0x4E, 0x22,
  1880. 0x0A, 0xD1, 0x62, 0x21, 0xA7, 0xB2, 0xA5, 0xE6
  1881. };
  1882. static const guint8 VID_SSH_QUICKSEC_0_9_0[] = { /* SSH Communications Security QuickSec 0.9.0 */
  1883. 0x37, 0xEB, 0xA0, 0xC4, 0x13, 0x61, 0x84, 0xE7,
  1884. 0xDA, 0xF8, 0x56, 0x2A, 0x77, 0x06, 0x0B, 0x4A
  1885. };
  1886. static const guint8 VID_SSH_QUICKSEC_1_1_0[] = { /* SSH Communications Security QuickSec 1.1.0 */
  1887. 0x5D, 0x72, 0x92, 0x5E, 0x55, 0x94, 0x8A, 0x96,
  1888. 0x61, 0xA7, 0xFC, 0x48, 0xFD, 0xEC, 0x7F, 0xF9
  1889. };
  1890. static const guint8 VID_SSH_QUICKSEC_1_1_1[] = { /* SSH Communications Security QuickSec 1.1.1 */
  1891. 0x77, 0x7F, 0xBF, 0x4C, 0x5A, 0xF6, 0xD1, 0xCD,
  1892. 0xD4, 0xB8, 0x95, 0xA0, 0x5B, 0xF8, 0x25, 0x94
  1893. };
  1894. static const guint8 VID_SSH_QUICKSEC_1_1_2[] = { /* SSH Communications Security QuickSec 1.1.2 */
  1895. 0x2C, 0xDF, 0x08, 0xE7, 0x12, 0xED, 0xE8, 0xA5,
  1896. 0x97, 0x87, 0x61, 0x26, 0x7C, 0xD1, 0x9B, 0x91
  1897. };
  1898. static const guint8 VID_SSH_QUICKSEC_1_1_3[] = { /* SSH Communications Security QuickSec 1.1.3 */
  1899. 0x59, 0xE4, 0x54, 0xA8, 0xC2, 0xCF, 0x02, 0xA3,
  1900. 0x49, 0x59, 0x12, 0x1F, 0x18, 0x90, 0xBC, 0x87
  1901. };
  1902. static const guint8 VID_draft_huttunen_ipsec_esp_in_udp_00[] = { /* draft-huttunen-ipsec-esp-in-udp-00.txt */
  1903. 0x6A, 0x74, 0x34, 0xC1, 0x9D, 0x7E, 0x36, 0x34,
  1904. 0x80, 0x90, 0xA0, 0x23, 0x34, 0xC9, 0xC8, 0x05
  1905. };
  1906. static const guint8 VID_draft_huttunen_ipsec_esp_in_udp_01[] = { /* draft-huttunen-ipsec-esp-in-udp-01.txt */
  1907. 0x50, 0x76, 0x0F, 0x62, 0x4C, 0x63, 0xE5, 0xC5,
  1908. 0x3E, 0xEA, 0x38, 0x6C, 0x68, 0x5C, 0xA0, 0x83
  1909. };
  1910. static const guint8 VID_draft_stenberg_ipsec_nat_traversal_01[] = { /* draft-stenberg-ipsec-nat-traversal-01 */
  1911. 0x27, 0xBA, 0xB5, 0xDC, 0x01, 0xEA, 0x07, 0x60,
  1912. 0xEA, 0x4E, 0x31, 0x90, 0xAC, 0x27, 0xC0, 0xD0
  1913. };
  1914. static const guint8 VID_draft_stenberg_ipsec_nat_traversal_02[]= { /* draft-stenberg-ipsec-nat-traversal-02 */
  1915. 0x61, 0x05, 0xC4, 0x22, 0xE7, 0x68, 0x47, 0xE4,
  1916. 0x3F, 0x96, 0x84, 0x80, 0x12, 0x92, 0xAE, 0xCD
  1917. };
  1918. static const guint8 VID_draft_ietf_ipsec_nat_t_ike[]= { /* draft-ietf-ipsec-nat-t-ike */
  1919. 0x4D, 0xF3, 0x79, 0x28, 0xE9, 0xFC, 0x4F, 0xD1,
  1920. 0xB3, 0x26, 0x21, 0x70, 0xD5, 0x15, 0xC6, 0x62
  1921. };
  1922. static const guint8 VID_draft_ietf_ipsec_nat_t_ike_00[]= { /* draft-ietf-ipsec-nat-t-ike-00 */
  1923. 0x44, 0x85, 0x15, 0x2D, 0x18, 0xB6, 0xBB, 0xCD,
  1924. 0x0B, 0xE8, 0xA8, 0x46, 0x95, 0x79, 0xDD, 0xCC
  1925. };
  1926. static const guint8 VID_draft_ietf_ipsec_nat_t_ike_01[]= { /* "draft-ietf-ipsec-nat-t-ike-01" */
  1927. 0x16, 0xF6, 0xCA, 0x16, 0xE4, 0xA4, 0x06, 0x6D,
  1928. 0x83, 0x82, 0x1A, 0x0F, 0x0A, 0xEA, 0xA8, 0x62
  1929. };
  1930. static const guint8 VID_draft_ietf_ipsec_nat_t_ike_02[]= { /* draft-ietf-ipsec-nat-t-ike-02 */
  1931. 0xCD, 0x60, 0x46, 0x43, 0x35, 0xDF, 0x21, 0xF8,
  1932. 0x7C, 0xFD, 0xB2, 0xFC, 0x68, 0xB6, 0xA4, 0x48
  1933. };
  1934. static const guint8 VID_draft_ietf_ipsec_nat_t_ike_02n[]= { /* draft-ietf-ipsec-nat-t-ike-02\n */
  1935. 0x90, 0xCB, 0x80, 0x91, 0x3E, 0xBB, 0x69, 0x6E,
  1936. 0x08, 0x63, 0x81, 0xB5, 0xEC, 0x42, 0x7B, 0x1F
  1937. };
  1938. static const guint8 VID_draft_ietf_ipsec_nat_t_ike_03[] = { /* draft-ietf-ipsec-nat-t-ike-03 */
  1939. 0x7D, 0x94, 0x19, 0xA6, 0x53, 0x10, 0xCA, 0x6F,
  1940. 0x2C, 0x17, 0x9D, 0x92, 0x15, 0x52, 0x9d, 0x56
  1941. };
  1942. static const guint8 VID_draft_ietf_ipsec_nat_t_ike_04[] = { /* draft-ietf-ipsec-nat-t-ike-04 */
  1943. 0x99, 0x09, 0xb6, 0x4e, 0xed, 0x93, 0x7c, 0x65,
  1944. 0x73, 0xde, 0x52, 0xac, 0xe9, 0x52, 0xfa, 0x6b
  1945. };
  1946. static const guint8 VID_draft_ietf_ipsec_nat_t_ike_05[] = { /* draft-ietf-ipsec-nat-t-ike-05 */
  1947. 0x80, 0xd0, 0xbb, 0x3d, 0xef, 0x54, 0x56, 0x5e,
  1948. 0xe8, 0x46, 0x45, 0xd4, 0xc8, 0x5c, 0xe3, 0xee
  1949. };
  1950. static const guint8 VID_draft_ietf_ipsec_nat_t_ike_06[] = { /* draft-ietf-ipsec-nat-t-ike-06 */
  1951. 0x4d, 0x1e, 0x0e, 0x13, 0x6d, 0xea, 0xfa, 0x34,
  1952. 0xc4, 0xf3, 0xea, 0x9f, 0x02, 0xec, 0x72, 0x85
  1953. };
  1954. static const guint8 VID_draft_ietf_ipsec_nat_t_ike_07[] = { /* draft-ietf-ipsec-nat-t-ike-07 */
  1955. 0x43, 0x9b, 0x59, 0xf8, 0xba, 0x67, 0x6c, 0x4c,
  1956. 0x77, 0x37, 0xae, 0x22, 0xea, 0xb8, 0xf5, 0x82
  1957. };
  1958. static const guint8 VID_draft_ietf_ipsec_nat_t_ike_08[] = { /* draft-ietf-ipsec-nat-t-ike-08 */
  1959. 0x8f, 0x8d, 0x83, 0x82, 0x6d, 0x24, 0x6b, 0x6f,
  1960. 0xc7, 0xa8, 0xa6, 0xa4, 0x28, 0xc1, 0x1d, 0xe8
  1961. };
  1962. static const guint8 VID_draft_ietf_ipsec_nat_t_ike_09[] = { /* draft-ietf-ipsec-nat-t-ike-09 */
  1963. 0x42, 0xea, 0x5b, 0x6f, 0x89, 0x8d, 0x97, 0x73,
  1964. 0xa5, 0x75, 0xdf, 0x26, 0xe7, 0xdd, 0x19, 0xe1
  1965. };
  1966. static const guint8 VID_testing_nat_t_rfc[] = { /* Testing NAT-T RFC */
  1967. 0xc4, 0x0f, 0xee, 0x00, 0xd5, 0xd3, 0x9d, 0xdb,
  1968. 0x1f, 0xc7, 0x62, 0xe0, 0x9b, 0x7c, 0xfe, 0xa7
  1969. };
  1970. static const guint8 VID_rfc3947_nat_t[] = { /* RFC 3947 Negotiation of NAT-Traversal in the IKE */
  1971. 0x4a, 0x13, 0x1c, 0x81, 0x07, 0x03, 0x58, 0x45,
  1972. 0x5c, 0x57, 0x28, 0xf2, 0x0e, 0x95, 0x45, 0x2f
  1973. };
  1974. static const guint8 VID_draft_beaulieu_ike_xauth_02[]= { /* draft-beaulieu-ike-xauth-02.txt 02 or 06 ??*/
  1975. 0x09, 0x00, 0x26, 0x89, 0xDF, 0xD6, 0xB7, 0x12,
  1976. 0x80, 0xA2, 0x24, 0xDE, 0xC3, 0x3B, 0x81, 0xE5
  1977. };
  1978. static const guint8 VID_xauth[]= { /* XAUTH (truncated MD5 hash of "draft-ietf-ipsra-isakmp-xauth-06.txt") */
  1979. 0x09, 0x00, 0x26, 0x89, 0xDF, 0xD6, 0xB7, 0x12
  1980. };
  1981. static const guint8 VID_rfc3706_dpd[]= { /* RFC 3706 */
  1982. 0xAF, 0xCA, 0xD7, 0x13, 0x68, 0xA1, 0xF1, 0xC9,
  1983. 0x6B, 0x86, 0x96, 0xFC, 0x77, 0x57, 0x01, 0x00
  1984. };
  1985. static const guint8 VID_draft_ietf_ipsec_antireplay_00[]= { /* draft-ietf-ipsec-antireplay-00.txt */
  1986. 0x32, 0x5D, 0xF2, 0x9A, 0x23, 0x19, 0xF2, 0xDD
  1987. };
  1988. static const guint8 VID_draft_ietf_ipsec_heartbeats_00[]= { /* draft-ietf-ipsec-heartbeats-00.txt */
  1989. 0x8D, 0xB7, 0xA4, 0x18, 0x11, 0x22, 0x16, 0x60
  1990. };
  1991. static const guint8 VID_IKE_CHALLENGE_RESPONSE_1[]= { /* IKE Challenge/Response for Authenticated Cryptographic Keys */
  1992. 0xBA, 0x29, 0x04, 0x99, 0xC2, 0x4E, 0x84, 0xE5,
  1993. 0x3A, 0x1D, 0x83, 0xA0, 0x5E, 0x5F, 0x00, 0xC9
  1994. };
  1995. static const guint8 VID_IKE_CHALLENGE_RESPONSE_2[]= { /* IKE Challenge/Response for Authenticated Cryptographic Keys */
  1996. 0x0D, 0x33, 0x61, 0x1A, 0x5D, 0x52, 0x1B, 0x5E,
  1997. 0x3C, 0x9C, 0x03, 0xD2, 0xFC, 0x10, 0x7E, 0x12
  1998. };
  1999. static const guint8 VID_IKE_CHALLENGE_RESPONSE_REV_1[]= { /* IKE Challenge/Response for Authenticated Cryptographic Keys (Revised) */
  2000. 0xAD, 0x32, 0x51, 0x04, 0x2C, 0xDC, 0x46, 0x52,
  2001. 0xC9, 0xE0, 0x73, 0x4C, 0xE5, 0xDE, 0x4C, 0x7D
  2002. };
  2003. static const guint8 VID_IKE_CHALLENGE_RESPONSE_REV_2[]= { /* IKE Challenge/Response for Authenticated Cryptographic Keys (Revised) */
  2004. 0x01, 0x3F, 0x11, 0x82, 0x3F, 0x96, 0x6F, 0xA9,
  2005. 0x19, 0x00, 0xF0, 0x24, 0xBA, 0x66, 0xA8, 0x6B
  2006. };
  2007. static const guint8 VID_MS_L2TP_IPSEC_VPN_CLIENT[]= { /* Microsoft L2TP/IPSec VPN Client */
  2008. 0x40, 0x48, 0xB7, 0xD5, 0x6E, 0xBC, 0xE8, 0x85,
  2009. 0x25, 0xE7, 0xDE, 0x7F, 0x00, 0xD6, 0xC2, 0xD3
  2010. };
  2011. static const guint8 VID_MS_VID_INITIAL_CONTACT[]= { /* Microsoft Vid-Initial-Contact */
  2012. 0x26, 0x24, 0x4d, 0x38, 0xed, 0xdb, 0x61, 0xb3,
  2013. 0x17, 0x2a, 0x36, 0xe3, 0xd0, 0xcf, 0xb8, 0x19
  2014. };
  2015. static const guint8 VID_GSS_API_1[]= { /* A GSS-API Authentication Method for IKE */
  2016. 0xB4, 0x6D, 0x89, 0x14, 0xF3, 0xAA, 0xA3, 0xF2,
  2017. 0xFE, 0xDE, 0xB7, 0xC7, 0xDB, 0x29, 0x43, 0xCA
  2018. };
  2019. static const guint8 VID_GSS_API_2[]= { /* A GSS-API Authentication Method for IKE */
  2020. 0xAD, 0x2C, 0x0D, 0xD0, 0xB9, 0xC3, 0x20, 0x83,
  2021. 0xCC, 0xBA, 0x25, 0xB8, 0x86, 0x1E, 0xC4, 0x55
  2022. };
  2023. static const guint8 VID_GSSAPI[]= { /* GSSAPI */
  2024. 0x62, 0x1B, 0x04, 0xBB, 0x09, 0x88, 0x2A, 0xC1,
  2025. 0xE1, 0x59, 0x35, 0xFE, 0xFA, 0x24, 0xAE, 0xEE
  2026. };
  2027. static const guint8 VID_MS_NT5_ISAKMPOAKLEY[]= { /* MS NT5 ISAKMPOAKLEY */
  2028. 0x1E, 0x2B, 0x51, 0x69, 0x05, 0x99, 0x1C, 0x7D,
  2029. 0x7C, 0x96, 0xFC, 0xBF, 0xB5, 0x87, 0xE4, 0x61
  2030. };
  2031. static const guint8 VID_CISCO_UNITY[]= { /* CISCO-UNITY */
  2032. 0x12, 0xF5, 0xF2, 0x8C, 0x45, 0x71, 0x68, 0xA9,
  2033. 0x70, 0x2D, 0x9F, 0xE2, 0x74, 0xCC
  2034. };
  2035. static const guint8 VID_CISCO_CONCENTRATOR[]= { /* CISCO-CONCENTRATOR */
  2036. 0x1F, 0x07, 0xF7, 0x0E, 0xAA, 0x65, 0x14, 0xD3,
  2037. 0xB0, 0xFA, 0x96, 0x54, 0x2A, 0x50, 0x01, 0x00
  2038. };
  2039. static const guint8 VID_CISCO_FRAG[] = { /* Cisco Fragmentation */
  2040. 0x40, 0x48, 0xB7, 0xD5, 0x6E, 0xBC, 0xE8, 0x85,
  2041. 0x25, 0xE7, 0xDE, 0x7F, 0x00, 0xD6, 0xC2, 0xD3,
  2042. 0x80, 0x00, 0x00, 0x00
  2043. };
  2044. static const guint8 VID_CP[] = { /* Check Point */
  2045. 0xF4, 0xED, 0x19, 0xE0, 0xC1, 0x14, 0xEB, 0x51,
  2046. 0x6F, 0xAA, 0xAC, 0x0E, 0xE3, 0x7D, 0xAF, 0x28,
  2047. 0x7, 0xB4, 0x38, 0x1F
  2048. };
  2049. static const guint8 VID_CYBERGUARD[] = { /* CyberGuard */
  2050. 0x9A, 0xA1, 0xF3, 0xB4, 0x34, 0x72, 0xA4, 0x5D,
  2051. 0x5F, 0x50, 0x6A, 0xEB, 0x26, 0xC0, 0xF2, 0x14
  2052. };
  2053. static const guint8 VID_SHREWSOFT[] = { /* Shrew Soft */
  2054. 0xf1, 0x4b, 0x94, 0xb7, 0xbf, 0xf1, 0xfe, 0xf0,
  2055. 0x27, 0x73, 0xb8, 0xc4, 0x9f, 0xed, 0xed, 0x26
  2056. };
  2057. static const guint8 VID_STRONGSWAN[] = { /* strongSwan */
  2058. 0x88, 0x2f, 0xe5, 0x6d, 0x6f, 0xd2, 0x0d, 0xbc,
  2059. 0x22, 0x51, 0x61, 0x3b, 0x2e, 0xbe, 0x5b, 0xeb
  2060. };
  2061. static const guint8 VID_KAME_RACOON[] = { /* KAME/racoon */
  2062. 0x70, 0x03, 0xcb, 0xc1, 0x09, 0x7d, 0xbe, 0x9c,
  2063. 0x26, 0x00, 0xba, 0x69, 0x83, 0xbc, 0x8b, 0x35
  2064. };
  2065. static const guint8 VID_IPSEC_TOOLS[] = { /* IPsec-Tools */
  2066. 0x20, 0xa3, 0x62, 0x2c, 0x1c, 0xea, 0x7c, 0xe3,
  2067. 0x7b, 0xee, 0x3c, 0xa4, 0x84, 0x42, 0x52, 0x76
  2068. };
  2069. static const guint8 VID_NETSCREEN_1[] = { /* Netscreen-1 */
  2070. 0x29, 0x9e, 0xe8, 0x28, 0x9f, 0x40, 0xa8, 0x97,
  2071. 0x3b, 0xc7, 0x86, 0x87, 0xe2, 0xe7, 0x22, 0x6b,
  2072. 0x53, 0x2c, 0x3b, 0x76
  2073. };
  2074. static const guint8 VID_NETSCREEN_2[] = { /* Netscreen-2 */
  2075. 0x3a, 0x15, 0xe1, 0xf3, 0xcf, 0x2a, 0x63, 0x58,
  2076. 0x2e, 0x3a, 0xc8, 0x2d, 0x1c, 0x64, 0xcb, 0xe3,
  2077. 0xb6, 0xd7, 0x79, 0xe7
  2078. };
  2079. static const guint8 VID_NETSCREEN_3[] = { /* Netscreen-3 */
  2080. 0x47, 0xd2, 0xb1, 0x26, 0xbf, 0xcd, 0x83, 0x48,
  2081. 0x97, 0x60, 0xe2, 0xcf, 0x8c, 0x5d, 0x4d, 0x5a,
  2082. 0x03, 0x49, 0x7c, 0x15
  2083. };
  2084. static const guint8 VID_NETSCREEN_4[] = { /* Netscreen-4 */
  2085. 0x4a, 0x43, 0x40, 0xb5, 0x43, 0xe0, 0x2b, 0x84,
  2086. 0xc8, 0x8a, 0x8b, 0x96, 0xa8, 0xaf, 0x9e, 0xbe,
  2087. 0x77, 0xd9, 0xac, 0xcc
  2088. };
  2089. static const guint8 VID_NETSCREEN_5[] = { /* Netscreen-5 */
  2090. 0x64, 0x40, 0x5f, 0x46, 0xf0, 0x3b, 0x76, 0x60,
  2091. 0xa2, 0x3b, 0xe1, 0x16, 0xa1, 0x97, 0x50, 0x58,
  2092. 0xe6, 0x9e, 0x83, 0x87
  2093. };
  2094. static const guint8 VID_NETSCREEN_6[] = { /* Netscreen-6 */
  2095. 0x69, 0x93, 0x69, 0x22, 0x87, 0x41, 0xc6, 0xd4,
  2096. 0xca, 0x09, 0x4c, 0x93, 0xe2, 0x42, 0xc9, 0xde,
  2097. 0x19, 0xe7, 0xb7, 0xc6
  2098. };
  2099. static const guint8 VID_NETSCREEN_7[] = { /* Netscreen-7 */
  2100. 0x8c, 0x0d, 0xc6, 0xcf, 0x62, 0xa0, 0xef, 0x1b,
  2101. 0x5c, 0x6e, 0xab, 0xd1, 0xb6, 0x7b, 0xa6, 0x98,
  2102. 0x66, 0xad, 0xf1, 0x6a
  2103. };
  2104. static const guint8 VID_NETSCREEN_8[] = { /* Netscreen-8 */
  2105. 0x92, 0xd2, 0x7a, 0x9e, 0xcb, 0x31, 0xd9, 0x92,
  2106. 0x46, 0x98, 0x6d, 0x34, 0x53, 0xd0, 0xc3, 0xd5,
  2107. 0x7a, 0x22, 0x2a, 0x61
  2108. };
  2109. static const guint8 VID_NETSCREEN_9[] = { /* Netscreen-9 */
  2110. 0x9b, 0x09, 0x6d, 0x9a, 0xc3, 0x27, 0x5a, 0x7d,
  2111. 0x6f, 0xe8, 0xb9, 0x1c, 0x58, 0x31, 0x11, 0xb0,
  2112. 0x9e, 0xfe, 0xd1, 0xa0
  2113. };
  2114. static const guint8 VID_NETSCREEN_10[] = { /* Netscreen-10 */
  2115. 0xbf, 0x03, 0x74, 0x61, 0x08, 0xd7, 0x46, 0xc9,
  2116. 0x04, 0xf1, 0xf3, 0x54, 0x7d, 0xe2, 0x4f, 0x78,
  2117. 0x47, 0x9f, 0xed, 0x12
  2118. };
  2119. static const guint8 VID_NETSCREEN_11[] = { /* Netscreen-11 */
  2120. 0xc2, 0xe8, 0x05, 0x00, 0xf4, 0xcc, 0x5f, 0xbf,
  2121. 0x5d, 0xaa, 0xee, 0xd3, 0xbb, 0x59, 0xab, 0xae,
  2122. 0xee, 0x56, 0xc6, 0x52
  2123. };
  2124. static const guint8 VID_NETSCREEN_12[] = { /* Netscreen-12 */
  2125. 0xc8, 0x66, 0x0a, 0x62, 0xb0, 0x3b, 0x1b, 0x61,
  2126. 0x30, 0xbf, 0x78, 0x16, 0x08, 0xd3, 0x2a, 0x6a,
  2127. 0x8d, 0x0f, 0xb8, 0x9f
  2128. };
  2129. static const guint8 VID_NETSCREEN_13[] = { /* Netscreen-13 */
  2130. 0xf8, 0x85, 0xda, 0x40, 0xb1, 0xe7, 0xa9, 0xab,
  2131. 0xd1, 0x76, 0x55, 0xec, 0x5b, 0xbe, 0xc0, 0xf2,
  2132. 0x1f, 0x0e, 0xd5, 0x2e
  2133. };
  2134. static const guint8 VID_NETSCREEN_14[] = { /* Netscreen-14 */
  2135. 0x2a, 0x2b, 0xca, 0xc1, 0x9b, 0x8e, 0x91, 0xb4,
  2136. 0x26, 0x10, 0x78, 0x07, 0xe0, 0x2e, 0x72, 0x49,
  2137. 0x56, 0x9d, 0x6f, 0xd3
  2138. };
  2139. static const guint8 VID_NETSCREEN_15[] = { /* Netscreen-15 */
  2140. 0x16, 0x6f, 0x93, 0x2d, 0x55, 0xeb, 0x64, 0xd8,
  2141. 0xe4, 0xdf, 0x4f, 0xd3, 0x7e, 0x23, 0x13, 0xf0,
  2142. 0xd0, 0xfd, 0x84, 0x51
  2143. };
  2144. static const guint8 VID_NETSCREEN_16[] = { /* Netscreen-16 */
  2145. 0xa3, 0x5b, 0xfd, 0x05, 0xca, 0x1a, 0xc0, 0xb3,
  2146. 0xd2, 0xf2, 0x4e, 0x9e, 0x82, 0xbf, 0xcb, 0xff,
  2147. 0x9c, 0x9e, 0x52, 0xb5
  2148. };
  2149. static const guint8 VID_ZYWALL[] = { /* ZYWALL */
  2150. 0x62, 0x50, 0x27, 0x74, 0x9d, 0x5a, 0xb9, 0x7f,
  2151. 0x56, 0x16, 0xc1, 0x60, 0x27, 0x65, 0xcf, 0x48,
  2152. 0x0a, 0x3b, 0x7d, 0x0b
  2153. };
  2154. static const guint8 VID_SIDEWINDER[] = { /* SIDEWINDER */
  2155. 0x84, 0x04, 0xad, 0xf9, 0xcd, 0xa0, 0x57, 0x60,
  2156. 0xb2, 0xca, 0x29, 0x2e, 0x4b, 0xff, 0x53, 0x7b
  2157. };
  2158. static const guint8 VID_SONICWALL[] = { /* SonicWALL */
  2159. 0x40, 0x4B, 0xF4, 0x39, 0x52, 0x2C, 0xA3, 0xF6
  2160. };
  2161. static const guint8 VID_HEARTBEAT_NOTIFY[] = { /* Heartbeat Notify */
  2162. 0x48 ,0x65, 0x61, 0x72, 0x74, 0x42, 0x65, 0x61,
  2163. 0x74, 0x5f, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79
  2164. };
  2165. static const guint8 VID_DWR[] = { /* DWR: Delete with reason */
  2166. 0x2D, 0x79, 0x22, 0xC6, 0xB3, 0x01, 0xD9, 0xB0,
  2167. 0xE1, 0x34, 0x27, 0x39, 0xE9, 0xCF, 0xBB, 0xD5
  2168. };
  2169. static const guint8 VID_ARUBA_RAP[] = { /* Remote AP (Aruba Networks) */
  2170. 0xca, 0x3e, 0x2b, 0x85, 0x4b, 0xa8, 0x03, 0x00,
  2171. 0x17, 0xdc, 0x10, 0x23, 0xa4, 0xfd, 0xe2, 0x04,
  2172. 0x1f, 0x9f, 0x74, 0x63
  2173. };
  2174. static const guint8 VID_ARUBA_CONTROLLER[] = { /* Controller (Aruba Networks) */
  2175. 0x3c, 0x8e, 0x70, 0xbd, 0xf9, 0xc7, 0xd7, 0x4a,
  2176. 0xdd, 0x53, 0xe4, 0x10, 0x09, 0x15, 0xdc, 0x2e,
  2177. 0x4b, 0xb5, 0x12, 0x74
  2178. };
  2179. static const guint8 VID_ARUBA_VIA_CLIENT[] = { /* VIA Client (Aruba Networks) */
  2180. 0x88, 0xf0, 0xe3, 0x14, 0x9b, 0x3f, 0xa4, 0x8b,
  2181. 0x05, 0xaa, 0x7f, 0x68, 0x5f, 0x0b, 0x76, 0x6b,
  2182. 0xe1, 0x86, 0xcc, 0xb8
  2183. };
  2184. static const guint8 VID_ARUBA_VIA_AUTH_PROFILE[] = { /* VIA Auth Profile (Aruba Networks) */
  2185. 0x56, 0x49, 0x41, 0x20, 0x41, 0x75, 0x74, 0x68,
  2186. 0x20, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65,
  2187. 0x20, 0x3a, 0x20
  2188. };
  2189. /* Based from value_string.c/h */
  2190. static const byte_string vendor_id[] = {
  2191. { VID_SSH_IPSEC_EXPRESS_1_1_0, sizeof(VID_SSH_IPSEC_EXPRESS_1_1_0), "Ssh Communications Security IPSEC Express version 1.1.0" },
  2192. { VID_SSH_IPSEC_EXPRESS_1_1_1, sizeof(VID_SSH_IPSEC_EXPRESS_1_1_1), "Ssh Communications Security IPSEC Express version 1.1.1" },
  2193. { VID_SSH_IPSEC_EXPRESS_1_1_2, sizeof(VID_SSH_IPSEC_EXPRESS_1_1_2), "Ssh Communications Security IPSEC Express version 1.1.2" },
  2194. { VID_SSH_IPSEC_EXPRESS_1_2_1, sizeof(VID_SSH_IPSEC_EXPRESS_1_2_1), "Ssh Communications Security IPSEC Express version 1.2.1" },
  2195. { VID_SSH_IPSEC_EXPRESS_1_2_2, sizeof(VID_SSH_IPSEC_EXPRESS_1_2_2), "Ssh Communications Security IPSEC Express version 1.2.2" },
  2196. { VID_SSH_IPSEC_EXPRESS_2_0_0, sizeof(VID_SSH_IPSEC_EXPRESS_2_0_0), "SSH Communications Security IPSEC Express version 2.0.0" },
  2197. { VID_SSH_IPSEC_EXPRESS_2_1_0, sizeof(VID_SSH_IPSEC_EXPRESS_2_1_0), "SSH Communications Security IPSEC Express version 2.1.0" },
  2198. { VID_SSH_IPSEC_EXPRESS_2_1_1, sizeof(VID_SSH_IPSEC_EXPRESS_2_1_1), "SSH Communications Security IPSEC Express version 2.1.1" },
  2199. { VID_SSH_IPSEC_EXPRESS_2_1_2, sizeof(VID_SSH_IPSEC_EXPRESS_2_1_2), "SSH Communications Security IPSEC Express version 2.1.2" },
  2200. { VID_SSH_IPSEC_EXPRESS_3_0_0, sizeof(VID_SSH_IPSEC_EXPRESS_3_0_0), "SSH Communications Security IPSEC Express version 3.0.0" },
  2201. { VID_SSH_IPSEC_EXPRESS_3_0_1, sizeof(VID_SSH_IPSEC_EXPRESS_3_0_1), "SSH Communications Security IPSEC Express version 3.0.1" },
  2202. { VID_SSH_IPSEC_EXPRESS_4_0_0, sizeof(VID_SSH_IPSEC_EXPRESS_4_0_0), "SSH Communications Security IPSEC Express version 4.0.0" },
  2203. { VID_SSH_IPSEC_EXPRESS_4_0_1, sizeof(VID_SSH_IPSEC_EXPRESS_4_0_1), "SSH Communications Security IPSEC Express version 4.0.1" },
  2204. { VID_SSH_IPSEC_EXPRESS_4_1_0, sizeof(VID_SSH_IPSEC_EXPRESS_4_1_0), "SSH Communications Security IPSEC Express version 4.1.0" },
  2205. { VID_SSH_IPSEC_EXPRESS_4_1_1, sizeof(VID_SSH_IPSEC_EXPRESS_4_1_1), "SSH Communications Security IPSEC Express version 4.1.1" },
  2206. { VID_SSH_IPSEC_EXPRESS_4_2_0, sizeof(VID_SSH_IPSEC_EXPRESS_4_2_0), "SSH Communications Security IPSEC Express version 4.2.0" },
  2207. { VID_SSH_IPSEC_EXPRESS_5_0, sizeof(VID_SSH_IPSEC_EXPRESS_5_0), "SSH Communications Security IPSEC Express version 5.0" },
  2208. { VID_SSH_IPSEC_EXPRESS_5_0_0, sizeof(VID_SSH_IPSEC_EXPRESS_5_0_0), "SSH Communications Security IPSEC Express version 5.0.0" },
  2209. { VID_SSH_IPSEC_EXPRESS_5_1_0, sizeof(VID_SSH_IPSEC_EXPRESS_5_1_0), "SSH Communications Security IPSEC Express version 5.1.0" },
  2210. { VID_SSH_IPSEC_EXPRESS_5_1_1, sizeof(VID_SSH_IPSEC_EXPRESS_5_1_1), "SSH Communications Security IPSEC Express version 5.1.1" },
  2211. { VID_SSH_SENTINEL, sizeof(VID_SSH_SENTINEL), "SSH Sentinel" },
  2212. { VID_SSH_SENTINEL_1_1, sizeof(VID_SSH_SENTINEL_1_1), "SSH Sentinel 1.1" },
  2213. { VID_SSH_SENTINEL_1_2, sizeof(VID_SSH_SENTINEL_1_2), "SSH Sentinel 1.2" },
  2214. { VID_SSH_SENTINEL_1_3, sizeof(VID_SSH_SENTINEL_1_3), "SSH Sentinel 1.3" },
  2215. { VID_SSH_SENTINEL_1_4, sizeof(VID_SSH_SENTINEL_1_4), "SSH Sentinel 1.4" },
  2216. { VID_SSH_SENTINEL_1_4_1, sizeof(VID_SSH_SENTINEL_1_4_1), "SSH Sentinel 1.4.1" },
  2217. { VID_SSH_QUICKSEC_0_9_0, sizeof(VID_SSH_QUICKSEC_0_9_0), "SSH Communications Security QuickSec 0.9.0" },
  2218. { VID_SSH_QUICKSEC_1_1_0, sizeof(VID_SSH_QUICKSEC_1_1_0), "SSH Communications Security QuickSec 1.1.0" },
  2219. { VID_SSH_QUICKSEC_1_1_1, sizeof(VID_SSH_QUICKSEC_1_1_1), "SSH Communications Security QuickSec 1.1.1" },
  2220. { VID_SSH_QUICKSEC_1_1_2, sizeof(VID_SSH_QUICKSEC_1_1_2), "SSH Communications Security QuickSec 1.1.2" },
  2221. { VID_SSH_QUICKSEC_1_1_3, sizeof(VID_SSH_QUICKSEC_1_1_3), "SSH Communications Security QuickSec 1.1.3" },
  2222. { VID_draft_huttunen_ipsec_esp_in_udp_00, sizeof(VID_draft_huttunen_ipsec_esp_in_udp_00), "draft-huttunen-ipsec-esp-in-udp-00.txt" },
  2223. { VID_draft_huttunen_ipsec_esp_in_udp_01, sizeof(VID_draft_huttunen_ipsec_esp_in_udp_01), "draft-huttunen-ipsec-esp-in-udp-01.txt (ESPThruNAT)" },
  2224. { VID_draft_stenberg_ipsec_nat_traversal_01, sizeof(VID_draft_stenberg_ipsec_nat_traversal_01), "draft-stenberg-ipsec-nat-traversal-01" },
  2225. { VID_draft_stenberg_ipsec_nat_traversal_02, sizeof(VID_draft_stenberg_ipsec_nat_traversal_02), "draft-stenberg-ipsec-nat-traversal-02" },
  2226. { VID_draft_ietf_ipsec_nat_t_ike, sizeof(VID_draft_ietf_ipsec_nat_t_ike), "draft-ietf-ipsec-nat-t-ike" },
  2227. { VID_draft_ietf_ipsec_nat_t_ike_00, sizeof(VID_draft_ietf_ipsec_nat_t_ike_00), "draft-ietf-ipsec-nat-t-ike-00" },
  2228. { VID_draft_ietf_ipsec_nat_t_ike_01, sizeof(VID_draft_ietf_ipsec_nat_t_ike_01), "draft-ietf-ipsec-nat-t-ike-01" },
  2229. { VID_draft_ietf_ipsec_nat_t_ike_02, sizeof(VID_draft_ietf_ipsec_nat_t_ike_02), "draft-ietf-ipsec-nat-t-ike-02" },
  2230. { VID_draft_ietf_ipsec_nat_t_ike_02n, sizeof(VID_draft_ietf_ipsec_nat_t_ike_02n), "draft-ietf-ipsec-nat-t-ike-02\\n" },
  2231. { VID_draft_ietf_ipsec_nat_t_ike_03, sizeof(VID_draft_ietf_ipsec_nat_t_ike_03), "draft-ietf-ipsec-nat-t-ike-03" },
  2232. { VID_draft_ietf_ipsec_nat_t_ike_04, sizeof(VID_draft_ietf_ipsec_nat_t_ike_04), "draft-ietf-ipsec-nat-t-ike-04" },
  2233. { VID_draft_ietf_ipsec_nat_t_ike_05, sizeof(VID_draft_ietf_ipsec_nat_t_ike_05), "draft-ietf-ipsec-nat-t-ike-05" },
  2234. { VID_draft_ietf_ipsec_nat_t_ike_06, sizeof(VID_draft_ietf_ipsec_nat_t_ike_06), "draft-ietf-ipsec-nat-t-ike-06" },
  2235. { VID_draft_ietf_ipsec_nat_t_ike_07, sizeof(VID_draft_ietf_ipsec_nat_t_ike_07), "draft-ietf-ipsec-nat-t-ike-07" },
  2236. { VID_draft_ietf_ipsec_nat_t_ike_08, sizeof(VID_draft_ietf_ipsec_nat_t_ike_08), "draft-ietf-ipsec-nat-t-ike-08" },
  2237. { VID_draft_ietf_ipsec_nat_t_ike_09, sizeof(VID_draft_ietf_ipsec_nat_t_ike_09), "draft-ietf-ipsec-nat-t-ike-09" },
  2238. { VID_testing_nat_t_rfc, sizeof(VID_testing_nat_t_rfc), "Testing NAT-T RFC" },
  2239. { VID_rfc3947_nat_t, sizeof(VID_rfc3947_nat_t), "RFC 3947 Negotiation of NAT-Traversal in the IKE" },
  2240. { VID_draft_beaulieu_ike_xauth_02, sizeof(VID_draft_beaulieu_ike_xauth_02), "draft-beaulieu-ike-xauth-02.txt" },
  2241. { VID_xauth, sizeof(VID_xauth), "XAUTH" },
  2242. { VID_rfc3706_dpd, sizeof(VID_rfc3706_dpd), "RFC 3706 DPD (Dead Peer Detection)" },
  2243. { VID_draft_ietf_ipsec_antireplay_00, sizeof(VID_draft_ietf_ipsec_antireplay_00), "draft-ietf-ipsec-antireplay-00.txt" },
  2244. { VID_draft_ietf_ipsec_heartbeats_00, sizeof(VID_draft_ietf_ipsec_heartbeats_00), "draft-ietf-ipsec-heartbeats-00.txt" },
  2245. { VID_IKE_CHALLENGE_RESPONSE_1, sizeof(VID_IKE_CHALLENGE_RESPONSE_1), "IKE Challenge/Response for Authenticated Cryptographic Keys" },
  2246. { VID_IKE_CHALLENGE_RESPONSE_2, sizeof(VID_IKE_CHALLENGE_RESPONSE_2), "IKE Challenge/Response for Authenticated Cryptographic Keys" },
  2247. { VID_IKE_CHALLENGE_RESPONSE_REV_1, sizeof(VID_IKE_CHALLENGE_RESPONSE_REV_1), "IKE Challenge/Response for Authenticated Cryptographic Keys (Revised)" },
  2248. { VID_IKE_CHALLENGE_RESPONSE_REV_2, sizeof(VID_IKE_CHALLENGE_RESPONSE_REV_2), "IKE Challenge/Response for Authenticated Cryptographic Keys (Revised)" },
  2249. { VID_MS_L2TP_IPSEC_VPN_CLIENT, sizeof(VID_MS_L2TP_IPSEC_VPN_CLIENT), "Microsoft L2TP/IPSec VPN Client" },
  2250. { VID_MS_VID_INITIAL_CONTACT, sizeof(VID_MS_VID_INITIAL_CONTACT), "Microsoft Vid-Initial-Contact" },
  2251. { VID_GSS_API_1, sizeof(VID_GSS_API_1), "A GSS-API Authentication Method for IKE" },
  2252. { VID_GSS_API_2, sizeof(VID_GSS_API_2), "A GSS-API Authentication Method for IKE" },
  2253. { VID_GSSAPI, sizeof(VID_GSSAPI), "GSSAPI" },
  2254. { VID_MS_NT5_ISAKMPOAKLEY, sizeof(VID_MS_NT5_ISAKMPOAKLEY), "MS NT5 ISAKMPOAKLEY" },
  2255. { VID_CISCO_UNITY, sizeof(VID_CISCO_UNITY), "CISCO-UNITY" },
  2256. { VID_CISCO_CONCENTRATOR, sizeof(VID_CISCO_CONCENTRATOR), "CISCO-CONCENTRATOR" },
  2257. { VID_CISCO_FRAG, sizeof(VID_CISCO_FRAG), "Cisco Fragmentation" },
  2258. { VID_CP, sizeof(VID_CP), "Check Point" },
  2259. { VID_CYBERGUARD, sizeof(VID_CYBERGUARD), "CyberGuard" },
  2260. { VID_SHREWSOFT, sizeof(VID_SHREWSOFT), "Shrew Soft" },
  2261. { VID_STRONGSWAN, sizeof(VID_STRONGSWAN), "strongSwan" },
  2262. { VID_KAME_RACOON, sizeof(VID_KAME_RACOON), "KAME/racoon" },
  2263. { VID_IPSEC_TOOLS, sizeof(VID_IPSEC_TOOLS), "IPSec-Tools" },
  2264. { VID_NETSCREEN_1, sizeof(VID_NETSCREEN_1), "Netscreen-1" },
  2265. { VID_NETSCREEN_2, sizeof(VID_NETSCREEN_2), "Netscreen-2" },
  2266. { VID_NETSCREEN_3, sizeof(VID_NETSCREEN_3), "Netscreen-3" },
  2267. { VID_NETSCREEN_4, sizeof(VID_NETSCREEN_4), "Netscreen-4" },
  2268. { VID_NETSCREEN_5, sizeof(VID_NETSCREEN_5), "Netscreen-5" },
  2269. { VID_NETSCREEN_6, sizeof(VID_NETSCREEN_6), "Netscreen-6" },
  2270. { VID_NETSCREEN_7, sizeof(VID_NETSCREEN_7), "Netscreen-7" },
  2271. { VID_NETSCREEN_8, sizeof(VID_NETSCREEN_8), "Netscreen-8" },
  2272. { VID_NETSCREEN_9, sizeof(VID_NETSCREEN_9), "Netscreen-9" },
  2273. { VID_NETSCREEN_10, sizeof(VID_NETSCREEN_10), "Netscreen-10" },
  2274. { VID_NETSCREEN_11, sizeof(VID_NETSCREEN_11), "Netscreen-11" },
  2275. { VID_NETSCREEN_12, sizeof(VID_NETSCREEN_12), "Netscreen-12" },
  2276. { VID_NETSCREEN_13, sizeof(VID_NETSCREEN_13), "Netscreen-13" },
  2277. { VID_NETSCREEN_14, sizeof(VID_NETSCREEN_14), "Netscreen-14" },
  2278. { VID_NETSCREEN_15, sizeof(VID_NETSCREEN_15), "Netscreen-15" },
  2279. { VID_NETSCREEN_16, sizeof(VID_NETSCREEN_16), "Netscreen-16" },
  2280. { VID_ZYWALL, sizeof(VID_ZYWALL), "ZYWALL" },
  2281. { VID_SIDEWINDER, sizeof(VID_SIDEWINDER), "SIDEWINDER" },
  2282. { VID_SONICWALL, sizeof(VID_SONICWALL), "SonicWALL" },
  2283. { VID_HEARTBEAT_NOTIFY, sizeof(VID_HEARTBEAT_NOTIFY), "Heartbeat Notify" },
  2284. { VID_DWR, sizeof(VID_DWR), "DWR: Delete with reason" },
  2285. { VID_ARUBA_RAP, sizeof(VID_ARUBA_RAP), "Remote AP (Aruba Networks)" },
  2286. { VID_ARUBA_CONTROLLER, sizeof(VID_ARUBA_CONTROLLER), "Controller (Aruba Networks)" },
  2287. { VID_ARUBA_VIA_CLIENT, sizeof(VID_ARUBA_VIA_CLIENT), "VIA Client (Aruba Networks)" },
  2288. { VID_ARUBA_VIA_AUTH_PROFILE, sizeof(VID_ARUBA_VIA_AUTH_PROFILE), "VIA Auth Profile (Aruba Networks)" },
  2289. { 0, 0, NULL }
  2290. };
  2291. /* Tries to match val against each element in the value_string array vs.
  2292. Returns the associated string ptr, and sets "*idx" to the index in
  2293. that table, on a match, and returns NULL, and sets "*idx" to -1,
  2294. on failure. */
  2295. static const gchar*
  2296. match_strbyte_idx(const guint8 *val, const gint val_len, const byte_string *vs, gint *idx) {
  2297. gint i = 0;
  2298. if (vs) {
  2299. while (vs[i].strptr) {
  2300. if (val_len >= vs[i].len && !memcmp(vs[i].value, val, vs[i].len)) {
  2301. *idx = i;
  2302. return(vs[i].strptr);
  2303. }
  2304. i++;
  2305. }
  2306. }
  2307. *idx = -1;
  2308. return NULL;
  2309. }
  2310. /* Like match_strbyte_idx(), but doesn't return the index. */
  2311. static const gchar*
  2312. match_strbyte(const guint8 *val,const gint val_len, const byte_string *vs) {
  2313. gint ignore_me;
  2314. return match_strbyte_idx(val, val_len, vs, &ignore_me);
  2315. }
  2316. /* Tries to match val against each element in the value_string array vs.
  2317. Returns the associated string ptr on a match.
  2318. Formats val with fmt, and returns the resulting string, on failure. */
  2319. static const gchar*
  2320. byte_to_str(const guint8 *val,const gint val_len, const byte_string *vs, const char *fmt) {
  2321. const gchar *ret;
  2322. DISSECTOR_ASSERT(fmt != NULL);
  2323. ret = match_strbyte(val, val_len, vs);
  2324. if (ret != NULL)
  2325. return ret;
  2326. return ep_strdup_printf(fmt, val);
  2327. }
  2328. static void
  2329. dissect_payloads(tvbuff_t *tvb, proto_tree *tree, proto_tree *parent_tree _U_,
  2330. int isakmp_version, guint8 initial_payload, int offset, int length,
  2331. packet_info *pinfo)
  2332. {
  2333. guint8 payload, next_payload;
  2334. guint16 payload_length;
  2335. proto_tree * ntree;
  2336. for (payload = initial_payload; length > 0; payload = next_payload) {
  2337. if (payload == PLOAD_IKE_NONE) {
  2338. /*
  2339. * What? There's more stuff in this chunk of data, but the
  2340. * previous payload had a "next payload" type of None?
  2341. */
  2342. proto_tree_add_item(tree, hf_isakmp_extradata, tvb, offset, length, ENC_NA);
  2343. break;
  2344. }
  2345. ntree = dissect_payload_header(tvb, offset, length, isakmp_version, payload, &next_payload, &payload_length, tree);
  2346. if (ntree == NULL)
  2347. break;
  2348. if (payload_length >= 4) { /* XXX = > 4? */
  2349. tvb_ensure_bytes_exist(tvb, offset + 4, payload_length - 4);
  2350. switch(payload){
  2351. case PLOAD_IKE_SA:
  2352. case PLOAD_IKE2_SA:
  2353. dissect_sa(tvb, offset + 4, payload_length - 4, ntree, isakmp_version, pinfo );
  2354. break;
  2355. case PLOAD_IKE_P:
  2356. dissect_proposal(tvb, offset + 4, payload_length - 4, ntree, isakmp_version, pinfo );
  2357. break;
  2358. case PLOAD_IKE_KE:
  2359. case PLOAD_IKE2_KE:
  2360. dissect_key_exch(tvb, offset + 4, payload_length - 4, ntree, isakmp_version, pinfo );
  2361. break;
  2362. case PLOAD_IKE_ID:
  2363. case PLOAD_IKE2_IDI:
  2364. case PLOAD_IKE2_IDR:
  2365. dissect_id(tvb, offset + 4, payload_length - 4, ntree, isakmp_version, pinfo );
  2366. break;
  2367. case PLOAD_IKE_CERT:
  2368. case PLOAD_IKE2_CERT:
  2369. dissect_cert(tvb, offset + 4, payload_length - 4, ntree, isakmp_version, pinfo );
  2370. break;
  2371. case PLOAD_IKE_CR:
  2372. case PLOAD_IKE2_CERTREQ:
  2373. dissect_certreq(tvb, offset + 4, payload_length - 4, ntree, isakmp_version, pinfo );
  2374. break;
  2375. case PLOAD_IKE_HASH:
  2376. dissect_hash(tvb, offset + 4, payload_length - 4, ntree);
  2377. break;
  2378. case PLOAD_IKE_SIG:
  2379. dissect_sig(tvb, offset + 4, payload_length - 4, ntree);
  2380. break;
  2381. case PLOAD_IKE_NONCE:
  2382. case PLOAD_IKE2_NONCE:
  2383. dissect_nonce(tvb, offset + 4, payload_length - 4, ntree);
  2384. break;
  2385. case PLOAD_IKE_N:
  2386. case PLOAD_IKE2_N:
  2387. dissect_notif(tvb, offset + 4, payload_length - 4, ntree, isakmp_version);
  2388. break;
  2389. case PLOAD_IKE_D:
  2390. case PLOAD_IKE2_D:
  2391. dissect_delete(tvb, offset + 4, payload_length - 4, ntree, isakmp_version);
  2392. break;
  2393. case PLOAD_IKE_VID:
  2394. case PLOAD_IKE2_V:
  2395. dissect_vid(tvb, offset + 4, payload_length - 4, ntree);
  2396. break;
  2397. case PLOAD_IKE_A:
  2398. case PLOAD_IKE2_CP:
  2399. dissect_config(tvb, offset + 4, payload_length - 4, ntree, isakmp_version);
  2400. break;
  2401. case PLOAD_IKE2_AUTH:
  2402. dissect_auth(tvb, offset + 4, payload_length - 4, ntree);
  2403. break;
  2404. case PLOAD_IKE2_TSI:
  2405. case PLOAD_IKE2_TSR:
  2406. dissect_ts(tvb, offset + 4, payload_length - 4, ntree);
  2407. break;
  2408. case PLOAD_IKE2_SK:
  2409. if(isakmp_version == 2)
  2410. dissect_enc(tvb, offset + 4, payload_length - 4, ntree, pinfo, next_payload);
  2411. break;
  2412. case PLOAD_IKE2_EAP:
  2413. dissect_eap(tvb, offset + 4, payload_length - 4, ntree, pinfo );
  2414. break;
  2415. case PLOAD_IKE2_GSPM:
  2416. dissect_gspm(tvb, offset + 4, payload_length - 4, ntree);
  2417. break;
  2418. case PLOAD_IKE_NAT_D:
  2419. case PLOAD_IKE_NAT_D13:
  2420. case PLOAD_IKE_NAT_D48:
  2421. dissect_nat_discovery(tvb, offset + 4, payload_length - 4, ntree );
  2422. break;
  2423. case PLOAD_IKE_NAT_OA:
  2424. case PLOAD_IKE_NAT_OA14:
  2425. case PLOAD_IKE_NAT_OA58:
  2426. dissect_nat_original_address(tvb, offset + 4, payload_length - 4, ntree, isakmp_version );
  2427. break;
  2428. case PLOAD_IKE_CISCO_FRAG:
  2429. dissect_cisco_fragmentation(tvb, offset + 4, payload_length - 4, ntree, pinfo );
  2430. break;
  2431. default:
  2432. proto_tree_add_item(ntree, hf_isakmp_datapayload, tvb, offset + 4, payload_length-4, ENC_NA);
  2433. break;
  2434. }
  2435. }
  2436. else if (payload_length > length) {
  2437. proto_tree_add_text(ntree, tvb, 0, 0,
  2438. "Payload (bogus, length is %u, greater than remaining length %d",
  2439. payload_length, length);
  2440. return;
  2441. }
  2442. else {
  2443. proto_tree_add_text(ntree, tvb, 0, 0,
  2444. "Payload (bogus, length is %u, must be at least 4)",
  2445. payload_length);
  2446. payload_length = 4;
  2447. }
  2448. offset += payload_length;
  2449. length -= payload_length;
  2450. }
  2451. }
  2452. void
  2453. isakmp_dissect_payloads(tvbuff_t *tvb, proto_tree *tree, int isakmp_version,
  2454. guint8 initial_payload, int offset, int length,
  2455. packet_info *pinfo)
  2456. {
  2457. dissect_payloads(tvb, tree, tree, isakmp_version, initial_payload, offset, length,
  2458. pinfo);
  2459. }
  2460. static void
  2461. dissect_isakmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
  2462. {
  2463. int offset = 0, len;
  2464. isakmp_hdr_t hdr;
  2465. proto_item * ti, *vers_item;
  2466. proto_tree * isakmp_tree = NULL, *vers_tree;
  2467. int isakmp_version;
  2468. #ifdef HAVE_LIBGCRYPT
  2469. guint8 i_cookie[COOKIE_SIZE], *ic_key;
  2470. decrypt_data_t *decr = NULL;
  2471. tvbuff_t *decr_tvb;
  2472. proto_tree *decr_tree;
  2473. address null_addr;
  2474. void *pd_save = NULL;
  2475. gboolean pd_changed = FALSE;
  2476. #endif /* HAVE_LIBGCRYPT */
  2477. col_set_str(pinfo->cinfo, COL_PROTOCOL, "ISAKMP");
  2478. col_clear(pinfo->cinfo, COL_INFO);
  2479. if (tree) {
  2480. ti = proto_tree_add_item(tree, proto_isakmp, tvb, offset, -1, ENC_NA);
  2481. isakmp_tree = proto_item_add_subtree(ti, ett_isakmp);
  2482. }
  2483. /* RFC3948 2.3 NAT Keepalive packet:
  2484. * 1 byte payload with the value 0xff.
  2485. */
  2486. if ( (tvb_length(tvb)==1) && (tvb_get_guint8(tvb, offset)==0xff) ){
  2487. col_set_str(pinfo->cinfo, COL_INFO, "NAT Keepalive");
  2488. proto_tree_add_item(isakmp_tree, hf_isakmp_nat_keepalive, tvb, offset, 1, ENC_NA);
  2489. return;
  2490. }
  2491. hdr.length = tvb_get_ntohl(tvb, offset + ISAKMP_HDR_SIZE - 4);
  2492. hdr.exch_type = tvb_get_guint8(tvb, COOKIE_SIZE + COOKIE_SIZE + 1 + 1);
  2493. hdr.version = tvb_get_guint8(tvb, COOKIE_SIZE + COOKIE_SIZE + 1);
  2494. isakmp_version = hi_nibble(hdr.version); /* save the version */
  2495. hdr.flags = tvb_get_guint8(tvb, COOKIE_SIZE + COOKIE_SIZE + 1 + 1 + 1);
  2496. #ifdef HAVE_LIBGCRYPT
  2497. if (isakmp_version == 1) {
  2498. SET_ADDRESS(&null_addr, AT_NONE, 0, NULL);
  2499. tvb_memcpy(tvb, i_cookie, offset, COOKIE_SIZE);
  2500. decr = (decrypt_data_t*) g_hash_table_lookup(isakmp_hash, i_cookie);
  2501. if (! decr) {
  2502. ic_key = (guint8 *)g_slice_alloc(COOKIE_SIZE);
  2503. decr = (decrypt_data_t *)g_slice_alloc(sizeof(decrypt_data_t));
  2504. memcpy(ic_key, i_cookie, COOKIE_SIZE);
  2505. memset(decr, 0, sizeof(decrypt_data_t));
  2506. SET_ADDRESS(&decr->initiator, AT_NONE, 0, NULL);
  2507. g_hash_table_insert(isakmp_hash, ic_key, decr);
  2508. }
  2509. if (ADDRESSES_EQUAL(&decr->initiator, &null_addr)) {
  2510. /* XXX - We assume that we're seeing the second packet in an exchange here.
  2511. * Is there a way to verify this? */
  2512. SE_COPY_ADDRESS(&decr->initiator, &pinfo->src);
  2513. }
  2514. pd_save = pinfo->private_data;
  2515. pinfo->private_data = decr;
  2516. pd_changed = TRUE;
  2517. } else if (isakmp_version == 2) {
  2518. ikev2_uat_data_key_t hash_key;
  2519. ikev2_uat_data_t *ike_sa_data = NULL;
  2520. ikev2_decrypt_data_t *ikev2_dec_data;
  2521. guchar spii[COOKIE_SIZE], spir[COOKIE_SIZE];
  2522. tvb_memcpy(tvb, spii, offset, COOKIE_SIZE);
  2523. tvb_memcpy(tvb, spir, offset + COOKIE_SIZE, COOKIE_SIZE);
  2524. hash_key.spii = spii;
  2525. hash_key.spir = spir;
  2526. hash_key.spii_len = COOKIE_SIZE;
  2527. hash_key.spir_len = COOKIE_SIZE;
  2528. ike_sa_data = (ikev2_uat_data_t *)g_hash_table_lookup(ikev2_key_hash, &hash_key);
  2529. if (ike_sa_data) {
  2530. guint8 initiator_flag;
  2531. initiator_flag = hdr.flags & I_FLAG;
  2532. ikev2_dec_data = ep_new(ikev2_decrypt_data_t);
  2533. ikev2_dec_data->encr_key = initiator_flag ? ike_sa_data->sk_ei : ike_sa_data->sk_er;
  2534. ikev2_dec_data->auth_key = initiator_flag ? ike_sa_data->sk_ai : ike_sa_data->sk_ar;
  2535. ikev2_dec_data->encr_spec = ike_sa_data->encr_spec;
  2536. ikev2_dec_data->auth_spec = ike_sa_data->auth_spec;
  2537. pd_save = pinfo->private_data;
  2538. pinfo->private_data = ikev2_dec_data;
  2539. pd_changed = TRUE;
  2540. } else if (pinfo->private_data) {
  2541. pd_save = pinfo->private_data;
  2542. pinfo->private_data = NULL;
  2543. pd_changed = TRUE;
  2544. }
  2545. }
  2546. #endif /* HAVE_LIBGCRYPT */
  2547. if (tree) {
  2548. proto_tree_add_item(isakmp_tree, hf_isakmp_ispi, tvb, offset, COOKIE_SIZE, ENC_NA);
  2549. offset += COOKIE_SIZE;
  2550. proto_tree_add_item(isakmp_tree, hf_isakmp_rspi, tvb, offset, COOKIE_SIZE, ENC_NA);
  2551. offset += COOKIE_SIZE;
  2552. hdr.next_payload = tvb_get_guint8(tvb, offset);
  2553. proto_tree_add_item(isakmp_tree, hf_isakmp_nextpayload, tvb, offset, 1, ENC_BIG_ENDIAN);
  2554. offset += 1;
  2555. vers_item = proto_tree_add_uint_format(isakmp_tree, hf_isakmp_version, tvb, offset,
  2556. 1, hdr.version, "Version: %u.%u",
  2557. hi_nibble(hdr.version), lo_nibble(hdr.version));
  2558. vers_tree = proto_item_add_subtree(vers_item, ett_isakmp_version);
  2559. proto_tree_add_item(vers_tree, hf_isakmp_mjver, tvb, offset, 1, ENC_BIG_ENDIAN);
  2560. proto_tree_add_item(vers_tree, hf_isakmp_mnver, tvb, offset, 1, ENC_BIG_ENDIAN);
  2561. offset += 1;
  2562. if(isakmp_version == 1) {
  2563. proto_tree_add_item(isakmp_tree, hf_isakmp_exchangetype_v1, tvb, offset, 1, ENC_BIG_ENDIAN);
  2564. col_add_str(pinfo->cinfo, COL_INFO,val_to_str(hdr.exch_type, exchange_v1_type, "Unknown %d"));
  2565. } else if (isakmp_version == 2){
  2566. proto_tree_add_item(isakmp_tree, hf_isakmp_exchangetype_v2, tvb, offset, 1, ENC_BIG_ENDIAN);
  2567. col_add_str(pinfo->cinfo, COL_INFO,val_to_str(hdr.exch_type, exchange_v2_type, "Unknown %d"));
  2568. }
  2569. offset += 1;
  2570. {
  2571. proto_item * fti;
  2572. proto_tree * ftree;
  2573. fti = proto_tree_add_item(isakmp_tree, hf_isakmp_flags, tvb, offset, 1, ENC_BIG_ENDIAN);
  2574. ftree = proto_item_add_subtree(fti, ett_isakmp_flags);
  2575. if (isakmp_version == 1) {
  2576. proto_tree_add_item(ftree, hf_isakmp_flag_e, tvb, offset, 1, ENC_BIG_ENDIAN);
  2577. proto_tree_add_item(ftree, hf_isakmp_flag_c, tvb, offset, 1, ENC_BIG_ENDIAN);
  2578. proto_tree_add_item(ftree, hf_isakmp_flag_a, tvb, offset, 1, ENC_BIG_ENDIAN);
  2579. } else if (isakmp_version == 2) {
  2580. proto_tree_add_item(ftree, hf_isakmp_flag_i, tvb, offset, 1, ENC_BIG_ENDIAN);
  2581. proto_tree_add_item(ftree, hf_isakmp_flag_v, tvb, offset, 1, ENC_BIG_ENDIAN);
  2582. proto_tree_add_item(ftree, hf_isakmp_flag_r, tvb, offset, 1, ENC_BIG_ENDIAN);
  2583. }
  2584. offset += 1;
  2585. }
  2586. hdr.message_id = tvb_get_ntohl(tvb, offset);
  2587. proto_tree_add_item(isakmp_tree, hf_isakmp_messageid, tvb, offset, 4, ENC_BIG_ENDIAN);
  2588. offset += 4;
  2589. if (hdr.length < ISAKMP_HDR_SIZE) {
  2590. proto_tree_add_uint_format(isakmp_tree, hf_isakmp_length, tvb, offset, 4,
  2591. hdr.length, "Length: (bogus, length is %u, should be at least %lu)",
  2592. hdr.length, (unsigned long)ISAKMP_HDR_SIZE);
  2593. #ifdef HAVE_LIBGCRYPT
  2594. if (pd_changed) pinfo->private_data = pd_save;
  2595. #endif /* HAVE_LIBGCRYPT */
  2596. return;
  2597. }
  2598. len = hdr.length - ISAKMP_HDR_SIZE;
  2599. if (len < 0) {
  2600. proto_tree_add_uint_format(isakmp_tree, hf_isakmp_length, tvb, offset, 4,
  2601. hdr.length, "Length: (bogus, length is %u, which is too large)",
  2602. hdr.length);
  2603. #ifdef HAVE_LIBGCRYPT
  2604. if (pd_changed) pinfo->private_data = pd_save;
  2605. #endif /* HAVE_LIBGCRYPT */
  2606. return;
  2607. }
  2608. tvb_ensure_bytes_exist(tvb, offset, len);
  2609. proto_tree_add_item(isakmp_tree, hf_isakmp_length, tvb, offset, 4, ENC_BIG_ENDIAN);
  2610. offset += 4;
  2611. if (hdr.flags & E_FLAG) {
  2612. if (len && isakmp_tree) {
  2613. ti = proto_tree_add_item(isakmp_tree, hf_isakmp_enc_data, tvb, offset, len, ENC_NA);
  2614. proto_item_append_text(ti, " (%d byte%s)", len, plurality(len, "", "s"));
  2615. #ifdef HAVE_LIBGCRYPT
  2616. if (decr) {
  2617. decr_tvb = decrypt_payload(tvb, pinfo, tvb_get_ptr(tvb, offset, len), len, &hdr);
  2618. if (decr_tvb) {
  2619. decr_tree = proto_item_add_subtree(ti, ett_isakmp);
  2620. dissect_payloads(decr_tvb, decr_tree, tree, isakmp_version,
  2621. hdr.next_payload, 0, tvb_length(decr_tvb), pinfo);
  2622. }
  2623. }
  2624. #endif /* HAVE_LIBGCRYPT */
  2625. }
  2626. } else {
  2627. dissect_payloads(tvb, isakmp_tree, tree, isakmp_version, hdr.next_payload,
  2628. offset, len, pinfo);
  2629. }
  2630. }
  2631. #ifdef HAVE_LIBGCRYPT
  2632. if (pd_changed) pinfo->private_data = pd_save;
  2633. #endif /* HAVE_LIBGCRYPT */
  2634. }
  2635. static proto_tree *
  2636. dissect_payload_header(tvbuff_t *tvb, int offset, int length,
  2637. int isakmp_version, guint8 payload _U_, guint8 *next_payload_p,
  2638. guint16 *payload_length_p, proto_tree *tree)
  2639. {
  2640. guint8 next_payload;
  2641. guint16 payload_length;
  2642. proto_item * ti;
  2643. proto_tree * ntree;
  2644. if (length < 4) {
  2645. proto_tree_add_text(tree, tvb, offset, length,
  2646. "Not enough room in payload for all transforms");
  2647. return NULL;
  2648. }
  2649. next_payload = tvb_get_guint8(tvb, offset);
  2650. payload_length = tvb_get_ntohs(tvb, offset + 2);
  2651. ti = proto_tree_add_uint(tree, hf_isakmp_typepayload, tvb, offset, payload_length, payload);
  2652. ntree = proto_item_add_subtree(ti, ett_isakmp_payload);
  2653. proto_tree_add_item(ntree, hf_isakmp_nextpayload, tvb, offset, 1, ENC_BIG_ENDIAN);
  2654. if (isakmp_version == 2) {
  2655. proto_tree_add_item(ntree, hf_isakmp_criticalpayload, tvb, offset+1, 1, ENC_BIG_ENDIAN);
  2656. }
  2657. proto_tree_add_item(ntree, hf_isakmp_payloadlen, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
  2658. *next_payload_p = next_payload;
  2659. *payload_length_p = payload_length;
  2660. return ntree;
  2661. }
  2662. static void
  2663. dissect_sa(tvbuff_t *tvb, int offset, int length, proto_tree *tree, int isakmp_version, packet_info *pinfo )
  2664. {
  2665. guint32 doi;
  2666. proto_item *sti;
  2667. proto_tree *stree;
  2668. if (isakmp_version == 1) {
  2669. doi = tvb_get_ntohl(tvb, offset);
  2670. proto_tree_add_item(tree, hf_isakmp_sa_doi, tvb, offset, 4, ENC_BIG_ENDIAN);
  2671. offset += 4;
  2672. length -= 4;
  2673. if (doi == 1) {
  2674. /* IPSEC */
  2675. if (length < 4) {
  2676. proto_tree_add_bytes_format(tree, hf_isakmp_sa_situation, tvb, offset, length,
  2677. NULL,
  2678. "Situation: %s (length is %u, should be >= 4)",
  2679. tvb_bytes_to_str(tvb, offset, length), length);
  2680. return;
  2681. }
  2682. sti = proto_tree_add_item(tree, hf_isakmp_sa_situation, tvb, offset, 4, ENC_NA);
  2683. stree = proto_item_add_subtree(sti, ett_isakmp_sa);
  2684. proto_tree_add_item(stree, hf_isakmp_sa_situation_identity_only, tvb, offset, 4, ENC_BIG_ENDIAN);
  2685. proto_tree_add_item(stree, hf_isakmp_sa_situation_secrecy, tvb, offset, 4, ENC_BIG_ENDIAN);
  2686. proto_tree_add_item(stree, hf_isakmp_sa_situation_integrity, tvb, offset, 4, ENC_BIG_ENDIAN);
  2687. offset += 4;
  2688. length -= 4;
  2689. dissect_payloads(tvb, tree, tree, isakmp_version, PLOAD_IKE_P, offset,
  2690. length, pinfo);
  2691. } else {
  2692. /* Unknown */
  2693. proto_tree_add_item(tree, hf_isakmp_sa_situation, tvb, offset, length, ENC_NA);
  2694. }
  2695. } else if (isakmp_version == 2) {
  2696. dissect_payloads(tvb, tree, tree, isakmp_version, PLOAD_IKE_P, offset,
  2697. length, pinfo);
  2698. }
  2699. }
  2700. static void
  2701. dissect_proposal(tvbuff_t *tvb, int offset, int length, proto_tree *tree, int isakmp_version, packet_info *pinfo )
  2702. {
  2703. guint8 protocol_id;
  2704. guint8 spi_size;
  2705. guint8 num_transforms;
  2706. guint8 next_payload;
  2707. guint16 payload_length;
  2708. proto_tree * ntree;
  2709. guint8 proposal_num;
  2710. proposal_num = tvb_get_guint8(tvb, offset);
  2711. proto_item_append_text(tree, " # %d", proposal_num);
  2712. proto_tree_add_item(tree, hf_isakmp_prop_number, tvb, offset, 1, ENC_BIG_ENDIAN);
  2713. offset += 1;
  2714. length -= 1;
  2715. protocol_id = tvb_get_guint8(tvb, offset);
  2716. if (isakmp_version == 1)
  2717. {
  2718. proto_tree_add_item(tree, hf_isakmp_prop_protoid_v1, tvb, offset, 1, ENC_BIG_ENDIAN);
  2719. }else if (isakmp_version == 2)
  2720. {
  2721. proto_tree_add_item(tree, hf_isakmp_prop_protoid_v2, tvb, offset, 1, ENC_BIG_ENDIAN);
  2722. }
  2723. offset += 1;
  2724. length -= 1;
  2725. spi_size = tvb_get_guint8(tvb, offset);
  2726. proto_tree_add_item(tree, hf_isakmp_spisize, tvb, offset, 1, ENC_BIG_ENDIAN);
  2727. offset += 1;
  2728. length -= 1;
  2729. num_transforms = tvb_get_guint8(tvb, offset);
  2730. proto_tree_add_item(tree, hf_isakmp_prop_transforms, tvb, offset, 1, ENC_BIG_ENDIAN);
  2731. offset += 1;
  2732. length -= 1;
  2733. if (spi_size) {
  2734. proto_tree_add_item(tree, hf_isakmp_spi, tvb, offset, spi_size, ENC_NA);
  2735. offset += spi_size;
  2736. length -= spi_size;
  2737. }
  2738. while (num_transforms > 0) {
  2739. ntree = dissect_payload_header(tvb, offset, length, isakmp_version,
  2740. PLOAD_IKE_T, &next_payload, &payload_length, tree);
  2741. if (ntree == NULL)
  2742. break;
  2743. if (length < payload_length) {
  2744. proto_tree_add_text(tree, tvb, offset + 4, length,
  2745. "Not enough room in payload for all transforms");
  2746. break;
  2747. }
  2748. dissect_transform(tvb, offset + 4, payload_length - 4, ntree, pinfo, isakmp_version, protocol_id);
  2749. offset += payload_length;
  2750. length -= payload_length;
  2751. num_transforms--;
  2752. }
  2753. }
  2754. /* Returns the number of bytes consumed by this option. */
  2755. static int
  2756. dissect_rohc_supported(tvbuff_t *tvb, proto_tree *rohc_tree, int offset )
  2757. {
  2758. guint optlen, rohc, len = 0;
  2759. proto_item *rohc_item = NULL;
  2760. proto_tree *sub_rohc_tree = NULL;
  2761. rohc = tvb_get_ntohs(tvb, offset);
  2762. optlen = tvb_get_ntohs(tvb, offset+2);
  2763. len = 2;
  2764. /* is TV ? (Type/Value) ? */
  2765. if (rohc & 0x8000) {
  2766. rohc = rohc & 0x7fff;
  2767. len = 0;
  2768. optlen = 2;
  2769. }
  2770. rohc_item = proto_tree_add_item(rohc_tree, hf_isakmp_notify_data_rohc_attr, tvb, offset, 2+len+optlen, ENC_NA);
  2771. proto_item_append_text(rohc_item," (t=%d,l=%d) %s",rohc, optlen, val_to_str(rohc, rohc_attr_type, "Unknown Attribute Type (%02d)") );
  2772. sub_rohc_tree = proto_item_add_subtree(rohc_item, ett_isakmp_rohc_attr);
  2773. proto_tree_add_item(sub_rohc_tree, hf_isakmp_notify_data_rohc_attr_format, tvb, offset, 2, ENC_BIG_ENDIAN);
  2774. proto_tree_add_uint(sub_rohc_tree, hf_isakmp_notify_data_rohc_attr_type, tvb, offset, 2, rohc);
  2775. offset += 2;
  2776. if (len)
  2777. {
  2778. proto_tree_add_item(sub_rohc_tree, hf_isakmp_notify_data_rohc_attr_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  2779. offset += 2;
  2780. }
  2781. if (optlen==0)
  2782. {
  2783. proto_tree_add_text(sub_rohc_tree, tvb, offset, 0,"Attribut value is empty");
  2784. return 2+len;
  2785. }
  2786. proto_tree_add_item(sub_rohc_tree, hf_isakmp_notify_data_rohc_attr_value, tvb, offset, optlen, ENC_NA);
  2787. switch(rohc) {
  2788. case ROHC_MAX_CID:
  2789. proto_tree_add_item(sub_rohc_tree, hf_isakmp_notify_data_rohc_attr_max_cid, tvb, offset, optlen, ENC_BIG_ENDIAN);
  2790. break;
  2791. case ROHC_PROFILE:
  2792. proto_tree_add_item(sub_rohc_tree, hf_isakmp_notify_data_rohc_attr_profile, tvb, offset, optlen, ENC_BIG_ENDIAN);
  2793. break;
  2794. case ROHC_INTEG:
  2795. proto_tree_add_item(sub_rohc_tree, hf_isakmp_notify_data_rohc_attr_integ, tvb, offset, optlen, ENC_BIG_ENDIAN);
  2796. break;
  2797. case ROHC_ICV_LEN:
  2798. proto_tree_add_item(sub_rohc_tree, hf_isakmp_notify_data_rohc_attr_icv_len, tvb, offset, optlen, ENC_BIG_ENDIAN);
  2799. break;
  2800. case ROHC_MRRU:
  2801. proto_tree_add_item(sub_rohc_tree, hf_isakmp_notify_data_rohc_attr_mrru, tvb, offset, optlen, ENC_BIG_ENDIAN);
  2802. break;
  2803. default:
  2804. /* No Default Action */
  2805. break;
  2806. }
  2807. return 2+len+optlen;
  2808. }
  2809. /* Dissect life duration, which is variable-length. Note that this function
  2810. * handles both/either the security association life duration as defined in
  2811. * section 4.5 of RFC2407 (http://tools.ietf.org/html/rfc2407), as well as the
  2812. * life duration according to the attribute classes table in Appendix A of
  2813. * RFC2409: http://tools.ietf.org/html/rfc2409#page-33 */
  2814. static void
  2815. dissect_life_duration(tvbuff_t *tvb, proto_tree *tree, proto_item *ti, int hf_uint32, int hf_uint64, int hf_bytes, int offset, guint len)
  2816. {
  2817. switch (len) {
  2818. case 0:
  2819. break;
  2820. case 1: {
  2821. guint8 val;
  2822. val = tvb_get_guint8(tvb, offset);
  2823. proto_tree_add_uint_format_value(tree, hf_uint32, tvb, offset, len, val, "%u", val);
  2824. proto_item_append_text(ti, " : %u", val);
  2825. break;
  2826. }
  2827. case 2: {
  2828. guint16 val;
  2829. val = tvb_get_ntohs(tvb, offset);
  2830. proto_tree_add_uint_format_value(tree, hf_uint32, tvb, offset, len, val, "%u", val);
  2831. proto_item_append_text(ti, " : %u", val);
  2832. break;
  2833. }
  2834. case 3: {
  2835. guint32 val;
  2836. val = tvb_get_ntoh24(tvb, offset);
  2837. proto_tree_add_uint_format_value(tree, hf_uint32, tvb, offset, len, val, "%u", val);
  2838. proto_item_append_text(ti, " : %u", val);
  2839. break;
  2840. }
  2841. case 4: {
  2842. guint32 val;
  2843. val = tvb_get_ntohl(tvb, offset);
  2844. proto_tree_add_uint_format_value(tree, hf_uint32, tvb, offset, len, val, "%u", val);
  2845. proto_item_append_text(ti, " : %u", val);
  2846. break;
  2847. }
  2848. case 5: {
  2849. guint64 val;
  2850. val = tvb_get_ntoh40(tvb, offset);
  2851. proto_tree_add_uint64_format_value(tree, hf_uint64, tvb, offset, len, val, "%" G_GINT64_MODIFIER "u", val);
  2852. proto_item_append_text(ti, " : %" G_GINT64_MODIFIER "u", val);
  2853. break;
  2854. }
  2855. case 6: {
  2856. guint64 val;
  2857. val = tvb_get_ntoh48(tvb, offset);
  2858. proto_tree_add_uint64_format_value(tree, hf_uint64, tvb, offset, len, val, "%" G_GINT64_MODIFIER "u", val);
  2859. proto_item_append_text(ti, " : %" G_GINT64_MODIFIER "u", val);
  2860. break;
  2861. }
  2862. case 7: {
  2863. guint64 val;
  2864. val = tvb_get_ntoh56(tvb, offset);
  2865. proto_tree_add_uint64_format_value(tree, hf_uint64, tvb, offset, len, val, "%" G_GINT64_MODIFIER "u", val);
  2866. proto_item_append_text(ti, " : %" G_GINT64_MODIFIER "u", val);
  2867. break;
  2868. }
  2869. case 8: {
  2870. guint64 val;
  2871. val = tvb_get_ntoh64(tvb, offset);
  2872. proto_tree_add_uint64_format_value(tree, hf_uint64, tvb, offset, len, val, "%" G_GINT64_MODIFIER "u", val);
  2873. proto_item_append_text(ti, " : %" G_GINT64_MODIFIER "u", val);
  2874. break;
  2875. }
  2876. default:
  2877. proto_tree_add_item(tree, hf_bytes, tvb, offset, len, ENC_NA);
  2878. proto_item_append_text(ti, " : %" G_GINT64_MODIFIER "x ...", tvb_get_ntoh64(tvb, offset));
  2879. break;
  2880. }
  2881. }
  2882. /* Returns the number of bytes consumed by this option. */
  2883. static int
  2884. dissect_transform_attribute(tvbuff_t *tvb, proto_tree *transform_attr_type_tree, int offset )
  2885. {
  2886. guint optlen, transform_attr_type, len = 0;
  2887. proto_item *transform_attr_type_item = NULL;
  2888. proto_tree *sub_transform_attr_type_tree = NULL;
  2889. transform_attr_type = tvb_get_ntohs(tvb, offset);
  2890. optlen = tvb_get_ntohs(tvb, offset+2);
  2891. len = 2;
  2892. /* is TV ? (Type/Value) ? */
  2893. if (transform_attr_type & 0x8000) {
  2894. transform_attr_type = transform_attr_type & 0x7fff;
  2895. len = 0;
  2896. optlen = 2;
  2897. }
  2898. transform_attr_type_item = proto_tree_add_item(transform_attr_type_tree, hf_isakmp_tf_attr, tvb, offset, 2+len+optlen, ENC_NA);
  2899. proto_item_append_text(transform_attr_type_item, " (t=%d,l=%d) %s",transform_attr_type, optlen, val_to_str(transform_attr_type, transform_isakmp_attr_type, "Unknown Attribute Type (%02d)") );
  2900. sub_transform_attr_type_tree = proto_item_add_subtree(transform_attr_type_item, ett_isakmp_tf_attr);
  2901. proto_tree_add_item(sub_transform_attr_type_tree, hf_isakmp_tf_attr_format, tvb, offset, 2, ENC_BIG_ENDIAN);
  2902. proto_tree_add_uint(sub_transform_attr_type_tree, hf_isakmp_tf_attr_type_v1, tvb, offset, 2, transform_attr_type);
  2903. offset += 2;
  2904. if (len)
  2905. {
  2906. proto_tree_add_item(sub_transform_attr_type_tree, hf_isakmp_tf_attr_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  2907. offset += 2;
  2908. }
  2909. if (optlen==0)
  2910. {
  2911. proto_tree_add_text(sub_transform_attr_type_tree, tvb, offset, 0,"Attribute value is empty");
  2912. return 2+len;
  2913. }
  2914. proto_tree_add_item(sub_transform_attr_type_tree, hf_isakmp_tf_attr_value, tvb, offset, optlen, ENC_NA);
  2915. switch(transform_attr_type) {
  2916. case ISAKMP_ATTR_LIFE_TYPE:
  2917. proto_tree_add_item(sub_transform_attr_type_tree, hf_isakmp_tf_attr_life_type, tvb, offset, optlen, ENC_BIG_ENDIAN);
  2918. proto_item_append_text(transform_attr_type_item," : %s", val_to_str(tvb_get_ntohs(tvb, offset), transform_attr_sa_life_type, "Unknown %d"));
  2919. break;
  2920. case ISAKMP_ATTR_LIFE_DURATION:
  2921. dissect_life_duration(tvb, sub_transform_attr_type_tree, transform_attr_type_item, hf_isakmp_tf_attr_life_duration_uint32, hf_isakmp_tf_attr_life_duration_uint64, hf_isakmp_tf_attr_life_duration_bytes , offset, optlen);
  2922. break;
  2923. case ISAKMP_ATTR_GROUP_DESC:
  2924. proto_tree_add_item(sub_transform_attr_type_tree, hf_isakmp_tf_attr_group_description, tvb, offset, optlen, ENC_BIG_ENDIAN);
  2925. proto_item_append_text(transform_attr_type_item," : %s", val_to_str(tvb_get_ntohs(tvb, offset), transform_dh_group_type, "Unknown %d"));
  2926. break;
  2927. case ISAKMP_ATTR_ENCAP_MODE:
  2928. proto_tree_add_item(sub_transform_attr_type_tree, hf_isakmp_tf_attr_encap_mode, tvb, offset, optlen, ENC_BIG_ENDIAN);
  2929. proto_item_append_text(transform_attr_type_item," : %s", val_to_str(tvb_get_ntohs(tvb, offset), transform_attr_encap_type, "Unknown %d"));
  2930. break;
  2931. case ISAKMP_ATTR_AUTH_ALGORITHM:
  2932. proto_tree_add_item(sub_transform_attr_type_tree, hf_isakmp_tf_attr_auth_algorithm, tvb, offset, optlen, ENC_BIG_ENDIAN);
  2933. proto_item_append_text(transform_attr_type_item," : %s", val_to_str(tvb_get_ntohs(tvb, offset), transform_attr_auth_type, "Unknown %d"));
  2934. break;
  2935. case ISAKMP_ATTR_KEY_LENGTH:
  2936. proto_tree_add_item(sub_transform_attr_type_tree, hf_isakmp_tf_attr_key_length, tvb, offset, optlen, ENC_BIG_ENDIAN);
  2937. proto_item_append_text(transform_attr_type_item," : %d", tvb_get_ntohs(tvb, offset));
  2938. break;
  2939. case ISAKMP_ATTR_KEY_ROUNDS:
  2940. proto_tree_add_item(sub_transform_attr_type_tree, hf_isakmp_tf_attr_key_rounds, tvb, offset, optlen, ENC_BIG_ENDIAN);
  2941. proto_item_append_text(transform_attr_type_item," : %d", tvb_get_ntohs(tvb, offset));
  2942. break;
  2943. case ISAKMP_ATTR_CMPR_DICT_SIZE:
  2944. proto_tree_add_item(sub_transform_attr_type_tree, hf_isakmp_tf_attr_cmpr_dict_size, tvb, offset, optlen, ENC_BIG_ENDIAN);
  2945. break;
  2946. case ISAKMP_ATTR_CMPR_ALGORITHM:
  2947. proto_tree_add_item(sub_transform_attr_type_tree, hf_isakmp_tf_attr_cmpr_algorithm, tvb, offset, optlen, ENC_NA);
  2948. break;
  2949. case ISAKMP_ATTR_ECN_TUNNEL:
  2950. proto_tree_add_item(sub_transform_attr_type_tree, hf_isakmp_tf_attr_ecn_tunnel, tvb, offset, optlen, ENC_BIG_ENDIAN);
  2951. proto_item_append_text(transform_attr_type_item," : %s", val_to_str(tvb_get_ntohs(tvb, offset), transform_attr_ecn_type, "Unknown %d"));
  2952. break;
  2953. case ISAKMP_ATTR_EXT_SEQ_NBR:
  2954. proto_tree_add_item(sub_transform_attr_type_tree, hf_isakmp_tf_attr_ext_seq_nbr, tvb, offset, optlen, ENC_BIG_ENDIAN);
  2955. proto_item_append_text(transform_attr_type_item," : %s", val_to_str(tvb_get_ntohs(tvb, offset), transform_attr_ext_seq_nbr_type, "Unknown %d"));
  2956. case ISAKMP_ATTR_AUTH_KEY_LENGTH:
  2957. proto_tree_add_item(sub_transform_attr_type_tree, hf_isakmp_tf_attr_auth_key_length, tvb, offset, optlen, ENC_BIG_ENDIAN);
  2958. proto_item_append_text(transform_attr_type_item," : %d", tvb_get_ntohs(tvb, offset));
  2959. break;
  2960. case ISAKMP_ATTR_SIG_ENCO_ALGORITHM:
  2961. proto_tree_add_item(sub_transform_attr_type_tree, hf_isakmp_tf_attr_sig_enco_algorithm, tvb, offset, optlen, ENC_NA);
  2962. break;
  2963. case ISAKMP_ATTR_ADDR_PRESERVATION:
  2964. proto_tree_add_item(sub_transform_attr_type_tree, hf_isakmp_tf_attr_addr_preservation, tvb, offset, optlen, ENC_BIG_ENDIAN);
  2965. proto_item_append_text(transform_attr_type_item," : %s", val_to_str(tvb_get_ntohs(tvb, offset), transform_attr_addr_preservation_type, "Unknown %d"));
  2966. break;
  2967. case ISAKMP_ATTR_SA_DIRECTION:
  2968. proto_tree_add_item(sub_transform_attr_type_tree, hf_isakmp_tf_attr_sa_direction, tvb, offset, optlen, ENC_BIG_ENDIAN);
  2969. proto_item_append_text(transform_attr_type_item," : %s", val_to_str(tvb_get_ntohs(tvb, offset), transform_attr_sa_direction_type, "Unknown %d"));
  2970. default:
  2971. /* No Default Action */
  2972. break;
  2973. }
  2974. return 2+len+optlen;
  2975. }
  2976. /* Returns the number of bytes consumed by this option. */
  2977. static int
  2978. dissect_transform_ike_attribute(tvbuff_t *tvb, proto_tree *transform_attr_type_tree, int offset
  2979. #ifdef HAVE_LIBGCRYPT
  2980. , decrypt_data_t *decr
  2981. #endif
  2982. )
  2983. {
  2984. guint optlen, transform_attr_type, len = 0;
  2985. proto_item *transform_attr_type_item = NULL;
  2986. proto_tree *sub_transform_attr_type_tree = NULL;
  2987. transform_attr_type = tvb_get_ntohs(tvb, offset);
  2988. optlen = tvb_get_ntohs(tvb, offset+2);
  2989. len = 2;
  2990. /* is TV ? (Type/Value) ? */
  2991. if (transform_attr_type & 0x8000) {
  2992. transform_attr_type = transform_attr_type & 0x7fff;
  2993. len = 0;
  2994. optlen = 2;
  2995. }
  2996. transform_attr_type_item = proto_tree_add_item(transform_attr_type_tree, hf_isakmp_ike_attr, tvb, offset, 2+len+optlen, ENC_NA);
  2997. proto_item_append_text(transform_attr_type_item," (t=%d,l=%d) %s",transform_attr_type, optlen, val_to_str(transform_attr_type,transform_ike_attr_type,"Unknown Attribute Type (%02d)") );
  2998. sub_transform_attr_type_tree = proto_item_add_subtree(transform_attr_type_item, ett_isakmp_tf_ike_attr);
  2999. proto_tree_add_item(sub_transform_attr_type_tree, hf_isakmp_ike_attr_format, tvb, offset, 2, ENC_BIG_ENDIAN);
  3000. proto_tree_add_uint(sub_transform_attr_type_tree, hf_isakmp_ike_attr_type, tvb, offset, 2, transform_attr_type);
  3001. offset += 2;
  3002. if (len)
  3003. {
  3004. proto_tree_add_item(sub_transform_attr_type_tree, hf_isakmp_ike_attr_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  3005. offset += 2;
  3006. }
  3007. if (optlen==0)
  3008. {
  3009. proto_tree_add_text(sub_transform_attr_type_tree, tvb, offset, 0,"Attribut value is empty");
  3010. return 2+len;
  3011. }
  3012. proto_tree_add_item(sub_transform_attr_type_tree, hf_isakmp_ike_attr_value, tvb, offset, optlen, ENC_NA);
  3013. switch(transform_attr_type) {
  3014. case IKE_ATTR_ENCRYPTION_ALGORITHM:
  3015. proto_tree_add_item(sub_transform_attr_type_tree, hf_isakmp_ike_attr_encryption_algorithm, tvb, offset, optlen, ENC_BIG_ENDIAN);
  3016. proto_item_append_text(transform_attr_type_item," : %s", val_to_str(tvb_get_ntohs(tvb, offset), transform_attr_enc_type, "Unknown %d"));
  3017. #ifdef HAVE_LIBGCRYPT
  3018. decr->encr_alg = tvb_get_ntohs(tvb, offset);
  3019. #endif
  3020. break;
  3021. case IKE_ATTR_HASH_ALGORITHM:
  3022. proto_tree_add_item(sub_transform_attr_type_tree, hf_isakmp_ike_attr_hash_algorithm, tvb, offset, optlen, ENC_BIG_ENDIAN);
  3023. proto_item_append_text(transform_attr_type_item," : %s", val_to_str(tvb_get_ntohs(tvb, offset), transform_attr_hash_type, "Unknown %d"));
  3024. #ifdef HAVE_LIBGCRYPT
  3025. decr->hash_alg = tvb_get_ntohs(tvb, offset);
  3026. #endif
  3027. break;
  3028. case IKE_ATTR_AUTHENTICATION_METHOD:
  3029. proto_tree_add_item(sub_transform_attr_type_tree, hf_isakmp_ike_attr_authentication_method, tvb, offset, optlen, ENC_BIG_ENDIAN);
  3030. proto_item_append_text(transform_attr_type_item," : %s", val_to_str(tvb_get_ntohs(tvb, offset), transform_attr_authmeth_type, "Unknown %d"));
  3031. #ifdef HAVE_LIBGCRYPT
  3032. decr->is_psk = tvb_get_ntohs(tvb, offset) == 0x01 ? TRUE : FALSE;
  3033. #endif
  3034. break;
  3035. case IKE_ATTR_GROUP_DESCRIPTION:
  3036. proto_tree_add_item(sub_transform_attr_type_tree, hf_isakmp_ike_attr_group_description, tvb, offset, optlen, ENC_BIG_ENDIAN);
  3037. proto_item_append_text(transform_attr_type_item," : %s", val_to_str(tvb_get_ntohs(tvb, offset), transform_dh_group_type, "Unknown %d"));
  3038. #ifdef HAVE_LIBGCRYPT
  3039. decr->group = tvb_get_ntohs(tvb, offset);
  3040. #endif
  3041. break;
  3042. case IKE_ATTR_GROUP_TYPE:
  3043. proto_tree_add_item(sub_transform_attr_type_tree, hf_isakmp_ike_attr_group_type, tvb, offset, optlen, ENC_BIG_ENDIAN);
  3044. proto_item_append_text(transform_attr_type_item," : %s", val_to_str(tvb_get_ntohs(tvb, offset), transform_attr_grp_type, "Unknown %d"));
  3045. break;
  3046. case IKE_ATTR_GROUP_PRIME:
  3047. proto_tree_add_item(sub_transform_attr_type_tree, hf_isakmp_ike_attr_group_prime, tvb, offset, optlen, ENC_NA);
  3048. break;
  3049. case IKE_ATTR_GROUP_GENERATOR_ONE:
  3050. proto_tree_add_item(sub_transform_attr_type_tree, hf_isakmp_ike_attr_group_generator_one, tvb, offset, optlen, ENC_NA);
  3051. break;
  3052. case IKE_ATTR_GROUP_GENERATOR_TWO:
  3053. proto_tree_add_item(sub_transform_attr_type_tree, hf_isakmp_ike_attr_group_generator_two, tvb, offset, optlen, ENC_NA);
  3054. break;
  3055. case IKE_ATTR_GROUP_CURVE_A:
  3056. proto_tree_add_item(sub_transform_attr_type_tree, hf_isakmp_ike_attr_group_curve_a, tvb, offset, optlen, ENC_NA);
  3057. break;
  3058. case IKE_ATTR_GROUP_CURVE_B:
  3059. proto_tree_add_item(sub_transform_attr_type_tree, hf_isakmp_ike_attr_group_curve_b, tvb, offset, optlen, ENC_NA);
  3060. break;
  3061. case IKE_ATTR_LIFE_TYPE:
  3062. proto_tree_add_item(sub_transform_attr_type_tree, hf_isakmp_ike_attr_life_type, tvb, offset, optlen, ENC_BIG_ENDIAN);
  3063. proto_item_append_text(transform_attr_type_item," : %s", val_to_str(tvb_get_ntohs(tvb, offset), transform_attr_sa_life_type, "Unknown %d"));
  3064. break;
  3065. case IKE_ATTR_LIFE_DURATION:
  3066. dissect_life_duration(tvb, sub_transform_attr_type_tree, transform_attr_type_item, hf_isakmp_ike_attr_life_duration_uint32, hf_isakmp_ike_attr_life_duration_uint64, hf_isakmp_ike_attr_life_duration_bytes, offset, optlen);
  3067. break;
  3068. case IKE_ATTR_PRF:
  3069. proto_tree_add_item(sub_transform_attr_type_tree, hf_isakmp_ike_attr_prf, tvb, offset, optlen, ENC_NA);
  3070. break;
  3071. case IKE_ATTR_KEY_LENGTH:
  3072. proto_tree_add_item(sub_transform_attr_type_tree, hf_isakmp_ike_attr_key_length, tvb, offset, optlen, ENC_BIG_ENDIAN);
  3073. proto_item_append_text(transform_attr_type_item," : %d", tvb_get_ntohs(tvb, offset));
  3074. break;
  3075. case IKE_ATTR_FIELD_SIZE:
  3076. proto_tree_add_item(sub_transform_attr_type_tree, hf_isakmp_ike_attr_field_size, tvb, offset, optlen, ENC_NA);
  3077. break;
  3078. case IKE_ATTR_GROUP_ORDER:
  3079. proto_tree_add_item(sub_transform_attr_type_tree, hf_isakmp_ike_attr_group_order, tvb, offset, optlen, ENC_NA);
  3080. break;
  3081. default:
  3082. /* No Default Action */
  3083. break;
  3084. }
  3085. return 2+len+optlen;
  3086. }
  3087. /* Returns the number of bytes consumed by this option. */
  3088. static int
  3089. dissect_transform_ike2_attribute(tvbuff_t *tvb, proto_tree *transform_attr_type_tree, int offset )
  3090. {
  3091. guint optlen, transform_attr_type, len = 0;
  3092. proto_item *transform_attr_type_item = NULL;
  3093. proto_tree *sub_transform_attr_type_tree = NULL;
  3094. transform_attr_type = tvb_get_ntohs(tvb, offset);
  3095. optlen = tvb_get_ntohs(tvb, offset+2);
  3096. len = 2;
  3097. /* is TV ? (Type/Value) ? */
  3098. if (transform_attr_type & 0x8000) {
  3099. transform_attr_type = transform_attr_type & 0x7fff;
  3100. len = 0;
  3101. optlen = 2;
  3102. }
  3103. transform_attr_type_item = proto_tree_add_item(transform_attr_type_tree, hf_isakmp_ike2_attr, tvb, offset, 2+len+optlen, ENC_NA);
  3104. proto_item_append_text(transform_attr_type_item," (t=%d,l=%d) %s",transform_attr_type, optlen, val_to_str(transform_attr_type,transform_ike2_attr_type,"Unknown Attribute Type (%02d)") );
  3105. sub_transform_attr_type_tree = proto_item_add_subtree(transform_attr_type_item, ett_isakmp_tf_ike2_attr);
  3106. proto_tree_add_item(sub_transform_attr_type_tree, hf_isakmp_ike2_attr_format, tvb, offset, 2, ENC_BIG_ENDIAN);
  3107. proto_tree_add_uint(sub_transform_attr_type_tree, hf_isakmp_ike2_attr_type, tvb, offset, 2, transform_attr_type);
  3108. offset += 2;
  3109. if (len)
  3110. {
  3111. proto_tree_add_item(sub_transform_attr_type_tree, hf_isakmp_ike2_attr_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  3112. offset += 2;
  3113. }
  3114. if (optlen==0)
  3115. {
  3116. proto_tree_add_text(sub_transform_attr_type_tree, tvb, offset, 0,"Attribut value is empty");
  3117. return 2+len;
  3118. }
  3119. proto_tree_add_item(sub_transform_attr_type_tree, hf_isakmp_ike2_attr_value, tvb, offset, optlen, ENC_NA);
  3120. switch(transform_attr_type) {
  3121. case IKE2_ATTR_KEY_LENGTH:
  3122. proto_tree_add_item(sub_transform_attr_type_tree, hf_isakmp_ike2_attr_key_length, tvb, offset, optlen, ENC_BIG_ENDIAN);
  3123. proto_item_append_text(transform_attr_type_item," : %d", tvb_get_ntohs(tvb, offset));
  3124. break;
  3125. default:
  3126. /* No Default Action */
  3127. break;
  3128. }
  3129. return 2+len+optlen;
  3130. }
  3131. static void
  3132. dissect_transform(tvbuff_t *tvb, int offset, int length, proto_tree *tree, packet_info *pinfo
  3133. #ifndef HAVE_LIBGCRYPT
  3134. _U_
  3135. #endif
  3136. , int isakmp_version, int protocol_id )
  3137. {
  3138. if (isakmp_version == 1)
  3139. {
  3140. guint8 transform_id;
  3141. guint8 transform_num;
  3142. #ifdef HAVE_LIBGCRYPT
  3143. decrypt_data_t *decr = (decrypt_data_t *) pinfo->private_data;
  3144. #endif /* HAVE_LIBGCRYPT */
  3145. int offset_end = 0;
  3146. offset_end = offset + length;
  3147. transform_num = tvb_get_guint8(tvb, offset);
  3148. proto_item_append_text(tree," # %d",transform_num);
  3149. proto_tree_add_item(tree, hf_isakmp_trans_number, tvb, offset, 1, ENC_BIG_ENDIAN);
  3150. offset += 1;
  3151. transform_id = tvb_get_guint8(tvb, offset);
  3152. switch (protocol_id) {
  3153. case 1: /* ISAKMP */
  3154. proto_tree_add_uint_format(tree, hf_isakmp_trans_id, tvb, offset, 1,
  3155. transform_id, "Transform ID: %s (%u)",
  3156. val_to_str_const(transform_id, vs_v1_trans_isakmp, "UNKNOWN-TRANS-TYPE"), transform_id);
  3157. break;
  3158. case 2: /* AH */
  3159. proto_tree_add_uint_format(tree, hf_isakmp_trans_id, tvb, offset, 1,
  3160. transform_id, "Transform ID: %s (%u)",
  3161. val_to_str_const(transform_id, vs_v1_trans_ah, "UNKNOWN-AH-TRANS-TYPE"), transform_id);
  3162. break;
  3163. case 3: /* ESP */
  3164. proto_tree_add_uint_format(tree, hf_isakmp_trans_id, tvb, offset, 1,
  3165. transform_id, "Transform ID: %s (%u)",
  3166. val_to_str_const(transform_id, vs_v1_trans_esp, "UNKNOWN-ESP-TRANS-TYPE"), transform_id);
  3167. break;
  3168. case 4: /* IPCOMP */
  3169. proto_tree_add_uint_format(tree, hf_isakmp_trans_id, tvb, offset, 1,
  3170. transform_id, "Transform ID: %s (%u)",
  3171. val_to_str_const(transform_id, transform_id_ipcomp, "UNKNOWN-IPCOMP-TRANS-TYPE"), transform_id);
  3172. break;
  3173. default:
  3174. proto_tree_add_item(tree, hf_isakmp_trans_id, tvb, offset, 1, ENC_BIG_ENDIAN);
  3175. break;
  3176. }
  3177. offset += 3;
  3178. if (protocol_id == 1 && transform_id == 1) {
  3179. while (offset < offset_end) {
  3180. offset += dissect_transform_ike_attribute(tvb, tree, offset
  3181. #ifdef HAVE_LIBGCRYPT
  3182. , decr
  3183. #endif
  3184. );
  3185. }
  3186. }
  3187. else {
  3188. while (offset < offset_end) {
  3189. offset += dissect_transform_attribute(tvb, tree, offset);
  3190. }
  3191. }
  3192. }
  3193. else if(isakmp_version == 2)
  3194. {
  3195. guint8 transform_type;
  3196. int offset_end = 0;
  3197. offset_end = offset + length;
  3198. transform_type = tvb_get_guint8(tvb, offset);
  3199. proto_tree_add_item(tree, hf_isakmp_trans_type, tvb, offset, 1, ENC_BIG_ENDIAN);
  3200. offset += 1;
  3201. offset += 1; /* Reserved */
  3202. switch(transform_type){
  3203. case TF_IKE2_ENCR:
  3204. proto_tree_add_item(tree, hf_isakmp_trans_encr, tvb, offset, 2, ENC_BIG_ENDIAN);
  3205. break;
  3206. case TF_IKE2_PRF:
  3207. proto_tree_add_item(tree, hf_isakmp_trans_prf, tvb, offset, 2, ENC_BIG_ENDIAN);
  3208. break;
  3209. case TF_IKE2_INTEG:
  3210. proto_tree_add_item(tree, hf_isakmp_trans_integ, tvb, offset, 2, ENC_BIG_ENDIAN);
  3211. break;
  3212. case TF_IKE2_DH:
  3213. proto_tree_add_item(tree, hf_isakmp_trans_dh, tvb, offset, 2, ENC_BIG_ENDIAN);
  3214. break;
  3215. case TF_IKE2_ESN:
  3216. proto_tree_add_item(tree, hf_isakmp_trans_esn, tvb, offset, 2, ENC_BIG_ENDIAN);
  3217. break;
  3218. default:
  3219. proto_tree_add_item(tree, hf_isakmp_trans_id_v2, tvb, offset, 2, ENC_BIG_ENDIAN);
  3220. break;
  3221. }
  3222. offset += 2;
  3223. while (offset < offset_end) {
  3224. offset += dissect_transform_ike2_attribute(tvb, tree, offset);
  3225. }
  3226. }
  3227. }
  3228. static void
  3229. dissect_key_exch(tvbuff_t *tvb, int offset, int length, proto_tree *tree, int isakmp_version, packet_info *pinfo
  3230. #ifndef HAVE_LIBGCRYPT
  3231. _U_
  3232. #endif
  3233. )
  3234. {
  3235. #ifdef HAVE_LIBGCRYPT
  3236. decrypt_data_t *decr = (decrypt_data_t *) pinfo->private_data;
  3237. #endif /* HAVE_LIBGCRYPT */
  3238. if (isakmp_version == 2) {
  3239. proto_tree_add_item(tree, hf_isakmp_key_exch_dh_group, tvb, offset, 2, ENC_BIG_ENDIAN);
  3240. offset += 4;
  3241. length -= 4;
  3242. }
  3243. proto_tree_add_item(tree, hf_isakmp_key_exch_data, tvb, offset, length, ENC_NA);
  3244. #ifdef HAVE_LIBGCRYPT
  3245. if (decr && decr->gi_len == 0 && ADDRESSES_EQUAL(&decr->initiator, &pinfo->src)) {
  3246. decr->gi = (gchar *)g_malloc(length);
  3247. tvb_memcpy(tvb, decr->gi, offset, length);
  3248. decr->gi_len = length;
  3249. } else if (decr && decr->gr_len == 0 && !ADDRESSES_EQUAL(&decr->initiator, &pinfo->src)) {
  3250. decr->gr = (gchar *)g_malloc(length);
  3251. tvb_memcpy(tvb, decr->gr, offset, length);
  3252. decr->gr_len = length;
  3253. }
  3254. #endif /* HAVE_LIBGCRYPT */
  3255. }
  3256. static void
  3257. dissect_id(tvbuff_t *tvb, int offset, int length, proto_tree *tree, int isakmp_version, packet_info *pinfo )
  3258. {
  3259. guint8 id_type;
  3260. guint8 protocol_id;
  3261. guint16 port;
  3262. proto_item *idit;
  3263. proto_tree *idtree;
  3264. asn1_ctx_t asn1_ctx;
  3265. asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
  3266. id_type = tvb_get_guint8(tvb, offset);
  3267. if (isakmp_version == 1)
  3268. {
  3269. proto_tree_add_item(tree, hf_isakmp_id_type_v1, tvb, offset, 1, ENC_BIG_ENDIAN);
  3270. }else if (isakmp_version == 2)
  3271. {
  3272. proto_tree_add_item(tree, hf_isakmp_id_type_v2, tvb, offset, 1, ENC_BIG_ENDIAN);
  3273. }
  3274. offset += 1;
  3275. length -= 1;
  3276. protocol_id= tvb_get_guint8(tvb, offset);
  3277. if (protocol_id == 0)
  3278. proto_tree_add_uint_format(tree, hf_isakmp_id_protoid, tvb, offset,1,
  3279. protocol_id, "Protocol ID: Unused");
  3280. else
  3281. proto_tree_add_item(tree, hf_isakmp_id_protoid, tvb, offset, 1, ENC_BIG_ENDIAN);
  3282. offset += 1;
  3283. length -= 1;
  3284. port = tvb_get_ntohs(tvb, offset);
  3285. if (port == 0)
  3286. proto_tree_add_uint_format(tree, hf_isakmp_id_port, tvb, offset, 2,
  3287. port, "Port: Unused");
  3288. else
  3289. proto_tree_add_item(tree, hf_isakmp_id_port, tvb, offset, 2, ENC_BIG_ENDIAN);
  3290. offset += 2;
  3291. length -= 2;
  3292. /*
  3293. * It shows strings of all types though some of types are not
  3294. * supported in IKEv2 specification actually.
  3295. */
  3296. idit = proto_tree_add_item(tree, hf_isakmp_id_data, tvb, offset, length, ENC_NA);
  3297. idtree = proto_item_add_subtree(idit, ett_isakmp_id);
  3298. switch (id_type) {
  3299. case IKE_ID_IPV4_ADDR:
  3300. proto_tree_add_item(idtree, hf_isakmp_id_data_ipv4_addr, tvb, offset, 4, ENC_BIG_ENDIAN);
  3301. proto_item_append_text(idit, "%s", tvb_ip_to_str(tvb, offset));
  3302. break;
  3303. case IKE_ID_FQDN:
  3304. proto_tree_add_item(idtree, hf_isakmp_id_data_fqdn, tvb, offset, length, ENC_ASCII|ENC_NA);
  3305. proto_item_append_text(idit, "%s", tvb_get_ephemeral_string(tvb, offset,length));
  3306. break;
  3307. case IKE_ID_USER_FQDN:
  3308. proto_tree_add_item(idtree, hf_isakmp_id_data_user_fqdn, tvb, offset, length, ENC_ASCII|ENC_NA);
  3309. proto_item_append_text(idit, "%s", tvb_get_ephemeral_string(tvb, offset,length));
  3310. break;
  3311. case IKE_ID_IPV4_ADDR_SUBNET:
  3312. proto_tree_add_item(idtree, hf_isakmp_id_data_ipv4_addr, tvb, offset, 4, ENC_BIG_ENDIAN);
  3313. proto_tree_add_item(idtree, hf_isakmp_id_data_ipv4_subnet, tvb, offset+4, 4, ENC_BIG_ENDIAN);
  3314. proto_item_append_text(idit, "%s/%s", tvb_ip_to_str(tvb, offset), tvb_ip_to_str(tvb, offset+4));
  3315. break;
  3316. case IKE_ID_IPV4_ADDR_RANGE:
  3317. proto_tree_add_item(idtree, hf_isakmp_id_data_ipv4_range_start, tvb, offset, 4, ENC_BIG_ENDIAN);
  3318. proto_tree_add_item(idtree, hf_isakmp_id_data_ipv4_range_end, tvb, offset+4, 4, ENC_BIG_ENDIAN);
  3319. proto_item_append_text(idit, "%s/%s", tvb_ip_to_str(tvb, offset), tvb_ip_to_str(tvb, offset+4));
  3320. break;
  3321. case IKE_ID_IPV6_ADDR:
  3322. proto_tree_add_item(idtree, hf_isakmp_id_data_ipv6_addr, tvb, offset, 16, ENC_NA);
  3323. proto_item_append_text(idit, "%s", tvb_ip6_to_str(tvb, offset));
  3324. break;
  3325. case IKE_ID_IPV6_ADDR_SUBNET:
  3326. proto_tree_add_item(idtree, hf_isakmp_id_data_ipv6_addr, tvb, offset, 16, ENC_NA);
  3327. proto_tree_add_item(idtree, hf_isakmp_id_data_ipv6_subnet, tvb, offset+16, 16, ENC_NA);
  3328. proto_item_append_text(idit, "%s/%s", tvb_ip6_to_str(tvb, offset), tvb_ip6_to_str(tvb, offset+16));
  3329. break;
  3330. case IKE_ID_IPV6_ADDR_RANGE:
  3331. proto_tree_add_item(idtree, hf_isakmp_id_data_ipv6_range_start, tvb, offset, 16, ENC_NA);
  3332. proto_tree_add_item(idtree, hf_isakmp_id_data_ipv6_range_end, tvb, offset+16, 16, ENC_NA);
  3333. proto_item_append_text(idit, "%s/%s", tvb_ip6_to_str(tvb, offset), tvb_ip6_to_str(tvb, offset+16));
  3334. break;
  3335. case IKE_ID_KEY_ID:
  3336. proto_tree_add_item(idtree, hf_isakmp_id_data_key_id, tvb, offset, length, ENC_NA);
  3337. break;
  3338. case IKE_ID_DER_ASN1_DN:
  3339. dissect_x509if_Name(FALSE, tvb, offset, &asn1_ctx, tree, hf_isakmp_id_data_cert);
  3340. break;
  3341. default:
  3342. proto_item_append_text(idit, "%s", tvb_bytes_to_str(tvb,offset,length));
  3343. break;
  3344. }
  3345. }
  3346. static void
  3347. dissect_cert(tvbuff_t *tvb, int offset, int length _U_, proto_tree *tree, int isakmp_version, packet_info *pinfo )
  3348. {
  3349. asn1_ctx_t asn1_ctx;
  3350. asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, TRUE, pinfo);
  3351. if (isakmp_version == 1)
  3352. {
  3353. proto_tree_add_item(tree, hf_isakmp_cert_encoding_v1, tvb, offset, 1, ENC_BIG_ENDIAN);
  3354. }else if (isakmp_version == 2)
  3355. {
  3356. proto_tree_add_item(tree, hf_isakmp_cert_encoding_v2, tvb, offset, 1, ENC_BIG_ENDIAN);
  3357. }
  3358. offset += 1;
  3359. dissect_x509af_Certificate(FALSE, tvb, offset, &asn1_ctx, tree, hf_isakmp_cert_data);
  3360. }
  3361. static void
  3362. dissect_certreq(tvbuff_t *tvb, int offset, int length, proto_tree *tree, int isakmp_version, packet_info *pinfo )
  3363. {
  3364. guint8 cert_type;
  3365. asn1_ctx_t asn1_ctx;
  3366. asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
  3367. cert_type = tvb_get_guint8(tvb, offset);
  3368. if (isakmp_version == 1)
  3369. {
  3370. proto_tree_add_item(tree, hf_isakmp_certreq_type_v1, tvb, offset, 1, ENC_BIG_ENDIAN);
  3371. }else if (isakmp_version == 2)
  3372. {
  3373. proto_tree_add_item(tree, hf_isakmp_certreq_type_v2, tvb, offset, 1, ENC_BIG_ENDIAN);
  3374. }
  3375. offset += 1;
  3376. length -= 1;
  3377. if (isakmp_version == 1)
  3378. {
  3379. switch(cert_type){
  3380. case 4:
  3381. dissect_x509if_Name(FALSE, tvb, offset, &asn1_ctx, tree, hf_isakmp_certreq_authority_sig);
  3382. break;
  3383. default:
  3384. proto_tree_add_item(tree, hf_isakmp_certreq_authority_v1, tvb, offset, length, ENC_NA);
  3385. break;
  3386. }
  3387. }else if (isakmp_version == 2)
  3388. {
  3389. /* this is a list of 20 byte SHA-1 hashes */
  3390. while (length > 0) {
  3391. proto_tree_add_item(tree, hf_isakmp_certreq_authority_v2, tvb, offset, 20, ENC_NA);
  3392. offset+=20;
  3393. length-=20;
  3394. }
  3395. }
  3396. }
  3397. static void
  3398. dissect_auth(tvbuff_t *tvb, int offset, int length, proto_tree *tree)
  3399. {
  3400. proto_tree_add_item(tree, hf_isakmp_auth_meth, tvb, offset, 1, ENC_BIG_ENDIAN);
  3401. offset += 4;
  3402. length -= 4;
  3403. proto_tree_add_item(tree, hf_isakmp_auth_data, tvb, offset, length, ENC_NA);
  3404. }
  3405. static void
  3406. dissect_hash(tvbuff_t *tvb, int offset, int length, proto_tree *ntree)
  3407. {
  3408. proto_tree_add_item(ntree, hf_isakmp_hash, tvb, offset, length, ENC_NA);
  3409. }
  3410. static void
  3411. dissect_sig(tvbuff_t *tvb, int offset, int length, proto_tree *ntree)
  3412. {
  3413. proto_tree_add_item(ntree, hf_isakmp_sig, tvb, offset, length, ENC_NA);
  3414. }
  3415. static void
  3416. dissect_nonce(tvbuff_t *tvb, int offset, int length, proto_tree *ntree)
  3417. {
  3418. proto_tree_add_item(ntree, hf_isakmp_nonce, tvb, offset, length, ENC_NA);
  3419. }
  3420. static void
  3421. dissect_cisco_fragmentation(tvbuff_t *tvb, int offset, int length, proto_tree *tree, packet_info *pinfo)
  3422. {
  3423. guint8 seq; /* Packet sequence number, starting from 1 */
  3424. guint8 last;
  3425. proto_tree *ptree = NULL;
  3426. ptree = proto_tree_get_parent(tree);
  3427. if (length < 4)
  3428. return;
  3429. proto_tree_add_item(tree, hf_isakmp_cisco_frag_packetid, tvb, offset, 2, ENC_BIG_ENDIAN);
  3430. offset += 2;
  3431. seq = tvb_get_guint8(tvb, offset);
  3432. proto_tree_add_item(tree, hf_isakmp_cisco_frag_seq, tvb, offset, 1, ENC_BIG_ENDIAN);
  3433. offset += 1;
  3434. last = tvb_get_guint8(tvb, offset);
  3435. proto_tree_add_item(tree, hf_isakmp_cisco_frag_last, tvb, offset, 1, ENC_BIG_ENDIAN);
  3436. offset += 1;
  3437. /*length-=4;*/
  3438. /* Start Reassembly stuff for Cisco IKE fragmentation */
  3439. {
  3440. gboolean save_fragmented;
  3441. tvbuff_t *defrag_isakmp_tvb = NULL;
  3442. fragment_head *frag_msg = NULL;
  3443. save_fragmented = pinfo->fragmented;
  3444. pinfo->fragmented = TRUE;
  3445. frag_msg = fragment_add_seq_check(&isakmp_reassembly_table, tvb, offset,
  3446. pinfo,
  3447. 12345, /*FIXME: Fragmented packet id, guint16, somehow get CKY here */
  3448. NULL,
  3449. seq-1, /* fragment sequence number, starting from 0 */
  3450. tvb_length_remaining(tvb, offset), /* fragment length - to the end */
  3451. last); /* More fragments? */
  3452. defrag_isakmp_tvb = process_reassembled_data(tvb, offset, pinfo,
  3453. "Reassembled ISAKMP", frag_msg, &isakmp_frag_items,
  3454. NULL, ptree);
  3455. if (defrag_isakmp_tvb) { /* take it all */
  3456. dissect_isakmp(defrag_isakmp_tvb, pinfo, ptree);
  3457. }
  3458. col_append_fstr(pinfo->cinfo, COL_INFO,
  3459. " (%sMessage fragment %u%s)",
  3460. (frag_msg ? "Reassembled + " : ""),
  3461. seq, (last ? " - last" : ""));
  3462. pinfo->fragmented = save_fragmented;
  3463. }
  3464. /* End Reassembly stuff for Cisco IKE fragmentation */
  3465. }
  3466. static void
  3467. dissect_notif(tvbuff_t *tvb, int offset, int length, proto_tree *tree, int isakmp_version)
  3468. {
  3469. guint8 spi_size;
  3470. guint16 msgtype;
  3471. int offset_end = 0;
  3472. offset_end = offset + length;
  3473. if (isakmp_version == 1) {
  3474. proto_tree_add_item(tree, hf_isakmp_notify_doi, tvb, offset, 1, ENC_BIG_ENDIAN);
  3475. offset += 4;
  3476. length -= 4;
  3477. }
  3478. if (isakmp_version == 1)
  3479. {
  3480. proto_tree_add_item(tree, hf_isakmp_notify_protoid_v1, tvb, offset, 1, ENC_BIG_ENDIAN);
  3481. }else if (isakmp_version == 2)
  3482. {
  3483. proto_tree_add_item(tree, hf_isakmp_notify_protoid_v2, tvb, offset, 1, ENC_BIG_ENDIAN);
  3484. }
  3485. offset += 1;
  3486. length -= 1;
  3487. spi_size = tvb_get_guint8(tvb, offset);
  3488. proto_tree_add_item(tree, hf_isakmp_spisize, tvb, offset, 1, ENC_BIG_ENDIAN);
  3489. offset += 1;
  3490. length -= 1;
  3491. msgtype = tvb_get_ntohs(tvb, offset);
  3492. if (isakmp_version == 1)
  3493. {
  3494. proto_tree_add_item(tree, hf_isakmp_notify_msgtype_v1, tvb, offset, 2, ENC_BIG_ENDIAN);
  3495. }else if (isakmp_version == 2)
  3496. {
  3497. proto_tree_add_item(tree, hf_isakmp_notify_msgtype_v2, tvb, offset, 2, ENC_BIG_ENDIAN);
  3498. }
  3499. offset += 2;
  3500. length -= 2;
  3501. if (spi_size) {
  3502. proto_tree_add_item(tree, hf_isakmp_spi, tvb, offset, spi_size, ENC_NA);
  3503. offset += spi_size;
  3504. length -= spi_size;
  3505. }
  3506. /* Notification Data */
  3507. proto_tree_add_item(tree, hf_isakmp_notify_data, tvb, offset, length, ENC_NA);
  3508. if (isakmp_version == 1)
  3509. {
  3510. switch (msgtype) {
  3511. case 36136: /* DPD ARE YOU THERE */
  3512. proto_tree_add_item(tree, hf_isakmp_notify_data_dpd_are_you_there, tvb, offset, length, ENC_BIG_ENDIAN);
  3513. break;
  3514. case 36137: /* DPD ARE YOU THERE ACK */
  3515. proto_tree_add_item(tree, hf_isakmp_notify_data_dpd_are_you_there_ack, tvb, offset, length, ENC_BIG_ENDIAN);
  3516. break;
  3517. case 40501: /* UNITY Load Balance */
  3518. proto_tree_add_item(tree, hf_isakmp_notify_data_unity_load_balance, tvb, offset, length, ENC_BIG_ENDIAN);
  3519. break;
  3520. default:
  3521. /* No Default Action */
  3522. break;
  3523. }
  3524. } else if (isakmp_version == 2)
  3525. {
  3526. switch(msgtype){
  3527. case 16387: /* IPCOMP_SUPPORTED */
  3528. proto_tree_add_item(tree, hf_isakmp_notify_data_ipcomp_cpi, tvb, offset, 2, ENC_BIG_ENDIAN);
  3529. proto_tree_add_item(tree, hf_isakmp_notify_data_ipcomp_transform_id, tvb, offset+2, 1, ENC_BIG_ENDIAN);
  3530. break;
  3531. case 16407: /* REDIRECT */
  3532. proto_tree_add_item(tree, hf_isakmp_notify_data_redirect_gw_ident_type, tvb, offset, 1, ENC_BIG_ENDIAN);
  3533. proto_tree_add_item(tree, hf_isakmp_notify_data_redirect_gw_ident_len, tvb, offset+1, 1, ENC_BIG_ENDIAN);
  3534. switch(tvb_get_guint8(tvb, offset)){ /* Ident Type ? */
  3535. case 1:
  3536. proto_tree_add_item(tree, hf_isakmp_notify_data_redirect_new_resp_gw_ident_ipv4, tvb, offset+2, 4, ENC_BIG_ENDIAN);
  3537. break;
  3538. case 2:
  3539. proto_tree_add_item(tree, hf_isakmp_notify_data_redirect_new_resp_gw_ident_ipv6, tvb, offset+2, 16, ENC_NA);
  3540. break;
  3541. case 3:
  3542. proto_tree_add_item(tree, hf_isakmp_notify_data_redirect_new_resp_gw_ident_fqdn, tvb, offset+2, tvb_get_guint8(tvb,offset+1), ENC_ASCII|ENC_NA);
  3543. break;
  3544. default :
  3545. proto_tree_add_item(tree, hf_isakmp_notify_data_redirect_new_resp_gw_ident, tvb, offset+2, tvb_get_guint8(tvb,offset+1), ENC_NA);
  3546. break;
  3547. }
  3548. length -= tvb_get_guint8(tvb, offset+1) - 2;
  3549. offset += tvb_get_guint8(tvb, offset+1) + 2;
  3550. if(length)
  3551. {
  3552. proto_tree_add_item(tree, hf_isakmp_notify_data_redirect_nonce_data, tvb, offset, length, ENC_NA);
  3553. }
  3554. break;
  3555. case 16408: /* REDIRECT_FROM */
  3556. proto_tree_add_item(tree, hf_isakmp_notify_data_redirect_gw_ident_type, tvb, offset, 1, ENC_BIG_ENDIAN);
  3557. proto_tree_add_item(tree, hf_isakmp_notify_data_redirect_gw_ident_len, tvb, offset+1, 1, ENC_BIG_ENDIAN);
  3558. switch(tvb_get_guint8(tvb, offset)){ /* Ident Type ? */
  3559. case 1:
  3560. proto_tree_add_item(tree, hf_isakmp_notify_data_redirect_org_resp_gw_ident_ipv4, tvb, offset+2, 4, ENC_BIG_ENDIAN);
  3561. break;
  3562. case 2:
  3563. proto_tree_add_item(tree, hf_isakmp_notify_data_redirect_org_resp_gw_ident_ipv6, tvb, offset+2, 16, ENC_NA);
  3564. break;
  3565. default :
  3566. proto_tree_add_item(tree, hf_isakmp_notify_data_redirect_org_resp_gw_ident, tvb, offset+2, tvb_get_guint8(tvb,offset+1), ENC_NA);
  3567. break;
  3568. }
  3569. break;
  3570. case 16409: /* TICKET_LT_OPAQUE */
  3571. proto_tree_add_item(tree, hf_isakmp_notify_data_ticket_lifetime, tvb, offset, 4, ENC_BIG_ENDIAN);
  3572. offset += 4;
  3573. length -= 4;
  3574. proto_tree_add_item(tree, hf_isakmp_notify_data_ticket_data, tvb, offset, length, ENC_NA);
  3575. break;
  3576. case 16413: /* TICKET_OPAQUE */
  3577. proto_tree_add_item(tree, hf_isakmp_notify_data_ticket_data, tvb, offset, length, ENC_NA);
  3578. break;
  3579. case 16416: /* ROHC_SUPPORTED */
  3580. while (offset < offset_end) {
  3581. offset += dissect_rohc_supported(tvb, tree, offset);
  3582. }
  3583. break;
  3584. case 16419: /* QUICK_CRASH_DETECTION */
  3585. proto_tree_add_item(tree, hf_isakmp_notify_data_qcd_token_secret_data, tvb, offset, length, ENC_NA);
  3586. break;
  3587. case 16422: /* IKEV2_MESSAGE_ID_SYNC */
  3588. proto_tree_add_item(tree, hf_isakmp_notify_data_ha_nonce_data, tvb, offset, 4, ENC_BIG_ENDIAN);
  3589. offset += 4;
  3590. proto_tree_add_item(tree, hf_isakmp_notify_data_ha_expected_send_req_msg_id, tvb, offset, 4, ENC_BIG_ENDIAN);
  3591. offset += 4;
  3592. proto_tree_add_item(tree, hf_isakmp_notify_data_ha_expected_recv_req_msg_id, tvb, offset, 4, ENC_BIG_ENDIAN);
  3593. break;
  3594. case 16423: /* IPSEC_REPLAY_COUNTER_SYNC */
  3595. proto_tree_add_item(tree, hf_isakmp_notify_data_ha_incoming_ipsec_sa_delta_value, tvb, offset, length, ENC_NA);
  3596. break;
  3597. case 16424: /* SECURE_PASSWORD_METHODS */
  3598. proto_tree_add_item(tree, hf_isakmp_notify_data_secure_password_methods, tvb, offset, length, ENC_NA);
  3599. break;
  3600. default:
  3601. /* No Default Action */
  3602. break;
  3603. }
  3604. }
  3605. }
  3606. static void
  3607. dissect_delete(tvbuff_t *tvb, int offset, int length, proto_tree *tree, int isakmp_version)
  3608. {
  3609. guint8 spi_size;
  3610. if (isakmp_version == 1) {
  3611. proto_tree_add_item(tree, hf_isakmp_delete_doi, tvb, offset, 1, ENC_BIG_ENDIAN);
  3612. offset += 4;
  3613. length -= 4;
  3614. }
  3615. if (isakmp_version == 1)
  3616. {
  3617. proto_tree_add_item(tree, hf_isakmp_delete_protoid_v1, tvb, offset, 1, ENC_BIG_ENDIAN);
  3618. }else if (isakmp_version == 2)
  3619. {
  3620. proto_tree_add_item(tree, hf_isakmp_delete_protoid_v2, tvb, offset, 1, ENC_BIG_ENDIAN);
  3621. }
  3622. offset += 1;
  3623. length -= 1;
  3624. spi_size = tvb_get_guint8(tvb, offset);
  3625. proto_tree_add_item(tree, hf_isakmp_spisize, tvb, offset, 1, ENC_BIG_ENDIAN);
  3626. offset += 1;
  3627. length -= 1;
  3628. proto_tree_add_item(tree, hf_isakmp_num_spis, tvb, offset, 2, ENC_BIG_ENDIAN);
  3629. offset += 2;
  3630. length -= 2;
  3631. if (spi_size > 0) {
  3632. while (length > 0) {
  3633. proto_tree_add_item(tree, hf_isakmp_delete_spi, tvb, offset, spi_size, ENC_NA);
  3634. offset+=spi_size;
  3635. length-=spi_size;
  3636. }
  3637. }
  3638. }
  3639. static int
  3640. dissect_vid(tvbuff_t *tvb, int offset, int length, proto_tree *tree)
  3641. {
  3642. const guint8 * pVID;
  3643. const char * vendorstring;
  3644. pVID = tvb_get_ptr(tvb, offset, length);
  3645. vendorstring = byte_to_str(pVID, (gint)length, vendor_id, "Unknown Vendor ID");
  3646. proto_tree_add_item(tree, hf_isakmp_vid_bytes, tvb, offset, length, ENC_NA);
  3647. proto_tree_add_string(tree, hf_isakmp_vid_string, tvb, offset, length, vendorstring);
  3648. proto_item_append_text(tree," : %s", vendorstring);
  3649. /* Check Point VID */
  3650. if (length >= 24 && memcmp(pVID, VID_CP, 20) == 0)
  3651. {
  3652. offset += 20;
  3653. proto_tree_add_item(tree, hf_isakmp_vid_cp_product, tvb, offset, 4, ENC_BIG_ENDIAN);
  3654. offset +=4;
  3655. proto_tree_add_item(tree, hf_isakmp_vid_cp_version, tvb, offset, 4, ENC_BIG_ENDIAN);
  3656. offset +=4;
  3657. proto_tree_add_item(tree, hf_isakmp_vid_cp_timestamp, tvb, offset, 4, ENC_BIG_ENDIAN);
  3658. offset +=4;
  3659. proto_tree_add_item(tree, hf_isakmp_vid_cp_reserved, tvb, offset, 4, ENC_BIG_ENDIAN);
  3660. offset +=4;
  3661. proto_tree_add_item(tree, hf_isakmp_vid_cp_features, tvb, offset, 4, ENC_BIG_ENDIAN);
  3662. offset +=4;
  3663. }
  3664. /* Cisco Unity VID */
  3665. if (length >= 14 && memcmp(pVID, VID_CISCO_UNITY, 14) == 0)
  3666. {
  3667. offset += 14;
  3668. proto_tree_add_item(tree, hf_isakmp_vid_cisco_unity_major, tvb, offset, 1, ENC_BIG_ENDIAN);
  3669. proto_item_append_text(tree, " %u", tvb_get_guint8(tvb,offset));
  3670. offset += 1;
  3671. proto_tree_add_item(tree, hf_isakmp_vid_cisco_unity_minor, tvb, offset, 1, ENC_BIG_ENDIAN);
  3672. proto_item_append_text(tree, ".%u", tvb_get_guint8(tvb,offset));
  3673. offset += 1;
  3674. }
  3675. /* VID_MS_NT5_ISAKMPOAKLEY */
  3676. if (length >= 16 && memcmp(pVID, VID_MS_NT5_ISAKMPOAKLEY, 16) == 0)
  3677. {
  3678. offset += 16;
  3679. proto_tree_add_item(tree, hf_isakmp_vid_ms_nt5_isakmpoakley, tvb, offset, 4, ENC_BIG_ENDIAN);
  3680. offset += 4;
  3681. }
  3682. /* VID_ARUBA_VIA_AUTH_PROFILE */
  3683. if (length >= 19 && memcmp(pVID, VID_ARUBA_VIA_AUTH_PROFILE, 19) == 0)
  3684. {
  3685. offset += 19;
  3686. proto_tree_add_item(tree, hf_isakmp_vid_aruba_via_auth_profile, tvb, offset, length-19, ENC_ASCII|ENC_NA);
  3687. offset += 4;
  3688. }
  3689. return offset;
  3690. }
  3691. /* Returns the number of bytes consumed by this option. */
  3692. static int
  3693. dissect_config_attribute(tvbuff_t *tvb, proto_tree *cfg_attr_type_tree, int offset, int isakmp_version)
  3694. {
  3695. guint optlen, cfg_attr_type, len = 0;
  3696. int offset_end = 0;
  3697. proto_item *cfg_attr_type_item = NULL;
  3698. proto_tree *sub_cfg_attr_type_tree = NULL;
  3699. cfg_attr_type = tvb_get_ntohs(tvb, offset);
  3700. optlen = tvb_get_ntohs(tvb, offset+2);
  3701. len = 2;
  3702. /* No Length ? */
  3703. if (cfg_attr_type & 0x8000) {
  3704. cfg_attr_type = cfg_attr_type & 0x7fff;
  3705. len = 0;
  3706. optlen = 2;
  3707. }
  3708. if (isakmp_version == 1) {
  3709. cfg_attr_type_item = proto_tree_add_none_format(cfg_attr_type_tree, hf_isakmp_cfg_attr, tvb, offset, 2+len+optlen, "Attribute Type: (t=%d,l=%d) %s", cfg_attr_type, optlen, rval_to_str(cfg_attr_type,vs_v1_cfgattr,"Unknown Attribute Type (%02d)") );
  3710. sub_cfg_attr_type_tree = proto_item_add_subtree(cfg_attr_type_item, ett_isakmp_cfg_attr);
  3711. proto_tree_add_uint(sub_cfg_attr_type_tree, hf_isakmp_cfg_attr_type_v1, tvb, offset, 2, cfg_attr_type);
  3712. } else if (isakmp_version == 2) {
  3713. cfg_attr_type_item = proto_tree_add_none_format(cfg_attr_type_tree, hf_isakmp_cfg_attr, tvb, offset, 2+len+optlen, "Attribute Type: (t=%d,l=%d) %s", cfg_attr_type, optlen, rval_to_str(cfg_attr_type,vs_v2_cfgattr,"Unknown Attribute Type (%02d)") );
  3714. sub_cfg_attr_type_tree = proto_item_add_subtree(cfg_attr_type_item, ett_isakmp_cfg_attr);
  3715. proto_tree_add_uint(sub_cfg_attr_type_tree, hf_isakmp_cfg_attr_type_v2, tvb, offset, 2, cfg_attr_type);
  3716. }
  3717. proto_tree_add_item(sub_cfg_attr_type_tree, hf_isakmp_cfg_attr_format, tvb, offset, 2, ENC_BIG_ENDIAN);
  3718. offset += 2;
  3719. if (len)
  3720. {
  3721. proto_tree_add_item(sub_cfg_attr_type_tree, hf_isakmp_cfg_attr_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  3722. offset += 2;
  3723. }
  3724. if (optlen==0)
  3725. {
  3726. proto_tree_add_text(sub_cfg_attr_type_tree, tvb, offset, 0,"Attribut value is empty");
  3727. return 2+len;
  3728. }
  3729. proto_tree_add_item(sub_cfg_attr_type_tree, hf_isakmp_cfg_attr_value, tvb, offset, optlen, ENC_NA);
  3730. switch (cfg_attr_type) {
  3731. case INTERNAL_IP4_ADDRESS: /* 1 */
  3732. offset_end = offset + optlen;
  3733. if (optlen%4 == 0)
  3734. {
  3735. while (offset_end-offset > 0)
  3736. {
  3737. proto_tree_add_item(sub_cfg_attr_type_tree, hf_isakmp_cfg_attr_internal_ip4_address, tvb, offset, 4, ENC_BIG_ENDIAN);
  3738. offset += 4;
  3739. }
  3740. }
  3741. break;
  3742. case INTERNAL_IP4_NETMASK: /* 2 */
  3743. proto_tree_add_item(sub_cfg_attr_type_tree, hf_isakmp_cfg_attr_internal_ip4_netmask, tvb, offset, 4, ENC_BIG_ENDIAN);
  3744. break;
  3745. case INTERNAL_IP4_DNS: /* 3 */
  3746. offset_end = offset + optlen;
  3747. if (optlen%4 == 0)
  3748. {
  3749. while (offset_end-offset > 0)
  3750. {
  3751. proto_tree_add_item(sub_cfg_attr_type_tree, hf_isakmp_cfg_attr_internal_ip4_dns, tvb, offset, 4, ENC_BIG_ENDIAN);
  3752. offset += 4;
  3753. }
  3754. }
  3755. break;
  3756. case INTERNAL_IP4_NBNS: /* 4 */
  3757. offset_end = offset + optlen;
  3758. if (optlen%4 == 0)
  3759. {
  3760. while (offset_end-offset > 0)
  3761. {
  3762. proto_tree_add_item(sub_cfg_attr_type_tree, hf_isakmp_cfg_attr_internal_ip4_nbns, tvb, offset, 4, ENC_BIG_ENDIAN);
  3763. offset += 4;
  3764. }
  3765. }
  3766. break;
  3767. case INTERNAL_ADDRESS_EXPIRY: /* 5 */
  3768. proto_tree_add_item(sub_cfg_attr_type_tree, hf_isakmp_cfg_attr_internal_address_expiry, tvb, offset, 4, ENC_BIG_ENDIAN);
  3769. break;
  3770. case INTERNAL_IP4_DHCP: /* 6 */
  3771. offset_end = offset + optlen;
  3772. if (optlen%4 == 0)
  3773. {
  3774. while (offset_end-offset > 0)
  3775. {
  3776. proto_tree_add_item(sub_cfg_attr_type_tree, hf_isakmp_cfg_attr_internal_ip4_dhcp, tvb, offset, 4, ENC_BIG_ENDIAN);
  3777. offset += 4;
  3778. }
  3779. }
  3780. break;
  3781. case APPLICATION_VERSION: /* 7 */
  3782. proto_tree_add_item(sub_cfg_attr_type_tree, hf_isakmp_cfg_attr_application_version, tvb, offset, optlen, ENC_ASCII|ENC_NA);
  3783. proto_item_append_text(cfg_attr_type_item," : %s", tvb_get_ephemeral_string(tvb, offset,optlen));
  3784. break;
  3785. case INTERNAL_IP6_ADDRESS: /* 8 */
  3786. offset_end = offset + optlen;
  3787. if (optlen%16 == 0)
  3788. {
  3789. while (offset_end-offset > 0)
  3790. {
  3791. proto_tree_add_item(sub_cfg_attr_type_tree, hf_isakmp_cfg_attr_internal_ip6_address, tvb, offset, 16, ENC_BIG_ENDIAN);
  3792. offset += 16;
  3793. }
  3794. }
  3795. break;
  3796. case INTERNAL_IP6_NETMASK: /* 9 Only in IKEv1 */
  3797. proto_tree_add_item(sub_cfg_attr_type_tree, hf_isakmp_cfg_attr_internal_ip6_netmask, tvb, offset, 18, ENC_NA);
  3798. break;
  3799. case INTERNAL_IP6_DNS: /* 10 */
  3800. offset_end = offset + optlen;
  3801. if (optlen%16 == 0)
  3802. {
  3803. while (offset_end-offset > 0)
  3804. {
  3805. proto_tree_add_item(sub_cfg_attr_type_tree, hf_isakmp_cfg_attr_internal_ip6_dns, tvb, offset, 16, ENC_NA);
  3806. offset += 16;
  3807. }
  3808. }
  3809. break;
  3810. case INTERNAL_IP6_NBNS: /* 11 */
  3811. offset_end = offset + optlen;
  3812. if (optlen%16 == 0)
  3813. {
  3814. while (offset_end-offset > 0)
  3815. {
  3816. proto_tree_add_item(sub_cfg_attr_type_tree, hf_isakmp_cfg_attr_internal_ip6_nbns, tvb, offset, 16, ENC_NA);
  3817. offset += 16;
  3818. }
  3819. }
  3820. break;
  3821. case INTERNAL_IP6_DHCP: /* 12 */
  3822. offset_end = offset + optlen;
  3823. if (optlen%16 == 0)
  3824. {
  3825. while (offset_end-offset > 0)
  3826. {
  3827. proto_tree_add_item(sub_cfg_attr_type_tree, hf_isakmp_cfg_attr_internal_ip6_dhcp, tvb, offset, 16, ENC_NA);
  3828. offset += 16;
  3829. }
  3830. }
  3831. break;
  3832. case INTERNAL_IP4_SUBNET: /* 13 */
  3833. offset_end = offset + optlen;
  3834. if (optlen%8 == 0)
  3835. {
  3836. while (offset_end-offset > 0)
  3837. {
  3838. proto_tree_add_item(sub_cfg_attr_type_tree, hf_isakmp_cfg_attr_internal_ip4_subnet_ip, tvb, offset, 4, ENC_BIG_ENDIAN);
  3839. proto_tree_add_item(sub_cfg_attr_type_tree, hf_isakmp_cfg_attr_internal_ip4_subnet_netmask, tvb, offset, 4, ENC_BIG_ENDIAN);
  3840. offset += 8;
  3841. }
  3842. }
  3843. break;
  3844. case SUPPORTED_ATTRIBUTES: /* 14 */
  3845. offset_end = offset + optlen;
  3846. if (optlen%2 == 0)
  3847. {
  3848. while (offset_end-offset > 0)
  3849. {
  3850. proto_tree_add_item(sub_cfg_attr_type_tree, hf_isakmp_cfg_attr_supported_attributes, tvb, offset, 2, ENC_BIG_ENDIAN);
  3851. offset += 2;
  3852. }
  3853. }
  3854. break;
  3855. case INTERNAL_IP6_SUBNET: /* 15 */
  3856. offset_end = offset + optlen;
  3857. if (optlen%17 == 0)
  3858. {
  3859. while (offset_end-offset > 0)
  3860. {
  3861. proto_tree_add_item(sub_cfg_attr_type_tree, hf_isakmp_cfg_attr_internal_ip6_subnet_ip, tvb, offset, 16, ENC_NA);
  3862. offset += 16;
  3863. proto_tree_add_item(sub_cfg_attr_type_tree, hf_isakmp_cfg_attr_internal_ip6_subnet_prefix, tvb, offset, 1, ENC_BIG_ENDIAN);
  3864. offset += 1;
  3865. }
  3866. }
  3867. break;
  3868. case INTERNAL_IP6_LINK: /* 17 */
  3869. proto_tree_add_item(sub_cfg_attr_type_tree, hf_isakmp_cfg_attr_internal_ip6_link_interface, tvb, offset, 8, ENC_BIG_ENDIAN);
  3870. offset += 8;
  3871. proto_tree_add_item(sub_cfg_attr_type_tree, hf_isakmp_cfg_attr_internal_ip6_link_id, tvb, offset, optlen-8, ENC_NA);
  3872. break;
  3873. case INTERNAL_IP6_PREFIX: /* 18 */
  3874. offset_end = offset + optlen;
  3875. if (optlen%17 == 0)
  3876. {
  3877. while (offset_end-offset > 0)
  3878. {
  3879. proto_tree_add_item(sub_cfg_attr_type_tree, hf_isakmp_cfg_attr_internal_ip6_prefix_ip, tvb, offset, 16, ENC_NA);
  3880. offset += 16;
  3881. proto_tree_add_item(sub_cfg_attr_type_tree, hf_isakmp_cfg_attr_internal_ip6_prefix_length, tvb, offset, 1, ENC_BIG_ENDIAN);
  3882. offset += 1;
  3883. }
  3884. }
  3885. break;
  3886. case XAUTH_TYPE: /* 16520 */
  3887. proto_tree_add_item(sub_cfg_attr_type_tree, hf_isakmp_cfg_attr_xauth_type, tvb, offset, optlen, ENC_BIG_ENDIAN);
  3888. proto_item_append_text(cfg_attr_type_item," : %s", rval_to_str(tvb_get_ntohs(tvb, offset), cfgattr_xauth_type, "Unknown %d"));
  3889. break;
  3890. case XAUTH_USER_NAME: /* 16521 */
  3891. proto_tree_add_item(sub_cfg_attr_type_tree, hf_isakmp_cfg_attr_xauth_user_name, tvb, offset, optlen, ENC_ASCII|ENC_NA);
  3892. proto_item_append_text(cfg_attr_type_item," : %s", tvb_get_ephemeral_string(tvb, offset,optlen));
  3893. break;
  3894. case XAUTH_USER_PASSWORD: /* 16522 */
  3895. proto_tree_add_item(sub_cfg_attr_type_tree, hf_isakmp_cfg_attr_xauth_user_password, tvb, offset, optlen, ENC_ASCII|ENC_NA);
  3896. proto_item_append_text(cfg_attr_type_item," : %s", tvb_get_ephemeral_string(tvb, offset,optlen));
  3897. break;
  3898. case XAUTH_PASSCODE: /* 16523 */
  3899. proto_tree_add_item(sub_cfg_attr_type_tree, hf_isakmp_cfg_attr_xauth_passcode, tvb, offset, optlen, ENC_ASCII|ENC_NA);
  3900. proto_item_append_text(cfg_attr_type_item," : %s", tvb_get_ephemeral_string(tvb, offset,optlen));
  3901. break;
  3902. case XAUTH_MESSAGE: /* 16524 */
  3903. proto_tree_add_item(sub_cfg_attr_type_tree, hf_isakmp_cfg_attr_xauth_message, tvb, offset, optlen, ENC_ASCII|ENC_NA);
  3904. proto_item_append_text(cfg_attr_type_item," : %s", tvb_get_ephemeral_string(tvb, offset,optlen));
  3905. break;
  3906. case XAUTH_CHALLENGE: /* 16525 */
  3907. proto_tree_add_item(sub_cfg_attr_type_tree, hf_isakmp_cfg_attr_xauth_challenge, tvb, offset, optlen, ENC_ASCII|ENC_NA);
  3908. proto_item_append_text(cfg_attr_type_item," : %s", tvb_get_ephemeral_string(tvb, offset,optlen));
  3909. break;
  3910. case XAUTH_DOMAIN: /* 16526 */
  3911. proto_tree_add_item(sub_cfg_attr_type_tree, hf_isakmp_cfg_attr_xauth_domain, tvb, offset, optlen, ENC_ASCII|ENC_NA);
  3912. proto_item_append_text(cfg_attr_type_item," : %s", tvb_get_ephemeral_string(tvb, offset,optlen));
  3913. break;
  3914. case XAUTH_STATUS: /* 16527 */
  3915. proto_tree_add_item(sub_cfg_attr_type_tree, hf_isakmp_cfg_attr_xauth_status, tvb, offset, optlen, ENC_BIG_ENDIAN);
  3916. proto_item_append_text(cfg_attr_type_item," : %s", val_to_str(tvb_get_ntohs(tvb, offset), cfgattr_xauth_status, "Unknown %d"));
  3917. break;
  3918. case XAUTH_NEXT_PIN: /* 16528 */
  3919. proto_tree_add_item(sub_cfg_attr_type_tree, hf_isakmp_cfg_attr_xauth_next_pin, tvb, offset, optlen, ENC_ASCII|ENC_NA);
  3920. proto_item_append_text(cfg_attr_type_item," : %s", tvb_get_ephemeral_string(tvb, offset,optlen));
  3921. break;
  3922. case XAUTH_ANSWER: /* 16527 */
  3923. proto_tree_add_item(sub_cfg_attr_type_tree, hf_isakmp_cfg_attr_xauth_answer, tvb, offset, optlen, ENC_ASCII|ENC_NA);
  3924. proto_item_append_text(cfg_attr_type_item," : %s", tvb_get_ephemeral_string(tvb, offset,optlen));
  3925. break;
  3926. case UNITY_BANNER: /* 28672 */
  3927. proto_tree_add_item(sub_cfg_attr_type_tree, hf_isakmp_cfg_attr_unity_banner, tvb, offset, optlen, ENC_ASCII|ENC_NA);
  3928. proto_item_append_text(cfg_attr_type_item," : %s", tvb_get_ephemeral_string(tvb, offset,optlen));
  3929. break;
  3930. case UNITY_DEF_DOMAIN: /* 28674 */
  3931. proto_tree_add_item(sub_cfg_attr_type_tree, hf_isakmp_cfg_attr_unity_def_domain, tvb, offset, optlen, ENC_ASCII|ENC_NA);
  3932. proto_item_append_text(cfg_attr_type_item," : %s", tvb_get_ephemeral_string(tvb, offset,optlen));
  3933. break;
  3934. /* TODO: Support other UNITY Attributes ! */
  3935. default:
  3936. /* No Default Action */
  3937. break;
  3938. }
  3939. return 2+len+optlen;
  3940. }
  3941. static void
  3942. dissect_config(tvbuff_t *tvb, int offset, int length, proto_tree *tree, int isakmp_version)
  3943. {
  3944. int offset_end = 0;
  3945. offset_end = offset + length;
  3946. if (isakmp_version == 1) {
  3947. proto_tree_add_item(tree, hf_isakmp_cfg_type_v1,tvb, offset, 1, ENC_BIG_ENDIAN);
  3948. offset += 2;
  3949. proto_tree_add_item(tree, hf_isakmp_cfg_identifier,tvb, offset, 1, ENC_BIG_ENDIAN);
  3950. offset += 2;
  3951. } else if (isakmp_version == 2) {
  3952. proto_tree_add_item(tree, hf_isakmp_cfg_type_v2,tvb, offset, 1, ENC_BIG_ENDIAN);
  3953. offset += 4;
  3954. }
  3955. while (offset < offset_end) {
  3956. offset += dissect_config_attribute(tvb, tree, offset, isakmp_version);
  3957. }
  3958. }
  3959. static void
  3960. dissect_nat_discovery(tvbuff_t *tvb, int offset, int length, proto_tree *tree )
  3961. {
  3962. proto_tree_add_item(tree, hf_isakmp_nat_hash, tvb, offset, length, ENC_NA);
  3963. }
  3964. static void
  3965. dissect_nat_original_address(tvbuff_t *tvb, int offset, int length _U_, proto_tree *tree, int isakmp_version)
  3966. {
  3967. guint8 id_type;
  3968. id_type = tvb_get_guint8(tvb, offset);
  3969. if (isakmp_version == 1)
  3970. {
  3971. proto_tree_add_item(tree, hf_isakmp_id_type_v1, tvb, offset, 1, ENC_BIG_ENDIAN);
  3972. }else if (isakmp_version == 2)
  3973. {
  3974. proto_tree_add_item(tree, hf_isakmp_id_type_v2, tvb, offset, 1, ENC_BIG_ENDIAN);
  3975. }
  3976. offset += 1;
  3977. offset += 3; /* reserved */
  3978. switch (id_type) {
  3979. case IKE_ID_IPV4_ADDR:
  3980. proto_tree_add_item(tree, hf_isakmp_nat_original_address_ipv4, tvb, offset, 4, ENC_BIG_ENDIAN);
  3981. break;
  3982. case IKE_ID_IPV6_ADDR:
  3983. proto_tree_add_item(tree, hf_isakmp_nat_original_address_ipv6, tvb, offset, 16, ENC_NA);
  3984. break;
  3985. default:
  3986. break;
  3987. }
  3988. }
  3989. static void
  3990. dissect_ts(tvbuff_t *tvb, int offset, int length, proto_tree *tree)
  3991. {
  3992. guint8 num, tstype, protocol_id;
  3993. num = tvb_get_guint8(tvb, offset);
  3994. proto_item_append_text(tree," # %d", num);
  3995. proto_tree_add_item(tree, hf_isakmp_ts_number_of_ts, tvb, offset, 1, ENC_BIG_ENDIAN);
  3996. offset += 1;
  3997. length -= 1;
  3998. offset += 3; /* Reserved */
  3999. length -= 3;
  4000. while (length > 0) {
  4001. tstype = tvb_get_guint8(tvb, offset);
  4002. proto_tree_add_item(tree, hf_isakmp_ts_type, tvb, offset, 1, ENC_BIG_ENDIAN);
  4003. offset += 1;
  4004. length -= 1;
  4005. switch (tstype) {
  4006. case IKEV2_TS_IPV4_ADDR_RANGE:
  4007. protocol_id = tvb_get_guint8(tvb, offset);
  4008. if (protocol_id == 0)
  4009. proto_tree_add_uint_format(tree, hf_isakmp_ts_protoid, tvb, offset,1,
  4010. protocol_id, "Protocol ID: Unused");
  4011. else
  4012. proto_tree_add_item(tree, hf_isakmp_ts_protoid, tvb, offset, 1, ENC_BIG_ENDIAN);
  4013. offset += 1;
  4014. length -= 1;
  4015. proto_tree_add_item(tree, hf_isakmp_ts_selector_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  4016. offset += 2;
  4017. length -= 2;
  4018. proto_tree_add_item(tree, hf_isakmp_ts_start_port, tvb, offset, 2, ENC_BIG_ENDIAN);
  4019. offset += 2;
  4020. length -= 2;
  4021. proto_tree_add_item(tree, hf_isakmp_ts_end_port, tvb, offset, 2, ENC_BIG_ENDIAN);
  4022. offset += 2;
  4023. length -= 2;
  4024. proto_tree_add_item(tree, hf_isakmp_ts_start_addr_ipv4, tvb, offset, 4, ENC_BIG_ENDIAN);
  4025. offset += 4;
  4026. length -= 4;
  4027. proto_tree_add_item(tree, hf_isakmp_ts_end_addr_ipv4, tvb, offset, 4, ENC_BIG_ENDIAN);
  4028. offset += 4;
  4029. length -= 4;
  4030. break;
  4031. case IKEV2_TS_IPV6_ADDR_RANGE:
  4032. protocol_id = tvb_get_guint8(tvb, offset);
  4033. if (protocol_id == 0)
  4034. proto_tree_add_uint_format(tree, hf_isakmp_ts_protoid, tvb, offset,1,
  4035. protocol_id, "Protocol ID: Unused");
  4036. else
  4037. proto_tree_add_item(tree, hf_isakmp_ts_protoid, tvb, offset, 1, ENC_BIG_ENDIAN);
  4038. offset += 1;
  4039. length -= 1;
  4040. proto_tree_add_item(tree, hf_isakmp_ts_selector_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  4041. offset += 2;
  4042. length -= 2;
  4043. proto_tree_add_item(tree, hf_isakmp_ts_start_port, tvb, offset, 2, ENC_BIG_ENDIAN);
  4044. offset += 2;
  4045. length -= 2;
  4046. proto_tree_add_item(tree, hf_isakmp_ts_end_port, tvb, offset, 2, ENC_BIG_ENDIAN);
  4047. offset += 2;
  4048. length -= 2;
  4049. proto_tree_add_item(tree, hf_isakmp_ts_start_addr_ipv6, tvb, offset, 16, ENC_NA);
  4050. offset += 16;
  4051. length -= 16;
  4052. proto_tree_add_item(tree, hf_isakmp_ts_end_addr_ipv6, tvb, offset, 16, ENC_NA);
  4053. offset += 16;
  4054. length -= 16;
  4055. break;
  4056. case IKEV2_TS_FC_ADDR_RANGE:
  4057. offset += 1; /* Reserved */
  4058. length -= 1;
  4059. proto_tree_add_item(tree, hf_isakmp_ts_selector_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  4060. offset += 2;
  4061. length -= 2;
  4062. offset += 1; /* Reserved */
  4063. length -= 1;
  4064. proto_tree_add_item(tree, hf_isakmp_ts_start_addr_fc, tvb, offset, 3, ENC_BIG_ENDIAN);
  4065. offset += 3;
  4066. length -= 3;
  4067. offset += 1; /* Reserved */
  4068. length -= 1;
  4069. proto_tree_add_item(tree, hf_isakmp_ts_end_addr_fc, tvb, offset, 3, ENC_BIG_ENDIAN);
  4070. offset += 3;
  4071. length -= 3;
  4072. proto_tree_add_item(tree, hf_isakmp_ts_start_r_ctl, tvb, offset, 1, ENC_BIG_ENDIAN);
  4073. offset += 1;
  4074. length -= 1;
  4075. proto_tree_add_item(tree, hf_isakmp_ts_end_r_ctl, tvb, offset, 1, ENC_BIG_ENDIAN);
  4076. offset += 1;
  4077. length -= 1;
  4078. proto_tree_add_item(tree, hf_isakmp_ts_start_type, tvb, offset, 1, ENC_BIG_ENDIAN);
  4079. offset += 1;
  4080. length -= 1;
  4081. proto_tree_add_item(tree, hf_isakmp_ts_end_type, tvb, offset, 1, ENC_BIG_ENDIAN);
  4082. offset += 1;
  4083. length -= 1;
  4084. break;
  4085. default:
  4086. proto_tree_add_item(tree, hf_isakmp_ts_data, tvb, offset, length, ENC_NA);
  4087. offset += length;
  4088. length -= length;
  4089. break;
  4090. }
  4091. }
  4092. }
  4093. static void
  4094. dissect_enc(tvbuff_t *tvb,
  4095. int offset,
  4096. int length,
  4097. proto_tree *tree,
  4098. #ifdef HAVE_LIBGCRYPT
  4099. packet_info *pinfo,
  4100. guint8 inner_payload)
  4101. #else
  4102. packet_info *pinfo _U_,
  4103. guint8 inner_payload _U_)
  4104. #endif
  4105. {
  4106. #ifdef HAVE_LIBGCRYPT
  4107. ikev2_decrypt_data_t *key_info = NULL;
  4108. gint iv_len, encr_data_len, icd_len, decr_data_len, md_len;
  4109. guint8 pad_len;
  4110. guchar *iv = NULL, *encr_data = NULL, *decr_data = NULL, *entire_message = NULL, *md = NULL;
  4111. gcry_cipher_hd_t cipher_hd;
  4112. gcry_md_hd_t md_hd;
  4113. gcry_error_t err = 0;
  4114. proto_item *item = NULL, *icd_item = NULL, *encr_data_item = NULL, *padlen_item = NULL, *iv_item = NULL;
  4115. tvbuff_t *decr_tvb = NULL;
  4116. gint payloads_len;
  4117. proto_tree *decr_tree = NULL, *decr_payloads_tree = NULL;
  4118. if (pinfo->private_data) {
  4119. key_info = (ikev2_decrypt_data_t*)(pinfo->private_data);
  4120. iv_len = key_info->encr_spec->iv_len;
  4121. icd_len = key_info->auth_spec->trunc_len;
  4122. encr_data_len = length - iv_len - icd_len;
  4123. /*
  4124. * Zero or negative length of encrypted data shows that the user specified
  4125. * wrong encryption algorithm and/or authentication algorithm.
  4126. */
  4127. if (encr_data_len <= 0) {
  4128. proto_tree_add_expert(tree, pinfo, &ei_isakmp_enc_iv, tvb, offset, length);
  4129. return;
  4130. }
  4131. /*
  4132. * Add the IV to the tree and store it in a packet scope buffer for later decryption
  4133. * if the specified encryption algorithm uses IV.
  4134. */
  4135. if (iv_len) {
  4136. iv_item = proto_tree_add_item(tree, hf_isakmp_enc_iv, tvb, offset, iv_len, ENC_NA);
  4137. proto_item_append_text(iv_item, " (%d bytes)", iv_len);
  4138. iv = (guchar *)ep_tvb_memdup(tvb, offset, iv_len);
  4139. offset += iv_len;
  4140. }
  4141. /*
  4142. * Add the encrypted portion to the tree and store it in a packet scope buffer for later decryption.
  4143. */
  4144. encr_data_item = proto_tree_add_item(tree, hf_isakmp_enc_data, tvb, offset, encr_data_len, ENC_NA);
  4145. proto_item_append_text(encr_data_item, " (%d bytes)",encr_data_len);
  4146. encr_data = (guchar *)ep_tvb_memdup(tvb, offset, encr_data_len);
  4147. offset += encr_data_len;
  4148. /*
  4149. * Add the ICD (Integrity Checksum Data) to the tree before decryption to ensure
  4150. * the ICD be displayed even if the decryption fails.
  4151. */
  4152. if (icd_len) {
  4153. icd_item = proto_tree_add_item(tree, hf_isakmp_enc_icd, tvb, offset, icd_len, ENC_NA);
  4154. proto_item_append_text(icd_item, " (%d bytes)",icd_len);
  4155. /*
  4156. * Recalculate ICD value if the specified authentication algorithm allows it.
  4157. */
  4158. if (key_info->auth_spec->gcry_alg) {
  4159. err = gcry_md_open(&md_hd, key_info->auth_spec->gcry_alg, key_info->auth_spec->gcry_flag);
  4160. if (err) {
  4161. REPORT_DISSECTOR_BUG(ep_strdup_printf("IKEv2 hashing error: algorithm %d: gcry_md_open failed: %s",
  4162. key_info->auth_spec->gcry_alg, gcry_strerror(err)));
  4163. }
  4164. err = gcry_md_setkey(md_hd, key_info->auth_key, key_info->auth_spec->key_len);
  4165. if (err) {
  4166. REPORT_DISSECTOR_BUG(ep_strdup_printf("IKEv2 hashing error: algorithm %s, key length %u: gcry_md_setkey failed: %s",
  4167. gcry_md_algo_name(key_info->auth_spec->gcry_alg), key_info->auth_spec->key_len, gcry_strerror(err)));
  4168. }
  4169. /* Calculate hash over the bytes from the beginning of the ISAKMP header to the right before the ICD. */
  4170. entire_message = (guchar *)ep_tvb_memdup(tvb, 0, offset);
  4171. gcry_md_write(md_hd, entire_message, offset);
  4172. md = gcry_md_read(md_hd, 0);
  4173. md_len = gcry_md_get_algo_dlen(key_info->auth_spec->gcry_alg);
  4174. if (md_len < icd_len) {
  4175. gcry_md_close(md_hd);
  4176. REPORT_DISSECTOR_BUG(ep_strdup_printf("IKEv2 hashing error: algorithm %s: gcry_md_get_algo_dlen returned %d which is smaller than icd length %d",
  4177. gcry_md_algo_name(key_info->auth_spec->gcry_alg), md_len, icd_len));
  4178. }
  4179. if (tvb_memeql(tvb, offset, md, icd_len) == 0) {
  4180. proto_item_append_text(icd_item, "[correct]");
  4181. } else {
  4182. proto_item_append_text(icd_item, "[incorrect, should be %s]", bytes_to_str(md, icd_len));
  4183. expert_add_info(pinfo, icd_item, &ei_isakmp_ikev2_integrity_checksum);
  4184. }
  4185. gcry_md_close(md_hd);
  4186. } else {
  4187. proto_item_append_text(icd_item, "[not validated]");
  4188. }
  4189. }
  4190. /*
  4191. * Confirm encrypted data length is multiple of block size.
  4192. */
  4193. if (encr_data_len % key_info->encr_spec->block_len != 0) {
  4194. proto_item_append_text(encr_data_item, "[Invalid length, should be a multiple of block size (%u)]",
  4195. key_info->encr_spec->block_len);
  4196. expert_add_info(pinfo, encr_data_item, &ei_isakmp_enc_data_length_mult_block_size);
  4197. return;
  4198. }
  4199. /*
  4200. * Allocate buffer for decrypted data.
  4201. */
  4202. decr_data = (guchar*)g_malloc(encr_data_len);
  4203. decr_data_len = encr_data_len;
  4204. /*
  4205. * If the cipher is NULL, just copy the encrypted data to the decrypted data buffer.
  4206. * And otherwise perform decryption with libgcrypt.
  4207. */
  4208. if (key_info->encr_spec->number == IKEV2_ENCR_NULL) {
  4209. memcpy(decr_data, encr_data, decr_data_len);
  4210. } else {
  4211. err = gcry_cipher_open(&cipher_hd, key_info->encr_spec->gcry_alg, key_info->encr_spec->gcry_mode, 0);
  4212. if (err) {
  4213. g_free(decr_data);
  4214. REPORT_DISSECTOR_BUG(ep_strdup_printf("IKEv2 decryption error: algorithm %d, mode %d: gcry_cipher_open failed: %s",
  4215. key_info->encr_spec->gcry_alg, key_info->encr_spec->gcry_mode, gcry_strerror(err)));
  4216. }
  4217. err = gcry_cipher_setkey(cipher_hd, key_info->encr_key, key_info->encr_spec->key_len);
  4218. if (err) {
  4219. g_free(decr_data);
  4220. REPORT_DISSECTOR_BUG(ep_strdup_printf("IKEv2 decryption error: algorithm %d, key length %d: gcry_cipher_setkey failed: %s",
  4221. key_info->encr_spec->gcry_alg, key_info->encr_spec->key_len, gcry_strerror(err)));
  4222. }
  4223. err = gcry_cipher_setiv(cipher_hd, iv, iv_len);
  4224. if (err) {
  4225. g_free(decr_data);
  4226. REPORT_DISSECTOR_BUG(ep_strdup_printf("IKEv2 decryption error: algorithm %d, iv length %d: gcry_cipher_setiv failed: %s",
  4227. key_info->encr_spec->gcry_alg, iv_len, gcry_strerror(err)));
  4228. }
  4229. err = gcry_cipher_decrypt(cipher_hd, decr_data, decr_data_len, encr_data, encr_data_len);
  4230. if (err) {
  4231. g_free(decr_data);
  4232. REPORT_DISSECTOR_BUG(ep_strdup_printf("IKEv2 decryption error: algorithm %d: gcry_cipher_decrypt failed: %s",
  4233. key_info->encr_spec->gcry_alg, gcry_strerror(err)));
  4234. }
  4235. gcry_cipher_close(cipher_hd);
  4236. }
  4237. decr_tvb = tvb_new_child_real_data(tvb, decr_data, decr_data_len, decr_data_len);
  4238. tvb_set_free_cb(decr_tvb, g_free);
  4239. add_new_data_source(pinfo, decr_tvb, "Decrypted Data");
  4240. item = proto_tree_add_item(tree, hf_isakmp_enc_decrypted_data, decr_tvb, 0, decr_data_len, ENC_NA);
  4241. proto_item_append_text(item, " (%d byte%s)", decr_data_len, plurality(decr_data_len, "", "s"));
  4242. /* Move the ICD item to the bottom of the tree. */
  4243. if (icd_item) {
  4244. proto_tree_move_item(tree, item, icd_item);
  4245. }
  4246. decr_tree = proto_item_add_subtree(item, ett_isakmp_decrypted_data);
  4247. pad_len = tvb_get_guint8(decr_tvb, decr_data_len - 1);
  4248. payloads_len = decr_data_len - 1 - pad_len;
  4249. if (payloads_len > 0) {
  4250. item = proto_tree_add_item(decr_tree, hf_isakmp_enc_contained_data, decr_tvb, 0, payloads_len, ENC_NA);
  4251. proto_item_append_text(item, " (%d byte%s)", payloads_len, plurality(payloads_len, "", "s"));
  4252. decr_payloads_tree = proto_item_add_subtree(item, ett_isakmp_decrypted_payloads);
  4253. }
  4254. padlen_item = proto_tree_add_item(decr_tree, hf_isakmp_enc_pad_length, decr_tvb, payloads_len + pad_len, 1, ENC_BIG_ENDIAN);
  4255. if (pad_len > 0) {
  4256. if (payloads_len < 0) {
  4257. proto_item_append_text(padlen_item, " [too long]");
  4258. expert_add_info(pinfo, padlen_item, &ei_isakmp_enc_pad_length_big);
  4259. } else {
  4260. item = proto_tree_add_item(decr_tree, hf_isakmp_enc_padding, decr_tvb, payloads_len, pad_len, ENC_NA);
  4261. proto_item_append_text(item, " (%d byte%s)", pad_len, plurality(pad_len, "", "s"));
  4262. proto_tree_move_item(decr_tree, item, padlen_item);
  4263. }
  4264. }
  4265. /*
  4266. * We dissect the inner payloads at last in order to ensure displaying Padding, Pad Length and ICD
  4267. * even if the dissection fails. This may occur when the user specify wrong encryption key.
  4268. */
  4269. if (decr_payloads_tree) {
  4270. dissect_payloads(decr_tvb, decr_payloads_tree, decr_tree, 2, inner_payload, 0, payloads_len, pinfo);
  4271. }
  4272. }else{
  4273. #endif /* HAVE_LIBGCRYPT */
  4274. proto_tree_add_item(tree, hf_isakmp_enc_iv, tvb, offset, 4, ENC_NA);
  4275. proto_tree_add_item(tree, hf_isakmp_enc_data, tvb, offset+4 , length, ENC_NA);
  4276. #ifdef HAVE_LIBGCRYPT
  4277. }
  4278. #endif /* HAVE_LIBGCRYPT */
  4279. }
  4280. static void
  4281. dissect_eap(tvbuff_t *tvb, int offset, int length, proto_tree *tree, packet_info *pinfo)
  4282. {
  4283. tvbuff_t *eap_tvb = NULL;
  4284. eap_tvb = tvb_new_subset(tvb, offset,length, length );
  4285. if ((eap_tvb != NULL)&& eap_handle != NULL){
  4286. call_dissector(eap_handle, eap_tvb, pinfo, tree);
  4287. }else{
  4288. proto_tree_add_item(tree, hf_isakmp_eap_data, tvb, offset, length, ENC_NA);
  4289. }
  4290. }
  4291. static void
  4292. dissect_gspm(tvbuff_t *tvb, int offset, int length, proto_tree *tree)
  4293. {
  4294. proto_tree_add_item(tree, hf_isakmp_gspm_data, tvb, offset, length, ENC_NA);
  4295. }
  4296. /*
  4297. * Protocol initialization
  4298. */
  4299. #ifdef HAVE_LIBGCRYPT
  4300. static guint
  4301. isakmp_hash_func(gconstpointer c) {
  4302. const guint8 *i_cookie = (guint8 *) c;
  4303. guint val = 0, keychunk, i;
  4304. /* XOR our icookie down to the size of a guint */
  4305. for (i = 0; i < COOKIE_SIZE - (COOKIE_SIZE % (guint)sizeof(keychunk)); i += (guint)sizeof(keychunk)) {
  4306. memcpy(&keychunk, &i_cookie[i], sizeof(keychunk));
  4307. val ^= keychunk;
  4308. }
  4309. return val;
  4310. }
  4311. static gint
  4312. isakmp_equal_func(gconstpointer ic1, gconstpointer ic2) {
  4313. if (memcmp(ic1, ic2, COOKIE_SIZE) == 0)
  4314. return 1;
  4315. return 0;
  4316. }
  4317. static guint ikev2_key_hash_func(gconstpointer k) {
  4318. const ikev2_uat_data_key_t *key = (const ikev2_uat_data_key_t*)k;
  4319. guint hash = 0, keychunk, i;
  4320. /* XOR our icookie down to the size of a guint */
  4321. for (i = 0; i < key->spii_len - (key->spii_len % (guint)sizeof(keychunk)); i += (guint)sizeof(keychunk)) {
  4322. memcpy(&keychunk, &key->spii[i], sizeof(keychunk));
  4323. hash ^= keychunk;
  4324. }
  4325. for (i = 0; i < key->spir_len - (key->spir_len % (guint)sizeof(keychunk)); i += (guint)sizeof(keychunk)) {
  4326. memcpy(&keychunk, &key->spir[i], sizeof(keychunk));
  4327. hash ^= keychunk;
  4328. }
  4329. return hash;
  4330. }
  4331. static gint ikev2_key_equal_func(gconstpointer k1, gconstpointer k2) {
  4332. const ikev2_uat_data_key_t *key1 = (const ikev2_uat_data_key_t *)k1;
  4333. const ikev2_uat_data_key_t *key2 = (const ikev2_uat_data_key_t *)k2;
  4334. if (key1->spii_len != key2->spii_len) return 0;
  4335. if (key1->spir_len != key2->spir_len) return 0;
  4336. if (memcmp(key1->spii, key2->spii, key1->spii_len) != 0) return 0;
  4337. if (memcmp(key1->spir, key2->spir, key1->spir_len) != 0) return 0;
  4338. return 1;
  4339. }
  4340. #endif /* HAVE_LIBGCRYPT */
  4341. #ifdef HAVE_LIBGCRYPT
  4342. static gboolean
  4343. free_cookie(gpointer key_arg, gpointer value, gpointer user_data _U_)
  4344. {
  4345. guint8 *ic_key = (guint8 *)key_arg;
  4346. decrypt_data_t *decr = (decrypt_data_t *)value;
  4347. g_slice_free1(COOKIE_SIZE, ic_key);
  4348. g_slice_free1(sizeof(decrypt_data_t), decr);
  4349. return TRUE;
  4350. }
  4351. #endif
  4352. static void
  4353. isakmp_init_protocol(void) {
  4354. #ifdef HAVE_LIBGCRYPT
  4355. guint i;
  4356. decrypt_data_t *decr;
  4357. guint8 *ic_key;
  4358. #endif /* HAVE_LIBGCRYPT */
  4359. reassembly_table_init(&isakmp_reassembly_table,
  4360. &addresses_reassembly_table_functions);
  4361. #ifdef HAVE_LIBGCRYPT
  4362. if (isakmp_hash) {
  4363. g_hash_table_foreach_remove(isakmp_hash, free_cookie, NULL);
  4364. g_hash_table_destroy(isakmp_hash);
  4365. }
  4366. isakmp_hash = g_hash_table_new(isakmp_hash_func, isakmp_equal_func);
  4367. for (i = 0; i < num_ikev1_uat_data; i++) {
  4368. ic_key = (guint8 *)g_slice_alloc(COOKIE_SIZE);
  4369. decr = (decrypt_data_t *)g_slice_alloc(sizeof(decrypt_data_t));
  4370. memcpy(ic_key, ikev1_uat_data[i].icookie, COOKIE_SIZE);
  4371. memset(decr, 0, sizeof(decrypt_data_t));
  4372. memcpy(decr->secret, ikev1_uat_data[i].key, ikev1_uat_data[i].key_len);
  4373. decr->secret_len = ikev1_uat_data[i].key_len;
  4374. g_hash_table_insert(isakmp_hash, ic_key, decr);
  4375. }
  4376. if (ikev2_key_hash) {
  4377. g_hash_table_destroy(ikev2_key_hash);
  4378. }
  4379. ikev2_key_hash = g_hash_table_new(ikev2_key_hash_func, ikev2_key_equal_func);
  4380. for (i = 0; i < num_ikev2_uat_data; i++) {
  4381. g_hash_table_insert(ikev2_key_hash, &(ikev2_uat_data[i].key), &(ikev2_uat_data[i]));
  4382. }
  4383. #endif /* HAVE_LIBGCRYPT */
  4384. }
  4385. #ifdef HAVE_LIBGCRYPT
  4386. static void
  4387. isakmp_prefs_apply_cb(void) {
  4388. isakmp_init_protocol();
  4389. }
  4390. #endif /* HAVE_LIBGCRYPT */
  4391. #ifdef HAVE_LIBGCRYPT
  4392. UAT_BUFFER_CB_DEF(ikev1_users, icookie, ikev1_uat_data_key_t, icookie, icookie_len)
  4393. UAT_BUFFER_CB_DEF(ikev1_users, key, ikev1_uat_data_key_t, key, key_len)
  4394. static void ikev1_uat_data_update_cb(void* p, const char** err) {
  4395. ikev1_uat_data_key_t *ud = (ikev1_uat_data_key_t *)p;
  4396. if (ud->icookie_len != COOKIE_SIZE) {
  4397. *err = ep_strdup_printf("Length of Initiator's COOKIE must be %d octets (%d hex characters).", COOKIE_SIZE, COOKIE_SIZE * 2);
  4398. return;
  4399. }
  4400. if (ud->key_len == 0) {
  4401. *err = ep_strdup_printf("Must have Encryption key.");
  4402. return;
  4403. }
  4404. if (ud->key_len > MAX_KEY_SIZE) {
  4405. *err = ep_strdup_printf("Length of Encryption key limited to %d octets (%d hex characters).", MAX_KEY_SIZE, MAX_KEY_SIZE * 2);
  4406. return;
  4407. }
  4408. }
  4409. UAT_BUFFER_CB_DEF(ikev2_users, spii, ikev2_uat_data_t, key.spii, key.spii_len)
  4410. UAT_BUFFER_CB_DEF(ikev2_users, spir, ikev2_uat_data_t, key.spir, key.spir_len)
  4411. UAT_BUFFER_CB_DEF(ikev2_users, sk_ei, ikev2_uat_data_t, sk_ei, sk_ei_len)
  4412. UAT_BUFFER_CB_DEF(ikev2_users, sk_er, ikev2_uat_data_t, sk_er, sk_er_len)
  4413. UAT_VS_DEF(ikev2_users, encr_alg, ikev2_uat_data_t, guint, IKEV2_ENCR_3DES, IKEV2_ENCR_3DES_STR)
  4414. UAT_BUFFER_CB_DEF(ikev2_users, sk_ai, ikev2_uat_data_t, sk_ai, sk_ai_len)
  4415. UAT_BUFFER_CB_DEF(ikev2_users, sk_ar, ikev2_uat_data_t, sk_ar, sk_ar_len)
  4416. UAT_VS_DEF(ikev2_users, auth_alg, ikev2_uat_data_t, guint, IKEV2_AUTH_HMAC_SHA1_96, IKEV2_AUTH_HMAC_SHA1_96_STR)
  4417. static void ikev2_uat_data_update_cb(void* p, const char** err) {
  4418. ikev2_uat_data_t *ud = (ikev2_uat_data_t *)p;
  4419. if (ud->key.spii_len != COOKIE_SIZE) {
  4420. *err = ep_strdup_printf("Length of Initiator's SPI must be %d octets (%d hex characters).", COOKIE_SIZE, COOKIE_SIZE * 2);
  4421. return;
  4422. }
  4423. if (ud->key.spir_len != COOKIE_SIZE) {
  4424. *err = ep_strdup_printf("Length of Responder's SPI must be %d octets (%d hex characters).", COOKIE_SIZE, COOKIE_SIZE * 2);
  4425. return;
  4426. }
  4427. if ((ud->encr_spec = ikev2_decrypt_find_encr_spec(ud->encr_alg)) == NULL) {
  4428. REPORT_DISSECTOR_BUG("Couldn't get IKEv2 encryption algorithm spec.");
  4429. }
  4430. if ((ud->auth_spec = ikev2_decrypt_find_auth_spec(ud->auth_alg)) == NULL) {
  4431. REPORT_DISSECTOR_BUG("Couldn't get IKEv2 authentication algorithm spec.");
  4432. }
  4433. if (ud->sk_ei_len != ud->encr_spec->key_len) {
  4434. *err = ep_strdup_printf("Length of SK_ei (%u octets) does not match the key length (%u octets) of the selected encryption algorithm.",
  4435. ud->sk_ei_len, ud->encr_spec->key_len);
  4436. return;
  4437. }
  4438. if (ud->sk_er_len != ud->encr_spec->key_len) {
  4439. *err = ep_strdup_printf("Length of SK_er (%u octets) does not match the key length (%u octets) of the selected encryption algorithm.",
  4440. ud->sk_er_len, ud->encr_spec->key_len);
  4441. return;
  4442. }
  4443. if (ud->sk_ai_len != ud->auth_spec->key_len) {
  4444. *err = ep_strdup_printf("Length of SK_ai (%u octets) does not match the key length (%u octets) of the selected integrity algorithm.",
  4445. ud->sk_ai_len, ud->auth_spec->key_len);
  4446. return;
  4447. }
  4448. if (ud->sk_ar_len != ud->auth_spec->key_len) {
  4449. *err = ep_strdup_printf("Length of SK_ar (%u octets) does not match the key length (%u octets) of the selected integrity algorithm.",
  4450. ud->sk_ar_len, ud->auth_spec->key_len);
  4451. return;
  4452. }
  4453. }
  4454. #endif /* HAVE_LIBGCRYPT */
  4455. void
  4456. proto_register_isakmp(void)
  4457. {
  4458. #ifdef HAVE_LIBGCRYPT
  4459. module_t *isakmp_module;
  4460. #endif
  4461. static hf_register_info hf[] = {
  4462. { &hf_isakmp_ispi,
  4463. { "Initiator SPI", "isakmp.ispi",
  4464. FT_BYTES, BASE_NONE, NULL, 0x0,
  4465. "ISAKMP Initiator SPI", HFILL }},
  4466. { &hf_isakmp_rspi,
  4467. { "Responder SPI", "isakmp.rspi",
  4468. FT_BYTES, BASE_NONE, NULL, 0x0,
  4469. "ISAKMP Responder SPI", HFILL }},
  4470. { &hf_isakmp_typepayload,
  4471. { "Type Payload", "isakmp.typepayload",
  4472. FT_UINT8,BASE_RANGE_STRING | BASE_DEC, RVALS(payload_type), 0x0,
  4473. "ISAKMP Type Payload", HFILL }},
  4474. { &hf_isakmp_nextpayload,
  4475. { "Next payload", "isakmp.nextpayload",
  4476. FT_UINT8, BASE_RANGE_STRING | BASE_DEC, RVALS(payload_type), 0x0,
  4477. "ISAKMP Next Payload", HFILL }},
  4478. { &hf_isakmp_criticalpayload,
  4479. { "Critical Bit", "isakmp.criticalpayload",
  4480. FT_BOOLEAN, 8,TFS(&criticalpayload), 0x80,
  4481. "ISAKMP (v2) Critical Payload", HFILL }},
  4482. { &hf_isakmp_extradata,
  4483. { "Extra data", "isakmp.extradata",
  4484. FT_BYTES, BASE_NONE, NULL, 0x0,
  4485. "Extra data ??????", HFILL }},
  4486. { &hf_isakmp_datapayload,
  4487. { "Data Payload", "isakmp.datapayload",
  4488. FT_BYTES, BASE_NONE, NULL, 0x0,
  4489. "Data Payload (not dissect)", HFILL }},
  4490. { &hf_isakmp_version,
  4491. { "Version", "isakmp.version",
  4492. FT_UINT8, BASE_HEX, NULL, 0x0,
  4493. "ISAKMP Version (major + minor)", HFILL }},
  4494. { &hf_isakmp_mjver,
  4495. { "MjVer", "isakmp.mjver",
  4496. FT_UINT8, BASE_HEX, NULL, 0xF0,
  4497. "ISAKMP MjVer", HFILL }},
  4498. { &hf_isakmp_mnver,
  4499. { "MnVer", "isakmp.mnver",
  4500. FT_UINT8, BASE_HEX, NULL, 0x0F,
  4501. "ISAKMP MnVer", HFILL }},
  4502. { &hf_isakmp_exchangetype_v1,
  4503. { "Exchange type", "isakmp.exchangetype",
  4504. FT_UINT8, BASE_DEC, VALS(exchange_v1_type), 0x0,
  4505. "ISAKMP Exchange Type", HFILL }},
  4506. { &hf_isakmp_exchangetype_v2,
  4507. { "Exchange type", "isakmp.exchangetype",
  4508. FT_UINT8, BASE_DEC, VALS(exchange_v2_type), 0x0,
  4509. "ISAKMP Exchange Type", HFILL }},
  4510. { &hf_isakmp_flags,
  4511. { "Flags", "isakmp.flags",
  4512. FT_UINT8, BASE_HEX, NULL, 0x0,
  4513. "ISAKMP Flags", HFILL }},
  4514. { &hf_isakmp_flag_e,
  4515. { "Encryption", "isakmp.flag_e",
  4516. FT_BOOLEAN, 8, TFS(&flag_e), E_FLAG,
  4517. "Encryption Bit", HFILL }},
  4518. { &hf_isakmp_flag_c,
  4519. { "Commit", "isakmp.flag_c",
  4520. FT_BOOLEAN, 8, TFS(&flag_c), C_FLAG,
  4521. "Commit Bit", HFILL }},
  4522. { &hf_isakmp_flag_a,
  4523. { "Authentication", "isakmp.flag_a",
  4524. FT_BOOLEAN, 8, TFS(&flag_a), A_FLAG,
  4525. "Authentication Bit", HFILL }},
  4526. { &hf_isakmp_flag_i,
  4527. { "Initiator", "isakmp.flag_i",
  4528. FT_BOOLEAN, 8, TFS(&flag_i), I_FLAG,
  4529. "Initiator Bit", HFILL }},
  4530. { &hf_isakmp_flag_v,
  4531. { "Version", "isakmp.flag_v",
  4532. FT_BOOLEAN, 8, TFS(&flag_v), V_FLAG,
  4533. "Version Bit", HFILL }},
  4534. { &hf_isakmp_flag_r,
  4535. { "Response", "isakmp.flag_r",
  4536. FT_BOOLEAN, 8, TFS(&flag_r), R_FLAG,
  4537. "Response Bit", HFILL }},
  4538. { &hf_isakmp_messageid,
  4539. { "Message ID", "isakmp.messageid",
  4540. FT_UINT32, BASE_HEX, NULL, 0x0,
  4541. "ISAKMP Message ID", HFILL }},
  4542. { &hf_isakmp_length,
  4543. { "Length", "isakmp.length",
  4544. FT_UINT32, BASE_DEC, NULL, 0x0,
  4545. "ISAKMP Length", HFILL }},
  4546. { &hf_isakmp_payloadlen,
  4547. { "Payload length", "isakmp.payloadlength",
  4548. FT_UINT16, BASE_DEC, NULL, 0x0,
  4549. "ISAKMP Payload Length", HFILL }},
  4550. { &hf_isakmp_sa_doi,
  4551. { "Domain of interpretation", "isakmp.sa.doi",
  4552. FT_UINT32, BASE_DEC, VALS(doi_type), 0x0,
  4553. "ISAKMP Domain of Interpretation", HFILL }},
  4554. { &hf_isakmp_sa_situation,
  4555. { "Situation", "isakmp.sa.situation",
  4556. FT_BYTES, BASE_NONE, NULL, 0x0,
  4557. "ISAKMP SA Situation", HFILL }},
  4558. { &hf_isakmp_sa_situation_identity_only,
  4559. { "Identity Only", "isakmp.sa.situation.identity_only",
  4560. FT_BOOLEAN, 32, NULL, SIT_IDENTITY_ONLY,
  4561. "The type specifies that the SA will be identified by source identity information present in an associated Identification Payload", HFILL }},
  4562. { &hf_isakmp_sa_situation_secrecy,
  4563. { "Secrecy", "isakmp.sa.situation.secrecy",
  4564. FT_BOOLEAN, 32, NULL, SIT_SECRECY,
  4565. "The type specifies that the SA is being negotiated in an environment that requires labeled secrecy.", HFILL }},
  4566. { &hf_isakmp_sa_situation_integrity,
  4567. { "Integrity", "isakmp.sa.situation.integrity",
  4568. FT_BOOLEAN, 32, NULL, SIT_INTEGRITY,
  4569. "The type specifies that the SA is being negotiated in an environment that requires labeled integrity", HFILL }},
  4570. { &hf_isakmp_prop_protoid_v1,
  4571. { "Protocol ID", "isakmp.prop.protoid",
  4572. FT_UINT32, BASE_DEC, VALS(protoid_v1_type), 0x0,
  4573. "ISAKMP Proposal Protocol ID", HFILL }},
  4574. { &hf_isakmp_prop_protoid_v2,
  4575. { "Protocol ID", "isakmp.prop.protoid",
  4576. FT_UINT32, BASE_DEC, VALS(protoid_v2_type), 0x0,
  4577. "IKEv2 Proposal Protocol ID", HFILL }},
  4578. { &hf_isakmp_prop_number,
  4579. { "Proposal number", "isakmp.prop.number",
  4580. FT_UINT8, BASE_DEC, NULL, 0x0,
  4581. "ISAKMP Proposal Number", HFILL }},
  4582. { &hf_isakmp_spisize,
  4583. { "SPI Size", "isakmp.spisize",
  4584. FT_UINT8, BASE_DEC, NULL, 0x0,
  4585. NULL, HFILL }},
  4586. { &hf_isakmp_spi,
  4587. { "SPI", "isakmp.spi",
  4588. FT_BYTES, BASE_NONE, NULL, 0x0,
  4589. NULL, HFILL }},
  4590. { &hf_isakmp_prop_transforms,
  4591. { "Proposal transforms", "isakmp.prop.transforms",
  4592. FT_UINT8, BASE_DEC, NULL, 0x0,
  4593. "ISAKMP Proposal Transforms", HFILL }},
  4594. { &hf_isakmp_trans_number,
  4595. { "Transform number", "isakmp.trans.number",
  4596. FT_UINT8, BASE_DEC, NULL, 0x0,
  4597. "ISAKMP Transform Number", HFILL }},
  4598. { &hf_isakmp_trans_id,
  4599. { "Transform ID", "isakmp.trans.id",
  4600. FT_UINT8, BASE_DEC, NULL, 0x0,
  4601. "ISAKMP Transform ID", HFILL }},
  4602. { &hf_isakmp_id_type_v1,
  4603. { "ID type", "isakmp.id.type",
  4604. FT_UINT8, BASE_RANGE_STRING | BASE_DEC, RVALS(vs_v1_id_type), 0x0,
  4605. "ISAKMP (v1) ID Type", HFILL }},
  4606. { &hf_isakmp_id_type_v2,
  4607. { "ID type", "isakmp.id.type",
  4608. FT_UINT8, BASE_RANGE_STRING | BASE_DEC, RVALS(vs_v2_id_type), 0x0,
  4609. "ISAKMP (v2) ID Type", HFILL }},
  4610. { &hf_isakmp_id_protoid,
  4611. { "Protocol ID", "isakmp.id.protoid",
  4612. FT_UINT8, BASE_DEC|BASE_EXT_STRING, (&ipproto_val_ext), 0x0,
  4613. "ISAKMP ID Protocol ID", HFILL }},
  4614. { &hf_isakmp_id_port,
  4615. { "Port", "isakmp.id.port",
  4616. FT_UINT16, BASE_DEC, NULL, 0x0,
  4617. "ISAKMP ID Port", HFILL }},
  4618. { &hf_isakmp_id_data,
  4619. { "Identification Data:", "isakmp.id.data",
  4620. FT_NONE, BASE_NONE, NULL, 0x0,
  4621. "ISAKMP ID Data", HFILL }},
  4622. { &hf_isakmp_id_data_ipv4_addr,
  4623. { "ID_IPV4_ADDR", "isakmp.id.data.ipv4_addr",
  4624. FT_IPv4, BASE_NONE, NULL, 0x0,
  4625. "The type specifies a single four (4) octet IPv4 address", HFILL }},
  4626. { &hf_isakmp_id_data_fqdn,
  4627. { "ID_FQDN", "isakmp.id.data.fqdn",
  4628. FT_STRING, BASE_NONE, NULL, 0x0,
  4629. "The type specifies a fully-qualified domain name string", HFILL }},
  4630. { &hf_isakmp_id_data_user_fqdn,
  4631. { "ID_FQDN", "isakmp.id.data.user_fqdn",
  4632. FT_STRING, BASE_NONE, NULL, 0x0,
  4633. "The type specifies a fully-qualified username string", HFILL }},
  4634. { &hf_isakmp_id_data_ipv4_subnet,
  4635. { "ID_IPV4_SUBNET", "isakmp.id.data.ipv4_subnet",
  4636. FT_IPv4, BASE_NONE, NULL, 0x0,
  4637. "The second is an IPv4 network mask", HFILL }},
  4638. { &hf_isakmp_id_data_ipv4_range_start,
  4639. { "ID_IPV4_SUBNET", "isakmp.id.data.ipv4_range_start",
  4640. FT_IPv4, BASE_NONE, NULL, 0x0,
  4641. "The first value is the beginning IPv4 address (inclusive)", HFILL }},
  4642. { &hf_isakmp_id_data_ipv4_range_end,
  4643. { "ID_IPV4_RANGE (End)", "isakmp.id.data.ipv4_range_end",
  4644. FT_IPv4, BASE_NONE, NULL, 0x0,
  4645. "The second value is the ending IPv4 address (inclusive)", HFILL }},
  4646. { &hf_isakmp_id_data_ipv6_addr,
  4647. { "ID_IPV6_ADDR", "isakmp.id.data.ipv6_addr",
  4648. FT_IPv6, BASE_NONE, NULL, 0x0,
  4649. "The type specifies a single sixteen (16) octet IPv6 address", HFILL }},
  4650. { &hf_isakmp_id_data_ipv6_subnet,
  4651. { "ID_IPV6A_ADDR_SUBNET", "isakmp.id.data.ipv6_subnet",
  4652. FT_IPv6, BASE_NONE, NULL, 0x0,
  4653. "The type specifies a range of IPv6 addresses represented by two sixteen (16) octet values", HFILL }},
  4654. { &hf_isakmp_id_data_ipv6_range_start,
  4655. { "ID_IPV6_ADDR_RANGE (Start)", "isakmp.id.data.ipv6_range_start",
  4656. FT_IPv6, BASE_NONE, NULL, 0x0,
  4657. "The first value is the beginning IPv6 address (inclusive)", HFILL }},
  4658. { &hf_isakmp_id_data_ipv6_range_end,
  4659. { "ID_IPV6_ADDR_RANGE (End)", "isakmp.id.data.ipv6_range_end",
  4660. FT_IPv6, BASE_NONE, NULL, 0x0,
  4661. "the second value is the ending IPv6 address (inclusive)", HFILL }},
  4662. { &hf_isakmp_id_data_key_id,
  4663. { "ID_KEY_ID", "isakmp.id.data.key_id",
  4664. FT_BYTES, BASE_NONE, NULL, 0x0,
  4665. "The type specifies an opaque byte stream which may be used to pass vendor-specific information necessary to identify which pre-hared key should be used to authenticate Aggressive mode negotiations", HFILL }},
  4666. { &hf_isakmp_id_data_cert,
  4667. { "ID_DER_ASN1_DN", "isakmp.id.data.der_asn1_dn",
  4668. FT_UINT32, BASE_DEC, NULL, 0x0,
  4669. NULL, HFILL } },
  4670. { &hf_isakmp_cert_encoding_v1,
  4671. { "Certificate Encoding", "isakmp.cert.encoding",
  4672. FT_UINT8, BASE_RANGE_STRING | BASE_DEC, RVALS(cert_v1_type), 0x0,
  4673. "ISAKMP Certificate Encoding", HFILL }},
  4674. { &hf_isakmp_cert_encoding_v2,
  4675. { "Certificate Encoding", "isakmp.cert.encoding",
  4676. FT_UINT8, BASE_RANGE_STRING | BASE_DEC, RVALS(cert_v2_type), 0x0,
  4677. "IKEv2 Certificate Encoding", HFILL }},
  4678. { &hf_isakmp_cert_data,
  4679. { "Certificate Data", "isakmp.cert.data",
  4680. FT_NONE, BASE_NONE, NULL, 0x0,
  4681. "ISAKMP Certificate Data", HFILL }},
  4682. { &hf_isakmp_certreq_type_v1,
  4683. { "Certificate Type", "isakmp.certreq.type",
  4684. FT_UINT8, BASE_RANGE_STRING | BASE_DEC, RVALS(cert_v1_type), 0x0,
  4685. "ISAKMP Certificate Type", HFILL }},
  4686. { &hf_isakmp_certreq_type_v2,
  4687. { "Certificate Type", "isakmp.certreq.type",
  4688. FT_UINT8, BASE_RANGE_STRING | BASE_DEC, RVALS(cert_v2_type), 0x0,
  4689. "IKEv2 Certificate Type", HFILL }},
  4690. { &hf_isakmp_auth_meth,
  4691. { "Authentication Method", "isakmp.auth.method",
  4692. FT_UINT8, BASE_RANGE_STRING | BASE_DEC, RVALS(authmeth_v2_type), 0x0,
  4693. "IKEv2 Authentication Method", HFILL }},
  4694. { &hf_isakmp_auth_data,
  4695. { "Authentication Data", "isakmp.auth.data",
  4696. FT_BYTES, BASE_NONE, NULL, 0x0,
  4697. "IKEv2 Authentication Data", HFILL }},
  4698. { &hf_isakmp_notify_doi,
  4699. { "Domain of interpretation", "isakmp.notify.doi",
  4700. FT_UINT32, BASE_DEC, VALS(doi_type), 0x0,
  4701. "ISAKMP Notify Domain of Interpretation", HFILL }},
  4702. { &hf_isakmp_notify_protoid_v1,
  4703. { "Protocol ID", "isakmp.notify.protoid",
  4704. FT_UINT32, BASE_DEC, VALS(protoid_v1_type), 0x0,
  4705. "ISAKMP Notify Protocol ID", HFILL }},
  4706. { &hf_isakmp_notify_protoid_v2,
  4707. { "Protocol ID", "isakmp.notify.protoid",
  4708. FT_UINT32, BASE_DEC, VALS(protoid_v2_type), 0x0,
  4709. "IKEv2 Notify Protocol ID", HFILL }},
  4710. { &hf_isakmp_notify_msgtype_v1,
  4711. { "Notify Message Type", "isakmp.notify.msgtype",
  4712. FT_UINT16, BASE_RANGE_STRING | BASE_DEC, RVALS(notifmsg_v1_type), 0x0,
  4713. "ISAKMP Notify Message Type", HFILL }},
  4714. { &hf_isakmp_notify_msgtype_v2,
  4715. { "Notify Message Type", "isakmp.notify.msgtype",
  4716. FT_UINT16, BASE_RANGE_STRING | BASE_DEC, RVALS(notifmsg_v2_type), 0x0,
  4717. "ISAKMP Notify Message Type", HFILL }},
  4718. { &hf_isakmp_notify_data,
  4719. { "Notification DATA", "isakmp.notify.data",
  4720. FT_BYTES, BASE_NONE, NULL, 0x0,
  4721. NULL, HFILL }},
  4722. { &hf_isakmp_notify_data_dpd_are_you_there,
  4723. { "DPD ARE-YOU-THERE sequence", "isakmp.notify.data.dpd.are_you_there",
  4724. FT_UINT32, BASE_DEC, NULL, 0x0,
  4725. NULL, HFILL }},
  4726. { &hf_isakmp_notify_data_dpd_are_you_there_ack,
  4727. { "DPD ARE-YOU-THERE-ACK sequence", "isakmp.notify.data.dpd.are_you_there_ack",
  4728. FT_UINT32, BASE_DEC, NULL, 0x0,
  4729. NULL, HFILL }},
  4730. { &hf_isakmp_notify_data_unity_load_balance,
  4731. { "UNITY LOAD BALANCE", "isakmp.notify.data.unity.load_balance",
  4732. FT_IPv4, BASE_NONE, NULL, 0x0,
  4733. NULL, HFILL }},
  4734. { &hf_isakmp_notify_data_ipcomp_cpi,
  4735. { "IPCOMP CPI", "isakmp.notify.data.ipcomp.cpi",
  4736. FT_UINT16, BASE_DEC, NULL, 0x0,
  4737. NULL, HFILL }},
  4738. { &hf_isakmp_notify_data_ipcomp_transform_id,
  4739. { "IPCOMP Transform ID", "isakmp.notify.data.ipcomp.transform_id",
  4740. FT_UINT8, BASE_DEC, VALS(transform_id_ipcomp), 0x0,
  4741. NULL, HFILL }},
  4742. { &hf_isakmp_notify_data_redirect_gw_ident_type,
  4743. { "Gateway Identity Type", "isakmp.notify.data.redirect.gw_ident.type",
  4744. FT_UINT8, BASE_DEC, VALS(redirect_gateway_identity_type), 0x0,
  4745. NULL, HFILL }},
  4746. { &hf_isakmp_notify_data_redirect_gw_ident_len,
  4747. { "Gateway Identity Length", "isakmp.notify.data.redirect.gw_ident.len",
  4748. FT_UINT8, BASE_DEC, NULL, 0x0,
  4749. NULL, HFILL }},
  4750. { &hf_isakmp_notify_data_redirect_new_resp_gw_ident_ipv4,
  4751. { "New Responder Gateway Identity (IPv4)", "isakmp.notify.data.redirect.new_resp_gw_ident.ipv4",
  4752. FT_IPv4, BASE_NONE, NULL, 0x0,
  4753. NULL, HFILL }},
  4754. { &hf_isakmp_notify_data_redirect_new_resp_gw_ident_ipv6,
  4755. { "New Responder Gateway Identity (IPv6)", "isakmp.notify.data.redirect.new_resp_gw_ident.ipv6",
  4756. FT_IPv6, BASE_NONE, NULL, 0x0,
  4757. NULL, HFILL }},
  4758. { &hf_isakmp_notify_data_redirect_new_resp_gw_ident_fqdn,
  4759. { "New Responder Gateway Identity (FQDN)", "isakmp.notify.data.redirect.new_resp_gw_ident.fqdn",
  4760. FT_STRING, BASE_NONE, NULL, 0x0,
  4761. NULL, HFILL }},
  4762. { &hf_isakmp_notify_data_redirect_new_resp_gw_ident,
  4763. { "New Responder Gateway Identity (DATA)", "isakmp.notify.data.redirect.new_resp_gw_ident.data",
  4764. FT_BYTES, BASE_NONE, NULL, 0x0,
  4765. NULL, HFILL }},
  4766. { &hf_isakmp_notify_data_redirect_nonce_data,
  4767. { "Redirect Nonce Data", "isakmp.notify.data.redirect.nonce_data",
  4768. FT_BYTES, BASE_NONE, NULL, 0x0,
  4769. NULL, HFILL }},
  4770. { &hf_isakmp_notify_data_redirect_org_resp_gw_ident_ipv4,
  4771. { "Original Responder Gateway Identity (IPv4)", "isakmp.notify.data.redirect.org_resp_gw_ident.ipv4",
  4772. FT_IPv4, BASE_NONE, NULL, 0x0,
  4773. NULL, HFILL }},
  4774. { &hf_isakmp_notify_data_redirect_org_resp_gw_ident_ipv6,
  4775. { "Original Responder Gateway Identity (IPv6)", "isakmp.notify.data.redirect.org_resp_gw_ident.ipv6",
  4776. FT_IPv6, BASE_NONE, NULL, 0x0,
  4777. NULL, HFILL }},
  4778. { &hf_isakmp_notify_data_redirect_org_resp_gw_ident,
  4779. { "Original Responder Gateway Identity (DATA)", "isakmp.notify.data.redirect.org_resp_gw_ident.data",
  4780. FT_BYTES, BASE_NONE, NULL, 0x0,
  4781. NULL, HFILL }},
  4782. { &hf_isakmp_notify_data_ticket_lifetime,
  4783. { "TICKET OPAQUE Lifetime", "isakmp.notify.data.ticket_opaque.lifetime",
  4784. FT_UINT32, BASE_DEC, NULL, 0x0,
  4785. "The Lifetime field contains a relative time value, the number of seconds until the ticket expires (encoded as an unsigned integer).", HFILL }},
  4786. { &hf_isakmp_notify_data_ticket_data,
  4787. { "TICKET OPAQUE Data", "isakmp.notify.data.ticket_opaque.data",
  4788. FT_BYTES, BASE_NONE, NULL, 0x0,
  4789. NULL, HFILL }},
  4790. /* ROHC Attributes Type */
  4791. { &hf_isakmp_notify_data_rohc_attr,
  4792. { "ROHC Attribute Type", "isakmp.notify.data.rohc.attr",
  4793. FT_NONE, BASE_NONE, NULL, 0x00,
  4794. NULL, HFILL }},
  4795. { &hf_isakmp_notify_data_rohc_attr_type,
  4796. { "ROHC Attribute Type", "isakmp.notify.data.rohc.attr.type",
  4797. FT_UINT16, BASE_DEC, VALS(rohc_attr_type), 0x00,
  4798. NULL, HFILL }},
  4799. { &hf_isakmp_notify_data_rohc_attr_format,
  4800. { "ROHC Format", "isakmp.notify.data.rohc.attr.format",
  4801. FT_BOOLEAN, 16, TFS(&attribute_format), 0x8000,
  4802. NULL, HFILL }},
  4803. { &hf_isakmp_notify_data_rohc_attr_length,
  4804. { "Length", "isakmp.notify.data.rohc.attr.length",
  4805. FT_UINT16, BASE_DEC, NULL, 0x00,
  4806. NULL, HFILL }},
  4807. { &hf_isakmp_notify_data_rohc_attr_value,
  4808. { "Value", "isakmp.notify.data.rohc.attr.value",
  4809. FT_BYTES, BASE_NONE, NULL, 0x00,
  4810. NULL, HFILL }},
  4811. { &hf_isakmp_notify_data_rohc_attr_max_cid,
  4812. { "Maximum Context Identifier", "isakmp.notify.data.rohc.attr.max_cid",
  4813. FT_UINT16, BASE_DEC, NULL, 0x00,
  4814. NULL, HFILL }},
  4815. { &hf_isakmp_notify_data_rohc_attr_profile,
  4816. { "ROHC Profile", "isakmp.notify.data.rohc.attr.profile",
  4817. FT_UINT16, BASE_DEC, NULL, 0x00,
  4818. NULL, HFILL }},
  4819. { &hf_isakmp_notify_data_rohc_attr_integ,
  4820. { "ROHC Integrity Algorithm", "isakmp.notify.data.rohc.attr.integ",
  4821. FT_UINT16, BASE_DEC, VALS(transform_ike2_integ_type), 0x00,
  4822. NULL, HFILL }},
  4823. { &hf_isakmp_notify_data_rohc_attr_icv_len,
  4824. { "ROHC ICV Length in bytes", "isakmp.notify.data.rohc.attr.icv_len",
  4825. FT_UINT16, BASE_DEC, NULL, 0x00,
  4826. "In bytes", HFILL }},
  4827. { &hf_isakmp_notify_data_rohc_attr_mrru,
  4828. { "MRRU", "isakmp.notify.data.rohc.attr.mrru",
  4829. FT_UINT16, BASE_DEC, NULL, 0x00,
  4830. NULL, HFILL }},
  4831. { &hf_isakmp_notify_data_qcd_token_secret_data,
  4832. { "Token Secret Data", "isakmp.notify.data.qcd.token_secret_data",
  4833. FT_BYTES, BASE_NONE, NULL, 0x0,
  4834. NULL, HFILL }},
  4835. { &hf_isakmp_notify_data_ha_nonce_data,
  4836. { "Nonce Data", "isakmp.notify.data.ha.nonce_data",
  4837. FT_UINT32, BASE_HEX, NULL, 0x0,
  4838. "Random nonce data, the data should be identical in the synchronization request and response", HFILL }},
  4839. { &hf_isakmp_notify_data_ha_expected_send_req_msg_id,
  4840. { "EXPECTED SEND REQ MESSAGE ID", "isakmp.notify.data.ha.expected_send_req_message_id",
  4841. FT_UINT32, BASE_HEX, NULL, 0x0,
  4842. "Indicate the Message ID it will use in the next request that it will send to the other protocol peer", HFILL }},
  4843. { &hf_isakmp_notify_data_ha_expected_recv_req_msg_id,
  4844. { "EXPECTED RECV REQ MESSAGE ID", "isakmp.notify.data.ha.expected_recv_req_message_id",
  4845. FT_UINT32, BASE_HEX, NULL, 0x0,
  4846. "Indicate the Message ID it is expecting in the next request to be received from the other protocol peer", HFILL }},
  4847. { &hf_isakmp_notify_data_ha_incoming_ipsec_sa_delta_value,
  4848. { "Incoming IPsec SA delta value", "isakmp.notify.data.ha.incoming_ipsec_sa_delta_value",
  4849. FT_BYTES, BASE_NONE, NULL, 0x0,
  4850. "The sender requests that the peer should increment all the Child SA Replay Counters for the sender's incomingtraffic by this value", HFILL }},
  4851. { &hf_isakmp_notify_data_secure_password_methods,
  4852. { "Secure Password Methods", "isakmp.notify.data.secure_password_methods",
  4853. FT_BYTES, BASE_NONE, NULL, 0x0,
  4854. NULL, HFILL }},
  4855. { &hf_isakmp_delete_doi,
  4856. { "Domain of interpretation", "isakmp.delete.doi",
  4857. FT_UINT32, BASE_DEC, VALS(doi_type), 0x0,
  4858. "ISAKMP Delete Domain of Interpretation", HFILL }},
  4859. { &hf_isakmp_delete_protoid_v1,
  4860. { "Protocol ID", "isakmp.delete.protoid",
  4861. FT_UINT32, BASE_DEC, VALS(protoid_v1_type), 0x0,
  4862. "ISAKMP Delete Protocol ID", HFILL }},
  4863. { &hf_isakmp_delete_protoid_v2,
  4864. { "Protocol ID", "isakmp.delete.protoid",
  4865. FT_UINT32, BASE_DEC, VALS(protoid_v2_type), 0x0,
  4866. "IKEv2 Delete Protocol ID", HFILL }},
  4867. { &hf_isakmp_delete_spi,
  4868. { "Delete SPI", "isakmp.delete.spi",
  4869. FT_BYTES, BASE_NONE, NULL, 0x0,
  4870. "Identifies the specific security association(s) to delete", HFILL }},
  4871. { &hf_isakmp_vid_bytes,
  4872. { "Vendor ID", "isakmp.vid_bytes",
  4873. FT_BYTES, BASE_NONE, NULL, 0x0,
  4874. NULL, HFILL }},
  4875. { &hf_isakmp_vid_string,
  4876. { "Vendor ID", "isakmp.vid_string",
  4877. FT_STRING, BASE_NONE, NULL, 0x0,
  4878. NULL, HFILL }},
  4879. { &hf_isakmp_vid_cp_product,
  4880. { "Checkpoint Product", "isakmp.vid.cp.product",
  4881. FT_UINT32, BASE_DEC, VALS(cp_product), 0x0,
  4882. NULL, HFILL }},
  4883. { &hf_isakmp_vid_cp_version,
  4884. { "Checkpoint Version", "isakmp.vid.cp.version",
  4885. FT_UINT32, BASE_DEC, VALS(cp_version), 0x0,
  4886. "Encoded Version number", HFILL }},
  4887. { &hf_isakmp_vid_cp_timestamp,
  4888. { "Checkpoint Timestamp", "isakmp.vid.cp.timestamp",
  4889. FT_UINT32, BASE_DEC, NULL, 0x0,
  4890. "Timestamp (NGX only; always zero in 4.1 or NG)", HFILL }},
  4891. { &hf_isakmp_vid_cp_reserved,
  4892. { "Checkpoint Reserved", "isakmp.vid.cp.reserved",
  4893. FT_UINT32, BASE_HEX, NULL, 0x0,
  4894. NULL, HFILL }},
  4895. { &hf_isakmp_vid_cp_features,
  4896. { "Checkpoint Features", "isakmp.vid.cp.features",
  4897. FT_UINT32, BASE_HEX, NULL, 0x0,
  4898. NULL, HFILL }},
  4899. { &hf_isakmp_vid_cisco_unity_major,
  4900. { "CISCO-UNITY Major version", "isakmp.vid.cisco_unity.major",
  4901. FT_UINT8, BASE_DEC, NULL, 0x0,
  4902. NULL, HFILL }},
  4903. { &hf_isakmp_vid_cisco_unity_minor,
  4904. { "CISCO-UNITY Minor version", "isakmp.vid.cisco_unity.minor",
  4905. FT_UINT8, BASE_DEC, NULL, 0x0,
  4906. NULL, HFILL }},
  4907. { &hf_isakmp_vid_ms_nt5_isakmpoakley,
  4908. { "MS NT5 ISAKMPOAKLEY", "isakmp.vid.ms_nt5_isakmpoakley",
  4909. FT_UINT32, BASE_DEC, VALS(ms_nt5_isakmpoakley_type), 0x0,
  4910. NULL, HFILL }},
  4911. { &hf_isakmp_vid_aruba_via_auth_profile,
  4912. { "Auth Profile", "isakmp.vid.aruba_via_auth_profile",
  4913. FT_STRING, BASE_NONE, NULL, 0x0,
  4914. "Aruba Networks Auth Profile for VIA Client", HFILL }},
  4915. { &hf_isakmp_ts_number_of_ts,
  4916. { "Number of Traffic Selector", "isakmp.ts.number",
  4917. FT_UINT8, BASE_DEC, NULL, 0x0,
  4918. NULL, HFILL }},
  4919. { &hf_isakmp_ts_type,
  4920. { "Traffic Selector Type", "isakmp.ts.type",
  4921. FT_UINT8, BASE_RANGE_STRING | BASE_DEC, RVALS(traffic_selector_type), 0x0,
  4922. NULL, HFILL }},
  4923. { &hf_isakmp_ts_protoid,
  4924. { "Protocol ID", "isakmp.ts.protoid",
  4925. FT_UINT8, BASE_DEC|BASE_EXT_STRING, (&ipproto_val_ext), 0x0,
  4926. "IKEv2 Traffic Selector Protocol ID", HFILL }},
  4927. { &hf_isakmp_ts_selector_length,
  4928. { "Selector Length", "isakmp.ts.selector_length",
  4929. FT_UINT16, BASE_DEC, NULL, 0x0,
  4930. NULL, HFILL }},
  4931. { &hf_isakmp_ts_start_port,
  4932. { "Start Port", "isakmp.ts.start_port",
  4933. FT_UINT16, BASE_DEC, NULL, 0x0,
  4934. NULL, HFILL }},
  4935. { &hf_isakmp_ts_end_port,
  4936. { "End Port", "isakmp.ts.end_port",
  4937. FT_UINT16, BASE_DEC, NULL, 0x0,
  4938. NULL, HFILL }},
  4939. { &hf_isakmp_ts_start_addr_ipv4,
  4940. { "Starting Addr", "isakmp.ts.start_ipv4",
  4941. FT_IPv4, BASE_NONE, NULL, 0x0,
  4942. NULL, HFILL }},
  4943. { &hf_isakmp_ts_end_addr_ipv4,
  4944. { "Ending Addr", "isakmp.ts.end_ipv4",
  4945. FT_IPv4, BASE_NONE, NULL, 0x0,
  4946. NULL, HFILL }},
  4947. { &hf_isakmp_ts_start_addr_ipv6,
  4948. { "Starting Addr", "isakmp.ts.start_ipv6",
  4949. FT_IPv6, BASE_NONE, NULL, 0x0,
  4950. NULL, HFILL }},
  4951. { &hf_isakmp_ts_end_addr_ipv6,
  4952. { "Ending Addr", "isakmp.ts.end_ipv6",
  4953. FT_IPv6, BASE_NONE, NULL, 0x0,
  4954. NULL, HFILL }},
  4955. { &hf_isakmp_ts_start_addr_fc,
  4956. { "Starting Addr", "isakmp.ts.start_fc",
  4957. FT_UINT32, BASE_DEC, NULL, 0x0,
  4958. NULL, HFILL }},
  4959. { &hf_isakmp_ts_end_addr_fc,
  4960. { "Ending Addr", "isakmp.ts.end_fc",
  4961. FT_UINT32, BASE_DEC, NULL, 0x0,
  4962. NULL, HFILL }},
  4963. { &hf_isakmp_ts_start_r_ctl,
  4964. { "Starting R_CTL", "isakmp.ts.start_r_ctl",
  4965. FT_UINT8, BASE_DEC, NULL, 0x0,
  4966. NULL, HFILL }},
  4967. { &hf_isakmp_ts_end_r_ctl,
  4968. { "Ending R_CTL", "isakmp.ts.end_r_ctl",
  4969. FT_UINT8, BASE_DEC, NULL, 0x0,
  4970. NULL, HFILL }},
  4971. { &hf_isakmp_ts_start_type,
  4972. { "Starting Type", "isakmp.ts.start_type",
  4973. FT_UINT8, BASE_DEC, NULL, 0x0,
  4974. NULL, HFILL }},
  4975. { &hf_isakmp_ts_end_type,
  4976. { "Ending Type", "isakmp.ts.end_type",
  4977. FT_UINT8, BASE_DEC, NULL, 0x0,
  4978. NULL, HFILL }},
  4979. { &hf_isakmp_ts_data,
  4980. { "Traffic Selector Data", "isakmp.ts.data",
  4981. FT_BYTES, BASE_NONE, NULL, 0x0,
  4982. NULL, HFILL }},
  4983. { &hf_isakmp_num_spis,
  4984. { "Port", "isakmp.spinum",
  4985. FT_UINT16, BASE_DEC, NULL, 0x0,
  4986. "ISAKMP Number of SPIs", HFILL }},
  4987. { &hf_isakmp_hash,
  4988. { "Hash DATA", "isakmp.hash",
  4989. FT_BYTES, BASE_NONE, NULL, 0x0,
  4990. NULL, HFILL }},
  4991. { &hf_isakmp_sig,
  4992. { "Signature DATA", "isakmp.sig",
  4993. FT_BYTES, BASE_NONE, NULL, 0x0,
  4994. NULL, HFILL }},
  4995. { &hf_isakmp_nonce,
  4996. { "Nonce DATA", "isakmp.nonce",
  4997. FT_BYTES, BASE_NONE, NULL, 0x0,
  4998. NULL, HFILL }},
  4999. { &hf_isakmp_cisco_frag_packetid,
  5000. { "Frag ID", "isakmp.frag.packetid",
  5001. FT_UINT16, BASE_HEX, NULL, 0x0,
  5002. "ISAKMP fragment packet-id", HFILL }},
  5003. { &hf_isakmp_cisco_frag_seq,
  5004. { "Frag seq", "isakmp.frag.seq",
  5005. FT_UINT8, BASE_DEC, NULL, 0x0,
  5006. "ISAKMP fragment number", HFILL }},
  5007. { &hf_isakmp_cisco_frag_last,
  5008. { "Frag last", "isakmp.frag.last",
  5009. FT_UINT8, BASE_DEC, VALS(frag_last_vals), 0x0,
  5010. "ISAKMP last fragment", HFILL }},
  5011. { &hf_isakmp_fragments,
  5012. {"Message fragments", "isakmp.fragments",
  5013. FT_NONE, BASE_NONE, NULL, 0x00, NULL, HFILL } },
  5014. { &hf_isakmp_fragment,
  5015. {"Message fragment", "isakmp.fragment",
  5016. FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL } },
  5017. { &hf_isakmp_fragment_overlap,
  5018. {"Message fragment overlap", "isakmp.fragment.overlap",
  5019. FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL } },
  5020. { &hf_isakmp_fragment_overlap_conflicts,
  5021. {"Message fragment overlapping with conflicting data",
  5022. "isakmp.fragment.overlap.conflicts",
  5023. FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL } },
  5024. { &hf_isakmp_fragment_multiple_tails,
  5025. {"Message has multiple tail fragments",
  5026. "isakmp.fragment.multiple_tails",
  5027. FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL } },
  5028. { &hf_isakmp_fragment_too_long_fragment,
  5029. {"Message fragment too long", "isakmp.fragment.too_long_fragment",
  5030. FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL } },
  5031. { &hf_isakmp_fragment_error,
  5032. {"Message defragmentation error", "isakmp.fragment.error",
  5033. FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL } },
  5034. { &hf_isakmp_fragment_count,
  5035. {"Message fragment count", "isakmp.fragment.count",
  5036. FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL } },
  5037. { &hf_isakmp_reassembled_in,
  5038. {"Reassembled in", "isakmp.reassembled.in",
  5039. FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL } },
  5040. { &hf_isakmp_reassembled_length,
  5041. {"Reassembled ISAKMP length", "isakmp.reassembled.length",
  5042. FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL } },
  5043. { &hf_isakmp_certreq_authority_sig,
  5044. { "Certificate Authority Signature", "ike.certreq.authority.sig",
  5045. FT_UINT32, BASE_DEC, NULL, 0x0,
  5046. NULL, HFILL } },
  5047. { &hf_isakmp_certreq_authority_v1,
  5048. { "Certificate Authority Data", "ike.certreq.authority",
  5049. FT_BYTES, BASE_NONE, NULL, 0x0,
  5050. NULL, HFILL } },
  5051. { &hf_isakmp_certreq_authority_v2,
  5052. { "Certificate Authority Data", "ike.certreq.authority",
  5053. FT_BYTES, BASE_NONE, NULL, 0x0,
  5054. "SHA-1 hash of the Certificate Authority", HFILL } },
  5055. { &hf_isakmp_nat_keepalive,
  5056. { "NAT Keepalive", "ike.nat_keepalive",
  5057. FT_NONE, BASE_NONE, NULL, 0x0, "NAT Keepalive packet", HFILL } },
  5058. { &hf_isakmp_nat_hash,
  5059. { "HASH of the address and port", "ike.nat_hash",
  5060. FT_BYTES, BASE_NONE, NULL, 0x00,
  5061. NULL, HFILL }},
  5062. { &hf_isakmp_nat_original_address_ipv4,
  5063. { "NAT Original IPv4 Address", "ike.nat_original_address_ipv4",
  5064. FT_IPv4, BASE_NONE, NULL, 0x00,
  5065. NULL, HFILL }},
  5066. { &hf_isakmp_nat_original_address_ipv6,
  5067. { "NAT Original IPv6 Address", "ike.nat_original_address_ipv6",
  5068. FT_IPv6, BASE_NONE, NULL, 0x00,
  5069. NULL, HFILL }},
  5070. /* Transform Attributes Type */
  5071. { &hf_isakmp_tf_attr,
  5072. { "Transform Attribute Type", "isakmp.tf.attr",
  5073. FT_NONE, BASE_NONE, NULL, 0x00,
  5074. "ISAKMP Transform Attribute", HFILL }},
  5075. { &hf_isakmp_tf_attr_type_v1,
  5076. { "Transform Attribute Type", "isakmp.tf.attr.type_v1",
  5077. FT_UINT16, BASE_DEC, VALS(transform_isakmp_attr_type), 0x00,
  5078. "ISAKMP (v1) Transform Attribute type", HFILL }},
  5079. { &hf_isakmp_tf_attr_format,
  5080. { "Transform Format", "isakmp.tf.attr.format",
  5081. FT_BOOLEAN, 16, TFS(&attribute_format), 0x8000,
  5082. "ISAKMP Transform Attribute Format", HFILL }},
  5083. { &hf_isakmp_tf_attr_length,
  5084. { "Length", "isakmp.tf.attr.length",
  5085. FT_UINT16, BASE_DEC, NULL, 0x00,
  5086. "ISAKMP Tranform Attribute length", HFILL }},
  5087. { &hf_isakmp_tf_attr_value,
  5088. { "Value", "isakmp.tf.attr.value",
  5089. FT_BYTES, BASE_NONE, NULL, 0x00,
  5090. "ISAKMP Transform Attribute value", HFILL }},
  5091. { &hf_isakmp_tf_attr_life_type,
  5092. { "Life Type", "isakmp.tf.attr.life_type",
  5093. FT_UINT16, BASE_DEC, VALS(transform_attr_sa_life_type), 0x00,
  5094. NULL, HFILL }},
  5095. { &hf_isakmp_tf_attr_life_duration_uint32,
  5096. { "Life Duration", "isakmp.tf.attr.life_duration",
  5097. FT_UINT32, BASE_DEC, NULL, 0x00,
  5098. NULL, HFILL }},
  5099. { &hf_isakmp_tf_attr_life_duration_uint64,
  5100. { "Life Duration", "isakmp.tf.attr.life_duration",
  5101. FT_UINT64, BASE_DEC, NULL, 0x00,
  5102. NULL, HFILL }},
  5103. { &hf_isakmp_tf_attr_life_duration_bytes,
  5104. { "Life Duration", "isakmp.tf.attr.life_duration",
  5105. FT_BYTES, BASE_NONE, NULL, 0x00,
  5106. NULL, HFILL }},
  5107. { &hf_isakmp_tf_attr_group_description,
  5108. { "Group Description", "isakmp.tf.attr.group_description",
  5109. FT_UINT16, BASE_DEC, VALS(transform_dh_group_type), 0x00,
  5110. NULL, HFILL }},
  5111. { &hf_isakmp_tf_attr_encap_mode,
  5112. { "Encapsulation Mode", "isakmp.tf.attr.encap_mode",
  5113. FT_UINT16, BASE_DEC, VALS(transform_attr_encap_type), 0x00,
  5114. NULL, HFILL }},
  5115. { &hf_isakmp_tf_attr_auth_algorithm,
  5116. { "Authentication Algorithm", "isakmp.tf.attr.auth_algorithm",
  5117. FT_UINT16, BASE_DEC, VALS(transform_attr_auth_type), 0x00,
  5118. NULL, HFILL }},
  5119. { &hf_isakmp_tf_attr_key_length,
  5120. { "Key Length", "isakmp.tf.attr.key_length",
  5121. FT_UINT16, BASE_DEC, NULL, 0x00,
  5122. NULL, HFILL }},
  5123. { &hf_isakmp_tf_attr_key_rounds,
  5124. { "Key Rounds", "isakmp.tf.attr.key_rounds",
  5125. FT_UINT16, BASE_DEC, NULL, 0x00,
  5126. NULL, HFILL }},
  5127. { &hf_isakmp_tf_attr_cmpr_dict_size,
  5128. { "Compress Dictionary Size", "isakmp.tf.attr.cmpr_dict_size",
  5129. FT_UINT16, BASE_DEC, NULL, 0x00,
  5130. NULL, HFILL }},
  5131. { &hf_isakmp_tf_attr_cmpr_algorithm,
  5132. { "Compress Private Algorithm", "isakmp.tf.attr.cmpr_algorithm",
  5133. FT_BYTES, BASE_NONE, NULL, 0x00,
  5134. NULL, HFILL }},
  5135. { &hf_isakmp_tf_attr_ecn_tunnel,
  5136. { "ECN Tunnel", "isakmp.tf.attr.ecn_tunnel",
  5137. FT_UINT16, BASE_DEC, VALS(transform_attr_ecn_type), 0x00,
  5138. NULL, HFILL }},
  5139. { &hf_isakmp_tf_attr_ext_seq_nbr,
  5140. { "Extended (64-bit) Sequence Number", "isakmp.tf.attr.ext_seq_nbr",
  5141. FT_UINT16, BASE_DEC, VALS(transform_attr_ext_seq_nbr_type), 0x00,
  5142. NULL, HFILL }},
  5143. { &hf_isakmp_tf_attr_auth_key_length,
  5144. { "Authentication Key Length", "isakmp.tf.attr.auth_key_length",
  5145. FT_UINT16, BASE_DEC, NULL, 0x00,
  5146. NULL, HFILL }},
  5147. { &hf_isakmp_tf_attr_sig_enco_algorithm,
  5148. { "Signature Encoding Algorithm", "isakmp.tf.attr.sig_enco_algorithm",
  5149. FT_BYTES, BASE_NONE, NULL, 0x00,
  5150. NULL, HFILL }},
  5151. { &hf_isakmp_tf_attr_addr_preservation,
  5152. { "Address Preservation", "isakmp.tf.attr.addr_preservation",
  5153. FT_UINT16, BASE_DEC, VALS(transform_attr_addr_preservation_type), 0x00,
  5154. NULL, HFILL }},
  5155. { &hf_isakmp_tf_attr_sa_direction,
  5156. { "SA Direction", "isakmp.tf.attr.sa_direction",
  5157. FT_UINT16, BASE_DEC, VALS(transform_attr_sa_direction_type), 0x00,
  5158. NULL, HFILL }},
  5159. { &hf_isakmp_ike_attr,
  5160. { "Transform IKE Attribute Type", "isakmp.ike.attr",
  5161. FT_NONE, BASE_NONE, NULL, 0x00,
  5162. "IKE Transform Attribute", HFILL }},
  5163. { &hf_isakmp_ike_attr_type,
  5164. { "Transform IKE Attribute Type", "isakmp.ike.attr.type",
  5165. FT_UINT16, BASE_DEC, VALS(transform_ike_attr_type), 0x00,
  5166. "IKE Transform Attribute type", HFILL }},
  5167. { &hf_isakmp_ike_attr_format,
  5168. { "Transform IKE Format", "isakmp.ike.attr.format",
  5169. FT_BOOLEAN, 16, TFS(&attribute_format), 0x8000,
  5170. "IKE Transform Attribute Format", HFILL }},
  5171. { &hf_isakmp_ike_attr_length,
  5172. { "Length", "isakmp.ike.attr.length",
  5173. FT_UINT16, BASE_DEC, NULL, 0x00,
  5174. "IKE Tranform Attribute length", HFILL }},
  5175. { &hf_isakmp_ike_attr_value,
  5176. { "Value", "isakmp.ike.attr.value",
  5177. FT_BYTES, BASE_NONE, NULL, 0x00,
  5178. "IKE Transform Attribute value", HFILL }},
  5179. { &hf_isakmp_ike_attr_encryption_algorithm,
  5180. { "Encryption Algorithm", "isakmp.ike.attr.encryption_algorithm",
  5181. FT_UINT16, BASE_DEC, VALS(transform_attr_enc_type), 0x00,
  5182. NULL, HFILL }},
  5183. { &hf_isakmp_ike_attr_hash_algorithm,
  5184. { "HASH Algorithm", "isakmp.ike.attr.hash_algorithm",
  5185. FT_UINT16, BASE_DEC, VALS(transform_attr_hash_type), 0x00,
  5186. NULL, HFILL }},
  5187. { &hf_isakmp_ike_attr_authentication_method,
  5188. { "Authentication Method", "isakmp.ike.attr.authentication_method",
  5189. FT_UINT16, BASE_DEC, VALS(transform_attr_authmeth_type), 0x00,
  5190. NULL, HFILL }},
  5191. { &hf_isakmp_ike_attr_group_description,
  5192. { "Group Description", "isakmp.ike.attr.group_description",
  5193. FT_UINT16, BASE_DEC, VALS(transform_dh_group_type), 0x00,
  5194. NULL, HFILL }},
  5195. { &hf_isakmp_ike_attr_group_type,
  5196. { "Groupe Type", "isakmp.ike.attr.group_type",
  5197. FT_UINT16, BASE_DEC, VALS(transform_attr_grp_type), 0x00,
  5198. NULL, HFILL }},
  5199. { &hf_isakmp_ike_attr_group_prime,
  5200. { "Groupe Prime", "isakmp.ike.attr.group_prime",
  5201. FT_BYTES, BASE_NONE, NULL, 0x00,
  5202. NULL, HFILL }},
  5203. { &hf_isakmp_ike_attr_group_generator_one,
  5204. { "Groupe Generator One", "isakmp.ike.attr.group_generator_one",
  5205. FT_BYTES, BASE_NONE, NULL, 0x00,
  5206. NULL, HFILL }},
  5207. { &hf_isakmp_ike_attr_group_generator_two,
  5208. { "Groupe Generator Two", "isakmp.ike.attr.group_generator_two",
  5209. FT_BYTES, BASE_NONE, NULL, 0x00,
  5210. NULL, HFILL }},
  5211. { &hf_isakmp_ike_attr_group_curve_a,
  5212. { "Groupe Curve A", "isakmp.ike.attr.group_curve_a",
  5213. FT_BYTES, BASE_NONE, NULL, 0x00,
  5214. NULL, HFILL }},
  5215. { &hf_isakmp_ike_attr_group_curve_b,
  5216. { "Groupe Curve B", "isakmp.ike.attr.group_curve_b",
  5217. FT_BYTES, BASE_NONE, NULL, 0x00,
  5218. NULL, HFILL }},
  5219. { &hf_isakmp_ike_attr_life_type,
  5220. { "Life Type", "isakmp.ike.attr.life_type",
  5221. FT_UINT16, BASE_DEC, VALS(transform_attr_sa_life_type), 0x00,
  5222. NULL, HFILL }},
  5223. { &hf_isakmp_ike_attr_life_duration_uint32,
  5224. { "Life Duration", "isakmp.ike.attr.life_duration",
  5225. FT_UINT32, BASE_DEC, NULL, 0x00,
  5226. NULL, HFILL }},
  5227. { &hf_isakmp_ike_attr_life_duration_uint64,
  5228. { "Life Duration", "isakmp.ike.attr.life_duration",
  5229. FT_UINT64, BASE_DEC, NULL, 0x00,
  5230. NULL, HFILL }},
  5231. { &hf_isakmp_ike_attr_life_duration_bytes,
  5232. { "Life Duration", "isakmp.ike.attr.life_duration",
  5233. FT_BYTES, BASE_NONE, NULL, 0x00,
  5234. NULL, HFILL }},
  5235. { &hf_isakmp_ike_attr_prf,
  5236. { "PRF", "isakmp.ike.attr.prf",
  5237. FT_BYTES, BASE_NONE, NULL, 0x00,
  5238. NULL, HFILL }},
  5239. { &hf_isakmp_ike_attr_key_length,
  5240. { "Key Length", "isakmp.ike.attr.key_length",
  5241. FT_UINT16, BASE_DEC, NULL, 0x00,
  5242. NULL, HFILL }},
  5243. { &hf_isakmp_ike_attr_field_size,
  5244. { "Field Size", "isakmp.ike.attr.field_size",
  5245. FT_BYTES, BASE_NONE, NULL, 0x00,
  5246. NULL, HFILL }},
  5247. { &hf_isakmp_ike_attr_group_order,
  5248. { "Key Length", "isakmp.ike.attr.group_order",
  5249. FT_BYTES, BASE_NONE, NULL, 0x00,
  5250. NULL, HFILL }},
  5251. { &hf_isakmp_trans_type,
  5252. { "Transform Type", "isakmp.tf.type",
  5253. FT_UINT8, BASE_RANGE_STRING | BASE_DEC, RVALS(transform_ike2_type), 0x00,
  5254. NULL, HFILL }},
  5255. { &hf_isakmp_trans_encr,
  5256. { "Transform ID (ENCR)", "isakmp.tf.id.encr",
  5257. FT_UINT16, BASE_DEC, VALS(transform_ike2_encr_type), 0x00,
  5258. NULL, HFILL }},
  5259. { &hf_isakmp_trans_prf,
  5260. { "Transform ID (PRF)", "isakmp.tf.id.prf",
  5261. FT_UINT16, BASE_DEC, VALS(transform_ike2_prf_type), 0x00,
  5262. NULL, HFILL }},
  5263. { &hf_isakmp_trans_integ,
  5264. { "Transform ID (INTEG)", "isakmp.tf.id.integ",
  5265. FT_UINT16, BASE_DEC, VALS(transform_ike2_integ_type), 0x00,
  5266. NULL, HFILL }},
  5267. { &hf_isakmp_trans_dh,
  5268. { "Transform ID (D-H)", "isakmp.tf.id.dh",
  5269. FT_UINT16, BASE_DEC, VALS(transform_dh_group_type), 0x00,
  5270. NULL, HFILL }},
  5271. { &hf_isakmp_trans_esn,
  5272. { "Transform ID (ESN)", "isakmp.tf.id.esn",
  5273. FT_UINT16, BASE_DEC, VALS(transform_ike2_esn_type), 0x00,
  5274. NULL, HFILL }},
  5275. { &hf_isakmp_trans_id_v2,
  5276. { "Transform ID", "isakmp.tf.id",
  5277. FT_UINT16, BASE_DEC, NULL, 0x00,
  5278. NULL, HFILL }},
  5279. { &hf_isakmp_ike2_attr,
  5280. { "Transform IKE2 Attribute Type", "isakmp.ike2.attr",
  5281. FT_NONE, BASE_NONE, NULL, 0x00,
  5282. "IKE2 Transform Attribute", HFILL }},
  5283. { &hf_isakmp_ike2_attr_type,
  5284. { "Transform IKE2 Attribute Type", "isakmp.ike2.attr.type",
  5285. FT_UINT16, BASE_DEC, VALS(transform_ike2_attr_type), 0x00,
  5286. "IKE2 Transform Attribute type", HFILL }},
  5287. { &hf_isakmp_ike2_attr_format,
  5288. { "Transform IKE2 Format", "isakmp.ike2.attr.format",
  5289. FT_BOOLEAN, 16, TFS(&attribute_format), 0x8000,
  5290. "IKE2 Transform Attribute Format", HFILL }},
  5291. { &hf_isakmp_ike2_attr_length,
  5292. { "Length", "isakmp.ike2.attr.length",
  5293. FT_UINT16, BASE_DEC, NULL, 0x00,
  5294. "IKE2 Tranform Attribute length", HFILL }},
  5295. { &hf_isakmp_ike2_attr_value,
  5296. { "Value", "isakmp.ike2.attr.value",
  5297. FT_BYTES, BASE_NONE, NULL, 0x00,
  5298. "IKE2 Transform Attribute value", HFILL }},
  5299. { &hf_isakmp_ike2_attr_key_length,
  5300. { "Key Length", "isakmp.ike2.attr.key_length",
  5301. FT_UINT16, BASE_DEC, NULL, 0x00,
  5302. NULL, HFILL }},
  5303. { &hf_isakmp_key_exch_dh_group,
  5304. { "DH Group #", "isakmp.key_exchange.dh_group",
  5305. FT_UINT16, BASE_DEC, VALS(transform_dh_group_type), 0x00,
  5306. NULL, HFILL }},
  5307. { &hf_isakmp_key_exch_data,
  5308. { "Key Exchange Data", "isakmp.key_exchange.data",
  5309. FT_BYTES, BASE_NONE, NULL, 0x00,
  5310. NULL, HFILL }},
  5311. { &hf_isakmp_eap_data,
  5312. { "EAP Message", "isakmp.eap.data",
  5313. FT_BYTES, BASE_NONE, NULL, 0x00,
  5314. NULL, HFILL }},
  5315. { &hf_isakmp_gspm_data,
  5316. { "GSPM", "isakmp.gspm.data",
  5317. FT_BYTES, BASE_NONE, NULL, 0x00,
  5318. "Generic Secure Password Method", HFILL }},
  5319. { &hf_isakmp_cfg_type_v1,
  5320. { "Type", "isakmp.cfg.type",
  5321. FT_UINT8, BASE_RANGE_STRING | BASE_DEC, RVALS(vs_v1_cfgtype), 0x0,
  5322. "ISAKMP (v1) Config Type", HFILL }},
  5323. { &hf_isakmp_cfg_identifier,
  5324. { "Identifier", "isakmp.cfg.identifier",
  5325. FT_UINT16, BASE_DEC, NULL, 0x0,
  5326. "ISAKMP (v1) Config Identifier", HFILL }},
  5327. { &hf_isakmp_cfg_type_v2,
  5328. { "Type", "isakmp.cfg.type",
  5329. FT_UINT8, BASE_RANGE_STRING | BASE_DEC, RVALS(vs_v2_cfgtype), 0x0,
  5330. "ISAKMP (v2) Config Type", HFILL }},
  5331. /* Config Attributes Type */
  5332. { &hf_isakmp_cfg_attr,
  5333. { "Config Attribute Type", "isakmp.cfg.attr",
  5334. FT_NONE, BASE_NONE, NULL, 0x00,
  5335. "ISAKMP Config Attribute", HFILL }},
  5336. { &hf_isakmp_cfg_attr_type_v1,
  5337. { "Type", "isakmp.cfg.attr.type",
  5338. FT_UINT16, BASE_RANGE_STRING | BASE_DEC, RVALS(vs_v1_cfgattr), 0x00,
  5339. "ISAKMP (v1) Config Attribute type", HFILL }},
  5340. { &hf_isakmp_cfg_attr_type_v2,
  5341. { "Type", "isakmp.cfg.attr.type",
  5342. FT_UINT16, BASE_RANGE_STRING | BASE_DEC, RVALS(vs_v2_cfgattr), 0x00,
  5343. "ISAKMP (v2) Config Attribute type", HFILL }},
  5344. { &hf_isakmp_cfg_attr_format,
  5345. { "Config Attribute Format", "isakmp.cfg.attr.format",
  5346. FT_BOOLEAN, 16, TFS(&attribute_format), 0x8000,
  5347. "ISAKMP Config Attribute Format", HFILL }},
  5348. { &hf_isakmp_cfg_attr_length,
  5349. { "Length", "isakmp.cfg.attr.length",
  5350. FT_UINT16, BASE_DEC, NULL, 0x00,
  5351. "ISAKMP Config Attribute length", HFILL }},
  5352. { &hf_isakmp_cfg_attr_value,
  5353. { "Value", "isakmp.cfg.attr.value",
  5354. FT_BYTES, BASE_NONE, NULL, 0x00,
  5355. "ISAKMP Config Attribute value", HFILL }},
  5356. { &hf_isakmp_cfg_attr_internal_ip4_address,
  5357. { "INTERNAL IP4 ADDRESS", "isakmp.cfg.attr.internal_ip4_address",
  5358. FT_IPv4, BASE_NONE, NULL, 0x00,
  5359. "An IPv4 address on the internal network", HFILL }},
  5360. { &hf_isakmp_cfg_attr_internal_ip4_netmask,
  5361. { "INTERNAL IP4 NETMASK", "isakmp.cfg.attr.internal_ip4_netmask",
  5362. FT_IPv4, BASE_NONE, NULL, 0x00,
  5363. "The internal network's netmask", HFILL }},
  5364. { &hf_isakmp_cfg_attr_internal_ip4_dns,
  5365. { "INTERNAL IP4 DNS", "isakmp.cfg.attr.internal_ip4_dns",
  5366. FT_IPv4, BASE_NONE, NULL, 0x00,
  5367. "An IPv4 address of a DNS server within the network", HFILL }},
  5368. { &hf_isakmp_cfg_attr_internal_ip4_nbns,
  5369. { "INTERNAL IP4 NBNS", "isakmp.cfg.attr.internal_ip4_nbns",
  5370. FT_IPv4, BASE_NONE, NULL, 0x00,
  5371. "An IPv4 address of a NetBios Name Server (WINS) within the network", HFILL }},
  5372. { &hf_isakmp_cfg_attr_internal_address_expiry,
  5373. { "INTERNAL ADDRESS EXPIRY (Secs)", "isakmp.cfg.attr.internal_address_expiry",
  5374. FT_UINT32, BASE_DEC, NULL, 0x00,
  5375. "Specifies the number of seconds that the host can use the internal IP address", HFILL }},
  5376. { &hf_isakmp_cfg_attr_internal_ip4_dhcp,
  5377. { "INTERNAL IP4 DHCP", "isakmp.cfg.attr.internal_ip4_dhcp",
  5378. FT_IPv4, BASE_NONE, NULL, 0x00,
  5379. "the host to send any internal DHCP requests to the address", HFILL }},
  5380. { &hf_isakmp_cfg_attr_application_version,
  5381. { "APPLICATION VERSION", "isakmp.cfg.attr.application_version",
  5382. FT_STRING, BASE_NONE, NULL, 0x00,
  5383. "The version or application information of the IPsec host", HFILL }},
  5384. { &hf_isakmp_cfg_attr_internal_ip6_address,
  5385. { "INTERNAL IP6 ADDRESS", "isakmp.cfg.attr.internal_ip6_address",
  5386. FT_IPv4, BASE_NONE, NULL, 0x00,
  5387. "An IPv6 address on the internal network", HFILL }},
  5388. { &hf_isakmp_cfg_attr_internal_ip6_netmask,
  5389. { "INTERNAL IP4 NETMASK", "isakmp.cfg.attr.internal_ip6_netmask",
  5390. FT_IPv6, BASE_NONE, NULL, 0x00,
  5391. "The internal network's netmask", HFILL }},
  5392. { &hf_isakmp_cfg_attr_internal_ip6_dns,
  5393. { "INTERNAL IP6 DNS", "isakmp.cfg.attr.internal_ip6_dns",
  5394. FT_IPv6, BASE_NONE, NULL, 0x00,
  5395. "An IPv6 address of a DNS server within the network", HFILL }},
  5396. { &hf_isakmp_cfg_attr_internal_ip6_nbns,
  5397. { "INTERNAL IP6 NBNS", "isakmp.cfg.attr.internal_ip6_nbns",
  5398. FT_IPv6, BASE_NONE, NULL, 0x00,
  5399. "An IPv6 address of a NetBios Name Server (WINS) within the network", HFILL }},
  5400. { &hf_isakmp_cfg_attr_internal_ip6_dhcp,
  5401. { "INTERNAL IP6 DHCP", "isakmp.cfg.attr.internal_ip6_dhcp",
  5402. FT_IPv6, BASE_NONE, NULL, 0x00,
  5403. "The host to send any internal DHCP requests to the address", HFILL }},
  5404. { &hf_isakmp_cfg_attr_internal_ip4_subnet_ip,
  5405. { "INTERNAL IP4 SUBNET (IP)", "isakmp.cfg.attr.internal_ip4_subnet_ip",
  5406. FT_IPv4, BASE_NONE, NULL, 0x00,
  5407. "The protected sub-networks that this edge-device protects (IP)", HFILL }},
  5408. { &hf_isakmp_cfg_attr_internal_ip4_subnet_netmask,
  5409. { "INTERNAL IP4 SUBNET (NETMASK)", "isakmp.cfg.attr.internal_ip4_subnet_netmask",
  5410. FT_IPv4, BASE_NONE, NULL, 0x00,
  5411. "The protected sub-networks that this edge-device protects (IP)", HFILL }},
  5412. { &hf_isakmp_cfg_attr_supported_attributes,
  5413. { "SUPPORTED ATTRIBUTES", "isakmp.cfg.attr.supported_attributes",
  5414. FT_UINT16, BASE_DEC, NULL, 0x00,
  5415. NULL, HFILL }},
  5416. { &hf_isakmp_cfg_attr_internal_ip6_subnet_ip,
  5417. { "INTERNAL_IP6_SUBNET (IP)", "isakmp.cfg.attr.internal_ip6_subnet_ip",
  5418. FT_IPv6, BASE_NONE, NULL, 0x00,
  5419. NULL, HFILL }},
  5420. { &hf_isakmp_cfg_attr_internal_ip6_subnet_prefix,
  5421. { "INTERNAL_IP6_SUBNET (PREFIX)", "isakmp.cfg.attr.internal_ip6_subnet_prefix",
  5422. FT_UINT8, BASE_DEC, NULL, 0x00,
  5423. NULL, HFILL }},
  5424. { &hf_isakmp_cfg_attr_internal_ip6_link_interface,
  5425. { "INTERNAL_IP6_LINK (Link-Local Interface ID)", "isakmp.cfg.attr.internal_ip6_link_interface",
  5426. FT_UINT64, BASE_DEC, NULL, 0x00,
  5427. "The Interface ID used for link-local address (by the party that sent this attribute)", HFILL }},
  5428. { &hf_isakmp_cfg_attr_internal_ip6_link_id,
  5429. { "INTERNAL_IP6_LINK (IKEv2 Link ID)", "isakmp.cfg.attr.internal_ip6_link_id",
  5430. FT_BYTES, BASE_NONE, NULL, 0x00,
  5431. "The Link ID is selected by the VPN gateway and is treated as an opaque octet string by the client.", HFILL }},
  5432. { &hf_isakmp_cfg_attr_internal_ip6_prefix_ip,
  5433. { "INTERNAL_IP6_PREFIX (IP)", "isakmp.cfg.attr.internal_ip6_prefix_ip",
  5434. FT_IPv6, BASE_NONE, NULL, 0x00,
  5435. "An IPv6 prefix assigned to the virtual link", HFILL }},
  5436. { &hf_isakmp_cfg_attr_internal_ip6_prefix_length,
  5437. { "INTERNAL_IP6_PREFIX (Length)", "isakmp.cfg.attr.internal_ip6_prefix_length",
  5438. FT_UINT8, BASE_DEC, NULL, 0x00,
  5439. "The length of the prefix in bits (usually 64)", HFILL }},
  5440. { &hf_isakmp_cfg_attr_xauth_type,
  5441. { "XAUTH TYPE", "isakmp.cfg.attr.xauth.type",
  5442. FT_UINT16, BASE_RANGE_STRING | BASE_DEC, RVALS(cfgattr_xauth_type), 0x00,
  5443. "The type of extended authentication requested", HFILL }},
  5444. { &hf_isakmp_cfg_attr_xauth_user_name,
  5445. { "XAUTH USER NAME", "isakmp.cfg.attr.xauth.user_name",
  5446. FT_STRING, BASE_NONE, NULL, 0x00,
  5447. "The user name", HFILL }},
  5448. { &hf_isakmp_cfg_attr_xauth_user_password,
  5449. { "XAUTH USER PASSWORD", "isakmp.cfg.attr.xauth.user_password",
  5450. FT_STRING, BASE_NONE, NULL, 0x00,
  5451. "The user's password", HFILL }},
  5452. { &hf_isakmp_cfg_attr_xauth_passcode,
  5453. { "XAUTH PASSCODE", "isakmp.cfg.attr.xauth.passcode",
  5454. FT_STRING, BASE_NONE, NULL, 0x00,
  5455. "A token card's passcode", HFILL }},
  5456. { &hf_isakmp_cfg_attr_xauth_message,
  5457. { "XAUTH MESSAGE", "isakmp.cfg.attr.xauth.message",
  5458. FT_STRING, BASE_NONE, NULL, 0x00,
  5459. "A textual message from an edge device to an IPSec host", HFILL }},
  5460. { &hf_isakmp_cfg_attr_xauth_challenge,
  5461. { "XAUTH CHALLENGE", "isakmp.cfg.attr.xauth.challenge",
  5462. FT_STRING, BASE_NONE, NULL, 0x00,
  5463. "A challenge string sent from the edge device to the IPSec host for it to include in its calculation of a password", HFILL }},
  5464. { &hf_isakmp_cfg_attr_xauth_domain,
  5465. { "XAUTH DOMAIN", "isakmp.cfg.attr.xauth.domain",
  5466. FT_STRING, BASE_NONE, NULL, 0x00,
  5467. "The domain to be authenticated in", HFILL }},
  5468. { &hf_isakmp_cfg_attr_xauth_status,
  5469. { "XAUTH STATUS", "isakmp.cfg.attr.xauth.status",
  5470. FT_UINT16, BASE_DEC, VALS(cfgattr_xauth_status), 0x00,
  5471. "A variable that is used to denote authentication success or failure", HFILL }},
  5472. { &hf_isakmp_cfg_attr_xauth_next_pin,
  5473. { "XAUTH TYPE", "isakmp.cfg.attr.xauth.next_pin",
  5474. FT_STRING, BASE_NONE, NULL, 0x00,
  5475. "A variable which is used when the edge device is requesting that the user choose a new pin number", HFILL }},
  5476. { &hf_isakmp_cfg_attr_xauth_answer,
  5477. { "XAUTH ANSWER", "isakmp.cfg.attr.xauth.answer",
  5478. FT_STRING, BASE_NONE, NULL, 0x00,
  5479. "A variable length ASCII string used to send input to the edge device", HFILL }},
  5480. { &hf_isakmp_cfg_attr_unity_banner,
  5481. { "UNITY BANNER", "isakmp.cfg.attr.unity.banner",
  5482. FT_STRING, BASE_NONE, NULL, 0x00,
  5483. "Banner", HFILL }},
  5484. { &hf_isakmp_cfg_attr_unity_def_domain,
  5485. { "UNITY DEF DOMAIN", "isakmp.cfg.attr.unity.def_domain",
  5486. FT_STRING, BASE_NONE, NULL, 0x00,
  5487. NULL, HFILL }},
  5488. { &hf_isakmp_enc_decrypted_data,
  5489. { "Decrypted Data", "isakmp.enc.decrypted",
  5490. FT_NONE, BASE_NONE, NULL, 0x0,
  5491. NULL, HFILL }},
  5492. { &hf_isakmp_enc_contained_data,
  5493. { "Contained Data", "isakmp.enc.contained",
  5494. FT_NONE, BASE_NONE, NULL, 0x0,
  5495. NULL, HFILL }},
  5496. { &hf_isakmp_enc_padding,
  5497. { "Padding", "isakmp.enc.padding",
  5498. FT_NONE, BASE_NONE, NULL, 0x0,
  5499. NULL, HFILL }},
  5500. { &hf_isakmp_enc_pad_length,
  5501. { "Pad Length", "isakmp.enc.pad_length",
  5502. FT_UINT16, BASE_DEC, NULL, 0x0,
  5503. NULL, HFILL }},
  5504. { &hf_isakmp_enc_data,
  5505. { "Encrypted Data", "isakmp.enc.data",
  5506. FT_NONE, BASE_NONE, NULL, 0x0,
  5507. NULL, HFILL }},
  5508. { &hf_isakmp_enc_iv,
  5509. { "Initialization Vector", "isakmp.enc.iv",
  5510. FT_BYTES, BASE_NONE, NULL, 0x0,
  5511. NULL, HFILL }},
  5512. { &hf_isakmp_enc_icd,
  5513. { "Integrity Checksum Data", "isakmp.enc.icd",
  5514. FT_BYTES, BASE_NONE, NULL, 0x0,
  5515. NULL, HFILL }},
  5516. };
  5517. static gint *ett[] = {
  5518. &ett_isakmp,
  5519. &ett_isakmp_version,
  5520. &ett_isakmp_flags,
  5521. &ett_isakmp_payload,
  5522. &ett_isakmp_fragment,
  5523. &ett_isakmp_fragments,
  5524. &ett_isakmp_sa,
  5525. &ett_isakmp_tf_attr,
  5526. &ett_isakmp_tf_ike_attr,
  5527. &ett_isakmp_tf_ike2_attr,
  5528. &ett_isakmp_id,
  5529. &ett_isakmp_cfg_attr,
  5530. &ett_isakmp_rohc_attr,
  5531. #ifdef HAVE_LIBGCRYPT
  5532. &ett_isakmp_decrypted_data,
  5533. &ett_isakmp_decrypted_payloads
  5534. #endif /* HAVE_LIBGCRYPT */
  5535. };
  5536. static ei_register_info ei[] = {
  5537. { &ei_isakmp_enc_iv, { "isakmp.enc.iv.not_enough_data", PI_MALFORMED, PI_WARN, "Not enough data in IKEv2 Encrypted payload", EXPFILL }},
  5538. { &ei_isakmp_ikev2_integrity_checksum, { "isakmp.ikev2.integrity_checksum", PI_CHECKSUM, PI_WARN, "IKEv2 Integrity Checksum Data is incorrect", EXPFILL }},
  5539. { &ei_isakmp_enc_data_length_mult_block_size, { "isakmp.enc_data_length_mult_block_size", PI_MALFORMED, PI_WARN, "Encrypted data length isn't a multiple of block size", EXPFILL }},
  5540. { &ei_isakmp_enc_pad_length_big, { "isakmp.enc.pad_length.big", PI_MALFORMED, PI_WARN, "Pad length is too big", EXPFILL }},
  5541. };
  5542. expert_module_t* expert_isakmp;
  5543. #ifdef HAVE_LIBGCRYPT
  5544. static uat_field_t ikev1_uat_flds[] = {
  5545. UAT_FLD_BUFFER(ikev1_users, icookie, "Initiator's COOKIE", "Initiator's COOKIE"),
  5546. UAT_FLD_BUFFER(ikev1_users, key, "Encryption Key", "Encryption Key"),
  5547. UAT_END_FIELDS
  5548. };
  5549. static uat_field_t ikev2_uat_flds[] = {
  5550. UAT_FLD_BUFFER(ikev2_users, spii, "Initiator's SPI", "Initiator's SPI value of the IKE_SA"),
  5551. UAT_FLD_BUFFER(ikev2_users, spir, "Responder's SPI", "Responder's SPI value of the IKE_SA"),
  5552. UAT_FLD_BUFFER(ikev2_users, sk_ei, "SK_ei", "Key used to encrypt/decrypt IKEv2 packets from initiator to responder"),
  5553. UAT_FLD_BUFFER(ikev2_users, sk_er, "SK_er", "Key used to encrypt/decrypt IKEv2 packets from responder to initiator"),
  5554. UAT_FLD_VS(ikev2_users, encr_alg, "Encryption algorithm", vs_ikev2_encr_algs, "Encryption algorithm of IKE_SA"),
  5555. UAT_FLD_BUFFER(ikev2_users, sk_ai, "SK_ai", "Key used to calculate Integrity Checksum Data for IKEv2 packets from initiator to responder"),
  5556. UAT_FLD_BUFFER(ikev2_users, sk_ar, "SK_ar", "Key used to calculate Integrity Checksum Data for IKEv2 packets from responder to initiator"),
  5557. UAT_FLD_VS(ikev2_users, auth_alg, "Integrity algorithm", vs_ikev2_auth_algs, "Integrity algorithm of IKE_SA"),
  5558. UAT_END_FIELDS
  5559. };
  5560. #endif /* HAVE_LIBGCRYPT */
  5561. proto_isakmp = proto_register_protocol("Internet Security Association and Key Management Protocol",
  5562. "ISAKMP", "isakmp");
  5563. proto_register_field_array(proto_isakmp, hf, array_length(hf));
  5564. proto_register_subtree_array(ett, array_length(ett));
  5565. expert_isakmp = expert_register_protocol(proto_isakmp);
  5566. expert_register_field_array(expert_isakmp, ei, array_length(ei));
  5567. register_init_routine(&isakmp_init_protocol);
  5568. register_dissector("isakmp", dissect_isakmp, proto_isakmp);
  5569. #ifdef HAVE_LIBGCRYPT
  5570. isakmp_module = prefs_register_protocol(proto_isakmp, isakmp_prefs_apply_cb);
  5571. ikev1_uat = uat_new("IKEv1 Decryption Table",
  5572. sizeof(ikev1_uat_data_key_t),
  5573. "ikev1_decryption_table",
  5574. TRUE,
  5575. (void**)&ikev1_uat_data,
  5576. &num_ikev1_uat_data,
  5577. UAT_AFFECTS_DISSECTION, /* affects dissection of packets, but not set of named fields */
  5578. "ChIKEv1DecryptionSection",
  5579. NULL,
  5580. ikev1_uat_data_update_cb,
  5581. NULL,
  5582. NULL,
  5583. ikev1_uat_flds);
  5584. prefs_register_uat_preference(isakmp_module,
  5585. "ikev1_decryption_table",
  5586. "IKEv1 Decryption Table",
  5587. "Table of IKE_SA security parameters for decryption of IKEv1 packets",
  5588. ikev1_uat);
  5589. ikev2_uat = uat_new("IKEv2 Decryption Table",
  5590. sizeof(ikev2_uat_data_t),
  5591. "ikev2_decryption_table",
  5592. TRUE,
  5593. (void**)&ikev2_uat_data,
  5594. &num_ikev2_uat_data,
  5595. UAT_AFFECTS_DISSECTION, /* affects dissection of packets, but not set of named fields */
  5596. "ChIKEv2DecryptionSection",
  5597. NULL,
  5598. ikev2_uat_data_update_cb,
  5599. NULL,
  5600. NULL,
  5601. ikev2_uat_flds);
  5602. prefs_register_uat_preference(isakmp_module,
  5603. "ikev2_decryption_table",
  5604. "IKEv2 Decryption Table",
  5605. "Table of IKE_SA security parameters for decryption of IKEv2 packets",
  5606. ikev2_uat);
  5607. #endif /* HAVE_LIBGCRYPT */
  5608. }
  5609. void
  5610. proto_reg_handoff_isakmp(void)
  5611. {
  5612. dissector_handle_t isakmp_handle;
  5613. isakmp_handle = find_dissector("isakmp");
  5614. eap_handle = find_dissector("eap");
  5615. dissector_add_uint("udp.port", UDP_PORT_ISAKMP, isakmp_handle);
  5616. dissector_add_uint("tcp.port", TCP_PORT_ISAKMP, isakmp_handle);
  5617. }