diff options
| author | Greg Hudson <ghudson@mit.edu> | 2013-07-11 20:39:51 -0400 |
|---|---|---|
| committer | Greg Hudson <ghudson@mit.edu> | 2013-07-11 20:39:51 -0400 |
| commit | 443ce5fef316e3dc324fe84557a06b069dbe33f9 (patch) | |
| tree | 1aa5e33e71690fdbd4d3f7dc36ea3de8b82869df /src/lib/crypto/krb | |
| parent | 90f9f6f6708baff4de2162c5eb754bb4bc557845 (diff) | |
| download | krb5-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/krb')
| -rw-r--r-- | src/lib/crypto/krb/cf2.c | 2 | ||||
| -rw-r--r-- | src/lib/crypto/krb/checksum_confounder.c | 4 | ||||
| -rw-r--r-- | src/lib/crypto/krb/checksum_hmac_md5.c | 2 | ||||
| -rw-r--r-- | src/lib/crypto/krb/combine_keys.c | 2 |
4 files changed, 5 insertions, 5 deletions
diff --git a/src/lib/crypto/krb/cf2.c b/src/lib/crypto/krb/cf2.c index e6d990cef..5eec1540f 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 0e54953ca..31c7cd364 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 8145875ba..ec024f396 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 d9235dd73..0c44e8b43 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); |
