----- Original Message -----
From: "Nils Larsch" <[EMAIL PROTECTED]>

> >
> > BN_mod_exp() will calculate:
> > r = (a^p) % m
> > I don't think it permits calculation of:
> > a = (a^p) %m
>
> use a extra variable :
> BIGNUM *tmp = BN_dup(a);
> if (!BN_mod_exp(a, tmp, p, m, ctx)) goto err;
> BN_free(tmp);
>

Shall do.

<snip>

> > Is the above simply an alternative to doing:
> > BIGNUM *tmp = BN_new();
> > /* do stuff with tmp */
> > BN_free(tmp);
>
> Yes
>
> >
> > What are the circumstances that determine whether I create a BIGNUM with
a
> > 'BN_CTX_get()' or a 'BN_new()' ?
>
> In frequently called functions which require a modest amount of BIGNUMs I
> would prefer the BN_CTX method (to save the expensive malloc() calls).
> In non time-critical functions I would use the 'normal' BN_new() method.
>

Yep ..... understood.
Thanks again for the (very clear) advice and assistance.

Cheers,
Rob


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to