1) whoever is correct ...
"whoever gave it to you" is a noun clause. The whole noun clause is the object, not just the word "whoever".
So the noun clause needs a subject...whoever, not whomever.
Here's an example of "whomever":
I'll return the tools to whomever you borrowed them from. (You borrowed the tools from s.o. = Direct object)