Hardware-Accelerated Message Digests

Detailed Description

Generation and authentication of Message Digests (aka hashes) must be done in parts using the following sequence:

  • psa_drv_hash_setup_t
  • psa_drv_hash_update_t
  • psa_drv_hash_update_t
  • ...
  • psa_drv_hash_finish_t

If a previously started Message Digest operation needs to be terminated before the psa_drv_hash_finish_t operation is complete, it should be aborted by the psa_drv_hash_abort_t. Failure to do so may result in allocated resources not being freed or in other undefined behavior.

Typedefs

typedef struct psa_drv_hash_context_s psa_drv_hash_context_t
 The hardware-specific hash context structure.
 
typedef psa_status_t(* psa_drv_hash_setup_t) (psa_drv_hash_context_t *p_context)
 The function prototype for the start operation of a hash (message digest) operation.
 
typedef psa_status_t(* psa_drv_hash_update_t) (psa_drv_hash_context_t *p_context, const uint8_t *p_input, size_t input_length)
 The function prototype for the update operation of a hash (message digest) operation.
 
typedef psa_status_t(* psa_drv_hash_finish_t) (psa_drv_hash_context_t *p_context, uint8_t *p_output, size_t output_size, size_t *p_output_length)
 The function prototype for the finish operation of a hash (message digest) operation.
 
typedef void(* psa_drv_hash_abort_t) (psa_drv_hash_context_t *p_context)
 The function prototype for the abort operation of a hash (message digest) operation.
 

Typedef Documentation

typedef void(* psa_drv_hash_abort_t) (psa_drv_hash_context_t *p_context)

The function prototype for the abort operation of a hash (message digest) operation.

Functions that implement this prototype should be named in the following convention:

  • ~~~~~~~~~~~~~{.c} psa_drv_hash_<ALGO>_abort
  • ~~~~~~~~~~~~~ Where ALGO is the name of the underlying algorithm

    Parameters
    [in,out]p_contextA hardware-specific structure for the previously started hash operation to be aborted

Definition at line 144 of file crypto_accel_driver.h.

typedef struct psa_drv_hash_context_s psa_drv_hash_context_t

The hardware-specific hash context structure.

The contents of this structure are implementation dependent and are therefore not described here

Definition at line 63 of file crypto_accel_driver.h.

typedef psa_status_t(* psa_drv_hash_finish_t) (psa_drv_hash_context_t *p_context, uint8_t *p_output, size_t output_size, size_t *p_output_length)

The function prototype for the finish operation of a hash (message digest) operation.

Functions that implement this prototype should be named in the following convention:

  • ~~~~~~~~~~~~~{.c} psa_drv_hash_<ALGO>_finish
  • ~~~~~~~~~~~~~ Where ALGO is the name of the underlying algorithm

    Parameters
    [in,out]p_contextA hardware-specific structure for the previously started hash operation to be fiinished
    [out]p_outputA buffer where the generated digest will be placed
    [in]output_sizeThe size in bytes of the buffer that has been allocated for the p_output buffer
    [out]p_output_lengthThe number of bytes placed in p_output after success
    Return values
    PSA_SUCCESSSuccess.

Definition at line 126 of file crypto_accel_driver.h.

typedef psa_status_t(* psa_drv_hash_setup_t) (psa_drv_hash_context_t *p_context)

The function prototype for the start operation of a hash (message digest) operation.

Functions that implement this prototype should be named in the following convention:

  • ~~~~~~~~~~~~~{.c} psa_drv_hash_<ALGO>_setup
  • ~~~~~~~~~~~~~ Where ALGO is the name of the underlying hash function

    Parameters
    [in,out]p_contextA structure that will contain the hardware-specific hash context
    Return values
    PSA_SUCCESSSuccess.

Definition at line 80 of file crypto_accel_driver.h.

typedef psa_status_t(* psa_drv_hash_update_t) (psa_drv_hash_context_t *p_context, const uint8_t *p_input, size_t input_length)

The function prototype for the update operation of a hash (message digest) operation.

Functions that implement this prototype should be named in the following convention:

  • ~~~~~~~~~~~~~{.c} psa_drv_hash_<ALGO>_update
  • ~~~~~~~~~~~~~ Where ALGO is the name of the underlying algorithm

    Parameters
    [in,out]p_contextA hardware-specific structure for the previously-established hash operation to be continued
    [in]p_inputA buffer containing the message to be appended to the hash operation
    [in]input_lengthThe size in bytes of the input message buffer

Definition at line 99 of file crypto_accel_driver.h.