|
wpa_supplicant / hostapd 2.0
|
SHA1 hash implementation and interface functions. More...
#include "includes.h"#include "common.h"#include "sha1.h"#include "sha1_i.h"#include "md5.h"#include "crypto.h"Defines | |
| #define | SHA1HANDSOFF |
| #define | rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits)))) |
| #define | blk0(i) |
| #define | blk(i) |
| #define | R0(v, w, x, y, z, i) |
| #define | R1(v, w, x, y, z, i) |
| #define | R2(v, w, x, y, z, i) z += (w ^ x ^ y) + blk(i) + 0x6ED9EBA1 + rol(v, 5); w = rol(w, 30); |
| #define | R3(v, w, x, y, z, i) |
| #define | R4(v, w, x, y, z, i) |
Typedefs | |
| typedef struct SHA1Context | SHA1_CTX |
Functions | |
| void | SHA1Transform (u32 state[5], const unsigned char buffer[64]) |
| int | sha1_vector (size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac) |
| SHA-1 hash for data vector. | |
| void | SHA1Init (SHA1_CTX *context) |
| void | SHA1Update (SHA1_CTX *context, const void *_data, u32 len) |
| void | SHA1Final (unsigned char digest[20], SHA1_CTX *context) |
SHA1 hash implementation and interface functions.
This software may be distributed under the terms of the BSD license. See README for more details.
| #define blk | ( | i | ) |
(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 blk0 | ( | i | ) |
(block->l[i] = (rol(block->l[i], 24) & 0xFF00FF00) | \
(rol(block->l[i], 8) & 0x00FF00FF))
| #define R0 | ( | v, | |
| w, | |||
| x, | |||
| y, | |||
| z, | |||
| i | |||
| ) |
z += ((w & (x ^ y)) ^ y) + blk0(i) + 0x5A827999 + rol(v, 5); \
w = rol(w, 30);
| #define R1 | ( | v, | |
| w, | |||
| x, | |||
| y, | |||
| z, | |||
| i | |||
| ) |
z += ((w & (x ^ y)) ^ y) + blk(i) + 0x5A827999 + rol(v, 5); \
w = rol(w, 30);
| #define R3 | ( | v, | |
| w, | |||
| x, | |||
| y, | |||
| z, | |||
| i | |||
| ) |
z += (((w | x) & y) | (w & x)) + blk(i) + 0x8F1BBCDC + rol(v, 5); \
w = rol(w, 30);
| #define R4 | ( | v, | |
| w, | |||
| x, | |||
| y, | |||
| z, | |||
| i | |||
| ) |
z += (w ^ x ^ y) + blk(i) + 0xCA62C1D6 + rol(v, 5); \
w=rol(w, 30);
| int sha1_vector | ( | size_t | num_elem, |
| const u8 * | addr[], | ||
| const size_t * | len, | ||
| u8 * | mac | ||
| ) |
SHA-1 hash for data vector.
| num_elem | Number of elements in the data vector |
| addr | Pointers to the data areas |
| len | Lengths of the data blocks |
| mac | Buffer for the hash |
1.7.3