/* Compute BnA to the BnP-th power modulo BnM. Please note, all "out" Big number arguments should be properly initialized by calling to BigNumInit() or BigNumFromBin() functions. */
BOOLEAN EFIAPI BigNumExpMod(IN CONST VOID *BnA, IN CONST VOID *BnP, IN CONST VOID *BnM, OUT VOID *BnRes)
/* Compute BnA to the BnP-th power modulo BnM. Please note, all "out" Big number arguments should be properly initialized by calling to BigNumInit() or BigNumFromBin() functions. */
BOOLEAN EFIAPI BigNumExpMod(IN CONST VOID *BnA, IN CONST VOID *BnP, IN CONST VOID *BnM, OUT VOID *BnRes)
{
  BOOLEAN  RetVal;
  BN_CTX   *Ctx;
  Ctx = BN_CTX_new ();
  if (Ctx == NULL) {
    return FALSE;
  }
  RetVal = (BOOLEAN)BN_mod_exp (BnRes, BnA, BnP, BnM, Ctx);
  BN_CTX_free (Ctx);
  return RetVal;
}