Constification.
[openssl.git] / crypto / bn / bn.h
index 4749c52341f7e55aa8f0a0aa06086e1a10b1ec73..e366106f1268f91f59cc7dca4f8c35a9e8db0fba 100644 (file)
@@ -416,8 +416,8 @@ BIGNUM *BN_CTX_get(BN_CTX *ctx);
 void   BN_CTX_end(BN_CTX *ctx);
 int     BN_rand(BIGNUM *rnd, int bits, int top,int bottom);
 int     BN_pseudo_rand(BIGNUM *rnd, int bits, int top,int bottom);
-int    BN_rand_range(BIGNUM *rnd, BIGNUM *range);
-int    BN_pseudo_rand_range(BIGNUM *rnd, BIGNUM *range);
+int    BN_rand_range(BIGNUM *rnd, const BIGNUM *range);
+int    BN_pseudo_rand_range(BIGNUM *rnd, const BIGNUM *range);
 int    BN_num_bits(const BIGNUM *a);
 int    BN_num_bits_word(BN_ULONG);
 BIGNUM *BN_new(void);
@@ -752,10 +752,12 @@ int RAND_pseudo_bytes(unsigned char *buf,int num);
 #define bn_correct_top(a) \
         { \
         BN_ULONG *ftl; \
-       if ((a)->top > 0) \
+       int top = (a)->top; \
+       if (top > 0) \
                { \
-               for (ftl= &((a)->d[(a)->top-1]); (a)->top > 0; (a)->top--) \
-               if (*(ftl--)) break; \
+               for (ftl= &((a)->d[top-1]); top > 0; top--) \
+                       if (*(ftl--)) break; \
+               (a)->top = top; \
                } \
        bn_pollute(a); \
        }