Defines | |
#define | C4E_SHA1_DIGEST_LEN |
#define | C4E_SHA1_BLOCK_LEN |
#define | C4E_SHA1_CTX_WORDS |
#define | C4E_SHA1_TMP_WORDS |
#define | C4E_SHA1_MEM_WORDS |
#define | C4E_SHA224_DIGEST_LEN |
#define | C4E_SHA256_DIGEST_LEN |
#define | C4E_SHA2_BLOCK_LEN |
#define | C4E_SHA2_CTX_WORDS |
#define | C4E_SHA2_TMP_WORDS |
#define | C4E_SHA2_MEM_WORDS |
Functions | |
void | c4e_sha1_start (C4eAlgo32Uint ctx[C4E_SHA1_CTX_WORDS]) |
Start of SHA-1. | |
void | c4e_sha1_next (C4eAlgo32Uint ctx[C4E_RESTRICT C4E_SHA1_CTX_WORDS], C4eAlgo32Uint wtmp[C4E_RESTRICT C4E_SHA1_TMP_WORDS], C4E_CONST void *C4E_RESTRICT next) |
Processes the next data block of 64 bytes (C4E_SHA1_BLOCK_LEN) with SHA-1. | |
void | c4e_sha1_stop (C4eAlgo32Uint ctx[C4E_RESTRICT C4E_SHA1_CTX_WORDS], C4eAlgo32Uint wtmp[C4E_RESTRICT C4E_SHA1_TMP_WORDS], C4E_CONST void *C4E_RESTRICT last, C4eArchUint len, C4eArchUint8 digest[C4E_RESTRICT C4E_SHA1_DIGEST_LEN]) |
Processes the last SHA-1 data block (possibly of length zero) and returns the SHA-1 digest. | |
void | c4e_sha1_mem (C4eAlgo32Uint tmp[C4E_RESTRICT C4E_SHA1_MEM_WORDS], C4E_CONST void *C4E_RESTRICT mem, C4eArchSize len, C4eArchUint8 digest[C4E_RESTRICT C4E_SHA1_DIGEST_LEN]) |
This is an all-in-one function for the sandwich c4e_sha1_start(), c4e_sha1_next() and c4e_sha1_stop(), which computes the SHA-1 digest over a memory area. | |
void | c4e_sha2_start (C4eAlgo32Uint ctx[C4E_SHA2_CTX_WORDS], C4eHashId hid) |
Start of SHA-224 or SHA-256. | |
void | c4e_sha2_next (C4eAlgo32Uint ctx[C4E_RESTRICT C4E_SHA2_CTX_WORDS], C4eAlgo32Uint wtmp[C4E_RESTRICT C4E_SHA2_TMP_WORDS], C4E_CONST void *C4E_RESTRICT next) |
Processes the next data block of 64 bytes (C4E_SHA2_BLOCK_LEN) with SHA-256 or SHA224. | |
void | c4e_sha2_stop (C4eAlgo32Uint ctx[C4E_RESTRICT C4E_SHA2_CTX_WORDS], C4eAlgo32Uint wtmp[C4E_RESTRICT C4E_SHA2_TMP_WORDS], C4E_CONST void *C4E_RESTRICT last, C4eArchUint len, C4eArchUint8 digest[C4E_RESTRICT C4E_SHA256_DIGEST_LEN]) |
Processes the last SHA-224 or SHA-256 data block (possibly of length zero) and returns the digest. | |
void | c4e_sha2_mem (C4eAlgo32Uint tmp[C4E_RESTRICT C4E_SHA2_MEM_WORDS], C4eHashId hid, C4E_CONST void *C4E_RESTRICT mem, C4eArchSize len, C4eArchUint8 digest[C4E_RESTRICT C4E_SHA256_DIGEST_LEN]) |
This is an all-in-one function for the sandwich c4e_sha2_start(), c4e_sha2_next() and c4e_sha2_stop(), which computes the SHA-256/224 digest over a memory area. |
#define C4E_SHA1_DIGEST_LEN |
#define C4E_SHA1_BLOCK_LEN |
#define C4E_SHA1_CTX_WORDS |
Number of C4eAlgo32Uint context words to be passed to SHA-1 routines.
#define C4E_SHA1_TMP_WORDS |
Number of C4eAlgo32Uint words to be used for temporary space in SHA-1 routines.
#define C4E_SHA1_MEM_WORDS |
Number of C4eAlgo32Uint words needed by c4e_sha1_mem().
#define C4E_SHA224_DIGEST_LEN |
#define C4E_SHA256_DIGEST_LEN |
#define C4E_SHA2_BLOCK_LEN |
#define C4E_SHA2_CTX_WORDS |
Number of C4eAlgo32Uint context words to be passed to SHA-2 routines.
#define C4E_SHA2_TMP_WORDS |
Number of C4eAlgo32Uint words to be used for temporary space in SHA-2 routines.
#define C4E_SHA2_MEM_WORDS |
Number of C4eAlgo32Uint words needed by c4e_sha2_mem().
void c4e_sha1_start | ( | C4eAlgo32Uint | ctx[C4E_SHA1_CTX_WORDS] | ) |
Start of SHA-1.
ctx
is transparent to the user, except the memory space to be provided.ctx
must point to pre-allocated memory space of at least C4E_SHA1_CTX_WORDS elements, each of C4eAlgo32Uint size.[out] | ctx | A working context with memory space provided by the user. The returned context from this function must be passed to c4e_sha1_next() and c4e_sha1_stop(). |
void c4e_sha1_next | ( | C4eAlgo32Uint | ctx[C4E_RESTRICT C4E_SHA1_CTX_WORDS], | |
C4eAlgo32Uint | wtmp[C4E_RESTRICT C4E_SHA1_TMP_WORDS], | |||
C4E_CONST void *C4E_RESTRICT | next | |||
) |
Processes the next data block of 64 bytes (C4E_SHA1_BLOCK_LEN) with SHA-1.
ctx
here. [in,out] | ctx | Context as prepared by function c4e_sha1_start(), which must be persistent between successive calls. |
wtmp | Temporary space used for processing of array w [] and backup of H values (must not be persistent between successive calls). | |
[in] | next | The next data block (of C4E_SHA1_BLOCK_LEN bytes) to be processed. |
void c4e_sha1_stop | ( | C4eAlgo32Uint | ctx[C4E_RESTRICT C4E_SHA1_CTX_WORDS], | |
C4eAlgo32Uint | wtmp[C4E_RESTRICT C4E_SHA1_TMP_WORDS], | |||
C4E_CONST void *C4E_RESTRICT | last, | |||
C4eArchUint | len, | |||
C4eArchUint8 | digest[C4E_RESTRICT C4E_SHA1_DIGEST_LEN] | |||
) |
Processes the last SHA-1 data block (possibly of length zero) and returns the SHA-1 digest.
ctx
here.[in] | ctx | Context as passed to c4e_sha1_start() and c4e_sha1_next(), which must be persistent between function calls. |
wtmp | Temporary space used for processing of array w [] and backup of H values (must not be persistent with respect to c4e_sha1_next()). | |
[in] | last | The last data block to be processed. |
[in] | len | Length of last block (0...C4E_SHA1_BLOCK_LEN bytes) |
[out] | digest | Pointer to buffer which gets the SHA-1 message digest. Notice that this pointer is allowed to alias wtmp . |
void c4e_sha1_mem | ( | C4eAlgo32Uint | tmp[C4E_RESTRICT C4E_SHA1_MEM_WORDS], | |
C4E_CONST void *C4E_RESTRICT | mem, | |||
C4eArchSize | len, | |||
C4eArchUint8 | digest[C4E_RESTRICT C4E_SHA1_DIGEST_LEN] | |||
) |
This is an all-in-one function for the sandwich c4e_sha1_start(), c4e_sha1_next() and c4e_sha1_stop(), which computes the SHA-1 digest over a memory area.
len
is less than this limit (including an extra block inserted for padding).tmp | Temporary used memory space, provided by the caller. | |
[in] | mem | Pointer to start of memory area, for which a SHA-1 digest is calculated. If len is zero, then it is allowed to set mem NULL. |
[in] | len | Length of memory area in bytes. |
[out] | digest | Pointer to buffer which gets the SHA-1 message digest. Notice that this pointer is allowed to alias tmp . |
void c4e_sha2_start | ( | C4eAlgo32Uint | ctx[C4E_SHA2_CTX_WORDS], | |
C4eHashId | hid | |||
) |
Start of SHA-224 or SHA-256.
ctx
is transparent to the user, except the memory space to be provided.ctx
must point to pre-allocated memory space of at least C4E_SHA2_CTX_WORDS elements, each of C4eAlgo32Uint size.[out] | ctx | A working context with memory space provided by the user. The returned context from this function must be passed to c4e_sha2_next() and c4e_sha2_stop(). |
[in] | hid | Hash algorithm identifier, which must be C4eHashId::C4eHashIdSha224 or C4eHashId::C4eHashIdSha256. |
void c4e_sha2_next | ( | C4eAlgo32Uint | ctx[C4E_RESTRICT C4E_SHA2_CTX_WORDS], | |
C4eAlgo32Uint | wtmp[C4E_RESTRICT C4E_SHA2_TMP_WORDS], | |||
C4E_CONST void *C4E_RESTRICT | next | |||
) |
Processes the next data block of 64 bytes (C4E_SHA2_BLOCK_LEN) with SHA-256 or SHA224.
ctx
here. [in,out] | ctx | Context as prepared by function c4e_sha2_start(), which must be persistent between successive calls. |
wtmp | Temporary space used for processing of array w [] and backup of H values (must not be persistent between successive calls). | |
[in] | next | The next data block (of C4E_SHA2_BLOCK_LEN bytes) to be processed. |
void c4e_sha2_stop | ( | C4eAlgo32Uint | ctx[C4E_RESTRICT C4E_SHA2_CTX_WORDS], | |
C4eAlgo32Uint | wtmp[C4E_RESTRICT C4E_SHA2_TMP_WORDS], | |||
C4E_CONST void *C4E_RESTRICT | last, | |||
C4eArchUint | len, | |||
C4eArchUint8 | digest[C4E_RESTRICT C4E_SHA256_DIGEST_LEN] | |||
) |
Processes the last SHA-224 or SHA-256 data block (possibly of length zero) and returns the digest.
ctx
here.[in] | ctx | Context as passed to c4e_sha2_start() and c4e_sha2_next(), which must be persistent between function calls. |
wtmp | Temporary space used for processing of array w [] and backup of H values (must not be persistent with respect to c4e_sha2_next()). | |
[in] | last | The last data block to be processed. |
[in] | len | Length of last block (0...C4E_SHA2_BLOCK_LEN bytes) |
[out] | digest | Pointer to buffer which gets the SHA-224/256 message digest (for SHA-224 only the first C4E_SHA224_DIGEST_LEN bytes are valid). Notice that this pointer is allowed to alias wtmp . |
void c4e_sha2_mem | ( | C4eAlgo32Uint | tmp[C4E_RESTRICT C4E_SHA2_MEM_WORDS], | |
C4eHashId | hid, | |||
C4E_CONST void *C4E_RESTRICT | mem, | |||
C4eArchSize | len, | |||
C4eArchUint8 | digest[C4E_RESTRICT C4E_SHA256_DIGEST_LEN] | |||
) |
This is an all-in-one function for the sandwich c4e_sha2_start(), c4e_sha2_next() and c4e_sha2_stop(), which computes the SHA-256/224 digest over a memory area.
len
is less than this limit (including an extra block inserted for padding).tmp | Temporary used memory space, provided by the caller. | |
[in] | hid | Hash algorithm identifier, which must be C4eHashId::C4eHashIdSha224 or C4eHashId::C4eHashIdSha256. |
[in] | mem | Pointer to start of memory area, for which a SHA-256 or SHA-224 digest shall be calculated. If len is zero, then it is allowed to set mem NULL. |
[in] | len | Length of memory area in bytes. |
[out] | digest | Pointer to buffer which gets the SHA-224/256 message digest (for SHA-224 only the first C4E_SHA224_DIGEST_LEN bytes are valid). Notice that this pointer is allowed to alias tmp . |