Penetration and Diffusion of Hard X-Rays through Thick Barriers. I. The Approach to Spectral Equilibrium