  We present a first 3D magnetohydrodynamic (MHD) simulation of convective
oxygen and neon shell burning in a non-rotating $18\, M_\odot$ star shortly
before core collapse to study the generation of magnetic fields in supernova
progenitors. We also run a purely hydrodynamic control simulation to gauge the
impact of the magnetic fields on the convective flow and on convective boundary
mixing. After about 17 convective turnover times, the magnetic field is
approaching saturation levels in the oxygen shell with an average field
strength of $\mathord{\sim}10^{10}\, \mathrm{G}$, and does not reach kinetic
equipartition. The field remains dominated by small to medium scales, and the
dipole field strength at the base of the oxygen shell is only $10^{9}\,
\mathrm{G}$. The angle-averaged diagonal components of the Maxwell stress
tensor mirror those of the Reynolds stress tensor, but are about one order of
magnitude smaller. The shear flow at the oxygen-neon shell interface creates
relatively strong fields parallel to the convective boundary, which noticeably
inhibit the turbulent entrainment of neon into the oxygen shell. The reduced
ingestion of neon lowers the nuclear energy generation rate in the oxygen shell
and thereby slightly slows down the convective flow. Aside from this indirect
effect, we find that magnetic fields do not appreciably alter the flow inside
the oxygen shell. We discuss the implications of our results for the subsequent
core-collapse supernova and stress the need for longer simulations, resolution
studies, and an investigation of non-ideal effects for a better understanding
of magnetic fields in supernova progenitors.
