Humanae Vitae is online at the Vatican site, and the text highlighted below is © Copyright – Libreria Editrice Vaticana.
Strong words in the last few sections of HV, but if there is a pure medical reason for a procedure or treatment that blocks conception, this is acceptable. As you see in the note, this teaching dates to the 1950’s.
15. On the other hand, the Church does not consider at all illicit the use of those therapeutic means necessary to cure bodily diseases, even if a foreseeable impediment to procreation should result there from—provided such impediment is not directly intended for any motive whatsoever. (See Pius XII, Address to 26th Congress of Italian Association of Urology: AAS 45 (1953), 674-675; to Society of Hematology: AAS 50 (1958), 734-735 [TPS VI, 394-395].)