From 2898b0c3a5e1e7f791f70cf4578bb2486c0612fa Mon Sep 17 00:00:00 2001 From: doug <> Date: Sat, 21 Mar 2015 08:05:20 +0000 Subject: Fix indentation that incorrectly implies a different control flow. The actual control flow is intentional while the indenting is incorrect. This is intended to be a cosmetic change. Verified that each of these was part of a KNF commit that wasn't intending to change behavior. Also, double checked against the history of changes in OpenSSL and BoringSSL. Addresses Coverity CIDs: 78842, 78859, 78863. ok tedu@ --- src/lib/libcrypto/bio/bss_mem.c | 4 ++-- src/lib/libcrypto/bn/bn_exp.c | 5 +++-- src/lib/libcrypto/bn/bn_recp.c | 10 ++++++---- src/lib/libssl/src/crypto/bio/bss_mem.c | 4 ++-- src/lib/libssl/src/crypto/bn/bn_exp.c | 5 +++-- src/lib/libssl/src/crypto/bn/bn_recp.c | 10 ++++++---- 6 files changed, 22 insertions(+), 16 deletions(-) (limited to 'src/lib') diff --git a/src/lib/libcrypto/bio/bss_mem.c b/src/lib/libcrypto/bio/bss_mem.c index 8310f8cf4d..119bd672f6 100644 --- a/src/lib/libcrypto/bio/bss_mem.c +++ b/src/lib/libcrypto/bio/bss_mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bss_mem.c,v 1.13 2014/07/11 08:44:47 jsing Exp $ */ +/* $OpenBSD: bss_mem.c,v 1.14 2015/03/21 08:05:20 doug Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -142,7 +142,7 @@ mem_free(BIO *a) b = (BUF_MEM *)a->ptr; if (a->flags & BIO_FLAGS_MEM_RDONLY) b->data = NULL; - BUF_MEM_free(b); + BUF_MEM_free(b); a->ptr = NULL; } } diff --git a/src/lib/libcrypto/bn/bn_exp.c b/src/lib/libcrypto/bn/bn_exp.c index 12de0c5a12..4a28c2c605 100644 --- a/src/lib/libcrypto/bn/bn_exp.c +++ b/src/lib/libcrypto/bn/bn_exp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_exp.c,v 1.21 2015/02/14 15:13:24 miod Exp $ */ +/* $OpenBSD: bn_exp.c,v 1.22 2015/03/21 08:05:20 doug Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -874,7 +874,8 @@ BN_mod_exp_mont_word(BIGNUM *rr, BN_ULONG a, const BIGNUM *p, const BIGNUM *m, } if (m->top == 1) a %= m->d[0]; /* make sure that 'a' is reduced */ - bits = BN_num_bits(p); + + bits = BN_num_bits(p); if (bits == 0) { ret = BN_one(rr); return ret; diff --git a/src/lib/libcrypto/bn/bn_recp.c b/src/lib/libcrypto/bn/bn_recp.c index b90c5421f1..7b31fe0adf 100644 --- a/src/lib/libcrypto/bn/bn_recp.c +++ b/src/lib/libcrypto/bn/bn_recp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_recp.c,v 1.11 2014/07/11 08:44:48 jsing Exp $ */ +/* $OpenBSD: bn_recp.c,v 1.12 2015/03/21 08:05:20 doug Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -181,9 +181,11 @@ BN_div_recp(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, BN_RECP_CTX *recp, /* Nr := round(2^i / N) */ if (i != recp->shift) - recp->shift = BN_reciprocal(&(recp->Nr), &(recp->N), i, ctx); /* BN_reciprocal returns i, or -1 for an error */ - if (recp->shift == -1) - goto err; + recp->shift = BN_reciprocal(&(recp->Nr), &(recp->N), i, ctx); + + /* BN_reciprocal returns i, or -1 for an error */ + if (recp->shift == -1) + goto err; /* d := |round(round(m / 2^BN_num_bits(N)) * recp->Nr / 2^(i - BN_num_bits(N)))| * = |round(round(m / 2^BN_num_bits(N)) * round(2^i / N) / 2^(i - BN_num_bits(N)))| diff --git a/src/lib/libssl/src/crypto/bio/bss_mem.c b/src/lib/libssl/src/crypto/bio/bss_mem.c index 8310f8cf4d..119bd672f6 100644 --- a/src/lib/libssl/src/crypto/bio/bss_mem.c +++ b/src/lib/libssl/src/crypto/bio/bss_mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bss_mem.c,v 1.13 2014/07/11 08:44:47 jsing Exp $ */ +/* $OpenBSD: bss_mem.c,v 1.14 2015/03/21 08:05:20 doug Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -142,7 +142,7 @@ mem_free(BIO *a) b = (BUF_MEM *)a->ptr; if (a->flags & BIO_FLAGS_MEM_RDONLY) b->data = NULL; - BUF_MEM_free(b); + BUF_MEM_free(b); a->ptr = NULL; } } diff --git a/src/lib/libssl/src/crypto/bn/bn_exp.c b/src/lib/libssl/src/crypto/bn/bn_exp.c index 12de0c5a12..4a28c2c605 100644 --- a/src/lib/libssl/src/crypto/bn/bn_exp.c +++ b/src/lib/libssl/src/crypto/bn/bn_exp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_exp.c,v 1.21 2015/02/14 15:13:24 miod Exp $ */ +/* $OpenBSD: bn_exp.c,v 1.22 2015/03/21 08:05:20 doug Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -874,7 +874,8 @@ BN_mod_exp_mont_word(BIGNUM *rr, BN_ULONG a, const BIGNUM *p, const BIGNUM *m, } if (m->top == 1) a %= m->d[0]; /* make sure that 'a' is reduced */ - bits = BN_num_bits(p); + + bits = BN_num_bits(p); if (bits == 0) { ret = BN_one(rr); return ret; diff --git a/src/lib/libssl/src/crypto/bn/bn_recp.c b/src/lib/libssl/src/crypto/bn/bn_recp.c index b90c5421f1..7b31fe0adf 100644 --- a/src/lib/libssl/src/crypto/bn/bn_recp.c +++ b/src/lib/libssl/src/crypto/bn/bn_recp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_recp.c,v 1.11 2014/07/11 08:44:48 jsing Exp $ */ +/* $OpenBSD: bn_recp.c,v 1.12 2015/03/21 08:05:20 doug Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -181,9 +181,11 @@ BN_div_recp(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, BN_RECP_CTX *recp, /* Nr := round(2^i / N) */ if (i != recp->shift) - recp->shift = BN_reciprocal(&(recp->Nr), &(recp->N), i, ctx); /* BN_reciprocal returns i, or -1 for an error */ - if (recp->shift == -1) - goto err; + recp->shift = BN_reciprocal(&(recp->Nr), &(recp->N), i, ctx); + + /* BN_reciprocal returns i, or -1 for an error */ + if (recp->shift == -1) + goto err; /* d := |round(round(m / 2^BN_num_bits(N)) * recp->Nr / 2^(i - BN_num_bits(N)))| * = |round(round(m / 2^BN_num_bits(N)) * round(2^i / N) / 2^(i - BN_num_bits(N)))| -- cgit v1.2.3-55-g6feb