
ISARA Radiate™ Quantum-safe Library Version 3.1
Quantum-safe cryptographic primitives and algorithms.
#include <iqr_hash.h>
Data Fields | |
iqr_retval(* | initialize )(void **state) |
Initialize the Hash. More... | |
iqr_retval(* | begin )(void *state) |
Begin a hashing operation. More... | |
iqr_retval(* | update )(void *state, const uint8_t *buf, size_t buf_size) |
Add data to the hashing operation. More... | |
iqr_retval(* | end )(void *state, uint8_t *digest, size_t digest_size) |
End the hashing operation and retrieve the digest. More... | |
iqr_retval(* | cleanup )(void **state) |
Clean up the Hash. More... | |
Field Documentation
◆ begin
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.
- Parameters
-
[in] state Hash state, maintained by the implementation.
- Returns
IQR_OK
on success, or another value from iqr_retval.h if an error occurs.
◆ cleanup
iqr_retval(* cleanup(void **state) |
Clean up the Hash.
Perform any clean up required before the Hash is destroyed, including clearing and deallocating any state.
If cleanup()
returns an error value, the Hash object will be cleared and deallocated; be sure that your cleanup()
deallocates any memory allocated by your initialize()
.
- Parameters
-
[in,out] state Hash state, maintained by the implementation.
- Returns
IQR_OK
on success, or another value from iqr_retval.h if an error occurs.
◆ end
iqr_retval(* end(void *state, uint8_t *digest, size_t digest_size) |
End the hashing operation and retrieve the digest.
Called to finalize hashing and retrieve the digest.
- Parameters
-
[in] state Hash state, maintained by the implementation. [out] digest A buffer to receive the digest. [in] digest_size The size of digest in bytes. Must be exactly the size returned by iqr_HashGetDigestSize()
.
- Returns
IQR_OK
on success, or another value from iqr_retval.h if an error occurs.
◆ initialize
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.
- Parameters
-
[out] state Hash state, maintained by the implementation.
- Returns
IQR_OK
on success, or another value from iqr_retval.h if an error occurs.
◆ update
iqr_retval(* update(void *state, const uint8_t *buf, size_t buf_size) |
Add data to the hashing operation.
Called when data needs to be hashed.
- Parameters
-
[in] state Hash state, maintained by the implementation. [in] buf A buffer containing bytes to hash. [in] buf_size The size of buf in bytes.
- Returns
IQR_OK
on success, or another value from iqr_retval.h if an error occurs.
Detailed Description
Callbacks required for Hash implementations.
You can supply your own hash algorithm by implementing these functions; for example, you could take advantage of OpenSSL's hand-tuned assembly versions. See the Developer's Guide (online) for details.