|
rcbench
Servo and ESC test bench: panel, IOmcu and shared C
|
SHA-256, written from FIPS 180-4: the constants of section 4.2.2, the initial hash value of section 5.3.3, the padding of section 5.1.1 and the computation of section 6.2.2. More...
Functions | |
| static uint32_t | rotr (uint32_t x, unsigned n) |
| Rotate a 32-bit word right. | |
| static void | compress (uint32_t h[8], const uint8_t block[64]) |
| One 512-bit block (section 6.2.2, steps 1 to 4). | |
| void | link_sha256_init (link_sha256_t *s) |
| Start a computation: set the initial hash value and clear the state. | |
| void | link_sha256_update (link_sha256_t *s, const void *data, size_t len) |
Fold len bytes in. data may be NULL when len is 0. | |
| void | link_sha256_final (link_sha256_t *s, uint8_t out[LINK_SHA256_BYTES]) |
Pad, finish and write the 32-byte digest. s is spent afterwards. | |
| void | link_sha256 (const void *data, size_t len, uint8_t out[LINK_SHA256_BYTES]) |
The digest of len bytes in one call. | |
Variables | |
| static const uint32_t | k_round [64] |
| The first 32 bits of the fractional parts of the cube roots of the first 64 primes (section 4.2.2). | |
SHA-256, written from FIPS 180-4: the constants of section 4.2.2, the initial hash value of section 5.3.3, the padding of section 5.1.1 and the computation of section 6.2.2.
SPDX-License-Identifier: MIT
|
static |
One 512-bit block (section 6.2.2, steps 1 to 4).
| h | The eight 32-bit hash words, updated in place. |
| block | The 64 bytes of the block. |
| void link_sha256 | ( | const void * | data, |
| size_t | len, | ||
| uint8_t | out[LINK_SHA256_BYTES] ) |
The digest of len bytes in one call.
| data | The bytes to digest; may be NULL when len is 0. |
| len | Number of bytes in data. |
| out | Receives the 32-byte digest. |
| void link_sha256_final | ( | link_sha256_t * | s, |
| uint8_t | out[LINK_SHA256_BYTES] ) |
Pad, finish and write the 32-byte digest. s is spent afterwards.
| s | The state, from link_sha256_init() and link_sha256_update(). |
| out | Receives the 32-byte digest. |
| void link_sha256_init | ( | link_sha256_t * | s | ) |
Start a computation: set the initial hash value and clear the state.
| s | The state to set up. NULL does nothing. |
| void link_sha256_update | ( | link_sha256_t * | s, |
| const void * | data, | ||
| size_t | len ) |
Fold len bytes in. data may be NULL when len is 0.
| s | The state, from link_sha256_init(). |
| data | The bytes to fold in; may be NULL when len is 0. |
| len | Number of bytes in data. |
|
static |
Rotate a 32-bit word right.
| x | The word to rotate. |
| n | Bit count; the callers pass 2 to 25. |
|
static |
The first 32 bits of the fractional parts of the cube roots of the first 64 primes (section 4.2.2).