suricata
detect-tls-cert-validity.c
Go to the documentation of this file.
1 /* Copyright (C) 2015-2020 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 Mats Klepsland <mats.klepsland@gmail.com>
22  *
23  * Implements tls certificate validity keywords
24  */
25 
26 #include "suricata-common.h"
27 #include "threads.h"
28 #include "decode.h"
29 #include "detect.h"
30 
31 #include "detect-parse.h"
32 #include "detect-engine.h"
33 #include "detect-engine-mpm.h"
34 #include "detect-content.h"
35 #include "detect-pcre.h"
37 
38 #include "flow.h"
39 #include "flow-util.h"
40 #include "flow-var.h"
41 
42 #include "stream-tcp.h"
43 
44 #include "app-layer.h"
45 #include "app-layer-ssl.h"
46 
47 #include "util-time.h"
48 #include "util-unittest.h"
49 #include "util-unittest-helper.h"
50 
51 /**
52  * [tls_notbefore|tls_notafter]:[<|>]<date string>[<><date string>];
53  */
54 #define PARSE_REGEX \
55  "^\\s*(<|>)?\\s*([ -:TW0-9]+[-:TW0-9]+)\\s*(?:(<>)\\s*([ -:TW0-9]+[-:TW0-9]+))?\\s*$"
56 static DetectParseRegex parse_regex;
57 
58 static int DetectTlsValidityMatch (DetectEngineThreadCtx *, Flow *,
59  uint8_t, void *, void *, const Signature *,
60  const SigMatchCtx *);
61 
62 static time_t DateStringToEpoch (char *);
63 static DetectTlsValidityData *DetectTlsValidityParse (const char *);
64 static int DetectTlsExpiredSetup (DetectEngineCtx *, Signature *s, const char *str);
65 static int DetectTlsValidSetup (DetectEngineCtx *, Signature *s, const char *str);
66 static int DetectTlsNotBeforeSetup (DetectEngineCtx *, Signature *s, const char *str);
67 static int DetectTlsNotAfterSetup (DetectEngineCtx *, Signature *s, const char *str);
68 static int DetectTlsValiditySetup (DetectEngineCtx *, Signature *s, const char *str, uint8_t);
69 #ifdef UNITTESTS
70 static void TlsNotBeforeRegisterTests(void);
71 static void TlsNotAfterRegisterTests(void);
72 static void TlsExpiredRegisterTests(void);
73 static void TlsValidRegisterTests(void);
74 #endif /* UNITTESTS */
75 static void DetectTlsValidityFree(DetectEngineCtx *, void *);
76 static int g_tls_validity_buffer_id = 0;
77 
78 /**
79  * \brief Registration function for tls validity keywords.
80  */
82 {
83  sigmatch_table[DETECT_TLS_NOTBEFORE].name = "tls_cert_notbefore";
84  sigmatch_table[DETECT_TLS_NOTBEFORE].desc = "match TLS certificate notBefore field";
85  sigmatch_table[DETECT_TLS_NOTBEFORE].url = "/rules/tls-keywords.html#tls-cert-notbefore";
86  sigmatch_table[DETECT_TLS_NOTBEFORE].AppLayerTxMatch = DetectTlsValidityMatch;
87  sigmatch_table[DETECT_TLS_NOTBEFORE].Setup = DetectTlsNotBeforeSetup;
88  sigmatch_table[DETECT_TLS_NOTBEFORE].Free = DetectTlsValidityFree;
89 #ifdef UNITTESTS
91 #endif
92 
93  sigmatch_table[DETECT_TLS_NOTAFTER].name = "tls_cert_notafter";
94  sigmatch_table[DETECT_TLS_NOTAFTER].desc = "match TLS certificate notAfter field";
95  sigmatch_table[DETECT_TLS_NOTAFTER].url = "/rules/tls-keywords.html#tls-cert-notafter";
96  sigmatch_table[DETECT_TLS_NOTAFTER].AppLayerTxMatch = DetectTlsValidityMatch;
97  sigmatch_table[DETECT_TLS_NOTAFTER].Setup = DetectTlsNotAfterSetup;
98  sigmatch_table[DETECT_TLS_NOTAFTER].Free = DetectTlsValidityFree;
99 #ifdef UNITTESTS
101 #endif
102 
103  sigmatch_table[DETECT_TLS_EXPIRED].name = "tls_cert_expired";
104  sigmatch_table[DETECT_TLS_EXPIRED].desc = "match expired TLS certificates";
105  sigmatch_table[DETECT_TLS_EXPIRED].url = "/rules/tls-keywords.html#tls-cert-expired";
106  sigmatch_table[DETECT_TLS_EXPIRED].AppLayerTxMatch = DetectTlsValidityMatch;
107  sigmatch_table[DETECT_TLS_EXPIRED].Setup = DetectTlsExpiredSetup;
108  sigmatch_table[DETECT_TLS_EXPIRED].Free = DetectTlsValidityFree;
110 #ifdef UNITTESTS
112 #endif
113 
114  sigmatch_table[DETECT_TLS_VALID].name = "tls_cert_valid";
115  sigmatch_table[DETECT_TLS_VALID].desc = "match valid TLS certificates";
116  sigmatch_table[DETECT_TLS_VALID].url = "/rules/tls-keywords.html#tls-cert-valid";
117  sigmatch_table[DETECT_TLS_VALID].AppLayerTxMatch = DetectTlsValidityMatch;
118  sigmatch_table[DETECT_TLS_VALID].Setup = DetectTlsValidSetup;
119  sigmatch_table[DETECT_TLS_VALID].Free = DetectTlsValidityFree;
121 #ifdef UNITTESTS
123 #endif
124 
125  DetectSetupParseRegexes(PARSE_REGEX, &parse_regex);
126 
127  g_tls_validity_buffer_id = DetectBufferTypeGetByName("tls:server_cert_done:generic");
128 }
129 
130 /**
131  * \internal
132  * \brief Function to match validity field in a tls certificate.
133  *
134  * \param t Pointer to thread vars.
135  * \param det_ctx Pointer to the pattern matcher thread.
136  * \param f Pointer to the current flow.
137  * \param flags Flags.
138  * \param state App layer state.
139  * \param s Pointer to the Signature.
140  * \param m Pointer to the sigmatch that we will cast into
141  * DetectTlsValidityData.
142  *
143  * \retval 0 no match.
144  * \retval 1 match.
145  */
146 static int DetectTlsValidityMatch (DetectEngineThreadCtx *det_ctx,
147  Flow *f, uint8_t flags, void *state,
148  void *txv, const Signature *s,
149  const SigMatchCtx *ctx)
150 {
151  SCEnter();
152 
153  SSLState *ssl_state = (SSLState *)state;
154  if (ssl_state == NULL) {
155  SCLogDebug("no tls state, no match");
156  SCReturnInt(0);
157  }
158 
159  int ret = 0;
160 
161  SSLStateConnp *connp = NULL;
162  if (flags & STREAM_TOSERVER)
163  connp = &ssl_state->client_connp;
164  else
165  connp = &ssl_state->server_connp;
166 
167  const DetectTlsValidityData *dd = (const DetectTlsValidityData *)ctx;
168 
169  time_t cert_epoch = 0;
170  if (dd->type == DETECT_TLS_TYPE_NOTBEFORE)
171  cert_epoch = connp->cert0_not_before;
172  else if (dd->type == DETECT_TLS_TYPE_NOTAFTER)
173  cert_epoch = connp->cert0_not_after;
174 
175  if (cert_epoch == 0)
176  SCReturnInt(0);
177 
178  if ((dd->mode & DETECT_TLS_VALIDITY_EQ) && cert_epoch == dd->epoch)
179  ret = 1;
180  else if ((dd->mode & DETECT_TLS_VALIDITY_LT) && cert_epoch <= dd->epoch)
181  ret = 1;
182  else if ((dd->mode & DETECT_TLS_VALIDITY_GT) && cert_epoch >= dd->epoch)
183  ret = 1;
184  else if ((dd->mode & DETECT_TLS_VALIDITY_RA) &&
185  cert_epoch >= dd->epoch && cert_epoch <= dd->epoch2)
186  ret = 1;
187  else if ((dd->mode & DETECT_TLS_VALIDITY_EX) && (time_t)SCTIME_SECS(f->lastts) > cert_epoch)
188  ret = 1;
189  else if ((dd->mode & DETECT_TLS_VALIDITY_VA) && (time_t)SCTIME_SECS(f->lastts) <= cert_epoch)
190  ret = 1;
191 
192  SCReturnInt(ret);
193 }
194 
195 /**
196  * \internal
197  * \brief Function to check if string is epoch.
198  *
199  * \param string Date string.
200  *
201  * \retval epoch time on success.
202  * \retval LONG_MIN on failure.
203  */
204 static time_t StringIsEpoch (char *string)
205 {
206  if (strlen(string) == 0)
207  return LONG_MIN;
208 
209  /* We assume that the date string is epoch if it consists of only
210  digits. */
211  char *sp = string;
212  while (*sp) {
213  if (isdigit(*sp++) == 0)
214  return LONG_MIN;
215  }
216 
217  return strtol(string, NULL, 10);
218 }
219 
220 #define MAX_DATE_LEN 20
221 
222 /**
223  * \internal
224  * \brief Function to convert date string to epoch.
225  *
226  * \param string Date string.
227  *
228  * \retval epoch on success.
229  * \retval 0 on failure.
230  */
231 static time_t DateStringToEpoch (char *string)
232 {
233  int r = 0;
234  struct tm tm;
235  const char *patterns[] = {
236  /* ISO 8601 */
237  "%Y-%m",
238  "%Y-%m-%d",
239  "%Y-%m-%d %H",
240  "%Y-%m-%d %H:%M",
241  "%Y-%m-%d %H:%M:%S",
242  "%Y-%m-%dT%H",
243  "%Y-%m-%dT%H:%M",
244  "%Y-%m-%dT%H:%M:%S",
245  "%H:%M",
246  "%H:%M:%S",
247  };
248 
249  /* Skip leading whitespace. */
250  while (isspace(*string))
251  string++;
252 
253  time_t epoch = StringIsEpoch(string);
254  if (epoch != LONG_MIN) {
255  return epoch;
256  }
257 
258  r = SCStringPatternToTime(string, patterns, 10, &tm);
259 
260  if (r != 0)
261  return LONG_MIN;
262 
263  return SCMkTimeUtc(&tm);
264 }
265 
266 /**
267  * \internal
268  * \brief Function to parse options passed via tls validity keywords.
269  *
270  * \param rawstr Pointer to the user provided options.
271  *
272  * \retval dd pointer to DetectTlsValidityData on success.
273  * \retval NULL on failure.
274  */
275 static DetectTlsValidityData *DetectTlsValidityParse (const char *rawstr)
276 {
277  DetectTlsValidityData *dd = NULL;
278  char mode[2] = "";
279  char value1[MAX_DATE_LEN] = "";
280  char value2[MAX_DATE_LEN] = "";
281  char range[3] = "";
282 
283  pcre2_match_data *match = NULL;
284  int ret = DetectParsePcreExec(&parse_regex, &match, rawstr, 0, 0);
285  if (ret < 3 || ret > 5) {
286  SCLogError("Parse error %s", rawstr);
287  goto error;
288  }
289 
290  size_t pcre2len = sizeof(mode);
291  int res = SC_Pcre2SubstringCopy(match, 1, (PCRE2_UCHAR8 *)mode, &pcre2len);
292  if (res < 0) {
293  SCLogError("pcre2_substring_copy_bynumber failed");
294  goto error;
295  }
296  SCLogDebug("mode \"%s\"", mode);
297 
298  pcre2len = sizeof(value1);
299  res = pcre2_substring_copy_bynumber(match, 2, (PCRE2_UCHAR8 *)value1, &pcre2len);
300  if (res < 0) {
301  SCLogError("pcre2_substring_copy_bynumber failed");
302  goto error;
303  }
304  SCLogDebug("value1 \"%s\"", value1);
305 
306  if (ret > 3) {
307  pcre2len = sizeof(range);
308  res = pcre2_substring_copy_bynumber(match, 3, (PCRE2_UCHAR8 *)range, &pcre2len);
309  if (res < 0) {
310  SCLogError("pcre2_substring_copy_bynumber failed");
311  goto error;
312  }
313  SCLogDebug("range \"%s\"", range);
314 
315  if (ret > 4) {
316  pcre2len = sizeof(value2);
317  res = pcre2_substring_copy_bynumber(match, 4, (PCRE2_UCHAR8 *)value2, &pcre2len);
318  if (res < 0) {
319  SCLogError("pcre2_substring_copy_bynumber failed");
320  goto error;
321  }
322  SCLogDebug("value2 \"%s\"", value2);
323  }
324  }
325 
326  dd = SCMalloc(sizeof(DetectTlsValidityData));
327  if (unlikely(dd == NULL))
328  goto error;
329 
330  dd->epoch = 0;
331  dd->epoch2 = 0;
332  dd->mode = 0;
333 
334  if (strlen(mode) > 0) {
335  if (mode[0] == '<')
337  else if (mode[0] == '>')
339  }
340 
341  if (strlen(range) > 0) {
342  if (strcmp("<>", range) == 0)
344  }
345 
346  if (strlen(range) != 0 && strlen(mode) != 0) {
347  SCLogError("Range specified but mode also set");
348  goto error;
349  }
350 
351  if (dd->mode == 0) {
353  }
354 
355  /* set the first value */
356  dd->epoch = DateStringToEpoch(value1);
357  if (dd->epoch == LONG_MIN)
358  goto error;
359 
360  /* set the second value if specified */
361  if (strlen(value2) > 0) {
362  if (!(dd->mode & DETECT_TLS_VALIDITY_RA)) {
363  SCLogError("Multiple tls validity values specified but mode is not range");
364  goto error;
365  }
366 
367  dd->epoch2 = DateStringToEpoch(value2);
368  if (dd->epoch2 == LONG_MIN)
369  goto error;
370 
371  if (dd->epoch2 <= dd->epoch) {
372  SCLogError("Second value in range must not be smaller than the first");
373  goto error;
374  }
375  }
376  pcre2_match_data_free(match);
377  return dd;
378 
379 error:
380  if (match) {
381  pcre2_match_data_free(match);
382  }
383  if (dd)
384  SCFree(dd);
385  return NULL;
386 }
387 
388 /**
389  * \brief Function to add the parsed tls_cert_expired into the current signature.
390  *
391  * \param de_ctx Pointer to the Detection Engine Context.
392  * \param s Pointer to the Current Signature.
393  * \param rawstr Pointer to the user provided flags options.
394  *
395  * \retval 0 on Success.
396  * \retval -1 on Failure.
397  */
398 static int DetectTlsExpiredSetup (DetectEngineCtx *de_ctx, Signature *s,
399  const char *rawstr)
400 {
401  DetectTlsValidityData *dd = NULL;
402 
403  SCLogDebug("\'%s\'", rawstr);
404 
406  return -1;
407 
408  dd = SCCalloc(1, sizeof(DetectTlsValidityData));
409  if (dd == NULL) {
410  SCLogError("Allocation \'%s\' failed", rawstr);
411  goto error;
412  }
413 
414  /* okay so far so good, lets get this into a SigMatch
415  * and put it in the Signature. */
416 
419  dd->epoch = 0;
420  dd->epoch2 = 0;
421 
423  g_tls_validity_buffer_id) == NULL) {
424  goto error;
425  }
426  return 0;
427 
428 error:
429  DetectTlsValidityFree(de_ctx, dd);
430  return -1;
431 }
432 
433 /**
434  * \brief Function to add the parsed tls_cert_valid into the current signature.
435  *
436  * \param de_ctx Pointer to the Detection Engine Context.
437  * \param s Pointer to the Current Signature.
438  * \param rawstr Pointer to the user provided flags options.
439  *
440  * \retval 0 on Success.
441  * \retval -1 on Failure.
442  */
443 static int DetectTlsValidSetup (DetectEngineCtx *de_ctx, Signature *s,
444  const char *rawstr)
445 {
446  DetectTlsValidityData *dd = NULL;
447 
448  SCLogDebug("\'%s\'", rawstr);
449 
451  return -1;
452 
453  dd = SCCalloc(1, sizeof(DetectTlsValidityData));
454  if (dd == NULL) {
455  SCLogError("Allocation \'%s\' failed", rawstr);
456  goto error;
457  }
458 
459  /* okay so far so good, lets get this into a SigMatch
460  * and put it in the Signature. */
461 
464  dd->epoch = 0;
465  dd->epoch2 = 0;
466 
468  de_ctx, s, DETECT_TLS_VALID, (SigMatchCtx *)dd, g_tls_validity_buffer_id) == NULL) {
469  goto error;
470  }
471  return 0;
472 
473 error:
474  DetectTlsValidityFree(de_ctx, dd);
475  return -1;
476 }
477 
478 /**
479  * \brief Function to add the parsed tls_notbefore into the current signature.
480  *
481  * \param de_ctx Pointer to the Detection Engine Context.
482  * \param s Pointer to the Current Signature.
483  * \param rawstr Pointer to the user provided flags options.
484  *
485  * \retval 0 on Success.
486  * \retval -1 on Failure.
487  */
488 static int DetectTlsNotBeforeSetup (DetectEngineCtx *de_ctx, Signature *s,
489  const char *rawstr)
490 {
492  int r = DetectTlsValiditySetup(de_ctx, s, rawstr, type);
493 
494  SCReturnInt(r);
495 }
496 
497 /**
498  * \brief Function to add the parsed tls_notafter into the current signature.
499  *
500  * \param de_ctx Pointer to the Detection Engine Context.
501  * \param s Pointer to the Current Signature.
502  * \param rawstr Pointer to the user provided flags options.
503  *
504  * \retval 0 on Success.
505  * \retval -1 on Failure.
506  */
507 static int DetectTlsNotAfterSetup (DetectEngineCtx *de_ctx, Signature *s,
508  const char *rawstr)
509 {
510  uint8_t type = DETECT_TLS_TYPE_NOTAFTER;
511  int r = DetectTlsValiditySetup(de_ctx, s, rawstr, type);
512 
513  SCReturnInt(r);
514 }
515 
516 /**
517  * \brief Function to add the parsed tls validity field into the current signature.
518  *
519  * \param de_ctx Pointer to the Detection Engine Context.
520  * \param s Pointer to the Current Signature.
521  * \param rawstr Pointer to the user provided flags options.
522  * \param type Defines if this is notBefore or notAfter.
523  *
524  * \retval 0 on Success.
525  * \retval -1 on Failure.
526  */
527 static int DetectTlsValiditySetup (DetectEngineCtx *de_ctx, Signature *s,
528  const char *rawstr, uint8_t type)
529 {
530  DetectTlsValidityData *dd = NULL;
531 
532  SCLogDebug("\'%s\'", rawstr);
533 
535  return -1;
536 
537  dd = DetectTlsValidityParse(rawstr);
538  if (dd == NULL) {
539  SCLogError("Parsing \'%s\' failed", rawstr);
540  goto error;
541  }
542 
543  /* okay so far so good, lets get this into a SigMatch
544  * and put it in the Signature. */
545 
548  }
549  else if (type == DETECT_TLS_TYPE_NOTAFTER) {
551  }
552  else {
553  goto error;
554  }
555 
557  g_tls_validity_buffer_id) == NULL) {
558  goto error;
559  }
560  return 0;
561 
562 error:
563  DetectTlsValidityFree(de_ctx, dd);
564  return -1;
565 }
566 
567 /**
568  * \internal
569  * \brief Function to free memory associated with DetectTlsValidityData.
570  *
571  * \param de_ptr Pointer to DetectTlsValidityData.
572  */
573 void DetectTlsValidityFree(DetectEngineCtx *de_ctx, void *de_ptr)
574 {
576  if (dd)
577  SCFree(dd);
578 }
579 
580 #ifdef UNITTESTS
582 #endif
SigTableElmt_::url
const char * url
Definition: detect.h:1461
SSLState_
SSLv[2.0|3.[0|1|2|3]] state structure.
Definition: app-layer-ssl.h:227
detect-content.h
DetectTlsValidityData_::type
uint8_t type
Definition: detect-tls-cert-validity.h:45
detect-engine.h
SigTableElmt_::desc
const char * desc
Definition: detect.h:1460
sigmatch_table
SigTableElmt * sigmatch_table
Definition: detect-parse.c:79
DETECT_TLS_TYPE_NOTAFTER
#define DETECT_TLS_TYPE_NOTAFTER
Definition: detect-tls-cert-validity.h:39
SigTableElmt_::Free
void(* Free)(DetectEngineCtx *, void *)
Definition: detect.h:1445
flow-util.h
DetectParseRegex
Definition: detect-parse.h:93
SigTableElmt_::name
const char * name
Definition: detect.h:1458
stream-tcp.h
detect-tls-cert-validity.h
unlikely
#define unlikely(expr)
Definition: util-optimize.h:35
SSLState_::client_connp
SSLStateConnp client_connp
Definition: app-layer-ssl.h:248
SigTableElmt_::flags
uint32_t flags
Definition: detect.h:1449
ALPROTO_TLS
@ ALPROTO_TLS
Definition: app-layer-protos.h:39
DETECT_TLS_VALIDITY_EQ
#define DETECT_TLS_VALIDITY_EQ
Definition: detect-tls-cert-validity.h:27
SCLogDebug
#define SCLogDebug(...)
Definition: util-debug.h:279
TlsNotBeforeRegisterTests
void TlsNotBeforeRegisterTests(void)
Register unit tests for tls_cert_notbefore.
Definition: detect-tls-cert-validity.c:1354
PARSE_REGEX
#define PARSE_REGEX
Definition: detect-tls-cert-validity.c:54
SSLState_::server_connp
SSLStateConnp server_connp
Definition: app-layer-ssl.h:249
SSLStateConnp_::cert0_not_before
int64_t cert0_not_before
Definition: app-layer-ssl.h:190
SSLStateConnp_
Definition: app-layer-ssl.h:167
TlsNotAfterRegisterTests
void TlsNotAfterRegisterTests(void)
Register unit tests for tls_cert_notafter.
Definition: detect-tls-cert-validity.c:1376
threads.h
Flow_
Flow data structure.
Definition: flow.h:348
ctx
struct Thresholds ctx
DetectEngineCtx_
main detection engine ctx
Definition: detect.h:933
SCMkTimeUtc
time_t SCMkTimeUtc(struct tm *tp)
Convert broken-down time to seconds since Unix epoch.
Definition: util-time.c:442
DETECT_TLS_VALIDITY_RA
#define DETECT_TLS_VALIDITY_RA
Definition: detect-tls-cert-validity.h:30
SigTableElmt_::AppLayerTxMatch
int(* AppLayerTxMatch)(DetectEngineThreadCtx *, Flow *, uint8_t flags, void *alstate, void *txv, const Signature *, const SigMatchCtx *)
Definition: detect.h:1423
DetectTlsValidityRegister
void DetectTlsValidityRegister(void)
Registration function for tls validity keywords.
Definition: detect-tls-cert-validity.c:81
DetectParsePcreExec
int DetectParsePcreExec(DetectParseRegex *parse_regex, pcre2_match_data **match, const char *str, int start_offset, int options)
Definition: detect-parse.c:3501
DETECT_TLS_EXPIRED
@ DETECT_TLS_EXPIRED
Definition: detect-engine-register.h:143
SCDetectSignatureSetAppProto
int SCDetectSignatureSetAppProto(Signature *s, AppProto alproto)
Definition: detect-parse.c:2236
SigTableElmt_::Setup
int(* Setup)(DetectEngineCtx *, Signature *, const char *)
Definition: detect.h:1440
detect-pcre.h
util-unittest.h
util-unittest-helper.h
DetectBufferTypeGetByName
int DetectBufferTypeGetByName(const char *name)
Definition: detect-engine.c:1278
DETECT_TLS_VALID
@ DETECT_TLS_VALID
Definition: detect-engine-register.h:144
SSLStateConnp_::cert0_not_after
int64_t cert0_not_after
Definition: app-layer-ssl.h:191
DETECT_TLS_NOTAFTER
@ DETECT_TLS_NOTAFTER
Definition: detect-engine-register.h:142
decode.h
de_ctx
DetectEngineCtx * de_ctx
Definition: fuzz_siginit.c:18
DetectEngineThreadCtx_
Definition: detect.h:1245
Flow_::lastts
SCTime_t lastts
Definition: flow.h:402
DetectSetupParseRegexes
void DetectSetupParseRegexes(const char *parse_str, DetectParseRegex *detect_parse)
Definition: detect-parse.c:3627
SCEnter
#define SCEnter(...)
Definition: util-debug.h:281
detect-engine-mpm.h
DETECT_TLS_NOTBEFORE
@ DETECT_TLS_NOTBEFORE
Definition: detect-engine-register.h:141
SCSigMatchAppendSMToList
SigMatch * SCSigMatchAppendSMToList(DetectEngineCtx *de_ctx, Signature *s, uint16_t type, SigMatchCtx *ctx, const int list)
Append a SigMatch to the list type.
Definition: detect-parse.c:388
detect.h
DetectTlsValidityData_
Definition: detect-tls-cert-validity.h:41
util-time.h
DetectTlsValidityData_::mode
uint8_t mode
Definition: detect-tls-cert-validity.h:44
type
uint16_t type
Definition: decode-vlan.c:106
detect-tls-cert-validity.c
SigMatchCtx_
Used to start a pointer to SigMatch context Should never be dereferenced without casting to something...
Definition: detect.h:351
flags
uint8_t flags
Definition: decode-gre.h:0
DETECT_TLS_VALIDITY_LT
#define DETECT_TLS_VALIDITY_LT
Definition: detect-tls-cert-validity.h:28
suricata-common.h
DETECT_TLS_VALIDITY_EX
#define DETECT_TLS_VALIDITY_EX
Definition: detect-tls-cert-validity.h:33
SCTIME_SECS
#define SCTIME_SECS(t)
Definition: util-time.h:57
DetectTlsValidityData_::epoch2
time_t epoch2
Definition: detect-tls-cert-validity.h:43
DETECT_TLS_VALIDITY_GT
#define DETECT_TLS_VALIDITY_GT
Definition: detect-tls-cert-validity.h:29
DETECT_TLS_VALIDITY_VA
#define DETECT_TLS_VALIDITY_VA
Definition: detect-tls-cert-validity.h:36
SCMalloc
#define SCMalloc(sz)
Definition: util-mem.h:47
str
#define str(s)
Definition: suricata-common.h:308
SCLogError
#define SCLogError(...)
Macro used to log ERROR messages.
Definition: util-debug.h:271
SCFree
#define SCFree(p)
Definition: util-mem.h:61
TlsValidRegisterTests
void TlsValidRegisterTests(void)
Register unit tests for tls_cert_valid.
Definition: detect-tls-cert-validity.c:1402
DetectTlsValidityData_::epoch
time_t epoch
Definition: detect-tls-cert-validity.h:42
DETECT_TLS_TYPE_NOTBEFORE
#define DETECT_TLS_TYPE_NOTBEFORE
Definition: detect-tls-cert-validity.h:38
detect-parse.h
Signature_
Signature container.
Definition: detect.h:668
SC_Pcre2SubstringCopy
int SC_Pcre2SubstringCopy(pcre2_match_data *match_data, uint32_t number, PCRE2_UCHAR *buffer, PCRE2_SIZE *bufflen)
Definition: detect-parse.c:3603
SIGMATCH_NOOPT
#define SIGMATCH_NOOPT
Definition: detect.h:1650
SCStringPatternToTime
int SCStringPatternToTime(char *string, const char **patterns, int num_patterns, struct tm *tp)
Parse a date string based on specified patterns.
Definition: util-time.c:485
MAX_DATE_LEN
#define MAX_DATE_LEN
Definition: detect-tls-cert-validity.c:220
flow.h
SCCalloc
#define SCCalloc(nm, sz)
Definition: util-mem.h:53
SCReturnInt
#define SCReturnInt(x)
Definition: util-debug.h:285
flow-var.h
app-layer-ssl.h
TlsExpiredRegisterTests
void TlsExpiredRegisterTests(void)
Register unit tests for tls_cert_expired.
Definition: detect-tls-cert-validity.c:1394
SigTableElmt_::RegisterTests
void(* RegisterTests)(void)
Definition: detect.h:1447
app-layer.h