Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1966992

Summary: crypto testcases fail on golang on s390x [rhel-9]
Product: Red Hat Enterprise Linux 9 Reporter: Edjunior Barbosa Machado <emachado>
Component: golangAssignee: David Benoit <dbenoit>
Status: CLOSED ERRATA QA Contact: Edjunior Barbosa Machado <emachado>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 9.0CC: asm, bstinson, dbenoit, emachado, fweimer, jwboyer, tstellar
Target Milestone: betaKeywords: Bugfix, Triaged, ZStream
Target Release: ---Flags: pm-rhel: mirror+
Hardware: s390x   
OS: Unspecified   
Whiteboard:
Fixed In Version: golang-1.19.2-2.el9 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of:
: 1969844 1975769 2149311 2149312 (view as bug list) Environment:
Last Closed: 2023-05-09 07:29:46 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2149316, 2154434, 1969844, 1975769, 2149311, 2149312, 2149315    
Attachments:
Description Flags
full testcase output with golang-1.16.4-2.ssl3 none

Description Edjunior Barbosa Machado 2021-06-02 10:22:10 UTC
Created attachment 1788653 [details]
full testcase output with golang-1.16.4-2.ssl3

Description of problem:
Some crypto tests from openssl3-enabled golang-1.16.4-2.ssl3 ​are failing on RHEL-9.0.0-20210529.d.3 s390x:

(...)
=== RUN   TestNoAsm
   ​ecdsa_test.go:29: P-256: error: boringcrypto: unknown elliptic curve
   ​ecdsa_test.go:112: boringcrypto: unknown elliptic curve
--- FAIL: TestNoAsm (0.02s)
=== RUN   TestKeyGeneration
--- PASS: TestKeyGeneration (0.00s)
=== RUN   TestSignAndVerify
   ​ecdsa_test.go:158: skipping test in boring mode
--- SKIP: TestSignAndVerify (0.00s)
=== RUN   TestSignAndVerifyASN1
--- PASS: TestSignAndVerifyASN1 (0.00s)
=== RUN   TestHashSignAndHashVerify
   ​ecdsa_test.go:142: p256: error signing: asn1: syntax error: sequence truncated
   ​ecdsa_test.go:142: p384: error signing: asn1: syntax error: sequence truncated
   ​ecdsa_test.go:142: p521: error signing: asn1: syntax error: sequence truncated
--- FAIL: TestHashSignAndHashVerify (0.00s)
=== RUN   TestNonceSafety
   ​ecdsa_test.go:245: p256: error signing: asn1: syntax error: sequence truncated
   ​ecdsa_test.go:245: p384: error signing: asn1: syntax error: sequence truncated
   ​ecdsa_test.go:245: p521: error signing: asn1: syntax error: sequence truncated
--- FAIL: TestNonceSafety (0.00s)
=== RUN   TestINDCCA
   ​ecdsa_test.go:320: p256: error signing: asn1: syntax error: sequence truncated
   ​ecdsa_test.go:320: p384: error signing: asn1: syntax error: sequence truncated
   ​ecdsa_test.go:320: p521: error signing: asn1: syntax error: sequence truncated
--- FAIL: TestINDCCA (0.00s)
=== RUN   TestVectors
--- PASS: TestVectors (0.12s)
=== RUN   TestNegativeInputs
--- PASS: TestNegativeInputs (0.00s)
=== RUN   TestZeroHashSignature
--- FAIL: TestZeroHashSignature (0.00s)
panic: asn1: syntax error: sequence truncated [recovered]
	panic: asn1: syntax error: sequence truncated

goroutine 16 [running]:
testing.tRunner.func1.2(0x1b6940, 0xc000166ea0)
	/usr/lib/golang/src/testing/testing.go:1143 +0x2e6
testing.tRunner.func1(0xc00013a180)
	/usr/lib/golang/src/testing/testing.go:1146 +0x458
panic(0x1b6940, 0xc000166ea0)
	/usr/lib/golang/src/runtime/panic.go:965 +0x16e
crypto/ecdsa.TestZeroHashSignature(0xc00013a180)
	/usr/lib/golang/src/crypto/ecdsa/ecdsa_test.go:542 +0x5f8
testing.tRunner(0xc00013a180, 0x1e6b50)
	/usr/lib/golang/src/testing/testing.go:1193 +0xd8
created by testing.(*T).Run
	/usr/lib/golang/src/testing/testing.go:1238 +0x296
FAIL	crypto/ecdsa	0.158s
(...)
=== RUN   TestDecryptPKCS1v15
   ​pkcs1v15_test.go:72: #0 got:[]byte{} want:[]byte{0x78}
   ​pkcs1v15_test.go:72: #1 got:[]byte{} want:[]byte{0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e}
   ​pkcs1v15_test.go:72: #2 got:[]byte{} want:[]byte{0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0xa}
   ​pkcs1v15_test.go:72: #3 got:[]byte{} want:[]byte{0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x31, 0x32}
   ​pkcs1v15_test.go:72: #0 got:[]byte{} want:[]byte{0x78}
   ​pkcs1v15_test.go:72: #1 got:[]byte{} want:[]byte{0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e}
   ​pkcs1v15_test.go:72: #2 got:[]byte{} want:[]byte{0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0xa}
   ​pkcs1v15_test.go:72: #3 got:[]byte{} want:[]byte{0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x31, 0x32}
--- FAIL: TestDecryptPKCS1v15 (0.00s)
=== RUN   TestEncryptPKCS1v15
   ​pkcs1v15_test.go:106: output mismatch: []byte{} []byte{0x30, 0x9e, 0x5b, 0x36, 0xae, 0x41}
--- FAIL: TestEncryptPKCS1v15 (0.00s)
=== RUN   TestEncryptPKCS1v15SessionKey
--- FAIL: TestEncryptPKCS1v15SessionKey (0.00s)
panic: runtime error: index out of range [0] with length 0 [recovered]
	panic: runtime error: index out of range [0] with length 0

goroutine 2019 [running]:
testing.tRunner.func1.2(0x1d70c0, 0xc00032a000)
	/usr/lib/golang/src/testing/testing.go:1143 +0x2e6
testing.tRunner.func1(0xc000207380)
	/usr/lib/golang/src/testing/testing.go:1146 +0x458
panic(0x1d70c0, 0xc00032a000)
	/usr/lib/golang/src/runtime/panic.go:965 +0x16e
crypto/rsa.decryptPKCS1v15(0x0, 0x0, 0xc00012c070, 0xc000320480, 0x100, 0x102, 0x100, 0x0, 0x0, 0x102, ...)
	/usr/lib/golang/src/crypto/rsa/pkcs1v15.go:197 +0x484
crypto/rsa.DecryptPKCS1v15SessionKey(0x0, 0x0, 0xc00012c070, 0xc000320480, 0x100, 0x102, 0xc00031a488, 0x4, 0x4, 0x438, ...)
	/usr/lib/golang/src/crypto/rsa/pkcs1v15.go:148 +0xfc
crypto/rsa.TestEncryptPKCS1v15SessionKey(0xc000207380)
	/usr/lib/golang/src/crypto/rsa/pkcs1v15_test.go:142 +0x122
testing.tRunner(0xc000207380, 0x1f9d38)
	/usr/lib/golang/src/testing/testing.go:1193 +0xd8
created by testing.(*T).Run
	/usr/lib/golang/src/testing/testing.go:1238 +0x296
FAIL	crypto/rsa	4.590s
(...)

The tests used to pass with previous golang-1.16.4-1.el9.

These failures were not reproducible in the other supported arches.

Version-Release number of selected component (if applicable):
golang-1.16.4-2.ssl3


Steps to Reproduce:
1. Set up openssl3 environment as described on specfile (https://gitlab.com/redhat/centos-stream/rpms/golang/-/blob/8a80e2787914ab2b0dba9e661e6877929888bf68/golang.spec#L465-504):

TEST_BORING_CONFIGS=`mktemp -d`
TEST_BORING_CNF=$TEST_BORING_CONFIGS/openssl-boring.cnf
TEST_BORING_FIPS_CNF=$TEST_BORING_CONFIGS/fipsmodule.cnf

cp /etc/pki/tls/openssl.cnf $TEST_BORING_CNF
openssl fipsinstall -module /usr/lib64/ossl-modules/fips.so -out $TEST_BORING_FIPS_CNF

cat > $TEST_BORING_CNF << EOM
openssl_conf = openssl_test

[openssl_test]
providers = provider_test
alg_section = algorithm_test
ssl_conf = ssl_module

[algorithm_test]
default_properties = fips=yes

[provider_test]
default = default_sect
 # The fips section name should match the section name inside the
 # included fipsmodule.cnf.
fips = fips_sect
.include $TEST_BORING_FIPS_CNF

[default_sect]
activate = 1

[ ssl_module ]

system_default = crypto_policy

[ crypto_policy ]

.include = /etc/crypto-policies/back-ends/opensslcnf.config

[ new_oids ]

EOM

export OPENSSL_CONF=$TEST_BORING_CNF

2. GOLANG_FIPS=1 go test -v -timeout 50m crypto/ecdsa crypto/rsa

Additional info:
RHEL-9.0.0-20210529.d.3 BaseOS s390x

Comment 5 Edjunior Barbosa Machado 2022-06-17 15:38:11 UTC
2 more crypto/rsa tests fail with golang-1.18.2-2.el9 on RHEL-9.1.0-20220616.1 BaseOS s390x:

(...)
--- FAIL: TestDecryptOAEP (0.00s)
    rsa_test.go:322: #0,0 bad result: []byte{} (want []byte{0x66, 0x28, 0x19, 0x4e, 0x12, 0x7, 0x3d, 0xb0, 0x3b, 0xa9, 0x4c, 0xda, 0x9e, 0xf9, 0x53, 0x23, 0x97, 0xd5, 0xd, 0xba, 0x79, 0xb9, 0x87, 0x0, 0x4a, 0xfe, 0xfe, 0x34})
    rsa_test.go:330: #0,0 (blind) bad result: []byte{} (want []byte{0x66, 0x28, 0x19, 0x4e, 0x12, 0x7, 0x3d, 0xb0, 0x3b, 0xa9, 0x4c, 0xda, 0x9e, 0xf9, 0x53, 0x23, 0x97, 0xd5, 0xd, 0xba, 0x79, 0xb9, 0x87, 0x0, 0x4a, 0xfe, 0xfe, 0x34})
    rsa_test.go:322: #0,1 bad result: []byte{} (want []byte{0x75, 0xc, 0x40, 0x47, 0xf5, 0x47, 0xe8, 0xe4, 0x14, 0x11, 0x85, 0x65, 0x23, 0x29, 0x8a, 0xc9, 0xba, 0xe2, 0x45, 0xef, 0xaf, 0x13, 0x97, 0xfb, 0xe5, 0x6f, 0x9d, 0xd5})
    rsa_test.go:330: #0,1 (blind) bad result: []byte{} (want []byte{0x75, 0xc, 0x40, 0x47, 0xf5, 0x47, 0xe8, 0xe4, 0x14, 0x11, 0x85, 0x65, 0x23, 0x29, 0x8a, 0xc9, 0xba, 0xe2, 0x45, 0xef, 0xaf, 0x13, 0x97, 0xfb, 0xe5, 0x6f, 0x9d, 0xd5})
    rsa_test.go:322: #0,2 bad result: []byte{} (want []byte{0xd9, 0x4a, 0xe0, 0x83, 0x2e, 0x64, 0x45, 0xce, 0x42, 0x33, 0x1c, 0xb0, 0x6d, 0x53, 0x1a, 0x82, 0xb1, 0xdb, 0x4b, 0xaa, 0xd3, 0xf, 0x74, 0x6d, 0xc9, 0x16, 0xdf, 0x24, 0xd4, 0xe3, 0xc2, 0x45, 0x1f, 0xff, 0x59, 0xa6, 0x42, 0x3e, 0xb0, 0xe1, 0xd0, 0x2d, 0x4f, 0xe6, 0x46, 0xcf, 0x69, 0x9d, 0xfd, 0x81, 0x8c, 0x6e, 0x97, 0xb0, 0x51})
    rsa_test.go:330: #0,2 (blind) bad result: []byte{} (want []byte{0xd9, 0x4a, 0xe0, 0x83, 0x2e, 0x64, 0x45, 0xce, 0x42, 0x33, 0x1c, 0xb0, 0x6d, 0x53, 0x1a, 0x82, 0xb1, 0xdb, 0x4b, 0xaa, 0xd3, 0xf, 0x74, 0x6d, 0xc9, 0x16, 0xdf, 0x24, 0xd4, 0xe3, 0xc2, 0x45, 0x1f, 0xff, 0x59, 0xa6, 0x42, 0x3e, 0xb0, 0xe1, 0xd0, 0x2d, 0x4f, 0xe6, 0x46, 0xcf, 0x69, 0x9d, 0xfd, 0x81, 0x8c, 0x6e, 0x97, 0xb0, 0x51})
--- FAIL: TestEncryptDecryptOAEP (0.00s)
    rsa_test.go:351: skipping check for unsupported key less than 2048 bits
    rsa_test.go:354: running check for supported key size
    rsa_test.go:368: #1,0: round trip "\x8b\xbak\xf8*l\x0f\x86\xd5\xf1un\x97\x95hp\xb0\x89S\xb0kN\xb2\x05\xbc\x16\x94\xee" -> ""
FAIL
FAIL	crypto/rsa	4.503s
(...)

Comment 23 errata-xmlrpc 2023-05-09 07:29:46 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (delve, golang, and go-toolset bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2023:2181