In this paper we carry out a vertical differentiation duopoly model applied to pharmaceutical markets to analyze how endogenous and exogenous generic reference pricing influence competition between generic and branded drugs producers. Unlike the literature, we characterize for the exogenous case the equilibrium prices for all feasible relevant reference prices. Competition is enhanced after the introduction of a reference pricing system. We also compare both reference pricing systems on welfare grounds, assuming two different objective functions for health authorities: (i) standard social welfare and (ii) gross consumer surplus net of total pharmaceutical expenditures. We show that regardless of the objective function, health authorities will never choose endogenous reference pricing. When health authorities are paternalistic, the exogenous reference price that maximizes standard social welfare is such that the price of the generic drug is the reference price while the price of the branded drug is higher than the reference price. When health authorities are not paternalistic, the optimal exogenous reference price is such that the price of the branded drug is the reference price while the price of the generic drug is lower than the reference price.