iPXE
|
SHA-256 algorithm. More...
#include <stdint.h>
#include <string.h>
#include <byteswap.h>
#include <assert.h>
#include <ipxe/rotate.h>
#include <ipxe/crypto.h>
#include <ipxe/sha256.h>
Go to the source code of this file.
Data Structures | |
struct | sha256_variables |
SHA-256 variables. More... | |
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
struct sha256_variables | __attribute__ ((packed)) |
void | sha256_family_init (struct sha256_context *context, const struct sha256_digest *init, size_t digestsize) |
Initialise SHA-256 family algorithm. More... | |
static void | sha256_init (void *ctx) |
Initialise SHA-256 algorithm. More... | |
static void | sha256_digest (struct sha256_context *context) |
Calculate SHA-256 digest of accumulated data. More... | |
void | sha256_update (void *ctx, const void *data, size_t len) |
Accumulate data with SHA-256 algorithm. More... | |
void | sha256_final (void *ctx, void *out) |
Generate SHA-256 digest. More... | |
Variables | |
uint32_t | a |
uint32_t | b |
uint32_t | c |
uint32_t | d |
uint32_t | e |
uint32_t | f |
uint32_t | g |
uint32_t | h |
uint32_t | w [SHA256_ROUNDS] |
static const uint32_t | k [SHA256_ROUNDS] |
SHA-256 constants. More... | |
static const struct sha256_digest | sha256_init_digest |
SHA-256 initial digest values. More... | |
struct digest_algorithm | sha256_algorithm |
SHA-256 algorithm. More... | |
SHA-256 algorithm.
Definition in file sha256.c.
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
struct sha256_variables __attribute__ | ( | (packed) | ) |
void sha256_family_init | ( | struct sha256_context * | context, |
const struct sha256_digest * | init, | ||
size_t | digestsize | ||
) |
Initialise SHA-256 family algorithm.
context | SHA-256 context |
init | Initial digest values |
digestsize | Digest size |
Definition at line 92 of file sha256.c.
References sha256_digest_data_dwords::dd, sha256_context::ddd, sha256_digest_data::digest, digestsize, sha256_context::digestsize, sha256_context::len, and memcpy().
Referenced by sha224_init(), and sha256_init().
|
static |
Initialise SHA-256 algorithm.
ctx | SHA-256 context |
Definition at line 107 of file sha256.c.
References ctx, sha256_family_init(), and sha256_init_digest.
|
static |
Calculate SHA-256 digest of accumulated data.
context | SHA-256 context |
Definition at line 119 of file sha256.c.
References a, assert(), b, be32_to_cpus, c, ch, cpu_to_be32, d, sha256_digest_data::data, DBGC, DBGC2, DBGC_HDA, sha256_digest_data_dwords::dd, sha256_context::ddd, sha256_digest_data::digest, sha256_digest_data_dwords::dword, e, f, g, sha256_digest::h, h, k, sha256_context::len, linker_assert, ror32(), SHA256_ROUNDS, u, and w.
Referenced by sha256_update().
void sha256_update | ( | void * | ctx, |
const void * | data, | ||
size_t | len | ||
) |
Accumulate data with SHA-256 algorithm.
ctx | SHA-256 context |
data | Data |
len | Length of data |
Definition at line 216 of file sha256.c.
References sha256_block::byte, ctx, data, sha256_digest_data::data, sha256_digest_data_dwords::dd, sha256_context::ddd, len, sha256_context::len, offset, and sha256_digest().
Referenced by sha256_final().
void sha256_final | ( | void * | ctx, |
void * | out | ||
) |
Generate SHA-256 digest.
ctx | SHA-256 context |
out | Output buffer |
Definition at line 239 of file sha256.c.
References assert(), cpu_to_be64, ctx, sha256_digest_data::data, sha256_digest_data_dwords::dd, sha256_context::ddd, sha256_digest_data::digest, sha256_context::digestsize, sha256_context::len, memcpy(), offsetof, out, pad, sha256_update(), and typeof().
uint32_t a |
Definition at line 28 of file sha256.c.
Referenced by sha256_digest().
uint32_t b |
Definition at line 29 of file sha256.c.
Referenced by sha256_digest().
uint32_t c |
Definition at line 30 of file sha256.c.
Referenced by sha256_digest().
uint32_t d |
Definition at line 31 of file sha256.c.
Referenced by sha256_digest().
uint32_t e |
Definition at line 32 of file sha256.c.
Referenced by sha256_digest().
uint32_t f |
Definition at line 33 of file sha256.c.
Referenced by ar9003_hw_atten_chain_get(), ar9003_hw_atten_chain_get_margin(), ar9003_hw_power_control_override(), arbel_post_send(), md4_digest(), md5_digest(), oncrpc_iob_add_fields(), sha1_digest(), and sha256_digest().
uint32_t g |
Definition at line 34 of file sha256.c.
Referenced by arbel_complete(), hermon_complete(), md5_digest(), and sha256_digest().
uint8_t h |
Definition at line 35 of file sha256.c.
Referenced by ath9k_hw_getnf(), ath9k_hw_loadnf(), ath9k_hw_update_nfcal_hist_buffer(), ath9k_init_nfcal_hist_buffer(), entropy_adaptive_proportion_cutoff(), entropy_adaptive_proportion_cutoff_lookup(), and sha256_digest().
Definition at line 36 of file sha256.c.
Referenced by sha256_digest().
|
static |
SHA-256 constants.
Definition at line 57 of file sha256.c.
Referenced by sha256_digest().
|
static |
SHA-256 initial digest values.
Definition at line 72 of file sha256.c.
Referenced by sha256_init().
struct digest_algorithm sha256_algorithm |
SHA-256 algorithm.
Definition at line 264 of file sha256.c.
Referenced by icert_cert(), peerdist_info_v1(), and sha256_test_exec().