EDGESEC  0.1.0-alpha.0+sha.ca29a8277b72f80785649ea9ef9cd7edf642d939
Secure router - reference implementation
Macros | Typedefs | Functions
md5_internal.c File Reference

MD5 hash implementation and interface functions. More...

#include <stdint.h>
#include <sys/types.h>
#include <unistd.h>
#include "utils/allocs.h"
#include "utils/os.h"
#include "md5_internal.h"
Include dependency graph for md5_internal.c:

Macros

#define byteReverse(buf, len)   /* Nothing */
 
#define F1(x, y, z)   (z ^ (x & (y ^ z)))
 
#define F2(x, y, z)   F1(z, x, y)
 
#define F3(x, y, z)   (x ^ y ^ z)
 
#define F4(x, y, z)   (y ^ (x | ~z))
 
#define MD5STEP(f, w, x, y, z, data, s)    (w += f(x, y, z) + data, w = w << s | w >> (32 - s), w += x)
 

Typedefs

typedef struct MD5Context MD5_CTX
 

Functions

int edge_md5_vector (size_t num_elem, const uint8_t *addr[], const size_t *len, uint8_t *mac)
 

Detailed Description

MD5 hash implementation and interface functions.

Author
Jouni Malinen

Macro Definition Documentation

◆ byteReverse

#define byteReverse (   buf,
  len 
)    /* Nothing */

◆ F1

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

◆ F2

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

◆ F3

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

◆ F4

#define F4 (   x,
  y,
 
)    (y ^ (x | ~z))

◆ MD5STEP

#define MD5STEP (   f,
  w,
  x,
  y,
  z,
  data,
 
)     (w += f(x, y, z) + data, w = w << s | w >> (32 - s), w += x)

Typedef Documentation

◆ MD5_CTX

typedef struct MD5Context MD5_CTX

Function Documentation

◆ edge_md5_vector()

int edge_md5_vector ( size_t  num_elem,
const uint8_t *  addr[],
const size_t *  len,
uint8_t *  mac 
)

MD5 hash for data vector

Parameters
num_elemNumber of elements in the data vector
addrPointers to the data areas
lenLengths of the data blocks
[out]macBuffer for the hash
Return values
0on success
-1on failure
Author
Jouni Malinen j@w1..nosp@m.fi
Date
2009
Remarks
The source of this code was adapted from md5_internal() in commit 0a5d68aba50c385e316a30d834d5b6174a4041d2 in src/crypto/md5-internal.c of the hostap project, see https://w1.fi/cgit/hostap/tree/src/crypto/md5-internal.c?id=0a5d68aba50c385e316a30d834d5b6174a4041d2#n34