Exhibit 23.1

Consent of Independent Registered Public Accounting Firm

The Board of Directors

NuStar GP, LLC:

We consent to the use of our reports with respect to the consolidated balance sheets of NuStar Energy L.P. and subsidiaries as of December 31, 2017 and 2016, and the related consolidated statements of income, comprehensive income, cash flows, and partners’ equity for each of the years in the three-year period ended December 31, 2017 and the effectiveness of internal control over financial reporting as of December 31, 2017 incorporated by reference herein.

/s/ KPMG LLP

San Antonio, Texas

July 23, 2018