The cortex is the upper and/or lower layer of a lichen composed entirely of gelatinized fungal cells.  It offers protection to the rest of the lichen.

In this cross section of Pseduocyphellaria anomala, the brown upper cortex, green algal layer, white medulla, and tan lower cortex are all visible. (A. Fischer--3/2011)