Having a perfect square at this point is not an error. Rather it is
authortb <tb@openbsd.org>
Fri, 29 Jul 2022 08:37:33 +0000 (08:37 +0000)
committertb <tb@openbsd.org>
Fri, 29 Jul 2022 08:37:33 +0000 (08:37 +0000)
a shortcut bypassing expensive computation, so change goto err to
goto done. Bug introduced in last refactoring before commit.

lib/libcrypto/bn/bn_bpsw.c

index ef3b829..93d43af 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: bn_bpsw.c,v 1.4 2022/07/29 08:32:20 tb Exp $ */
+/*     $OpenBSD: bn_bpsw.c,v 1.5 2022/07/29 08:37:33 tb Exp $ */
 /*
  * Copyright (c) 2022 Martin Grenouilloux <martin.grenouilloux@lse.epita.fr>
  * Copyright (c) 2022 Theo Buehler <tb@openbsd.org>
@@ -248,7 +248,7 @@ bn_strong_lucas_selfridge(int *is_prime, const BIGNUM *n, BN_CTX *ctx)
                goto err;
        if (is_perfect_square) {
                *is_prime = 0;
-               goto err;
+               goto done;
        }
 
        /*