From: Cristian Stoica <cristian.sto...@freescale.com>

Linux crypto-api uses 'unsigned int' for hash or cipher algorithm key
length.

Signed-off-by: Cristian Stoica <cristian.sto...@freescale.com>
Reviewed-by: Mircea Pop <mircea....@freescale.com>
Reviewed-by: Alexandru Porosanu <alexandru.poros...@freescale.com>
Reviewed-by: Horia Ioan Geanta Neag <horia.gea...@freescale.com>
Tested-by: Horia Ioan Geanta Neag <horia.gea...@freescale.com>
Signed-off-by: Horia Geanta <horia.gea...@freescale.com>
---
 cryptlib.c |   10 +++++-----
 cryptlib.h |    4 ++--
 ioctl.c    |    4 ++--
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/cryptlib.c b/cryptlib.c
index 54d5d41..90fb491 100644
--- a/cryptlib.c
+++ b/cryptlib.c
@@ -54,7 +54,7 @@ static void cryptodev_complete(struct crypto_async_request 
*req, int err)
 }
 
 int cryptodev_cipher_init(struct cipher_data *out, const char *alg_name,
-                               uint8_t *keyp, size_t keylen, int stream, int 
aead)
+                               uint8_t *keyp, unsigned int keylen, int stream, 
int aead)
 {
        int ret;
 
@@ -74,7 +74,7 @@ int cryptodev_cipher_init(struct cipher_data *out, const char 
*alg_name,
                                        unlikely((keylen < alg->min_keysize) ||
                                        (keylen > alg->max_keysize))) {
                                dprintk(1, KERN_DEBUG,
-                                       "Wrong keylen '%zu' for algorithm '%s'. 
\
+                                       "Wrong keylen '%u' for algorithm '%s'. \
                                        Use %u to %u.\n",
                                           keylen, alg_name, alg->min_keysize,
                                           alg->max_keysize);
@@ -103,7 +103,7 @@ int cryptodev_cipher_init(struct cipher_data *out, const 
char *alg_name,
        }
 
        if (unlikely(ret)) {
-               dprintk(1, KERN_DEBUG, "Setting key failed for %s-%zu.\n",
+               dprintk(1, KERN_DEBUG, "Setting key failed for %s-%u.\n",
                        alg_name, keylen*8);
                ret = -EINVAL;
                goto error;
@@ -259,7 +259,7 @@ ssize_t cryptodev_cipher_decrypt(struct cipher_data *cdata,
 /* Hash functions */
 
 int cryptodev_hash_init(struct hash_data *hdata, const char *alg_name,
-                       int hmac_mode, void *mackey, size_t mackeylen)
+                       int hmac_mode, void *mackey, unsigned int mackeylen)
 {
        int ret;
 
@@ -274,7 +274,7 @@ int cryptodev_hash_init(struct hash_data *hdata, const char 
*alg_name,
                ret = crypto_ahash_setkey(hdata->async.s, mackey, mackeylen);
                if (unlikely(ret)) {
                        dprintk(1, KERN_DEBUG,
-                               "Setting hmac key failed for %s-%zu.\n",
+                               "Setting hmac key failed for %s-%u.\n",
                                alg_name, mackeylen*8);
                        ret = -EINVAL;
                        goto error;
diff --git a/cryptlib.h b/cryptlib.h
index 1745d0f..714ab04 100644
--- a/cryptlib.h
+++ b/cryptlib.h
@@ -23,7 +23,7 @@ struct cipher_data {
 };
 
 int cryptodev_cipher_init(struct cipher_data *out, const char *alg_name,
-                         uint8_t *key, size_t keylen, int stream, int aead);
+                         uint8_t *key, unsigned int keylen, int stream, int 
aead);
 void cryptodev_cipher_deinit(struct cipher_data *cdata);
 ssize_t cryptodev_cipher_decrypt(struct cipher_data *cdata,
                        const struct scatterlist *sg1,
@@ -84,7 +84,7 @@ ssize_t cryptodev_hash_update(struct hash_data *hdata,
 int cryptodev_hash_reset(struct hash_data *hdata);
 void cryptodev_hash_deinit(struct hash_data *hdata);
 int cryptodev_hash_init(struct hash_data *hdata, const char *alg_name,
-                       int hmac_mode, void *mackey, size_t mackeylen);
+                       int hmac_mode, void *mackey, unsigned int mackeylen);
 
 
 #endif
diff --git a/ioctl.c b/ioctl.c
index 1ba10bb..5a34c74 100644
--- a/ioctl.c
+++ b/ioctl.c
@@ -226,8 +226,8 @@ crypto_create_session(struct fcrypt *fcr, struct session_op 
*sop)
        if (alg_name) {
                if (unlikely(sop->keylen > CRYPTO_CIPHER_MAX_KEY_LEN)) {
                        dprintk(1, KERN_DEBUG,
-                               "Setting key failed for %s-%zu.\n",
-                               alg_name, (size_t)sop->keylen*8);
+                               "Setting key failed for %s-%u.\n",
+                               alg_name, sop->keylen*8);
                        ret = -EINVAL;
                        goto error_cipher;
                }
-- 
1.7.7.6



_______________________________________________
Cryptodev-linux-devel mailing list
Cryptodev-linux-devel@gna.org
https://mail.gna.org/listinfo/cryptodev-linux-devel

Reply via email to