syslog-ng source
test_secure_logging.c File Reference
#include <criterion/criterion.h>
#include "libtest/cr_template.h"
#include "libtest/msg_parse_lib.h"
#include "libtest/stopwatch.h"
#include "slog.h"
#include "apphook.h"
#include "cfg.h"
#include "logmatcher.h"
#include "timeutils/cache.h"
#include <errno.h>
#include <string.h>
#include <unistd.h>
Include dependency graph for test_secure_logging.c:

Classes

struct  TestData
 

Macros

#define MAX_TEST_MESSAGES   1000
 
#define MIN_TEST_MESSAGES   10
 
#define PERFORMANCE_COUNTER   100000
 

Functions

int randomNumber (int low, int high)
 
LogMessage * create_random_sample_message (void)
 
LogTemplate * createTemplate (TestData *testData)
 
void createLogMessages (gint num, LogMessage **log)
 
GString * applyTemplate (LogTemplate *templ, LogMessage *msg)
 
int findInArray (int index, int *buffer, int size)
 
GString ** verifyMaliciousMessages (guchar *hostkey, gchar *macFileName, GString **templateOutput, size_t totalNumberOfMessages, int *brokenEntries)
 
void verifyMessages (guchar *hostkey, gchar *macFileName, GString **templateOutput, LogMessage **original, size_t totalNumberOfMessages)
 
void generateHostKey (guchar *hostkey, gchar *hostKeyFileName)
 
GString * createTemporaryDirectory (gchar *template)
 
GString * createTemporaryFilePath (GString *dirname, gchar *basename)
 
void removeTemporaryFile (gchar *fileName, gboolean force)
 
void removeTemporaryDirectory (gchar *dirName, gboolean force)
 
TestDatainitialize (gchar *name)
 
void closure (TestData *testData)
 
void corruptKey (TestData *testData)
 
void setup (void)
 
void teardown (void)
 
 TestSuite (secure_logging,.init=setup,.fini=teardown)
 
void test_slog_template_format (void)
 
void test_slog_verification (void)
 
void test_slog_verification_bulk (void)
 
void test_slog_corrupted_key (void)
 
void test_slog_malicious_modifications (void)
 
void test_slog_performance (void)
 
 Test (secure_logging, test_slog_template_format)
 
 Test (secure_logging, test_slog_performance)
 
 Test (secure_logging, test_slog_verification_bulk)
 
 Test (secure_logging, test_slog_verification)
 
 Test (secure_logging, test_slog_corrupted_key)
 
 Test (secure_logging, test_slog_malicious_modifications)
 

Macro Definition Documentation

◆ MAX_TEST_MESSAGES

#define MAX_TEST_MESSAGES   1000

◆ MIN_TEST_MESSAGES

#define MIN_TEST_MESSAGES   10

◆ PERFORMANCE_COUNTER

#define PERFORMANCE_COUNTER   100000

Function Documentation

◆ applyTemplate()

GString* applyTemplate ( LogTemplate *  templ,
LogMessage *  msg 
)

◆ closure()

void closure ( TestData testData)

◆ corruptKey()

void corruptKey ( TestData testData)

◆ create_random_sample_message()

LogMessage* create_random_sample_message ( void  )

◆ createLogMessages()

void createLogMessages ( gint  num,
LogMessage **  log 
)

◆ createTemplate()

LogTemplate* createTemplate ( TestData testData)

◆ createTemporaryDirectory()

GString* createTemporaryDirectory ( gchar *  template)

◆ createTemporaryFilePath()

GString* createTemporaryFilePath ( GString *  dirname,
gchar *  basename 
)

◆ findInArray()

int findInArray ( int  index,
int *  buffer,
int  size 
)

◆ generateHostKey()

void generateHostKey ( guchar *  hostkey,
gchar *  hostKeyFileName 
)

◆ initialize()

TestData* initialize ( gchar *  name)

◆ randomNumber()

int randomNumber ( int  low,
int  high 
)

◆ removeTemporaryDirectory()

void removeTemporaryDirectory ( gchar *  dirName,
gboolean  force 
)

◆ removeTemporaryFile()

void removeTemporaryFile ( gchar *  fileName,
gboolean  force 
)

◆ setup()

void setup ( void  )

◆ teardown()

void teardown ( void  )

◆ Test() [1/6]

Test ( secure_logging  ,
test_slog_corrupted_key   
)

◆ Test() [2/6]

Test ( secure_logging  ,
test_slog_malicious_modifications   
)

◆ Test() [3/6]

Test ( secure_logging  ,
test_slog_performance   
)

◆ Test() [4/6]

Test ( secure_logging  ,
test_slog_template_format   
)

◆ Test() [5/6]

Test ( secure_logging  ,
test_slog_verification   
)

◆ Test() [6/6]

Test ( secure_logging  ,
test_slog_verification_bulk   
)

◆ test_slog_corrupted_key()

void test_slog_corrupted_key ( void  )

◆ test_slog_malicious_modifications()

void test_slog_malicious_modifications ( void  )

◆ test_slog_performance()

void test_slog_performance ( void  )

◆ test_slog_template_format()

void test_slog_template_format ( void  )

◆ test_slog_verification()

void test_slog_verification ( void  )

◆ test_slog_verification_bulk()

void test_slog_verification_bulk ( void  )

◆ TestSuite()

TestSuite ( secure_logging  ,
init = setup,
fini = teardown 
)

◆ verifyMaliciousMessages()

GString** verifyMaliciousMessages ( guchar *  hostkey,
gchar *  macFileName,
GString **  templateOutput,
size_t  totalNumberOfMessages,
int *  brokenEntries 
)

◆ verifyMessages()

void verifyMessages ( guchar *  hostkey,
gchar *  macFileName,
GString **  templateOutput,
LogMessage **  original,
size_t  totalNumberOfMessages 
)