/* If none of the handlers return an error, then EFI_SUCCESS is returned. The handlers those satisfy AuthenticationOperation will only be executed. The handlers are executed in same order to their registered order. */
EFI_STATUS EFIAPI ExecuteSecurity2Handlers(IN UINT32 AuthenticationOperation, IN UINT32 AuthenticationStatus, IN CONST EFI_DEVICE_PATH_PROTOCOL *File OPTIONAL, IN VOID *FileBuffer, IN UINTN FileSize, IN BOOLEAN BootPolicy)
/* If none of the handlers return an error, then EFI_SUCCESS is returned. The handlers those satisfy AuthenticationOperation will only be executed. The handlers are executed in same order to their registered order. */
EFI_STATUS EFIAPI ExecuteSecurity2Handlers(IN UINT32 AuthenticationOperation, IN UINT32 AuthenticationStatus, IN CONST EFI_DEVICE_PATH_PROTOCOL *File OPTIONAL, IN VOID *FileBuffer, IN UINTN FileSize, IN BOOLEAN BootPolicy)
{
  UINT32      Index;
  EFI_STATUS  Status;
  if ((File == NULL) && (FileBuffer == NULL)) {
    return EFI_INVALID_PARAMETER;
  }
  if (mNumberOfSecurity2Handler == 0) {
    return EFI_SUCCESS;
  }
  for (Index = 0; Index < mNumberOfSecurity2Handler; Index++) {
    if (((FileBuffer != NULL) && ((mSecurity2Table[Index].Security2Operation & EFI_AUTH_IMAGE_OPERATION_MASK) != 0)) ||
        ((FileBuffer == NULL) && ((mSecurity2Table[Index].Security2Operation & EFI_AUTH_NONE_IMAGE_OPERATION_MASK) != 0)))
    {
      if ((mSecurity2Table[Index].Security2Operation & AuthenticationOperation) != 0) {
        Status = mSecurity2Table[Index].Security2Handler (
                                          AuthenticationStatus,
                                          File,
                                          FileBuffer,
                                          FileSize,
                                          BootPolicy
                                          );
        if (EFI_ERROR (Status)) {
          return Status;
        }
      }
    }
  }
  return EFI_SUCCESS;
}