From e846d238d7194188e211de7d7cacc531f388a183 Mon Sep 17 00:00:00 2001 From: Joakim Karlsson Date: Mon, 10 Aug 2020 14:47:43 +0200 Subject: [PATCH] QUIC: fix compile without LIBGCRYPT_AEAD Change-Id: Id0d3ba56e91c5dcf8b7063a2166445ca7bcec5d3 Reviewed-on: https://code.wireshark.org/review/38110 Petri-Dish: Alexis La Goutte Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman --- epan/dissectors/packet-http3.c | 14 ++++++++++++++ epan/dissectors/packet-quic.c | 2 -- epan/dissectors/packet-quic.h | 3 +++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/epan/dissectors/packet-http3.c b/epan/dissectors/packet-http3.c index f132a7f04e..0b46486e7c 100644 --- a/epan/dissectors/packet-http3.c +++ b/epan/dissectors/packet-http3.c @@ -35,6 +35,7 @@ static int hf_http3_frame_type = -1; static int hf_http3_frame_length = -1; static int hf_http3_frame_payload = -1; static expert_field ei_http3_unknown_stream_type = EI_INIT; +static expert_field ei_http3_data_not_decoded = EI_INIT; /* Initialize the subtree pointers */ static gint ett_http3 = -1; @@ -159,6 +160,7 @@ http3_check_frame_size(tvbuff_t *tvb, packet_info *pinfo, int offset) return FALSE; } +#ifdef HAVE_LIBGCRYPT_AEAD static int dissect_http3_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) { @@ -250,6 +252,7 @@ dissect_http3_uni_stream(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, in return offset; } +#endif /* HAVE_LIBGCRYPT_AEAD */ static int dissect_http3(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) @@ -258,7 +261,9 @@ dissect_http3(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) proto_item *ti; proto_tree *http3_tree; int offset = 0; +#ifdef HAVE_LIBGCRYPT_AEAD http3_stream_info *h3_stream; +#endif /* HAVE_LIBGCRYPT_AEAD */ if (!stream_info) { return 0; @@ -289,6 +294,7 @@ dissect_http3(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) ti = proto_tree_add_item(tree, proto_http3, tvb, 0, -1, ENC_NA); http3_tree = proto_item_add_subtree(ti, ett_http3); +#ifdef HAVE_LIBGCRYPT_AEAD h3_stream = (http3_stream_info *)quic_stream_get_proto_data(pinfo, stream_info); if (!h3_stream) { h3_stream = wmem_new0(wmem_file_scope(), http3_stream_info); @@ -324,6 +330,10 @@ dissect_http3(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) } offset = dissect_http3_frame(tvb, pinfo, http3_tree, offset); } +#else + proto_tree_add_expert_format(http3_tree, pinfo, &ei_http3_data_not_decoded, tvb, offset, 0, + "Data not decoded, missing LIBGCRYPT AEAD support"); +#endif return tvb_captured_length(tvb); } @@ -370,6 +380,10 @@ proto_register_http3(void) { "http3.unknown_stream_type", PI_UNDECODED, PI_WARN, "An unknown stream type was encountered", EXPFILL } }, + { &ei_http3_data_not_decoded, + { "http3.data_not_decoded", PI_UNDECODED, PI_WARN, + "Data not decoded", EXPFILL } + }, }; proto_http3 = proto_register_protocol("Hypertext Transfer Protocol Version 3", "HTTP3", "http3"); diff --git a/epan/dissectors/packet-quic.c b/epan/dissectors/packet-quic.c index f6e1efb225..fa37525b77 100644 --- a/epan/dissectors/packet-quic.c +++ b/epan/dissectors/packet-quic.c @@ -1396,7 +1396,6 @@ dissect_quic_stream_payload(tvbuff_t *tvb, int offset, int length, packet_info * pinfo->can_desegment = 2; desegment_quic_stream(tvb, offset, length, pinfo, tree, quic_info, stream_info, stream); } -#endif /* HAVE_LIBGCRYPT_AEAD */ /* QUIC Streams tracking and reassembly. }}} */ void @@ -1412,7 +1411,6 @@ void *quic_stream_get_proto_data(packet_info *pinfo, quic_stream_info *stream_in return stream->subdissector_private; } -#ifdef HAVE_LIBGCRYPT_AEAD static int dissect_quic_frame_type(tvbuff_t *tvb, packet_info *pinfo, proto_tree *quic_tree, guint offset, quic_info_data_t *quic_info, gboolean from_server) { diff --git a/epan/dissectors/packet-quic.h b/epan/dissectors/packet-quic.h index be2d89accc..9a111fed7d 100644 --- a/epan/dissectors/packet-quic.h +++ b/epan/dissectors/packet-quic.h @@ -39,8 +39,11 @@ typedef struct _quic_stream_info { #define QUIC_STREAM_SERVER_UNI 3 /** Set/Get protocol-specific data for the QUIC STREAM. */ + +#ifdef HAVE_LIBGCRYPT_AEAD void quic_stream_add_proto_data(struct _packet_info *pinfo, quic_stream_info *stream_info, void *proto_data); void *quic_stream_get_proto_data(struct _packet_info *pinfo, quic_stream_info *stream_info); +#endif /* HAVE_LIBGCRYPT_AEAD */ /** Returns the number of items for quic.connection.number. */ WS_DLL_PUBLIC guint32 get_quic_connections_count(void);