![]() |
ISARA Quantum Resistant Toolkit
Version 1.1
Quantum resistant cryptographic primitives and algorithms.
|
#include <iqr_hash.h>
Data Fields | |
iqr_retval(* | initialize )(void **state) |
iqr_retval(* | begin )(void *state) |
iqr_retval(* | update )(void *state, const uint8_t *data, size_t size) |
iqr_retval(* | end )(void *state, uint8_t *digest, size_t size) |
iqr_retval(* | cleanup )(void **state) |
iqr_retval(* begin) (void *state) |
Begin a hashing operation.
Called when hashing is about to begin. If the algorithm needs state, begin()
must allocate and initialize the state data.
[in] | state | Hash state, maintained by the implementation. |
IQR_OK
or a suitable error value. iqr_retval(* cleanup) (void **state) |
Clean up the Hash.
Perform any clean up required before the Hash is destroyed, including zeroing and deallocating any state.
If cleanup()
returns an error value, the Hash object will be zeroed and deallocated; be sure that your cleanup()
deallocates any memory allocated by your initialize()
.
[in,out] | state | Hash state, maintained by the implementation. |
IQR_OK
or a suitable error value. iqr_retval(* end) (void *state, uint8_t *digest, size_t size) |
End the hashing operation and retrieve the digest.
Called to finalize hashing and retrieve the digest. The digest and size parameters are optional and can be NULL
.
[in,out] | state | Hash state, maintained by the implementation. |
[in] | digest | Buffer to receive the digest. |
[in] | size | The size of the digest buffer in bytes. |
IQR_OK
or a suitable error value. iqr_retval(* initialize) (void **state) |
Initialize the Hash.
Called to initialize the Hash object. Allocate any necessary state here.
If initialize()
returns an error value, the call to iqr_HashCreate()
will return the failure value without allocating memory.
[out] | state | Pointer to Hash state, maintained by the implementation. |
IQR_OK
or a suitable error value. iqr_retval(* update) (void *state, const uint8_t *data, size_t size) |
Add data to the hashing operation.
Called when data needs to be hashed.
[in] | state | Hash state. |
[in] | data | Buffer containing bytes to hash. |
[in] | size | The size of data in bytes. |
IQR_OK
or a suitable error value. Callbacks required for Hash implementations.
You can supply your own SHA-2 or SHA-3 by implementing these functions; for example, you could take advantage of OpenSSL's hand-tuned assembly versions. See the Developer's Guide for details.