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 0×7ffff7b3f33b
1 QMutexLocker qmutex.h 109 0×7ffff7b3f33b
2 QCA::init qca_core.cpp 185 0×7ffff7b3f33b
3 RegistrationDialog::verifyKey registrationdialog.cpp 60 0×4b15e8
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;
}
↧