That's half the NSA's mission. Tt has another half and that is eavesdropping and getting into things. Those two missions are at odds with each other, and so the NSA has to make decisions about trade-offs. As these incidents show, the trade-offs the NSA has chosen to make have turned out to have been bad ideas.
The NSA has a specific mission to secure the nation's infrastructure. In witholding key information from US companies, it's failing that mission.