xorriso  1.5.4.pl02
About: GNU xorriso creates, loads, manipulates and writes ISO 9660 filesystem images with Rock Ridge extensions. It is suitable for incremental data backup and for production of bootable ISO 9660 images. GNU xorriso is a statical compilation of the libraries libburn, libisofs, libisoburn, and libjte.
  Fossies Dox: xorriso-1.5.4.pl02.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

sha512.c File Reference
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include "sha512.h"
Include dependency graph for sha512.c:

Go to the source code of this file.

Macros

#define SWAP(n)
 
#define LIBJTE_INITIALIZE_32   yes
 
#define Ch(x, y, z)   ((x & y) ^ (~x & z))
 
#define Maj(x, y, z)   ((x & y) ^ (x & z) ^ (y & z))
 
#define S0(x)   (CYCLIC (x, 28) ^ CYCLIC (x, 34) ^ CYCLIC (x, 39))
 
#define S1(x)   (CYCLIC (x, 14) ^ CYCLIC (x, 18) ^ CYCLIC (x, 41))
 
#define R0(x)   (CYCLIC (x, 1) ^ CYCLIC (x, 8) ^ (x >> 7))
 
#define R1(x)   (CYCLIC (x, 19) ^ CYCLIC (x, 61) ^ (x >> 6))
 
#define CYCLIC(w, s)   ((w >> s) | (w << (64 - s)))
 
#define UNALIGNED_P(p)   (((uintptr_t) p) % sizeof (uint64_t) != 0)
 

Functions

static void sha512_process_block (const void *buffer, size_t len, struct sha512_ctx *ctx)
 
void sha512_init_ctx (struct sha512_ctx *ctx)
 
void * sha512_finish_ctx (struct sha512_ctx *ctx, void *resbuf)
 
void sha512_process_bytes (const void *buffer, size_t len, struct sha512_ctx *ctx)
 

Variables

static const unsigned char fillbuf [128] = { 0x80, 0 }
 
static uint64_t K [80]
 
static int K_initialized = 0
 
static const uint32_t K32 [160]
 

Macro Definition Documentation

◆ Ch

#define Ch (   x,
  y,
 
)    ((x & y) ^ (~x & z))

◆ CYCLIC

#define CYCLIC (   w,
 
)    ((w >> s) | (w << (64 - s)))

◆ LIBJTE_INITIALIZE_32

#define LIBJTE_INITIALIZE_32   yes

Definition at line 64 of file sha512.c.

◆ Maj

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

◆ R0

#define R0 (   x)    (CYCLIC (x, 1) ^ CYCLIC (x, 8) ^ (x >> 7))

◆ R1

#define R1 (   x)    (CYCLIC (x, 19) ^ CYCLIC (x, 61) ^ (x >> 6))

◆ S0

#define S0 (   x)    (CYCLIC (x, 28) ^ CYCLIC (x, 34) ^ CYCLIC (x, 39))

◆ S1

#define S1 (   x)    (CYCLIC (x, 14) ^ CYCLIC (x, 18) ^ CYCLIC (x, 41))

◆ SWAP

#define SWAP (   n)
Value:
(((n) << 56) \
| (((n) & 0xff00) << 40) \
| (((n) & 0xff0000) << 24) \
| (((n) & 0xff000000) << 8) \
| (((n) >> 8) & 0xff000000) \
| (((n) >> 24) & 0xff0000) \
| (((n) >> 40) & 0xff00) \
| ((n) >> 56))

Definition at line 42 of file sha512.c.

◆ UNALIGNED_P

#define UNALIGNED_P (   p)    (((uintptr_t) p) % sizeof (uint64_t) != 0)

Function Documentation

◆ sha512_finish_ctx()

void* sha512_finish_ctx ( struct sha512_ctx ctx,
void *  resbuf 
)

◆ sha512_init_ctx()

void sha512_init_ctx ( struct sha512_ctx ctx)

Definition at line 273 of file sha512.c.

References sha512_ctx::buflen, sha512_ctx::H, K, K32, K_initialized, and sha512_ctx::total.

Referenced by sha512_init().

◆ sha512_process_block()

static void sha512_process_block ( const void *  buffer,
size_t  len,
struct sha512_ctx ctx 
)
static

Definition at line 172 of file sha512.c.

References Ch, sha512_ctx::H, K, Maj, R0, R1, S0, S1, SWAP, and sha512_ctx::total.

Referenced by sha512_finish_ctx(), and sha512_process_bytes().

◆ sha512_process_bytes()

void sha512_process_bytes ( const void *  buffer,
size_t  len,
struct sha512_ctx ctx 
)

Definition at line 351 of file sha512.c.

References sha512_ctx::buffer, sha512_ctx::buflen, sha512_process_block(), and UNALIGNED_P.

Referenced by sha512_update().

Variable Documentation

◆ fillbuf

const unsigned char fillbuf[128] = { 0x80, 0 }
static

Definition at line 59 of file sha512.c.

Referenced by sha512_finish_ctx().

◆ K

uint64_t K[80]
static

Definition at line 68 of file sha512.c.

Referenced by sha512_init_ctx(), and sha512_process_block().

◆ K32

const uint32_t K32[160]
static

Definition at line 76 of file sha512.c.

Referenced by sha512_init_ctx().

◆ K_initialized

int K_initialized = 0
static

Definition at line 69 of file sha512.c.

Referenced by sha512_init_ctx().