The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Macros | Functions
sha1.c File Reference

Local implementation of the SHA1 hashing scheme. More...

#include <freeradius-devel/util/sha1.h>
+ Include dependency graph for sha1.c:

Go to the source code of this file.

Macros

#define blk(i)
 
#define blk0(i)   (block->l[i] = htonl(block->l[i]))
 
#define R0(v, w, x, y, z, i)   do { z+=((w&(x^y))^y)+blk0(i)+0x5A827999+rol(v,5);w=rol(w,30); } while (0)
 
#define R1(v, w, x, y, z, i)   do { z+=((w&(x^y))^y)+blk(i)+0x5A827999+rol(v,5);w=rol(w,30); } while (0)
 
#define R2(v, w, x, y, z, i)   do { z+=(w^x^y)+blk(i)+0x6ED9EBA1+rol(v,5);w=rol(w,30); } while (0)
 
#define R3(v, w, x, y, z, i)   do { z+=(((w|x)&y)|(w&x))+blk(i)+0x8F1BBCDC+rol(v,5);w=rol(w,30); } while (0)
 
#define R4(v, w, x, y, z, i)   do { z+=(w^x^y)+blk(i)+0xCA62C1D6+rol(v,5);w=rol(w,30); } while (0)
 
#define rol(value, bits)   (((value) << (bits)) | ((value) >> (32 - (bits))))
 

Functions

void fr_sha1_final (uint8_t digest[static SHA1_DIGEST_LENGTH], fr_sha1_ctx *context)
 
void fr_sha1_final_no_len (uint8_t digest[static SHA1_DIGEST_LENGTH], fr_sha1_ctx *context)
 
void fr_sha1_init (fr_sha1_ctx *context)
 
void fr_sha1_transform (uint32_t state[static 5], uint8_t const buffer[static 64])
 
void fr_sha1_update (fr_sha1_ctx *context, uint8_t const *in, size_t len)
 

Detailed Description

Local implementation of the SHA1 hashing scheme.

SHA-1 in C 100% Public Domain

Author
Steve Reid (steve.nosp@m.@edm.nosp@m.web.c.nosp@m.om)

Definition in file sha1.c.

Macro Definition Documentation

◆ blk

#define blk (   i)
Value:
(block->l[i&15] = rol(block->l[(i+13)&15]^block->l[(i+8)&15] \
^block->l[(i+2)&15]^block->l[i&15],1))
#define rol(value, bits)
Definition: sha1.c:15

Definition at line 22 of file sha1.c.

◆ blk0

#define blk0 (   i)    (block->l[i] = htonl(block->l[i]))

Definition at line 20 of file sha1.c.

◆ R0

#define R0 (   v,
  w,
  x,
  y,
  z,
 
)    do { z+=((w&(x^y))^y)+blk0(i)+0x5A827999+rol(v,5);w=rol(w,30); } while (0)

Definition at line 26 of file sha1.c.

◆ R1

#define R1 (   v,
  w,
  x,
  y,
  z,
 
)    do { z+=((w&(x^y))^y)+blk(i)+0x5A827999+rol(v,5);w=rol(w,30); } while (0)

Definition at line 27 of file sha1.c.

◆ R2

#define R2 (   v,
  w,
  x,
  y,
  z,
 
)    do { z+=(w^x^y)+blk(i)+0x6ED9EBA1+rol(v,5);w=rol(w,30); } while (0)

Definition at line 28 of file sha1.c.

◆ R3

#define R3 (   v,
  w,
  x,
  y,
  z,
 
)    do { z+=(((w|x)&y)|(w&x))+blk(i)+0x8F1BBCDC+rol(v,5);w=rol(w,30); } while (0)

Definition at line 29 of file sha1.c.

◆ R4

#define R4 (   v,
  w,
  x,
  y,
  z,
 
)    do { z+=(w^x^y)+blk(i)+0xCA62C1D6+rol(v,5);w=rol(w,30); } while (0)

Definition at line 30 of file sha1.c.

◆ rol

#define rol (   value,
  bits 
)    (((value) << (bits)) | ((value) >> (32 - (bits))))

Definition at line 15 of file sha1.c.

Function Documentation

◆ fr_sha1_final()

void fr_sha1_final ( uint8_t  digest[static SHA1_DIGEST_LENGTH],
fr_sha1_ctx context 
)

Definition at line 141 of file sha1.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_sha1_final_no_len()

void fr_sha1_final_no_len ( uint8_t  digest[static SHA1_DIGEST_LENGTH],
fr_sha1_ctx context 
)

Definition at line 174 of file sha1.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_sha1_init()

void fr_sha1_init ( fr_sha1_ctx context)

Definition at line 93 of file sha1.c.

+ Here is the caller graph for this function:

◆ fr_sha1_transform()

void fr_sha1_transform ( uint32_t  state[static 5],
uint8_t const  buffer[static 64] 
)

Definition at line 35 of file sha1.c.

+ Here is the caller graph for this function:

◆ fr_sha1_update()

void fr_sha1_update ( fr_sha1_ctx context,
uint8_t const *  in,
size_t  len 
)

Definition at line 105 of file sha1.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function: