Counterfeiting of chips is such a big problem that the US DARPA has a major program to develop tiny cryptographic chips that can be embedded inside chip packages to prove their authenticity. It's called the SHIELD program (solicitation number DARPA-BAA-14-16 if you want to ask for money).
I'm not an EE, but I imagine that a much better solution would be a universal device where you can connect a chip and run a publicly available test suite against the chip to confirm that is performs as expected.
Like @wyager, I'm extremely skeptical of a program like SHIELD.
They think that the embedded chip (which they call a dielet), which responds to a crytographic challenge from a handheld device on an assembly line, can avoid testing, which is much more time consuming and complicated. To test, you need to connect the device's pins to something and power it on. These devices are for military systems: you'll need to test lifespan and performance under a variety of environmental conditions. I don't know if the dielet idea will work out, but it's specifically to verify authenticity without having to test.
A public test suite wouldn't reveal features introduced by a hostile foreign government, such as a security backdoor that only activated in response to a secret key too long to brute force. Presumably for DARPA this is a worry.
Agree a public test suite would be good for other fake component risks though.
Both. Counterfeiting, or substituting recycled parts, can be for economic reasons, or can be a hostile government that managed to substitute its hardware into the supply chain, for sabotage or to create backdoors.