diff options
author | Bodo Möller <bodo@openssl.org> | 2000-02-03 01:26:07 +0000 |
---|---|---|
committer | Bodo Möller <bodo@openssl.org> | 2000-02-03 01:26:07 +0000 |
commit | 7999c65c9bfd80ec0f07f6eb5be5ce2e36927298 (patch) | |
tree | c9631f548315d57e6ca05ae6fdafd002058e1632 /crypto/bn | |
parent | bfe30e4d1b63c2f00584f26ed8d2ca0c37c480a8 (diff) | |
download | openssl-7999c65c9bfd80ec0f07f6eb5be5ce2e36927298.tar.gz |
Some 'const's for BNs.
Diffstat (limited to 'crypto/bn')
-rw-r--r-- | crypto/bn/bn.h | 2 | ||||
-rw-r--r-- | crypto/bn/bn_prime.c | 17 | ||||
-rw-r--r-- | crypto/bn/bn_word.c | 2 |
3 files changed, 11 insertions, 10 deletions
diff --git a/crypto/bn/bn.h b/crypto/bn/bn.h index 63fb9cc6e8..417f3706fb 100644 --- a/crypto/bn/bn.h +++ b/crypto/bn/bn.h @@ -356,7 +356,7 @@ int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx); int BN_mul(BIGNUM *r, BIGNUM *a, BIGNUM *b, BN_CTX *ctx); int BN_sqr(BIGNUM *r, BIGNUM *a,BN_CTX *ctx); -BN_ULONG BN_mod_word(BIGNUM *a, BN_ULONG w); +BN_ULONG BN_mod_word(const BIGNUM *a, BN_ULONG w); BN_ULONG BN_div_word(BIGNUM *a, BN_ULONG w); int BN_mul_word(BIGNUM *a, BN_ULONG w); int BN_add_word(BIGNUM *a, BN_ULONG w); diff --git a/crypto/bn/bn_prime.c b/crypto/bn/bn_prime.c index efc053ecf6..0f07c222fa 100644 --- a/crypto/bn/bn_prime.c +++ b/crypto/bn/bn_prime.c @@ -121,8 +121,8 @@ */ #include "bn_prime.h" -static int witness(BIGNUM *w, BIGNUM *a, BIGNUM *a1, BIGNUM *a1_odd, int k, - BN_CTX *ctx, BN_MONT_CTX *mont); +static int witness(BIGNUM *w, const BIGNUM *a, const BIGNUM *a1, + const BIGNUM *a1_odd, int k, BN_CTX *ctx, BN_MONT_CTX *mont); static int probable_prime(BIGNUM *rnd, int bits); static int probable_prime_dh(BIGNUM *rnd, int bits, BIGNUM *add, BIGNUM *rem, BN_CTX *ctx); @@ -223,7 +223,7 @@ int BN_is_prime_fasttest(const BIGNUM *a, int checks, BN_CTX *ctx = NULL; BIGNUM *A1, *A1_odd, *check; /* taken from ctx */ BN_MONT_CTX *mont = NULL; - BIGNUM *A; + const BIGNUM *A; if (checks == BN_prime_checks) checks = BN_prime_checks_for_size(BN_num_bits(a)); @@ -247,9 +247,10 @@ int BN_is_prime_fasttest(const BIGNUM *a, int checks, /* A := abs(a) */ if (a->neg) { - A = &(ctx->bn[ctx->tos++]); - BN_copy(A, a); - A->neg = 0; + BIGNUM *t = &(ctx->bn[ctx->tos++]); + BN_copy(t, a); + t->neg = 0; + A = t; } else A = a; @@ -318,8 +319,8 @@ err: return(ret); } -static int witness(BIGNUM *w, BIGNUM *a, BIGNUM *a1, BIGNUM *a1_odd, int k, - BN_CTX *ctx, BN_MONT_CTX *mont) +static int witness(BIGNUM *w, const BIGNUM *a, const BIGNUM *a1, + const BIGNUM *a1_odd, int k, BN_CTX *ctx, BN_MONT_CTX *mont) { if (!BN_mod_exp_mont(w, w, a1_odd, a, ctx, mont)) /* w := w^a1_odd mod a */ return -1; diff --git a/crypto/bn/bn_word.c b/crypto/bn/bn_word.c index c0cfbc6797..73157a7d43 100644 --- a/crypto/bn/bn_word.c +++ b/crypto/bn/bn_word.c @@ -60,7 +60,7 @@ #include "cryptlib.h" #include "bn_lcl.h" -BN_ULONG BN_mod_word(BIGNUM *a, BN_ULONG w) +BN_ULONG BN_mod_word(const BIGNUM *a, BN_ULONG w) { #ifndef BN_LLONG BN_ULONG ret=0; |