diff options
author | David Benjamin <davidben@chromium.org> | 2015-02-11 09:16:26 +0300 |
---|---|---|
committer | Adam Langley <agl@google.com> | 2015-02-11 22:31:01 +0300 |
commit | c9a202fee3632be4cb133996993949bdec548035 (patch) | |
tree | 762e03c99e20e0ae1f2045117343766fd5690ab8 /crypto/dsa | |
parent | efec193d27e81cc4d25d0b04c89d4d0c155fcccf (diff) |
Add in missing curly braces part 1.
Everything before crypto/ec.
Change-Id: Icbfab8e4ffe5cc56bf465eb57d3fdad3959a085c
Reviewed-on: https://boringssl-review.googlesource.com/3401
Reviewed-by: Adam Langley <agl@google.com>
Diffstat (limited to 'crypto/dsa')
-rw-r--r-- | crypto/dsa/dsa.c | 21 | ||||
-rw-r--r-- | crypto/dsa/dsa_impl.c | 11 |
2 files changed, 20 insertions, 12 deletions
diff --git a/crypto/dsa/dsa.c b/crypto/dsa/dsa.c index 8816b631..eca073a3 100644 --- a/crypto/dsa/dsa.c +++ b/crypto/dsa/dsa.c @@ -128,20 +128,27 @@ void DSA_free(DSA *dsa) { CRYPTO_free_ex_data(CRYPTO_EX_INDEX_DSA, dsa, &dsa->ex_data); - if (dsa->p != NULL) + if (dsa->p != NULL) { BN_clear_free(dsa->p); - if (dsa->q != NULL) + } + if (dsa->q != NULL) { BN_clear_free(dsa->q); - if (dsa->g != NULL) + } + if (dsa->g != NULL) { BN_clear_free(dsa->g); - if (dsa->pub_key != NULL) + } + if (dsa->pub_key != NULL) { BN_clear_free(dsa->pub_key); - if (dsa->priv_key != NULL) + } + if (dsa->priv_key != NULL) { BN_clear_free(dsa->priv_key); - if (dsa->kinv != NULL) + } + if (dsa->kinv != NULL) { BN_clear_free(dsa->kinv); - if (dsa->r != NULL) + } + if (dsa->r != NULL) { BN_clear_free(dsa->r); + } OPENSSL_free(dsa); } diff --git a/crypto/dsa/dsa_impl.c b/crypto/dsa/dsa_impl.c index 6719758b..9efd008b 100644 --- a/crypto/dsa/dsa_impl.c +++ b/crypto/dsa/dsa_impl.c @@ -128,8 +128,9 @@ static int sign_setup(const DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, } /* Compute r = (g^k mod p) mod q */ - if (!BN_copy(&kq, &k)) + if (!BN_copy(&kq, &k)) { goto err; + } /* We do not want timing information to leak the length of k, * so we compute g^k using an equivalent exponent of fixed length. @@ -137,11 +138,11 @@ static int sign_setup(const DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, * (This is a kludge that we need because the BN_mod_exp_mont() * does not let us specify the desired timing behaviour.) */ - if (!BN_add(&kq, &kq, dsa->q)) + if (!BN_add(&kq, &kq, dsa->q)) { + goto err; + } + if (BN_num_bits(&kq) <= BN_num_bits(dsa->q) && !BN_add(&kq, &kq, dsa->q)) { goto err; - if (BN_num_bits(&kq) <= BN_num_bits(dsa->q)) { - if (!BN_add(&kq, &kq, dsa->q)) - goto err; } K = &kq; |