CycloneBOOT 2.6.6
Secure Bootloader for ARM Cortex-M MCU
Loading...
Searching...
No Matches
crc32.h
Go to the documentation of this file.
1
31#ifndef _CRC32_H
32#define _CRC32_H
33
34// Dependencies
35#include "core/crypto.h"
36
37// CRC32 block size
38#define CRC32_BLOCK_SIZE 64
39// CRC32 digest size
40#define CRC32_DIGEST_SIZE 4
41// Minimum length of the padding string
42#define CRC32_MIN_PAD_SIZE 9
43// CRC32 algorithm object identifier
44#define CRC32_OID crc32Oid
45// Common interface for hash algorithms
46#define CRC32_HASH_ALGO (&crc32HashAlgo)
47
48// C++ guard
49#ifdef __cplusplus
50extern "C"
51{
52#endif
53
58typedef struct
59{
60 uint32_t digest;
62
63// CRC32 related constants
64extern const HashAlgo crc32HashAlgo;
65
66// CycloneBOOT CRC32 related functions
67error_t crc32Compute(const void *data, size_t length, uint8_t *digest);
68void crc32Init(Crc32Context *context);
69void crc32Update(Crc32Context *context, const void *data, size_t length);
70void crc32Final(Crc32Context *context, uint8_t *digest);
71void crc32FinalRaw(Crc32Context *context, uint8_t *digest);
72void crc32ProcessBlock(Crc32Context *context);
73
74// C++ guard
75#ifdef __cplusplus
76}
77#endif
78
79#endif
void crc32Final(Crc32Context *context, uint8_t *digest)
Finish the CRC32 message digest.
Definition crc32.c:161
error_t crc32Compute(const void *data, size_t length, uint8_t *digest)
Digest a message using CRC32.
Definition crc32.c:99
void crc32Init(Crc32Context *context)
Initialize CRC32 message digest context.
Definition crc32.c:119
void crc32Update(Crc32Context *context, const void *data, size_t length)
Update the CRC32 context with a portion of the message being hashed.
Definition crc32.c:132
CRC32 algorithm context.
Definition crc32.h:59
uint32_t digest
CRC32 digest.
Definition crc32.h:60