MD_GetHsmState

Retrieves the current state of the specified HSM.

Synopsis
#include <md.h>
MD_RV MD_GetHsmState(uint32 hsmIndex,
                     HsmState_t* pState,
                     uint32* pErrorCode);
Input Requirements

The message dispatch library has been initialized via the MD_Initialize() function.

Input Parameters
Parameter Description
hsmIndex Zero based index of the HSM to query. When MD_Initialize () is invoked the message dispatch library assigns an index to each available HSM.
pState Pointer to a variable to hold the HSM state. The pointer must not be NULL.
pErrorCode Not used: always return zero. The pointer may be NULL.
Output Requirements
Parameter Description
pState When the function returns, pState points to a variable containing one of the following values. These values are defined in hsmstate.h
Label Value Meaning
S_NORMAL_OPERATION 0x8000

The HSM is operational.

S_HSM_DISCONNECTED 2 No HSM detected.
S_HSM_ERASED 1 HSM Decommissioned.
S_TAMPER_RESPOND 3 HSM is in Tampered State.

NOTE   Any other value indicates a non-operational HSM

pErrorCode Error code can be ignored.

The function returns the following codes:

Function Code Qualification
MDR_OK No error
MDR_UNSUCCESSFUL Error in operation. Operation failed.
MDR_NOT_INITIALIZE The message dispatch library was not previously initialized successfully
MDR_INVALID_HSM_INDEX HSM index was not in the range of accessible HSMs