It was wrong before and still wrong though.
For example, you haven't explained why you feel that a torpedo for an Iranian warship in international waters is a war crime, but sinking Iranian warships at the pier in Iranian waters is not.
The U.S. did even less for shipwrecked survivors in the latter case than in the former. Why are bombs and cruise missiles to sink ships from destroyers 800 nm away not also war crimes in your mind?
Is it also a war crime when Ukraine sinks Russian navy ships at their piers with USVs or cruise missiles with no ability to recover survivors? (Hint: no, it's not)