Driver for the cc2538 SHA-256 mode of the security core.
More...
|
file | sha256.c |
| Implementation of the cc2538 SHA-256 driver.
|
|
file | sha256.h |
| Header file for the cc2538 SHA-256 driver.
|
|
|
static uint8_t | new_hash (sha256_state_t *state, const void *data, void *hash) |
| Starts a new hash session in hardware. More...
|
|
static uint8_t | resume_hash (sha256_state_t *state, const void *data, void *hash) |
| Resumes an already started hash session in hardware. More...
|
|
|
uint8_t | sha256_init (sha256_state_t *state) |
| Initializes the hash state. More...
|
|
uint8_t | sha256_process (sha256_state_t *state, const void *data, uint32_t len) |
| Processes a block of memory through the hash. More...
|
|
uint8_t | sha256_done (sha256_state_t *state, void *hash) |
| Terminates hash session to get the digest. More...
|
|
Driver for the cc2538 SHA-256 mode of the security core.
◆ new_hash()
static uint8_t new_hash |
( |
sha256_state_t * |
state, |
|
|
const void * |
data, |
|
|
void * |
hash |
|
) |
| |
|
static |
Starts a new hash session in hardware.
- Parameters
-
state | Hash state |
data | Pointer to input message |
hash | Destination of the hash (32 bytes) |
- Returns
CRYPTO_SUCCESS
if successful, or CRYPTO/SHA256 error code
Definition at line 63 of file sha256.c.
◆ resume_hash()
static uint8_t resume_hash |
( |
sha256_state_t * |
state, |
|
|
const void * |
data, |
|
|
void * |
hash |
|
) |
| |
|
static |
Resumes an already started hash session in hardware.
- Parameters
-
state | Hash state |
data | Pointer to the input message |
hash | Pointer to the destination of the hash (32 bytes) |
- Returns
CRYPTO_SUCCESS
if successful, or CRYPTO/SHA256 error code
Definition at line 140 of file sha256.c.
◆ sha256_done()
uint8_t sha256_done |
( |
sha256_state_t * |
state, |
|
|
void * |
hash |
|
) |
| |
Terminates hash session to get the digest.
- Parameters
-
state | Pointer to hash state |
hash | Pointer to hash |
- Returns
CRYPTO_SUCCESS
if successful, or CRYPTO/SHA256 error code
- Note
- This function must be called only after
sha256_process()
.
Definition at line 320 of file sha256.c.
◆ sha256_init()
uint8_t sha256_init |
( |
sha256_state_t * |
state | ) |
|
Initializes the hash state.
- Parameters
-
state | Pointer to hash state to initialize |
- Returns
CRYPTO_SUCCESS
if successful, or CRYPTO/SHA256 error code
Definition at line 229 of file sha256.c.
◆ sha256_process()
uint8_t sha256_process |
( |
sha256_state_t * |
state, |
|
|
const void * |
data, |
|
|
uint32_t |
len |
|
) |
| |
Processes a block of memory through the hash.
- Parameters
-
state | Pointer to hash state |
data | Pointer to the data to hash |
len | Length of the data to hash in bytes (octets) |
- Returns
CRYPTO_SUCCESS
if successful, or CRYPTO/SHA256 error code
- Note
- This function must be called only after
sha256_init()
.
Definition at line 243 of file sha256.c.