Re: [PATCH 4/26] dm crypt: Use skcipher and ahash

2016-01-25 Thread kbuild test robot
Hi Herbert,

[auto build test ERROR on net/master]
[also build test ERROR on v4.4 next-20160122]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improving the system]

url:
https://github.com/0day-ci/linux/commits/Herbert-Xu/crypto-Use-skcipher-and-ahash-shash-where-possible/20160124-212323
config: x86_64-randconfig-x014-201604 (attached as .config)
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All errors (new ones prefixed by >>):

   drivers/md/dm-crypt.c: In function 'crypt_iv_essiv_init':
>> drivers/md/dm-crypt.c:278:2: error: implicit declaration of function 
>> 'ahash_request_zero' [-Werror=implicit-function-declaration]
 ahash_request_zero(req);
 ^
   cc1: some warnings being treated as errors

vim +/ahash_request_zero +278 drivers/md/dm-crypt.c

   272  sg_init_one(, cc->key, cc->key_size);
   273  ahash_request_set_tfm(req, essiv->hash_tfm);
   274  ahash_request_set_callback(req, CRYPTO_TFM_REQ_MAY_SLEEP, NULL, 
NULL);
   275  ahash_request_set_crypt(req, , essiv->salt, cc->key_size);
   276  
   277  err = crypto_ahash_digest(req);
 > 278  ahash_request_zero(req);
   279  if (err)
   280  return err;
   281  

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation

-- 
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to open-iscsi+unsubscr...@googlegroups.com.
To post to this group, send email to open-iscsi@googlegroups.com.
Visit this group at https://groups.google.com/group/open-iscsi.
For more options, visit https://groups.google.com/d/optout.


.config.gz
Description: Binary data


[PATCH 4/26] dm crypt: Use skcipher and ahash

2016-01-25 Thread Herbert Xu
This patch replaces uses of ablkcipher with skcipher, and the long
obsolete hash interface with ahash.

Signed-off-by: Herbert Xu 
---

 drivers/md/dm-crypt.c |   93 +-
 1 file changed, 48 insertions(+), 45 deletions(-)

diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
index 3147c8d..06a4e3c 100644
--- a/drivers/md/dm-crypt.c
+++ b/drivers/md/dm-crypt.c
@@ -28,6 +28,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -44,7 +45,7 @@ struct convert_context {
struct bvec_iter iter_out;
sector_t cc_sector;
atomic_t cc_pending;
-   struct ablkcipher_request *req;
+   struct skcipher_request *req;
 };
 
 /*
@@ -86,7 +87,7 @@ struct crypt_iv_operations {
 };
 
 struct iv_essiv_private {
-   struct crypto_hash *hash_tfm;
+   struct crypto_ahash *hash_tfm;
u8 *salt;
 };
 
@@ -153,13 +154,13 @@ struct crypt_config {
 
/* ESSIV: struct crypto_cipher *essiv_tfm */
void *iv_private;
-   struct crypto_ablkcipher **tfms;
+   struct crypto_skcipher **tfms;
unsigned tfms_count;
 
/*
 * Layout of each crypto request:
 *
-*   struct ablkcipher_request
+*   struct skcipher_request
 *  context
 *  padding
 *   struct dm_crypt_request
@@ -189,7 +190,7 @@ static u8 *iv_of_dmreq(struct crypt_config *cc, struct 
dm_crypt_request *dmreq);
 /*
  * Use this to access cipher attributes that are the same for each CPU.
  */
-static struct crypto_ablkcipher *any_tfm(struct crypt_config *cc)
+static struct crypto_skcipher *any_tfm(struct crypt_config *cc)
 {
return cc->tfms[0];
 }
@@ -263,23 +264,25 @@ static int crypt_iv_plain64_gen(struct crypt_config *cc, 
u8 *iv,
 static int crypt_iv_essiv_init(struct crypt_config *cc)
 {
struct iv_essiv_private *essiv = >iv_gen_private.essiv;
-   struct hash_desc desc;
+   AHASH_REQUEST_ON_STACK(req, essiv->hash_tfm);
struct scatterlist sg;
struct crypto_cipher *essiv_tfm;
int err;
 
sg_init_one(, cc->key, cc->key_size);
-   desc.tfm = essiv->hash_tfm;
-   desc.flags = CRYPTO_TFM_REQ_MAY_SLEEP;
+   ahash_request_set_tfm(req, essiv->hash_tfm);
+   ahash_request_set_callback(req, CRYPTO_TFM_REQ_MAY_SLEEP, NULL, NULL);
+   ahash_request_set_crypt(req, , essiv->salt, cc->key_size);
 
-   err = crypto_hash_digest(, , cc->key_size, essiv->salt);
+   err = crypto_ahash_digest(req);
+   ahash_request_zero(req);
if (err)
return err;
 
essiv_tfm = cc->iv_private;
 
err = crypto_cipher_setkey(essiv_tfm, essiv->salt,
-   crypto_hash_digestsize(essiv->hash_tfm));
+   crypto_ahash_digestsize(essiv->hash_tfm));
if (err)
return err;
 
@@ -290,7 +293,7 @@ static int crypt_iv_essiv_init(struct crypt_config *cc)
 static int crypt_iv_essiv_wipe(struct crypt_config *cc)
 {
struct iv_essiv_private *essiv = >iv_gen_private.essiv;
-   unsigned salt_size = crypto_hash_digestsize(essiv->hash_tfm);
+   unsigned salt_size = crypto_ahash_digestsize(essiv->hash_tfm);
struct crypto_cipher *essiv_tfm;
int r, err = 0;
 
@@ -320,7 +323,7 @@ static struct crypto_cipher *setup_essiv_cpu(struct 
crypt_config *cc,
}
 
if (crypto_cipher_blocksize(essiv_tfm) !=
-   crypto_ablkcipher_ivsize(any_tfm(cc))) {
+   crypto_skcipher_ivsize(any_tfm(cc))) {
ti->error = "Block size of ESSIV cipher does "
"not match IV size of block cipher";
crypto_free_cipher(essiv_tfm);
@@ -342,7 +345,7 @@ static void crypt_iv_essiv_dtr(struct crypt_config *cc)
struct crypto_cipher *essiv_tfm;
struct iv_essiv_private *essiv = >iv_gen_private.essiv;
 
-   crypto_free_hash(essiv->hash_tfm);
+   crypto_free_ahash(essiv->hash_tfm);
essiv->hash_tfm = NULL;
 
kzfree(essiv->salt);
@@ -360,7 +363,7 @@ static int crypt_iv_essiv_ctr(struct crypt_config *cc, 
struct dm_target *ti,
  const char *opts)
 {
struct crypto_cipher *essiv_tfm = NULL;
-   struct crypto_hash *hash_tfm = NULL;
+   struct crypto_ahash *hash_tfm = NULL;
u8 *salt = NULL;
int err;
 
@@ -370,14 +373,14 @@ static int crypt_iv_essiv_ctr(struct crypt_config *cc, 
struct dm_target *ti,
}
 
/* Allocate hash algorithm */
-   hash_tfm = crypto_alloc_hash(opts, 0, CRYPTO_ALG_ASYNC);
+   hash_tfm = crypto_alloc_ahash(opts, 0, CRYPTO_ALG_ASYNC);
if (IS_ERR(hash_tfm)) {
ti->error = "Error initializing ESSIV hash";
err = PTR_ERR(hash_tfm);
goto bad;
}
 
-   salt = kzalloc(crypto_hash_digestsize(hash_tfm), GFP_KERNEL);
+   salt =