Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/crypto/external/bsd/libsaslc/dist/src fix size_t inconsisten...



details:   https://anonhg.NetBSD.org/src/rev/2f89174af4bb
branches:  trunk
changeset: 761995:2f89174af4bb
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Feb 12 22:46:14 2011 +0000

description:
fix size_t inconsistencies.

diffstat:

 crypto/external/bsd/libsaslc/dist/src/crypto.c         |  13 ++++----
 crypto/external/bsd/libsaslc/dist/src/mech_digestmd5.c |  27 ++++++++++--------
 crypto/external/bsd/libsaslc/dist/src/mech_gssapi.c    |   6 ++--
 crypto/external/bsd/libsaslc/dist/src/xsess.c          |   8 ++--
 4 files changed, 28 insertions(+), 26 deletions(-)

diffs (217 lines):

diff -r 1606574191d1 -r 2f89174af4bb crypto/external/bsd/libsaslc/dist/src/crypto.c
--- a/crypto/external/bsd/libsaslc/dist/src/crypto.c    Sat Feb 12 22:30:04 2011 +0000
+++ b/crypto/external/bsd/libsaslc/dist/src/crypto.c    Sat Feb 12 22:46:14 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: crypto.c,v 1.3 2011/02/11 23:44:43 christos Exp $ */
+/* $NetBSD: crypto.c,v 1.4 2011/02/12 22:46:14 christos Exp $ */
 
 /*
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: crypto.c,v 1.3 2011/02/11 23:44:43 christos Exp $");
+__RCSID("$NetBSD: crypto.c,v 1.4 2011/02/12 22:46:14 christos Exp $");
 
 #include <assert.h>
 #include <stdio.h>
@@ -214,7 +214,7 @@
 
        assert(digest != NULL);
        if (digest != NULL)
-               (void)MD5((const unsigned char *)buf, (int)buflen, digest);
+               (void)MD5((const unsigned char *)buf, buflen, digest);
 }
 
 /**
@@ -229,7 +229,7 @@
 {
        unsigned char digest[MD5_DIGEST_LENGTH];
 
-       (void)MD5((const unsigned char *)buf, (int)buflen, digest);
+       (void)MD5((const unsigned char *)buf, buflen, digest);
        return saslc__crypto_hash_to_hex(digest);
 }
 
@@ -249,9 +249,8 @@
        unsigned int hmac_len;
 
        assert(hmac != NULL);
-       if (hmac == NULL ||
-           HMAC(EVP_md5(), key, (int)keylen, in, (int)inlen, hmac, &hmac_len)
-           == NULL)
+       if (hmac == NULL || HMAC(EVP_md5(), key, (int)keylen, in,
+           inlen, hmac, &hmac_len) == NULL)
                return -1;
 
        assert(hmac_len == MD5_DIGEST_LENGTH);
diff -r 1606574191d1 -r 2f89174af4bb crypto/external/bsd/libsaslc/dist/src/mech_digestmd5.c
--- a/crypto/external/bsd/libsaslc/dist/src/mech_digestmd5.c    Sat Feb 12 22:30:04 2011 +0000
+++ b/crypto/external/bsd/libsaslc/dist/src/mech_digestmd5.c    Sat Feb 12 22:46:14 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mech_digestmd5.c,v 1.5 2011/02/12 22:24:01 matt Exp $ */
+/* $NetBSD: mech_digestmd5.c,v 1.6 2011/02/12 22:46:14 christos Exp $ */
 
 /* Copyright (c) 2010 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -35,7 +35,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: mech_digestmd5.c,v 1.5 2011/02/12 22:24:01 matt Exp $");
+__RCSID("$NetBSD: mech_digestmd5.c,v 1.6 2011/02/12 22:46:14 christos Exp $");
 
 #include <assert.h>
 #include <md5.h>
@@ -167,7 +167,7 @@
        list_t *        realm;
        uint32_t        cipher_flags;
        uint32_t        qop_flags;
-       unsigned long   maxbuf;
+       size_t          maxbuf;
 } cdata_t;
 
 typedef struct { /* response data */
@@ -461,7 +461,8 @@
        char *tmp1, *tmp2, *r;
        char *unq_authzid;
        md5hash_t a1hash, userhash;
-       int len;
+       int plen;
+       size_t len;
  /*****************************************************************************/
  /* If authzid is specified, then A1 is                                       */
  /*                                                                           */
@@ -478,18 +479,19 @@
                return NULL;
 
        if (ms->rdata.authzid == NULL)
-               len = asprintf(&tmp1, ":%s:%s",
+               plen = asprintf(&tmp1, ":%s:%s",
                    ms->cdata.nonce, ms->rdata.cnonce);
        else {
                if ((unq_authzid = unq(ms->rdata.authzid)) == NULL)
                        return NULL;
 
-               len = asprintf(&tmp1, ":%s:%s:%s",
+               plen = asprintf(&tmp1, ":%s:%s:%s",
                    ms->cdata.nonce, ms->rdata.cnonce, unq_authzid);
                free(unq_authzid);
        }
-       if (len == -1)
+       if (plen == -1)
                return NULL;
+       len = plen;
 
        tmp2 = malloc(MD5_DIGEST_LENGTH + len);
        if (tmp2 == NULL) {
@@ -939,7 +941,7 @@
        static const struct cipher_ctx_tbl_s {
                cipher_t eval;                  /* for error checking */
                const EVP_CIPHER *(*evp_type)(void);/* type of cipher */
-               int keylen;                     /* key length */
+               size_t keylen;                  /* key length */
                ssize_t blksize;                /* block size for cipher */
                size_t ivlen;                   /* initial value length */
        } cipher_ctx_tbl[] = {
@@ -1017,7 +1019,8 @@
        case CIPHER_RC4_40:
        case CIPHER_RC4_56:
                assert(ctp->ivlen == 0);        /* no IV */
-               rv = EVP_CIPHER_CTX_set_key_length(ctx->evp_ctx, ctp->keylen);
+               rv = EVP_CIPHER_CTX_set_key_length(ctx->evp_ctx,
+                   (int)ctp->keylen);
                if (rv == 0) {
                        errmsg = "EVP_CIPHER_CTX_set_key_length failed";
                        goto err;
@@ -1510,7 +1513,7 @@
        list_t *l, *n;
        list_t *tmp_list;
        cdata_t *cdata;
-       unsigned long maxbuf;
+       size_t maxbuf;
        uint32_t tmp_flags;
        int rv;
 
@@ -1640,7 +1643,7 @@
                                    "multiple maxbuf in challenge");
                                goto out;
                        }
-                       maxbuf = strtoul(val, NULL, 10);
+                       maxbuf = (size_t)strtoul(val, NULL, 10);
                        if (INVALID_MAXBUF(maxbuf)) {
                                saslc__error_set(ERR(sess), ERROR_MECH,
                                    "invalid maxbuf in challenge");
@@ -1954,7 +1957,7 @@
        if (ms->mech_sess.qop != QOP_NONE) {
                maxbuf = saslc_sess_getprop(sess, SASLC_DIGESTMD5_MAXBUF);
                if (maxbuf != NULL)
-                       rdata->maxbuf = strtoul(maxbuf, NULL, 10);
+                       rdata->maxbuf = (size_t)strtoul(maxbuf, NULL, 10);
                if (rdata->maxbuf == 0)
                        rdata->maxbuf = cdata->maxbuf;
                if (INVALID_MAXBUF(rdata->maxbuf)) {
diff -r 1606574191d1 -r 2f89174af4bb crypto/external/bsd/libsaslc/dist/src/mech_gssapi.c
--- a/crypto/external/bsd/libsaslc/dist/src/mech_gssapi.c       Sat Feb 12 22:30:04 2011 +0000
+++ b/crypto/external/bsd/libsaslc/dist/src/mech_gssapi.c       Sat Feb 12 22:46:14 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mech_gssapi.c,v 1.3 2011/02/11 23:44:43 christos Exp $ */
+/* $NetBSD: mech_gssapi.c,v 1.4 2011/02/12 22:46:14 christos Exp $ */
 
 /* Copyright (c) 2010 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -35,7 +35,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: mech_gssapi.c,v 1.3 2011/02/11 23:44:43 christos Exp $");
+__RCSID("$NetBSD: mech_gssapi.c,v 1.4 2011/02/12 22:46:14 christos Exp $");
 
 #include <assert.h>
 #include <errno.h>
@@ -269,7 +269,7 @@
        }
        buflen = outbuf->length + 4;
        if (buflen > ms->omaxbuf) {
-               saslc__error_set(ERR(sess), MECH_ERROR,
+               saslc__error_set(ERR(sess), ERROR_MECH,
                    "output exceeds server maxbuf size");
                gss_release_buffer(&min_s, outbuf);
                return -1;
diff -r 1606574191d1 -r 2f89174af4bb crypto/external/bsd/libsaslc/dist/src/xsess.c
--- a/crypto/external/bsd/libsaslc/dist/src/xsess.c     Sat Feb 12 22:30:04 2011 +0000
+++ b/crypto/external/bsd/libsaslc/dist/src/xsess.c     Sat Feb 12 22:46:14 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xsess.c,v 1.3 2011/02/11 23:44:43 christos Exp $ */
+/* $NetBSD: xsess.c,v 1.4 2011/02/12 22:46:14 christos Exp $ */
 
 /*
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: xsess.c,v 1.3 2011/02/11 23:44:43 christos Exp $");
+__RCSID("$NetBSD: xsess.c,v 1.4 2011/02/12 22:46:14 christos Exp $");
 
 #include <assert.h>
 #include <saslc.h>
@@ -429,7 +429,7 @@
                        saslc_debug = saslc__parser_is_true(debug);
        }
 
-       saslc__msg_dbg("%s: encoded: inlen=%zd in='%s'", __func__, inlen,
+       saslc__msg_dbg("%s: encoded: inlen=%zu in='%s'", __func__, inlen,
            in ? (const char *)in : "<null>");
        if (inlen == 0 || (sess->flags & SASLC_FLAGS_BASE64_IN) == 0)
                dec = NULL;
@@ -442,7 +442,7 @@
                }
                in = dec;
        }
-       saslc__msg_dbg("%s: decoded: inlen=%zd in='%s'", __func__, inlen,
+       saslc__msg_dbg("%s: decoded: inlen=%zu in='%s'", __func__, inlen,
            in ? (const char *)in : "<null>");
        rv = sess->mech->cont(sess, in, inlen, out, outlen);
        if (dec != NULL)



Home | Main Index | Thread Index | Old Index