From 444753045ad6499c9aa9c4482ea79cbdde3fdb23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Love=20H=C3=B6rnquist=20=C3=85strand?= Date: Tue, 28 Nov 2006 03:59:34 +0000 Subject: [PATCH] use unsigned int as counter to fit better with the asn1 compiler git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@19166 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/hx509/crypto.c | 20 ++++++++++++-------- lib/hx509/hxtool.c | 14 +++++++------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/lib/hx509/crypto.c b/lib/hx509/crypto.c index 1fcca0d74..0a1fa5860 100644 --- a/lib/hx509/crypto.c +++ b/lib/hx509/crypto.c @@ -2139,9 +2139,11 @@ hx509_crypto_select(const hx509_context context, def = hx509_signature_sha1(); } else if (type == HX509_SELECT_PUBLIC_SIG) { bits = SIG_PUBLIC_SIG; - def = hx509_signature_rsa_with_sha1(); /* XXX depend on `sourceŽ and `peerŽ */ + /* XXX depend on `sourceŽ and `peerŽ */ + def = hx509_signature_rsa_with_sha1(); } else { - hx509_set_error_string(context, 0, EINVAL, "unknown type %d of selection", type); + hx509_set_error_string(context, 0, EINVAL, + "Unknown type %d of selection", type); return EINVAL; } @@ -2152,7 +2154,8 @@ hx509_crypto_select(const hx509_context context, for (j = 0; sig_algs[j]; j++) { if ((sig_algs[j]->flags & bits) != bits) continue; - if (der_heim_oid_cmp((*sig_algs[j]->sig_oid)(), &peer->val[i].algorithm) != 0) + if (der_heim_oid_cmp((*sig_algs[j]->sig_oid)(), + &peer->val[i].algorithm) != 0) continue; if (keytype && sig_algs[j]->key_oid && der_heim_oid_cmp(keytype, (*sig_algs[j]->key_oid)())) @@ -2179,10 +2182,10 @@ hx509_crypto_available(hx509_context context, int type, hx509_cert source, AlgorithmIdentifier **val, - size_t *plen) + unsigned int *plen) { const heim_oid *keytype = NULL; - size_t len, i; + unsigned int len, i; void *ptr; int bits, ret; @@ -2195,7 +2198,8 @@ hx509_crypto_available(hx509_context context, } else if (type == HX509_SELECT_PUBLIC_SIG) { bits = SIG_PUBLIC_SIG; } else { - hx509_set_error_string(context, 0, EINVAL, "unknown type %d of available", type); + hx509_set_error_string(context, 0, EINVAL, + "Unknown type %d of available", type); return EINVAL; } @@ -2238,9 +2242,9 @@ out: void hx509_crypto_free_algs(AlgorithmIdentifier *val, - size_t len) + unsigned int len) { - size_t i; + unsigned int i; for (i = 0; i < len; i++) free_AlgorithmIdentifier(&val[i]); free(val); diff --git a/lib/hx509/hxtool.c b/lib/hx509/hxtool.c index dd8f080ba..3c2618a0b 100644 --- a/lib/hx509/hxtool.c +++ b/lib/hx509/hxtool.c @@ -993,10 +993,9 @@ random_data(void *opt, int argc, char **argv) int crypto_available(struct crypto_available_options *opt, int argc, char **argv) { - int ret; - size_t len, i; AlgorithmIdentifier *val; - int type = HX509_SELECT_ALL; + unsigned int len, i; + int ret, type; if (opt->type_string) { if (strcmp(opt->type_string, "all") == 0) @@ -1007,7 +1006,8 @@ crypto_available(struct crypto_available_options *opt, int argc, char **argv) type = HX509_SELECT_PUBLIC_SIG; else errx(1, "unknown type: %s", opt->type_string); - } + } else + type = HX509_SELECT_ALL; ret = hx509_crypto_available(context, type, NULL, &val, &len); if (ret) @@ -1030,9 +1030,8 @@ crypto_select(struct crypto_select_options *opt, int argc, char **argv) { hx509_peer_info peer = NULL; AlgorithmIdentifier selected; - int ret; + int ret, type; char *s; - int type = HX509_SELECT_DIGEST; if (opt->type_string) { if (strcmp(opt->type_string, "digest") == 0) @@ -1041,7 +1040,8 @@ crypto_select(struct crypto_select_options *opt, int argc, char **argv) type = HX509_SELECT_PUBLIC_SIG; else errx(1, "unknown type: %s", opt->type_string); - } + } else + type = HX509_SELECT_DIGEST; if (opt->peer_cmstype_strings.num_strings) { AlgorithmIdentifier *val;