Current uses do not require support for negative exponent in exptmod, so we can save about 1.5 kB in leaving out invmod.