Dibbler - a portable DHCPv6  1.0.2RC1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
sha1.c File Reference
#include "sha1.h"
#include <stddef.h>
#include <string.h>
#include <stdlib.h>
+ Include dependency graph for sha1.c:

Macros

#define alignof(type)   offsetof (struct { char c; type x; }, x)
#define BLOCKSIZE   4096
#define F1(B, C, D)   ( D ^ ( B & ( C ^ D ) ) )
#define F2(B, C, D)   (B ^ C ^ D)
#define F3(B, C, D)   ( ( B & C ) | ( D & ( B | C ) ) )
#define F4(B, C, D)   (B ^ C ^ D)
#define K1   0x5a827999
#define K2   0x6ed9eba1
#define K3   0x8f1bbcdc
#define K4   0xca62c1d6
#define M(I)
#define R(A, B, C, D, E, F, K, M)
#define rol(x, n)   (((x) << (n)) | ((uint32_t) (x) >> (32 - (n))))
#define SWAP(n)   (n)
#define UNALIGNED_P(p)   (((size_t) p) % alignof (uint32_t) != 0)

Functions

void * sha1_finish_ctx (struct sha1_ctx *ctx, void *resbuf)
void sha1_init_ctx (struct sha1_ctx *ctx)
void sha1_process_block (const void *buffer, size_t len, struct sha1_ctx *ctx)
void sha1_process_bytes (const void *buffer, size_t len, struct sha1_ctx *ctx)
void * sha1_read_ctx (const struct sha1_ctx *ctx, void *resbuf)

Variables

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

Macro Definition Documentation

#define alignof (   type)    offsetof (struct { char c; type x; }, x)
#define BLOCKSIZE   4096
#define F1 (   B,
  C,
 
)    ( D ^ ( B & ( C ^ D ) ) )
#define F2 (   B,
  C,
 
)    (B ^ C ^ D)
#define F3 (   B,
  C,
 
)    ( ( B & C ) | ( D & ( B | C ) ) )
#define F4 (   B,
  C,
 
)    (B ^ C ^ D)
#define K1   0x5a827999
#define K2   0x6ed9eba1
#define K3   0x8f1bbcdc
#define K4   0xca62c1d6
#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 R (   A,
  B,
  C,
  D,
  E,
  F,
  K,
  M 
)
Value:
do { E += rol( A, 5 ) \
+ F( B, C, D ) \
+ K \
+ M; \
B = rol( B, 30 ); \
} while(0)
#define rol (   x,
 
)    (((x) << (n)) | ((uint32_t) (x) >> (32 - (n))))
#define SWAP (   n)    (n)
#define UNALIGNED_P (   p)    (((size_t) p) % alignof (uint32_t) != 0)

Function Documentation

void* sha1_finish_ctx ( struct sha1_ctx ctx,
void *  resbuf 
)
void sha1_init_ctx ( struct sha1_ctx ctx)
void sha1_process_block ( const void *  buffer,
size_t  len,
struct sha1_ctx ctx 
)
void sha1_process_bytes ( const void *  buffer,
size_t  len,
struct sha1_ctx ctx 
)
void* sha1_read_ctx ( const struct sha1_ctx ctx,
void *  resbuf 
)

Variable Documentation

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