CryptoAuthLib
Microchip CryptoAuthentication Library
sha2_routines.h
Go to the documentation of this file.
1 
28 #ifndef SHA2_ROUTINES_H
29 #define SHA2_ROUTINES_H
30 
31 #include <stdint.h>
32 
33 #define SHA256_DIGEST_SIZE (32)
34 #define SHA256_BLOCK_SIZE (64)
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 typedef struct
41 {
42  uint32_t total_msg_size;
43  uint32_t block_size;
44  uint8_t block[SHA256_BLOCK_SIZE * 2];
45  uint32_t hash[8];
47 
48 void sw_sha256_init(sw_sha256_ctx* ctx);
49 
50 void sw_sha256_update(sw_sha256_ctx* ctx, const uint8_t* message, uint32_t len);
51 
52 void sw_sha256_final(sw_sha256_ctx * ctx, uint8_t digest[SHA256_DIGEST_SIZE]);
53 
54 void sw_sha256(const uint8_t * message, unsigned int len, uint8_t digest[SHA256_DIGEST_SIZE]);
55 
56 #ifdef __cplusplus
57 }
58 #endif
59 
60 #endif // SHA2_ROUTINES_H
61 
void sw_sha256(const uint8_t *message, unsigned int len, uint8_t digest[SHA256_DIGEST_SIZE])
single call convenience function which computes Hash of given data using SHA256 software ...
Definition: sha2_routines.c:248
#define SHA256_BLOCK_SIZE
Definition: sha2_routines.h:34
#define SHA256_DIGEST_SIZE
Definition: sha2_routines.h:33
void sw_sha256_final(sw_sha256_ctx *ctx, uint8_t digest[SHA256_DIGEST_SIZE])
completes the final SHA256 calculation and returns the final digest/hash
Definition: sha2_routines.c:202
uint32_t block_size
Number of bytes in current block.
Definition: sha2_routines.h:43
uint32_t total_msg_size
Total number of message bytes processed.
Definition: sha2_routines.h:42
void sw_sha256_update(sw_sha256_ctx *ctx, const uint8_t *message, uint32_t len)
updates the running hash with the next block of data, called iteratively for the entire stream of dat...
Definition: sha2_routines.c:167
Definition: sha2_routines.h:40
void sw_sha256_init(sw_sha256_ctx *ctx)
Intialize the software SHA256.
Definition: sha2_routines.c:144