The function Fp254Impl::exp_by_constant_montgomery takes as input a in Montgomery form and a BigUint exponent exp and is expected to return a^exp in Montgomery form. The function produces the correct result for nonzero exponents. However when the exponent is zero, the function returns 1 in standard form rather than Montgomery representation of 1. This introduces inconsistency.