suricata
util-crypt.c File Reference
#include "suricata-common.h"
#include "suricata.h"
#include "util-crypt.h"
Include dependency graph for util-crypt.c:

Go to the source code of this file.

Macros

#define F0(x, y, z)   (z ^ (x & (y ^ z)))
 
#define F1(x, y, z)   (x ^ y ^ z)
 
#define F2(x, y, z)   ((x & y) | (z & (x | y)))
 
#define F3(x, y, z)   (x ^ y ^ z)
 
#define FF0(a, b, c, d, e, i)   e = (ROLc(a, 5) + F0(b,c,d) + e + W[i] + 0x5a827999UL); b = ROLc(b, 30);
 
#define FF1(a, b, c, d, e, i)   e = (ROLc(a, 5) + F1(b,c,d) + e + W[i] + 0x6ed9eba1UL); b = ROLc(b, 30);
 
#define FF2(a, b, c, d, e, i)   e = (ROLc(a, 5) + F2(b,c,d) + e + W[i] + 0x8f1bbcdcUL); b = ROLc(b, 30);
 
#define FF3(a, b, c, d, e, i)   e = (ROLc(a, 5) + F3(b,c,d) + e + W[i] + 0xca62c1d6UL); b = ROLc(b, 30);
 

Functions

int ComputeSHA1 (const uint8_t *inbuf, size_t inbuf_len, uint8_t *outbuf, size_t outbuf_size)
 calculate SHA1 hash More...
 
int Base64Encode (const unsigned char *in, unsigned long inlen, unsigned char *out, unsigned long *outlen)
 

Detailed Description

Author
Roliers Jean-Paul popof.nosp@m..fpn.nosp@m.@gmai.nosp@m.l.co

Implements cryptographic functions. Based on the libtomcrypt library ( http://libtom.org/?page=features&newsitems=5&whatfile=crypt )

Implementation of function using NSS is not linked with libtomcrypt.

Definition in file util-crypt.c.

Macro Definition Documentation

#define F0 (   x,
  y,
 
)    (z ^ (x & (y ^ z)))

Definition at line 38 of file util-crypt.c.

#define F1 (   x,
  y,
 
)    (x ^ y ^ z)

Definition at line 39 of file util-crypt.c.

#define F2 (   x,
  y,
 
)    ((x & y) | (z & (x | y)))

Definition at line 40 of file util-crypt.c.

#define F3 (   x,
  y,
 
)    (x ^ y ^ z)

Definition at line 41 of file util-crypt.c.

#define FF0 (   a,
  b,
  c,
  d,
  e,
 
)    e = (ROLc(a, 5) + F0(b,c,d) + e + W[i] + 0x5a827999UL); b = ROLc(b, 30);
#define FF1 (   a,
  b,
  c,
  d,
  e,
 
)    e = (ROLc(a, 5) + F1(b,c,d) + e + W[i] + 0x6ed9eba1UL); b = ROLc(b, 30);
#define FF2 (   a,
  b,
  c,
  d,
  e,
 
)    e = (ROLc(a, 5) + F2(b,c,d) + e + W[i] + 0x8f1bbcdcUL); b = ROLc(b, 30);
#define FF3 (   a,
  b,
  c,
  d,
  e,
 
)    e = (ROLc(a, 5) + F3(b,c,d) + e + W[i] + 0xca62c1d6UL); b = ROLc(b, 30);

Function Documentation

int Base64Encode ( const unsigned char *  in,
unsigned long  inlen,
unsigned char *  out,
unsigned long *  outlen 
)

Definition at line 272 of file util-crypt.c.

References SC_BASE64_INVALID_ARG, SC_BASE64_OK, and SC_BASE64_OVERFLOW.

Referenced by AlertJsonHeader(), JsonFiveTuple(), JsonHttpLogJSONBodyPrintable(), JsonPacket(), OutputJsonDNP3SetItem(), and StringAsBase64().

Here is the caller graph for this function:

int ComputeSHA1 ( const uint8_t *  inbuf,
size_t  inbuf_len,
uint8_t *  outbuf,
size_t  outbuf_size 
)

calculate SHA1 hash

Return values
int1 for success, 0 for fail

Definition at line 230 of file util-crypt.c.

References ComputeSHA1(), rlen, and unlikely.

Referenced by ComputeSHA1(), JsonFiveTuple(), and SSLVersionToString().

Here is the call graph for this function:

Here is the caller graph for this function: