Hello all,
publicKeyData.resultLength = m->top * sizeof(BN_ULONG);
publicKeyData.result = ( System::BYTE * )( rr->d );
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:
--
if(rr->d)
{
OPENSSL_free(rr->d);
}
rr->d = ( BN_ULONG * )( malloc( m->top * sizeof(BN_ULONG) ) );
rr->top = m->top;
rr->dmax = m->top;
rr->neg = 0;
publicKeyData.operandALength = a->top * sizeof(BN_ULONG);
publicKeyData.operandA = ( System::BYTE * )( a->d );
publicKeyData.operandBLength = p->top * sizeof(BN_ULONG);
publicKeyData.operandB = ( System::BYTE * )( p->d );
publicKeyData.modulusLength = m->top * sizeof(BN_ULONG);
publicKeyData.modulus = ( System::BYTE * )( m->d );
{
OPENSSL_free(rr->d);
}
rr->d = ( BN_ULONG * )( malloc( m->top * sizeof(BN_ULONG) ) );
rr->top = m->top;
rr->dmax = m->top;
rr->neg = 0;
publicKeyData.operandALength = a->top * sizeof(BN_ULONG);
publicKeyData.operandA = ( System::BYTE * )( a->d );
publicKeyData.operandBLength = p->top * sizeof(BN_ULONG);
publicKeyData.operandB = ( System::BYTE * )( p->d );
publicKeyData.modulusLength = m->top * sizeof(BN_ULONG);
publicKeyData.modulus = ( System::BYTE * )( m->d );
publicKeyData.resultLength = m->top * sizeof(BN_ULONG);
publicKeyData.result = ( System::BYTE * )( rr->d );
calculate (
publicKeyData
); <<calculate fills out the Result Bytes in "rr->d" buffer.
--
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).
OPENSSL_free(rr->d)
rr->d = ( BN_ULONG * )( malloc( m->top * sizeof(BN_ULONG) ) );
rr->top = m->top;
rr->dmax = m->top;
rr->neg = 0
rr->top = m->top;
rr->dmax = m->top;
rr->neg = 0
As forward declarations are no longer allowed in openssl 1.1.1 , how to replicate above operations in openssl 1.1.1 ?
Are there any Set functions for set, dmax , d values (allocate memory for rr->d) . ?!
Please help me on this!!
Thanks,
Prudvi.