summaryrefslogtreecommitdiffstats
path: root/src/lib/crypto
diff options
context:
space:
mode:
authorGreg Hudson <ghudson@mit.edu>2013-07-11 20:39:51 -0400
committerGreg Hudson <ghudson@mit.edu>2013-07-11 20:39:51 -0400
commit443ce5fef316e3dc324fe84557a06b069dbe33f9 (patch)
tree1aa5e33e71690fdbd4d3f7dc36ea3de8b82869df /src/lib/crypto
parent90f9f6f6708baff4de2162c5eb754bb4bc557845 (diff)
downloadkrb5-443ce5fef316e3dc324fe84557a06b069dbe33f9.tar.gz
krb5-443ce5fef316e3dc324fe84557a06b069dbe33f9.tar.xz
krb5-443ce5fef316e3dc324fe84557a06b069dbe33f9.zip
Use k5calloc instead of k5alloc where appropriate
Wherever we use k5alloc with a multiplication in the size parameter,, use the new k5calloc helper function instead.
Diffstat (limited to 'src/lib/crypto')
-rw-r--r--src/lib/crypto/builtin/hmac.c2
-rw-r--r--src/lib/crypto/krb/cf2.c2
-rw-r--r--src/lib/crypto/krb/checksum_confounder.c4
-rw-r--r--src/lib/crypto/krb/checksum_hmac_md5.c2
-rw-r--r--src/lib/crypto/krb/combine_keys.c2
5 files changed, 6 insertions, 6 deletions
diff --git a/src/lib/crypto/builtin/hmac.c b/src/lib/crypto/builtin/hmac.c
index c697a76e85..95c8f5f4a0 100644
--- a/src/lib/crypto/builtin/hmac.c
+++ b/src/lib/crypto/builtin/hmac.c
@@ -71,7 +71,7 @@ krb5int_hmac_keyblock(const struct krb5_hash_provider *hash,
ihash = k5alloc(hash->hashsize, &ret);
if (ihash == NULL)
goto cleanup;
- ihash_iov = k5alloc((num_data + 1) * sizeof(krb5_crypto_iov), &ret);
+ ihash_iov = k5calloc(num_data + 1, sizeof(krb5_crypto_iov), &ret);
if (ihash_iov == NULL)
goto cleanup;
diff --git a/src/lib/crypto/krb/cf2.c b/src/lib/crypto/krb/cf2.c
index e6d990cef7..5eec1540f6 100644
--- a/src/lib/crypto/krb/cf2.c
+++ b/src/lib/crypto/krb/cf2.c
@@ -56,7 +56,7 @@ prf_plus(krb5_context context, krb5_keyblock *k, const char *pepper,
if (keybytes % prflen != 0)
iterations++;
assert(iterations <= 254);
- buffer = k5alloc(iterations * prflen, &retval);
+ buffer = k5calloc(iterations, prflen, &retval);
if (retval)
goto cleanup;
if (k5_buf_len(&prf_inbuf) == -1) {
diff --git a/src/lib/crypto/krb/checksum_confounder.c b/src/lib/crypto/krb/checksum_confounder.c
index 0e54953cac..31c7cd3646 100644
--- a/src/lib/crypto/krb/checksum_confounder.c
+++ b/src/lib/crypto/krb/checksum_confounder.c
@@ -83,7 +83,7 @@ krb5int_confounder_checksum(const struct krb5_cksumtypes *ctp,
return ret;
/* Hash the confounder, then the input data. */
- hash_iov = k5alloc((num_data + 1) * sizeof(krb5_crypto_iov), &ret);
+ hash_iov = k5calloc(num_data + 1, sizeof(krb5_crypto_iov), &ret);
if (hash_iov == NULL)
goto cleanup;
hash_iov[0].flags = KRB5_CRYPTO_TYPE_DATA;
@@ -134,7 +134,7 @@ krb5_error_code krb5int_confounder_verify(const struct krb5_cksumtypes *ctp,
goto cleanup;
/* Hash the confounder, then the input data. */
- hash_iov = k5alloc((num_data + 1) * sizeof(krb5_crypto_iov), &ret);
+ hash_iov = k5calloc(num_data + 1, sizeof(krb5_crypto_iov), &ret);
if (hash_iov == NULL)
goto cleanup;
hash_iov[0].flags = KRB5_CRYPTO_TYPE_DATA;
diff --git a/src/lib/crypto/krb/checksum_hmac_md5.c b/src/lib/crypto/krb/checksum_hmac_md5.c
index 8145875ba9..ec024f3966 100644
--- a/src/lib/crypto/krb/checksum_hmac_md5.c
+++ b/src/lib/crypto/krb/checksum_hmac_md5.c
@@ -68,7 +68,7 @@ krb5_error_code krb5int_hmacmd5_checksum(const struct krb5_cksumtypes *ctp,
/* Compute the MD5 value of the input. */
ms_usage = krb5int_arcfour_translate_usage(usage);
store_32_le(ms_usage, t);
- hash_iov = k5alloc((num_data + 1) * sizeof(krb5_crypto_iov), &ret);
+ hash_iov = k5calloc(num_data + 1, sizeof(krb5_crypto_iov), &ret);
if (hash_iov == NULL)
goto cleanup;
hash_iov[0].flags = KRB5_CRYPTO_TYPE_DATA;
diff --git a/src/lib/crypto/krb/combine_keys.c b/src/lib/crypto/krb/combine_keys.c
index d9235dd730..0c44e8b430 100644
--- a/src/lib/crypto/krb/combine_keys.c
+++ b/src/lib/crypto/krb/combine_keys.c
@@ -110,7 +110,7 @@ krb5int_c_combine_keys(krb5_context context, krb5_keyblock *key1,
rnd = k5alloc(keybytes, &ret);
if (ret)
goto cleanup;
- combined = k5alloc(keybytes * 2, &ret);
+ combined = k5calloc(2, keybytes, &ret);
if (ret)
goto cleanup;
output = k5alloc(keylength, &ret);