Hi,
I am  new to the openssl . I am trying to use the
Harware Crypto for Mod exp calculations. So to make
use of the hardware capability I am getting the RSA
METHOD by using 'RSA_get_default_method' and updating 
the function pointer of the member bn_mod_exp of the
RSA_METHOD structure with my own function. It can be
explained with pseudo code as follows

Init(...)
{
 DH_METHOD *pDHMeth = NULL;
 RSA_METHOD *pRSAMethod = NULL;
 
  pDHMeth = DH_get_default_method();
  pDHMeth->bn_mod_exp = DHmodexp;

  pRSAMethod = RSA_get_default_method();
  pRSAMethod->bn_mod_exp = RSAmodexp;
}
DhModexp( const DH *pDH,BIGNUM *r, const BIGNUM *a,
                          const BIGNUM *p, 
                          const BIGNUM *m, BN_CTX
*ctx,
                          BN_MONT_CTX *m_ctx)
)
{
  return ModExp(r,a,p,m,ctx,m_ctx);
}
RsaModExp(BIGNUM *r, const BIGNUM *a,
          const BIGNUM *p, 
          const BIGNUM *m, BN_CTX *ctx,
          BN_MONT_CTX *m_ctx)
)
{
  return ModExp(r,a,p,m,ctx,m_ctx);
}
/* Inputs: a - The base
 *         p - The exponent
 *         m - The modulus
 *         ctx - The BIGNUM context structure.
 *         in_mont - The Montgomerry methods context
 *
 * Output: rr - The result of the mod-exp operation.
 * Return value: 1 on success and -1 on failure.
 */

ModExp(BIGNUM *r, const BIGNUM *a,
                          const BIGNUM *p, 
                          const BIGNUM *m, BN_CTX
*ctx,
                          BN_MONT_CTX *m_ctx)
{
  /**doing some validations and invoking the hardware
    provided API for Mod exp calculation  and 
   converting the result back to big number format**/

}

The above method works fine for DH related operations
but it is not working for RSA related operations,if I
generate a key pair and try to sign and verify then it
fails.(Hardware Mod exp API returns no error) So
Please let me know  is the above method a correct
approach or else  is there any other technique to hook
up the Hardware Mod exp routine into openssl.(Assume
there is no engine interface enabled and I am using
the openssl version  "OpenSSL 0.9.7c 30 Sep 2003")


Thanks in advance!

  regards
    Tom


________________________________________________________________________
Yahoo! India Matrimony: Find your life partner online
Go to: http://yahoo.shaadi.com/india-matrimony
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to