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)  

sha1.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "sha1.h"
Include dependency graph for sha1.c:

Go to the source code of this file.

Macros

#define rol(x, n)   ( ((x) << (n)) | ((x) >> (32-(n))) )
 
#define ror(x, n)   ( ((x) >> (n)) | ((x) << (32-(n))) )
 
#define TRANSFORM(x, d, n)   transform ((x), (d), (n))
 
#define K1   0x5A827999L
 
#define K2   0x6ED9EBA1L
 
#define K3   0x8F1BBCDCL
 
#define K4   0xCA62C1D6L
 
#define F1(x, y, z)   ( z ^ ( x & ( y ^ z ) ) )
 
#define F2(x, y, z)   ( x ^ y ^ z )
 
#define F3(x, y, z)   ( ( x & y ) | ( z & ( x | y ) ) )
 
#define F4(x, y, z)   ( x ^ y ^ z )
 
#define M(i)
 
#define R(a, b, c, d, e, f, k, m)
 
#define X(a)
 

Functions

void sha1_init_ctx (void *context)
 
static void transform (SHA1_CONTEXT *hd, const unsigned char *data, size_t nblocks)
 
void sha1_write (void *context, const void *inbuf_arg, size_t inlen)
 
void sha1_finish_ctx (void *context)
 
unsigned char * sha1_read (void *context)
 

Macro Definition Documentation

◆ F1

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

Definition at line 84 of file sha1.c.

◆ F2

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

Definition at line 85 of file sha1.c.

◆ F3

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

Definition at line 86 of file sha1.c.

◆ F4

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

Definition at line 87 of file sha1.c.

◆ K1

#define K1   0x5A827999L

Definition at line 80 of file sha1.c.

◆ K2

#define K2   0x6ED9EBA1L

Definition at line 81 of file sha1.c.

◆ K3

#define K3   0x8F1BBCDCL

Definition at line 82 of file sha1.c.

◆ K4

#define K4   0xCA62C1D6L

Definition at line 83 of file sha1.c.

◆ M

#define M (   i)
Value:
( tm = x[ i &0x0f] \
^ x[(i-14)&0x0f] \
^ x[(i-8) &0x0f] \
^ x[(i-3) &0x0f], \
(x[i&0x0f] = rol(tm, 1)))
#define rol(x, n)
Definition: sha1.c:51

Definition at line 88 of file sha1.c.

◆ R

#define R (   a,
  b,
  c,
  d,
  e,
  f,
  k,
 
)
Value:
do { e += rol( a, 5 ) \
+ f( b, c, d ) \
+ k \
+ m; \
b = rol( b, 30 ); \
} while(0)

Definition at line 93 of file sha1.c.

◆ rol

#define rol (   x,
 
)    ( ((x) << (n)) | ((x) >> (32-(n))) )

Definition at line 51 of file sha1.c.

◆ ror

#define ror (   x,
 
)    ( ((x) >> (n)) | ((x) << (32-(n))) )

Definition at line 52 of file sha1.c.

◆ TRANSFORM

#define TRANSFORM (   x,
  d,
 
)    transform ((x), (d), (n))

Definition at line 63 of file sha1.c.

◆ X

#define X (   a)
Value:
do { *p++ = hd->h##a >> 24; *p++ = hd->h##a >> 16; \
*p++ = hd->h##a >> 8; *p++ = hd->h##a; } while(0)

Function Documentation

◆ sha1_finish_ctx()

void sha1_finish_ctx ( void *  context)

Definition at line 279 of file sha1.c.

References SHA1_CONTEXT::buf, SHA1_CONTEXT::count, SHA1_CONTEXT::nblocks, sha1_write(), TRANSFORM, and X.

Referenced by sha1_final().

◆ sha1_init_ctx()

void sha1_init_ctx ( void *  context)

◆ sha1_read()

unsigned char* sha1_read ( void *  context)

Definition at line 343 of file sha1.c.

References SHA1_CONTEXT::buf.

Referenced by sha1_final().

◆ sha1_write()

void sha1_write ( void *  context,
const void *  inbuf_arg,
size_t  inlen 
)

Definition at line 232 of file sha1.c.

References SHA1_CONTEXT::buf, SHA1_CONTEXT::count, SHA1_CONTEXT::nblocks, and TRANSFORM.

Referenced by sha1_finish_ctx(), and sha1_update().

◆ transform()

static void transform ( SHA1_CONTEXT hd,
const unsigned char *  data,
size_t  nblocks 
)
static

Definition at line 104 of file sha1.c.

References F1, F2, F3, F4, SHA1_CONTEXT::h0, SHA1_CONTEXT::h1, SHA1_CONTEXT::h2, SHA1_CONTEXT::h3, SHA1_CONTEXT::h4, K1, K2, K3, K4, M, and R.