diff --git a/primecandidate.c b/primecandidate.c
index b7620fec780f0c3308f7c1acddadeb9a1e83be6a..1f73307a1ad991552681fae3c66916bb2ff5e046 100644
--- a/primecandidate.c
+++ b/primecandidate.c
@@ -381,6 +381,21 @@ unsigned pcs_get_bits(PrimeCandidateSource *pcs)
     return pcs->bits;
 }
 
+unsigned pcs_get_bits_remaining(PrimeCandidateSource *pcs)
+{
+    return mp_get_nbits(pcs->limit);
+}
+
+mp_int *pcs_get_upper_bound(PrimeCandidateSource *pcs)
+{
+    /* Compute (limit-1) * factor + addend */
+    mp_int *tmp = mp_mul(pcs->limit, pcs->factor);
+    mp_int *bound = mp_add(tmp, pcs->addend);
+    mp_free(tmp);
+    mp_sub_into(bound, bound, pcs->factor);
+    return bound;
+}
+
 mp_int **pcs_get_known_prime_factors(PrimeCandidateSource *pcs, size_t *nout)
 {
     *nout = pcs->nkps;
diff --git a/sshkeygen.h b/sshkeygen.h
index 6a9594f2a4bfaf90d8fcd90cf6e69ebe242f53a9..f8f3159f541cf97588ebc7a380c58d3cbd907d1e 100644
--- a/sshkeygen.h
+++ b/sshkeygen.h
@@ -70,6 +70,8 @@ void pcs_inspect(PrimeCandidateSource *pcs, mp_int **limit_out,
 
 /* Query functions for primegen to use */
 unsigned pcs_get_bits(PrimeCandidateSource *pcs);
+unsigned pcs_get_bits_remaining(PrimeCandidateSource *pcs);
+mp_int *pcs_get_upper_bound(PrimeCandidateSource *pcs);
 mp_int **pcs_get_known_prime_factors(PrimeCandidateSource *pcs, size_t *nout);
 
 /* ----------------------------------------------------------------------