Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Segmentation fault while using QCA
Qt 6.11 is out! See what's new in the release blog

Segmentation fault while using QCA

Scheduled Pinned Locked Moved General and Desktop
6 Posts 2 Posters 3.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    Gowtam
    wrote on last edited by
    #1

    I've been getting the following segmentation fault when compiling:

    "The inferior stopped because it received a signal from the Operating System.
    Signal name : SIGSEGV
    Signal meaning : Segmentation fault"

    Stacktrace:
    0 lockInline qmutex.h 187 0x7ffff7b3f33b
    1 QMutexLocker qmutex.h 109 0x7ffff7b3f33b
    2 QCA::init qca_core.cpp 185 0x7ffff7b3f33b
    3 RegistrationDialog::verifyKey registrationdialog.cpp 60 0x4b15e8

    following is the function:
    @bool RegistrationDialog::verifyKey(QString Registeredkey)
    {
    QString generated_key;
    QString mac_address = getMacAddress();

    // the Initializer object sets things up, and
    // also does cleanup when it goes out of scope
    QCA::Initializer init = QCA::Initializer();
    
    QString PassKey = "iXBv9TobQ545Fc4AB";
    QCA::SymmetricKey key(16);
    QCA::InitializationVector iv(PassKey.toLatin1());
    QCA::Cipher cipher(QString( "des" ), QCA::Cipher::CBC, QCA::Cipher::PKCS7, QCA::Encode, key, iv);
    
    
    // we use the first argument if provided, or
    // use "hello" if no arguments
    

    // QCA::SecureArray arg = (argc >= 2) ? argv[1] : "hello";
    QCA::SecureArray arg = mac_address.toUtf8();

    // DES testing
    if(!QCA::isSupported("des-cbc-pkcs7"))
        printf("DES-CBC not supported!\n");
    else {
    
        QCA::SecureArray u = cipher.update(arg);
    
        // We need to check if that update() call worked.
        if (!cipher.ok()) {
            qDebug()<<"Update failed";
        }
    
        QCA::SecureArray f = cipher.final();
    
        // Check if the final() call worked
        if (!cipher.ok()) {
            qDebug()<<"Final failed";
        }
    
        generated_key = qPrintable(QCA::arrayToHex(f.toByteArray()));
    
        if ( Registeredkey == generated_key ) {
            return true;
        } else {
            qDebug()<<"not true!";
            return false;
        }
    }
    
    return false;
    

    }@

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Are you building your program with Qt 5 and are you using QCA from your system ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • G Offline
        G Offline
        Gowtam
        wrote on last edited by
        #3

        Thanks for the reply.
        Yes, I'm using Qt5. I'm using QCA from the system itself.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Then you QCA is probably linked to Qt 4, which results in the crash (there was a "thread":http://qt-project.org/forums/viewthread/30218 about that not long ago)

          So you have two choices:

          • Build your application with Qt 4
          • Build your own version of QCA with Qt 5

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • G Offline
            G Offline
            Gowtam
            wrote on last edited by
            #5

            I downloaded QCA source from the respective website. But, how to make it compile with Qt5?
            Or is this someway related to Qmutexlocker?

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              No it's related to the fact that loading both Qt 4 and Qt 5 in the same address space is not supported.

              You'll have to follow the instructions provided, I have not yet built QCA with Qt 5

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved