Test that BN_mod_sqrt detects quadratic non-residues. Change-Id: I99abb8f99c060f0830c1df9cdbde159c85ccfe92 Reviewed-on: https://boringssl-review.googlesource.com/12462 Reviewed-by: Adam Langley <agl@google.com>
diff --git a/include/openssl/bn.h b/include/openssl/bn.h index 764d8c5..8deb278 100644 --- a/include/openssl/bn.h +++ b/include/openssl/bn.h
@@ -575,8 +575,10 @@ OPENSSL_EXPORT int BN_mod_lshift1_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *m); -/* BN_mod_sqrt returns a |BIGNUM|, r, such that r^2 == a (mod p). |p| must be a - * prime. */ +/* BN_mod_sqrt returns a newly-allocated |BIGNUM|, r, such that + * r^2 == a (mod p). |p| must be a prime. It returns NULL on error or if |a| is + * not a square mod |p|. In the latter case, it will add |BN_R_NOT_A_SQUARE| to + * the error queue. */ OPENSSL_EXPORT BIGNUM *BN_mod_sqrt(BIGNUM *in, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);