ISARA Radiate Security Solution Suite Toolkit Edition Version 1.5

Quantum-safe cryptographic primitives and algorithms.

iqr_HashCallbacks Struct Reference

#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]stateHash state, maintained by the implementation.
Returns
IQR_OK or a suitable error value.

◆ 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]stateHash state, maintained by the implementation.
Returns
IQR_OK or a suitable error value.

◆ 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. The digest and size parameters are optional and can be NULL.

Parameters
[in]stateHash state, maintained by the implementation.
[out]digestA buffer to receive the digest.
[in]digest_sizeThe size of digest in bytes. Must be exactly the size returned by iqr_HashGetDigestSize().
Returns
IQR_OK or a suitable error value.

◆ 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]statePointer to Hash state, maintained by the implementation.
Returns
IQR_OK or a suitable error value.

◆ 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]stateHash state.
[in]bufA buffer containing bytes to hash.
[in]buf_sizeThe size of buf in bytes.
Returns
IQR_OK or a suitable error value.

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: Toolkit edition, or Signature edition) for details.