Classes | Defines | Functions | Variables
sha256-internal.c File Reference
#include "includes.h"
#include "common.h"
#include "sha256.h"
#include "crypto.h"
Include dependency graph for sha256-internal.c:

Go to the source code of this file.

Classes

struct  sha256_state

Defines

#define block_size   64
#define Ch(x, y, z)   (z ^ (x & (y ^ z)))
#define Gamma0(x)   (S(x, 7) ^ S(x, 18) ^ R(x, 3))
#define Gamma1(x)   (S(x, 17) ^ S(x, 19) ^ R(x, 10))
#define Maj(x, y, z)   (((x | y) & z) | (x & y))
#define MIN(x, y)   (((x) < (y)) ? (x) : (y))
#define R(x, n)   (((x)&0xFFFFFFFFUL)>>(n))
#define RND(a, b, c, d, e, f, g, h, i)
#define RORc(x, y)
#define S(x, n)   RORc((x), (n))
#define Sigma0(x)   (S(x, 2) ^ S(x, 13) ^ S(x, 22))
#define Sigma1(x)   (S(x, 6) ^ S(x, 11) ^ S(x, 25))

Functions

static int sha256_compress (struct sha256_state *md, unsigned char *buf)
static int sha256_done (struct sha256_state *md, unsigned char *out)
static void sha256_init (struct sha256_state *md)
static int sha256_process (struct sha256_state *md, const unsigned char *in, unsigned long inlen)
int sha256_vector (size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac)

Variables

static const unsigned long K [64]

Define Documentation

#define block_size   64
#define Ch (   x,
  y,
 
)    (z ^ (x & (y ^ z)))

Definition at line 84 of file sha256-internal.c.

#define Gamma0 (   x)    (S(x, 7) ^ S(x, 18) ^ R(x, 3))

Definition at line 90 of file sha256-internal.c.

#define Gamma1 (   x)    (S(x, 17) ^ S(x, 19) ^ R(x, 10))

Definition at line 91 of file sha256-internal.c.

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

Definition at line 85 of file sha256-internal.c.

#define MIN (   x,
  y 
)    (((x) < (y)) ? (x) : (y))

Definition at line 93 of file sha256-internal.c.

#define R (   x,
 
)    (((x)&0xFFFFFFFFUL)>>(n))

Definition at line 87 of file sha256-internal.c.

#define RND (   a,
  b,
  c,
  d,
  e,
  f,
  g,
  h,
 
)
Value:
t0 = h + Sigma1(e) + Ch(e, f, g) + K[i] + W[i]; \
        t1 = Sigma0(a) + Maj(a, b, c);                  \
        d += t0;                                        \
        h  = t0 + t1;
#define RORc (   x,
  y 
)
Value:
( ((((unsigned long) (x) & 0xFFFFFFFFUL) >> (unsigned long) ((y) & 31)) | \
   ((unsigned long) (x) << (unsigned long) (32 - ((y) & 31)))) & 0xFFFFFFFFUL)

Definition at line 81 of file sha256-internal.c.

#define S (   x,
 
)    RORc((x), (n))

Definition at line 86 of file sha256-internal.c.

#define Sigma0 (   x)    (S(x, 2) ^ S(x, 13) ^ S(x, 22))

Definition at line 88 of file sha256-internal.c.

#define Sigma1 (   x)    (S(x, 6) ^ S(x, 11) ^ S(x, 25))

Definition at line 89 of file sha256-internal.c.


Function Documentation

static int sha256_compress ( struct sha256_state md,
unsigned char *  buf 
) [static]

Definition at line 97 of file sha256-internal.c.

static int sha256_done ( struct sha256_state md,
unsigned char *  out 
) [static]

Terminate the hash to get the digest

Parameters:
mdThe hash state
out[out] The destination of the hash (32 bytes)
Returns:
CRYPT_OK if successful

Definition at line 202 of file sha256-internal.c.

static void sha256_init ( struct sha256_state md) [static]

Definition at line 140 of file sha256-internal.c.

static int sha256_process ( struct sha256_state md,
const unsigned char *  in,
unsigned long  inlen 
) [static]

Process a block of memory though the hash

Parameters:
mdThe hash state
inThe data to hash
inlenThe length of the data (octets)
Returns:
CRYPT_OK if successful

Definition at line 161 of file sha256-internal.c.

int sha256_vector ( size_t  num_elem,
const u8 *  addr[],
const size_t *  len,
u8 *  mac 
)

sha256_vector - SHA256 hash for data vector : Number of elements in the data vector : Pointers to the data areas : Lengths of the data blocks : Buffer for the hash Returns: 0 on success, -1 of failure

Definition at line 41 of file sha256-internal.c.


Variable Documentation

const unsigned long K[64] [static]
Initial value:
 {
        0x428a2f98UL, 0x71374491UL, 0xb5c0fbcfUL, 0xe9b5dba5UL, 0x3956c25bUL,
        0x59f111f1UL, 0x923f82a4UL, 0xab1c5ed5UL, 0xd807aa98UL, 0x12835b01UL,
        0x243185beUL, 0x550c7dc3UL, 0x72be5d74UL, 0x80deb1feUL, 0x9bdc06a7UL,
        0xc19bf174UL, 0xe49b69c1UL, 0xefbe4786UL, 0x0fc19dc6UL, 0x240ca1ccUL,
        0x2de92c6fUL, 0x4a7484aaUL, 0x5cb0a9dcUL, 0x76f988daUL, 0x983e5152UL,
        0xa831c66dUL, 0xb00327c8UL, 0xbf597fc7UL, 0xc6e00bf3UL, 0xd5a79147UL,
        0x06ca6351UL, 0x14292967UL, 0x27b70a85UL, 0x2e1b2138UL, 0x4d2c6dfcUL,
        0x53380d13UL, 0x650a7354UL, 0x766a0abbUL, 0x81c2c92eUL, 0x92722c85UL,
        0xa2bfe8a1UL, 0xa81a664bUL, 0xc24b8b70UL, 0xc76c51a3UL, 0xd192e819UL,
        0xd6990624UL, 0xf40e3585UL, 0x106aa070UL, 0x19a4c116UL, 0x1e376c08UL,
        0x2748774cUL, 0x34b0bcb5UL, 0x391c0cb3UL, 0x4ed8aa4aUL, 0x5b9cca4fUL,
        0x682e6ff3UL, 0x748f82eeUL, 0x78a5636fUL, 0x84c87814UL, 0x8cc70208UL,
        0x90befffaUL, 0xa4506cebUL, 0xbef9a3f7UL, 0xc67178f2UL
}

Definition at line 63 of file sha256-internal.c.



wpa_supplicant_node
Author(s): Package maintained by Blaise Gassend
autogenerated on Thu Apr 24 2014 15:33:24