Make hunting-and-pecking loop (more) resistant to side channel attack

Lifted from:
http://authsae.cvs.sourceforge.net/viewvc/authsae/authsae/sae.c?r1=1.8&r2=1.9&view=patch
at Dan's request.