Constify the BIGNUM routines a bit more. The only trouble were the
[openssl.git] / crypto / bn / bn_shift.c
index 6dbe77b50fdc51e99c456628b255ccaf55d2f1ec..e4da833ea67f33aa68b22a7dde588ca182034358 100644 (file)
@@ -60,7 +60,7 @@
 #include "cryptlib.h"
 #include "bn_lcl.h"
 
-int BN_lshift1(BIGNUM *r, BIGNUM *a)
+int BN_lshift1(BIGNUM *r, const BIGNUM *a)
        {
        register BN_ULONG *ap,*rp,t,c;
        int i;
@@ -92,7 +92,7 @@ int BN_lshift1(BIGNUM *r, BIGNUM *a)
        return(1);
        }
 
-int BN_rshift1(BIGNUM *r, BIGNUM *a)
+int BN_rshift1(BIGNUM *r, const BIGNUM *a)
        {
        BN_ULONG *ap,*rp,t,c;
        int i;
@@ -121,7 +121,7 @@ int BN_rshift1(BIGNUM *r, BIGNUM *a)
        return(1);
        }
 
-int BN_lshift(BIGNUM *r, BIGNUM *a, int n)
+int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
        {
        int i,nw,lb,rb;
        BN_ULONG *t,*f;
@@ -153,7 +153,7 @@ int BN_lshift(BIGNUM *r, BIGNUM *a, int n)
        return(1);
        }
 
-int BN_rshift(BIGNUM *r, BIGNUM *a, int n)
+int BN_rshift(BIGNUM *r, const BIGNUM *a, int n)
        {
        int i,j,nw,lb,rb;
        BN_ULONG *t,*f;
@@ -162,7 +162,7 @@ int BN_rshift(BIGNUM *r, BIGNUM *a, int n)
        nw=n/BN_BITS2;
        rb=n%BN_BITS2;
        lb=BN_BITS2-rb;
-       if (nw > a->top)
+       if (nw > a->top || a->top == 0)
                {
                BN_zero(r);
                return(1);