diff --git a/crypto/asn1/tasn_dec.c b/crypto/asn1/tasn_dec.c index 80c8b7df8..69bacecd9 100644 --- a/crypto/asn1/tasn_dec.c +++ b/crypto/asn1/tasn_dec.c @@ -599,14 +599,13 @@ static int asn1_template_noexp_d2i(ASN1_VALUE **val, { int flags, aclass; int ret; - const unsigned char *p, *q; + const unsigned char *p; if (!val) return 0; flags = tt->flags; aclass = flags & ASN1_TFLG_TAG_CLASS; p = *in; - q = p; if (flags & ASN1_TFLG_SK_MASK) { @@ -663,7 +662,7 @@ static int asn1_template_noexp_d2i(ASN1_VALUE **val, while(len > 0) { ASN1_VALUE *skfield; - q = p; + const unsigned char *q = p; /* See if EOC found */ if (asn1_check_eoc(&p, len)) { diff --git a/crypto/bn/exponentiation.c b/crypto/bn/exponentiation.c index ca09c6441..afc428777 100644 --- a/crypto/bn/exponentiation.c +++ b/crypto/bn/exponentiation.c @@ -416,7 +416,7 @@ err: static int mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx) { - int i, j, bits, ret = 0, wstart, wend, window, wvalue; + int i, j, bits, ret = 0, wstart, window; int start = 1; BIGNUM *aa; /* Table of variables obtained from 'ctx' */ @@ -485,15 +485,16 @@ static int mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, start = 1; /* This is used to avoid multiplication etc * when there is only the value '1' in the * buffer. */ - wvalue = 0; /* The 'value' of the window */ wstart = bits - 1; /* The top bit of the window */ - wend = 0; /* The bottom bit of the window */ if (!BN_one(r)) { goto err; } for (;;) { + int wvalue; /* The 'value' of the window */ + int wend; /* The bottom bit of the window */ + if (BN_is_bit_set(p, wstart) == 0) { if (!start) { if (!BN_mod_mul_reciprocal(r, r, r, &recp, ctx)) { @@ -542,7 +543,6 @@ static int mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, /* move the 'window' down further */ wstart -= wend + 1; - wvalue = 0; start = 0; if (wstart < 0) { break; @@ -601,7 +601,7 @@ int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont) { - int i, j, bits, ret = 0, wstart, wend, window, wvalue; + int i, j, bits, ret = 0, wstart, window; int start = 1; BIGNUM *d, *r; const BIGNUM *aa; @@ -680,9 +680,7 @@ int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, start = 1; /* This is used to avoid multiplication etc * when there is only the value '1' in the * buffer. */ - wvalue = 0; /* The 'value' of the window */ wstart = bits - 1; /* The top bit of the window */ - wend = 0; /* The bottom bit of the window */ j = m->top; /* borrow j */ if (m->d[j - 1] & (((BN_ULONG)1) << (BN_BITS2 - 1))) { @@ -701,6 +699,9 @@ int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, } for (;;) { + int wvalue; /* The 'value' of the window */ + int wend; /* The bottom bit of the window */ + if (BN_is_bit_set(p, wstart) == 0) { if (!start) { if (!BN_mod_mul_montgomery(r, r, r, mont, ctx)) @@ -716,7 +717,6 @@ int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, /* We now have wstart on a 'set' bit, we now need to work out how bit a * window to do. To do this we need to scan forward until the last set bit * before the end of the window */ - j = wstart; wvalue = 1; wend = 0; for (i = 1; i < window; i++) { @@ -748,7 +748,6 @@ int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, /* move the 'window' down further */ wstart -= wend + 1; - wvalue = 0; start = 0; if (wstart < 0) { break; diff --git a/crypto/cipher/e_rc2.c b/crypto/cipher/e_rc2.c index c26c94ea1..46cf36096 100644 --- a/crypto/cipher/e_rc2.c +++ b/crypto/cipher/e_rc2.c @@ -279,7 +279,6 @@ static void RC2_cbc_encrypt(const uint8_t *in, uint8_t *out, size_t length, l2c(xor0, iv); l2c(xor1, iv); } - tin0 = tin1 = tout0 = tout1 = xor0 = xor1 = 0; tin[0] = tin[1] = 0; } diff --git a/crypto/ec/wnaf.c b/crypto/ec/wnaf.c index 2fed4a575..cac7234ca 100644 --- a/crypto/ec/wnaf.c +++ b/crypto/ec/wnaf.c @@ -443,8 +443,8 @@ int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, * as the wNAF belonging to the generator, * so wNAF splitting will not buy us anything. */ - numblocks = 1; - totalnum = num + 1; /* don't use wNAF splitting */ + numblocks = 1; /* don't use wNAF splitting */ + totalnum = num + numblocks; wNAF[num] = tmp_wNAF; wNAF[num + 1] = NULL; wNAF_len[num] = tmp_len; diff --git a/crypto/x509/t_crl.c b/crypto/x509/t_crl.c index f2b2ee226..93a7afb1a 100644 --- a/crypto/x509/t_crl.c +++ b/crypto/x509/t_crl.c @@ -91,7 +91,6 @@ int X509_CRL_print(BIO *out, X509_CRL *x) BIO_printf(out, "Certificate Revocation List (CRL):\n"); l = X509_CRL_get_version(x); BIO_printf(out, "%8sVersion %lu (0x%lx)\n", "", l+1, l); - i = OBJ_obj2nid(x->sig_alg->algorithm); X509_signature_print(out, x->sig_alg, NULL); p=X509_NAME_oneline(X509_CRL_get_issuer(x),NULL,0); BIO_printf(out,"%8sIssuer: %s\n","",p);