RetroArch
Macros | Functions | Variables
md5.c File Reference
#include "mbedtls/config.h"
#include "mbedtls/md5.h"
#include <string.h>
#include "mbedtls/platform.h"
#include "arc4_alt.h"
Include dependency graph for md5.c:

Macros

#define GET_UINT32_LE(n, b, i)
 
#define PUT_UINT32_LE(n, b, i)
 
#define S(x, n)   ((x << n) | ((x & 0xFFFFFFFF) >> (32 - n)))
 
#define P(a, b, c, d, k, s, t)
 
#define F(x, y, z)   (z ^ (x & (y ^ z)))
 
#define F(x, y, z)   (y ^ (z & (x ^ y)))
 
#define F(x, y, z)   (x ^ y ^ z)
 
#define F(x, y, z)   (y ^ (x | ~z))
 

Functions

void mbedtls_md5_init (mbedtls_md5_context *ctx)
 Initialize MD5 context. More...
 
void mbedtls_md5_free (mbedtls_md5_context *ctx)
 Clear MD5 context. More...
 
void mbedtls_md5_clone (mbedtls_md5_context *dst, const mbedtls_md5_context *src)
 Clone (the state of) an MD5 context. More...
 
void mbedtls_md5_starts (mbedtls_md5_context *ctx)
 MD5 context setup. More...
 
void mbedtls_md5_process (mbedtls_md5_context *ctx, const unsigned char data[64])
 
void mbedtls_md5_update (mbedtls_md5_context *ctx, const unsigned char *input, size_t ilen)
 MD5 process buffer. More...
 
void mbedtls_md5_finish (mbedtls_md5_context *ctx, unsigned char output[16])
 MD5 final digest. More...
 
void mbedtls_md5 (const unsigned char *input, size_t ilen, unsigned char output[16])
 Output = MD5( input buffer ) More...
 
int mbedtls_md5_self_test (int verbose)
 Checkup routine. More...
 

Variables

static const unsigned char md5_padding [64]
 
static const unsigned char md5_test_buf [7][81]
 
static const int md5_test_buflen [7]
 
static const unsigned char md5_test_sum [7][16]
 

Macro Definition Documentation

◆ F [1/4]

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

◆ F [2/4]

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

◆ F [3/4]

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

◆ F [4/4]

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

◆ GET_UINT32_LE

#define GET_UINT32_LE (   n,
  b,
 
)
Value:
{ \
(n) = ( (uint32_t) (b)[(i) ] ) \
| ( (uint32_t) (b)[(i) + 1] << 8 ) \
| ( (uint32_t) (b)[(i) + 2] << 16 ) \
| ( (uint32_t) (b)[(i) + 3] << 24 ); \
}
GLboolean GLboolean GLboolean b
Definition: glext.h:6844
GLdouble n
Definition: glext.h:8396
unsigned int uint32_t
Definition: stdint.h:126

◆ P

#define P (   a,
  b,
  c,
  d,
  k,
  s,
  t 
)
Value:
{ \
a += F(b,c,d) + X[k] + t; a = S(a,s) + b; \
}
#define S(x, n)
GLdouble GLdouble t
Definition: glext.h:6398
GLdouble s
Definition: glext.h:6390
const GLubyte * c
Definition: glext.h:9812
GLboolean GLboolean GLboolean b
Definition: glext.h:6844
#define X(a, b)
Definition: bba.c:185
#define F(x, y, z)
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6844

◆ PUT_UINT32_LE

#define PUT_UINT32_LE (   n,
  b,
 
)
Value:
{ \
(b)[(i) ] = (unsigned char) ( ( (n) ) & 0xFF ); \
(b)[(i) + 1] = (unsigned char) ( ( (n) >> 8 ) & 0xFF ); \
(b)[(i) + 2] = (unsigned char) ( ( (n) >> 16 ) & 0xFF ); \
(b)[(i) + 3] = (unsigned char) ( ( (n) >> 24 ) & 0xFF ); \
}
GLboolean GLboolean GLboolean b
Definition: glext.h:6844
GLdouble n
Definition: glext.h:8396

◆ S

#define S (   x,
  n 
)    ((x << n) | ((x & 0xFFFFFFFF) >> (32 - n)))

Function Documentation

◆ mbedtls_md5()

void mbedtls_md5 ( const unsigned char *  input,
size_t  ilen,
unsigned char  output[16] 
)

Output = MD5( input buffer )

Parameters
inputbuffer holding the data
ilenlength of the input data
outputMD5 checksum result
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mbedtls_md5_clone()

void mbedtls_md5_clone ( mbedtls_md5_context dst,
const mbedtls_md5_context src 
)

Clone (the state of) an MD5 context.

Parameters
dstThe destination context
srcThe context to be cloned
Here is the caller graph for this function:

◆ mbedtls_md5_finish()

void mbedtls_md5_finish ( mbedtls_md5_context ctx,
unsigned char  output[16] 
)

MD5 final digest.

Parameters
ctxMD5 context
outputMD5 checksum result
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mbedtls_md5_free()

void mbedtls_md5_free ( mbedtls_md5_context ctx)

Clear MD5 context.

Parameters
ctxMD5 context to be cleared
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mbedtls_md5_init()

void mbedtls_md5_init ( mbedtls_md5_context ctx)

Initialize MD5 context.

Parameters
ctxMD5 context to be initialized
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mbedtls_md5_process()

void mbedtls_md5_process ( mbedtls_md5_context ctx,
const unsigned char  data[64] 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mbedtls_md5_self_test()

int mbedtls_md5_self_test ( int  verbose)

Checkup routine.

Returns
0 if successful, or 1 if the test failed
Here is the call graph for this function:

◆ mbedtls_md5_starts()

void mbedtls_md5_starts ( mbedtls_md5_context ctx)

MD5 context setup.

Parameters
ctxcontext to be initialized
Here is the caller graph for this function:

◆ mbedtls_md5_update()

void mbedtls_md5_update ( mbedtls_md5_context ctx,
const unsigned char *  input,
size_t  ilen 
)

MD5 process buffer.

Parameters
ctxMD5 context
inputbuffer holding the data
ilenlength of the input data
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ md5_padding

const unsigned char md5_padding[64]
static
Initial value:
=
{
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
}

◆ md5_test_buf

const unsigned char md5_test_buf[7][81]
static
Initial value:
=
{
{ "" },
{ "a" },
{ "abc" },
{ "message digest" },
{ "abcdefghijklmnopqrstuvwxyz" },
{ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" },
{ "12345678901234567890123456789012345678901234567890123456789012"
"345678901234567890" }
}

◆ md5_test_buflen

const int md5_test_buflen[7]
static
Initial value:
=
{
0, 1, 3, 14, 26, 62, 80
}

◆ md5_test_sum

const unsigned char md5_test_sum[7][16]
static
Initial value:
=
{
{ 0xD4, 0x1D, 0x8C, 0xD9, 0x8F, 0x00, 0xB2, 0x04,
0xE9, 0x80, 0x09, 0x98, 0xEC, 0xF8, 0x42, 0x7E },
{ 0x0C, 0xC1, 0x75, 0xB9, 0xC0, 0xF1, 0xB6, 0xA8,
0x31, 0xC3, 0x99, 0xE2, 0x69, 0x77, 0x26, 0x61 },
{ 0x90, 0x01, 0x50, 0x98, 0x3C, 0xD2, 0x4F, 0xB0,
0xD6, 0x96, 0x3F, 0x7D, 0x28, 0xE1, 0x7F, 0x72 },
{ 0xF9, 0x6B, 0x69, 0x7D, 0x7C, 0xB7, 0x93, 0x8D,
0x52, 0x5A, 0x2F, 0x31, 0xAA, 0xF1, 0x61, 0xD0 },
{ 0xC3, 0xFC, 0xD3, 0xD7, 0x61, 0x92, 0xE4, 0x00,
0x7D, 0xFB, 0x49, 0x6C, 0xCA, 0x67, 0xE1, 0x3B },
{ 0xD1, 0x74, 0xAB, 0x98, 0xD2, 0x77, 0xD9, 0xF5,
0xA5, 0x61, 0x1C, 0x2C, 0x9F, 0x41, 0x9D, 0x9F },
{ 0x57, 0xED, 0xF4, 0xA2, 0x2B, 0xE3, 0xC9, 0x55,
0xAC, 0x49, 0xDA, 0x2E, 0x21, 0x07, 0xB6, 0x7A }
}