diff options
author | deraadt <> | 2014-05-29 21:19:30 +0000 |
---|---|---|
committer | deraadt <> | 2014-05-29 21:19:30 +0000 |
commit | e36774a3cfbf9430a020ae98951cce7b70f75c00 (patch) | |
tree | 956fc9edb289b1e8d01f4d38b053f5348ad99c38 /src/lib/libcrypto/bn | |
parent | 3d662abca6b2a7f5bc9108b036434d61fcdb6e53 (diff) | |
download | openbsd-e36774a3cfbf9430a020ae98951cce7b70f75c00.tar.gz openbsd-e36774a3cfbf9430a020ae98951cce7b70f75c00.tar.bz2 openbsd-e36774a3cfbf9430a020ae98951cce7b70f75c00.zip |
ok, next pass after review: when possible, put the reallocarray arguments
in the "size_t nmemb, size_t size"
Diffstat (limited to 'src/lib/libcrypto/bn')
-rw-r--r-- | src/lib/libcrypto/bn/bn_gf2m.c | 10 | ||||
-rw-r--r-- | src/lib/libcrypto/bn/bn_lib.c | 2 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/lib/libcrypto/bn/bn_gf2m.c b/src/lib/libcrypto/bn/bn_gf2m.c index 4bd50924d3..f451befb0d 100644 --- a/src/lib/libcrypto/bn/bn_gf2m.c +++ b/src/lib/libcrypto/bn/bn_gf2m.c | |||
@@ -547,7 +547,7 @@ BN_GF2m_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *p, | |||
547 | bn_check_top(a); | 547 | bn_check_top(a); |
548 | bn_check_top(b); | 548 | bn_check_top(b); |
549 | bn_check_top(p); | 549 | bn_check_top(p); |
550 | if ((arr = reallocarray(NULL, sizeof(int), max)) == NULL) | 550 | if ((arr = reallocarray(NULL, max, sizeof(int))) == NULL) |
551 | goto err; | 551 | goto err; |
552 | ret = BN_GF2m_poly2arr(p, arr, max); | 552 | ret = BN_GF2m_poly2arr(p, arr, max); |
553 | if (!ret || ret > max) { | 553 | if (!ret || ret > max) { |
@@ -609,7 +609,7 @@ BN_GF2m_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) | |||
609 | 609 | ||
610 | bn_check_top(a); | 610 | bn_check_top(a); |
611 | bn_check_top(p); | 611 | bn_check_top(p); |
612 | if ((arr = reallocarray(NULL, sizeof(int), max)) == NULL) | 612 | if ((arr = reallocarray(NULL, max, sizeof(int))) == NULL) |
613 | goto err; | 613 | goto err; |
614 | ret = BN_GF2m_poly2arr(p, arr, max); | 614 | ret = BN_GF2m_poly2arr(p, arr, max); |
615 | if (!ret || ret > max) { | 615 | if (!ret || ret > max) { |
@@ -1037,7 +1037,7 @@ BN_GF2m_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *p, | |||
1037 | bn_check_top(a); | 1037 | bn_check_top(a); |
1038 | bn_check_top(b); | 1038 | bn_check_top(b); |
1039 | bn_check_top(p); | 1039 | bn_check_top(p); |
1040 | if ((arr = reallocarray(NULL, sizeof(int), max)) == NULL) | 1040 | if ((arr = reallocarray(NULL, max, sizeof(int))) == NULL) |
1041 | goto err; | 1041 | goto err; |
1042 | ret = BN_GF2m_poly2arr(p, arr, max); | 1042 | ret = BN_GF2m_poly2arr(p, arr, max); |
1043 | if (!ret || ret > max) { | 1043 | if (!ret || ret > max) { |
@@ -1099,7 +1099,7 @@ BN_GF2m_mod_sqrt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) | |||
1099 | int *arr = NULL; | 1099 | int *arr = NULL; |
1100 | bn_check_top(a); | 1100 | bn_check_top(a); |
1101 | bn_check_top(p); | 1101 | bn_check_top(p); |
1102 | if ((arr = reallocarray(NULL, sizeof(int), max)) == NULL) | 1102 | if ((arr = reallocarray(NULL, max, sizeof(int))) == NULL) |
1103 | goto err; | 1103 | goto err; |
1104 | ret = BN_GF2m_poly2arr(p, arr, max); | 1104 | ret = BN_GF2m_poly2arr(p, arr, max); |
1105 | if (!ret || ret > max) { | 1105 | if (!ret || ret > max) { |
@@ -1234,7 +1234,7 @@ BN_GF2m_mod_solve_quad(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) | |||
1234 | 1234 | ||
1235 | bn_check_top(a); | 1235 | bn_check_top(a); |
1236 | bn_check_top(p); | 1236 | bn_check_top(p); |
1237 | if ((arr = reallocarray(NULL, sizeof(int), max)) == NULL) | 1237 | if ((arr = reallocarray(NULL, max, sizeof(int))) == NULL) |
1238 | goto err; | 1238 | goto err; |
1239 | ret = BN_GF2m_poly2arr(p, arr, max); | 1239 | ret = BN_GF2m_poly2arr(p, arr, max); |
1240 | if (!ret || ret > max) { | 1240 | if (!ret || ret > max) { |
diff --git a/src/lib/libcrypto/bn/bn_lib.c b/src/lib/libcrypto/bn/bn_lib.c index 28489f8181..a4f0bdd34b 100644 --- a/src/lib/libcrypto/bn/bn_lib.c +++ b/src/lib/libcrypto/bn/bn_lib.c | |||
@@ -278,7 +278,7 @@ bn_expand_internal(const BIGNUM *b, int words) | |||
278 | BN_R_EXPAND_ON_STATIC_BIGNUM_DATA); | 278 | BN_R_EXPAND_ON_STATIC_BIGNUM_DATA); |
279 | return (NULL); | 279 | return (NULL); |
280 | } | 280 | } |
281 | a = A = reallocarray(NULL, sizeof(BN_ULONG), words); | 281 | a = A = reallocarray(NULL, words, sizeof(BN_ULONG)); |
282 | if (A == NULL) { | 282 | if (A == NULL) { |
283 | BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); | 283 | BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); |
284 | return (NULL); | 284 | return (NULL); |