From c66c30cd57444c4c1ec0f9c974f89950a7a3a669 Mon Sep 17 00:00:00 2001 From: Tim Ruffing Date: Thu, 15 Jun 2023 11:49:35 +0200 Subject: [PATCH] field: Document return value of fe_sqrt() --- src/field.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/field.h b/src/field.h index e632f9e3e2..14f1ddfd64 100644 --- a/src/field.h +++ b/src/field.h @@ -267,8 +267,10 @@ static void secp256k1_fe_sqr(secp256k1_fe *r, const secp256k1_fe *a); /** Compute a square root of a field element. * * On input, a must be a valid field element with magnitude<=8; r need not be initialized. - * Performs {r = sqrt(a)} or {r = sqrt(-a)}, whichever exists. The resulting value - * represented by r will be a square itself. Variables r and a must not point to the same object. + * Performs {r = sqrt(a)} and returns 1 if sqrt(a) exists. + * Performs {r = sqrt(-a) and returns 0 otherwise; then sqrt(-a) exists. + * The resulting value represented by r will be a square itself. + * Variables r and a must not point to the same object. * On output, r will have magnitude 1 but will not be normalized. */ static int secp256k1_fe_sqrt(secp256k1_fe * SECP256K1_RESTRICT r, const secp256k1_fe * SECP256K1_RESTRICT a);