Bug 699408 - Data Corruption: opencryptoki erroneously returns error when reading its token data from disk
Summary: Data Corruption: opencryptoki erroneously returns error when reading its toke...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: opencryptoki
Version: 6.1
Hardware: All
OS: All
urgent
urgent
Target Milestone: rc
: 6.1
Assignee: Dan Horák
QA Contact: BaseOS QE Security Team
URL:
Whiteboard:
Depends On:
Blocks: 632765 684385
TreeView+ depends on / blocked
 
Reported: 2011-04-25 14:50 UTC by IBM Bug Proxy
Modified: 2013-11-04 13:21 UTC (History)
10 users (show)

Fixed In Version: opencryptoki-2.3.3-2.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-05-19 13:53:51 UTC
Target Upstream Version:


Attachments (Terms of Use)
Patch to add to opencryptoki 2.3.3 srpm, which fixes the token data loading issue (555 bytes, text/plain)
2011-04-25 14:51 UTC, IBM Bug Proxy
no flags Details
Patch to RHEL 6 beta1 snap 4 to add the previous patch to the srpm specfile (694 bytes, text/plain)
2011-04-25 14:51 UTC, IBM Bug Proxy
no flags Details


Links
System ID Private Priority Status Summary Last Updated
IBM Linux Technology Center 71697 0 None None None Never
Red Hat Product Errata RHBA-2011:0661 0 normal SHIPPED_LIVE opencryptoki bug fix and enhancement update 2011-05-18 17:55:22 UTC

Description IBM Bug Proxy 2011-04-25 14:50:58 UTC
---Problem Description---
opencryptoki erroneously returns error when reading its token data from disk.
  
---Steps to Reproduce---
 Using a testcase from opencryptoki's testsuite, tok_obj:

$ PKCS11_USER_PIN=1234 ./tok_obj -slot 0
1.  Create a token object
2.  Count token objects
3.  Verify contents of the first token object
4.  Destroy all token objects
5.  Initialize Token
6.  Set USER PIN
7.  Get Token Info
9.  Exit
Selection:   

At the prompt, enter 1, then 4.  4 will fail with CKR_FUNCTION_FAILED

Userspace rpm: opencryptoki-libs 

Hi Redhat,

  This bug was discovered during feature verification for opencryptoki.  Please
apply the attached patches, which will fix the issue.  The RH feature is
bugzilla 632765.

Thanks,
Kent
      
1. Server architecture(s) (please list all effected) (x86/POWER6/Z/etc.): All
2. Server type (9117-MMA/HS20/s390/etc.): N/A
3. Other components involved (ixgbe/java/emulex/etc.): opencryptoki
4. Does the server have the latest GA firmware? N/A
5. Has the problem been shown to occur on more than one system? Yes
6. Collect "sosreport" from machine problem was found on, and attach to bug. N/A
7. What is the latest official distro build on which this bug has been seen? RHEL 6.1 snap 4

Comment 1 IBM Bug Proxy 2011-04-25 14:51:02 UTC
Created attachment 494682 [details]
Patch to add to opencryptoki 2.3.3 srpm, which fixes the token data loading issue

Comment 2 IBM Bug Proxy 2011-04-25 14:51:06 UTC
Created attachment 494683 [details]
Patch to RHEL 6 beta1 snap 4 to add the previous patch to the srpm specfile

Comment 5 IBM Bug Proxy 2011-04-25 16:51:23 UTC
------- Comment From yoder1.com 2011-04-25 12:47 EDT-------
The upshot of this bug is that it is a data corruption issue -- data stored by opencryptoki cannot be re-loaded correctly after an application shuts down.

Changing the severity to ship issue.

Comment 6 IBM Bug Proxy 2011-04-25 17:51:50 UTC
------- Comment From tpnoonan.com 2011-04-25 13:43 EDT-------
this is a data corruptor

Comment 7 IBM Bug Proxy 2011-04-25 18:11:10 UTC
------- Comment From sglass.com 2011-04-25 14:05 EDT-------
This has been tested by IBM

Comment 10 John Jarvis 2011-04-26 18:11:14 UTC
This fix is approved and planned for inclusion in the RHEL 6.1 Release Candidate.

Comment 12 Miroslav Vadkerti 2011-04-27 20:48:03 UTC
Doing sanity testing only:
* current version of opencryptoki in RHEL6.1: opencryptoki-2.3.3-2.el6.x86_64
* patch opencryptoki-2.3.3-strip_pkcs_padding.patch applied:
--- opencryptoki-2.3.3.rhel6snap4/usr/lib/pkcs11/common/utility.c	2011-01-13 18:26:36.000000000 +0100
+++ opencryptoki-2.3.3/usr/lib/pkcs11/common/utility.c	2011-04-21 18:32:21.000000000 +0200
@@ -1104,9 +1104,10 @@ strip_pkcs_padding( CK_BYTE   * ptr,
    CK_BYTE  pad_value;
 
    pad_value = ptr[total_len - 1];
-   if (pad_value > total_len)
+   if (pad_value > total_len) {
        st_err_log(10, __FILE__, __LINE__);
        return CKR_ENCRYPTED_DATA_INVALID;
+   }
 
    // thus, we have 'pad_value' bytes of 'pad_value' appended to the end
    //
* all available RHTS tests PASS:
/CoreOS/openCryptoki/Regression/bz415971-pkcsconf-validation-of-PIN-is-wrong
/CoreOS/openCryptoki/Regression/bz612274-Opencryptoki-session-object-performance-degradation
/CoreOS/openCryptoki/Sanity/init-scripts-LSB
/CoreOS/openCryptoki/Sanity/testsuite - some of the tests fail - reported
upstream

Comment 13 IBM Bug Proxy 2011-05-05 15:30:55 UTC
------- Comment From yoder1.com 2011-05-05 11:25 EDT-------
Verified in RHEL6.1-20110427.0-Server-s390x-DVD1.iso, closing defect.

Kent

Comment 14 errata-xmlrpc 2011-05-19 13:53:51 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-0661.html


Note You need to log in before you can comment on or make changes to this bug.