Skip to content

Add optional support for Botan3#8994

Merged
droidmonkey merged 1 commit intokeepassxreboot:developfrom
novasharper:botan3
Feb 18, 2023
Merged

Add optional support for Botan3#8994
droidmonkey merged 1 commit intokeepassxreboot:developfrom
novasharper:botan3

Conversation

@novasharper
Copy link
Copy Markdown
Contributor

@novasharper novasharper commented Jan 14, 2023

Update CMake config to add a KPXC_DEV_BOTAN3 option. This will result in CMake setting the C++ standard to C++20 instead of C++17, ignoring the 'deprecated-enum-enum-conversion' and 'deprecated' warnings, and using the Botan 3 version/include dir/libraries instead of the Botan 2 ones.

The value of this option will be made available to the c++ code via the config-keepassxc.h header.

This also makes some minimal compatability fixes to the code (behind a ifndef-else-endif compiler directive)

  • For Botan 3, just check that the botan major version is 3
  • In SessionCipher.cpp, if we are compiling against Botan 3, use the pubkey api instead of the pk_ops api.

Testing strategy

Compiled an ran the application with WITH_XC_ALL and KPXC_DEV_BOTAN3.

Type of change

  • ✅ New feature (change that adds functionality)

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jan 14, 2023

Codecov Report

Base: 64.85% // Head: 64.57% // Decreases project coverage by -0.28% ⚠️

Coverage data is based on head (1b3ef37) compared to base (ba15981).
Patch coverage: 100.00% of modified lines in pull request are covered.

❗ Current head 1b3ef37 differs from pull request most recent head a783125. Consider uploading reports for the commit a783125 to get more accurate results

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #8994      +/-   ##
===========================================
- Coverage    64.85%   64.57%   -0.28%     
===========================================
  Files          342      340       -2     
  Lines        44426    44142     -284     
===========================================
- Hits         28812    28504     -308     
- Misses       15614    15638      +24     
Impacted Files Coverage Δ
src/crypto/Crypto.cpp 60.80% <100.00%> (+0.22%) ⬆️
src/fdosecrets/objects/SessionCipher.cpp 75.81% <100.00%> (ø)
src/gui/styles/base/BaseStyle.cpp 57.90% <100.00%> (-0.03%) ⬇️
src/gui/SquareSvgWidget.h 0.00% <0.00%> (-100.00%) ⬇️
src/gui/SquareSvgWidget.cpp 0.00% <0.00%> (-100.00%) ⬇️
src/qrcode/QrCode.cpp 0.00% <0.00%> (-79.69%) ⬇️
src/gui/TotpExportSettingsDialog.cpp 0.00% <0.00%> (-71.01%) ⬇️
src/sshagent/OpenSSHKey.cpp 78.59% <0.00%> (-2.61%) ⬇️
src/format/KeePass2.cpp 80.85% <0.00%> (-2.23%) ⬇️
src/gui/DatabaseWidget.cpp 61.38% <0.00%> (-0.59%) ⬇️
... and 12 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@droidmonkey
Copy link
Copy Markdown
Member

Botan 3 is not yet released. I would be hesitant to add support until it stabilizes to some extent.

@novasharper
Copy link
Copy Markdown
Contributor Author

Botan 3 is not yet released. I would be hesitant to add support until it stabilizes to some extent.

Right. I am not imagining that releases would be built against Botan 3, but this will make it possible to test/develop against Botan 3.

@droidmonkey
Copy link
Copy Markdown
Member

In that case I'd call the cmake switch something like KPXC_DEV_BOTAN3

@novasharper
Copy link
Copy Markdown
Contributor Author

In that case I'd call the cmake switch something like KPXC_DEV_BOTAN3

Will do. I was not sure what the naming scheme was for the cmake options.

@novasharper novasharper force-pushed the botan3 branch 3 times, most recently from 1e963f7 to a7b1c5c Compare February 16, 2023 14:26
Update CMake config to add a WITH_XC_BOTAN3 option. This will result in
CMake setting the C++ standard to C++20 instead of C++17, ignoring the
'deprecated-enum-enum-conversion' and 'deprecated' warnings, and using
the Botan 3 version/include dir/libraries instead of the Botan 2 ones.

The value of this option will be made available to the c++ code via the
config-keepassxc.h header.

This also makes some minimal compatability fixes to the code (behind a
ifndef-else-endif compiler directive)

- For Botan 3, just check that the botan major version is 3
- In SessionCipher.cpp, if we are compiling against Botan 3, use the
  pubkey api instead of the pk_ops api.
@droidmonkey droidmonkey merged commit f9f82e9 into keepassxreboot:develop Feb 18, 2023
@novasharper novasharper deleted the botan3 branch February 19, 2023 18:18
@TimB87 TimB87 mentioned this pull request Apr 14, 2023
droidmonkey added a commit that referenced this pull request May 8, 2023
Fix Botan 3 build (#9388)

* SymmetricCipher: Fix Botan 3 build

Botan commit 819cf8fe6278a19b8266f449228f02fc28a4f784 changed Botan::Cipher_Dir to be a scoped enumeration, so the users must be adapted.

This change causes no issues with Botan 2 because normal enumeration values can also be referred to the same way scoped enumeration values are accessed.

* Auto detect Botan3

* AsyncTask: Do not use `std::result_of`

`std::result_of` was deprecated in C++17 and then it was subsequently removed in C++20. One could use `std::invoke_result_t`, but let Qt figure out the return type instead.

* Collapse Botan2 and Botan3 find package into one

* Update COPYING
@droidmonkey droidmonkey added the pr: backported Pull request backported to previous release label Oct 27, 2024
@phoerious phoerious modified the milestones: v2.8.0, v2.7.7 Nov 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build system pr: backported Pull request backported to previous release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants