
#include <tee_internal_api.h>

// not real implementation
// only simulated behaviour

static volatile bool g_cancellation_masked = false;

extern bool GetCancellationFlag(void);

bool TEE_GetCancellationFlag(void) {
  return(!g_cancellation_masked && GetCancellationFlag());
}

bool TEE_UnmaskCancellation(void) {
  if (g_cancellation_masked) {
    g_cancellation_masked = false;
    return true;
  }
  return false;
}

bool TEE_MaskCancellation(void) {
  if (g_cancellation_masked) {
    return true;
  }
  g_cancellation_masked = true;
  return false;
}
