rnpgp / rnp

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

tests fail with GnuPG 2.3.x #1583

Closed andreasstieger closed 3 years ago

andreasstieger commented 3 years ago

Description

Tests fail with GnuPG 2.3.x while they work with 2.2.x. (clean build root and the package being the only difference). Reason is that GnuPG 2.3.x refuses 64 bit block ciphers unless --allow-old-ciphers is passed. See https://dev.gnupg.org/T3415 and https://github.com/gpg/gnupg/commit/825dd7220ff6079cbe2d0df7fde93526c077fb6d .

Steps to Reproduce

  1. build with GnuPG 2.3.x, in this case 2.3.1
  2. run tests

Expected Behavior

Passing tests

Actual Behavior

[  247s] test_encryption_s2k (__main__.Misc) ... /usr/bin/gpg --homedir /tmp/rnpctmpz1b8k6hc/.gpg -c --s2k-cipher-algo AES --s2k-digest-algo SHA1 --s2k-mode 0 --batch --passphrase password --output /tmp/rnpctmpz1b8k6hc/cleartext.gpg /tmp/rnpctmpz1b8k6hc/cleartext.txt
[  247s] gpg: Note: simple S2K mode (0) is strongly discouraged
[  247s] 
[...]
[  247s] /usr/bin/gpg --homedir /tmp/rnpctmpz1b8k6hc/.gpg -c --s2k-cipher-algo IDEA --s2k-digest-algo RIPEMD160 --s2k-mode 1 --batch --passphrase password --output /tmp/rnpctmpz1b8k6hc/cleartext.gpg /tmp/rnpctmpz1b8k6hc/cleartext.txt
[  247s] gpg: cipher algorithm 'IDEA' may not be used for encryption
[  247s] gpg: (use option "--allow-old-cipher-algos" to override)
[  247s] gpg: symmetric encryption of '/tmp/rnpctmpz1b8k6hc/cleartext.txt' failed: Invalid cipher algorithm
[  247s] 
[  247s] ERROR
[...]
[  249s] ======================================================================
[  249s] ERROR: test_encryption_s2k (__main__.Misc)
[  249s] ----------------------------------------------------------------------
[  249s] Traceback (most recent call last):
[  249s]   File "/home/abuild/rpmbuild/BUILD/rnp-0.15.2/src/tests/cli_tests.py", line 1587, in test_encryption_s2k
[  249s]     rnp_encryption_s2k_gpg(ciphers[i % len(ciphers)], hashes[
[  249s]   File "/home/abuild/rpmbuild/BUILD/rnp-0.15.2/src/tests/cli_tests.py", line 1581, in rnp_encryption_s2k_gpg
[  249s]     raise_err('gpg symmetric encryption failed', err)
[  249s]   File "/home/abuild/rpmbuild/BUILD/rnp-0.15.2/src/tests/cli_common.py", line 35, in raise_err
[  249s]     raise CLIError(msg, log)
[  249s] cli_common.CLIError: <unprintable CLIError object>
[  249s] 
[  249s] ----------------------------------------------------------------------
[...]
[  800s] test_file_encryption__gpg_to_rnp (__main__.Encryption) ... /usr/bin/gpg --homedir /tmp/rnpctmprkayjn4j/.gpg -e -r encryption@rnp --batch --trust-model always --output /tmp/rnpctmprkayjn4j/cleartext.gpg /tmp/rnpctmprkayjn4j/cleartext.txt
[...]
[  800s] /usr/bin/gpg --homedir /tmp/rnpctmprkayjn4j/.gpg -e --cipher-algo idea -r encryption@rnp --batch --trust-model always --output /tmp/rnpctmprkayjn4j/cleartext.gpg /tmp/rnpctmprkayjn4j/cleartext.txt
[  800s] gpg: WARNING: forcing symmetric cipher IDEA (1) violates recipient preferences
[  800s] gpg: cipher algorithm 'IDEA' may not be used for encryption
[  800s] gpg: (use option "--allow-old-cipher-algos" to override)
[  800s] gpg: /tmp/rnpctmprkayjn4j/cleartext.txt: encryption failed: Invalid cipher algorithm
[  800s] 
[  800s] ERROR
[...]
[  800s] test_sym_encryption__gpg_to_rnp (__main__.Encryption) ... /usr/bin/gpg --homedir /tmp/rnpctmprkayjn4j/.gpg -c -z 0 --s2k-count 65536 --batch --passphrase password --output /tmp/rnpctmprkayjn4j/cleartext.gpg /tmp/rnpctmprkayjn4j/cleartext.txt
[  800s] 
[...]
[  800s] 
[  800s] /usr/bin/gpg --homedir /tmp/rnpctmprkayjn4j/.gpg -c --cipher-algo idea --compress-algo 2 --s2k-count 65536 --batch --passphrase password --output /tmp/rnpctmprkayjn4j/cleartext.gpg /tmp/rnpctmprkayjn4j/cleartext.txt
[  800s] gpg: cipher algorithm 'IDEA' may not be used for encryption
[  800s] gpg: (use option "--allow-old-cipher-algos" to override)
[  800s] gpg: symmetric encryption of '/tmp/rnpctmprkayjn4j/cleartext.txt' failed: Invalid cipher algorithm
[  800s] 
[  800s] ERROR
[...]
[  802s] ======================================================================
[  802s] ERROR: test_file_encryption__gpg_to_rnp (__main__.Encryption)
[  802s] ----------------------------------------------------------------------
[  802s] Traceback (most recent call last):
[  802s]   File "/home/abuild/rpmbuild/BUILD/rnp-0.15.2/src/tests/cli_tests.py", line 2042, in test_file_encryption__gpg_to_rnp
[  802s]     gpg_to_rnp_encryption(size, cipher)
[  802s]   File "/home/abuild/rpmbuild/BUILD/rnp-0.15.2/src/tests/cli_tests.py", line 622, in gpg_to_rnp_encryption
[  802s]     gpg_encrypt_file(src, dst, cipher, z, armor)
[  802s]   File "/home/abuild/rpmbuild/BUILD/rnp-0.15.2/src/tests/cli_tests.py", line 489, in gpg_encrypt_file
[  802s]     raise_err('gpg encryption failed for cipher ' + cipher, err)
[  802s]   File "/home/abuild/rpmbuild/BUILD/rnp-0.15.2/src/tests/cli_common.py", line 35, in raise_err
[  802s]     raise CLIError(msg, log)
[  802s] cli_common.CLIError: <unprintable CLIError object>
[  802s] 
[  802s] ======================================================================
[  802s] ERROR: test_sym_encryption__gpg_to_rnp (__main__.Encryption)
[  802s] ----------------------------------------------------------------------
[  802s] Traceback (most recent call last):
[  802s]   File "/home/abuild/rpmbuild/BUILD/rnp-0.15.2/src/tests/cli_tests.py", line 2052, in test_sym_encryption__gpg_to_rnp
[  802s]     rnp_sym_encryption_gpg_to_rnp(size, cipher, z)
[  802s]   File "/home/abuild/rpmbuild/BUILD/rnp-0.15.2/src/tests/cli_tests.py", line 665, in rnp_sym_encryption_gpg_to_rnp
[  802s]     gpg_symencrypt_file(src, dst, cipher, z, armor)
[  802s]   File "/home/abuild/rpmbuild/BUILD/rnp-0.15.2/src/tests/cli_tests.py", line 509, in gpg_symencrypt_file
[  802s]     raise_err('gpg symmetric encryption failed for cipher ' + cipher, err)
[  802s]   File "/home/abuild/rpmbuild/BUILD/rnp-0.15.2/src/tests/cli_common.py", line 35, in raise_err
[  802s]     raise CLIError(msg, log)
[  802s] cli_common.CLIError: <unprintable CLIError object>
[  802s] 
[  802s] ----------------------------------------------------------------------
[...]
[  802s] The following tests FAILED:
[  802s]    223 - cli_tests-Encryption (Failed)
[  802s]    225 - cli_tests-Misc (Failed)
ni4 commented 3 years ago

@andreasstieger Thanks for reporting!