Fix a bug in BN_mod_sqrt() that can cause it to loop forever.
Obtained from: OpenSSL Project Security: CVE-2022-0778