aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/crypto/zcrypt_pcixcc.c
diff options
context:
space:
mode:
authorFelix Beck <felix.beck@de.ibm.com>2008-07-14 03:59:27 -0400
committerHeiko Carstens <heiko.carstens@de.ibm.com>2008-07-14 04:02:19 -0400
commit1a89dd8f0b4d7eca2dd4abffb736f37676e1b073 (patch)
tree138a60d59cad4c0f4e4ef287c5754b1f550b920f /drivers/s390/crypto/zcrypt_pcixcc.c
parent26348f78e84613371eb657ca1e584153ccb7d596 (diff)
[S390] Cleanup zcrypt printk messages.
Signed-off-by: Felix Beck <felix.beck@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Diffstat (limited to 'drivers/s390/crypto/zcrypt_pcixcc.c')
-rw-r--r--drivers/s390/crypto/zcrypt_pcixcc.c68
1 files changed, 10 insertions, 58 deletions
diff --git a/drivers/s390/crypto/zcrypt_pcixcc.c b/drivers/s390/crypto/zcrypt_pcixcc.c
index 4040c1c981d1..d8ad36f81540 100644
--- a/drivers/s390/crypto/zcrypt_pcixcc.c
+++ b/drivers/s390/crypto/zcrypt_pcixcc.c
@@ -290,38 +290,19 @@ static int XCRB_msg_to_type6CPRB_msgX(struct zcrypt_device *zdev,
290 ap_msg->length = sizeof(struct type6_hdr) + 290 ap_msg->length = sizeof(struct type6_hdr) +
291 CEIL4(xcRB->request_control_blk_length) + 291 CEIL4(xcRB->request_control_blk_length) +
292 xcRB->request_data_length; 292 xcRB->request_data_length;
293 if (ap_msg->length > PCIXCC_MAX_XCRB_MESSAGE_SIZE) { 293 if (ap_msg->length > PCIXCC_MAX_XCRB_MESSAGE_SIZE)
294 PRINTK("Combined message is too large (%ld/%d/%d).\n",
295 sizeof(struct type6_hdr),
296 xcRB->request_control_blk_length,
297 xcRB->request_data_length);
298 return -EFAULT; 294 return -EFAULT;
299 } 295 if (CEIL4(xcRB->reply_control_blk_length) > PCIXCC_MAX_XCRB_REPLY_SIZE)
300 if (CEIL4(xcRB->reply_control_blk_length) >
301 PCIXCC_MAX_XCRB_REPLY_SIZE) {
302 PDEBUG("Reply CPRB length is too large (%d).\n",
303 xcRB->request_control_blk_length);
304 return -EFAULT; 296 return -EFAULT;
305 } 297 if (CEIL4(xcRB->reply_data_length) > PCIXCC_MAX_XCRB_DATA_SIZE)
306 if (CEIL4(xcRB->reply_data_length) > PCIXCC_MAX_XCRB_DATA_SIZE) {
307 PDEBUG("Reply data block length is too large (%d).\n",
308 xcRB->reply_data_length);
309 return -EFAULT; 298 return -EFAULT;
310 }
311 replylen = CEIL4(xcRB->reply_control_blk_length) + 299 replylen = CEIL4(xcRB->reply_control_blk_length) +
312 CEIL4(xcRB->reply_data_length) + 300 CEIL4(xcRB->reply_data_length) +
313 sizeof(struct type86_fmt2_msg); 301 sizeof(struct type86_fmt2_msg);
314 if (replylen > PCIXCC_MAX_XCRB_RESPONSE_SIZE) { 302 if (replylen > PCIXCC_MAX_XCRB_RESPONSE_SIZE) {
315 PDEBUG("Reply CPRB + data block > PCIXCC_MAX_XCRB_RESPONSE_SIZE"
316 " (%d/%d/%d).\n",
317 sizeof(struct type86_fmt2_msg),
318 xcRB->reply_control_blk_length,
319 xcRB->reply_data_length);
320 xcRB->reply_control_blk_length = PCIXCC_MAX_XCRB_RESPONSE_SIZE - 303 xcRB->reply_control_blk_length = PCIXCC_MAX_XCRB_RESPONSE_SIZE -
321 (sizeof(struct type86_fmt2_msg) + 304 (sizeof(struct type86_fmt2_msg) +
322 CEIL4(xcRB->reply_data_length)); 305 CEIL4(xcRB->reply_data_length));
323 PDEBUG("Capping Reply CPRB length at %d\n",
324 xcRB->reply_control_blk_length);
325 } 306 }
326 307
327 /* prepare type6 header */ 308 /* prepare type6 header */
@@ -340,11 +321,8 @@ static int XCRB_msg_to_type6CPRB_msgX(struct zcrypt_device *zdev,
340 xcRB->request_control_blk_length)) 321 xcRB->request_control_blk_length))
341 return -EFAULT; 322 return -EFAULT;
342 if (msg->cprbx.cprb_len + sizeof(msg->hdr.function_code) > 323 if (msg->cprbx.cprb_len + sizeof(msg->hdr.function_code) >
343 xcRB->request_control_blk_length) { 324 xcRB->request_control_blk_length)
344 PDEBUG("cprb_len too large (%d/%d)\n", msg->cprbx.cprb_len,
345 xcRB->request_control_blk_length);
346 return -EFAULT; 325 return -EFAULT;
347 }
348 function_code = ((unsigned char *)&msg->cprbx) + msg->cprbx.cprb_len; 326 function_code = ((unsigned char *)&msg->cprbx) + msg->cprbx.cprb_len;
349 memcpy(msg->hdr.function_code, function_code, sizeof(msg->hdr.function_code)); 327 memcpy(msg->hdr.function_code, function_code, sizeof(msg->hdr.function_code));
350 328
@@ -472,29 +450,18 @@ static int convert_type86_ica(struct zcrypt_device *zdev,
472 service_rc = msg->cprbx.ccp_rtcode; 450 service_rc = msg->cprbx.ccp_rtcode;
473 if (unlikely(service_rc != 0)) { 451 if (unlikely(service_rc != 0)) {
474 service_rs = msg->cprbx.ccp_rscode; 452 service_rs = msg->cprbx.ccp_rscode;
475 if (service_rc == 8 && service_rs == 66) { 453 if (service_rc == 8 && service_rs == 66)
476 PDEBUG("Bad block format on PCIXCC/CEX2C\n");
477 return -EINVAL; 454 return -EINVAL;
478 } 455 if (service_rc == 8 && service_rs == 65)
479 if (service_rc == 8 && service_rs == 65) {
480 PDEBUG("Probably an even modulus on PCIXCC/CEX2C\n");
481 return -EINVAL; 456 return -EINVAL;
482 } 457 if (service_rc == 8 && service_rs == 770)
483 if (service_rc == 8 && service_rs == 770) {
484 PDEBUG("Invalid key length on PCIXCC/CEX2C\n");
485 return -EINVAL; 458 return -EINVAL;
486 }
487 if (service_rc == 8 && service_rs == 783) { 459 if (service_rc == 8 && service_rs == 783) {
488 PDEBUG("Extended bitlengths not enabled on PCIXCC/CEX2C\n");
489 zdev->min_mod_size = PCIXCC_MIN_MOD_SIZE_OLD; 460 zdev->min_mod_size = PCIXCC_MIN_MOD_SIZE_OLD;
490 return -EAGAIN; 461 return -EAGAIN;
491 } 462 }
492 if (service_rc == 12 && service_rs == 769) { 463 if (service_rc == 12 && service_rs == 769)
493 PDEBUG("Invalid key on PCIXCC/CEX2C\n");
494 return -EINVAL; 464 return -EINVAL;
495 }
496 PRINTK("Unknown service rc/rs (PCIXCC/CEX2C): %d/%d\n",
497 service_rc, service_rs);
498 zdev->online = 0; 465 zdev->online = 0;
499 return -EAGAIN; /* repeat the request on a different device. */ 466 return -EAGAIN; /* repeat the request on a different device. */
500 } 467 }
@@ -570,11 +537,8 @@ static int convert_type86_rng(struct zcrypt_device *zdev,
570 } __attribute__((packed)) *msg = reply->message; 537 } __attribute__((packed)) *msg = reply->message;
571 char *data = reply->message; 538 char *data = reply->message;
572 539
573 if (msg->cprbx.ccp_rtcode != 0 || msg->cprbx.ccp_rscode != 0) { 540 if (msg->cprbx.ccp_rtcode != 0 || msg->cprbx.ccp_rscode != 0)
574 PDEBUG("RNG response error on PCIXCC/CEX2C rc=%hu/rs=%hu\n",
575 rc, rs);
576 return -EINVAL; 541 return -EINVAL;
577 }
578 memcpy(buffer, data + msg->fmt2.offset2, msg->fmt2.count2); 542 memcpy(buffer, data + msg->fmt2.offset2, msg->fmt2.count2);
579 return msg->fmt2.count2; 543 return msg->fmt2.count2;
580} 544}
@@ -599,9 +563,6 @@ static int convert_response_ica(struct zcrypt_device *zdev,
599 outputdata, outputdatalength); 563 outputdata, outputdatalength);
600 /* no break, incorrect cprb version is an unknown response */ 564 /* no break, incorrect cprb version is an unknown response */
601 default: /* Unknown response type, this should NEVER EVER happen */ 565 default: /* Unknown response type, this should NEVER EVER happen */
602 PRINTK("Unrecognized Message Header: %08x%08x\n",
603 *(unsigned int *) reply->message,
604 *(unsigned int *) (reply->message+4));
605 zdev->online = 0; 566 zdev->online = 0;
606 return -EAGAIN; /* repeat the request on a different device. */ 567 return -EAGAIN; /* repeat the request on a different device. */
607 } 568 }
@@ -628,9 +589,6 @@ static int convert_response_xcrb(struct zcrypt_device *zdev,
628 return convert_type86_xcrb(zdev, reply, xcRB); 589 return convert_type86_xcrb(zdev, reply, xcRB);
629 /* no break, incorrect cprb version is an unknown response */ 590 /* no break, incorrect cprb version is an unknown response */
630 default: /* Unknown response type, this should NEVER EVER happen */ 591 default: /* Unknown response type, this should NEVER EVER happen */
631 PRINTK("Unrecognized Message Header: %08x%08x\n",
632 *(unsigned int *) reply->message,
633 *(unsigned int *) (reply->message+4));
634 xcRB->status = 0x0008044DL; /* HDD_InvalidParm */ 592 xcRB->status = 0x0008044DL; /* HDD_InvalidParm */
635 zdev->online = 0; 593 zdev->online = 0;
636 return -EAGAIN; /* repeat the request on a different device. */ 594 return -EAGAIN; /* repeat the request on a different device. */
@@ -654,9 +612,6 @@ static int convert_response_rng(struct zcrypt_device *zdev,
654 return convert_type86_rng(zdev, reply, data); 612 return convert_type86_rng(zdev, reply, data);
655 /* no break, incorrect cprb version is an unknown response */ 613 /* no break, incorrect cprb version is an unknown response */
656 default: /* Unknown response type, this should NEVER EVER happen */ 614 default: /* Unknown response type, this should NEVER EVER happen */
657 PRINTK("Unrecognized Message Header: %08x%08x\n",
658 *(unsigned int *) reply->message,
659 *(unsigned int *) (reply->message+4));
660 zdev->online = 0; 615 zdev->online = 0;
661 return -EAGAIN; /* repeat the request on a different device. */ 616 return -EAGAIN; /* repeat the request on a different device. */
662 } 617 }
@@ -701,10 +656,7 @@ static void zcrypt_pcixcc_receive(struct ap_device *ap_dev,
701 memcpy(msg->message, reply->message, length); 656 memcpy(msg->message, reply->message, length);
702 break; 657 break;
703 default: 658 default:
704 PRINTK("Invalid internal response type: %i\n", 659 memcpy(msg->message, &error_reply, sizeof error_reply);
705 resp_type->type);
706 memcpy(msg->message, &error_reply,
707 sizeof error_reply);
708 } 660 }
709 } else 661 } else
710 memcpy(msg->message, reply->message, sizeof error_reply); 662 memcpy(msg->message, reply->message, sizeof error_reply);