suricata
util-base64.h File Reference
#include "suricata-common.h"
Include dependency graph for util-base64.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define ASCII_BLOCK   3
 
#define B64_BLOCK   4
 

Enumerations

enum  Base64Mode { BASE64_MODE_RELAX, BASE64_MODE_RFC2045, BASE64_MODE_STRICT, BASE64_MODE_RFC4648 }
 
enum  Base64Ecode { BASE64_ECODE_ERR = -1, BASE64_ECODE_OK = 0, BASE64_ECODE_BUF }
 

Functions

Base64Ecode DecodeBase64 (uint8_t *dest, uint32_t dest_size, const uint8_t *src, uint32_t len, uint32_t *consumed_bytes, uint32_t *decoded_bytes, Base64Mode mode)
 Decodes a base64-encoded string buffer into an ascii-encoded byte buffer. More...
 
void Base64RegisterTests (void)
 

Detailed Description

Macro Definition Documentation

◆ ASCII_BLOCK

#define ASCII_BLOCK   3

Definition at line 32 of file util-base64.h.

◆ B64_BLOCK

#define B64_BLOCK   4

Definition at line 33 of file util-base64.h.

Enumeration Type Documentation

◆ Base64Ecode

Enumerator
BASE64_ECODE_ERR 
BASE64_ECODE_OK 
BASE64_ECODE_BUF 

Definition at line 72 of file util-base64.h.

◆ Base64Mode

enum Base64Mode
Enumerator
BASE64_MODE_RELAX 
BASE64_MODE_RFC2045 
BASE64_MODE_STRICT 
BASE64_MODE_RFC4648 

Definition at line 34 of file util-base64.h.

Function Documentation

◆ Base64RegisterTests()

void Base64RegisterTests ( void  )

Definition at line 363 of file util-base64.c.

References UtRegisterTest().

Here is the call graph for this function:

◆ DecodeBase64()

Base64Ecode DecodeBase64 ( uint8_t *  dest,
uint32_t  dest_size,
const uint8_t *  src,
uint32_t  len,
uint32_t *  consumed_bytes,
uint32_t *  decoded_bytes,
Base64Mode  mode 
)

Decodes a base64-encoded string buffer into an ascii-encoded byte buffer.

Parameters
destThe destination byte buffer
dest_sizeThe destination byte buffer size
srcThe source string
lenThe length of the source string
consumed_bytesThe bytes that were actually processed/consumed
decoded_bytesThe bytes that were decoded
modeThe mode in which decoding should happen
Returns
Error code indicating success or failures with parsing

Definition at line 94 of file util-base64.c.

References B64_BLOCK, BASE64_ECODE_OK, len, and padding.

Referenced by DetectBase64DecodeDoMatch().

Here is the caller graph for this function: