https://bugs.kde.org/show_bug.cgi?id=423355

            Bug ID: 423355
           Summary: Nullptr QCA::PKeyBase* in QCA::PKeyContext* of pkeys
                    in QCA::KeyBundle for unknown pkey type
           Product: qca
           Version: 2.3.0
          Platform: Archlinux Packages
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: dr...@land.ru
          Reporter: einbert-xer...@outlook.com
                CC: aa...@kde.org, br...@frogmouth.net,
                    jus...@karneges.com
  Target Milestone: ---

Related bug: https://bugs.kde.org/show_bug.cgi?id=423349.

When loading PKCS12 key bundle, during conveting pkey to QCA::PKeyBase*:

#0 opensslQCAPlugin::MyPKeyContext::pkeyToBase
#1 opensslQCAPlugin::MyPKCS12Context::fromPKCS12
#2 QCA::get_pkcs12_der
#3 QCA::KeyBundle::fromFile

In opensslQCAPlugin::MyPKeyContext::pkeyToBase, if pkey_type it got is
unexpected (i.e. not EVP_PKEY_{RSA,DSA,DH}; e.g. EVP_PKEY_EC), it will return
nullptr, and opensslQCAPlugin::MyPKCS12Context::fromPKCS12 doesn't check the
return value. When calling pkey related methods (like
QCA::PrivateKey::canDecrypt(), which eventually calls QCA::PKeyBase::type()),
it will cause segmentation fault due to nullptr.

OBSERVED RESULT

Segmentation fault due to PKeyBase* being nullptr.

EXPECTED RESULT

- Either make QCA::KeyBundle::fromFile fail due to unknown pkey type, or check
if QCA::PKeyBase* is nullptr every time when use it (not just
QCA::Provider::Context*).
- Support more pkey types if possible.

SOFTWARE/OS VERSIONS
Qt Version: 5.15.0
Frameworks Version: 5.71.0
Operating System: Linux 5.7.4-arch1-1 x86_64
Windowing system: X11
Distribution: "Arch Linux"

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to