rnpgp / rnp

RNP: high performance C++ OpenPGP library used by Mozilla Thunderbird
https://www.rnpgp.org
Other
192 stars 54 forks source link

Tests fail with GnuPG 2.3.x on 32 bit only `gpg: Fatal: zlib inflate problem: invalid bit length repeat` #1627

Open andreasstieger opened 2 years ago

andreasstieger commented 2 years ago

Description

Tests fail with GnuPG 2.3.x on 32 bit only. Similar to #1583, but with these fixes merged the tests pass on x86_64 and fail on i586.

gpg: Fatal: zlib inflate problem: invalid bit length repeat

Steps to Reproduce

  1. Build 0.15.2 + cdfd31b824ba833e0d14c8844d3f144eaa922d8b

Expected Behavior

Actual Behavior

https://build.opensuse.org/package/show/home:AndreasStieger:branches:security:privacy/rnp

[  996s] 227/227 Test #223: cli_tests-Encryption ..........................................................***Failed  763.68 sec
[...]
[ 1005s] /usr/bin/gpg --display-charset UTF-8 --homedir /tmp/rnpctmpfhx8iiz4/.gpg --pinentry-mode=loopback --batch --yes --passphrase password --trust-model always -o /tmp/rnpctmpfhx8iiz4/cleartext.rnp -d /tmp/rnpctmpfhx8iiz4/cleartext.enc
[ 1005s] gpg: AES256.EAX encrypted session key
[ 1005s] gpg: encrypted with 1 passphrase
[ 1005s] gpg: Fatal: zlib inflate problem: invalid bit length repeat
[ 1005s] 
[ 1005s] ERROR
[...]
[ 1006s] ======================================================================
[ 1006s] ERROR: test_sym_encryption__rnp_aead (__main__.Encryption)
[ 1006s] ----------------------------------------------------------------------
[ 1006s] Traceback (most recent call last):
[ 1006s]   File "/home/abuild/rpmbuild/BUILD/rnp-0.15.2/src/tests/cli_tests.py", line 2089, in test_sym_encryption__rnp_aead
[ 1006s]     rnp_sym_encryption_rnp_aead(size, cipher, z, [aead, bits], GPG_AEAD)
[ 1006s]   File "/home/abuild/rpmbuild/BUILD/rnp-0.15.2/src/tests/cli_tests.py", line 706, in rnp_sym_encryption_rnp_aead
[ 1006s]     gpg_decrypt_file(enc, dst, PASSWORD)
[ 1006s]   File "/home/abuild/rpmbuild/BUILD/rnp-0.15.2/src/tests/cli_tests.py", line 522, in gpg_decrypt_file
[ 1006s]     raise_err('gpg decryption failed', err)
[ 1006s]   File "/home/abuild/rpmbuild/BUILD/rnp-0.15.2/src/tests/cli_common.py", line 35, in raise_err
[ 1006s]     raise CLIError(msg, log)
[ 1006s] cli_common.CLIError: <unprintable CLIError object>
[ 1006s] 
[ 1006s] ----------------------------------------------------------------------
[ 1006s] Ran 10 tests in 763.525s
[ 1006s] 
[ 1006s] FAILED (errors=1)
[ 1006s] 
[ 1006s] 
[ 1006s] 99% tests passed, 1 tests failed out of 227
[ 1006s] 
[ 1006s] Total Test time (real) = 860.25 sec
[ 1006s] 
[ 1006s] The following tests FAILED:
[ 1006s]    223 - cli_tests-Encryption (Failed)
[ 1006s] Errors while running CTest
[ 1006s] error: Bad exit status from /var/tmp/rpm-tmp.2nY8wK (%check)
ni4 commented 2 years ago

Thanks for reporting. Does this problem go away after restarting tests (i.e. not 100% reproducible)?

Relevant commands:

[  996s] /usr/bin/gpg --version
[  996s] 
[  996s] gpg (GnuPG) 2.3.2
[  996s] libgcrypt 1.9.4-unknown
[  996s] Copyright (C) 2021 Free Software Foundation, Inc.
[  996s] License GNU GPL-3.0-or-later <https://gnu.org/licenses/gpl.html>
[  996s] This is free software: you are free to change and redistribute it.
[  996s] There is NO WARRANTY, to the extent permitted by law.
[  996s] 
[  996s] Home: /home/abuild/.gnupg
[  996s] Supported algorithms:
[  996s] Pubkey: RSA, ELG, DSA, ECDH, ECDSA, EDDSA
[  996s] Cipher: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH,
[  996s]         CAMELLIA128, CAMELLIA192, CAMELLIA256
[  996s] AEAD: EAX, OCB
[  996s] Hash: SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
[  996s] Compression: Uncompressed, ZIP, ZLIB, BZIP2
...
[ 1005s] /home/abuild/rpmbuild/BUILD/rnp-0.15.2/build/src/rnp/rnp --homedir /tmp/rnpctmpfhx8iiz4/.rnp -z 1 --aead=eax --aead-chunk-bits=30 --cipher AES256 --passwords 1 --pass-fd 4 -c /tmp/rnpctmpfhx8iiz4/cleartext.txt --output /tmp/rnpctmpfhx8iiz4/cleartext.enc
[ 1005s] 
[ 1005s] 
[ 1005s] /home/abuild/rpmbuild/BUILD/rnp-0.15.2/build/src/rnp/rnp --homedir /tmp/rnpctmpfhx8iiz4/.rnp --pass-fd 4 --decrypt /tmp/rnpctmpfhx8iiz4/cleartext.enc --output /tmp/rnpctmpfhx8iiz4/cleartext.rnp
[ 1005s] 
[ 1005s] 
[ 1005s] /usr/bin/gpg --display-charset UTF-8 --homedir /tmp/rnpctmpfhx8iiz4/.gpg --pinentry-mode=loopback --batch --yes --passphrase password --trust-model always -o /tmp/rnpctmpfhx8iiz4/cleartext.rnp -d /tmp/rnpctmpfhx8iiz4/cleartext.enc
[ 1005s] gpg: AES256.EAX encrypted session key
[ 1005s] gpg: encrypted with 1 passphrase
[ 1005s] gpg: Fatal: zlib inflate problem: invalid bit length repeat
[ 1005s] 
[ 1005s] ERROR
andreasstieger commented 2 years ago

This is reproducible on IA32 and ARM 32 bit. I can run some more on head and see if we get to more information here. From what I read about similar issues in GnuPG these happened before when data generated by very old GnuPG versions was consumed by current ones. As a result though this issue might be rnp generating data that GnuPG 2.3.x happens to interpret in a more strict fashion.