Apache HTTPD
Classes | Macros | Functions
apr_sha1.c File Reference
#include "apr_sha1.h"
#include "apr_base64.h"
#include "apr_strings.h"
#include "apr_lib.h"
#include <string.h>

Go to the source code of this file.

Classes

union  endianTest
 

Macros

#define UNROLL_LOOPS
 
#define USE_MODIFIED_SHA
 
#define f1(x, y, z)   ((x & y) | (~x & z))
 
#define f2(x, y, z)   (x ^ y ^ z)
 
#define f3(x, y, z)   ((x & y) | (x & z) | (y & z))
 
#define f4(x, y, z)   (x ^ y ^ z)
 
#define CONST1   0x5a827999L
 
#define CONST2   0x6ed9eba1L
 
#define CONST3   0x8f1bbcdcL
 
#define CONST4   0xca62c1d6L
 
#define ROT32(x, n)   ((x << n) | (x >> (32 - n)))
 
#define FUNC(n, i)
 
#define SHA_BLOCKSIZE   64
 

Functions

static void sha_transform (apr_sha1_ctx_t *sha_info)
 
static char isLittleEndian (void)
 
static void maybe_byte_reverse (apr_uint32_t *buffer, int count)
 
 APU_DECLARE (void)
 Computes SipHash-2-4, producing a 64bit (APR_SIPHASH_DSIZE) hash from a message and a 128bit (APR_SIPHASH_KSIZE) secret key, into a possibly unaligned buffer (using the little endian representation as defined by the authors for interoperabilty) usable as a MAC.
 

Macro Definition Documentation

◆ CONST1

#define CONST1   0x5a827999L

Definition at line 69 of file apr_sha1.c.

◆ CONST2

#define CONST2   0x6ed9eba1L

Definition at line 70 of file apr_sha1.c.

◆ CONST3

#define CONST3   0x8f1bbcdcL

Definition at line 71 of file apr_sha1.c.

◆ CONST4

#define CONST4   0xca62c1d6L

Definition at line 72 of file apr_sha1.c.

◆ f1

#define f1 (   x,
  y,
  z 
)    ((x & y) | (~x & z))

Definition at line 63 of file apr_sha1.c.

◆ f2

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

Definition at line 64 of file apr_sha1.c.

◆ f3

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

Definition at line 65 of file apr_sha1.c.

◆ f4

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

Definition at line 66 of file apr_sha1.c.

◆ FUNC

#define FUNC (   n,
  i 
)
Value:
temp = ROT32(A,5) + f##n(B,C,D) + E + W[i] + CONST##n; \
E = D; D = C; C = ROT32(B,30); B = A; A = temp
int n
Definition ap_regex.h:278
#define ROT32(x, n)
Definition apr_sha1.c:76
apr_file_t * f
apr_size_t size
int i
Definition mod_so.c:347

Definition at line 78 of file apr_sha1.c.

◆ ROT32

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

Definition at line 76 of file apr_sha1.c.

◆ SHA_BLOCKSIZE

#define SHA_BLOCKSIZE   64

Definition at line 82 of file apr_sha1.c.

◆ UNROLL_LOOPS

#define UNROLL_LOOPS

Definition at line 57 of file apr_sha1.c.

◆ USE_MODIFIED_SHA

#define USE_MODIFIED_SHA

Definition at line 60 of file apr_sha1.c.

Function Documentation

◆ APU_DECLARE()

APU_DECLARE ( void  )

Computes SipHash-2-4, producing a 64bit (APR_SIPHASH_DSIZE) hash from a message and a 128bit (APR_SIPHASH_KSIZE) secret key, into a possibly unaligned buffer (using the little endian representation as defined by the authors for interoperabilty) usable as a MAC.

Computes SipHash-4-8, producing a 64bit (APR_SIPHASH_DSIZE) hash from a message and a 128bit (APR_SIPHASH_KSIZE) secret key, into a possibly unaligned buffer (using the little endian representation as defined by the authors for interoperabilty) usable as a MAC.

Initialize the SHA digest

Parameters
contextThe SHA context to initialize

Update the SHA digest

Parameters
contextThe SHA1 context to update
inputThe buffer to add to the SHA digest
inputLenThe length of the input buffer

Update the SHA digest with binary data

Parameters
contextThe SHA1 context to update
inputThe buffer to add to the SHA digest
inputLenThe length of the input buffer

Finish computing the SHA digest

Parameters
digestthe output buffer in which to store the digest
contextThe context to finalize
outThe output buffer (or MAC)
srcThe message
lenThe length of the message
keyThe secret key
Returns
The hash value as a 64bit unsigned integer

< use pool pre cleanup

Definition at line 206 of file apr_sha1.c.

◆ isLittleEndian()

static char isLittleEndian ( void  )
static

Definition at line 172 of file apr_sha1.c.

◆ maybe_byte_reverse()

static void maybe_byte_reverse ( apr_uint32_t buffer,
int  count 
)
static

Definition at line 182 of file apr_sha1.c.

◆ sha_transform()

static void sha_transform ( apr_sha1_ctx_t sha_info)
static

Definition at line 107 of file apr_sha1.c.