Re: [PATCH v8 6/6] crypto: AF_ALG - add support for key_id

From: kbuild test robot
Date: Thu Jun 23 2016 - 21:03:24 EST


Hi,

[auto build test ERROR on cryptodev/master]
[also build test ERROR on v4.7-rc4 next-20160623]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Tadeusz-Struk/crypto-algif-add-akcipher/20160624-065803
base: https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git master
config: x86_64-allmodconfig (attached as .config)
compiler: gcc-6 (Debian 6.1.1-1) 6.1.1 20160430
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64

All error/warnings (new ones prefixed by >>):

crypto/algif_akcipher.c: In function 'asym_key_encrypt':
>> crypto/algif_akcipher.c:326:9: error: variable 'params' has initializer but incomplete type
struct kernel_pkey_params params = {0};
^~~~~~~~~~~~~~~~~~
>> crypto/algif_akcipher.c:326:38: warning: excess elements in struct initializer
struct kernel_pkey_params params = {0};
^
crypto/algif_akcipher.c:326:38: note: (near initialization for 'params')
>> crypto/algif_akcipher.c:326:28: error: storage size of 'params' isn't known
struct kernel_pkey_params params = {0};
^~~~~~
>> crypto/algif_akcipher.c:352:8: error: implicit declaration of function 'encrypt_blob' [-Werror=implicit-function-declaration]
ret = encrypt_blob(&params, in, out);
^~~~~~~~~~~~
>> crypto/algif_akcipher.c:326:28: warning: unused variable 'params' [-Wunused-variable]
struct kernel_pkey_params params = {0};
^~~~~~
crypto/algif_akcipher.c: In function 'asym_key_decrypt':
crypto/algif_akcipher.c:366:9: error: variable 'params' has initializer but incomplete type
struct kernel_pkey_params params = {0};
^~~~~~~~~~~~~~~~~~
crypto/algif_akcipher.c:366:38: warning: excess elements in struct initializer
struct kernel_pkey_params params = {0};
^
crypto/algif_akcipher.c:366:38: note: (near initialization for 'params')
crypto/algif_akcipher.c:366:28: error: storage size of 'params' isn't known
struct kernel_pkey_params params = {0};
^~~~~~
>> crypto/algif_akcipher.c:392:8: error: implicit declaration of function 'decrypt_blob' [-Werror=implicit-function-declaration]
ret = decrypt_blob(&params, in, out);
^~~~~~~~~~~~
crypto/algif_akcipher.c:366:28: warning: unused variable 'params' [-Wunused-variable]
struct kernel_pkey_params params = {0};
^~~~~~
crypto/algif_akcipher.c: In function 'asym_key_sign':
crypto/algif_akcipher.c:406:9: error: variable 'params' has initializer but incomplete type
struct kernel_pkey_params params = {0};
^~~~~~~~~~~~~~~~~~
crypto/algif_akcipher.c:406:38: warning: excess elements in struct initializer
struct kernel_pkey_params params = {0};
^
crypto/algif_akcipher.c:406:38: note: (near initialization for 'params')
crypto/algif_akcipher.c:406:28: error: storage size of 'params' isn't known
struct kernel_pkey_params params = {0};
^~~~~~
>> crypto/algif_akcipher.c:432:8: error: implicit declaration of function 'create_signature' [-Werror=implicit-function-declaration]
ret = create_signature(&params, in, out);
^~~~~~~~~~~~~~~~
crypto/algif_akcipher.c:406:28: warning: unused variable 'params' [-Wunused-variable]
struct kernel_pkey_params params = {0};
^~~~~~
crypto/algif_akcipher.c: In function 'asym_key_verify':
>> crypto/algif_akcipher.c:460:5: error: 'struct public_key_signature' has no member named 'encoding'
sig.encoding = "pkcs1";
^
cc1: some warnings being treated as errors

vim +/params +326 crypto/algif_akcipher.c

320
321 return err ? err : size;
322 }
323
324 static int asym_key_encrypt(const struct key *key, struct akcipher_request *req)
325 {
> 326 struct kernel_pkey_params params = {0};
327 char *src = NULL, *dst = NULL, *in, *out;
328 int ret;
329
330 if (!sg_is_last(req->src)) {
331 src = kmalloc(req->src_len, GFP_KERNEL);
332 if (!src)
333 return -ENOMEM;
334 scatterwalk_map_and_copy(src, req->src, 0, req->src_len, 0);
335 in = src;
336 } else {
337 in = sg_virt(req->src);
338 }
339 if (!sg_is_last(req->dst)) {
340 dst = kmalloc(req->dst_len, GFP_KERNEL);
341 if (!dst) {
342 kfree(src);
343 return -ENOMEM;
344 }
345 out = dst;
346 } else {
347 out = sg_virt(req->dst);
348 }
349 params.key = (struct key *)key;
350 params.in_len = req->src_len;
351 params.out_len = req->dst_len;
> 352 ret = encrypt_blob(&params, in, out);
353 if (ret)
354 goto free;
355
356 if (dst)
357 scatterwalk_map_and_copy(dst, req->dst, 0, req->dst_len, 1);
358 free:
359 kfree(src);
360 kfree(dst);
361 return ret;
362 }
363
364 static int asym_key_decrypt(const struct key *key, struct akcipher_request *req)
365 {
> 366 struct kernel_pkey_params params = {0};
367 char *src = NULL, *dst = NULL, *in, *out;
368 int ret;
369
370 if (!sg_is_last(req->src)) {
371 src = kmalloc(req->src_len, GFP_KERNEL);
372 if (!src)
373 return -ENOMEM;
374 scatterwalk_map_and_copy(src, req->src, 0, req->src_len, 0);
375 in = src;
376 } else {
377 in = sg_virt(req->src);
378 }
379 if (!sg_is_last(req->dst)) {
380 dst = kmalloc(req->dst_len, GFP_KERNEL);
381 if (!dst) {
382 kfree(src);
383 return -ENOMEM;
384 }
385 out = dst;
386 } else {
387 out = sg_virt(req->dst);
388 }
389 params.key = (struct key *)key;
390 params.in_len = req->src_len;
391 params.out_len = req->dst_len;
> 392 ret = decrypt_blob(&params, in, out);
393 if (ret)
394 goto free;
395
396 if (dst)
397 scatterwalk_map_and_copy(dst, req->dst, 0, req->dst_len, 1);
398 free:
399 kfree(src);
400 kfree(dst);
401 return ret;
402 }
403
404 static int asym_key_sign(const struct key *key, struct akcipher_request *req)
405 {
> 406 struct kernel_pkey_params params = {0};
407 char *src = NULL, *dst = NULL, *in, *out;
408 int ret;
409
410 if (!sg_is_last(req->src)) {
411 src = kmalloc(req->src_len, GFP_KERNEL);
412 if (!src)
413 return -ENOMEM;
414 scatterwalk_map_and_copy(src, req->src, 0, req->src_len, 0);
415 in = src;
416 } else {
417 in = sg_virt(req->src);
418 }
419 if (!sg_is_last(req->dst)) {
420 dst = kmalloc(req->dst_len, GFP_KERNEL);
421 if (!dst) {
422 kfree(src);
423 return -ENOMEM;
424 }
425 out = dst;
426 } else {
427 out = sg_virt(req->dst);
428 }
429 params.key = (struct key *)key;
430 params.in_len = req->src_len;
431 params.out_len = req->dst_len;
> 432 ret = create_signature(&params, in, out);
433 if (ret)
434 goto free;
435
436 if (dst)
437 scatterwalk_map_and_copy(dst, req->dst, 0, req->dst_len, 1);
438 free:
439 kfree(src);
440 kfree(dst);
441 return ret;
442 }
443
444 static int asym_key_verify(const struct key *key, struct akcipher_request *req)
445 {
446 struct public_key_signature sig;
447 char *src = NULL, *in, digest[20];
448 int ret;
449
450 if (!sg_is_last(req->src)) {
451 src = kmalloc(req->src_len, GFP_KERNEL);
452 if (!src)
453 return -ENOMEM;
454 scatterwalk_map_and_copy(src, req->src, 0, req->src_len, 0);
455 in = src;
456 } else {
457 in = sg_virt(req->src);
458 }
459 sig.pkey_algo = "rsa";
> 460 sig.encoding = "pkcs1";
461 /* Need to find a way to pass the hash param */
462 sig.hash_algo = "sha1";
463 sig.digest_size = sizeof(digest);

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

Attachment: .config.gz
Description: Binary data