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

Macros

#define GET_UINT32_BE(n, b, i)
 
#define PUT_UINT32_BE(n, b, i)
 
#define S(x, n)   ((x << n) | ((x & 0xFFFFFFFF) >> (32 - n)))
 
#define R(t)
 
#define P(a, b, c, d, e, x)
 
#define F(x, y, z)   (z ^ (x & (y ^ z)))
 
#define K   0x5A827999
 
#define F(x, y, z)   (x ^ y ^ z)
 
#define K   0x6ED9EBA1
 
#define F(x, y, z)   ((x & y) | (z & (x | y)))
 
#define K   0x8F1BBCDC
 
#define F(x, y, z)   (x ^ y ^ z)
 
#define K   0xCA62C1D6
 

Functions

void mbedtls_sha1_init (mbedtls_sha1_context *ctx)
 Initialize SHA-1 context. More...
 
void mbedtls_sha1_free (mbedtls_sha1_context *ctx)
 Clear SHA-1 context. More...
 
void mbedtls_sha1_clone (mbedtls_sha1_context *dst, const mbedtls_sha1_context *src)
 Clone (the state of) a SHA-1 context. More...
 
void mbedtls_sha1_starts (mbedtls_sha1_context *ctx)
 SHA-1 context setup. More...
 
void mbedtls_sha1_process (mbedtls_sha1_context *ctx, const unsigned char data[64])
 
void mbedtls_sha1_update (mbedtls_sha1_context *ctx, const unsigned char *input, size_t ilen)
 SHA-1 process buffer. More...
 
void mbedtls_sha1_finish (mbedtls_sha1_context *ctx, unsigned char output[20])
 SHA-1 final digest. More...
 
void mbedtls_sha1 (const unsigned char *input, size_t ilen, unsigned char output[20])
 Output = SHA-1( input buffer ) More...
 
int mbedtls_sha1_self_test (int verbose)
 Checkup routine. More...
 

Variables

static const unsigned char sha1_padding [64]
 
static const unsigned char sha1_test_buf [3][57]
 
static const int sha1_test_buflen [3]
 
static const unsigned char sha1_test_sum [3][20]
 

Macro Definition Documentation

◆ F [1/4]

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

◆ F [2/4]

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

◆ F [3/4]

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

◆ F [4/4]

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

◆ GET_UINT32_BE

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

◆ K [1/4]

#define K   0x5A827999

◆ K [2/4]

#define K   0x6ED9EBA1

◆ K [3/4]

#define K   0x8F1BBCDC

◆ K [4/4]

#define K   0xCA62C1D6

◆ P

#define P (   a,
  b,
  c,
  d,
  e,
  x 
)
Value:
{ \
e += S(a,5) + F(b,c,d) + K + x; b = S(b,30); \
}
#define F(x, y, z)
#define K
#define S(x, n)
const GLubyte * c
Definition: glext.h:9812
GLboolean GLboolean GLboolean b
Definition: glext.h:6844
GLint GLint GLint GLint GLint x
Definition: glext.h:6295
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6844

◆ PUT_UINT32_BE

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

◆ R

#define R (   t)
Value:
( \
temp = W[( t - 3 ) & 0x0F] ^ W[( t - 8 ) & 0x0F] ^ \
W[( t - 14 ) & 0x0F] ^ W[ t & 0x0F], \
( W[t & 0x0F] = S(temp,1) ) \
)
GLdouble GLdouble t
Definition: glext.h:6398
#define S(x, n)
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 abits op endm macro pixldst3 mem_operand op endm macro pixldst30 mem_operand op endm macro pixldst abits if abits elseif abits elseif abits elseif abits elseif abits pixldst0 abits else pixldst0 abits pixldst0 abits pixldst0 abits pixldst0 abits endif elseif abits else pixldst0 abits pixldst0 abits endif elseif abits else error unsupported bpp *numpix else pixst endif endm macro pixld1_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl else error unsupported endif endm macro pixld2_s mem_operand if mov asr add asl add asl mov asr sub UNIT_X add asl mov asr add asl add asl mov asr add UNIT_X add asl else pixld1_s mem_operand pixld1_s mem_operand endif endm macro pixld0_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl endif endm macro pixld_s_internal mem_operand if mem_operand pixld2_s mem_operand pixdeinterleave basereg elseif mem_operand elseif mem_operand elseif mem_operand elseif mem_operand pixld0_s mem_operand else pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else error unsupported mem_operand if bpp mem_operand endif endm macro vuzp8 reg2 vuzp d d &reg2 endm macro vzip8 reg2 vzip d d &reg2 endm macro pixdeinterleave basereg basereg basereg basereg basereg endif endm macro pixinterleave basereg basereg basereg basereg basereg endif endm macro PF boost_increment endif if endif PF tst PF addne PF subne PF cmp ORIG_W if endif if endif if endif PF subge ORIG_W PF subges if endif if endif if endif endif endm macro cache_preload_simple endif if dst_r_bpp pld [DST_R, #(PREFETCH_DISTANCE_SIMPLE *dst_r_bpp/8)] endif if mask_bpp pld W[MASK, #(PREFETCH_DISTANCE_SIMPLE *mask_bpp/8)] endif endif endm macro fetch_mask_pixblock pixld mask_basereg pixblock_size MASK endm macro ensure_destination_ptr_alignment process_pixblock_tail_head if beq irp local skip1 beq endif SRC MASK if dst_r_bpp DST_R else add endif PF add sub
Definition: pixman-arm-neon-asm.h:477

◆ S

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

Function Documentation

◆ mbedtls_sha1()

void mbedtls_sha1 ( const unsigned char *  input,
size_t  ilen,
unsigned char  output[20] 
)

Output = SHA-1( input buffer )

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

◆ mbedtls_sha1_clone()

void mbedtls_sha1_clone ( mbedtls_sha1_context dst,
const mbedtls_sha1_context src 
)

Clone (the state of) a SHA-1 context.

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

◆ mbedtls_sha1_finish()

void mbedtls_sha1_finish ( mbedtls_sha1_context ctx,
unsigned char  output[20] 
)

SHA-1 final digest.

Parameters
ctxSHA-1 context
outputSHA-1 checksum result
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mbedtls_sha1_free()

void mbedtls_sha1_free ( mbedtls_sha1_context ctx)

Clear SHA-1 context.

Parameters
ctxSHA-1 context to be cleared
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mbedtls_sha1_init()

void mbedtls_sha1_init ( mbedtls_sha1_context ctx)

Initialize SHA-1 context.

Parameters
ctxSHA-1 context to be initialized
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mbedtls_sha1_process()

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

◆ mbedtls_sha1_self_test()

int mbedtls_sha1_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_sha1_starts()

void mbedtls_sha1_starts ( mbedtls_sha1_context ctx)

SHA-1 context setup.

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

◆ mbedtls_sha1_update()

void mbedtls_sha1_update ( mbedtls_sha1_context ctx,
const unsigned char *  input,
size_t  ilen 
)

SHA-1 process buffer.

Parameters
ctxSHA-1 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

◆ sha1_padding

const unsigned char sha1_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
}

◆ sha1_test_buf

const unsigned char sha1_test_buf[3][57]
static
Initial value:
=
{
{ "abc" },
{ "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" },
{ "" }
}

◆ sha1_test_buflen

const int sha1_test_buflen[3]
static
Initial value:
=
{
3, 56, 1000
}

◆ sha1_test_sum

const unsigned char sha1_test_sum[3][20]
static
Initial value:
=
{
{ 0xA9, 0x99, 0x3E, 0x36, 0x47, 0x06, 0x81, 0x6A, 0xBA, 0x3E,
0x25, 0x71, 0x78, 0x50, 0xC2, 0x6C, 0x9C, 0xD0, 0xD8, 0x9D },
{ 0x84, 0x98, 0x3E, 0x44, 0x1C, 0x3B, 0xD2, 0x6E, 0xBA, 0xAE,
0x4A, 0xA1, 0xF9, 0x51, 0x29, 0xE5, 0xE5, 0x46, 0x70, 0xF1 },
{ 0x34, 0xAA, 0x97, 0x3C, 0xD4, 0xC4, 0xDA, 0xA4, 0xF6, 0x1E,
0xEB, 0x2B, 0xDB, 0xAD, 0x27, 0x31, 0x65, 0x34, 0x01, 0x6F }
}