MeterLogger
|
#include <esp8266.h>
#include <string.h>
#include <stdint.h>
#include "crypto/crypto.h"
#include "crypto/sha256.h"
Go to the source code of this file.
Macros | |
#define | LITTLE_ENDIAN 1234 |
#define | BIG_ENDIAN 4321 |
#define | BYTE_ORDER LITTLE_ENDIAN |
#define | SHA256_SHORT_BLOCK_LENGTH (SHA256_BLOCK_LENGTH - 8) |
#define | REVERSE32(w, x) |
#define | REVERSE64(w, x) |
#define | ADDINC128(w, n) |
#define | R(b, x) ((x) >> (b)) |
#define | S32(b, x) (((x) >> (b)) | ((x) << (32 - (b)))) |
#define | S64(b, x) (((x) >> (b)) | ((x) << (64 - (b)))) |
#define | Ch(x, y, z) (((x) & (y)) ^ ((~(x)) & (z))) |
#define | Maj(x, y, z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) |
#define | Sigma0_256(x) (S32(2, (x)) ^ S32(13, (x)) ^ S32(22, (x))) |
#define | Sigma1_256(x) (S32(6, (x)) ^ S32(11, (x)) ^ S32(25, (x))) |
#define | sigma0_256(x) (S32(7, (x)) ^ S32(18, (x)) ^ R(3 , (x))) |
#define | sigma1_256(x) (S32(17, (x)) ^ S32(19, (x)) ^ R(10, (x))) |
#define | Sigma0_512(x) (S64(28, (x)) ^ S64(34, (x)) ^ S64(39, (x))) |
#define | Sigma1_512(x) (S64(14, (x)) ^ S64(18, (x)) ^ S64(41, (x))) |
#define | sigma0_512(x) (S64( 1, (x)) ^ S64( 8, (x)) ^ R( 7, (x))) |
#define | sigma1_512(x) (S64(19, (x)) ^ S64(61, (x)) ^ R( 6, (x))) |
Functions | |
void | sha256_transform (sha256_ctx_t *, uint8_t *) |
ICACHE_FLASH_ATTR void | sha256_init (sha256_ctx_t *context) |
ICACHE_FLASH_ATTR void | sha256_update (sha256_ctx_t *context, uint8_t *data, size_t len) |
ICACHE_FLASH_ATTR void | sha256_final (sha256_ctx_t *context, uint8_t digest[SHA256_DIGEST_LENGTH]) |
ICACHE_FLASH_ATTR char * | sha256_end (sha256_ctx_t *context, char buffer[SHA256_DIGEST_STRING_LENGTH]) |
ICACHE_FLASH_ATTR void | sha256_raw (uint8_t *data, size_t len, uint8_t digest[SHA256_DIGEST_LENGTH]) |
ICACHE_FLASH_ATTR char * | sha256_data (uint8_t *data, size_t len, char digest[SHA256_DIGEST_STRING_LENGTH]) |
Variables | |
static const uint32_t | K256 [64] |
static const uint32_t | sha256_initial_hash_value [8] |
static const char * | sha2_hex_digits = "0123456789abcdef" |
#define ADDINC128 | ( | w, | |
n | |||
) |
#define BYTE_ORDER LITTLE_ENDIAN |
#define Ch | ( | x, | |
y, | |||
z | |||
) | (((x) & (y)) ^ ((~(x)) & (z))) |
Definition at line 131 of file sha256.c.
Referenced by sha256_transform().
#define LITTLE_ENDIAN 1234 |
Copyright (c) 2000-2001 Aaron D. Gifford Copyright (c) 2013-2014 Pavol Rusnak All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTOR(S) ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define Maj | ( | x, | |
y, | |||
z | |||
) | (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) |
Definition at line 132 of file sha256.c.
Referenced by sha256_transform().
#define REVERSE32 | ( | w, | |
x | |||
) |
Definition at line 87 of file sha256.c.
Referenced by sha256_final().
#define REVERSE64 | ( | w, | |
x | |||
) |
Definition at line 92 of file sha256.c.
Referenced by sha256_final().
#define SHA256_SHORT_BLOCK_LENGTH (SHA256_BLOCK_LENGTH - 8) |
Definition at line 82 of file sha256.c.
Referenced by sha256_final().
Definition at line 135 of file sha256.c.
Referenced by sha256_transform().
Definition at line 137 of file sha256.c.
Referenced by sha256_transform().
Definition at line 136 of file sha256.c.
Referenced by sha256_transform().
Definition at line 138 of file sha256.c.
Referenced by sha256_transform().
ICACHE_FLASH_ATTR char* sha256_data | ( | uint8_t * | data, |
size_t | len, | ||
char | digest[SHA256_DIGEST_STRING_LENGTH] | ||
) |
Definition at line 430 of file sha256.c.
References sha256_end(), sha256_init(), and sha256_update().
ICACHE_FLASH_ATTR char* sha256_end | ( | sha256_ctx_t * | context, |
char | buffer[SHA256_DIGEST_STRING_LENGTH] | ||
) |
Definition at line 399 of file sha256.c.
References ICACHE_FLASH_ATTR, memset, SHA256_DIGEST_LENGTH, sha256_final(), and sha2_hex_digits.
Referenced by sha256_data().
ICACHE_FLASH_ATTR void sha256_final | ( | sha256_ctx_t * | context, |
uint8_t | digest[SHA256_DIGEST_LENGTH] | ||
) |
Definition at line 334 of file sha256.c.
References sha256_ctx_t::bitcount, sha256_ctx_t::buffer, ICACHE_FLASH_ATTR, memcpy, memset, REVERSE32, REVERSE64, SHA256_BLOCK_LENGTH, SHA256_SHORT_BLOCK_LENGTH, sha256_transform(), and sha256_ctx_t::state.
Referenced by hmac_sha256_final(), sha256_end(), and sha256_raw().
ICACHE_FLASH_ATTR void sha256_init | ( | sha256_ctx_t * | context | ) |
Definition at line 196 of file sha256.c.
References sha256_ctx_t::bitcount, sha256_ctx_t::buffer, ICACHE_FLASH_ATTR, memcpy, memset, SHA256_BLOCK_LENGTH, SHA256_DIGEST_LENGTH, sha256_initial_hash_value, and sha256_ctx_t::state.
Referenced by hmac_sha256_final(), hmac_sha256_init(), sha256_data(), and sha256_raw().
ICACHE_FLASH_ATTR void sha256_raw | ( | uint8_t * | data, |
size_t | len, | ||
uint8_t | digest[SHA256_DIGEST_LENGTH] | ||
) |
Definition at line 421 of file sha256.c.
References ICACHE_FLASH_ATTR, sha256_final(), sha256_init(), and sha256_update().
Referenced by hmac_sha256_init(), and init_aes_hmac_combined().
ICACHE_FLASH_ATTR void sha256_transform | ( | sha256_ctx_t * | context, |
uint8_t * | data | ||
) |
Definition at line 206 of file sha256.c.
References sha256_ctx_t::buffer, Ch, ICACHE_FLASH_ATTR, K256, Maj, Sigma0_256, sigma0_256, Sigma1_256, sigma1_256, and sha256_ctx_t::state.
Referenced by sha256_final(), and sha256_update().
ICACHE_FLASH_ATTR void sha256_update | ( | sha256_ctx_t * | context, |
uint8_t * | data, | ||
size_t | len | ||
) |
Definition at line 288 of file sha256.c.
References sha256_ctx_t::bitcount, sha256_ctx_t::buffer, ICACHE_FLASH_ATTR, memcpy, SHA256_BLOCK_LENGTH, and sha256_transform().
Referenced by hmac_sha256_final(), hmac_sha256_init(), hmac_sha256_update(), sha256_data(), and sha256_raw().
|
static |
Definition at line 156 of file sha256.c.
Referenced by sha256_transform().
|
static |
Definition at line 176 of file sha256.c.
Referenced by sha256_init().
|
static |
Definition at line 191 of file sha256.c.
Referenced by sha256_end().