summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2014-05-29 21:19:31 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2014-05-29 21:19:31 +0000
commit6691dbf59b4226a983036d794916439cf6954a66 (patch)
treedb206a382c16fe688878972c3ae7d1dd62069a51
parent23e318bc3fe7526bacb503f5b14da8aee3502871 (diff)
ok, next pass after review: when possible, put the reallocarray arguments
in the "size_t nmemb, size_t size"
-rw-r--r--lib/libcrypto/bn/bn_gf2m.c10
-rw-r--r--lib/libcrypto/bn/bn_lib.c2
-rw-r--r--lib/libcrypto/ec/ec_mult.c2
-rw-r--r--lib/libcrypto/lhash/lhash.c2
-rw-r--r--lib/libcrypto/objects/obj_xref.c2
-rw-r--r--lib/libcrypto/txt_db/txt_db.c4
-rw-r--r--lib/libcrypto/x509v3/pcy_tree.c2
7 files changed, 12 insertions, 12 deletions
diff --git a/lib/libcrypto/bn/bn_gf2m.c b/lib/libcrypto/bn/bn_gf2m.c
index 4bd50924d30..f451befb0d3 100644
--- a/lib/libcrypto/bn/bn_gf2m.c
+++ b/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,
bn_check_top(a);
bn_check_top(b);
bn_check_top(p);
- if ((arr = reallocarray(NULL, sizeof(int), max)) == NULL)
+ if ((arr = reallocarray(NULL, max, sizeof(int))) == NULL)
goto err;
ret = BN_GF2m_poly2arr(p, arr, max);
if (!ret || ret > max) {
@@ -609,7 +609,7 @@ BN_GF2m_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx)
bn_check_top(a);
bn_check_top(p);
- if ((arr = reallocarray(NULL, sizeof(int), max)) == NULL)
+ if ((arr = reallocarray(NULL, max, sizeof(int))) == NULL)
goto err;
ret = BN_GF2m_poly2arr(p, arr, max);
if (!ret || ret > max) {
@@ -1037,7 +1037,7 @@ BN_GF2m_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *p,
bn_check_top(a);
bn_check_top(b);
bn_check_top(p);
- if ((arr = reallocarray(NULL, sizeof(int), max)) == NULL)
+ if ((arr = reallocarray(NULL, max, sizeof(int))) == NULL)
goto err;
ret = BN_GF2m_poly2arr(p, arr, max);
if (!ret || ret > max) {
@@ -1099,7 +1099,7 @@ BN_GF2m_mod_sqrt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx)
int *arr = NULL;
bn_check_top(a);
bn_check_top(p);
- if ((arr = reallocarray(NULL, sizeof(int), max)) == NULL)
+ if ((arr = reallocarray(NULL, max, sizeof(int))) == NULL)
goto err;
ret = BN_GF2m_poly2arr(p, arr, max);
if (!ret || ret > max) {
@@ -1234,7 +1234,7 @@ BN_GF2m_mod_solve_quad(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx)
bn_check_top(a);
bn_check_top(p);
- if ((arr = reallocarray(NULL, sizeof(int), max)) == NULL)
+ if ((arr = reallocarray(NULL, max, sizeof(int))) == NULL)
goto err;
ret = BN_GF2m_poly2arr(p, arr, max);
if (!ret || ret > max) {
diff --git a/lib/libcrypto/bn/bn_lib.c b/lib/libcrypto/bn/bn_lib.c
index 28489f8181d..a4f0bdd34b6 100644
--- a/lib/libcrypto/bn/bn_lib.c
+++ b/lib/libcrypto/bn/bn_lib.c
@@ -278,7 +278,7 @@ bn_expand_internal(const BIGNUM *b, int words)
BN_R_EXPAND_ON_STATIC_BIGNUM_DATA);
return (NULL);
}
- a = A = reallocarray(NULL, sizeof(BN_ULONG), words);
+ a = A = reallocarray(NULL, words, sizeof(BN_ULONG));
if (A == NULL) {
BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE);
return (NULL);
diff --git a/lib/libcrypto/ec/ec_mult.c b/lib/libcrypto/ec/ec_mult.c
index b3bd34d82df..0fd0cab2f1a 100644
--- a/lib/libcrypto/ec/ec_mult.c
+++ b/lib/libcrypto/ec/ec_mult.c
@@ -790,7 +790,7 @@ ec_wNAF_precompute_mult(EC_GROUP * group, BN_CTX * ctx)
num = pre_points_per_block * numblocks; /* number of points to
* compute and store */
- points = reallocarray(NULL, sizeof(EC_POINT *), (num + 1));
+ points = reallocarray(NULL, (num + 1), sizeof(EC_POINT *));
if (!points) {
ECerr(EC_F_EC_WNAF_PRECOMPUTE_MULT, ERR_R_MALLOC_FAILURE);
goto err;
diff --git a/lib/libcrypto/lhash/lhash.c b/lib/libcrypto/lhash/lhash.c
index e75a43f5066..1e3359cfe06 100644
--- a/lib/libcrypto/lhash/lhash.c
+++ b/lib/libcrypto/lhash/lhash.c
@@ -119,7 +119,7 @@ lh_new(LHASH_HASH_FN_TYPE h, LHASH_COMP_FN_TYPE c)
if ((ret = malloc(sizeof(_LHASH))) == NULL)
goto err0;
- if ((ret->b = reallocarray(NULL, sizeof(LHASH_NODE *), MIN_NODES)) == NULL)
+ if ((ret->b = reallocarray(NULL, MIN_NODES, sizeof(LHASH_NODE *))) == NULL)
goto err1;
for (i = 0; i < MIN_NODES; i++)
ret->b[i] = NULL;
diff --git a/lib/libcrypto/objects/obj_xref.c b/lib/libcrypto/objects/obj_xref.c
index 8e9128efc4b..2c1631e7734 100644
--- a/lib/libcrypto/objects/obj_xref.c
+++ b/lib/libcrypto/objects/obj_xref.c
@@ -164,7 +164,7 @@ OBJ_add_sigid(int signid, int dig_id, int pkey_id)
sigx_app = sk_nid_triple_new(sigx_cmp);
if (!sigx_app)
return 0;
- ntr = reallocarray(NULL, sizeof(int), 3);
+ ntr = reallocarray(NULL, 3, sizeof(int));
if (!ntr)
return 0;
ntr->sign_id = signid;
diff --git a/lib/libcrypto/txt_db/txt_db.c b/lib/libcrypto/txt_db/txt_db.c
index 0f3a7ffbb39..e29a60316ae 100644
--- a/lib/libcrypto/txt_db/txt_db.c
+++ b/lib/libcrypto/txt_db/txt_db.c
@@ -94,9 +94,9 @@ TXT_DB_read(BIO *in, int num)
ret->qual = NULL;
if ((ret->data = sk_OPENSSL_PSTRING_new_null()) == NULL)
goto err;
- if ((ret->index = reallocarray(NULL, sizeof(*ret->index), num)) == NULL)
+ if ((ret->index = reallocarray(NULL, num, sizeof(*ret->index))) == NULL)
goto err;
- if ((ret->qual = reallocarray(NULL, sizeof(*(ret->qual)), num)) == NULL)
+ if ((ret->qual = reallocarray(NULL, num, sizeof(*(ret->qual)))) == NULL)
goto err;
for (i = 0; i < num; i++) {
ret->index[i] = NULL;
diff --git a/lib/libcrypto/x509v3/pcy_tree.c b/lib/libcrypto/x509v3/pcy_tree.c
index 080a87d6741..4aa83e027da 100644
--- a/lib/libcrypto/x509v3/pcy_tree.c
+++ b/lib/libcrypto/x509v3/pcy_tree.c
@@ -220,7 +220,7 @@ tree_init(X509_POLICY_TREE **ptree, STACK_OF(X509) *certs, unsigned int flags)
return 0;
tree->flags = 0;
- tree->levels = reallocarray(NULL, sizeof(X509_POLICY_LEVEL), n);
+ tree->levels = reallocarray(NULL, n, sizeof(X509_POLICY_LEVEL));
tree->nlevel = 0;
tree->extra_data = NULL;
tree->auth_policies = NULL;