Fix miscellaneous clang-tidy warnings.
There are still a ton of them, almost exclusively complaints that
function declaration and definitions have different parameter names. I
just fixed a few randomly.
Change-Id: I1072f3dba8f63372cda92425aa94f4aa9e3911fa
Reviewed-on: https://boringssl-review.googlesource.com/18706
Reviewed-by: Steven Valdez <svaldez@google.com>
diff --git a/crypto/dh/check.c b/crypto/dh/check.c
index e3c111b..55fc1c3 100644
--- a/crypto/dh/check.c
+++ b/crypto/dh/check.c
@@ -59,8 +59,8 @@
#include <openssl/bn.h>
-int DH_check_pub_key(const DH *dh, const BIGNUM *pub_key, int *ret) {
- *ret = 0;
+int DH_check_pub_key(const DH *dh, const BIGNUM *pub_key, int *out_flags) {
+ *out_flags = 0;
BN_CTX *ctx = BN_CTX_new();
if (ctx == NULL) {
@@ -77,7 +77,7 @@
goto err;
}
if (BN_cmp(pub_key, tmp) <= 0) {
- *ret |= DH_CHECK_PUBKEY_TOO_SMALL;
+ *out_flags |= DH_CHECK_PUBKEY_TOO_SMALL;
}
/* Check |pub_key| is less than |dh->p| - 1. */
@@ -86,7 +86,7 @@
goto err;
}
if (BN_cmp(pub_key, tmp) >= 0) {
- *ret |= DH_CHECK_PUBKEY_TOO_LARGE;
+ *out_flags |= DH_CHECK_PUBKEY_TOO_LARGE;
}
if (dh->q != NULL) {
@@ -97,7 +97,7 @@
goto err;
}
if (!BN_is_one(tmp)) {
- *ret |= DH_CHECK_PUBKEY_INVALID;
+ *out_flags |= DH_CHECK_PUBKEY_INVALID;
}
}
@@ -110,7 +110,7 @@
}
-int DH_check(const DH *dh, int *ret) {
+int DH_check(const DH *dh, int *out_flags) {
/* Check that p is a safe prime and if g is 2, 3 or 5, check that it is a
* suitable generator where:
* for 2, p mod 24 == 11
@@ -123,7 +123,7 @@
BN_ULONG l;
BIGNUM *t1 = NULL, *t2 = NULL;
- *ret = 0;
+ *out_flags = 0;
ctx = BN_CTX_new();
if (ctx == NULL) {
goto err;
@@ -140,16 +140,16 @@
if (dh->q) {
if (BN_cmp(dh->g, BN_value_one()) <= 0) {
- *ret |= DH_CHECK_NOT_SUITABLE_GENERATOR;
+ *out_flags |= DH_CHECK_NOT_SUITABLE_GENERATOR;
} else if (BN_cmp(dh->g, dh->p) >= 0) {
- *ret |= DH_CHECK_NOT_SUITABLE_GENERATOR;
+ *out_flags |= DH_CHECK_NOT_SUITABLE_GENERATOR;
} else {
/* Check g^q == 1 mod p */
if (!BN_mod_exp_mont(t1, dh->g, dh->q, dh->p, ctx, NULL)) {
goto err;
}
if (!BN_is_one(t1)) {
- *ret |= DH_CHECK_NOT_SUITABLE_GENERATOR;
+ *out_flags |= DH_CHECK_NOT_SUITABLE_GENERATOR;
}
}
r = BN_is_prime_ex(dh->q, BN_prime_checks, ctx, NULL);
@@ -157,17 +157,17 @@
goto err;
}
if (!r) {
- *ret |= DH_CHECK_Q_NOT_PRIME;
+ *out_flags |= DH_CHECK_Q_NOT_PRIME;
}
/* Check p == 1 mod q i.e. q divides p - 1 */
if (!BN_div(t1, t2, dh->p, dh->q, ctx)) {
goto err;
}
if (!BN_is_one(t2)) {
- *ret |= DH_CHECK_INVALID_Q_VALUE;
+ *out_flags |= DH_CHECK_INVALID_Q_VALUE;
}
if (dh->j && BN_cmp(dh->j, t1)) {
- *ret |= DH_CHECK_INVALID_J_VALUE;
+ *out_flags |= DH_CHECK_INVALID_J_VALUE;
}
} else if (BN_is_word(dh->g, DH_GENERATOR_2)) {
l = BN_mod_word(dh->p, 24);
@@ -175,7 +175,7 @@
goto err;
}
if (l != 11) {
- *ret |= DH_CHECK_NOT_SUITABLE_GENERATOR;
+ *out_flags |= DH_CHECK_NOT_SUITABLE_GENERATOR;
}
} else if (BN_is_word(dh->g, DH_GENERATOR_5)) {
l = BN_mod_word(dh->p, 10);
@@ -183,10 +183,10 @@
goto err;
}
if (l != 3 && l != 7) {
- *ret |= DH_CHECK_NOT_SUITABLE_GENERATOR;
+ *out_flags |= DH_CHECK_NOT_SUITABLE_GENERATOR;
}
} else {
- *ret |= DH_CHECK_UNABLE_TO_CHECK_GENERATOR;
+ *out_flags |= DH_CHECK_UNABLE_TO_CHECK_GENERATOR;
}
r = BN_is_prime_ex(dh->p, BN_prime_checks, ctx, NULL);
@@ -194,7 +194,7 @@
goto err;
}
if (!r) {
- *ret |= DH_CHECK_P_NOT_PRIME;
+ *out_flags |= DH_CHECK_P_NOT_PRIME;
} else if (!dh->q) {
if (!BN_rshift1(t1, dh->p)) {
goto err;
@@ -204,7 +204,7 @@
goto err;
}
if (!r) {
- *ret |= DH_CHECK_P_NOT_SAFE_PRIME;
+ *out_flags |= DH_CHECK_P_NOT_SAFE_PRIME;
}
}
ok = 1;