58static void DetectTlsSerialRegisterTests(
void);
62 Flow *f,
const uint8_t flow_flags,
63 void *txv,
const int list_id);
66static bool DetectTlsSerialValidateCallback(
68static int g_tls_cert_serial_buffer_id = 0;
78 "sticky buffer to match the TLS cert serial buffer";
100 "TLS certificate serial number");
103 DetectTlsSerialSetupCallback);
106 DetectTlsSerialValidateCallback);
134 const uint8_t flow_flags,
void *txv,
const int list_id)
141 if (flow_flags & STREAM_TOSERVER) {
142 connp = &ssl_state->client_connp;
144 connp = &ssl_state->server_connp;
151 const uint32_t data_len = (uint32_t)strlen(connp->
cert0_serial);
155 det_ctx, list_id, buffer, data, data_len, transforms);
161static bool DetectTlsSerialValidateCallback(
168 for (; sm != NULL; sm = sm->
next) {
175 *sigerror =
"tls.cert_serial should not be used together "
176 "with nocase, since the rule is automatically "
177 "uppercased anyway which makes nocase redundant.";
182 if (cd->content_len <= 2)
186 for (u = 0; u < cd->content_len; u++)
187 if (cd->content[u] ==
':')
190 *sigerror =
"No colon delimiters ':' detected in content after "
191 "tls.cert_serial. This rule will therefore never "
208 for (; sm != NULL; sm = sm->
next) {
214 bool changed =
false;
216 for (u = 0; u < cd->content_len; u++) {
217 if (islower(cd->content[u])) {
@ TLS_STATE_CLIENT_CERT_DONE
@ TLS_STATE_SERVER_CERT_DONE
#define DETECT_CONTENT_NOCASE
int SCDetectBufferSetActiveList(DetectEngineCtx *de_ctx, Signature *s, const int list)
void InspectionBufferSetupAndApplyTransforms(DetectEngineThreadCtx *det_ctx, const int list_id, InspectionBuffer *buffer, const uint8_t *data, const uint32_t data_len, const DetectEngineTransforms *transforms)
setup the buffer with our initial data
InspectionBuffer * InspectionBufferGet(DetectEngineThreadCtx *det_ctx, const int list_id)
void DetectAppLayerMpmRegister(const char *name, int direction, int priority, PrefilterRegisterFunc PrefilterRegister, InspectionBufferGetDataPtr GetData, AppProto alproto, int tx_min_progress)
register an app layer keyword for mpm
int PrefilterGenericMpmRegister(DetectEngineCtx *de_ctx, SigGroupHead *sgh, MpmCtx *mpm_ctx, const DetectBufferMpmRegistry *mpm_reg, int list_id)
void DetectBufferTypeSetDescriptionByName(const char *name, const char *desc)
void DetectBufferTypeRegisterSetupCallback(const char *name, void(*SetupCallback)(const DetectEngineCtx *, Signature *))
uint8_t DetectEngineInspectBufferGeneric(DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx, const DetectEngineAppInspectionEngine *engine, const Signature *s, Flow *f, uint8_t flags, void *alstate, void *txv, uint64_t tx_id)
Do the content inspection & validation for a signature.
void DetectAppLayerInspectEngineRegister(const char *name, AppProto alproto, uint32_t dir, int progress, InspectEngineFuncPtr Callback, InspectionBufferGetDataPtr GetData)
Registers an app inspection engine.
void DetectBufferTypeRegisterValidateCallback(const char *name, bool(*ValidateCallback)(const Signature *, const char **sigerror, const DetectBufferType *))
int DetectBufferTypeGetByName(const char *name)
int SCDetectSignatureSetAppProto(Signature *s, AppProto alproto)
SigTableElmt * sigmatch_table
void DetectTlsSerialRegister(void)
Registration function for keyword: tls.cert_serial.
#define SIG_FLAG_TOCLIENT
#define SIGMATCH_INFO_STICKY_BUFFER
#define SIG_FLAG_TOSERVER
main detection engine ctx
SpmGlobalThreadCtx * spm_global_thread_ctx
SSLv[2.0|3.[0|1|2|3]] state structure.
a single match condition for a signature
int(* Setup)(DetectEngineCtx *, Signature *, const char *)
void(* RegisterTests)(void)
SignatureInitDataBuffer * buffers
SignatureInitData * init_data
#define SCLogWarning(...)
Macro used to log WARNING messages.
SpmCtx * SpmInitCtx(const uint8_t *needle, uint16_t needle_len, int nocase, SpmGlobalThreadCtx *global_thread_ctx)
void SpmDestroyCtx(SpmCtx *ctx)