public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Bill Roberts <bill.roberts@arm.com>
To: git-commits@fedoraproject.org
Subject: [rpms/imhex] rawhide: imhex: support for nettle crypto backend
Date: Wed, 18 Nov 2026 11:15:49 GMT	[thread overview]
Message-ID: <179500054927.1.12200048668571784796.rpms-imhex-12ecd53ea7c2@fedoraproject.org> (raw)

            A new commit has been pushed.

            Repo   : rpms/imhex
            Branch : rawhide
            Commit : 12ecd53ea7c29aa87c395e25b402b28a91d93b75
            Author : Bill Roberts <bill.roberts@arm.com>
            Date   : 2026-10-14T14:54:03-05:00
            Stats  : +2710/-2 in 3 file(s)
            URL    : https://src.fedoraproject.org/rpms/imhex/c/12ecd53ea7c29aa87c395e25b402b28a91d93b75?branch=rawhide

            Log:
            imhex: support for nettle crypto backend

Use nettle for the crypto backend instead of mbedtls since mbedtls is
likely going away.

Signed-off-by: Bill Roberts <bill.roberts@arm.com>

---
diff --git a/0001-fix-Broken-AES-Modes-in-data-processor-2831.patch b/0001-fix-Broken-AES-Modes-in-data-processor-2831.patch
new file mode 100644
index 0000000..dc06073
--- /dev/null
+++ b/0001-fix-Broken-AES-Modes-in-data-processor-2831.patch
@@ -0,0 +1,912 @@
+From 12f42261137c6351e4fce8e4c329a32c639f2e6e Mon Sep 17 00:00:00 2001
+From: connor-cihula <connor.cihula@gmail.com>
+Date: Sun, 16 Aug 2026 15:07:30 -0500
+Subject: [PATCH 1/2] fix: Broken AES Modes in data processor (#2831)
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+<!--
+Please provide as much information as possible about what your PR aims
+to do.
+PRs with no description will most likely be closed until more
+information is provided.
+If you're planing on changing fundamental behaviour or add big new
+features, please open a GitHub Issue first before starting to work on
+it.
+If it's not something big and you still want to contact us about it,
+feel free to do so !
+-->
+
+### Problem description
+<!-- Describe the bug that you fixed/feature request that you
+implemented, or link to an existing issue describing it -->
+#2811 Revealed issues with AES decryption.
+
+- ECB: Breaks on input that is anything other than exactly one 16 byte
+block of input.
+- CBC: Didn't set a padding mode.
+- CFB128: Correct.
+- CTR: Correct.
+- GCM: Decrypts without authenticating.
+- CCM: Broken.
+- OFB: Correct  
+- XTS: Broken and hidden from UI.
+
+### Implementation description
+<!-- Explain what you did to correct the problem -->
+-  GCM/CCM: API change to allow usage of AAD and tag.
+- CBC: Use `MBEDTLS_PADDING_NONE`.
+- XTS: Was ignored before, I continue to ignore.
+
+### Screenshots
+<!-- If your change is visual, take a screenshot showing it. Ideally,
+make before/after sceenshots -->
+Before:
+<img width="432" height="271" alt="image"
+src="https://github.com/user-attachments/assets/7b6a70b0-83e7-4512-9abd-45f7f75f6cd9"
+/>
+After:
+<img width="432" height="271" alt="image"
+src="https://github.com/user-attachments/assets/dbb076a2-f77a-4348-b4f8-25efcbfc542d"
+/>
+
+### Additional things
+<!-- Anything else you would like to say -->
+@WerWolv once approved, I'll work on a PR for GNUTLS support as an
+alternative to MbedTLS, which should help with #2825 and conclude the
+discussion on #2811
+
+---------
+
+Co-authored-by: Connor Cihula <connor.cihula@arm.com>
+---
+ lib/libimhex/include/hex/helpers/crypto.hpp   |   2 +-
+ lib/libimhex/source/helpers/crypto.cpp        |  76 ++-
+ plugins/builtin/romfs/lang/en_US.json         |   2 +
+ .../data_processor_nodes/decode_nodes.cpp     |  37 +-
+ .../content/views/view_data_processor.cpp     | 116 ++---
+ tests/algorithms/CMakeLists.txt               |   2 +
+ tests/algorithms/source/aes.cpp               | 436 ++++++++++++++++++
+ 7 files changed, 577 insertions(+), 94 deletions(-)
+ create mode 100644 tests/algorithms/source/aes.cpp
+
+diff --git a/lib/libimhex/include/hex/helpers/crypto.hpp b/lib/libimhex/include/hex/helpers/crypto.hpp
+index dc4c5eda2..d98744f8c 100644
+--- a/lib/libimhex/include/hex/helpers/crypto.hpp
++++ b/lib/libimhex/include/hex/helpers/crypto.hpp
+@@ -65,5 +65,5 @@ namespace hex::crypt {
+         Key256Bits = 2
+     };
+ 
+-    wolv::util::Expected<std::vector<u8>, int> aesDecrypt(AESMode mode, KeyLength keyLength, const std::vector<u8> &key, std::array<u8, 8> nonce, std::array<u8, 8> iv, const std::vector<u8> &input);
++    wolv::util::Expected<std::vector<u8>, int> aesDecrypt(AESMode mode, KeyLength keyLength, const std::vector<u8> &key, const std::vector<u8> &nonce, const std::vector<u8> &iv, const std::vector<u8> &input, const std::vector<u8> &tag, const std::vector<u8> &aad);
+ }
+diff --git a/lib/libimhex/source/helpers/crypto.cpp b/lib/libimhex/source/helpers/crypto.cpp
+index 0eef9828b..908988219 100644
+--- a/lib/libimhex/source/helpers/crypto.cpp
++++ b/lib/libimhex/source/helpers/crypto.cpp
+@@ -492,18 +492,15 @@ namespace hex::crypt {
+     }
+ 
+     static wolv::util::Expected<std::vector<u8>, int> aes(mbedtls_cipher_type_t type, mbedtls_operation_t operation, const std::vector<u8> &key,
+-                   std::array<u8, 8> nonce, std::array<u8, 8> iv, const std::span<const u8> &input) {
+-
+-        if (input.empty())
+-            return {};
+-        if (key.size() > 256)
+-            return {};
+-
++                   const std::vector<u8> &nonce, const std::vector<u8> &iv, const std::vector<u8> &input, const std::vector<u8> &tag, const std::vector<u8> &aad) {
+         mbedtls_cipher_context_t ctx;
++        mbedtls_cipher_init(&ctx);
++        ON_SCOPE_EXIT { mbedtls_cipher_free(&ctx); };
++
+         auto cipherInfo = mbedtls_cipher_info_from_type(type);
+ 
+         if (cipherInfo == nullptr)
+-            return {};
++            return wolv::util::Unexpected(MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE);
+ 
+         int setupResult = mbedtls_cipher_setup(&ctx, cipherInfo);
+         if (setupResult != 0)
+@@ -513,39 +510,74 @@ namespace hex::crypt {
+         if (setKeyResult != 0)
+             return wolv::util::Unexpected(setKeyResult);
+ 
+-        std::array<u8, 16> nonceCounter = { 0 };
+-
+         auto mode = mbedtls_cipher_get_cipher_mode(&ctx);
+ 
+-        // if we are in ECB mode, we don't need to set the nonce
+-        if (mode != MBEDTLS_MODE_ECB) {
+-            std::ranges::copy(nonce, nonceCounter.begin());
+-            std::ranges::copy(iv, nonceCounter.begin() + 8);
++        if (mode == MBEDTLS_MODE_CBC) {
++            int paddingResult = mbedtls_cipher_set_padding_mode(&ctx, MBEDTLS_PADDING_NONE);
++            if (paddingResult != 0) {
++                return wolv::util::Unexpected(paddingResult);
++            }
++        }
++
++        if (mode == MBEDTLS_MODE_GCM || mode == MBEDTLS_MODE_CCM) {
++            const auto &aeadIv = mode == MBEDTLS_MODE_GCM ? iv : nonce;
++            std::vector<u8> authenticatedInput;
++            authenticatedInput.reserve(input.size() + tag.size());
++            authenticatedInput.insert(authenticatedInput.end(), input.begin(), input.end());
++            authenticatedInput.insert(authenticatedInput.end(), tag.begin(), tag.end());
++
++            size_t outputSize = input.size();
++            std::vector<u8> output(outputSize, 0x00);
++            const auto cryptResult = mbedtls_cipher_auth_decrypt_ext(
++                &ctx,
++                aeadIv.data(), aeadIv.size(),
++                aad.data(), aad.size(),
++                authenticatedInput.data(), authenticatedInput.size(),
++                output.data(), output.size(),
++                &outputSize, tag.size());
++
++            if (cryptResult != 0)
++                return wolv::util::Unexpected(cryptResult);
++
++            output.resize(outputSize);
++            return output;
+         }
+ 
++        if (input.empty())
++            return {};
++
+         size_t outputSize = input.size() + mbedtls_cipher_get_block_size(&ctx);
+         std::vector<u8> output(outputSize, 0x00);
+ 
+         int cryptResult = 0;
+         if (mode == MBEDTLS_MODE_ECB) {
+-            cryptResult = mbedtls_cipher_crypt(&ctx, nullptr, 0, input.data(), input.size(), output.data(), &outputSize);
++            const auto blockSize = static_cast<size_t>(mbedtls_cipher_get_block_size(&ctx));
++            outputSize = 0;
++
++            for (size_t inputOffset = 0; inputOffset < input.size(); inputOffset += blockSize) {
++                const auto inputSize = std::min(blockSize, input.size() - inputOffset);
++                size_t blockOutputSize = 0;
++
++                cryptResult = mbedtls_cipher_crypt(&ctx, nullptr, 0, input.data() + inputOffset, inputSize, output.data() + outputSize, &blockOutputSize);
++                if (cryptResult != 0)
++                    break;
++
++                outputSize += blockOutputSize;
++            }
+         } else {
+-            cryptResult = mbedtls_cipher_crypt(&ctx, nonceCounter.data(), nonceCounter.size(), input.data(), input.size(), output.data(), &outputSize);
++            cryptResult = mbedtls_cipher_crypt(&ctx, iv.data(), iv.size(), input.data(), input.size(), output.data(), &outputSize);
+         }
+ 
+-        // free regardless of the result
+-        mbedtls_cipher_free(&ctx);
+-
+         if (cryptResult != 0) {
+             return wolv::util::Unexpected(cryptResult);
+         }
+ 
+-        output.resize(input.size());
++        output.resize(outputSize);
+ 
+         return output;
+     }
+ 
+-    wolv::util::Expected<std::vector<u8>, int> aesDecrypt(AESMode mode, KeyLength keyLength, const std::vector<u8> &key, std::array<u8, 8> nonce, std::array<u8, 8> iv, const std::vector<u8> &input) {
++    wolv::util::Expected<std::vector<u8>, int> aesDecrypt(AESMode mode, KeyLength keyLength, const std::vector<u8> &key, const std::vector<u8> &nonce, const std::vector<u8> &iv, const std::vector<u8> &input, const std::vector<u8> &tag, const std::vector<u8> &aad) {
+         switch (keyLength) {
+             case KeyLength::Key128Bits:
+                 if (key.size() != 128 / 8)
+@@ -595,7 +627,7 @@ namespace hex::crypt {
+ 
+         type = mbedtls_cipher_type_t(type + u8(keyLength));
+ 
+-        return aes(type, MBEDTLS_DECRYPT, key, nonce, iv, input);
++        return aes(type, MBEDTLS_DECRYPT, key, nonce, iv, input, tag, aad);
+     }
+ 
+ }
+diff --git a/plugins/builtin/romfs/lang/en_US.json b/plugins/builtin/romfs/lang/en_US.json
+index 12fe9fe92..40022132a 100644
+--- a/plugins/builtin/romfs/lang/en_US.json
++++ b/plugins/builtin/romfs/lang/en_US.json
+@@ -321,12 +321,14 @@
+     "hex.builtin.nodes.control_flow.loop.out": "Out",
+     "hex.builtin.nodes.crypto": "Cryptography",
+     "hex.builtin.nodes.crypto.aes": "AES Decrypter",
++    "hex.builtin.nodes.crypto.aes.aad": "AAD",
+     "hex.builtin.nodes.crypto.aes.header": "AES Decrypter",
+     "hex.builtin.nodes.crypto.aes.iv": "IV",
+     "hex.builtin.nodes.crypto.aes.key": "Key",
+     "hex.builtin.nodes.crypto.aes.key_length": "Key length",
+     "hex.builtin.nodes.crypto.aes.mode": "Mode",
+     "hex.builtin.nodes.crypto.aes.nonce": "Nonce",
++    "hex.builtin.nodes.crypto.aes.tag": "Tag",
+     "hex.builtin.nodes.custom": "Custom",
+     "hex.builtin.nodes.custom.custom": "New Node",
+     "hex.builtin.nodes.custom.custom.edit": "Edit",
+diff --git a/plugins/builtin/source/content/data_processor_nodes/decode_nodes.cpp b/plugins/builtin/source/content/data_processor_nodes/decode_nodes.cpp
+index f0d93e96b..0f7082f89 100644
+--- a/plugins/builtin/source/content/data_processor_nodes/decode_nodes.cpp
++++ b/plugins/builtin/source/content/data_processor_nodes/decode_nodes.cpp
+@@ -17,7 +17,9 @@ namespace hex::plugin::builtin {
+                                          dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Buffer, "hex.builtin.nodes.crypto.aes.iv"),
+                                          dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Buffer, "hex.builtin.nodes.crypto.aes.nonce"),
+                                          dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Buffer, "hex.builtin.nodes.common.input"),
+-                                         dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Buffer, "hex.builtin.nodes.common.output") }) { }
++                                         dp::Attribute(dp::Attribute::IOType::Out, dp::Attribute::Type::Buffer, "hex.builtin.nodes.common.output"),
++                                         dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Buffer, "hex.builtin.nodes.crypto.aes.tag"),
++                                         dp::Attribute(dp::Attribute::IOType::In, dp::Attribute::Type::Buffer, "hex.builtin.nodes.crypto.aes.aad") }) { }
+ 
+         void drawNode() override {
+             ImGui::PushItemWidth(100_scaled);
+@@ -30,9 +32,7 @@ namespace hex::plugin::builtin {
+             const auto mode = static_cast<crypt::AESMode>(m_mode);
+             const auto keyLength = static_cast<crypt::KeyLength>(m_keyLength);
+ 
+-            const auto &key   = this->getBufferOnInput(0);
+-            const auto &iv    = this->getBufferOnInput(1);
+-            const auto &nonce = this->getBufferOnInput(2);
++            const auto &key = this->getBufferOnInput(0);
+             const auto &input = this->getBufferOnInput(3);
+ 
+             if (key.empty())
+@@ -41,20 +41,29 @@ namespace hex::plugin::builtin {
+             if (input.empty())
+                 throwNodeError("Input cannot be empty");
+ 
+-            std::array<u8, 8> ivData = { 0 }, nonceData = { 0 };
++            const bool isAuthenticatedMode = mode == crypt::AESMode::GCM || mode == crypt::AESMode::CCM;
++            const bool requiresIv = mode != crypt::AESMode::ECB && mode != crypt::AESMode::CCM;
++            const bool requiresNonce = mode == crypt::AESMode::CCM;
++            const std::vector<u8> empty;
+ 
+-            if (mode != crypt::AESMode::ECB) {
+-                if (iv.empty())
+-                    throwNodeError("IV cannot be empty");
++            const auto &iv = requiresIv ? this->getBufferOnInput(1) : empty;
++            const auto &nonce = requiresNonce ? this->getBufferOnInput(2) : empty;
+ 
+-                if (nonce.empty())
+-                    throwNodeError("Nonce cannot be empty");
++            if (requiresIv && iv.empty())
++                throwNodeError("IV cannot be empty");
+ 
+-                std::ranges::copy(iv, ivData.begin());
+-                std::ranges::copy(nonce, nonceData.begin());
+-            }
++            if (requiresNonce && nonce.empty())
++                throwNodeError("Nonce cannot be empty");
++
++            const auto &tag = isAuthenticatedMode ? this->getBufferOnInput(5) : empty;
++            if (isAuthenticatedMode && tag.empty())
++                throwNodeError("Tag cannot be empty");
++
++            const auto &aad = isAuthenticatedMode && !this->getAttributes()[6].getConnectedAttributes().empty()
++                ? this->getBufferOnInput(6)
++                : empty;
+ 
+-            auto output = crypt::aesDecrypt(mode, keyLength, key, nonceData, ivData, input);
++            auto output = crypt::aesDecrypt(mode, keyLength, key, nonce, iv, input, tag, aad);
+             if (!output) {
+                 switch (output.error()) {
+                     case CRYPTO_ERROR_INVALID_KEY_LENGTH:
+diff --git a/plugins/builtin/source/content/views/view_data_processor.cpp b/plugins/builtin/source/content/views/view_data_processor.cpp
+index 7b8af928f..d6b666536 100644
+--- a/plugins/builtin/source/content/views/view_data_processor.cpp
++++ b/plugins/builtin/source/content/views/view_data_processor.cpp
+@@ -824,65 +824,70 @@ namespace hex::plugin::builtin {
+             ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(1.0F, 1.0F));
+ 
+             // Draw all attributes of the node
+-            for (auto &attribute : node.getAttributes()) {
+-                ImNodesPinShape pinShape;
+-
+-                // Set the pin shape depending on the attribute type
+-                auto attributeType = attribute.getType();
+-                switch (attributeType) {
+-                    default:
+-                    case dp::Attribute::Type::Integer:
+-                        pinShape = ImNodesPinShape_Circle;
+-                        break;
+-                    case dp::Attribute::Type::Float:
+-                        pinShape = ImNodesPinShape_Triangle;
+-                        break;
+-                    case dp::Attribute::Type::Buffer:
+-                        pinShape = ImNodesPinShape_Quad;
+-                        break;
+-                }
++            for (const auto ioType : { dp::Attribute::IOType::In, dp::Attribute::IOType::Out }) {
++                for (auto &attribute : node.getAttributes()) {
++                    if (attribute.getIOType() != ioType)
++                        continue;
++
++                    ImNodesPinShape pinShape;
++
++                    // Set the pin shape depending on the attribute type
++                    auto attributeType = attribute.getType();
++                    switch (attributeType) {
++                        default:
++                        case dp::Attribute::Type::Integer:
++                            pinShape = ImNodesPinShape_Circle;
++                            break;
++                        case dp::Attribute::Type::Float:
++                            pinShape = ImNodesPinShape_Triangle;
++                            break;
++                        case dp::Attribute::Type::Buffer:
++                            pinShape = ImNodesPinShape_Quad;
++                            break;
++                    }
+ 
+-                // Draw the attribute
+-                if (attribute.getIOType() == dp::Attribute::IOType::In) {
+-                    ImNodes::BeginInputAttribute(attribute.getId(), pinShape);
++                    // Draw the attribute
++                    if (attribute.getIOType() == dp::Attribute::IOType::In) {
++                        ImNodes::BeginInputAttribute(attribute.getId(), pinShape);
+ 
+-                    // Draw input fields for attributes that have no connected links
+-                    if (attribute.getConnectedAttributes().empty() && attributeType != dp::Attribute::Type::Buffer) {
+-                        auto &defaultValue = attribute.getDefaultData();
++                        // Draw input fields for attributes that have no connected links
++                        if (attribute.getConnectedAttributes().empty() && attributeType != dp::Attribute::Type::Buffer) {
++                            auto &defaultValue = attribute.getDefaultData();
+ 
+-                        ImGui::PushItemWidth(100_scaled);
+-                        if (attributeType == dp::Attribute::Type::Integer) {
+-                            defaultValue.resize(sizeof(i128));
++                            ImGui::PushItemWidth(100_scaled);
++                            if (attributeType == dp::Attribute::Type::Integer) {
++                                defaultValue.resize(sizeof(i128));
+ 
+-                            auto value = i64(*reinterpret_cast<i128*>(defaultValue.data()));
+-                            if (ImGui::InputScalar(Lang(attribute.getUnlocalizedName()), ImGuiDataType_S64, &value)) {
+-                                std::fill(defaultValue.begin(), defaultValue.end(), 0x00);
++                                auto value = i64(*reinterpret_cast<i128*>(defaultValue.data()));
++                                if (ImGui::InputScalar(Lang(attribute.getUnlocalizedName()), ImGuiDataType_S64, &value)) {
++                                    std::ranges::fill(defaultValue, 0x00);
+ 
+-                                i128 writeValue = value;
+-                                std::memcpy(defaultValue.data(), &writeValue, sizeof(writeValue));
+-                            }
+-                        } else if (attributeType == dp::Attribute::Type::Float) {
+-                            defaultValue.resize(sizeof(long double));
++                                    i128 writeValue = value;
++                                    std::memcpy(defaultValue.data(), &writeValue, sizeof(writeValue));
++                                }
++                            } else if (attributeType == dp::Attribute::Type::Float) {
++                                defaultValue.resize(sizeof(long double));
+ 
+-                            auto value = double(*reinterpret_cast<long double*>(defaultValue.data()));
+-                            if (ImGui::InputScalar(Lang(attribute.getUnlocalizedName()), ImGuiDataType_Double, &value)) {
+-                                std::fill(defaultValue.begin(), defaultValue.end(), 0x00);
++                                auto value = double(*reinterpret_cast<long double*>(defaultValue.data()));
++                                if (ImGui::InputScalar(Lang(attribute.getUnlocalizedName()), ImGuiDataType_Double, &value)) {
++                                    std::ranges::fill(defaultValue, 0x00);
+ 
+-                                long double writeValue = value;
+-                                std::memcpy(defaultValue.data(), &writeValue, sizeof(writeValue));
++                                    long double writeValue = value;
++                                    std::memcpy(defaultValue.data(), &writeValue, sizeof(writeValue));
++                                }
+                             }
++                            ImGui::PopItemWidth();
++
++                        } else {
++                            ImGui::TextUnformatted(Lang(attribute.getUnlocalizedName()));
+                         }
+-                        ImGui::PopItemWidth();
+ 
+-                    } else {
++                        ImNodes::EndInputAttribute();
++                    } else if (attribute.getIOType() == dp::Attribute::IOType::Out) {
++                        ImNodes::BeginOutputAttribute(attribute.getId(), ImNodesPinShape(pinShape + 1));
+                         ImGui::TextUnformatted(Lang(attribute.getUnlocalizedName()));
++                        ImNodes::EndOutputAttribute();
+                     }
+-
+-                    ImNodes::EndInputAttribute();
+-                } else if (attribute.getIOType() == dp::Attribute::IOType::Out) {
+-                    ImNodes::BeginOutputAttribute(attribute.getId(), ImNodesPinShape(pinShape + 1));
+-                    ImGui::TextUnformatted(Lang(attribute.getUnlocalizedName()));
+-                    ImNodes::EndOutputAttribute();
+                 }
+             }
+         }
+@@ -1170,16 +1175,6 @@ namespace hex::plugin::builtin {
+             if (data.contains("name"))
+                 newNode->setUnlocalizedTitle(data["name"]);
+ 
+-            u32 attrIndex  = 0;
+-            for (auto &attr : newNode->getAttributes()) {
+-                if (attrIndex < data["attrs"].size())
+-                    attr.setId(data["attrs"][attrIndex]);
+-                else
+-                    attr.setId(-1);
+-
+-                attrIndex++;
+-            }
+-
+             if (!data["data"].is_null())
+                 newNode->load(data["data"]);
+ 
+@@ -1281,6 +1276,13 @@ namespace hex::plugin::builtin {
+                     maxNodeId += 1;
+                     node->setId(maxNodeId);
+                 }
++
++                for (auto &attr : node->getAttributes()) {
++                    if (attr.getId() == -1) {
++                        maxAttrId += 1;
++                        attr.setId(maxAttrId);
++                    }
++                }
+             }
+ 
+             dp::Node::setIdCounter(maxNodeId + 1);
+diff --git a/tests/algorithms/CMakeLists.txt b/tests/algorithms/CMakeLists.txt
+index 3aa618f48..65580200e 100644
+--- a/tests/algorithms/CMakeLists.txt
++++ b/tests/algorithms/CMakeLists.txt
+@@ -10,6 +10,7 @@ set(AVAILABLE_TESTS
+         64BitFloatEndianSwap
+ 
+     # Crypto
++        AESDecrypt
+         EncodeDecode16
+         EncodeDecode64
+         EncodeDecodeLEB128
+@@ -31,6 +32,7 @@ set(AVAILABLE_TESTS
+ add_executable(${PROJECT_NAME}
+         source/endian.cpp
+         source/crypto.cpp
++        source/aes.cpp
+ )
+ 
+ 
+diff --git a/tests/algorithms/source/aes.cpp b/tests/algorithms/source/aes.cpp
+new file mode 100644
+index 000000000..81e41bac2
+--- /dev/null
++++ b/tests/algorithms/source/aes.cpp
+@@ -0,0 +1,436 @@
++#include <hex/helpers/crypto.hpp>
++#include <hex/test/tests.hpp>
++
++#include <array>
++#include <cstdlib>
++#include <string_view>
++#include <vector>
++
++namespace {
++
++    struct AesDecryptVector {
++        hex::crypt::AESMode mode;
++        hex::crypt::KeyLength keyLength;
++        std::vector<u8> key;
++        std::vector<u8> nonce;
++        std::vector<u8> iv;
++        std::vector<u8> aad;
++        std::vector<u8> input;
++        std::vector<u8> tag;
++        std::vector<u8> expected;
++    };
++
++    u8 fromHexDigit(char digit) {
++        if (digit >= '0' && digit <= '9')
++            return digit - '0';
++        if (digit >= 'a' && digit <= 'f')
++            return digit - 'a' + 10;
++        if (digit >= 'A' && digit <= 'F')
++            return digit - 'A' + 10;
++
++        std::abort();
++    }
++
++    std::vector<u8> fromHex(std::string_view value) {
++        if ((value.size() % 2) != 0)
++            std::abort();
++
++        std::vector<u8> result(value.size() / 2);
++        for (size_t index = 0; index < result.size(); ++index)
++            result[index] = (fromHexDigit(value[index * 2]) << 4) | fromHexDigit(value[index * 2 + 1]);
++
++        return result;
++    }
++
++    AesDecryptVector makeSp80038aVector(
++        hex::crypt::AESMode mode,
++        hex::crypt::KeyLength keyLength,
++        std::string_view key,
++        std::string_view input) {
++        AesDecryptVector vector = {
++            .mode = mode,
++            .keyLength = keyLength,
++            .key = fromHex(key),
++            .input = fromHex(input),
++            .expected = fromHex(
++                "6bc1bee22e409f96e93d7e117393172a"
++                "ae2d8a571e03ac9c9eb76fac45af8e51"
++                "30c81c46a35ce411e5fbc1191a0a52ef"
++                "f69f2445df4f9b17ad2b417be66c3710")
++        };
++
++        if (mode == hex::crypt::AESMode::CTR) {
++            vector.iv = fromHex("f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff");
++        } else if (mode != hex::crypt::AESMode::ECB) {
++            vector.iv = fromHex("000102030405060708090a0b0c0d0e0f");
++        }
++
++        return vector;
++    }
++
++    const AesDecryptVector Ecb = {
++        .mode = hex::crypt::AESMode::ECB,
++        .keyLength = hex::crypt::KeyLength::Key128Bits,
++        .key = fromHex("2b7e151628aed2a6abf7158809cf4f3c"),
++        .input = fromHex(
++            "3ad77bb40d7a3660a89ecaf32466ef97"
++            "f5d3d58503b9699de785895a96fdbaaf"
++            "43b1cd7f598ece23881b00e3ed030688"
++            "7b0c785e27e8ad3f8223207104725dd4"),
++        .expected = fromHex(
++            "6bc1bee22e409f96e93d7e117393172a"
++            "ae2d8a571e03ac9c9eb76fac45af8e51"
++            "30c81c46a35ce411e5fbc1191a0a52ef"
++            "f69f2445df4f9b17ad2b417be66c3710")
++    };
++
++    const AesDecryptVector Cbc = {
++        .mode = hex::crypt::AESMode::CBC,
++        .keyLength = hex::crypt::KeyLength::Key128Bits,
++        .key = fromHex("2b7e151628aed2a6abf7158809cf4f3c"),
++        .iv = fromHex("000102030405060708090a0b0c0d0e0f"),
++        .input = fromHex(
++            "7649abac8119b246cee98e9b12e9197d"
++            "5086cb9b507219ee95db113a917678b2"
++            "73bed6b8e3c1743b7116e69e22229516"
++            "3ff1caa1681fac09120eca307586e1a7"),
++        .expected = fromHex(
++            "6bc1bee22e409f96e93d7e117393172a"
++            "ae2d8a571e03ac9c9eb76fac45af8e51"
++            "30c81c46a35ce411e5fbc1191a0a52ef"
++            "f69f2445df4f9b17ad2b417be66c3710")
++    };
++
++    const AesDecryptVector CbcPkcs7 = {
++        .mode = hex::crypt::AESMode::CBC,
++        .keyLength = hex::crypt::KeyLength::Key128Bits,
++        .key = fromHex("2b7e151628aed2a6abf7158809cf4f3c"),
++        .iv = fromHex("000102030405060708090a0b0c0d0e0f"),
++        .input = fromHex(
++            "7649abac8119b246cee98e9b12e9197d"
++            "8964e0b149c10b7b682e6e39aaeb731c"),
++        .expected = fromHex(
++            "6bc1bee22e409f96e93d7e117393172a"
++            "10101010101010101010101010101010")
++    };
++
++    const AesDecryptVector Cfb128 = {
++        .mode = hex::crypt::AESMode::CFB128,
++        .keyLength = hex::crypt::KeyLength::Key128Bits,
++        .key = fromHex("2b7e151628aed2a6abf7158809cf4f3c"),
++        .iv = fromHex("000102030405060708090a0b0c0d0e0f"),
++        .input = fromHex(
++            "3b3fd92eb72dad20333449f8e83cfb4a"
++            "c8a64537a0b3a93fcde3cdad9f1ce58b"
++            "26751f67a3cbb140b1808cf187a4f4df"
++            "c04b05357c5d1c0eeac4c66f9ff7f2e6"),
++        .expected = fromHex(
++            "6bc1bee22e409f96e93d7e117393172a"
++            "ae2d8a571e03ac9c9eb76fac45af8e51"
++            "30c81c46a35ce411e5fbc1191a0a52ef"
++            "f69f2445df4f9b17ad2b417be66c3710")
++    };
++
++    const AesDecryptVector Ctr = {
++        .mode = hex::crypt::AESMode::CTR,
++        .keyLength = hex::crypt::KeyLength::Key128Bits,
++        .key = fromHex("2b7e151628aed2a6abf7158809cf4f3c"),
++        .iv = fromHex("f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff"),
++        .input = fromHex(
++            "874d6191b620e3261bef6864990db6ce"
++            "9806f66b7970fdff8617187bb9fffdff"
++            "5ae4df3edbd5d35e5b4f09020db03eab"
++            "1e031dda2fbe03d1792170a0f3009cee"),
++        .expected = fromHex(
++            "6bc1bee22e409f96e93d7e117393172a"
++            "ae2d8a571e03ac9c9eb76fac45af8e51"
++            "30c81c46a35ce411e5fbc1191a0a52ef"
++            "f69f2445df4f9b17ad2b417be66c3710")
++    };
++
++    const AesDecryptVector Gcm = {
++        .mode = hex::crypt::AESMode::GCM,
++        .keyLength = hex::crypt::KeyLength::Key128Bits,
++        .key = fromHex("feffe9928665731c6d6a8f9467308308"),
++        .iv = fromHex("cafebabefacedbaddecaf888"),
++        .aad = fromHex(
++            "3ad77bb40d7a3660a89ecaf32466ef97"
++            "f5d3d58503b9699de785895a96fdbaaf"
++            "43b1cd7f598ece23881b00e3ed030688"
++            "7b0c785e27e8ad3f8223207104725dd4"),
++        .input = fromHex(
++            "42831ec2217774244b7221b784d0d49c"
++            "e3aa212f2c02a4e035c17e2329aca12e"
++            "21d514b25466931c7d8f6a5aac84aa05"
++            "1ba30b396a0aac973d58e091473f5985"),
++        .tag = fromHex("64c0232904af398a5b67c10b53a5024d"),
++        .expected = fromHex(
++            "d9313225f88406e5a55909c5aff5269a"
++            "86a7a9531534f7da2e4c303d8a318a72"
++            "1c3c0c95956809532fcf0e2449a6b525"
++            "b16aedf5aa0de657ba637b391aafd255")
++    };
++
++    const AesDecryptVector Ccm = {
++        .mode = hex::crypt::AESMode::CCM,
++        .keyLength = hex::crypt::KeyLength::Key128Bits,
++        .key = fromHex("404142434445464748494a4b4c4d4e4f"),
++        .nonce = fromHex("10111213141516"),
++        .aad = fromHex("0001020304050607"),
++        .input = fromHex("7162015b"),
++        .tag = fromHex("4dac255d"),
++        .expected = fromHex("20212223")
++    };
++
++    const AesDecryptVector Ofb = {
++        .mode = hex::crypt::AESMode::OFB,
++        .keyLength = hex::crypt::KeyLength::Key128Bits,
++        .key = fromHex("2b7e151628aed2a6abf7158809cf4f3c"),
++        .iv = fromHex("000102030405060708090a0b0c0d0e0f"),
++        .input = fromHex(
++            "3b3fd92eb72dad20333449f8e83cfb4a"
++            "7789508d16918f03f53c52dac54ed825"
++            "9740051e9c5fecf64344f7a82260edcc"
++            "304c6528f659c77866a510d9c1d6ae5e"),
++        .expected = fromHex(
++            "6bc1bee22e409f96e93d7e117393172a"
++            "ae2d8a571e03ac9c9eb76fac45af8e51"
++            "30c81c46a35ce411e5fbc1191a0a52ef"
++            "f69f2445df4f9b17ad2b417be66c3710")
++    };
++
++    const AesDecryptVector Ecb192 = makeSp80038aVector(
++        hex::crypt::AESMode::ECB,
++        hex::crypt::KeyLength::Key192Bits,
++        "8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b",
++        "bd334f1d6e45f25ff712a214571fa5cc"
++        "974104846d0ad3ad7734ecb3ecee4eef"
++        "ef7afd2270e2e60adce0ba2face6444e"
++        "9a4b41ba738d6c72fb16691603c18e0e");
++
++    const AesDecryptVector Ecb256 = makeSp80038aVector(
++        hex::crypt::AESMode::ECB,
++        hex::crypt::KeyLength::Key256Bits,
++        "603deb1015ca71be2b73aef0857d7781"
++        "1f352c073b6108d72d9810a30914dff4",
++        "f3eed1bdb5d2a03c064b5a7e3db181f8"
++        "591ccb10d410ed26dc5ba74a31362870"
++        "b6ed21b99ca6f4f9f153e7b1beafed1d"
++        "23304b7a39f9f3ff067d8d8f9e24ecc7");
++
++    const AesDecryptVector Cbc192 = makeSp80038aVector(
++        hex::crypt::AESMode::CBC,
++        hex::crypt::KeyLength::Key192Bits,
++        "8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b",
++        "4f021db243bc633d7178183a9fa071e8"
++        "b4d9ada9ad7dedf4e5e738763f69145a"
++        "571b242012fb7ae07fa9baac3df102e0"
++        "08b0e27988598881d920a9e64f5615cd");
++
++    const AesDecryptVector Cbc256 = makeSp80038aVector(
++        hex::crypt::AESMode::CBC,
++        hex::crypt::KeyLength::Key256Bits,
++        "603deb1015ca71be2b73aef0857d7781"
++        "1f352c073b6108d72d9810a30914dff4",
++        "f58c4c04d6e5f1ba779eabfb5f7bfbd6"
++        "9cfc4e967edb808d679f777bc6702c7d"
++        "39f23369a9d9bacfa530e26304231461"
++        "b2eb05e2c39be9fcda6c19078c6a9d1b");
++
++    const AesDecryptVector Cfb128192 = makeSp80038aVector(
++        hex::crypt::AESMode::CFB128,
++        hex::crypt::KeyLength::Key192Bits,
++        "8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b",
++        "cdc80d6fddf18cab34c25909c99a4174"
++        "67ce7f7f81173621961a2b70171d3d7a"
++        "2e1e8a1dd59b88b1c8e60fed1efac4c9"
++        "c05f9f9ca9834fa042ae8fba584b09ff");
++
++    const AesDecryptVector Cfb128256 = makeSp80038aVector(
++        hex::crypt::AESMode::CFB128,
++        hex::crypt::KeyLength::Key256Bits,
++        "603deb1015ca71be2b73aef0857d7781"
++        "1f352c073b6108d72d9810a30914dff4",
++        "dc7e84bfda79164b7ecd8486985d3860"
++        "39ffed143b28b1c832113c6331e5407b"
++        "df10132415e54b92a13ed0a8267ae2f9"
++        "75a385741ab9cef82031623d55b1e471");
++
++    const AesDecryptVector Ctr192 = makeSp80038aVector(
++        hex::crypt::AESMode::CTR,
++        hex::crypt::KeyLength::Key192Bits,
++        "8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b",
++        "1abc932417521ca24f2b0459fe7e6e0b"
++        "090339ec0aa6faefd5ccc2c6f4ce8e94"
++        "1e36b26bd1ebc670d1bd1d665620abf7"
++        "4f78a7f6d29809585a97daec58c6b050");
++
++    const AesDecryptVector Ctr256 = makeSp80038aVector(
++        hex::crypt::AESMode::CTR,
++        hex::crypt::KeyLength::Key256Bits,
++        "603deb1015ca71be2b73aef0857d7781"
++        "1f352c073b6108d72d9810a30914dff4",
++        "601ec313775789a5b7a7f504bbf3d228"
++        "f443e3ca4d62b59aca84e990cacaf5c5"
++        "2b0930daa23de94ce87017ba2d84988d"
++        "dfc9c58db67aada613c2dd08457941a6");
++
++    const AesDecryptVector Ofb192 = makeSp80038aVector(
++        hex::crypt::AESMode::OFB,
++        hex::crypt::KeyLength::Key192Bits,
++        "8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b",
++        "cdc80d6fddf18cab34c25909c99a4174"
++        "fcc28b8d4c63837c09e81700c1100401"
++        "8d9a9aeac0f6596f559c6d4daf59a5f2"
++        "6d9f200857ca6c3e9cac524bd9acc92a");
++
++    const AesDecryptVector Ofb256 = makeSp80038aVector(
++        hex::crypt::AESMode::OFB,
++        hex::crypt::KeyLength::Key256Bits,
++        "603deb1015ca71be2b73aef0857d7781"
++        "1f352c073b6108d72d9810a30914dff4",
++        "dc7e84bfda79164b7ecd8486985d3860"
++        "4febdc6740d20b3ac88f6ad82a4fb08d"
++        "71ab47a086e86eedf39d1c5bba97c408"
++        "0126141d67f37be8538f5a8be740e484");
++
++    const AesDecryptVector Gcm192 = {
++        .mode = hex::crypt::AESMode::GCM,
++        .keyLength = hex::crypt::KeyLength::Key192Bits,
++        .key = fromHex(
++            "feffe9928665731c6d6a8f9467308308"
++            "feffe9928665731c"),
++        .iv = fromHex("cafebabefacedbaddecaf888"),
++        .aad = fromHex(
++            "3ad77bb40d7a3660a89ecaf32466ef97"
++            "f5d3d58503b9699de785895a96fdbaaf"
++            "43b1cd7f598ece23881b00e3ed030688"
++            "7b0c785e27e8ad3f8223207104725dd4"),
++        .input = fromHex(
++            "3980ca0b3c00e841eb06fac4872a2757"
++            "859e1ceaa6efd984628593b40ca1e19c"
++            "7d773d00c144c525ac619d18c84a3f47"
++            "18e2448b2fe324d9ccda2710acade256"),
++        .tag = fromHex("3b9153b4e7318a5f3bbeac108f8a8edb"),
++        .expected = fromHex(
++            "d9313225f88406e5a55909c5aff5269a"
++            "86a7a9531534f7da2e4c303d8a318a72"
++            "1c3c0c95956809532fcf0e2449a6b525"
++            "b16aedf5aa0de657ba637b391aafd255")
++    };
++
++    const AesDecryptVector Gcm256 = {
++        .mode = hex::crypt::AESMode::GCM,
++        .keyLength = hex::crypt::KeyLength::Key256Bits,
++        .key = fromHex(
++            "feffe9928665731c6d6a8f9467308308"
++            "feffe9928665731c6d6a8f9467308308"),
++        .iv = fromHex("cafebabefacedbaddecaf888"),
++        .aad = fromHex(
++            "3ad77bb40d7a3660a89ecaf32466ef97"
++            "f5d3d58503b9699de785895a96fdbaaf"
++            "43b1cd7f598ece23881b00e3ed030688"
++            "7b0c785e27e8ad3f8223207104725dd4"),
++        .input = fromHex(
++            "522dc1f099567d07f47f37a32a84427d"
++            "643a8cdcbfe5c0c97598a2bd2555d1aa"
++            "8cb08e48590dbb3da7b08b1056828838"
++            "c5f61e6393ba7a0abcc9f662898015ad"),
++        .tag = fromHex("c06d76f31930fef37acae23ed465ae62"),
++        .expected = fromHex(
++            "d9313225f88406e5a55909c5aff5269a"
++            "86a7a9531534f7da2e4c303d8a318a72"
++            "1c3c0c95956809532fcf0e2449a6b525"
++            "b16aedf5aa0de657ba637b391aafd255")
++    };
++
++    const AesDecryptVector Ccm192 = {
++        .mode = hex::crypt::AESMode::CCM,
++        .keyLength = hex::crypt::KeyLength::Key192Bits,
++        .key = fromHex("19ebfde2d5468ba0a3031bde629b11fd4094afcb205393fa"),
++        .nonce = fromHex("5a8aa485c316e9"),
++        .input = fromHex("411986d04d6463100bff03f7d0bde7ea2c3488784378138c"),
++        .tag = fromHex("ddc93a54"),
++        .expected = fromHex("3796cf51b8726652a4204733b8fbb047cf00fb91a9837e22")
++    };
++
++    const AesDecryptVector Ccm256 = {
++        .mode = hex::crypt::AESMode::CCM,
++        .keyLength = hex::crypt::KeyLength::Key256Bits,
++        .key = fromHex("af063639e66c284083c5cf72b70d8bc277f5978e80d9322d99f2fdc718cda569"),
++        .nonce = fromHex("a544218dadd3c1"),
++        .input = fromHex("64a1341679972dc5869fcf69b19d5c5ea50aa0b5e985f5b7"),
++        .tag = fromHex("22aa8d59"),
++        .expected = fromHex("d3d5424e20fbec43ae495353ed830271515ab104f8860c98")
++    };
++
++}
++
++TEST_SEQUENCE("AESDecrypt") {
++    const std::array vectors = {
++        &Ecb, &Ecb192, &Ecb256,
++        &Cbc, &Cbc192, &Cbc256, &CbcPkcs7,
++        &Cfb128, &Cfb128192, &Cfb128256,
++        &Ctr, &Ctr192, &Ctr256,
++        &Gcm, &Gcm192, &Gcm256,
++        &Ccm, &Ccm192, &Ccm256,
++        &Ofb, &Ofb192, &Ofb256
++    };
++
++    for (const auto *vector : vectors) {
++        const auto actual = hex::crypt::aesDecrypt(
++            vector->mode,
++            vector->keyLength,
++            vector->key,
++            vector->nonce,
++            vector->iv,
++            vector->input,
++            vector->tag,
++            vector->aad);
++
++        TEST_ASSERT(actual.has_value());
++        TEST_ASSERT(actual.value() == vector->expected);
++
++        if (vector->mode == hex::crypt::AESMode::GCM || vector->mode == hex::crypt::AESMode::CCM) {
++            auto alteredTag = vector->tag;
++            alteredTag.front() ^= 0x01;
++            TEST_ASSERT(!hex::crypt::aesDecrypt(
++                vector->mode,
++                vector->keyLength,
++                vector->key,
++                vector->nonce,
++                vector->iv,
++                vector->input,
++                alteredTag,
++                vector->aad).has_value());
++
++            TEST_ASSERT(!hex::crypt::aesDecrypt(
++                vector->mode,
++                vector->keyLength,
++                vector->key,
++                vector->nonce,
++                vector->iv,
++                vector->input,
++                { },
++                vector->aad).has_value());
++
++            auto alteredAad = vector->aad;
++            if (alteredAad.empty())
++                alteredAad.push_back(0x00);
++            else
++                alteredAad.front() ^= 0x01;
++
++            TEST_ASSERT(!hex::crypt::aesDecrypt(
++                vector->mode,
++                vector->keyLength,
++                vector->key,
++                vector->nonce,
++                vector->iv,
++                vector->input,
++                vector->tag,
++                alteredAad).has_value());
++        }
++    }
++
++    TEST_SUCCESS();
++};
+-- 
+2.55.0
+

diff --git a/0002-feat-Add-Nettle-support-as-an-alternative-to-MbedTLS.patch b/0002-feat-Add-Nettle-support-as-an-alternative-to-MbedTLS.patch
new file mode 100644
index 0000000..53bafae
--- /dev/null
+++ b/0002-feat-Add-Nettle-support-as-an-alternative-to-MbedTLS.patch
@@ -0,0 +1,1786 @@
+From a7a09c2d536ae28946626e10528dbddbc3b2cd57 Mon Sep 17 00:00:00 2001
+From: Connor Cihula <connor.cihula@arm.com>
+Date: Tue, 11 Aug 2026 23:56:42 -0500
+Subject: [PATCH 2/2] feat: Add Nettle support as an alternative to MbedTLS
+
+---
+ .github/workflows/tests.yml                   |  15 +-
+ CMakeLists.txt                                |  15 +-
+ cmake/build_helpers.cmake                     |   6 +-
+ cmake/modules/FindNettle.cmake                |  39 ++
+ lib/libimhex/CMakeLists.txt                   |  19 +-
+ lib/libimhex/include/hex/helpers/crypto.hpp   |   4 +
+ lib/libimhex/source/helpers/crypto.cpp        | 415 +----------------
+ .../source/helpers/crypto_mbedtls.cpp         | 417 ++++++++++++++++++
+ lib/libimhex/source/helpers/crypto_nettle.cpp | 334 ++++++++++++++
+ lib/third_party/yara/CMakeLists.txt           |  24 +-
+ lib/third_party/yara/crypto.h                 |  33 ++
+ .../data_processor_nodes/decode_nodes.cpp     |  17 +-
+ .../source/content/views/view_about.cpp       |  49 +-
+ tests/algorithms/CMakeLists.txt               |   3 +
+ tests/algorithms/source/aes.cpp               |  87 +++-
+ tests/algorithms/source/crypto.cpp            |   8 +
+ 16 files changed, 1025 insertions(+), 460 deletions(-)
+ create mode 100644 cmake/modules/FindNettle.cmake
+ create mode 100644 lib/libimhex/source/helpers/crypto_mbedtls.cpp
+ create mode 100644 lib/libimhex/source/helpers/crypto_nettle.cpp
+
+diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
+index 5a3a45a08..486377e41 100644
+--- a/.github/workflows/tests.yml
++++ b/.github/workflows/tests.yml
+@@ -15,8 +15,13 @@ on:
+ 
+ jobs:
+   tests:
+-    name: 🧪 Unit Tests
++    needs: ci-gate
++    name: 🧪 Unit Tests (${{ matrix.crypto_backend }})
+     runs-on: ubuntu-24.04
++    strategy:
++      fail-fast: false
++      matrix:
++        crypto_backend: [mbedtls, nettle]
+     permissions:
+       actions: read
+       contents: read
+@@ -31,14 +36,17 @@ jobs:
+     - name: 📜 Setup ccache
+       uses: hendrikmuhs/ccache-action@v1
+       with:
+-        key: ${{ runner.os }}-tests-build-${{ github.run_id }}
+-        restore-keys: ${{ runner.os }}-tests-build
++        key: ${{ runner.os }}-tests-${{ matrix.crypto_backend }}-build-${{ github.run_id }}
++        restore-keys: ${{ runner.os }}-tests-${{ matrix.crypto_backend }}-build
+         max-size: 50M
+ 
+     - name: ⬇️ Install dependencies
+       run: |
+         sudo apt update
+         sudo bash dist/get_deps_debian.sh
++        if [ "${{ matrix.crypto_backend }}" = "nettle" ]; then
++          sudo apt install -y nettle-dev
++        fi
+ 
+     - name: 🛠️ Build
+       run: |
+@@ -49,6 +57,7 @@ jobs:
+           -DCMAKE_BUILD_TYPE=Debug                                                                                 \
+           -DIMHEX_ENABLE_UNIT_TESTS=ON                                                                             \
+           -DIMHEX_ENABLE_PLUGIN_TESTS=ON                                                                           \
++          -DCRYPTO_BACKEND=${{ matrix.crypto_backend }}                                                            \
+           -DCMAKE_C_COMPILER_LAUNCHER=ccache                                                                       \
+           -DCMAKE_CXX_COMPILER_LAUNCHER=ccache                                                                     \
+           -DCMAKE_C_FLAGS="-fuse-ld=lld -fsanitize=address,leak,undefined -fno-sanitize-recover=all --coverage"    \
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 02b03fa35..6bc6a68ad 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -23,11 +23,16 @@ option(IMHEX_ENABLE_UNIT_TESTS          "Enable building unit tests"
+ option(IMHEX_ENABLE_IMGUI_TEST_ENGINE   "Enable the ImGui Test Engine"                                                          OFF)
+ option(IMHEX_ENABLE_STD_ASSERTS         "Enable debug asserts in the C++ std library. (Breaks Plugin ABI!)"                     OFF)
+ ## Debug info
+-option(IMHEX_COMPRESS_DEBUG_INFO        "Compress debug information"                                                            ON )
+-option(IMHEX_GENERATE_PDBS              "Enable generating PDB files in non-debug builds (Windows only)"                        OFF)
+-option(IMHEX_REPLACE_DWARF_WITH_PDB     "Remove DWARF information from binaries when generating PDBS (Windows only)"            OFF)
+-option(IMHEX_STRICT_WARNINGS            "Enable most available warnings and treat them as errors"                               ON )
+-option(IMHEX_DISABLE_STACKTRACE         "Disables support for printing stack traces"                                            OFF)
++option(IMHEX_COMPRESS_DEBUG_INFO        "Compress debug information"                                                                    ON )
++option(IMHEX_GENERATE_PDBS              "Enable generating PDB files in non-debug builds (Windows only)"                                OFF)
++option(IMHEX_REPLACE_DWARF_WITH_PDB     "Remove DWARF information from binaries when generating PDBS (Windows only)"                    OFF)
++option(IMHEX_STRICT_WARNINGS            "Enable most available warnings and treat them as errors"                                       ON )
++option(IMHEX_DISABLE_STACKTRACE         "Disables support for printing stack traces"                                                    OFF)
++set   (CRYPTO_BACKEND                   "mbedtls" CACHE STRING "Crypto backend to use (mbedtls or nettle)"                                 )
++set_property(CACHE CRYPTO_BACKEND PROPERTY STRINGS mbedtls nettle)
++if (NOT CRYPTO_BACKEND STREQUAL "mbedtls" AND NOT CRYPTO_BACKEND STREQUAL "nettle")
++    message(FATAL_ERROR "Invalid CRYPTO_BACKEND '${CRYPTO_BACKEND}': expected 'mbedtls' or 'nettle'")
++endif ()
+ ## Plugins
+ option(IMHEX_STATIC_LINK_PLUGINS        "Statically link all plugins into the main executable"                                  OFF)
+ option(IMHEX_ENABLE_PLUGIN_TESTS        "Enable building plugin tests"                                                          ON )
+diff --git a/cmake/build_helpers.cmake b/cmake/build_helpers.cmake
+index bebb74593..b4892bae1 100644
+--- a/cmake/build_helpers.cmake
++++ b/cmake/build_helpers.cmake
+@@ -968,7 +968,11 @@ macro(addBundledLibraries)
+     endif()
+     enableUnityBuild(libpl)
+ 
+-    find_package(mbedTLS 3.4.0 REQUIRED)
++    if (CRYPTO_BACKEND STREQUAL "mbedtls")
++        find_package(mbedTLS 3.4.0 REQUIRED)
++    else ()
++        find_package(Nettle 3.4 REQUIRED)
++    endif ()
+     find_package(Magic 5.39 REQUIRED)
+ endmacro()
+ 
+diff --git a/cmake/modules/FindNettle.cmake b/cmake/modules/FindNettle.cmake
+new file mode 100644
+index 000000000..b70d52614
+--- /dev/null
++++ b/cmake/modules/FindNettle.cmake
+@@ -0,0 +1,39 @@
++# Find Nettle
++#
++# This module defines:
++#  Nettle_FOUND
++#  Nettle_VERSION
++#  Nettle_INCLUDE_DIR
++#  Nettle_LIBRARY
++#  Nettle::Nettle
++
++find_path(Nettle_INCLUDE_DIR NAMES nettle/version.h)
++find_library(Nettle_LIBRARY NAMES nettle libnettle)
++
++if (Nettle_INCLUDE_DIR)
++    file(STRINGS "${Nettle_INCLUDE_DIR}/nettle/version.h" Nettle_VERSION_MAJOR_LINE
++        REGEX "^#define[ \t]+NETTLE_VERSION_MAJOR[ \t]+[0-9]+")
++    file(STRINGS "${Nettle_INCLUDE_DIR}/nettle/version.h" Nettle_VERSION_MINOR_LINE
++        REGEX "^#define[ \t]+NETTLE_VERSION_MINOR[ \t]+[0-9]+")
++    string(REGEX REPLACE ".*NETTLE_VERSION_MAJOR[ \t]+([0-9]+).*" "\\1" Nettle_VERSION_MAJOR "${Nettle_VERSION_MAJOR_LINE}")
++    string(REGEX REPLACE ".*NETTLE_VERSION_MINOR[ \t]+([0-9]+).*" "\\1" Nettle_VERSION_MINOR "${Nettle_VERSION_MINOR_LINE}")
++    if (Nettle_VERSION_MAJOR MATCHES "^[0-9]+$" AND Nettle_VERSION_MINOR MATCHES "^[0-9]+$")
++        set(Nettle_VERSION "${Nettle_VERSION_MAJOR}.${Nettle_VERSION_MINOR}")
++    endif ()
++endif ()
++
++include(FindPackageHandleStandardArgs)
++find_package_handle_standard_args(Nettle
++    REQUIRED_VARS Nettle_LIBRARY Nettle_INCLUDE_DIR
++    VERSION_VAR Nettle_VERSION
++)
++
++if (Nettle_FOUND AND NOT TARGET Nettle::Nettle)
++    add_library(Nettle::Nettle UNKNOWN IMPORTED)
++    set_target_properties(Nettle::Nettle PROPERTIES
++        IMPORTED_LOCATION "${Nettle_LIBRARY}"
++        INTERFACE_INCLUDE_DIRECTORIES "${Nettle_INCLUDE_DIR}"
++    )
++endif ()
++
++mark_as_advanced(Nettle_INCLUDE_DIR Nettle_LIBRARY)
+diff --git a/lib/libimhex/CMakeLists.txt b/lib/libimhex/CMakeLists.txt
+index 1977cf830..41b215b5e 100644
+--- a/lib/libimhex/CMakeLists.txt
++++ b/lib/libimhex/CMakeLists.txt
+@@ -60,6 +60,12 @@ set(LIBIMHEX_SOURCES
+         source/subcommands/subcommands.cpp
+ )
+ 
++if (CRYPTO_BACKEND STREQUAL "mbedtls")
++    list(APPEND LIBIMHEX_SOURCES source/helpers/crypto_mbedtls.cpp)
++else ()
++    list(APPEND LIBIMHEX_SOURCES source/helpers/crypto_nettle.cpp)
++endif ()
++
+ if (APPLE)
+     set(LIBIMHEX_SOURCES ${LIBIMHEX_SOURCES}
+             source/helpers/utils_macos.m
+@@ -167,9 +173,16 @@ if (NOT IMHEX_EXTERNAL_PLUGIN_BUILD)
+         target_link_libraries(libimhex ${LIBIMHEX_LIBRARY_TYPE} CURL::libcurl)
+     endif()
+ 
+-    target_include_directories(libimhex ${LIBIMHEX_LIBRARY_TYPE} ${MBEDTLS_INCLUDE_DIR} ${LIBBACKTRACE_INCLUDE_DIRS} ${MAGIC_INCLUDE_DIRS})
+-    target_link_libraries(libimhex ${LIBIMHEX_LIBRARY_TYPE} ${MBEDTLS_LIBRARIES})
+-    target_link_directories(libimhex ${LIBIMHEX_LIBRARY_TYPE} ${MBEDTLS_LIBRARY_DIR} ${MAGIC_LIBRARY_DIRS})
++    target_include_directories(libimhex ${LIBIMHEX_LIBRARY_TYPE} ${LIBBACKTRACE_INCLUDE_DIRS} ${MAGIC_INCLUDE_DIRS})
++    target_link_directories(libimhex ${LIBIMHEX_LIBRARY_TYPE} ${MAGIC_LIBRARY_DIRS})
++
++    if (CRYPTO_BACKEND STREQUAL "mbedtls")
++        target_include_directories(libimhex ${LIBIMHEX_LIBRARY_TYPE} ${MBEDTLS_INCLUDE_DIR})
++        target_link_libraries(libimhex ${LIBIMHEX_LIBRARY_TYPE} ${MBEDTLS_LIBRARIES})
++        target_link_directories(libimhex ${LIBIMHEX_LIBRARY_TYPE} ${MBEDTLS_LIBRARY_DIR})
++    else ()
++        target_link_libraries(libimhex ${LIBIMHEX_LIBRARY_TYPE} Nettle::Nettle)
++    endif ()
+ 
+     precompileHeaders(libimhex "${CMAKE_CURRENT_SOURCE_DIR}/include")
+ endif()
+diff --git a/lib/libimhex/include/hex/helpers/crypto.hpp b/lib/libimhex/include/hex/helpers/crypto.hpp
+index d98744f8c..71ea161e8 100644
+--- a/lib/libimhex/include/hex/helpers/crypto.hpp
++++ b/lib/libimhex/include/hex/helpers/crypto.hpp
+@@ -10,6 +10,9 @@
+ 
+ #define CRYPTO_ERROR_INVALID_KEY_LENGTH (-1)
+ #define CRYPTO_ERROR_INVALID_MODE (-2)
++#define CRYPTO_ERROR_INVALID_INPUT (-3)
++#define CRYPTO_ERROR_UNSUPPORTED_MODE (-4)
++#define CRYPTO_ERROR_AUTHENTICATION_FAILED (-5)
+ 
+ namespace hex::prv {
+     class Provider;
+@@ -42,6 +45,7 @@ namespace hex::crypt {
+     std::vector<u8> encode64(const std::vector<u8> &input);
+     std::vector<u8> decode16(const std::string &input);
+     std::string encode16(const std::vector<u8> &input);
++    std::string getErrorString(int error);
+ 
+     i128 decodeSleb128(const std::vector<u8> &bytes);
+     u128 decodeUleb128(const std::vector<u8> &bytes);
+diff --git a/lib/libimhex/source/helpers/crypto.cpp b/lib/libimhex/source/helpers/crypto.cpp
+index 908988219..0556c6778 100644
+--- a/lib/libimhex/source/helpers/crypto.cpp
++++ b/lib/libimhex/source/helpers/crypto.cpp
+@@ -3,30 +3,6 @@
+ 
+ #include <hex/providers/provider.hpp>
+ 
+-#include <wolv/utils/guards.hpp>
+-#include <wolv/utils/expected.hpp>
+-
+-#include <mbedtls/version.h>
+-#include <mbedtls/base64.h>
+-
+-#if MBEDTLS_VERSION_MAJOR >= 4
+-    // TODO: We'll need to migrate to the new <psa/crypto.h> eventually. For now, just include the old stuff again
+-    #define MBEDTLS_DECLARE_PRIVATE_IDENTIFIERS
+-    #include <mbedtls/private/bignum.h>
+-    #include <mbedtls/private/md5.h>
+-    #include <mbedtls/private/sha1.h>
+-    #include <mbedtls/private/sha256.h>
+-    #include <mbedtls/private/sha512.h>
+-    #include <mbedtls/private/cipher.h>
+-#else
+-    #include <mbedtls/bignum.h>
+-    #include <mbedtls/md5.h>
+-    #include <mbedtls/sha1.h>
+-    #include <mbedtls/sha256.h>
+-    #include <mbedtls/sha512.h>
+-    #include <mbedtls/cipher.h>
+-#endif
+-
+ #include <array>
+ #include <functional>
+ #include <cstddef>
+@@ -162,244 +138,28 @@ namespace hex::crypt {
+     }
+ 
+ 
+-    std::array<u8, 16> md5(prv::Provider *&data, u64 offset, size_t size) {
+-        std::array<u8, 16> result = { 0 };
+-
+-        mbedtls_md5_context ctx;
+-        mbedtls_md5_init(&ctx);
+-
+-        mbedtls_md5_starts(&ctx);
+-
+-        processDataByChunks(data, offset, size, std::bind(mbedtls_md5_update, &ctx, _1, _2));
+-
+-        mbedtls_md5_finish(&ctx, result.data());
+-
+-        mbedtls_md5_free(&ctx);
+-
+-        return result;
+-    }
+-
+-    std::array<u8, 16> md5(const std::vector<u8> &data) {
+-        std::array<u8, 16> result = { 0 };
+-
+-        mbedtls_md5_context ctx;
+-        mbedtls_md5_init(&ctx);
+-
+-        mbedtls_md5_starts(&ctx);
+-        mbedtls_md5_update(&ctx, data.data(), data.size());
+-        mbedtls_md5_finish(&ctx, result.data());
+-
+-        mbedtls_md5_free(&ctx);
+-
+-        return result;
+-    }
+-
+-    std::array<u8, 20> sha1(prv::Provider *&data, u64 offset, size_t size) {
+-        std::array<u8, 20> result = { 0 };
+-
+-        mbedtls_sha1_context ctx;
+-        mbedtls_sha1_init(&ctx);
+-
+-        mbedtls_sha1_starts(&ctx);
+-
+-        processDataByChunks(data, offset, size, std::bind(mbedtls_sha1_update, &ctx, _1, _2));
+-
+-        mbedtls_sha1_finish(&ctx, result.data());
+-
+-        mbedtls_sha1_free(&ctx);
+-
+-        return result;
+-    }
+-
+-    std::array<u8, 20> sha1(const std::vector<u8> &data) {
+-        std::array<u8, 20> result = { 0 };
+-
+-        mbedtls_sha1_context ctx;
+-        mbedtls_sha1_init(&ctx);
+-
+-        mbedtls_sha1_starts(&ctx);
+-        mbedtls_sha1_update(&ctx, data.data(), data.size());
+-        mbedtls_sha1_finish(&ctx, result.data());
+-
+-        mbedtls_sha1_free(&ctx);
+-
+-        return result;
+-    }
+-
+-    std::array<u8, 28> sha224(prv::Provider *&data, u64 offset, size_t size) {
+-        std::array<u8, 28> result = { 0 };
+-
+-        mbedtls_sha256_context ctx;
+-        mbedtls_sha256_init(&ctx);
+-
+-        mbedtls_sha256_starts(&ctx, true);
+-
+-        processDataByChunks(data, offset, size, std::bind(mbedtls_sha256_update, &ctx, _1, _2));
+-
+-        mbedtls_sha256_finish(&ctx, result.data());
+-
+-        mbedtls_sha256_free(&ctx);
+-
+-        return result;
+-    }
+-
+-    std::array<u8, 28> sha224(const std::vector<u8> &data) {
+-        std::array<u8, 28> result = { 0 };
+-
+-        mbedtls_sha256_context ctx;
+-        mbedtls_sha256_init(&ctx);
+-
+-        mbedtls_sha256_starts(&ctx, true);
+-        mbedtls_sha256_update(&ctx, data.data(), data.size());
+-        mbedtls_sha256_finish(&ctx, result.data());
+-
+-        mbedtls_sha256_free(&ctx);
+-
+-        return result;
+-    }
+-
+-    std::array<u8, 32> sha256(prv::Provider *&data, u64 offset, size_t size) {
+-        std::array<u8, 32> result = { 0 };
+-
+-        mbedtls_sha256_context ctx;
+-        mbedtls_sha256_init(&ctx);
+-
+-        mbedtls_sha256_starts(&ctx, false);
+-
+-        processDataByChunks(data, offset, size, std::bind(mbedtls_sha256_update, &ctx, _1, _2));
+-
+-        mbedtls_sha256_finish(&ctx, result.data());
+-
+-        mbedtls_sha256_free(&ctx);
+-
+-        return result;
+-    }
+-
+-    std::array<u8, 32> sha256(const std::vector<u8> &data) {
+-        std::array<u8, 32> result = { 0 };
+-
+-        mbedtls_sha256_context ctx;
+-        mbedtls_sha256_init(&ctx);
+-
+-        mbedtls_sha256_starts(&ctx, false);
+-        mbedtls_sha256_update(&ctx, data.data(), data.size());
+-        mbedtls_sha256_finish(&ctx, result.data());
+-
+-        mbedtls_sha256_free(&ctx);
+-
+-        return result;
+-    }
+-
+-    std::array<u8, 48> sha384(prv::Provider *&data, u64 offset, size_t size) {
+-        std::array<u8, 48> result = { 0 };
+-
+-        mbedtls_sha512_context ctx;
+-        mbedtls_sha512_init(&ctx);
+-
+-        mbedtls_sha512_starts(&ctx, true);
+-
+-        processDataByChunks(data, offset, size, std::bind(mbedtls_sha512_update, &ctx, _1, _2));
+-
+-        mbedtls_sha512_finish(&ctx, result.data());
+-
+-        mbedtls_sha512_free(&ctx);
+-
+-        return result;
+-    }
+-
+-    std::array<u8, 48> sha384(const std::vector<u8> &data) {
+-        std::array<u8, 48> result = { 0 };
+-
+-        mbedtls_sha512_context ctx;
+-        mbedtls_sha512_init(&ctx);
+-
+-        mbedtls_sha512_starts(&ctx, true);
+-        mbedtls_sha512_update(&ctx, data.data(), data.size());
+-        mbedtls_sha512_finish(&ctx, result.data());
+-
+-        mbedtls_sha512_free(&ctx);
+-
+-        return result;
+-    }
+-
+-    std::array<u8, 64> sha512(prv::Provider *&data, u64 offset, size_t size) {
+-        std::array<u8, 64> result = { 0 };
+-
+-        mbedtls_sha512_context ctx;
+-        mbedtls_sha512_init(&ctx);
+-
+-        mbedtls_sha512_starts(&ctx, false);
+-
+-        processDataByChunks(data, offset, size, std::bind(mbedtls_sha512_update, &ctx, _1, _2));
+-
+-        mbedtls_sha512_finish(&ctx, result.data());
+-
+-        mbedtls_sha512_free(&ctx);
+-
+-        return result;
+-    }
+-
+-    std::array<u8, 64> sha512(const std::vector<u8> &data) {
+-        std::array<u8, 64> result = { 0 };
+-
+-        mbedtls_sha512_context ctx;
+-        mbedtls_sha512_init(&ctx);
+-
+-        mbedtls_sha512_starts(&ctx, false);
+-        mbedtls_sha512_update(&ctx, data.data(), data.size());
+-        mbedtls_sha512_finish(&ctx, result.data());
+-
+-        mbedtls_sha512_free(&ctx);
+-
+-        return result;
+-    }
+-
+-
+-    std::vector<u8> decode64(const std::vector<u8> &input) {
+-
+-        size_t written = 0;
+-        mbedtls_base64_decode(nullptr, 0, &written, input.data(), input.size());
+-        std::vector<u8> output(written, 0x00);
+-        if (mbedtls_base64_decode(output.data(), output.size(), &written, input.data(), input.size()))
+-            return {};
+-
+-        output.resize(written);
+-
+-        return output;
+-    }
+-
+-    std::vector<u8> encode64(const std::vector<u8> &input) {
+-
+-        size_t written = 0;
+-        mbedtls_base64_encode(nullptr, 0, &written, input.data(), input.size());
+-
+-        std::vector<u8> output(written, 0x00);
+-        if (mbedtls_base64_encode(output.data(), output.size(), &written, input.data(), input.size()))
+-            return {};
+-
+-        output.resize(written);
+-
+-        return output;
+-    }
+-
+     std::vector<u8> decode16(const std::string &input) {
+-        std::vector<u8> output(input.length() / 2, 0x00);
+-
+-
+-        mbedtls_mpi ctx;
+-        mbedtls_mpi_init(&ctx);
+-
+-        ON_SCOPE_EXIT { mbedtls_mpi_free(&ctx); };
++        if ((input.size() % 2) != 0)
++            return {};
+ 
+-        // Read buffered
+-        constexpr static auto BufferSize = 0x100;
+-        for (size_t offset = 0; offset < input.size(); offset += BufferSize) {
+-            std::string inputPart = input.substr(offset, std::min<size_t>(BufferSize, input.size() - offset));
+-            if (mbedtls_mpi_read_string(&ctx, 16, inputPart.c_str()))
++        const auto decodeNibble = [](char value) -> int {
++            if (value >= '0' && value <= '9')
++                return value - '0';
++            if (value >= 'a' && value <= 'f')
++                return value - 'a' + 10;
++            if (value >= 'A' && value <= 'F')
++                return value - 'A' + 10;
++            return -1;
++        };
++
++        std::vector<u8> output(input.size() / 2);
++        for (size_t index = 0; index < output.size(); ++index) {
++            const auto high = decodeNibble(input[index * 2]);
++            const auto low = decodeNibble(input[index * 2 + 1]);
++            if (high < 0 || low < 0)
+                 return {};
+ 
+-            if (mbedtls_mpi_write_binary(&ctx, output.data() + offset / 2, inputPart.size() / 2))
+-                return {};
++            output[index] = static_cast<u8>((high << 4) | low);
+         }
+ 
+         return output;
+@@ -491,143 +251,4 @@ namespace hex::crypt {
+         return encodeLeb128<i128>(value);
+     }
+ 
+-    static wolv::util::Expected<std::vector<u8>, int> aes(mbedtls_cipher_type_t type, mbedtls_operation_t operation, const std::vector<u8> &key,
+-                   const std::vector<u8> &nonce, const std::vector<u8> &iv, const std::vector<u8> &input, const std::vector<u8> &tag, const std::vector<u8> &aad) {
+-        mbedtls_cipher_context_t ctx;
+-        mbedtls_cipher_init(&ctx);
+-        ON_SCOPE_EXIT { mbedtls_cipher_free(&ctx); };
+-
+-        auto cipherInfo = mbedtls_cipher_info_from_type(type);
+-
+-        if (cipherInfo == nullptr)
+-            return wolv::util::Unexpected(MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE);
+-
+-        int setupResult = mbedtls_cipher_setup(&ctx, cipherInfo);
+-        if (setupResult != 0)
+-            return wolv::util::Unexpected(setupResult);
+-
+-        int setKeyResult = mbedtls_cipher_setkey(&ctx, key.data(), key.size() * 8, operation);
+-        if (setKeyResult != 0)
+-            return wolv::util::Unexpected(setKeyResult);
+-
+-        auto mode = mbedtls_cipher_get_cipher_mode(&ctx);
+-
+-        if (mode == MBEDTLS_MODE_CBC) {
+-            int paddingResult = mbedtls_cipher_set_padding_mode(&ctx, MBEDTLS_PADDING_NONE);
+-            if (paddingResult != 0) {
+-                return wolv::util::Unexpected(paddingResult);
+-            }
+-        }
+-
+-        if (mode == MBEDTLS_MODE_GCM || mode == MBEDTLS_MODE_CCM) {
+-            const auto &aeadIv = mode == MBEDTLS_MODE_GCM ? iv : nonce;
+-            std::vector<u8> authenticatedInput;
+-            authenticatedInput.reserve(input.size() + tag.size());
+-            authenticatedInput.insert(authenticatedInput.end(), input.begin(), input.end());
+-            authenticatedInput.insert(authenticatedInput.end(), tag.begin(), tag.end());
+-
+-            size_t outputSize = input.size();
+-            std::vector<u8> output(outputSize, 0x00);
+-            const auto cryptResult = mbedtls_cipher_auth_decrypt_ext(
+-                &ctx,
+-                aeadIv.data(), aeadIv.size(),
+-                aad.data(), aad.size(),
+-                authenticatedInput.data(), authenticatedInput.size(),
+-                output.data(), output.size(),
+-                &outputSize, tag.size());
+-
+-            if (cryptResult != 0)
+-                return wolv::util::Unexpected(cryptResult);
+-
+-            output.resize(outputSize);
+-            return output;
+-        }
+-
+-        if (input.empty())
+-            return {};
+-
+-        size_t outputSize = input.size() + mbedtls_cipher_get_block_size(&ctx);
+-        std::vector<u8> output(outputSize, 0x00);
+-
+-        int cryptResult = 0;
+-        if (mode == MBEDTLS_MODE_ECB) {
+-            const auto blockSize = static_cast<size_t>(mbedtls_cipher_get_block_size(&ctx));
+-            outputSize = 0;
+-
+-            for (size_t inputOffset = 0; inputOffset < input.size(); inputOffset += blockSize) {
+-                const auto inputSize = std::min(blockSize, input.size() - inputOffset);
+-                size_t blockOutputSize = 0;
+-
+-                cryptResult = mbedtls_cipher_crypt(&ctx, nullptr, 0, input.data() + inputOffset, inputSize, output.data() + outputSize, &blockOutputSize);
+-                if (cryptResult != 0)
+-                    break;
+-
+-                outputSize += blockOutputSize;
+-            }
+-        } else {
+-            cryptResult = mbedtls_cipher_crypt(&ctx, iv.data(), iv.size(), input.data(), input.size(), output.data(), &outputSize);
+-        }
+-
+-        if (cryptResult != 0) {
+-            return wolv::util::Unexpected(cryptResult);
+-        }
+-
+-        output.resize(outputSize);
+-
+-        return output;
+-    }
+-
+-    wolv::util::Expected<std::vector<u8>, int> aesDecrypt(AESMode mode, KeyLength keyLength, const std::vector<u8> &key, const std::vector<u8> &nonce, const std::vector<u8> &iv, const std::vector<u8> &input, const std::vector<u8> &tag, const std::vector<u8> &aad) {
+-        switch (keyLength) {
+-            case KeyLength::Key128Bits:
+-                if (key.size() != 128 / 8)
+-                    return wolv::util::Unexpected(CRYPTO_ERROR_INVALID_KEY_LENGTH);
+-                break;
+-            case KeyLength::Key192Bits:
+-                if (key.size() != 192 / 8)
+-                    return wolv::util::Unexpected(CRYPTO_ERROR_INVALID_KEY_LENGTH);
+-                break;
+-            case KeyLength::Key256Bits:
+-                if (key.size() != 256 / 8)
+-                    return wolv::util::Unexpected(CRYPTO_ERROR_INVALID_KEY_LENGTH);
+-                break;
+-            default:
+-                return wolv::util::Unexpected(CRYPTO_ERROR_INVALID_KEY_LENGTH);
+-        }
+-
+-        mbedtls_cipher_type_t type;
+-        switch (mode) {
+-            case AESMode::ECB:
+-                type = MBEDTLS_CIPHER_AES_128_ECB;
+-                break;
+-            case AESMode::CBC:
+-                type = MBEDTLS_CIPHER_AES_128_CBC;
+-                break;
+-            case AESMode::CFB128:
+-                type = MBEDTLS_CIPHER_AES_128_CFB128;
+-                break;
+-            case AESMode::CTR:
+-                type = MBEDTLS_CIPHER_AES_128_CTR;
+-                break;
+-            case AESMode::GCM:
+-                type = MBEDTLS_CIPHER_AES_128_GCM;
+-                break;
+-            case AESMode::CCM:
+-                type = MBEDTLS_CIPHER_AES_128_CCM;
+-                break;
+-            case AESMode::OFB:
+-                type = MBEDTLS_CIPHER_AES_128_OFB;
+-                break;
+-            case AESMode::XTS:
+-                type = MBEDTLS_CIPHER_AES_128_XTS;
+-                break;
+-            default:
+-                return wolv::util::Unexpected(CRYPTO_ERROR_INVALID_MODE);
+-        }
+-
+-        type = mbedtls_cipher_type_t(type + u8(keyLength));
+-
+-        return aes(type, MBEDTLS_DECRYPT, key, nonce, iv, input, tag, aad);
+-    }
+-
+ }
+diff --git a/lib/libimhex/source/helpers/crypto_mbedtls.cpp b/lib/libimhex/source/helpers/crypto_mbedtls.cpp
+new file mode 100644
+index 000000000..f27498e76
+--- /dev/null
++++ b/lib/libimhex/source/helpers/crypto_mbedtls.cpp
+@@ -0,0 +1,417 @@
++#include <algorithm>
++#include <hex/helpers/crypto.hpp>
++
++#include <hex/providers/provider.hpp>
++
++#include <wolv/utils/guards.hpp>
++#include <wolv/utils/expected.hpp>
++
++#include <mbedtls/version.h>
++#include <mbedtls/base64.h>
++#include <mbedtls/error.h>
++
++#if MBEDTLS_VERSION_MAJOR >= 4
++    // TODO: We'll need to migrate to the new <psa/crypto.h> eventually. For now, just include the old stuff again
++    #define MBEDTLS_DECLARE_PRIVATE_IDENTIFIERS
++    #include <mbedtls/private/md5.h>
++    #include <mbedtls/private/sha1.h>
++    #include <mbedtls/private/sha256.h>
++    #include <mbedtls/private/sha512.h>
++    #include <mbedtls/private/cipher.h>
++#else
++    #include <mbedtls/md5.h>
++    #include <mbedtls/sha1.h>
++    #include <mbedtls/sha256.h>
++    #include <mbedtls/sha512.h>
++    #include <mbedtls/cipher.h>
++#endif
++
++#include <array>
++#include <cstddef>
++
++namespace hex::crypt {
++
++    template<std::invocable<unsigned char *, size_t> Func>
++    void processDataByChunks(prv::Provider *data, u64 offset, size_t size, Func func) {
++        std::array<u8, 512> buffer = { 0 };
++        for (size_t bufferOffset = 0; bufferOffset < size; bufferOffset += buffer.size()) {
++            const auto readSize = std::min(buffer.size(), size - bufferOffset);
++            data->read(offset + bufferOffset, buffer.data(), readSize);
++            func(buffer.data(), readSize);
++        }
++    }
++
++    std::array<u8, 16> md5(prv::Provider *&data, u64 offset, size_t size) {
++        std::array<u8, 16> result = { 0 };
++
++        mbedtls_md5_context ctx;
++        mbedtls_md5_init(&ctx);
++
++        mbedtls_md5_starts(&ctx);
++
++        processDataByChunks(data, offset, size, [&ctx](auto && data, auto && size) { return mbedtls_md5_update(&ctx, data, size); });
++
++        mbedtls_md5_finish(&ctx, result.data());
++
++        mbedtls_md5_free(&ctx);
++
++        return result;
++    }
++
++    std::array<u8, 16> md5(const std::vector<u8> &data) {
++        std::array<u8, 16> result = { 0 };
++
++        mbedtls_md5_context ctx;
++        mbedtls_md5_init(&ctx);
++
++        mbedtls_md5_starts(&ctx);
++        mbedtls_md5_update(&ctx, data.data(), data.size());
++        mbedtls_md5_finish(&ctx, result.data());
++
++        mbedtls_md5_free(&ctx);
++
++        return result;
++    }
++
++    std::array<u8, 20> sha1(prv::Provider *&data, u64 offset, size_t size) {
++        std::array<u8, 20> result = { 0 };
++
++        mbedtls_sha1_context ctx;
++        mbedtls_sha1_init(&ctx);
++
++        mbedtls_sha1_starts(&ctx);
++
++        processDataByChunks(data, offset, size, [&ctx](auto && data, auto && size) { return mbedtls_sha1_update(&ctx, data, size); });
++
++        mbedtls_sha1_finish(&ctx, result.data());
++
++        mbedtls_sha1_free(&ctx);
++
++        return result;
++    }
++
++    std::array<u8, 20> sha1(const std::vector<u8> &data) {
++        std::array<u8, 20> result = { 0 };
++
++        mbedtls_sha1_context ctx;
++        mbedtls_sha1_init(&ctx);
++
++        mbedtls_sha1_starts(&ctx);
++        mbedtls_sha1_update(&ctx, data.data(), data.size());
++        mbedtls_sha1_finish(&ctx, result.data());
++
++        mbedtls_sha1_free(&ctx);
++
++        return result;
++    }
++
++    std::array<u8, 28> sha224(prv::Provider *&data, u64 offset, size_t size) {
++        std::array<u8, 28> result = { 0 };
++
++        mbedtls_sha256_context ctx;
++        mbedtls_sha256_init(&ctx);
++
++        mbedtls_sha256_starts(&ctx, true);
++
++        processDataByChunks(data, offset, size, [&ctx](auto && data, auto && size) { return mbedtls_sha256_update(&ctx, data, size); });
++
++        mbedtls_sha256_finish(&ctx, result.data());
++
++        mbedtls_sha256_free(&ctx);
++
++        return result;
++    }
++
++    std::array<u8, 28> sha224(const std::vector<u8> &data) {
++        std::array<u8, 28> result = { 0 };
++
++        mbedtls_sha256_context ctx;
++        mbedtls_sha256_init(&ctx);
++
++        mbedtls_sha256_starts(&ctx, true);
++        mbedtls_sha256_update(&ctx, data.data(), data.size());
++        mbedtls_sha256_finish(&ctx, result.data());
++
++        mbedtls_sha256_free(&ctx);
++
++        return result;
++    }
++
++    std::array<u8, 32> sha256(prv::Provider *&data, u64 offset, size_t size) {
++        std::array<u8, 32> result = { 0 };
++
++        mbedtls_sha256_context ctx;
++        mbedtls_sha256_init(&ctx);
++
++        mbedtls_sha256_starts(&ctx, false);
++
++        processDataByChunks(data, offset, size, [&ctx](auto && data, auto && size) { return mbedtls_sha256_update(&ctx, data, size); });
++
++        mbedtls_sha256_finish(&ctx, result.data());
++
++        mbedtls_sha256_free(&ctx);
++
++        return result;
++    }
++
++    std::array<u8, 32> sha256(const std::vector<u8> &data) {
++        std::array<u8, 32> result = { 0 };
++
++        mbedtls_sha256_context ctx;
++        mbedtls_sha256_init(&ctx);
++
++        mbedtls_sha256_starts(&ctx, false);
++        mbedtls_sha256_update(&ctx, data.data(), data.size());
++        mbedtls_sha256_finish(&ctx, result.data());
++
++        mbedtls_sha256_free(&ctx);
++
++        return result;
++    }
++
++    std::array<u8, 48> sha384(prv::Provider *&data, u64 offset, size_t size) {
++        std::array<u8, 48> result = { 0 };
++
++        mbedtls_sha512_context ctx;
++        mbedtls_sha512_init(&ctx);
++
++        mbedtls_sha512_starts(&ctx, true);
++
++        processDataByChunks(data, offset, size, [&ctx](auto && data, auto && size) { return mbedtls_sha512_update(&ctx, data, size); });
++
++        mbedtls_sha512_finish(&ctx, result.data());
++
++        mbedtls_sha512_free(&ctx);
++
++        return result;
++    }
++
++    std::array<u8, 48> sha384(const std::vector<u8> &data) {
++        std::array<u8, 48> result = { 0 };
++
++        mbedtls_sha512_context ctx;
++        mbedtls_sha512_init(&ctx);
++
++        mbedtls_sha512_starts(&ctx, true);
++        mbedtls_sha512_update(&ctx, data.data(), data.size());
++        mbedtls_sha512_finish(&ctx, result.data());
++
++        mbedtls_sha512_free(&ctx);
++
++        return result;
++    }
++
++    std::array<u8, 64> sha512(prv::Provider *&data, u64 offset, size_t size) {
++        std::array<u8, 64> result = { 0 };
++
++        mbedtls_sha512_context ctx;
++        mbedtls_sha512_init(&ctx);
++
++        mbedtls_sha512_starts(&ctx, false);
++
++        processDataByChunks(data, offset, size, [&ctx](auto && data, auto && size) { return mbedtls_sha512_update(&ctx, data, size); });
++
++        mbedtls_sha512_finish(&ctx, result.data());
++
++        mbedtls_sha512_free(&ctx);
++
++        return result;
++    }
++
++    std::array<u8, 64> sha512(const std::vector<u8> &data) {
++        std::array<u8, 64> result = { 0 };
++
++        mbedtls_sha512_context ctx;
++        mbedtls_sha512_init(&ctx);
++
++        mbedtls_sha512_starts(&ctx, false);
++        mbedtls_sha512_update(&ctx, data.data(), data.size());
++        mbedtls_sha512_finish(&ctx, result.data());
++
++        mbedtls_sha512_free(&ctx);
++
++        return result;
++    }
++
++
++    std::vector<u8> decode64(const std::vector<u8> &input) {
++
++        size_t written = 0;
++        mbedtls_base64_decode(nullptr, 0, &written, input.data(), input.size());
++        std::vector<u8> output(written, 0x00);
++        if (mbedtls_base64_decode(output.data(), output.size(), &written, input.data(), input.size()))
++            return {};
++
++        output.resize(written);
++
++        return output;
++    }
++
++    std::vector<u8> encode64(const std::vector<u8> &input) {
++
++        size_t written = 0;
++        mbedtls_base64_encode(nullptr, 0, &written, input.data(), input.size());
++
++        std::vector<u8> output(written, 0x00);
++        if (mbedtls_base64_encode(output.data(), output.size(), &written, input.data(), input.size()))
++            return {};
++
++        output.resize(written);
++
++        return output;
++    }
++
++    std::string getErrorString(int error) {
++        switch (error) {
++            case CRYPTO_ERROR_INVALID_KEY_LENGTH:
++                return "Invalid key length";
++            case CRYPTO_ERROR_INVALID_MODE:
++                return "Invalid mode";
++            default: {
++                std::array<char, 128> buffer = { 0 };
++                mbedtls_strerror(error, buffer.data(), buffer.size());
++                return buffer.data();
++            }
++        }
++    }
++
++    static wolv::util::Expected<std::vector<u8>, int> aes(mbedtls_cipher_type_t type, mbedtls_operation_t operation, const std::vector<u8> &key,
++                   const std::vector<u8> &nonce, const std::vector<u8> &iv, const std::vector<u8> &input, const std::vector<u8> &tag, const std::vector<u8> &aad) {
++        mbedtls_cipher_context_t ctx;
++        mbedtls_cipher_init(&ctx);
++        ON_SCOPE_EXIT { mbedtls_cipher_free(&ctx); };
++
++        auto cipherInfo = mbedtls_cipher_info_from_type(type);
++
++        if (cipherInfo == nullptr)
++            return wolv::util::Unexpected(MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE);
++
++        int setupResult = mbedtls_cipher_setup(&ctx, cipherInfo);
++        if (setupResult != 0)
++            return wolv::util::Unexpected(setupResult);
++
++        int setKeyResult = mbedtls_cipher_setkey(&ctx, key.data(), key.size() * 8, operation);
++        if (setKeyResult != 0)
++            return wolv::util::Unexpected(setKeyResult);
++
++        auto mode = mbedtls_cipher_get_cipher_mode(&ctx);
++
++        if (mode == MBEDTLS_MODE_CBC) {
++            int paddingResult = mbedtls_cipher_set_padding_mode(&ctx, MBEDTLS_PADDING_NONE);
++            if (paddingResult != 0) {
++                return wolv::util::Unexpected(paddingResult);
++            }
++        }
++
++        if (mode == MBEDTLS_MODE_GCM || mode == MBEDTLS_MODE_CCM) {
++            const auto &aeadIv = mode == MBEDTLS_MODE_GCM ? iv : nonce;
++            std::vector<u8> authenticatedInput;
++            authenticatedInput.reserve(input.size() + tag.size());
++            authenticatedInput.insert(authenticatedInput.end(), input.begin(), input.end());
++            authenticatedInput.insert(authenticatedInput.end(), tag.begin(), tag.end());
++
++            size_t outputSize = input.size();
++            std::vector<u8> output(outputSize, 0x00);
++            const auto cryptResult = mbedtls_cipher_auth_decrypt_ext(
++                &ctx,
++                aeadIv.data(), aeadIv.size(),
++                aad.data(), aad.size(),
++                authenticatedInput.data(), authenticatedInput.size(),
++                output.data(), output.size(),
++                &outputSize, tag.size());
++
++            if (cryptResult != 0)
++                return wolv::util::Unexpected(cryptResult);
++
++            output.resize(outputSize);
++            return output;
++        }
++
++        if (input.empty())
++            return {};
++
++        size_t outputSize = input.size() + mbedtls_cipher_get_block_size(&ctx);
++        std::vector<u8> output(outputSize, 0x00);
++
++        int cryptResult = 0;
++        if (mode == MBEDTLS_MODE_ECB) {
++            const auto blockSize = static_cast<size_t>(mbedtls_cipher_get_block_size(&ctx));
++            outputSize = 0;
++
++            for (size_t inputOffset = 0; inputOffset < input.size(); inputOffset += blockSize) {
++                const auto inputSize = std::min(blockSize, input.size() - inputOffset);
++                size_t blockOutputSize = 0;
++
++                cryptResult = mbedtls_cipher_crypt(&ctx, nullptr, 0, input.data() + inputOffset, inputSize, output.data() + outputSize, &blockOutputSize);
++                if (cryptResult != 0)
++                    break;
++
++                outputSize += blockOutputSize;
++            }
++        } else {
++            cryptResult = mbedtls_cipher_crypt(&ctx, iv.data(), iv.size(), input.data(), input.size(), output.data(), &outputSize);
++        }
++
++        if (cryptResult != 0) {
++            return wolv::util::Unexpected(cryptResult);
++        }
++
++        output.resize(outputSize);
++
++        return output;
++    }
++
++    wolv::util::Expected<std::vector<u8>, int> aesDecrypt(AESMode mode, KeyLength keyLength, const std::vector<u8> &key, const std::vector<u8> &nonce, const std::vector<u8> &iv, const std::vector<u8> &input, const std::vector<u8> &tag, const std::vector<u8> &aad) {
++        switch (keyLength) {
++            case KeyLength::Key128Bits:
++                if (key.size() != 128 / 8)
++                    return wolv::util::Unexpected(CRYPTO_ERROR_INVALID_KEY_LENGTH);
++                break;
++            case KeyLength::Key192Bits:
++                if (key.size() != 192 / 8)
++                    return wolv::util::Unexpected(CRYPTO_ERROR_INVALID_KEY_LENGTH);
++                break;
++            case KeyLength::Key256Bits:
++                if (key.size() != 256 / 8)
++                    return wolv::util::Unexpected(CRYPTO_ERROR_INVALID_KEY_LENGTH);
++                break;
++            default:
++                return wolv::util::Unexpected(CRYPTO_ERROR_INVALID_KEY_LENGTH);
++        }
++
++        mbedtls_cipher_type_t type;
++        switch (mode) {
++            case AESMode::ECB:
++                type = MBEDTLS_CIPHER_AES_128_ECB;
++                break;
++            case AESMode::CBC:
++                type = MBEDTLS_CIPHER_AES_128_CBC;
++                break;
++            case AESMode::CFB128:
++                type = MBEDTLS_CIPHER_AES_128_CFB128;
++                break;
++            case AESMode::CTR:
++                type = MBEDTLS_CIPHER_AES_128_CTR;
++                break;
++            case AESMode::GCM:
++                type = MBEDTLS_CIPHER_AES_128_GCM;
++                break;
++            case AESMode::CCM:
++                type = MBEDTLS_CIPHER_AES_128_CCM;
++                break;
++            case AESMode::OFB:
++                type = MBEDTLS_CIPHER_AES_128_OFB;
++                break;
++            case AESMode::XTS:
++                type = MBEDTLS_CIPHER_AES_128_XTS;
++                break;
++            default:
++                return wolv::util::Unexpected(CRYPTO_ERROR_INVALID_MODE);
++        }
++
++        type = mbedtls_cipher_type_t(type + u8(keyLength));
++
++        return aes(type, MBEDTLS_DECRYPT, key, nonce, iv, input, tag, aad);
++    }
++
++}
+diff --git a/lib/libimhex/source/helpers/crypto_nettle.cpp b/lib/libimhex/source/helpers/crypto_nettle.cpp
+new file mode 100644
+index 000000000..766a2ff0e
+--- /dev/null
++++ b/lib/libimhex/source/helpers/crypto_nettle.cpp
+@@ -0,0 +1,334 @@
++#include <hex/helpers/crypto.hpp>
++
++#include <hex/providers/provider.hpp>
++
++#include <nettle/aes.h>
++#include <nettle/base64.h>
++#include <nettle/cbc.h>
++#include <nettle/ccm.h>
++#include <nettle/cfb.h>
++#include <nettle/ctr.h>
++#include <nettle/gcm.h>
++#include <nettle/md5.h>
++#include <nettle/memops.h>
++#include <nettle/sha1.h>
++#include <nettle/sha2.h>
++#include <nettle/version.h>
++
++#include <algorithm>
++#include <array>
++#include <concepts>
++
++namespace hex::crypt {
++
++    template<std::invocable<unsigned char *, size_t> Func>
++    void processHashDataByChunks(prv::Provider *data, u64 offset, size_t size, Func func) {
++        std::array<u8, 512> buffer = { 0 };
++        for (size_t bufferOffset = 0; bufferOffset < size; bufferOffset += buffer.size()) {
++            const auto readSize = std::min(buffer.size(), size - bufferOffset);
++            data->read(offset + bufferOffset, buffer.data(), readSize);
++            func(buffer.data(), readSize);
++        }
++    }
++
++    template<size_t ResultSize, typename Context, auto Init, auto Update, auto Digest>
++    std::array<u8, ResultSize> hashProvider(prv::Provider *data, u64 offset, size_t size) {
++        std::array<u8, ResultSize> result = { 0 };
++        Context context;
++        Init(&context);
++        processHashDataByChunks(data, offset, size, [&](const auto *buffer, auto bufferSize) {
++            Update(&context, bufferSize, buffer);
++        });
++#if NETTLE_VERSION_MAJOR >= 4
++        Digest(&context, result.data());
++#else
++        Digest(&context, result.size(), result.data());
++#endif
++        return result;
++    }
++
++    template<size_t ResultSize, typename Context, auto Init, auto Update, auto Digest>
++    std::array<u8, ResultSize> hashVector(const std::vector<u8> &data) {
++        std::array<u8, ResultSize> result = { 0 };
++        Context context;
++        Init(&context);
++        if (!data.empty())
++            Update(&context, data.size(), data.data());
++#if NETTLE_VERSION_MAJOR >= 4
++        Digest(&context, result.data());
++#else
++        Digest(&context, result.size(), result.data());
++#endif
++        return result;
++    }
++
++    std::array<u8, 16> md5(prv::Provider *&data, u64 offset, size_t size) {
++        return hashProvider<16, md5_ctx, md5_init, md5_update, md5_digest>(data, offset, size);
++    }
++
++    std::array<u8, 16> md5(const std::vector<u8> &data) {
++        return hashVector<16, md5_ctx, md5_init, md5_update, md5_digest>(data);
++    }
++
++    std::array<u8, 20> sha1(prv::Provider *&data, u64 offset, size_t size) {
++        return hashProvider<20, sha1_ctx, sha1_init, sha1_update, sha1_digest>(data, offset, size);
++    }
++
++    std::array<u8, 20> sha1(const std::vector<u8> &data) {
++        return hashVector<20, sha1_ctx, sha1_init, sha1_update, sha1_digest>(data);
++    }
++
++    std::array<u8, 28> sha224(prv::Provider *&data, u64 offset, size_t size) {
++        return hashProvider<28, sha224_ctx, sha224_init, sha224_update, sha224_digest>(data, offset, size);
++    }
++
++    std::array<u8, 28> sha224(const std::vector<u8> &data) {
++        return hashVector<28, sha224_ctx, sha224_init, sha224_update, sha224_digest>(data);
++    }
++
++    std::array<u8, 32> sha256(prv::Provider *&data, u64 offset, size_t size) {
++        return hashProvider<32, sha256_ctx, sha256_init, sha256_update, sha256_digest>(data, offset, size);
++    }
++
++    std::array<u8, 32> sha256(const std::vector<u8> &data) {
++        return hashVector<32, sha256_ctx, sha256_init, sha256_update, sha256_digest>(data);
++    }
++
++    std::array<u8, 48> sha384(prv::Provider *&data, u64 offset, size_t size) {
++        return hashProvider<48, sha384_ctx, sha384_init, sha384_update, sha384_digest>(data, offset, size);
++    }
++
++    std::array<u8, 48> sha384(const std::vector<u8> &data) {
++        return hashVector<48, sha384_ctx, sha384_init, sha384_update, sha384_digest>(data);
++    }
++
++    std::array<u8, 64> sha512(prv::Provider *&data, u64 offset, size_t size) {
++        return hashProvider<64, sha512_ctx, sha512_init, sha512_update, sha512_digest>(data, offset, size);
++    }
++
++    std::array<u8, 64> sha512(const std::vector<u8> &data) {
++        return hashVector<64, sha512_ctx, sha512_init, sha512_update, sha512_digest>(data);
++    }
++
++    std::vector<u8> decode64(const std::vector<u8> &input) {
++        if (input.empty())
++            return {};
++
++        base64_decode_ctx context;
++        base64_decode_init(&context);
++
++        std::vector<u8> output(BASE64_DECODE_LENGTH(input.size()));
++        size_t outputSize = output.size();
++        if (base64_decode_update(&context, &outputSize, output.data(), input.size(), reinterpret_cast<const char *>(input.data())) == 0 ||
++            base64_decode_final(&context) == 0)
++            return {};
++
++        output.resize(outputSize);
++        return output;
++    }
++
++    std::vector<u8> encode64(const std::vector<u8> &input) {
++        std::vector<u8> output(BASE64_ENCODE_RAW_LENGTH(input.size()));
++        if (!input.empty())
++            base64_encode_raw(reinterpret_cast<char *>(output.data()), input.size(), input.data());
++        return output;
++    }
++
++    std::string getErrorString(int error) {
++        switch (error) {
++            case CRYPTO_ERROR_INVALID_KEY_LENGTH:       return "Invalid key length";
++            case CRYPTO_ERROR_INVALID_MODE:             return "Invalid mode";
++            case CRYPTO_ERROR_INVALID_INPUT:            return "Invalid input";
++            case CRYPTO_ERROR_UNSUPPORTED_MODE:         return "Unsupported mode";
++            case CRYPTO_ERROR_AUTHENTICATION_FAILED:    return "Authentication failed";
++            default:                                    return "Unknown crypto error";
++        }
++    }
++
++    static bool isValidCcmMessageLength(size_t nonceSize, size_t inputSize) {
++        const auto lengthSize = 15 - nonceSize;
++        if (lengthSize >= sizeof(size_t))
++            return true;
++
++        return inputSize < (size_t(1) << (lengthSize * 8));
++    }
++
++    static int validateAesParameters(AESMode mode, KeyLength keyLength, const std::vector<u8> &key,
++                                     const std::vector<u8> &nonce, const std::vector<u8> &iv,
++                                     const std::vector<u8> &input, const std::vector<u8> &tag) {
++        size_t expectedKeySize = 0;
++        switch (keyLength) {
++            case KeyLength::Key128Bits: expectedKeySize = 16; break;
++            case KeyLength::Key192Bits: expectedKeySize = 24; break;
++            case KeyLength::Key256Bits: expectedKeySize = 32; break;
++            default: return CRYPTO_ERROR_INVALID_KEY_LENGTH;
++        }
++
++        if (key.size() != expectedKeySize)
++            return CRYPTO_ERROR_INVALID_KEY_LENGTH;
++
++        switch (mode) {
++            case AESMode::ECB:
++                if ((input.size() % AES_BLOCK_SIZE) != 0)
++                    return CRYPTO_ERROR_INVALID_INPUT;
++                break;
++            case AESMode::CBC:
++                if (iv.size() != AES_BLOCK_SIZE || (input.size() % AES_BLOCK_SIZE) != 0)
++                    return CRYPTO_ERROR_INVALID_INPUT;
++                break;
++            case AESMode::CFB128:
++            case AESMode::CTR:
++            case AESMode::OFB:
++                if (iv.size() != AES_BLOCK_SIZE)
++                    return CRYPTO_ERROR_INVALID_INPUT;
++                break;
++            case AESMode::GCM:
++                if (iv.empty() || tag.size() < 4 || tag.size() > GCM_DIGEST_SIZE)
++                    return CRYPTO_ERROR_INVALID_INPUT;
++                break;
++            case AESMode::CCM:
++                if (nonce.size() < 7 || nonce.size() > 13 || tag.size() < 4 || tag.size() > CCM_DIGEST_SIZE ||
++                    (tag.size() % 2) != 0 || !isValidCcmMessageLength(nonce.size(), input.size()))
++                    return CRYPTO_ERROR_INVALID_INPUT;
++                break;
++            case AESMode::XTS:
++                return CRYPTO_ERROR_UNSUPPORTED_MODE;
++            default:
++                return CRYPTO_ERROR_INVALID_MODE;
++        }
++
++        return 0;
++    }
++
++    template<typename Context, auto SetKey, auto SetIv, auto Update, auto Decrypt, auto Digest>
++    static wolv::util::Expected<std::vector<u8>, int> decryptGcm(const std::vector<u8> &key, const std::vector<u8> &iv,
++                                                                 const std::vector<u8> &input, const std::vector<u8> &tag,
++                                                                 const std::vector<u8> &aad) {
++        Context context;
++        SetKey(&context, key.data());
++        SetIv(&context, iv.size(), iv.data());
++        if (!aad.empty())
++            Update(&context, aad.size(), aad.data());
++
++        std::vector<u8> output(input.size());
++        if (!input.empty())
++            Decrypt(&context, input.size(), output.data(), input.data());
++
++        std::array<u8, GCM_DIGEST_SIZE> actualTag = { 0 };
++#if NETTLE_VERSION_MAJOR >= 4
++        Digest(&context, actualTag.data());
++#else
++        Digest(&context, tag.size(), actualTag.data());
++#endif
++        if (memeql_sec(actualTag.data(), tag.data(), tag.size()) == 0)
++            return wolv::util::Unexpected(CRYPTO_ERROR_AUTHENTICATION_FAILED);
++
++        return output;
++    }
++
++    template<typename Context, auto SetEncryptKey, auto Encrypt>
++    static wolv::util::Expected<std::vector<u8>, int> decryptCcm(const std::vector<u8> &key, const std::vector<u8> &nonce,
++                                                                 const std::vector<u8> &input, const std::vector<u8> &tag,
++                                                                 const std::vector<u8> &aad) {
++        Context context;
++        SetEncryptKey(&context, key.data());
++
++        std::vector<u8> authenticatedInput;
++        authenticatedInput.reserve(input.size() + tag.size());
++        authenticatedInput.insert(authenticatedInput.end(), input.begin(), input.end());
++        authenticatedInput.insert(authenticatedInput.end(), tag.begin(), tag.end());
++
++        std::vector<u8> output(input.size());
++        const auto result = ccm_decrypt_message(
++            &context, reinterpret_cast<nettle_cipher_func *>(Encrypt),
++            nonce.size(), nonce.data(),
++            aad.size(), aad.data(),
++            tag.size(), input.size(), output.data(), authenticatedInput.data());
++        if (result == 0)
++            return wolv::util::Unexpected(CRYPTO_ERROR_AUTHENTICATION_FAILED);
++
++        return output;
++    }
++
++    template<typename Context, auto SetEncryptKey, auto SetDecryptKey, auto Encrypt, auto Decrypt>
++    static wolv::util::Expected<std::vector<u8>, int> decryptAes(AESMode mode, const std::vector<u8> &key,
++                                                                 const std::vector<u8> &nonce, const std::vector<u8> &iv,
++                                                                 const std::vector<u8> &input, const std::vector<u8> &tag,
++                                                                 const std::vector<u8> &aad) {
++        if (mode == AESMode::GCM) {
++            if constexpr (std::same_as<Context, aes128_ctx>)
++                return decryptGcm<gcm_aes128_ctx, gcm_aes128_set_key, gcm_aes128_set_iv, gcm_aes128_update, gcm_aes128_decrypt, gcm_aes128_digest>(key, iv, input, tag, aad);
++            else if constexpr (std::same_as<Context, aes192_ctx>)
++                return decryptGcm<gcm_aes192_ctx, gcm_aes192_set_key, gcm_aes192_set_iv, gcm_aes192_update, gcm_aes192_decrypt, gcm_aes192_digest>(key, iv, input, tag, aad);
++            else
++                return decryptGcm<gcm_aes256_ctx, gcm_aes256_set_key, gcm_aes256_set_iv, gcm_aes256_update, gcm_aes256_decrypt, gcm_aes256_digest>(key, iv, input, tag, aad);
++        }
++
++        if (mode == AESMode::CCM)
++            return decryptCcm<Context, SetEncryptKey, Encrypt>(key, nonce, input, tag, aad);
++
++        Context context;
++        std::vector<u8> output(input.size());
++
++        if (mode == AESMode::ECB) {
++            SetDecryptKey(&context, key.data());
++            if (!input.empty())
++                Decrypt(&context, input.size(), output.data(), input.data());
++            return output;
++        }
++
++        SetEncryptKey(&context, key.data());
++        auto mutableIv = std::array<u8, AES_BLOCK_SIZE>();
++        std::copy(iv.begin(), iv.end(), mutableIv.begin());
++
++        auto *encryptFunction = reinterpret_cast<nettle_cipher_func *>(Encrypt);
++        switch (mode) {
++            case AESMode::CBC:
++                SetDecryptKey(&context, key.data());
++                if (!input.empty())
++                    cbc_decrypt(&context, reinterpret_cast<nettle_cipher_func *>(Decrypt), AES_BLOCK_SIZE, mutableIv.data(), input.size(), output.data(), input.data());
++                break;
++            case AESMode::CFB128:
++                if (!input.empty())
++                    cfb_decrypt(&context, encryptFunction, AES_BLOCK_SIZE, mutableIv.data(), input.size(), output.data(), input.data());
++                break;
++            case AESMode::CTR:
++                if (!input.empty())
++                    ctr_crypt(&context, encryptFunction, AES_BLOCK_SIZE, mutableIv.data(), input.size(), output.data(), input.data());
++                break;
++            case AESMode::OFB: {
++                std::array<u8, AES_BLOCK_SIZE> feedback = mutableIv;
++                std::array<u8, AES_BLOCK_SIZE> stream = { 0 };
++                for (size_t offset = 0; offset < input.size(); offset += AES_BLOCK_SIZE) {
++                    Encrypt(&context, AES_BLOCK_SIZE, stream.data(), feedback.data());
++                    feedback = stream;
++                    const auto blockSize = std::min<size_t>(AES_BLOCK_SIZE, input.size() - offset);
++                    for (size_t index = 0; index < blockSize; ++index)
++                        output[offset + index] = input[offset + index] ^ stream[index];
++                }
++                break;
++            }
++            default:
++                return wolv::util::Unexpected(CRYPTO_ERROR_INVALID_MODE);
++        }
++
++        return output;
++    }
++
++    wolv::util::Expected<std::vector<u8>, int> aesDecrypt(AESMode mode, KeyLength keyLength, const std::vector<u8> &key, const std::vector<u8> &nonce, const std::vector<u8> &iv, const std::vector<u8> &input, const std::vector<u8> &tag, const std::vector<u8> &aad) {
++        if (const auto validationResult = validateAesParameters(mode, keyLength, key, nonce, iv, input, tag); validationResult != 0)
++            return wolv::util::Unexpected(validationResult);
++
++        switch (keyLength) {
++            case KeyLength::Key128Bits:
++                return decryptAes<aes128_ctx, aes128_set_encrypt_key, aes128_set_decrypt_key, aes128_encrypt, aes128_decrypt>(mode, key, nonce, iv, input, tag, aad);
++            case KeyLength::Key192Bits:
++                return decryptAes<aes192_ctx, aes192_set_encrypt_key, aes192_set_decrypt_key, aes192_encrypt, aes192_decrypt>(mode, key, nonce, iv, input, tag, aad);
++            case KeyLength::Key256Bits:
++                return decryptAes<aes256_ctx, aes256_set_encrypt_key, aes256_set_decrypt_key, aes256_encrypt, aes256_decrypt>(mode, key, nonce, iv, input, tag, aad);
++            default:
++                return wolv::util::Unexpected(CRYPTO_ERROR_INVALID_KEY_LENGTH);
++        }
++    }
++
++}
+diff --git a/lib/third_party/yara/CMakeLists.txt b/lib/third_party/yara/CMakeLists.txt
+index cb70e7f29..623c0ad18 100644
+--- a/lib/third_party/yara/CMakeLists.txt
++++ b/lib/third_party/yara/CMakeLists.txt
+@@ -33,7 +33,7 @@ set(LIBYARA_INCLUDES
+         ${LIBYARA_SOURCE_PATH}/include/yara/threading.h
+         ${LIBYARA_SOURCE_PATH}/include/yara/types.h
+         ${LIBYARA_SOURCE_PATH}/include/yara/utils.h
+-        ${LIBYARA_SOURCE_PATH}/crypto.h
++        ${CMAKE_CURRENT_SOURCE_DIR}/crypto.h
+         ${LIBYARA_SOURCE_PATH}/tlshc/tlsh_impl.h
+         ${LIBYARA_SOURCE_PATH}/tlshc/tlsh_util.h
+         )
+@@ -102,17 +102,23 @@ set(LIBYARA_MODULES
+         ${LIBYARA_SOURCE_PATH}/modules/time/time.c
+ )
+ 
+-find_package(mbedTLS 2.26.0 REQUIRED)
+-
+ add_library(libyara STATIC ${LIBYARA_SOURCE} ${LIBYARA_INCLUDES} ${LIBYARA_MODULES})
+ 
+-# Add mbedtls crypto wrappers
+ target_compile_definitions(libyara PRIVATE
+-        HAVE_MBEDTLS
+         USE_NO_PROC BUCKETS_256 CHECKSUM_3B
+         HASH_MODULE DOTNET_MODULE MAGIC_MODULE MACHO_MODULE DEX_MODULE
+ )
+ 
++if (CRYPTO_BACKEND STREQUAL "mbedtls")
++    target_compile_definitions(libyara PRIVATE HAVE_MBEDTLS)
++    target_include_directories(libyara PRIVATE ${MBEDTLS_INCLUDE_DIR})
++    target_link_directories(libyara PRIVATE ${MBEDTLS_LIBRARY_DIR})
++    set(LIBYARA_CRYPTO_LIBRARY ${MBEDTLS_LIBRARIES})
++else ()
++    target_compile_definitions(libyara PRIVATE HAVE_NETTLE)
++    set(LIBYARA_CRYPTO_LIBRARY Nettle::Nettle)
++endif ()
++
+ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+     target_compile_options(libyara PRIVATE -Wno-shift-count-overflow -Wno-stringop-overflow)
+ elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
+@@ -124,15 +130,13 @@ endif ()
+ target_include_directories(
+         libyara
+         PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/yara> $<BUILD_INTERFACE:${LIBYARA_SOURCE_PATH}/include>
+-        PRIVATE ${LIBYARA_SOURCE_PATH} ${MBEDTLS_INCLUDE_DIR}
++        PRIVATE ${LIBYARA_SOURCE_PATH}
+ )
+ 
+-target_link_directories(libyara PRIVATE ${MBEDTLS_LIBRARY_DIR})
+-
+ if (UNIX)
+-    target_link_libraries(libyara PRIVATE magic ${MBEDTLS_LIBRARIES} pthread)
++    target_link_libraries(libyara PRIVATE magic ${LIBYARA_CRYPTO_LIBRARY} pthread)
+ else ()
+-    target_link_libraries(libyara PRIVATE magic ${MBEDTLS_LIBRARIES})
++    target_link_libraries(libyara PRIVATE magic ${LIBYARA_CRYPTO_LIBRARY})
+ endif ()
+ 
+ include(GNUInstallDirs)
+diff --git a/lib/third_party/yara/crypto.h b/lib/third_party/yara/crypto.h
+index 4d2992029..ef9256593 100644
+--- a/lib/third_party/yara/crypto.h
++++ b/lib/third_party/yara/crypto.h
+@@ -163,6 +163,39 @@ typedef mbedtls_sha256_context yr_sha256_ctx;
+ 
+ #endif
+ 
++#define HAVE_COMMONCRYPTO_COMMONCRYPTO_H
++#elif defined(HAVE_NETTLE)
++
++#include <nettle/md5.h>
++#include <nettle/sha1.h>
++#include <nettle/sha2.h>
++#include <nettle/version.h>
++
++typedef struct md5_ctx yr_md5_ctx;
++typedef struct sha1_ctx yr_sha1_ctx;
++typedef struct sha256_ctx yr_sha256_ctx;
++
++#define yr_md5_init(ctx)                    md5_init(ctx)
++#define yr_md5_update(ctx, data, len)       md5_update(ctx, len, data)
++#define yr_sha1_init(ctx)                   sha1_init(ctx)
++#define yr_sha1_update(ctx, data, len)      sha1_update(ctx, len, data)
++#define yr_sha256_init(ctx)                 sha256_init(ctx)
++#define yr_sha256_update(ctx, data, len)    sha256_update(ctx, len, data)
++
++#if NETTLE_VERSION_MAJOR >= 4
++
++#define yr_md5_final(digest, ctx)           md5_digest(ctx, digest)
++#define yr_sha1_final(digest, ctx)          sha1_digest(ctx, digest)
++#define yr_sha256_final(digest, ctx)        sha256_digest(ctx, digest)
++
++#else
++
++#define yr_md5_final(digest, ctx)           md5_digest(ctx, YR_MD5_LEN, digest)
++#define yr_sha1_final(digest, ctx)          sha1_digest(ctx, YR_SHA1_LEN, digest)
++#define yr_sha256_final(digest, ctx)        sha256_digest(ctx, YR_SHA256_LEN, digest)
++
++#endif
++
+ #define HAVE_COMMONCRYPTO_COMMONCRYPTO_H
+ #endif
+ 
+diff --git a/plugins/builtin/source/content/data_processor_nodes/decode_nodes.cpp b/plugins/builtin/source/content/data_processor_nodes/decode_nodes.cpp
+index 0f7082f89..12ff747c4 100644
+--- a/plugins/builtin/source/content/data_processor_nodes/decode_nodes.cpp
++++ b/plugins/builtin/source/content/data_processor_nodes/decode_nodes.cpp
+@@ -4,7 +4,6 @@
+ #include <hex/helpers/scaling.hpp>
+ #include <hex/helpers/crypto.hpp>
+ #include <hex/data_processor/node.hpp>
+-#include <mbedtls/error.h>
+ 
+ #include <nlohmann/json.hpp>
+ 
+@@ -64,20 +63,8 @@ namespace hex::plugin::builtin {
+                 : empty;
+ 
+             auto output = crypt::aesDecrypt(mode, keyLength, key, nonce, iv, input, tag, aad);
+-            if (!output) {
+-                switch (output.error()) {
+-                    case CRYPTO_ERROR_INVALID_KEY_LENGTH:
+-                        throwNodeError("Invalid key length");
+-                    case CRYPTO_ERROR_INVALID_MODE:
+-                        throwNodeError("Invalid mode");
+-                    default: {
+-                        std::array<char, 128> errorBuffer = { 0 };
+-                        mbedtls_strerror(output.error(), errorBuffer.data(), errorBuffer.size());
+-
+-                        throwNodeError(std::string(errorBuffer.data()));
+-                    }
+-                }
+-            }
++            if (!output)
++                throwNodeError(crypt::getErrorString(output.error()));
+ 
+             this->setBufferOnOutput(4, output.value());
+         }
+diff --git a/plugins/builtin/source/content/views/view_about.cpp b/plugins/builtin/source/content/views/view_about.cpp
+index 7fd31c660..d90a6290e 100644
+--- a/plugins/builtin/source/content/views/view_about.cpp
++++ b/plugins/builtin/source/content/views/view_about.cpp
+@@ -344,30 +344,31 @@ namespace hex::plugin::builtin {
+         };
+ 
+         constexpr static std::array ThirdPartyLibraries = {
+-            ExternalResource { "json", "nlohmann", "https://github.com/nlohmann/json" },
+-            ExternalResource { "fmt", "fmtlib", "https://github.com/fmtlib/fmt" },
+-            ExternalResource { "nativefiledialog-extended", "btzy", "https://github.com/btzy/nativefiledialog-extended" },
+-            ExternalResource { "xdgpp", "danyspin97", "https://sr.ht/~danyspin97/xdgpp" },
+-            ExternalResource { "capstone", "aquynh", "https://github.com/aquynh/capstone" },
+-            ExternalResource { "microtar", "rxi", "https://github.com/rxi/microtar" },
+-            ExternalResource { "yara", "VirusTotal", "https://github.com/VirusTotal/yara" },
+-            ExternalResource { "edlib", "Martinsos", "https://github.com/Martinsos/edlib" },
+-            ExternalResource { "HashLibPlus", "ron4fun", "https://github.com/ron4fun/HashLibPlus" },
+-            ExternalResource { "miniaudio", "mackron", "https://github.com/mackron/miniaudio" },
+-            ExternalResource { "freetype", "freetype", "https://gitlab.freedesktop.org/freetype/freetype" },
+-            ExternalResource { "mbedTLS", "ARMmbed", "https://github.com/ARMmbed/mbedtls" },
+-            ExternalResource { "curl", "curl", "https://github.com/curl/curl" },
+-            ExternalResource { "file", "file", "https://github.com/file/file" },
+-            ExternalResource { "glfw", "glfw", "https://github.com/glfw/glfw" },
+-            ExternalResource { "llvm", "LLVM Maintainers", "https://github.com/llvm/llvm-project" },
+-            ExternalResource { "Boost.Regex", "John Maddock", "https://github.com/boostorg/regex" },
+-            ExternalResource { "md4c", "mity", "https://github.com/mity/md4c" },
+-            ExternalResource { "lunasvg", "sammycage", "https://github.com/sammycage/lunasvg" },
+-            ExternalResource { "zlib", "madler", "https://github.com/madler/zlib" },
+-            ExternalResource { "bzip2", "federicomenaquintero", "https://gitlab.com/federicomenaquintero/bzip2" },
+-            ExternalResource { "liblzma", "tukaani", "https://github.com/tukaani-project/xz" },
+-            ExternalResource { "zstd", "Facebook", "https://github.com/facebook/zstd" },
+-            ExternalResource { "libssh2", "libssh2 Maintainers", "https://github.com/libssh2/libssh2" },
++            ExternalResource { .name="json", .author="nlohmann", .link="https://github.com/nlohmann/json" },
++            ExternalResource { .name="fmt", .author="fmtlib", .link="https://github.com/fmtlib/fmt" },
++            ExternalResource { .name="nativefiledialog-extended", .author="btzy", .link="https://github.com/btzy/nativefiledialog-extended" },
++            ExternalResource { .name="xdgpp", .author="danyspin97", .link="https://sr.ht/~danyspin97/xdgpp" },
++            ExternalResource { .name="capstone", .author="aquynh", .link="https://github.com/aquynh/capstone" },
++            ExternalResource { .name="microtar", .author="rxi", .link="https://github.com/rxi/microtar" },
++            ExternalResource { .name="yara", .author="VirusTotal", .link="https://github.com/VirusTotal/yara" },
++            ExternalResource { .name="edlib", .author="Martinsos", .link="https://github.com/Martinsos/edlib" },
++            ExternalResource { .name="HashLibPlus", .author="ron4fun", .link="https://github.com/ron4fun/HashLibPlus" },
++            ExternalResource { .name="miniaudio", .author="mackron", .link="https://github.com/mackron/miniaudio" },
++            ExternalResource { .name="freetype", .author="freetype", .link="https://gitlab.freedesktop.org/freetype/freetype" },
++            ExternalResource { .name="mbedTLS", .author="ARMmbed", .link="https://github.com/ARMmbed/mbedtls" },
++            ExternalResource { .name="Nettle", .author="Nettle developers", .link="https://www.lysator.liu.se/~nisse/nettle/" },
++            ExternalResource { .name="curl", .author="curl", .link="https://github.com/curl/curl" },
++            ExternalResource { .name="file", .author="file", .link="https://github.com/file/file" },
++            ExternalResource { .name="glfw", .author="glfw", .link="https://github.com/glfw/glfw" },
++            ExternalResource { .name="llvm", .author="LLVM Maintainers", .link="https://github.com/llvm/llvm-project" },
++            ExternalResource { .name="Boost.Regex", .author="John Maddock", .link="https://github.com/boostorg/regex" },
++            ExternalResource { .name="md4c", .author="mity", .link="https://github.com/mity/md4c" },
++            ExternalResource { .name="lunasvg", .author="sammycage", .link="https://github.com/sammycage/lunasvg" },
++            ExternalResource { .name="zlib", .author="madler", .link="https://github.com/madler/zlib" },
++            ExternalResource { .name="bzip2", .author="federicomenaquintero", .link="https://gitlab.com/federicomenaquintero/bzip2" },
++            ExternalResource { .name="liblzma", .author="tukaani", .link="https://github.com/tukaani-project/xz" },
++            ExternalResource { .name="zstd", .author="Facebook", .link="https://github.com/facebook/zstd" },
++            ExternalResource { .name="libssh2", .author="libssh2 Maintainers", .link="https://github.com/libssh2/libssh2" },
+         };
+ 
+         constexpr static std::array ThirdPartyResources {
+diff --git a/tests/algorithms/CMakeLists.txt b/tests/algorithms/CMakeLists.txt
+index 65580200e..39ade301a 100644
+--- a/tests/algorithms/CMakeLists.txt
++++ b/tests/algorithms/CMakeLists.txt
+@@ -40,6 +40,9 @@ add_executable(${PROJECT_NAME}
+ 
+ target_include_directories(${PROJECT_NAME} PRIVATE include)
+ target_link_libraries(${PROJECT_NAME} PRIVATE libimhex tests_common ${FMT_LIBRARIES})
++if (CRYPTO_BACKEND STREQUAL "mbedtls")
++    target_compile_definitions(${PROJECT_NAME} PRIVATE IMHEX_CRYPTO_BACKEND_MBEDTLS)
++endif ()
+ 
+ set_target_properties(${PROJECT_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
+ 
+diff --git a/tests/algorithms/source/aes.cpp b/tests/algorithms/source/aes.cpp
+index 81e41bac2..205249790 100644
+--- a/tests/algorithms/source/aes.cpp
++++ b/tests/algorithms/source/aes.cpp
+@@ -1,6 +1,13 @@
+ #include <hex/helpers/crypto.hpp>
+ #include <hex/test/tests.hpp>
+ 
++#if defined(IMHEX_CRYPTO_BACKEND_MBEDTLS)
++    #include <mbedtls/ccm.h>
++    #include <mbedtls/cipher.h>
++    #include <mbedtls/error.h>
++    #include <mbedtls/gcm.h>
++#endif
++
+ #include <array>
+ #include <cstdlib>
+ #include <string_view>
+@@ -394,7 +401,7 @@ TEST_SEQUENCE("AESDecrypt") {
+         if (vector->mode == hex::crypt::AESMode::GCM || vector->mode == hex::crypt::AESMode::CCM) {
+             auto alteredTag = vector->tag;
+             alteredTag.front() ^= 0x01;
+-            TEST_ASSERT(!hex::crypt::aesDecrypt(
++            const auto alteredTagResult = hex::crypt::aesDecrypt(
+                 vector->mode,
+                 vector->keyLength,
+                 vector->key,
+@@ -402,7 +409,13 @@ TEST_SEQUENCE("AESDecrypt") {
+                 vector->iv,
+                 vector->input,
+                 alteredTag,
+-                vector->aad).has_value());
++                vector->aad);
++            TEST_ASSERT(!alteredTagResult.has_value());
++#if defined(IMHEX_CRYPTO_BACKEND_MBEDTLS)
++            TEST_ASSERT(alteredTagResult.error() == MBEDTLS_ERR_CIPHER_AUTH_FAILED);
++#else
++            TEST_ASSERT(alteredTagResult.error() == CRYPTO_ERROR_AUTHENTICATION_FAILED);
++#endif
+ 
+             TEST_ASSERT(!hex::crypt::aesDecrypt(
+                 vector->mode,
+@@ -432,5 +445,75 @@ TEST_SEQUENCE("AESDecrypt") {
+         }
+     }
+ 
++    const auto invalidKey = hex::crypt::aesDecrypt(
++        hex::crypt::AESMode::ECB, hex::crypt::KeyLength::Key128Bits,
++        { 0x00 }, { }, { }, std::vector<u8>(16), { }, { });
++    TEST_ASSERT(!invalidKey.has_value());
++    TEST_ASSERT(invalidKey.error() == CRYPTO_ERROR_INVALID_KEY_LENGTH);
++
++    const auto invalidMode = hex::crypt::aesDecrypt(
++        static_cast<hex::crypt::AESMode>(0xFF), hex::crypt::KeyLength::Key128Bits,
++        std::vector<u8>(16), { }, { }, std::vector<u8>(16), { }, { });
++    TEST_ASSERT(!invalidMode.has_value());
++    TEST_ASSERT(invalidMode.error() == CRYPTO_ERROR_INVALID_MODE);
++
++    const auto invalidBlockLength = hex::crypt::aesDecrypt(
++        hex::crypt::AESMode::ECB, hex::crypt::KeyLength::Key128Bits,
++        std::vector<u8>(16), { }, { }, std::vector<u8>(15), { }, { });
++    TEST_ASSERT(!invalidBlockLength.has_value());
++#if defined(IMHEX_CRYPTO_BACKEND_MBEDTLS)
++    TEST_ASSERT(invalidBlockLength.error() == MBEDTLS_ERR_CIPHER_FULL_BLOCK_EXPECTED);
++#else
++    TEST_ASSERT(invalidBlockLength.error() == CRYPTO_ERROR_INVALID_INPUT);
++#endif
++
++    const auto invalidIvLength = hex::crypt::aesDecrypt(
++        hex::crypt::AESMode::CTR, hex::crypt::KeyLength::Key128Bits,
++        std::vector<u8>(16), { }, std::vector<u8>(15), std::vector<u8>(16), { }, { });
++    TEST_ASSERT(!invalidIvLength.has_value());
++#if defined(IMHEX_CRYPTO_BACKEND_MBEDTLS)
++    TEST_ASSERT(invalidIvLength.error() == MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA);
++#else
++    TEST_ASSERT(invalidIvLength.error() == CRYPTO_ERROR_INVALID_INPUT);
++#endif
++
++    const auto invalidTagLength = hex::crypt::aesDecrypt(
++        hex::crypt::AESMode::GCM, hex::crypt::KeyLength::Key128Bits,
++        std::vector<u8>(16), { }, std::vector<u8>(12), std::vector<u8>(16), std::vector<u8>(3), { });
++    TEST_ASSERT(!invalidTagLength.has_value());
++#if defined(IMHEX_CRYPTO_BACKEND_MBEDTLS)
++    TEST_ASSERT(invalidTagLength.error() == MBEDTLS_ERR_GCM_BAD_INPUT);
++#else
++    TEST_ASSERT(invalidTagLength.error() == CRYPTO_ERROR_INVALID_INPUT);
++#endif
++
++    const auto invalidNonceLength = hex::crypt::aesDecrypt(
++        hex::crypt::AESMode::CCM, hex::crypt::KeyLength::Key128Bits,
++        std::vector<u8>(16), std::vector<u8>(6), { }, std::vector<u8>(16), std::vector<u8>(4), { });
++    TEST_ASSERT(!invalidNonceLength.has_value());
++#if defined(IMHEX_CRYPTO_BACKEND_MBEDTLS)
++    TEST_ASSERT(invalidNonceLength.error() == MBEDTLS_ERR_CCM_BAD_INPUT);
++#else
++    TEST_ASSERT(invalidNonceLength.error() == CRYPTO_ERROR_INVALID_INPUT);
++#endif
++
++    const auto xtsResult = hex::crypt::aesDecrypt(
++        hex::crypt::AESMode::XTS, hex::crypt::KeyLength::Key128Bits,
++        std::vector<u8>(16), { }, std::vector<u8>(16), std::vector<u8>(16), { }, { });
++    TEST_ASSERT(!xtsResult.has_value());
++    TEST_ASSERT(!hex::crypt::getErrorString(xtsResult.error()).empty());
++
++    TEST_ASSERT(hex::crypt::getErrorString(CRYPTO_ERROR_INVALID_KEY_LENGTH) == "Invalid key length");
++    TEST_ASSERT(hex::crypt::getErrorString(CRYPTO_ERROR_INVALID_MODE) == "Invalid mode");
++#if defined(IMHEX_CRYPTO_BACKEND_MBEDTLS)
++    std::array<char, 128> errorBuffer = { 0 };
++    mbedtls_strerror(CRYPTO_ERROR_INVALID_INPUT, errorBuffer.data(), errorBuffer.size());
++    TEST_ASSERT(hex::crypt::getErrorString(CRYPTO_ERROR_INVALID_INPUT) == errorBuffer.data());
++#else
++    TEST_ASSERT(hex::crypt::getErrorString(CRYPTO_ERROR_INVALID_INPUT) == "Invalid input");
++    TEST_ASSERT(hex::crypt::getErrorString(CRYPTO_ERROR_UNSUPPORTED_MODE) == "Unsupported mode");
++    TEST_ASSERT(hex::crypt::getErrorString(CRYPTO_ERROR_AUTHENTICATION_FAILED) == "Authentication failed");
++#endif
++
+     TEST_SUCCESS();
+ };
+diff --git a/tests/algorithms/source/crypto.cpp b/tests/algorithms/source/crypto.cpp
+index 55da31412..1236b337c 100644
+--- a/tests/algorithms/source/crypto.cpp
++++ b/tests/algorithms/source/crypto.cpp
+@@ -33,6 +33,10 @@ TEST_SEQUENCE("EncodeDecode16") {
+         TEST_ASSERT((vec = hex::crypt::decode16(i.string)) == i.vec, "vec: {} i.vec: {} from: '{}'", vec, i.vec, i.string);
+     }
+ 
++    TEST_ASSERT(hex::crypt::decode16("0").empty());
++    TEST_ASSERT(hex::crypt::decode16("0G").empty());
++    TEST_ASSERT(hex::crypt::decode16("GG").empty());
++
+     std::random_device rd;
+     std::mt19937 gen(rd());
+     std::uniform_int_distribution dataLen(0, 1024);
+@@ -83,6 +87,10 @@ TEST_SEQUENCE("EncodeDecode64") {
+         TEST_ASSERT((vec = hex::crypt::decode64(stringToVector(i.string))) == i.vec, "vec: {} i.vec: {} from: '{}'", vec, i.vec, i.string);
+     }
+ 
++    TEST_ASSERT(hex::crypt::decode64(stringToVector("A")).empty());
++    TEST_ASSERT(hex::crypt::decode64(stringToVector("AA=A")).empty());
++    TEST_ASSERT(hex::crypt::decode64(stringToVector("!!!!")).empty());
++
+     std::random_device rd;
+     std::mt19937 gen(rd());
+     std::uniform_int_distribution dataLen(0, 1024);
+-- 
+2.55.0
+

diff --git a/imhex.spec b/imhex.spec
index b461832..d6abb96 100644
--- a/imhex.spec
+++ b/imhex.spec
@@ -1,6 +1,6 @@
 Name:           imhex
 Version:        1.38.1
-Release:        1%{?dist}
+Release:        2%{?dist}
 Summary:        A hex editor for reverse engineers and programmers
 
 License:        GPL-2.0-only AND Zlib AND MIT AND Apache-2.0
@@ -12,6 +12,12 @@ Source0:        https://github.com/WerWolv/%{name}/releases/download/v%{version}
 # default to including the same-version patterns as a suggested package
 Source1:        https://github.com/WerWolv/ImHex-Patterns/archive/refs/tags/ImHex-v%{version}.tar.gz#/%{name}-patterns-%{version}.tar.gz
 
+# Backports with modifications of the following patches:
+#  - https://github.com/WerWolv/ImHex/pull/2831.patch
+#  - https://github.com/WerWolv/ImHex/pull/2849.patch
+Patch0: 0001-fix-Broken-AES-Modes-in-data-processor-2831.patch
+Patch1: 0002-feat-Add-Nettle-support-as-an-alternative-to-MbedTLS.patch
+
 BuildRequires:  cmake
 BuildRequires:  desktop-file-utils
 BuildRequires:  dbus-devel
@@ -30,7 +36,7 @@ BuildRequires:  zlib-devel
 BuildRequires:  bzip2-devel
 BuildRequires:  xz-devel
 BuildRequires:  llvm-devel
-BuildRequires:  mbedtls-devel
+BuildRequires:  nettle-devel
 BuildRequires:  yara-devel
 BuildRequires:  nativefiledialog-extended-devel
 BuildRequires:  lz4-devel
@@ -137,6 +143,7 @@ CXXFLAGS+=" -std=gnu++2b"
  -D USE_SYSTEM_NFD=ON                    \
  -D IMHEX_ENABLE_UNIT_TESTS=ON           \
  -D IMHEX_STRICT_WARNINGS=OFF            \
+ -D CRYPTO_BACKEND=nettle                \
 %if 0%{?rhel}
  -D IMHEX_BUILD_HARDENING=OFF
 %endif
@@ -205,6 +212,9 @@ done
 
 
 %changelog
+* Wed Oct 14 2026 Bill Roberts <bill.roberts@arm.com> - 1.38.1-2
+- Use Nettle instead of mbedtls for the crypto backend
+
 * Fri Jul 17 2026 Yaakov Selkowitz <yselkowi@redhat.com> - 1.38.1-1
 - Update to 1.38.1
 

                 reply	other threads:[~2026-11-18 11:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179500054927.1.12200048668571784796.rpms-imhex-12ecd53ea7c2@fedoraproject.org \
    --to=bill.roberts@arm.com \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox