suricata
detect-tls-version.c
Go to the documentation of this file.
1 /* Copyright (C) 2007-2016 Open Information Security Foundation
2  *
3  * You can copy, redistribute or modify this Program under the terms of
4  * the GNU General Public License version 2 as published by the Free
5  * Software Foundation.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * version 2 along with this program; if not, write to the Free Software
14  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15  * 02110-1301, USA.
16  */
17 
18 /**
19  * \file
20  *
21  * \author Victor Julien <victor@inliniac.net>
22  *
23  * Implements the tls.version keyword
24  */
25 
26 #include "suricata-common.h"
27 #include "threads.h"
28 #include "debug.h"
29 #include "decode.h"
30 
31 #include "detect.h"
32 #include "detect-parse.h"
33 
34 #include "detect-engine.h"
35 #include "detect-engine-mpm.h"
36 #include "detect-engine-state.h"
37 
38 #include "flow.h"
39 #include "flow-var.h"
40 #include "flow-util.h"
41 
42 #include "util-debug.h"
43 #include "util-unittest.h"
44 #include "util-unittest-helper.h"
45 
46 #include "app-layer.h"
47 #include "app-layer-parser.h"
48 
49 #include "app-layer-ssl.h"
50 #include "detect-tls-version.h"
51 
52 #include "stream-tcp.h"
53 
54 /**
55  * \brief Regex for parsing "id" option, matching number or "number"
56  */
57 #define PARSE_REGEX "^\\s*([A-z0-9\\.]+|\"[A-z0-9\\.]+\")\\s*$"
58 
59 static pcre *parse_regex;
60 static pcre_extra *parse_regex_study;
61 
62 static int DetectTlsVersionMatch (ThreadVars *, DetectEngineThreadCtx *,
63  Flow *, uint8_t, void *, void *,
64  const Signature *, const SigMatchCtx *);
65 static int DetectTlsVersionSetup (DetectEngineCtx *, Signature *, const char *);
66 static void DetectTlsVersionRegisterTests(void);
67 static void DetectTlsVersionFree(void *);
68 static int g_tls_generic_list_id = 0;
69 
70 /**
71  * \brief Registration function for keyword: tls.version
72  */
74 {
75  sigmatch_table[DETECT_AL_TLS_VERSION].name = "tls.version";
76  sigmatch_table[DETECT_AL_TLS_VERSION].desc = "match on TLS/SSL version";
77  sigmatch_table[DETECT_AL_TLS_VERSION].url = DOC_URL DOC_VERSION "/rules/tls-keywords.html#tls-version";
78  sigmatch_table[DETECT_AL_TLS_VERSION].AppLayerTxMatch = DetectTlsVersionMatch;
79  sigmatch_table[DETECT_AL_TLS_VERSION].Setup = DetectTlsVersionSetup;
80  sigmatch_table[DETECT_AL_TLS_VERSION].Free = DetectTlsVersionFree;
81  sigmatch_table[DETECT_AL_TLS_VERSION].RegisterTests = DetectTlsVersionRegisterTests;
82 
83  DetectSetupParseRegexes(PARSE_REGEX, &parse_regex, &parse_regex_study);
84 
85  g_tls_generic_list_id = DetectBufferTypeRegister("tls_generic");
86 }
87 
88 /**
89  * \brief match the specified version on a tls session
90  *
91  * \param t pointer to thread vars
92  * \param det_ctx pointer to the pattern matcher thread
93  * \param p pointer to the current packet
94  * \param m pointer to the sigmatch that we will cast into DetectTlsVersionData
95  *
96  * \retval 0 no match
97  * \retval 1 match
98  */
99 static int DetectTlsVersionMatch (ThreadVars *t, DetectEngineThreadCtx *det_ctx,
100  Flow *f, uint8_t flags, void *state, void *txv,
101  const Signature *s, const SigMatchCtx *m)
102 {
103  SCEnter();
104 
105  const DetectTlsVersionData *tls_data = (const DetectTlsVersionData *)m;
106  SSLState *ssl_state = (SSLState *)state;
107  if (ssl_state == NULL) {
108  SCLogDebug("no tls state, no match");
109  SCReturnInt(0);
110  }
111 
112  int ret = 0;
113  uint16_t version = 0;
114  SCLogDebug("looking for tls_data->ver 0x%02X (flags 0x%02X)", tls_data->ver, flags);
115 
116  if (flags & STREAM_TOCLIENT) {
117  version = ssl_state->server_connp.version;
118  SCLogDebug("server (toclient) version is 0x%02X", version);
119  } else if (flags & STREAM_TOSERVER) {
120  version = ssl_state->client_connp.version;
121  SCLogDebug("client (toserver) version is 0x%02X", version);
122  }
123 
124  if ((tls_data->flags & DETECT_TLS_VERSION_FLAG_RAW) == 0) {
125  /* Match all TLSv1.3 drafts as TLSv1.3 */
126  if (((version >> 8) & 0xff) == 0x7f) {
127  version = TLS_VERSION_13;
128  }
129  }
130 
131  if (tls_data->ver == version) {
132  ret = 1;
133  }
134 
135  SCReturnInt(ret);
136 }
137 
138 /**
139  * \brief This function is used to parse IPV4 ip_id passed via keyword: "id"
140  *
141  * \param idstr Pointer to the user provided id option
142  *
143  * \retval id_d pointer to DetectTlsVersionData on success
144  * \retval NULL on failure
145  */
146 static DetectTlsVersionData *DetectTlsVersionParse (const char *str)
147 {
148  uint16_t temp;
149  DetectTlsVersionData *tls = NULL;
150  #define MAX_SUBSTRINGS 30
151  int ret = 0, res = 0;
152  int ov[MAX_SUBSTRINGS];
153 
154  ret = pcre_exec(parse_regex, parse_regex_study, str, strlen(str), 0, 0,
155  ov, MAX_SUBSTRINGS);
156 
157  if (ret < 1 || ret > 3) {
158  SCLogError(SC_ERR_PCRE_MATCH, "invalid tls.version option");
159  goto error;
160  }
161 
162  if (ret > 1) {
163  const char *str_ptr;
164  char *orig;
165  char *tmp_str;
166  res = pcre_get_substring((char *)str, ov, MAX_SUBSTRINGS, 1, &str_ptr);
167  if (res < 0) {
168  SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre_get_substring failed");
169  goto error;
170  }
171 
172  /* We have a correct id option */
173  tls = SCCalloc(1, sizeof(DetectTlsVersionData));
174  if (unlikely(tls == NULL))
175  goto error;
176 
177  orig = SCStrdup((char*)str_ptr);
178  if (unlikely(orig == NULL)) {
179  goto error;
180  }
181  tmp_str=orig;
182 
183  /* Let's see if we need to scape "'s */
184  if (tmp_str[0] == '"')
185  {
186  tmp_str[strlen(tmp_str) - 1] = '\0';
187  tmp_str += 1;
188  }
189 
190  if (strncmp("1.0", tmp_str, 3) == 0) {
191  temp = TLS_VERSION_10;
192  } else if (strncmp("1.1", tmp_str, 3) == 0) {
193  temp = TLS_VERSION_11;
194  } else if (strncmp("1.2", tmp_str, 3) == 0) {
195  temp = TLS_VERSION_12;
196  } else if (strncmp("1.3", tmp_str, 3) == 0) {
197  temp = TLS_VERSION_13;
198  } else if ((strncmp("0x", tmp_str, 2) == 0) && (strlen(str) == 6)) {
199  temp = (uint16_t)strtol(tmp_str, NULL, 0);
201  } else {
202  SCLogError(SC_ERR_INVALID_VALUE, "Invalid value");
203  SCFree(orig);
204  goto error;
205  }
206 
207  tls->ver = temp;
208 
209  SCFree(orig);
210 
211  SCLogDebug("will look for tls %"PRIu8"", tls->ver);
212  }
213 
214  return tls;
215 
216 error:
217  if (tls != NULL)
218  DetectTlsVersionFree(tls);
219  return NULL;
220 
221 }
222 
223 /**
224  * \brief this function is used to add the parsed "id" option
225  * \brief into the current signature
226  *
227  * \param de_ctx pointer to the Detection Engine Context
228  * \param s pointer to the Current Signature
229  * \param idstr pointer to the user provided "id" option
230  *
231  * \retval 0 on Success
232  * \retval -1 on Failure
233  */
234 static int DetectTlsVersionSetup (DetectEngineCtx *de_ctx, Signature *s, const char *str)
235 {
236  DetectTlsVersionData *tls = NULL;
237  SigMatch *sm = NULL;
238 
240  return -1;
241 
242  tls = DetectTlsVersionParse(str);
243  if (tls == NULL)
244  goto error;
245 
246  /* Okay so far so good, lets get this into a SigMatch
247  * and put it in the Signature. */
248  sm = SigMatchAlloc();
249  if (sm == NULL)
250  goto error;
251 
253  sm->ctx = (void *)tls;
254 
255  SigMatchAppendSMToList(s, sm, g_tls_generic_list_id);
256 
257  return 0;
258 
259 error:
260  if (tls != NULL)
261  DetectTlsVersionFree(tls);
262  if (sm != NULL)
263  SCFree(sm);
264  return -1;
265 
266 }
267 
268 /**
269  * \brief this function will free memory associated with DetectTlsVersionData
270  *
271  * \param id_d pointer to DetectTlsVersionData
272  */
273 static void DetectTlsVersionFree(void *ptr)
274 {
276  SCFree(id_d);
277 }
278 
279 #ifdef UNITTESTS /* UNITTESTS */
280 
281 /**
282  * \test DetectTlsVersionTestParse01 is a test to make sure that we parse the "id"
283  * option correctly when given valid id option
284  */
285 static int DetectTlsVersionTestParse01 (void)
286 {
287  DetectTlsVersionData *tls = NULL;
288  tls = DetectTlsVersionParse("1.0");
289  FAIL_IF_NULL(tls);
290  FAIL_IF_NOT(tls->ver == TLS_VERSION_10);
291  DetectTlsVersionFree(tls);
292  PASS;
293 }
294 
295 /**
296  * \test DetectTlsVersionTestParse02 is a test to make sure that we parse the "id"
297  * option correctly when given an invalid id option
298  * it should return id_d = NULL
299  */
300 static int DetectTlsVersionTestParse02 (void)
301 {
302  DetectTlsVersionData *tls = NULL;
303  tls = DetectTlsVersionParse("2.5");
304  FAIL_IF_NOT_NULL(tls);
305  DetectTlsVersionFree(tls);
306  PASS;
307 }
308 
309 #include "stream-tcp-reassemble.h"
310 
311 /** \test Send a get request in three chunks + more data. */
312 static int DetectTlsVersionTestDetect01(void)
313 {
314  Flow f;
315  uint8_t tlsbuf1[] = { 0x16 };
316  uint32_t tlslen1 = sizeof(tlsbuf1);
317  uint8_t tlsbuf2[] = { 0x03 };
318  uint32_t tlslen2 = sizeof(tlsbuf2);
319  uint8_t tlsbuf3[] = { 0x01 };
320  uint32_t tlslen3 = sizeof(tlsbuf3);
321  uint8_t tlsbuf4[] = { 0x01, 0x00, 0x00, 0xad, 0x03, 0x01 };
322  uint32_t tlslen4 = sizeof(tlsbuf4);
323  TcpSession ssn;
324  Packet *p = NULL;
325  Signature *s = NULL;
326  ThreadVars th_v;
327  DetectEngineThreadCtx *det_ctx = NULL;
329 
330  memset(&th_v, 0, sizeof(th_v));
331  memset(&f, 0, sizeof(f));
332  memset(&ssn, 0, sizeof(ssn));
333 
334  p = UTHBuildPacket(NULL, 0, IPPROTO_TCP);
335 
336  FLOW_INITIALIZE(&f);
337  f.protoctx = (void *)&ssn;
338  f.proto = IPPROTO_TCP;
339  p->flow = &f;
343  f.alproto = ALPROTO_TLS;
344 
346 
348  FAIL_IF_NULL(de_ctx);
349 
350  de_ctx->flags |= DE_QUIET;
351 
352  s = de_ctx->sig_list = SigInit(de_ctx,"alert tls any any -> any any (msg:\"TLS\"; tls.version:1.0; sid:1;)");
353  FAIL_IF_NULL(s);
354 
355  SigGroupBuild(de_ctx);
356  DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx);
357 
358  FLOWLOCK_WRLOCK(&f);
359  int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS,
360  STREAM_TOSERVER, tlsbuf1, tlslen1);
361  FAIL_IF(r != 0);
362 
363  r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER,
364  tlsbuf2, tlslen2);
365  FAIL_IF(r != 0);
366 
367  r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER,
368  tlsbuf3, tlslen3);
369  FAIL_IF(r != 0);
370 
371  r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER,
372  tlsbuf4, tlslen4);
373  FAIL_IF(r != 0);
374  FLOWLOCK_UNLOCK(&f);
375 
376  SSLState *ssl_state = f.alstate;
377  FAIL_IF_NULL(ssl_state);
378 
379  FAIL_IF(ssl_state->client_connp.content_type != 0x16);
380 
382 
383  SCLogDebug("ssl_state is at %p, ssl_state->server_version 0x%02X "
384  "ssl_state->client_version 0x%02X",
385  ssl_state, ssl_state->server_connp.version,
386  ssl_state->client_connp.version);
387 
388  /* do detect */
389  SigMatchSignatures(&th_v, de_ctx, det_ctx, p);
390 
392 
393  AppLayerParserThreadCtxFree(alp_tctx);
394  SigGroupCleanup(de_ctx);
395  SigCleanSignatures(de_ctx);
396 
397  DetectEngineThreadCtxDeinit(&th_v, (void *)det_ctx);
398  DetectEngineCtxFree(de_ctx);
399 
401  FLOW_DESTROY(&f);
402 
403  UTHFreePackets(&p, 1);
404 
405  PASS;
406 }
407 
408 static int DetectTlsVersionTestDetect02(void)
409 {
410  Flow f;
411  uint8_t tlsbuf1[] = { 0x16 };
412  uint32_t tlslen1 = sizeof(tlsbuf1);
413  uint8_t tlsbuf2[] = { 0x03 };
414  uint32_t tlslen2 = sizeof(tlsbuf2);
415  uint8_t tlsbuf3[] = { 0x01 };
416  uint32_t tlslen3 = sizeof(tlsbuf3);
417  uint8_t tlsbuf4[] = { 0x01, 0x00, 0x00, 0xad, 0x03, 0x02 };
418  uint32_t tlslen4 = sizeof(tlsbuf4);
419  TcpSession ssn;
420  Packet *p = NULL;
421  Signature *s = NULL;
422  ThreadVars th_v;
423  DetectEngineThreadCtx *det_ctx = NULL;
425 
426  memset(&th_v, 0, sizeof(th_v));
427  memset(&f, 0, sizeof(f));
428  memset(&ssn, 0, sizeof(ssn));
429 
430  p = UTHBuildPacket(NULL, 0, IPPROTO_TCP);
431 
432  FLOW_INITIALIZE(&f);
433  f.protoctx = (void *)&ssn;
434  f.proto = IPPROTO_TCP;
435  p->flow = &f;
439  f.alproto = ALPROTO_TLS;
440 
442 
444  FAIL_IF_NULL(de_ctx);
445 
446  de_ctx->flags |= DE_QUIET;
447 
448  s = de_ctx->sig_list = SigInit(de_ctx,"alert tls any any -> any any (msg:\"TLS\"; tls.version:1.0; sid:1;)");
449  FAIL_IF_NULL(s);
450 
451  SigGroupBuild(de_ctx);
452  DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx);
453 
454  FLOWLOCK_WRLOCK(&f);
455  int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS,
456  STREAM_TOSERVER, tlsbuf1, tlslen1);
457  FAIL_IF(r != 0);
458 
459  r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER,
460  tlsbuf2, tlslen2);
461  FAIL_IF(r != 0);
462 
463  r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER,
464  tlsbuf3, tlslen3);
465  FAIL_IF(r != 0);
466 
467  r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_TLS, STREAM_TOSERVER,
468  tlsbuf4, tlslen4);
469  FAIL_IF(r != 0);
470  FLOWLOCK_UNLOCK(&f);
471 
472  SSLState *ssl_state = f.alstate;
473  FAIL_IF_NULL(ssl_state);
474 
475  FAIL_IF(ssl_state->client_connp.content_type != 0x16);
476 
478 
479  /* do detect */
480  SigMatchSignatures(&th_v, de_ctx, det_ctx, p);
481 
483 
484  AppLayerParserThreadCtxFree(alp_tctx);
485  SigGroupCleanup(de_ctx);
486  SigCleanSignatures(de_ctx);
487 
488  DetectEngineThreadCtxDeinit(&th_v, (void *)det_ctx);
489  DetectEngineCtxFree(de_ctx);
490 
492  FLOW_DESTROY(&f);
493 
494  UTHFreePackets(&p, 1);
495 
496  PASS;
497 }
498 #endif /* UNITTESTS */
499 
500 /**
501  * \brief this function registers unit tests for DetectTlsVersion
502  */
503 static void DetectTlsVersionRegisterTests(void)
504 {
505 #ifdef UNITTESTS /* UNITTESTS */
506  UtRegisterTest("DetectTlsVersionTestParse01", DetectTlsVersionTestParse01);
507  UtRegisterTest("DetectTlsVersionTestParse02", DetectTlsVersionTestParse02);
508  UtRegisterTest("DetectTlsVersionTestDetect01",
509  DetectTlsVersionTestDetect01);
510  UtRegisterTest("DetectTlsVersionTestDetect02",
511  DetectTlsVersionTestDetect02);
512 #endif /* UNITTESTS */
513 }
514 
#define MAX_SUBSTRINGS
SigTableElmt sigmatch_table[DETECT_TBLSIZE]
Definition: detect.h:1403
uint16_t flags
int(* Setup)(DetectEngineCtx *, Signature *, const char *)
Definition: detect.h:1146
int(* AppLayerTxMatch)(ThreadVars *, DetectEngineThreadCtx *, Flow *, uint8_t flags, void *alstate, void *txv, const Signature *, const SigMatchCtx *)
Definition: detect.h:1132
#define SCLogDebug(...)
Definition: util-debug.h:335
int DetectSignatureSetAppProto(Signature *s, AppProto alproto)
struct Flow_ * flow
Definition: decode.h:444
int PacketAlertCheck(Packet *p, uint32_t sid)
Check if a certain sid alerted, this is used in the test functions.
uint8_t proto
Definition: flow.h:346
uint16_t version
#define FLOWLOCK_UNLOCK(fb)
Definition: flow.h:235
#define PASS
Pass the test.
#define unlikely(expr)
Definition: util-optimize.h:35
Signature * SigInit(DetectEngineCtx *, const char *)
Parses a signature and adds it to the Detection Engine Context.
Signature * sig_list
Definition: detect.h:726
SSLStateConnp server_connp
#define FAIL_IF(expr)
Fail a test if expression evaluates to false.
Definition: util-unittest.h:71
void AppLayerParserThreadCtxFree(AppLayerParserThreadCtx *tctx)
Destroys the app layer parser thread context obtained using AppLayerParserThreadCtxAlloc().
#define FLOW_PKT_ESTABLISHED
Definition: flow.h:195
void SigCleanSignatures(DetectEngineCtx *de_ctx)
void StreamTcpFreeConfig(char quiet)
Definition: stream-tcp.c:669
#define FLOWLOCK_WRLOCK(fb)
Definition: flow.h:232
TmEcode DetectEngineThreadCtxInit(ThreadVars *, void *, void **)
initialize thread specific detection engine context
const char * name
Definition: detect.h:1160
Signature container.
Definition: detect.h:492
#define TRUE
Used to start a pointer to SigMatch context Should never be dereferenced without casting to something...
Definition: detect.h:319
#define PARSE_REGEX
Regex for parsing "id" option, matching number or "number".
void * protoctx
Definition: flow.h:398
main detection engine ctx
Definition: detect.h:720
TmEcode DetectEngineThreadCtxDeinit(ThreadVars *, void *)
SSLv[2.0|3.[0|1|2|3]] state structure.
void * alstate
Definition: flow.h:436
#define DE_QUIET
Definition: detect.h:298
#define str(s)
#define SCCalloc(nm, a)
Definition: util-mem.h:205
uint8_t flags
Definition: detect.h:721
Data structures and function prototypes for keeping state for the detection engine.
void(* Free)(void *)
Definition: detect.h:1151
#define SCLogError(err_code,...)
Macro used to log ERROR messages.
Definition: util-debug.h:294
#define FLOW_DESTROY(f)
Definition: flow-util.h:115
int SigGroupBuild(DetectEngineCtx *de_ctx)
Convert the signature list into the runtime match structure.
void UtRegisterTest(const char *name, int(*TestFn)(void))
Register unit test.
void SigMatchSignatures(ThreadVars *th_v, DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx, Packet *p)
wrapper for old tests
Definition: detect.c:1752
void DetectSetupParseRegexes(const char *parse_str, pcre **parse_regex, pcre_extra **parse_regex_study)
#define SCEnter(...)
Definition: util-debug.h:337
void StreamTcpInitConfig(char)
To initialize the stream global configuration data.
Definition: stream-tcp.c:365
uint8_t flowflags
Definition: decode.h:438
Packet * UTHBuildPacket(uint8_t *payload, uint16_t payload_len, uint8_t ipproto)
UTHBuildPacket is a wrapper that build packets with default ip and port fields.
#define STREAM_TOCLIENT
Definition: stream.h:32
#define FLOW_PKT_TOSERVER
Definition: flow.h:193
AppLayerParserThreadCtx * AppLayerParserThreadCtxAlloc(void)
Gets a new app layer protocol&#39;s parser thread context.
#define FAIL_IF_NOT_NULL(expr)
Fail a test if expression evaluates to non-NULL.
Definition: util-unittest.h:96
int SigGroupCleanup(DetectEngineCtx *de_ctx)
uint8_t type
Definition: detect.h:325
#define SCReturnInt(x)
Definition: util-debug.h:341
const char * desc
Definition: detect.h:1162
void SigMatchAppendSMToList(Signature *s, SigMatch *new, int list)
Append a SigMatch to the list type.
Definition: detect-parse.c:282
int DetectBufferTypeRegister(const char *name)
SigMatchCtx * ctx
Definition: detect.h:327
uint8_t version
Definition: decode-gre.h:405
#define SCFree(a)
Definition: util-mem.h:236
PoolThreadReserved res
#define DETECT_TLS_VERSION_FLAG_RAW
const char * url
Definition: detect.h:1163
#define FLOW_INITIALIZE(f)
Definition: flow-util.h:39
#define STREAM_TOSERVER
Definition: stream.h:31
SCMutex m
Definition: flow-hash.h:105
#define PKT_HAS_FLOW
Definition: decode.h:1101
uint8_t content_type
#define SCStrdup(a)
Definition: util-mem.h:220
#define FAIL_IF_NULL(expr)
Fail a test if expression evaluates to NULL.
Definition: util-unittest.h:89
#define DOC_URL
Definition: suricata.h:86
SigMatch * SigMatchAlloc(void)
Definition: detect-parse.c:226
Per thread variable structure.
Definition: threadvars.h:57
AppProto alproto
application level protocol
Definition: flow.h:407
uint32_t flags
Definition: decode.h:442
#define DOC_VERSION
Definition: suricata.h:91
void DetectEngineCtxFree(DetectEngineCtx *)
Free a DetectEngineCtx::
void UTHFreePackets(Packet **p, int numpkts)
UTHFreePackets: function to release the allocated data from UTHBuildPacket and the packet itself...
Flow data structure.
Definition: flow.h:327
void DetectTlsVersionRegister(void)
Registration function for keyword: tls.version.
SSLStateConnp client_connp
#define PKT_STREAM_EST
Definition: decode.h:1099
void(* RegisterTests)(void)
Definition: detect.h:1152
a single match condition for a signature
Definition: detect.h:324
#define FAIL_IF_NOT(expr)
Fail a test if expression to true.
Definition: util-unittest.h:82
int AppLayerParserParse(ThreadVars *tv, AppLayerParserThreadCtx *alp_tctx, Flow *f, AppProto alproto, uint8_t flags, uint8_t *input, uint32_t input_len)
DetectEngineCtx * DetectEngineCtxInit(void)