title: What does cb_arg in old versions of OpenSSL mean?
body: <p>I installed archaic <code>OpenSSL_0_9_6-beta3</code> version of OpenSSL. The function <code>RSA_generate_key</code> is defined in there as follows:</p>
  
  <pre><code>RSA * RSA_generate_key(int bits, unsigned long e,void (*callback)(int,int,void *),void *cb_arg)
  </code></pre>
  
  <p>This is my test code:</p>
  
  <pre><code>#include &lt;openssl/rsa.h&gt;
  
  int main(){
  
      unsigned long   e = RSA_F4;
  
      RSA *r = RSA_generate_key(512, e, NULL, NULL);
      const BIGNUM *n = r-&gt;n;
      BN_print_fp(stdout, n);
      RSA_free(r);
  
      return  0;
  }
  </code></pre>
  
  <p>When I run it, it just loops forever. When run under Valgrind I can see why: </p>
  
  <pre><code>Conditional jump or move depends on uninitialized value(s)
  </code></pre>
  
  <p>I guess that is because I don't understand what the function signature really means and I am passing incorrect parameters into it - there have been problems with methods looping when being fed incorrect parameters since forever in OpenSSL. That is why I came here to ask you if you understand the function signature, because I can't find any guides on the internet.</p>