[openssl-commits] [openssl] master update

Kurt Roeckx kurt at openssl.org
Fri Nov 20 21:33:06 UTC 2015


The branch master has been updated
       via  32c748140ff94016011efc206a3709e4187ce40b (commit)
       via  9f6795e7d2d1e35668ad70ba0afc480062be4e2e (commit)
      from  1786086b05714c284b337d5211b299e09b9cfad9 (commit)


- Log -----------------------------------------------------------------
commit 32c748140ff94016011efc206a3709e4187ce40b
Author: Kurt Roeckx <kurt at roeckx.be>
Date:   Mon Oct 19 22:26:59 2015 +0200

    BN_sub: document that r might be the same as a or b
    
    Reviewed-by: Rich Salz <rsalz at akamai.com>
    
    RT #4100, MR #1264

commit 9f6795e7d2d1e35668ad70ba0afc480062be4e2e
Author: Pascal Cuoq <cuoq at trust-in-soft.com>
Date:   Mon Oct 19 22:24:23 2015 +0200

    BN_usub: Don't copy when r and a the same
    
    Signed-off-by: Kurt Roeckx <kurt at roeckx.be>
    Reviewed-by: Rich Salz <rsalz at akamai.com>
    
    RT #4100, MR #1264

-----------------------------------------------------------------------

Summary of changes:
 crypto/bn/bn_add.c    | 2 +-
 doc/crypto/BN_add.pod | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/crypto/bn/bn_add.c b/crypto/bn/bn_add.c
index 0bfc3cc..bbb0584 100644
--- a/crypto/bn/bn_add.c
+++ b/crypto/bn/bn_add.c
@@ -222,7 +222,7 @@ int BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
                 break;
         }
     }
-    if (dif)
+    if (dif && ap != rp)
         memcpy(rp, ap, sizeof(*rp) * dif);
 
     r->top = max;
diff --git a/doc/crypto/BN_add.pod b/doc/crypto/BN_add.pod
index 942048c..3ad2274 100644
--- a/doc/crypto/BN_add.pod
+++ b/doc/crypto/BN_add.pod
@@ -49,6 +49,7 @@ BN_add() adds I<a> and I<b> and places the result in I<r> (C<r=a+b>).
 I<r> may be the same B<BIGNUM> as I<a> or I<b>.
 
 BN_sub() subtracts I<b> from I<a> and places the result in I<r> (C<r=a-b>).
+I<r> may be the same B<BIGNUM> as I<a> or I<b>.
 
 BN_mul() multiplies I<a> and I<b> and places the result in I<r> (C<r=a*b>).
 I<r> may be the same B<BIGNUM> as I<a> or I<b>.


More information about the openssl-commits mailing list