<div dir="ltr">Hello all,<div><br></div><div>We use a hardware accelerator to calculate BIGNUM rr = a^p mod m .( bn_mod_exp). I am trying to rewrite that logic for openssl 1.1.1. Code snippet of custom bn_mod_exp function:</div><div>--</div><div> if(rr->d)<br> {<br> OPENSSL_free(rr->d);<br> }<br> rr->d = ( BN_ULONG * )( malloc( m->top * sizeof(BN_ULONG) ) );<br> rr->top = m->top;<br> rr->dmax = m->top;<br> rr->neg = 0;<br><br> publicKeyData.operandALength = a->top * sizeof(BN_ULONG);<br> publicKeyData.operandA = ( System::BYTE * )( a->d );<br> publicKeyData.operandBLength = p->top * sizeof(BN_ULONG);<br> publicKeyData.operandB = ( System::BYTE * )( p->d );<br> publicKeyData.modulusLength = m->top * sizeof(BN_ULONG);<br> publicKeyData.modulus = ( System::BYTE * )( m->d );</div><div><br> publicKeyData.resultLength = m->top * sizeof(BN_ULONG);<br> publicKeyData.result = ( System::BYTE * )( rr->d );</div><div><br></div><div> calculate (
publicKeyData
); <<calculate fills out the Result Bytes in "rr->d" buffer.</div><div>--</div><div></div><div> I found a few 'get' functions (no set functions though) like -- bn_get_top , bn_get_dmax. These are in "bn_intern.c" , not in "bn_lib.c" (or BN API). </div><div> OPENSSL_free(rr->d)
</div><div> rr->d = ( BN_ULONG * )( malloc( m->top * sizeof(BN_ULONG) ) );<br> rr->top = m->top;<br> rr->dmax = m->top;<br> rr->neg = 0 <br></div><div><br></div><div>As forward declarations are no longer allowed in openssl 1.1.1 , how to replicate above operations in openssl 1.1.1 ? <br></div><div>Are there any Set functions for set, dmax , d values (allocate memory for rr->d) . ?!</div><div>Please help me on this!!</div><div><br></div><div>Thanks,</div><div>Prudvi. </div><div><br></div><div><br></div></div>