diff --git a/rsa-keygen.c b/rsa-keygen.c
index 70cb2f786141375ebf77c7b9c589e57f8b964590..34192e1404f11fcb2b848d7d5178dff661330e7d 100644
--- a/rsa-keygen.c
+++ b/rsa-keygen.c
@@ -56,7 +56,7 @@ bignum_random_prime(mpz_t x, unsigned bits,
       mpz_setbit(x, bits - 1);
 
       /* Miller-rabin count of 25 is probably much overkill. */
-      bignum_next_prime(x, x, 25, 10000, progress_ctx, progress);
+      nettle_next_prime(x, x, 25, 10000, progress_ctx, progress);
 
       if (mpz_sizeinbase(x, 2) == bits)
 	break;