Ben Laurie Wrote
>It's at times like this that I wish they hadn't made && boolean.
>Wouldn't it be cool to write:
>   a=b && BN_dup(b);

Yup, that would be cool, but you can still do
a = b && a = BN_dup ( b );
or more explict, but still tight:
a = ( b ? BN_dup ( b ) : 0 );

or better yet, we could just change BN_dup to check for a NULL arg.

Would someone be interested in updating bn_lib.c as listed below?
I have only been using OpenSSL for a week now, so I don't yet feel comfortable
adding my own distinctiveness to the collective.

from

BIGNUM *BN_dup(BIGNUM *a)
     {
     BIGNUM *r;

     bn_check_top(a);

     r=BN_new();
     if (r == NULL) return(NULL);
     return((BIGNUM *)BN_copy(r,a));
     }

to

BIGNUM *BN_dup(BIGNUM *a)
     {
     BIGNUM *r = NULL;   // <--- changed
     if (a)              // <--- changed
          {         // <--- changed
          bn_check_top(a);

          r=BN_new();
          if (r == NULL) return(NULL);
          r = ((BIGNUM *)BN_copy(r,a));       // <--- changed
          }         // <--- changed
     return r;           // <--- changed
     }

Mark Borgerding
mborgerding (at) acm.org


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

Reply via email to