Re: [PATCH 1/26] block: cryptoloop - Use new skcipher interface

2016-01-25 Thread Herbert Xu
On Sun, Jan 24, 2016 at 09:37:33PM +0800, kbuild test robot wrote:
> 
> [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]

These patches depend on the two helpers that I posted yesterday
so unfortunately we'll be getting quite a few build errors from
the bot.

Cheers,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

-- 
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.


Re: [PATCH 1/26] block: cryptoloop - Use new skcipher interface

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/block/cryptoloop.c: In function 'cryptoloop_transfer':
>> drivers/block/cryptoloop.c:167:2: error: implicit declaration of function 
>> 'skcipher_request_zero' [-Werror=implicit-function-declaration]
 skcipher_request_zero(req);
 ^
   cc1: some warnings being treated as errors

vim +/skcipher_request_zero +167 drivers/block/cryptoloop.c

   161  out_offs += sz;
   162  }
   163  
   164  err = 0;
   165  
   166  out:
 > 167  skcipher_request_zero(req);
   168  return err;
   169  }
   170  

---
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 1/26] block: cryptoloop - Use new skcipher interface

2016-01-25 Thread Herbert Xu
This patch replaces uses of blkcipher with the new skcipher
interface.

Signed-off-by: Herbert Xu 
---

 drivers/block/cryptoloop.c |   48 +++--
 1 file changed, 25 insertions(+), 23 deletions(-)

diff --git a/drivers/block/cryptoloop.c b/drivers/block/cryptoloop.c
index 99e773c..3d31761 100644
--- a/drivers/block/cryptoloop.c
+++ b/drivers/block/cryptoloop.c
@@ -21,9 +21,9 @@
 
 #include 
 
+#include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -46,7 +46,7 @@ cryptoloop_init(struct loop_device *lo, const struct 
loop_info64 *info)
char *cipher;
char *mode;
char *cmsp = cms;   /* c-m string pointer */
-   struct crypto_blkcipher *tfm;
+   struct crypto_skcipher *tfm;
 
/* encryption breaks for non sector aligned offsets */
 
@@ -82,12 +82,12 @@ cryptoloop_init(struct loop_device *lo, const struct 
loop_info64 *info)
*cmsp++ = ')';
*cmsp = 0;
 
-   tfm = crypto_alloc_blkcipher(cms, 0, CRYPTO_ALG_ASYNC);
+   tfm = crypto_alloc_skcipher(cms, 0, CRYPTO_ALG_ASYNC);
if (IS_ERR(tfm))
return PTR_ERR(tfm);
 
-   err = crypto_blkcipher_setkey(tfm, info->lo_encrypt_key,
- info->lo_encrypt_key_size);
+   err = crypto_skcipher_setkey(tfm, info->lo_encrypt_key,
+info->lo_encrypt_key_size);

if (err != 0)
goto out_free_tfm;
@@ -96,17 +96,14 @@ cryptoloop_init(struct loop_device *lo, const struct 
loop_info64 *info)
return 0;
 
  out_free_tfm:
-   crypto_free_blkcipher(tfm);
+   crypto_free_skcipher(tfm);
 
  out:
return err;
 }
 
 
-typedef int (*encdec_cbc_t)(struct blkcipher_desc *desc,
-   struct scatterlist *sg_out,
-   struct scatterlist *sg_in,
-   unsigned int nsg);
+typedef int (*encdec_cbc_t)(struct skcipher_request *req);
 
 static int
 cryptoloop_transfer(struct loop_device *lo, int cmd,
@@ -114,11 +111,8 @@ cryptoloop_transfer(struct loop_device *lo, int cmd,
struct page *loop_page, unsigned loop_off,
int size, sector_t IV)
 {
-   struct crypto_blkcipher *tfm = lo->key_data;
-   struct blkcipher_desc desc = {
-   .tfm = tfm,
-   .flags = CRYPTO_TFM_REQ_MAY_SLEEP,
-   };
+   struct crypto_skcipher *tfm = lo->key_data;
+   SKCIPHER_REQUEST_ON_STACK(req, tfm);
struct scatterlist sg_out;
struct scatterlist sg_in;
 
@@ -127,6 +121,10 @@ cryptoloop_transfer(struct loop_device *lo, int cmd,
unsigned in_offs, out_offs;
int err;
 
+   skcipher_request_set_tfm(req, tfm);
+   skcipher_request_set_callback(req, CRYPTO_TFM_REQ_MAY_SLEEP,
+ NULL, NULL);
+
sg_init_table(_out, 1);
sg_init_table(_in, 1);
 
@@ -135,13 +133,13 @@ cryptoloop_transfer(struct loop_device *lo, int cmd,
in_offs = raw_off;
out_page = loop_page;
out_offs = loop_off;
-   encdecfunc = crypto_blkcipher_crt(tfm)->decrypt;
+   encdecfunc = crypto_skcipher_decrypt;
} else {
in_page = loop_page;
in_offs = loop_off;
out_page = raw_page;
out_offs = raw_off;
-   encdecfunc = crypto_blkcipher_crt(tfm)->encrypt;
+   encdecfunc = crypto_skcipher_encrypt;
}
 
while (size > 0) {
@@ -152,10 +150,10 @@ cryptoloop_transfer(struct loop_device *lo, int cmd,
sg_set_page(_in, in_page, sz, in_offs);
sg_set_page(_out, out_page, sz, out_offs);
 
-   desc.info = iv;
-   err = encdecfunc(, _out, _in, sz);
+   skcipher_request_set_crypt(req, _in, _out, sz, iv);
+   err = encdecfunc(req);
if (err)
-   return err;
+   goto out;
 
IV++;
size -= sz;
@@ -163,7 +161,11 @@ cryptoloop_transfer(struct loop_device *lo, int cmd,
out_offs += sz;
}
 
-   return 0;
+   err = 0;
+
+out:
+   skcipher_request_zero(req);
+   return err;
 }
 
 static int
@@ -175,9 +177,9 @@ cryptoloop_ioctl(struct loop_device *lo, int cmd, unsigned 
long arg)
 static int
 cryptoloop_release(struct loop_device *lo)
 {
-   struct crypto_blkcipher *tfm = lo->key_data;
+   struct crypto_skcipher *tfm = lo->key_data;
if (tfm != NULL) {
-   crypto_free_blkcipher(tfm);
+   crypto_free_skcipher(tfm);
lo->key_data = NULL;
return 0;
}

-- 
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,