The general solution of the anomaly consistency condition (Wess-Zumino equation) has been found recently for Yang-Mills gauge theory. The general form of the counterterms arising in the renormalization of gauge-invariant operators (Kluberg-Stern and Zuber conjecture) and in gauge theories of the Yang-Mills type with non-power counting renormalizable couplings has also been worked out in any number of space-time dimensions. This Physics Report is devoted to reviewing in a self-contained manner these results and their proofs. This involves computing cohomology groups of the differential introduced by Becchi, Rouet, Stora and Tyutin, with the sources of the BRST variations of the fields (“antifields”) included in the problem. Applications of this computation to other physical questions (classical deformations of the action, conservation laws) are also considered. The general algebraic techniques developed in the Report can be applied to other gauge theories, for which relevant references are given.