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 | |
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')
-rw-r--r-- | src/lib/crypto/builtin/hmac.c | 2 | ||||
-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 | ||||
-rw-r--r-- | src/lib/kadm5/srv/kadm5_hook.c | 2 | ||||
-rw-r--r-- | src/lib/kadm5/srv/pwqual.c | 2 | ||||
-rw-r--r-- | src/lib/kadm5/srv/server_kdb.c | 2 | ||||
-rw-r--r-- | src/lib/krb5/ccache/ccselect.c | 2 | ||||
-rw-r--r-- | src/lib/krb5/krb/preauth_encts.c | 2 | ||||
-rw-r--r-- | src/lib/krb5/krb/s4u_authdata.c | 8 | ||||
-rw-r--r-- | src/lib/krb5/krb/send_tgs.c | 2 | ||||
-rw-r--r-- | src/lib/krb5/os/expand_path.c | 2 | ||||
-rw-r--r-- | src/lib/krb5/os/localauth.c | 2 |
14 files changed, 18 insertions, 18 deletions
diff --git a/src/lib/crypto/builtin/hmac.c b/src/lib/crypto/builtin/hmac.c index c697a76e8..95c8f5f4a 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 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); diff --git a/src/lib/kadm5/srv/kadm5_hook.c b/src/lib/kadm5/srv/kadm5_hook.c index 68a6b5eb4..62f3bffce 100644 --- a/src/lib/kadm5/srv/kadm5_hook.c +++ b/src/lib/kadm5/srv/kadm5_hook.c @@ -53,7 +53,7 @@ k5_kadm5_hook_load(krb5_context context, /* Allocate a large enough list of handles. */ for (count = 0; modules[count] != NULL; count++); - list = k5alloc((count + 1) * sizeof(*list), &ret); + list = k5calloc(count + 1, sizeof(*list), &ret); if (list == NULL) goto cleanup; diff --git a/src/lib/kadm5/srv/pwqual.c b/src/lib/kadm5/srv/pwqual.c index 8c53391ec..666852f1d 100644 --- a/src/lib/kadm5/srv/pwqual.c +++ b/src/lib/kadm5/srv/pwqual.c @@ -55,7 +55,7 @@ k5_pwqual_load(krb5_context context, const char *dict_file, /* Allocate a large enough list of handles. */ for (count = 0; modules[count] != NULL; count++); - list = k5alloc((count + 1) * sizeof(*list), &ret); + list = k5calloc(count + 1, sizeof(*list), &ret); if (list == NULL) goto cleanup; diff --git a/src/lib/kadm5/srv/server_kdb.c b/src/lib/kadm5/srv/server_kdb.c index 23661448a..8a82237c3 100644 --- a/src/lib/kadm5/srv/server_kdb.c +++ b/src/lib/kadm5/srv/server_kdb.c @@ -188,7 +188,7 @@ kdb_get_hist_key(kadm5_server_handle_t handle, krb5_keyblock **keyblocks_out, if (ret) goto done; - kblist = k5alloc((kdb->n_key_data + 1) * sizeof(*kblist), &ret); + kblist = k5calloc(kdb->n_key_data + 1, sizeof(*kblist), &ret); if (kblist == NULL) goto done; for (i = 0; i < kdb->n_key_data; i++) { diff --git a/src/lib/krb5/ccache/ccselect.c b/src/lib/krb5/ccache/ccselect.c index 235c0c6a4..2f3071a27 100644 --- a/src/lib/krb5/ccache/ccselect.c +++ b/src/lib/krb5/ccache/ccselect.c @@ -77,7 +77,7 @@ load_modules(krb5_context context) /* Allocate a large enough list of handles. */ for (count = 0; modules[count] != NULL; count++); - list = k5alloc((count + 1) * sizeof(*list), &ret); + list = k5calloc(count + 1, sizeof(*list), &ret); if (list == NULL) goto cleanup; diff --git a/src/lib/krb5/krb/preauth_encts.c b/src/lib/krb5/krb/preauth_encts.c index b8295aaf4..cec384227 100644 --- a/src/lib/krb5/krb/preauth_encts.c +++ b/src/lib/krb5/krb/preauth_encts.c @@ -92,7 +92,7 @@ encts_process(krb5_context context, krb5_clpreauth_moddata moddata, if (ret) goto cleanup; - pa = k5alloc(2 * sizeof(krb5_pa_data *), &ret); + pa = k5calloc(2, sizeof(krb5_pa_data *), &ret); if (pa == NULL) goto cleanup; diff --git a/src/lib/krb5/krb/s4u_authdata.c b/src/lib/krb5/krb/s4u_authdata.c index d93e75816..5b4704b75 100644 --- a/src/lib/krb5/krb/s4u_authdata.c +++ b/src/lib/krb5/krb/s4u_authdata.c @@ -165,7 +165,7 @@ s4u2proxy_export_authdata(krb5_context kcontext, memset(&sp, 0, sizeof(sp)); sp.delegated = s4uctx->delegated; - authdata = k5alloc(2 * sizeof(krb5_authdata *), &code); + authdata = k5calloc(2, sizeof(krb5_authdata *), &code); if (authdata == NULL) return code; @@ -253,7 +253,7 @@ s4u2proxy_get_attribute_types(krb5_context kcontext, if (s4uctx->count == 0) return ENOENT; - attrs = k5alloc(2 * sizeof(krb5_data), &code); + attrs = k5calloc(2, sizeof(krb5_data), &code); if (attrs == NULL) goto cleanup; @@ -379,7 +379,7 @@ s4u2proxy_export_internal(krb5_context kcontext, if (restrict_authenticated) return ENOENT; - delegated = k5alloc((s4uctx->count + 1) * sizeof(krb5_principal), &code); + delegated = k5calloc(s4uctx->count + 1, sizeof(krb5_principal), &code); if (delegated == NULL) return code; @@ -511,7 +511,7 @@ s4u2proxy_internalize(krb5_context kcontext, else if (count > 0) { int i; - delegated = k5alloc((count + 1) * sizeof(krb5_principal), &code); + delegated = k5calloc(count + 1, sizeof(krb5_principal), &code); if (delegated == NULL) goto cleanup; diff --git a/src/lib/krb5/krb/send_tgs.c b/src/lib/krb5/krb/send_tgs.c index 9a7c261dd..cd56366cb 100644 --- a/src/lib/krb5/krb/send_tgs.c +++ b/src/lib/krb5/krb/send_tgs.c @@ -232,7 +232,7 @@ k5_make_tgs_req(krb5_context context, for (count = 0; in_padata != NULL && in_padata[count] != NULL; count++); /* Construct a padata array for the request, beginning with the ap-req. */ - padata = k5alloc((count + 2) * sizeof(krb5_pa_data *), &ret); + padata = k5calloc(count + 2, sizeof(krb5_pa_data *), &ret); if (padata == NULL) goto cleanup; padata[0] = k5alloc(sizeof(krb5_pa_data), &ret); diff --git a/src/lib/krb5/os/expand_path.c b/src/lib/krb5/os/expand_path.c index 3d23849ba..f14e9acd8 100644 --- a/src/lib/krb5/os/expand_path.c +++ b/src/lib/krb5/os/expand_path.c @@ -477,7 +477,7 @@ k5_expand_path_tokens_extra(krb5_context context, const char *path_in, /* Get extra tokens. */ if (nargs > 0) { - extra_tokens = k5alloc((nargs + 1) * sizeof(char *), &ret); + extra_tokens = k5calloc(nargs + 1, sizeof(char *), &ret); if (extra_tokens == NULL) goto cleanup; va_start(ap, path_out); diff --git a/src/lib/krb5/os/localauth.c b/src/lib/krb5/os/localauth.c index 82fc1f950..81ab5d8ab 100644 --- a/src/lib/krb5/os/localauth.c +++ b/src/lib/krb5/os/localauth.c @@ -155,7 +155,7 @@ load_localauth_modules(krb5_context context) /* Allocate a large enough list of handles. */ for (count = 0; modules[count] != NULL; count++); - list = k5alloc((count + 1) * sizeof(*list), &ret); + list = k5calloc(count + 1, sizeof(*list), &ret); if (list == NULL) goto cleanup; |