/* Checks availability of HW AES key. 
This function checks if the AES key is present at dedicated hardware bus and can be used at actual security level. */
static status_t hashcrypt_check_need_key(HASHCRYPT_Type *base, hashcrypt_handle_t *handle)
/* Checks availability of HW AES key. 
This function checks if the AES key is present at dedicated hardware bus and can be used at actual security level. */
static status_t hashcrypt_check_need_key(HASHCRYPT_Type *base, hashcrypt_handle_t *handle)
{
    if (handle->keyType == kHASHCRYPT_SecretKey)
    {
        volatile uint32_t wait = 50u;
        while ((wait > 0U) && (base->STATUS == 0U))
        {
            wait--;
        }
        if (0U == (base->STATUS & HASHCRYPT_STATUS_NEEDKEY_MASK))
        {
            return kStatus_Success;
        }
        return kStatus_Fail;
    }
    else
    {
        return kStatus_Success;
    }
}