[UBUNTU] 18.04.3 - hash verification error with SHA-512 HMAC running the opencryptoki digest_tests on the ICA token

Bug #1840420 reported by bugproxy
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ubuntu on IBM z Systems
Fix Released
High
Canonical Foundations Team
opencryptoki (Ubuntu)
Fix Released
Undecided
Skipper Bug Screeners
Bionic
Fix Released
Undecided
Unassigned

Bug Description

Problem description (Tested with 18.04.2 but need be fixed with 18.04.3)
Summary
=======
Ubuntu 18.04.2 system installed ( 4.15.0-55-generic kernel ) providing
opencryptoki version 3.9.0, and libica version 3.2.1
The digest_tests being part of the github opencryptoki package show failures.
Total=641, Ran=521, Passed=391, Failed=130, Skipped=120, Errors=0
The problem is immediately reproducible.
Independent of crypto cards being online.

Details
=======
Set up Ubuntu 18.04.2 with opencryptoki and libica3.
Initialize the opencryptoki ICA token, compile and build the opencryptoki tests
being part of the github opencryptoki package tagged as 3.9.0.
After successful initialization, the ICA token is expected to be readily initialized
as follows:

# pkcsconf -t -c 0
Token #0 Info:
Label: icatest
Manufacturer: IBM Corp.
Model: IBM ICA
Serial Number: 123
Flags: 0x44D (RNG|LOGIN_REQUIRED|USER_PIN_INITIALIZED|CLOCK_ON_TOKEN|TOKEN_INITIALIZED)
Sessions: 0/18446744073709551614
R/W Sessions: 18446744073709551615/18446744073709551614
PIN Length: 4-8
Public Memory: 0xFFFFFFFFFFFFFFFF/0xFFFFFFFFFFFFFFFF
Private Memory: 0xFFFFFFFFFFFFFFFF/0xFFFFFFFFFFFFFFFF
Hardware Version: 1.0
Firmware Version: 1.0
Time: 17:48:54

Terminal ouptut
===============
Output of the failing tests for digest_tests
...
------
* TESTSUITE do_SignVerify_HMAC BEGIN SHA-512 HMAC Sign Verify.
------
* TESTCASE do_SignVerify_HMAC BEGIN Sign Verify SHA-512 HMAC with test vector 0.
* TESTCASE do_SignVerify_HMAC FAIL (digest_func.c:1284) hashed data does not match test vector's hashed data
------
* TESTCASE do_SignVerify_HMAC BEGIN Sign Verify SHA-512 HMAC with test vector 1.
* TESTCASE do_SignVerify_HMAC FAIL (digest_func.c:1284) hashed data does not match test vector's hashed data
------
* TESTCASE do_SignVerify_HMAC BEGIN Sign Verify SHA-512 HMAC with test vector 2.
* TESTCASE do_SignVerify_HMAC FAIL (digest_func.c:1284) hashed data does not match test vector's hashed data
------
* TESTCASE do_SignVerify_HMAC BEGIN Sign Verify SHA-512 HMAC with test vector 3.
* TESTCASE do_SignVerify_HMAC FAIL (digest_func.c:1284) hashed data does not match test vector's hashed data
------
* TESTCASE do_SignVerify_HMAC BEGIN Sign Verify SHA-512 HMAC with test vector 4.
* TESTCASE do_SignVerify_HMAC FAIL (digest_func.c:1284) hashed data does not match test vector's hashed data
------
* TESTCASE do_SignVerify_HMAC BEGIN Sign Verify SHA-512 HMAC with test vector 5.
* TESTCASE do_SignVerify_HMAC FAIL (digest_func.c:1284) hashed data does not match test vector's hashed data
------

Debug data
==========
See attached output of the digest_tests run.

---uname output---
Linux system 4.15.0-55-generic #60-Ubuntu SMP Tue Jul 2 18:21:03 UTC 2019 s390x s390x s390x GNU/Linux

Machine Type = IBM 3906

---Steps to Reproduce---
1.) Install the opencryptoki and libica3 packages
2.) Add your user to the pkcs11 group: usermod -aG pkcs11 root and re-login
3.) run: systemctl start pkcsslotd.service
4.) compile and build the opencryptoki version 3.9.0 test cases using the
GitHub package version 3.9
5.) run the digest_tests from the testcases/crypto/ directory, against the ICA slot
./digest_tests -slot <N>

The userspace tool has the following bit modes: 64bit

Userspace rpm: opencryptoki

------- Comment From <email address hidden> 2019-08-16 04:14 EDT-------
Solution : Backport for 3.9.0
This is fixed with commit https://github.com/opencryptoki/opencryptoki/commit/363f465755399e124b6f503db111c2b8390cfffe that came after 3.9.0.

bugproxy (bugproxy)
tags: added: architecture-s39064 bugnameltc-180486 severity-critical targetmilestone-inin---
Changed in ubuntu:
assignee: nobody → Skipper Bug Screeners (skipper-screen-team)
affects: ubuntu → opencryptoki (Ubuntu)
Revision history for this message
bugproxy (bugproxy) wrote : Comment bridged from LTC Bugzilla
Download full text (3.5 KiB)

------- Comment From <email address hidden> 2019-08-16 04:12 EDT-------
Problem description (Tested with 18.04.2 but need be fixed with 18.04.3)
Summary
=======
Ubuntu 18.04.2 system installed ( 4.15.0-55-generic kernel ) providing
opencryptoki version 3.9.0, and libica version 3.2.1
The digest_tests being part of the github opencryptoki package show failures.
Total=641, Ran=521, Passed=391, Failed=130, Skipped=120, Errors=0
The problem is immediately reproducible.
Independent of crypto cards being online.

Details
=======
Set up Ubuntu 18.04.2 with opencryptoki and libica3.
Initialize the opencryptoki ICA token, compile and build the opencryptoki tests
being part of the github opencryptoki package tagged as 3.9.0.
After successful initialization, the ICA token is expected to be readily initialized
as follows:

# pkcsconf -t -c 0
Token #0 Info:
Label: icatest
Manufacturer: IBM Corp.
Model: IBM ICA
Serial Number: 123
Flags: 0x44D (RNG|LOGIN_REQUIRED|USER_PIN_INITIALIZED|CLOCK_ON_TOKEN|TOKEN_INITIALIZED)
Sessions: 0/18446744073709551614
R/W Sessions: 18446744073709551615/18446744073709551614
PIN Length: 4-8
Public Memory: 0xFFFFFFFFFFFFFFFF/0xFFFFFFFFFFFFFFFF
Private Memory: 0xFFFFFFFFFFFFFFFF/0xFFFFFFFFFFFFFFFF
Hardware Version: 1.0
Firmware Version: 1.0
Time: 17:48:54

Terminal ouptut
===============
Output of the failing tests for digest_tests
...
------
* TESTSUITE do_SignVerify_HMAC BEGIN SHA-512 HMAC Sign Verify.
------
* TESTCASE do_SignVerify_HMAC BEGIN Sign Verify SHA-512 HMAC with test vector 0.
* TESTCASE do_SignVerify_HMAC FAIL (digest_func.c:1284) hashed data does not match test vector's hashed data
------
* TESTCASE do_SignVerify_HMAC BEGIN Sign Verify SHA-512 HMAC with test vector 1.
* TESTCASE do_SignVerify_HMAC FAIL (digest_func.c:1284) hashed data does not match test vector's hashed data
------
* TESTCASE do_SignVerify_HMAC BEGIN Sign Verify SHA-512 HMAC with test vector 2.
* TESTCASE do_SignVerify_HMAC FAIL (digest_func.c:1284) hashed data does not match test vector's hashed data
------
* TESTCASE do_SignVerify_HMAC BEGIN Sign Verify SHA-512 HMAC with test vector 3.
* TESTCASE do_SignVerify_HMAC FAIL (digest_func.c:1284) hashed data does not match test vector's hashed data
------
* TESTCASE do_SignVerify_HMAC BEGIN Sign Verify SHA-512 HMAC with test vector 4.
* TESTCASE do_SignVerify_HMAC FAIL (digest_func.c:1284) hashed data does not match test vector's hashed data
------
* TESTCASE do_SignVerify_HMAC BEGIN Sign Verify SHA-512 HMAC with test vector 5.
* TESTCASE do_SignVerify_HMAC FAIL (digest_func.c:1284) hashed data does not match test vector's hashed data
------

Debug data
==========
See attached output of the digest_tests run.

---uname output---
Linux system 4.15.0-55-generic #60-Ubuntu SMP Tue Jul 2 18:21:03 UTC 2019 s390x s390x s390x GNU/Linux

Machine Type = IBM 3906

---Steps to Reproduce---
1.) Install the opencryptoki and libica3 packages
2.) Add your user to the pkcs11 group: usermod -aG pkcs11 root and re-login
3.) run: systemctl start pkcsslotd.service
4.) compile and build the opencryptoki version 3.9.0 test cases using the
GitHub package version 3.9
5.) run the digest_tests from the testcases/crypto/...

Read more...

Frank Heimes (fheimes)
description: updated
Changed in ubuntu-z-systems:
status: New → Triaged
importance: Undecided → Critical
assignee: nobody → Canonical Foundations Team (canonical-foundations)
Revision history for this message
bugproxy (bugproxy) wrote :

------- Comment From <email address hidden> 2019-08-16 05:55 EDT-------
Decrease severity to 'high' due to fix being available.

tags: added: severity-high
removed: severity-critical
Frank Heimes (fheimes)
Changed in ubuntu-z-systems:
importance: Critical → High
Changed in opencryptoki (Ubuntu):
status: New → Fix Released
Frank Heimes (fheimes)
Changed in ubuntu-z-systems:
status: Triaged → In Progress
Changed in opencryptoki (Ubuntu Bionic):
status: New → In Progress
Revision history for this message
Brian Murray (brian-murray) wrote : Please test proposed package

Hello bugproxy, or anyone else affected,

Accepted opencryptoki into bionic-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/opencryptoki/3.9.0+dfsg-0ubuntu1.2 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-bionic to verification-done-bionic. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-bionic. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in opencryptoki (Ubuntu Bionic):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-bionic
Changed in ubuntu-z-systems:
status: In Progress → Fix Committed
Revision history for this message
bugproxy (bugproxy) wrote : Comment bridged from LTC Bugzilla

------- Comment From <email address hidden> 2019-08-26 10:49 EDT-------
"opencryptoki/bionic-proposed installed
now 3.9.0+dfsg-0ubuntu1.2 s390x"
digest_tests against the ica slot executed

All testcases are passed:
Total=641, Ran=521, Passed=521, Failed=0, Skipped=120, Errors=0

Revision history for this message
Frank Heimes (fheimes) wrote :

updating tags according to successful verification results in comment #4

tags: added: verification-done verification-done-bionic
removed: verification-needed verification-needed-bionic
Revision history for this message
Łukasz Zemczak (sil2100) wrote : Update Released

The verification of the Stable Release Update for opencryptoki has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package opencryptoki - 3.9.0+dfsg-0ubuntu1.2

---------------
opencryptoki (3.9.0+dfsg-0ubuntu1.2) bionic; urgency=medium

  * Fix CKR_SIGNATURE_INVALID, CKR_FUNCTION_FAILED when running the
    rsa_tests from opencryptoki 3.9.0 on the ICA token LP: #1840419:
    - Fix token_specific_rsa_x509_verify() function.
    - Fix get_mgf_mech() to support SHA224.
  * Fix hash verification error with SHA-512 HMAC LP: #1840420:
    - Fix a bug in sha512_hmac_sign(), wrong size was in use.

 -- Dimitri John Ledkov <email address hidden> Mon, 19 Aug 2019 16:46:08 +0100

Changed in opencryptoki (Ubuntu Bionic):
status: Fix Committed → Fix Released
Frank Heimes (fheimes)
Changed in ubuntu-z-systems:
status: Fix Committed → Fix Released
Revision history for this message
bugproxy (bugproxy) wrote : Comment bridged from LTC Bugzilla

------- Comment From <email address hidden> 2019-09-17 03:38 EDT-------
IBM Bugzilla status -> closed. Fix Released with Ubuntu 18.04.3

tags: added: targetmilestone-inin18043
removed: targetmilestone-inin---
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.