<div dir="ltr">I think this could be an issue with the system's /dev/urandom or entropy, as I've observed similar infinite loops in BN_prime when I changed OpenSSL code to always return the same sequence of bytes from its PRNG (for testing purposes). It could also be a genuine bug in OpenSSL, or both. I'll let others comment on that.<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jun 18, 2020 at 9:47 AM Ronny Meeus <<a href="mailto:ronny.meeus@gmail.com">ronny.meeus@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello<br>
<br>
we are in the process of upgrading our openssl to version 1.1.1g.<br>
On one of our architectures (Cavium MIPS, running kernel 4.9) we have<br>
an issue in the ssh-keygen tool. It keeps on consuming 100% CPU of 1<br>
core.<br>
On other architectures we do not see the issue at all.<br>
<br>
I instrumented the openssl library with some traces and observed that<br>
it keeps on looping in the "probable prime" function.<br>
At the end of the function the "BN_num_bits" check is done and if the<br>
return value is not equal to "bits" it basically starts all over<br>
again.<br>
<br>
    }<br>
    if (!BN_add_word(rnd, delta))<br>
        return 0;<br>
    if (BN_num_bits(rnd) != bits) {<br>
        printf("%s BN_num_bits %d %d\n", __FUNCTION__, BN_num_bits(rnd), bits);<br>
        goto again;<br>
    }<br>
    bn_check_top(rnd);<br>
    return 1;<br>
}<br>
<br>
I added the print function and the result of the print is as follows:<br>
probable_prime BN_num_bits 1473 1536<br>
This trace keeps on going forever and the values never change.<br>
<br>
Any idea what could be the underlying root-cause?<br>
<br>
Many thanks and best regards,<br>
Ronny<br>
</blockquote></div>