4
0
mirror of https://github.com/QuasarApp/qca.git synced 2025-05-08 08:49:34 +00:00

Add override

This commit is contained in:
Albert Astals Cid 2020-01-19 16:28:44 +01:00
parent 326399794e
commit 00d311d90f
43 changed files with 665 additions and 798 deletions

@ -133,7 +133,7 @@ if (CMAKE_COMPILER_IS_GNUCXX)
endif()
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-long-long -Wundef -Werror-implicit-function-declaration -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -fno-common")
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Wno-long-long -Wundef -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -fno-check-new -fno-common")
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Wno-long-long -Wundef -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -fno-check-new -fno-common -Wsuggest-override")
endif (CMAKE_SYSTEM_NAME MATCHES Linux)
endif (CMAKE_COMPILER_IS_GNUCXX)

@ -82,7 +82,7 @@ public:
}
void setup(const QCA::SymmetricKey &key)
void setup(const QCA::SymmetricKey &key) override
{
// We might not have a real key, since this can get called
// from the constructor.
@ -117,24 +117,24 @@ public:
m_k2 = xorArray(leftShift(m_k1), const_Rb);
}
QCA::Provider::Context *clone() const
QCA::Provider::Context *clone() const override
{
return new AESCMACContext(*this);
}
void clear()
void clear()
{
setup(m_key);
}
QCA::KeyLength keyLength() const
QCA::KeyLength keyLength() const override
{
return QCA::KeyLength(16, 16, 1);
}
// This is a bit different to the way the I-D does it,
// to allow for multiple update() calls.
void update(const QCA::MemoryRegion &a)
void update(const QCA::MemoryRegion &a) override
{
QCA::SecureArray bytesToProcess = m_residual + a;
int blockNum;
@ -161,7 +161,7 @@ public:
m_residual[yalv] = bytesToProcess[blockNum*16 + yalv];
}
void final( QCA::MemoryRegion *out)
void final( QCA::MemoryRegion *out) override
{
QCA::SecureArray lastBlock;
int numBytesLeft = m_residual.size();
@ -202,17 +202,17 @@ protected:
class ClientSideProvider : public QCA::Provider
{
public:
int qcaVersion() const
int qcaVersion() const override
{
return QCA_VERSION;
}
QString name() const
QString name() const override
{
return "exampleClientSideProvider";
}
QStringList features() const
QStringList features() const override
{
QStringList list;
list += "cmac(aes)";
@ -220,7 +220,7 @@ public:
return list;
}
Provider::Context *createContext(const QString &type)
Provider::Context *createContext(const QString &type) override
{
if(type == "cmac(aes)")
return new AESCMACContext(this);

@ -112,7 +112,7 @@ class AskerThread : public QThread
{
Q_OBJECT
protected:
virtual void run()
void run() override
{
asker_procedure();
}

@ -33,12 +33,12 @@ public:
void connectToHostEncrypted(const QString &host, quint16 port);
QCA::TLS *tls();
bool waitForReadyRead(int msecs = -1);
bool waitForReadyRead(int msecs = -1) override;
protected:
// from qiodevice
virtual qint64 readData(char *data, qint64 maxlen);
virtual qint64 writeData(const char *data, qint64 len);
qint64 readData(char *data, qint64 maxlen) override;
qint64 writeData(const char *data, qint64 len) override;
private:
class Private;

@ -265,7 +265,7 @@ public:
a Hash sub-class object to calculate additional
hashes.
*/
virtual void clear();
void clear() override;
/**
Update a hash, adding more of the message contents
@ -278,7 +278,7 @@ public:
\param a the byte array to add to the hash
*/
virtual void update(const MemoryRegion &a);
void update(const MemoryRegion &a) override;
/**
\overload
@ -340,7 +340,7 @@ if ( f.open( QIODevice::ReadOnly ) )
reuse the Hash object, you should call clear() and
start to update() again.
*/
virtual MemoryRegion final();
MemoryRegion final() override;
/**
%Hash a byte array, returning it as another
@ -733,7 +733,7 @@ public:
/**
reset the cipher object, to allow re-use
*/
virtual void clear();
void clear() override;
/**
pass in a byte array of data, which will be encrypted or decrypted
@ -742,20 +742,20 @@ public:
\param a the array of data to encrypt / decrypt
*/
virtual MemoryRegion update(const MemoryRegion &a);
MemoryRegion update(const MemoryRegion &a) override;
/**
complete the block of data, padding as required, and returning
the completed block
*/
virtual MemoryRegion final();
MemoryRegion final() override;
/**
Test if an update() or final() call succeeded.
\return true if the previous call succeeded
*/
virtual bool ok() const;
bool ok() const override;
/**
Reset / reconfigure the Cipher
@ -899,7 +899,7 @@ public:
doesn't need to be changed, you don't need to call
setup() again, since the key can just be reused.
*/
virtual void clear();
void clear() override;
/**
Update the MAC, adding more of the message contents
@ -908,7 +908,7 @@ public:
\param array the message contents
*/
virtual void update(const MemoryRegion &array);
void update(const MemoryRegion &array) override;
/**
Finalises input and returns the MAC result
@ -921,7 +921,7 @@ public:
reuse the %MessageAuthenticationCode object, you
should call clear() and start to update() again.
*/
virtual MemoryRegion final();
MemoryRegion final() override;
/**
Initialise the MAC algorithm

@ -53,8 +53,8 @@ Q_SIGNALS:
void timeout();
protected:
bool event(QEvent *event);
void timerEvent(QTimerEvent *event);
bool event(QEvent *event) override;
void timerEvent(QTimerEvent *event) override;
private:
// Functions is used internally. Outer world mustn't have access them.

@ -681,16 +681,16 @@ foreach(const CertificateInfoOrdered &info, tls->issuerList())
CertificateChain peerCertificateChain() const;
// reimplemented
virtual bool isClosable() const;
virtual int bytesAvailable() const;
virtual int bytesOutgoingAvailable() const;
virtual void close();
virtual void write(const QByteArray &a);
virtual QByteArray read();
virtual void writeIncoming(const QByteArray &a);
virtual QByteArray readOutgoing(int *plainBytes = 0);
virtual QByteArray readUnprocessed();
virtual int convertBytesWritten(qint64 encryptedBytes);
bool isClosable() const override;
int bytesAvailable() const override;
int bytesOutgoingAvailable() const override;
void close() override;
void write(const QByteArray &a) override;
QByteArray read() override;
void writeIncoming(const QByteArray &a) override;
QByteArray readOutgoing(int *plainBytes = 0) override;
QByteArray readUnprocessed() override;
int convertBytesWritten(qint64 encryptedBytes) override;
/**
Determine the number of packets available to be
@ -784,7 +784,7 @@ protected:
connected to.
*/
#if QT_VERSION >= 0x050000
void connectNotify(const QMetaMethod &signal);
void connectNotify(const QMetaMethod &signal) override;
#else
void connectNotify(const char *signal);
#endif
@ -796,7 +796,7 @@ protected:
disconnected from.
*/
#if QT_VERSION >= 0x050000
void disconnectNotify(const QMetaMethod &signal);
void disconnectNotify(const QMetaMethod &signal) override;
#else
void disconnectNotify(const char *signal);
#endif
@ -1177,13 +1177,13 @@ public:
void continueAfterAuthCheck();
// reimplemented
virtual int bytesAvailable() const;
virtual int bytesOutgoingAvailable() const;
virtual void write(const QByteArray &a);
virtual QByteArray read();
virtual void writeIncoming(const QByteArray &a);
virtual QByteArray readOutgoing(int *plainBytes = 0);
virtual int convertBytesWritten(qint64 encryptedBytes);
int bytesAvailable() const override;
int bytesOutgoingAvailable() const override;
void write(const QByteArray &a) override;
QByteArray read() override;
void writeIncoming(const QByteArray &a) override;
QByteArray readOutgoing(int *plainBytes = 0) override;
int convertBytesWritten(qint64 encryptedBytes) override;
Q_SIGNALS:
/**

@ -335,7 +335,7 @@ protected:
/**
Starts the event loop and calls atStart and atStop as necessary
*/
virtual void run();
void run() override;
private:
Q_DISABLE_COPY(SyncThread)

@ -179,7 +179,7 @@ public:
This is useful to reuse an existing Hex object
*/
virtual void clear();
void clear() override;
/**
Process more data, returning the corresponding
@ -195,7 +195,7 @@ public:
\param a the array containing data to process
*/
virtual MemoryRegion update(const MemoryRegion &a);
MemoryRegion update(const MemoryRegion &a) override;
/**
Complete the algorithm
@ -205,14 +205,14 @@ public:
zero length array - any output will have been returned
from the update() call.
*/
virtual MemoryRegion final();
MemoryRegion final() override;
/**
Test if an update() or final() call succeeded.
\return true if the previous call succeeded
*/
virtual bool ok() const;
bool ok() const override;
private:
Q_DISABLE_COPY(Hex)
@ -274,7 +274,7 @@ public:
Reset the internal state. This is useful to
reuse an existing Base64 object
*/
virtual void clear();
void clear() override;
/**
Process more data, returning the corresponding
@ -290,7 +290,7 @@ public:
\param a the array containing data to process
*/
virtual MemoryRegion update(const MemoryRegion &a);
MemoryRegion update(const MemoryRegion &a) override;
/**
Complete the algorithm
@ -300,14 +300,14 @@ public:
empty array, or an array containing one or two
"=" (equals, 0x3D) characters.
*/
virtual MemoryRegion final();
MemoryRegion final() override;
/**
Test if an update() or final() call succeeded.
\return true if the previous call succeeded
*/
virtual bool ok() const;
bool ok() const override;
private:
Q_DISABLE_COPY(Base64)

@ -51,12 +51,12 @@ public:
{
}
Context *clone() const
Context *clone() const override
{
return new botanRandomContext( *this );
}
QCA::SecureArray nextBytes(int size)
QCA::SecureArray nextBytes(int size) override
{
QCA::SecureArray buf(size);
Botan::AutoSeeded_RNG rng;
@ -84,22 +84,22 @@ public:
delete m_hashObj;
}
Context *clone() const
Context *clone() const override
{
return new BotanHashContext(*this);
}
void clear()
void clear() override
{
m_hashObj->clear();
}
void update(const QCA::MemoryRegion &a)
void update(const QCA::MemoryRegion &a) override
{
m_hashObj->update( (const Botan::byte*)a.data(), a.size() );
}
QCA::MemoryRegion final()
QCA::MemoryRegion final() override
{
QCA::SecureArray a( m_hashObj->output_length() );
m_hashObj->final( (Botan::byte *)a.data() );
@ -131,7 +131,7 @@ public:
{
}
void setup(const QCA::SymmetricKey &key)
void setup(const QCA::SymmetricKey &key) override
{
// this often gets called with an empty key, because that is the default
// in the QCA MessageAuthenticationCode constructor. Botan doesn't like
@ -141,27 +141,27 @@ public:
}
}
Context *clone() const
Context *clone() const override
{
return new BotanHMACContext(*this);
}
void clear()
void clear()
{
m_hashObj->clear();
}
QCA::KeyLength keyLength() const
QCA::KeyLength keyLength() const override
{
return anyKeyLength();
}
void update(const QCA::MemoryRegion &a)
void update(const QCA::MemoryRegion &a) override
{
m_hashObj->update( (const Botan::byte*)a.data(), a.size() );
}
void final( QCA::MemoryRegion *out)
void final( QCA::MemoryRegion *out) override
{
QCA::SecureArray sa( m_hashObj->output_length(), 0 );
m_hashObj->final( (Botan::byte *)sa.data() );
@ -182,18 +182,18 @@ public:
m_s2k = Botan::get_s2k(kdfName.toStdString());
}
~BotanPBKDFContext()
~BotanPBKDFContext()
{
delete m_s2k;
}
Context *clone() const
Context *clone() const override
{
return new BotanPBKDFContext( *this );
}
QCA::SymmetricKey makeKey(const QCA::SecureArray &secret, const QCA::InitializationVector &salt,
unsigned int keyLength, unsigned int iterationCount)
unsigned int keyLength, unsigned int iterationCount) override
{
std::string secretString(secret.data(), secret.size() );
Botan::OctetString key = m_s2k->derive_key(keyLength, secretString, (const Botan::byte*)salt.data(), salt.size(), iterationCount);
@ -205,7 +205,7 @@ public:
const QCA::InitializationVector &salt,
unsigned int keyLength,
int msecInterval,
unsigned int *iterationCount)
unsigned int *iterationCount) override
{
Q_ASSERT(iterationCount != NULL);
Botan::OctetString key;
@ -246,13 +246,13 @@ public:
delete m_hkdf;
}
Context *clone() const
Context *clone() const override
{
return new BotanHKDFContext( *this );
}
QCA::SymmetricKey makeKey(const QCA::SecureArray &secret, const QCA::InitializationVector &salt,
const QCA::InitializationVector &info, unsigned int keyLength)
const QCA::InitializationVector &info, unsigned int keyLength) override
{
std::string secretString(secret.data(), secret.size());
Botan::secure_vector<uint8_t> key(keyLength);
@ -285,7 +285,7 @@ public:
void setup(QCA::Direction dir,
const QCA::SymmetricKey &key,
const QCA::InitializationVector &iv,
const QCA::AuthTag &tag)
const QCA::AuthTag &tag) override
{
Q_UNUSED(tag);
try {
@ -319,12 +319,12 @@ public:
}
}
Context *clone() const
Context *clone() const override
{
return new BotanCipherContext( *this );
}
int blockSize() const
int blockSize() const override
{
#if BOTAN_VERSION_CODE < BOTAN_VERSION_CODE_FOR(2,0,0)
return Botan::block_size_of(m_algoName);
@ -336,13 +336,13 @@ public:
#endif
}
QCA::AuthTag tag() const
QCA::AuthTag tag() const override
{
// For future implementation
return QCA::AuthTag();
}
bool update(const QCA::SecureArray &in, QCA::SecureArray *out)
bool update(const QCA::SecureArray &in, QCA::SecureArray *out) override
{
if (!m_crypter)
return false;
@ -355,7 +355,7 @@ public:
return true;
}
bool final(QCA::SecureArray *out)
bool final(QCA::SecureArray *out) override
{
m_crypter->end_msg();
QCA::SecureArray result( m_crypter->remaining() );
@ -366,7 +366,7 @@ public:
return true;
}
QCA::KeyLength keyLength() const
QCA::KeyLength keyLength() const override
{
#if BOTAN_VERSION_CODE < BOTAN_VERSION_CODE_FOR(2,0,0)
Botan::Algorithm_Factory &af = Botan::global_state().algorithm_factory();
@ -416,7 +416,7 @@ protected:
class botanProvider : public QCA::Provider
{
public:
void init()
void init() override
{
#if BOTAN_VERSION_CODE < BOTAN_VERSION_CODE_FOR(2,0,0)
m_init = new Botan::LibraryInitializer;
@ -430,17 +430,17 @@ public:
// delete m_init;
}
int qcaVersion() const
int qcaVersion() const override
{
return QCA_VERSION;
}
QString name() const
QString name() const override
{
return "qca-botan";
}
QStringList features() const
QStringList features() const override
{
QStringList list;
list += "random";
@ -492,7 +492,7 @@ public:
return list;
}
Context *createContext(const QString &type)
Context *createContext(const QString &type) override
{
if ( type == "random" )
return new botanRandomContext( this );
@ -600,7 +600,7 @@ class botanPlugin : public QObject, public QCAPlugin
#endif
Q_INTERFACES(QCAPlugin)
public:
virtual QCA::Provider *createProvider() { return new botanProvider; }
QCA::Provider *createProvider() override { return new botanProvider; }
};
#include "qca-botan.moc"

@ -44,13 +44,13 @@ class saslProvider : public Provider
{
public:
saslProvider();
void init();
void init() override;
~saslProvider();
int qcaVersion() const;
QString name() const;
QString credit() const;
QStringList features() const;
Context *createContext(const QString &type);
int qcaVersion() const override;
QString name() const override;
QString credit() const override;
QStringList features() const override;
Context *createContext(const QString &type) override;
bool client_init;
bool server_init;
@ -581,23 +581,23 @@ public:
reset();
}
virtual Provider::Context *clone() const
Provider::Context *clone() const override
{
return 0;
}
virtual Result result() const
Result result() const override
{
return result_result;
}
virtual void reset()
void reset() override
{
resetState();
resetParams();
}
virtual void setup(const QString &_service, const QString &_host, const HostPort *local, const HostPort *remote, const QString &ext_id, int _ext_ssf)
void setup(const QString &_service, const QString &_host, const HostPort *local, const HostPort *remote, const QString &ext_id, int _ext_ssf) override
{
service = _service;
host = _host;
@ -607,12 +607,12 @@ public:
ext_ssf = _ext_ssf;
}
virtual int ssf() const
int ssf() const override
{
return result_ssf;
}
virtual void startClient(const QStringList &mechlist, bool allowClientSendFirst)
void startClient(const QStringList &mechlist, bool allowClientSendFirst) override
{
resetState();
@ -670,7 +670,7 @@ public:
}
// TODO: make use of disableServerSendLast
virtual void startServer(const QString &realm, bool disableServerSendLast)
void startServer(const QString &realm, bool disableServerSendLast) override
{
Q_UNUSED(disableServerSendLast);
resetState();
@ -721,7 +721,7 @@ public:
return;
}
virtual void serverFirstStep(const QString &mech, const QByteArray *clientInit)
void serverFirstStep(const QString &mech, const QByteArray *clientInit) override
{
in_mech = mech;
if(clientInit) {
@ -734,13 +734,13 @@ public:
doResultsReady();
}
virtual SASL::Params clientParams() const
SASL::Params clientParams() const override
{
SASLParams::SParams sparams = params.missing();
return SASL::Params(sparams.user, sparams.authzid, sparams.pass, sparams.realm);
}
virtual void setClientParams(const QString *user, const QString *authzid, const SecureArray *pass, const QString *realm)
void setClientParams(const QString *user, const QString *authzid, const SecureArray *pass, const QString *realm) override
{
if(user)
params.setUsername(*user);
@ -752,23 +752,23 @@ public:
params.setRealm(*realm);
}
virtual QString username() const
QString username() const override
{
return sc_username;
}
virtual QString authzid() const
QString authzid() const override
{
return sc_authzid;
}
virtual void nextStep(const QByteArray &from_net)
void nextStep(const QByteArray &from_net) override
{
in_buf = from_net;
tryAgain();
}
virtual void tryAgain()
void tryAgain() override
{
if(servermode)
serverTryAgain();
@ -777,7 +777,7 @@ public:
doResultsReady();
}
virtual QString mech() const
QString mech() const override
{
if (servermode)
return in_mech;
@ -785,18 +785,18 @@ public:
return out_mech;
}
virtual QStringList mechlist() const
QStringList mechlist() const override
{
return result_mechlist;
}
virtual QStringList realmlist() const
QStringList realmlist() const override
{
// TODO
return QStringList();
}
virtual void setConstraints(SASL::AuthFlags f, int minSSF, int maxSSF)
void setConstraints(SASL::AuthFlags f, int minSSF, int maxSSF) override
{
int sf = 0;
if( !(f & SASL::AllowPlain) )
@ -819,14 +819,14 @@ public:
ssf_max = maxSSF;
}
virtual bool waitForResultsReady(int msecs)
bool waitForResultsReady(int msecs) override
{
// TODO: for now, all operations block anyway
Q_UNUSED(msecs);
return true;
}
virtual void update(const QByteArray &from_net, const QByteArray &from_app)
void update(const QByteArray &from_net, const QByteArray &from_app) override
{
bool ok = true;
if(!from_app.isEmpty())
@ -841,36 +841,36 @@ public:
doResultsReady();
}
virtual bool haveClientInit() const
bool haveClientInit() const override
{
return result_haveClientInit;
}
virtual QByteArray stepData() const
QByteArray stepData() const override
{
return out_buf;
}
virtual QByteArray to_net()
QByteArray to_net() override
{
QByteArray a = result_to_net;
result_to_net.clear();
return a;
}
virtual int encoded() const
int encoded() const override
{
return result_encoded;
}
virtual QByteArray to_app()
QByteArray to_app() override
{
QByteArray a = result_plain;
result_plain.clear();
return a;
}
virtual SASL::AuthCondition authCondition() const
SASL::AuthCondition authCondition() const override
{
return result_authCondition;
}
@ -942,7 +942,7 @@ class saslPlugin : public QObject, public QCAPlugin
#endif
Q_INTERFACES(QCAPlugin)
public:
virtual Provider *createProvider() { return new saslProvider; }
Provider *createProvider() override { return new saslProvider; }
};
#include "qca-cyrus-sasl.moc"

@ -61,22 +61,22 @@ public:
gcry_md_close( context );
}
Context *clone() const
Context *clone() const override
{
return new gcryHashContext(*this);
}
void clear()
void clear() override
{
gcry_md_reset( context );
}
void update(const QCA::MemoryRegion &a)
void update(const QCA::MemoryRegion &a) override
{
gcry_md_write( context, a.data(), a.size() );
}
QCA::MemoryRegion final()
QCA::MemoryRegion final() override
{
unsigned char *md;
QCA::SecureArray a( gcry_md_get_algo_dlen( m_hashAlgorithm ) );
@ -110,12 +110,12 @@ public:
gcry_md_close( context );
}
void setup(const QCA::SymmetricKey &key)
void setup(const QCA::SymmetricKey &key) override
{
gcry_md_setkey( context, key.data(), key.size() );
}
Context *clone() const
Context *clone() const override
{
return new gcryHMACContext(*this);
}
@ -125,17 +125,17 @@ public:
gcry_md_reset( context );
}
QCA::KeyLength keyLength() const
QCA::KeyLength keyLength() const override
{
return anyKeyLength();
}
void update(const QCA::MemoryRegion &a)
void update(const QCA::MemoryRegion &a) override
{
gcry_md_write( context, a.data(), a.size() );
}
void final( QCA::MemoryRegion *out)
void final( QCA::MemoryRegion *out) override
{
QCA::SecureArray sa( gcry_md_get_algo_dlen( m_hashAlgorithm ), 0 );
unsigned char *md;
@ -164,7 +164,7 @@ public:
void setup(QCA::Direction dir,
const QCA::SymmetricKey &key,
const QCA::InitializationVector &iv,
const QCA::AuthTag &tag)
const QCA::AuthTag &tag) override
{
Q_UNUSED(tag);
m_direction = dir;
@ -185,25 +185,25 @@ public:
check_error( "gcry_cipher_setiv", err );
}
Context *clone() const
Context *clone() const override
{
return new gcryCipherContext( *this );
}
int blockSize() const
int blockSize() const override
{
unsigned int blockSize;
gcry_cipher_algo_info( m_cryptoAlgorithm, GCRYCTL_GET_BLKLEN, 0, (size_t*)&blockSize );
return blockSize;
}
QCA::AuthTag tag() const
QCA::AuthTag tag() const override
{
// For future implementation
return QCA::AuthTag();
}
bool update(const QCA::SecureArray &in, QCA::SecureArray *out)
bool update(const QCA::SecureArray &in, QCA::SecureArray *out) override
{
QCA::SecureArray result( in.size() );
if (QCA::Encode == m_direction) {
@ -217,7 +217,7 @@ public:
return true;
}
bool final(QCA::SecureArray *out)
bool final(QCA::SecureArray *out) override
{
QCA::SecureArray result;
if (m_pad) {
@ -235,7 +235,7 @@ public:
return true;
}
QCA::KeyLength keyLength() const
QCA::KeyLength keyLength() const override
{
switch (m_cryptoAlgorithm)
{
@ -288,13 +288,13 @@ public:
gcry_md_close( context );
}
Context *clone() const
Context *clone() const override
{
return new pbkdf1Context( *this );
}
QCA::SymmetricKey makeKey(const QCA::SecureArray &secret, const QCA::InitializationVector &salt,
unsigned int keyLength, unsigned int iterationCount)
unsigned int keyLength, unsigned int iterationCount) override
{
/* from RFC2898:
Steps:
@ -347,7 +347,7 @@ public:
const QCA::InitializationVector &salt,
unsigned int keyLength,
int msecInterval,
unsigned int *iterationCount)
unsigned int *iterationCount) override
{
Q_ASSERT(iterationCount != NULL);
QTime timer;
@ -421,13 +421,13 @@ public:
m_algorithm = algorithm;
}
Context *clone() const
Context *clone() const override
{
return new pbkdf2Context( *this );
}
QCA::SymmetricKey makeKey(const QCA::SecureArray &secret, const QCA::InitializationVector &salt,
unsigned int keyLength, unsigned int iterationCount)
unsigned int keyLength, unsigned int iterationCount) override
{
QCA::SymmetricKey result(keyLength);
gcry_error_t retval = gcry_pbkdf2(m_algorithm, secret.data(), secret.size(),
@ -445,7 +445,7 @@ public:
const QCA::InitializationVector &salt,
unsigned int keyLength,
int msecInterval,
unsigned int *iterationCount)
unsigned int *iterationCount) override
{
Q_ASSERT(iterationCount != NULL);
QCA::SymmetricKey result(keyLength);
@ -507,7 +507,7 @@ int qca_func_secure_check (const void *)
class gcryptProvider : public QCA::Provider
{
public:
void init()
void init() override
{
if (!gcry_control (GCRYCTL_ANY_INITIALIZATION_P))
{ /* No other library has already initialized libgcrypt. */
@ -526,17 +526,17 @@ public:
}
}
int qcaVersion() const
int qcaVersion() const override
{
return QCA_VERSION;
}
QString name() const
QString name() const override
{
return "qca-gcrypt";
}
QStringList features() const
QStringList features() const override
{
QStringList list;
list += "sha1";
@ -591,7 +591,7 @@ public:
return list;
}
Context *createContext(const QString &type)
Context *createContext(const QString &type) override
{
// std::cout << "type: " << qPrintable(type) << std::endl;
if ( type == "sha1" )
@ -689,7 +689,7 @@ class gcryptPlugin : public QObject, public QCAPlugin
#endif
Q_INTERFACES(QCAPlugin)
public:
virtual QCA::Provider *createProvider() { return new gcryptProvider; }
QCA::Provider *createProvider() override { return new gcryptProvider; }
};
#include "qca-gcrypt.moc"

@ -35,7 +35,7 @@ public:
void setInheritPipeList(const QList<int> &);
protected:
virtual void setupChildProcess();
void setupChildProcess() override;
private:
QList<int> pipeList;

@ -37,17 +37,17 @@ public:
~MyKeyStoreEntry();
// reimplemented Provider::Context
QCA::Provider::Context *clone() const;
QCA::Provider::Context *clone() const override;
// reimplemented KeyStoreEntryContext
QCA::KeyStoreEntry::Type type() const;
QString name() const;
QString id() const;
QString storeId() const;
QString storeName() const;
QCA::PGPKey pgpSecretKey() const;
QCA::PGPKey pgpPublicKey() const;
QString serialize() const;
QCA::KeyStoreEntry::Type type() const override;
QString name() const override;
QString id() const override;
QString storeId() const override;
QString storeName() const override;
QCA::PGPKey pgpSecretKey() const override;
QCA::PGPKey pgpPublicKey() const override;
QString serialize() const override;
};
} // end namespace gpgQCAPlugin

@ -44,24 +44,24 @@ public:
~MyKeyStoreList();
// reimplemented Provider::Context
QCA::Provider::Context *clone() const;
QCA::Provider::Context *clone() const override;
// reimplemented KeyStoreListContext
QString name(int) const;
QCA::KeyStore::Type type(int) const;
QString storeId(int) const;
QList<int> keyStores();
QString name(int) const override;
QCA::KeyStore::Type type(int) const override;
QString storeId(int) const override;
QList<int> keyStores() override;
void start();
void start() override;
bool isReadOnly(int) const;
bool isReadOnly(int) const override;
QList<QCA::KeyStoreEntry::Type> entryTypes(int) const;
QList<QCA::KeyStoreEntryContext*> entryList(int);
QCA::KeyStoreEntryContext *entry(int, const QString &entryId);
QCA::KeyStoreEntryContext *entryPassive(const QString &serialized);
QString writeEntry(int, const QCA::PGPKey &key);
bool removeEntry(int, const QString &entryId);
QList<QCA::KeyStoreEntry::Type> entryTypes(int) const override;
QList<QCA::KeyStoreEntryContext*> entryList(int) override;
QCA::KeyStoreEntryContext *entry(int, const QString &entryId) override;
QCA::KeyStoreEntryContext *entryPassive(const QString &serialized) override;
QString writeEntry(int, const QCA::PGPKey &key) override;
bool removeEntry(int, const QString &entryId) override;
static MyKeyStoreList *instance();
void ext_keyStoreLog(const QString &str);

@ -52,28 +52,28 @@ public:
MyMessageContext(MyOpenPGPContext *_sms, QCA::Provider *p);
// reimplemented Provider::Context
QCA::Provider::Context *clone() const;
QCA::Provider::Context *clone() const override;
// reimplemented MessageContext
bool canSignMultiple() const;
QCA::SecureMessage::Type type() const;
void reset();
void setupEncrypt(const QCA::SecureMessageKeyList &keys);
void setupSign(const QCA::SecureMessageKeyList &keys, QCA::SecureMessage::SignMode m, bool, bool);
void setupVerify(const QByteArray &detachedSig);
void start(QCA::SecureMessage::Format f, QCA::MessageContext::Operation op);
void update(const QByteArray &in);
QByteArray read();
int written();
void end();
bool finished() const;
bool waitForFinished(int msecs);
bool success() const;
QCA::SecureMessage::Error errorCode() const;
QByteArray signature() const;
QString hashName() const;
QCA::SecureMessageSignatureList signers() const;
QString diagnosticText() const;
bool canSignMultiple() const override;
QCA::SecureMessage::Type type() const override;
void reset() override;
void setupEncrypt(const QCA::SecureMessageKeyList &keys) override;
void setupSign(const QCA::SecureMessageKeyList &keys, QCA::SecureMessage::SignMode m, bool, bool) override;
void setupVerify(const QByteArray &detachedSig) override;
void start(QCA::SecureMessage::Format f, QCA::MessageContext::Operation op) override;
void update(const QByteArray &in) override;
QByteArray read() override;
int written() override;
void end() override;
bool finished() const override;
bool waitForFinished(int msecs) override;
bool success() const override;
QCA::SecureMessage::Error errorCode() const override;
QByteArray signature() const override;
QString hashName() const override;
QCA::SecureMessageSignatureList signers() const override;
QString diagnosticText() const override;
void seterror();
void complete();

@ -29,10 +29,10 @@ public:
MyOpenPGPContext(QCA::Provider *p);
// reimplemented Provider::Context
QCA::Provider::Context *clone() const;
QCA::Provider::Context *clone() const override;
// reimplemented SMSContext
QCA::MessageContext *createMessage();
QCA::MessageContext *createMessage() override;
};

@ -38,16 +38,16 @@ public:
MyPGPKeyContext(QCA::Provider *p);
// reimplemented Provider::Context
QCA::Provider::Context *clone() const;
QCA::Provider::Context *clone() const override;
// reimplemented PGPKeyContext
const QCA::PGPKeyContextProps *props() const;
const QCA::PGPKeyContextProps *props() const override;
QByteArray toBinary() const;
QCA::ConvertResult fromBinary(const QByteArray &a);
QByteArray toBinary() const override;
QCA::ConvertResult fromBinary(const QByteArray &a) override;
QString toAscii() const;
QCA::ConvertResult fromAscii(const QString &s);
QString toAscii() const override;
QCA::ConvertResult fromAscii(const QString &s) override;
void set(const GpgOp::Key &i, bool isSecret, bool inKeyring, bool isTrusted);
static void cleanup_temp_keyring(const QString &name);

@ -27,21 +27,21 @@ using namespace gpgQCAPlugin;
class gnupgProvider : public QCA::Provider
{
public:
virtual void init()
void init() override
{
}
virtual int qcaVersion() const
int qcaVersion() const override
{
return QCA_VERSION;
}
virtual QString name() const
QString name() const override
{
return "qca-gnupg";
}
virtual QStringList features() const
QStringList features() const override
{
QStringList list;
list += "pgpkey";
@ -50,7 +50,7 @@ public:
return list;
}
virtual Context *createContext(const QString &type)
Context *createContext(const QString &type) override
{
if(type == "pgpkey")
return new MyPGPKeyContext(this);
@ -71,7 +71,7 @@ class gnupgPlugin : public QObject, public QCAPlugin
#endif
Q_INTERFACES(QCAPlugin)
public:
virtual QCA::Provider *createProvider() { return new gnupgProvider; }
QCA::Provider *createProvider() override { return new gnupgProvider; }
};
#include "qca-gnupg.moc"

@ -42,12 +42,12 @@ public:
QCA::logger()->unregisterLogDevice (name ());
}
void logTextMessage( const QString &message, enum QCA::Logger::Severity severity )
void logTextMessage( const QString &message, enum QCA::Logger::Severity severity ) override
{
_stream << now () << " " << severityName (severity) << " " << message << endl;
}
void logBinaryMessage( const QByteArray &blob, enum QCA::Logger::Severity severity )
void logBinaryMessage( const QByteArray &blob, enum QCA::Logger::Severity severity ) override
{
Q_UNUSED(blob);
_stream << now () << " " << severityName (severity) << " " << "Binary blob not implemented yet" << endl;
@ -123,42 +123,36 @@ public:
}
public:
virtual
int
qcaVersion() const {
qcaVersion() const override {
return QCA_VERSION;
}
virtual
void
init () {}
init () override {}
virtual
QString
name () const {
name () const override {
return "qca-logger";
}
virtual
QStringList
features () const {
features () const override {
QStringList list;
list += "log";
return list;
}
virtual
Context *
createContext (
const QString &type
) {
) override {
Q_UNUSED(type);
return NULL;
}
virtual
QVariantMap
defaultConfig () const {
defaultConfig () const override {
QVariantMap mytemplate;
mytemplate["formtype"] = "http://affinix.com/qca/forms/qca-logger#1.0";
@ -169,9 +163,8 @@ public:
return mytemplate;
}
virtual
void
configChanged (const QVariantMap &config) {
configChanged (const QVariantMap &config) override {
if (!_externalConfig) {
delete _streamLogger;
_streamLogger = NULL;
@ -217,7 +210,7 @@ class loggerPlugin : public QObject, public QCAPlugin
Q_INTERFACES(QCAPlugin)
public:
virtual Provider *createProvider() { return new loggerProvider; }
Provider *createProvider() override { return new loggerProvider; }
};
#include "qca-logger.moc"

@ -90,12 +90,12 @@ public:
PK11_FreeSlot(m_slot);
}
Context *clone() const
Context *clone() const override
{
return new nssHashContext(*this);
}
void clear()
void clear() override
{
SECStatus s;
@ -114,12 +114,12 @@ public:
}
}
void update(const QCA::MemoryRegion &a)
void update(const QCA::MemoryRegion &a) override
{
PK11_DigestOp(m_context, (const unsigned char*)a.data(), a.size());
}
QCA::MemoryRegion final()
QCA::MemoryRegion final() override
{
unsigned int len = 0;
QCA::SecureArray a( 64 );
@ -186,7 +186,7 @@ public:
PK11_FreeSlot(m_slot);
}
Context *clone() const
Context *clone() const override
{
return new nssHmacContext(*this);
}
@ -212,12 +212,12 @@ public:
}
}
QCA::KeyLength keyLength() const
QCA::KeyLength keyLength() const override
{
return anyKeyLength();
}
void setup(const QCA::SymmetricKey &key)
void setup(const QCA::SymmetricKey &key) override
{
/* turn the raw key into a SECItem */
SECItem keyItem;
@ -243,12 +243,12 @@ public:
}
}
void update(const QCA::MemoryRegion &a)
void update(const QCA::MemoryRegion &a) override
{
PK11_DigestOp(m_context, (const unsigned char*)a.data(), a.size());
}
void final( QCA::MemoryRegion *out)
void final( QCA::MemoryRegion *out) override
{
// NSS doesn't appear to be able to tell us how big the digest will
// be for a given algorithm until after we finalise it, so we work
@ -307,7 +307,7 @@ public:
void setup(QCA::Direction dir,
const QCA::SymmetricKey &key,
const QCA::InitializationVector &iv,
const QCA::AuthTag &tag)
const QCA::AuthTag &tag) override
{
Q_UNUSED(tag);
/* Get a slot to use for the crypto operations */
@ -357,23 +357,23 @@ public:
}
}
QCA::Provider::Context *clone() const
QCA::Provider::Context *clone() const override
{
return new nssCipherContext(*this);
}
int blockSize() const
int blockSize() const override
{
return PK11_GetBlockSize( m_cipherMechanism, m_params);
}
QCA::AuthTag tag() const
QCA::AuthTag tag() const override
{
// For future implementation
return QCA::AuthTag();
}
bool update( const QCA::SecureArray &in, QCA::SecureArray *out )
bool update( const QCA::SecureArray &in, QCA::SecureArray *out ) override
{
out->resize(in.size()+blockSize());
int resultLength;
@ -386,7 +386,7 @@ public:
return true;
}
bool final( QCA::SecureArray *out )
bool final( QCA::SecureArray *out ) override
{
out->resize(blockSize());
unsigned int resultLength;
@ -398,7 +398,7 @@ public:
return true;
}
QCA::KeyLength keyLength() const
QCA::KeyLength keyLength() const override
{
int min = 0;
int max = 0;
@ -441,7 +441,7 @@ private:
class nssProvider : public QCA::Provider
{
public:
void init()
void init() override
{
}
@ -449,17 +449,17 @@ public:
{
}
int qcaVersion() const
int qcaVersion() const override
{
return QCA_VERSION;
}
QString name() const
QString name() const override
{
return "qca-nss";
}
QStringList features() const
QStringList features() const override
{
QStringList list;
@ -488,7 +488,7 @@ public:
return list;
}
Context *createContext(const QString &type)
Context *createContext(const QString &type) override
{
if ( type == "md2" )
return new nssHashContext( this, type );
@ -541,7 +541,7 @@ class nssPlugin : public QObject, public QCAPlugin
#endif
Q_INTERFACES( QCAPlugin )
public:
virtual QCA::Provider *createProvider() { return new nssProvider; }
QCA::Provider *createProvider() override { return new nssProvider; }
};
#include "qca-nss.moc"

File diff suppressed because it is too large Load Diff

@ -69,31 +69,25 @@ public:
~pkcs11Provider ();
public:
virtual
int
qcaVersion() const;
qcaVersion() const override;
virtual
void
init ();
init () override;
virtual
void
deinit ();
deinit () override;
virtual
QString
name () const;
name () const override;
virtual
QStringList
features () const;
features () const override;
virtual
Context *
createContext (
const QString &type
);
) override;
void
startSlotEvents ();
@ -101,13 +95,11 @@ public:
void
stopSlotEvents ();
virtual
QVariantMap
defaultConfig () const;
defaultConfig () const override;
virtual
void
configChanged (const QVariantMap &config);
configChanged (const QVariantMap &config) override;
protected:
static
@ -247,55 +239,44 @@ public:
~pkcs11KeyStoreListContext ();
virtual
Provider::Context *
clone () const;
clone () const override;
public:
virtual
void
start ();
start () override;
virtual
void
setUpdatesEnabled (bool enabled);
setUpdatesEnabled (bool enabled) override;
virtual
KeyStoreEntryContext *
entry (
int id,
const QString &entryId
);
) override;
virtual
KeyStoreEntryContext *
entryPassive (
const QString &serialized
);
) override;
virtual
KeyStore::Type
type (int id) const;
type (int id) const override;
virtual
QString
storeId (int id) const;
storeId (int id) const override;
virtual
QString
name (int id) const;
name (int id) const override;
virtual
QList<KeyStoreEntry::Type>
entryTypes (int id) const;
entryTypes (int id) const override;
virtual
QList<int>
keyStores ();
keyStores () override;
virtual
QList<KeyStoreEntryContext *>
entryList (int id);
entryList (int id) override;
bool
_tokenPrompt (
@ -527,40 +508,34 @@ public:
);
}
virtual
Provider::Context *
clone () const {
clone () const override {
return new pkcs11RSAContext (*this);
}
public:
virtual
bool
isNull () const {
isNull () const override {
return _pubkey.isNull ();
}
virtual
PKey::Type
type () const {
type () const override {
return _pubkey.type ();
}
virtual
bool
isPrivate () const {
isPrivate () const override {
return _has_privateKeyRole;
}
virtual
bool
canExport () const {
canExport () const override {
return !_has_privateKeyRole;
}
virtual
void
convertToPublic () {
convertToPublic () override {
QCA_logTextMessage (
"pkcs11RSAContext::convertToPublic - entry",
Logger::Debug
@ -580,36 +555,32 @@ public:
);
}
virtual
int
bits () const {
bits () const override {
return _pubkey.bitSize ();
}
virtual
int
maximumEncryptSize (
EncryptionAlgorithm alg
) const {
) const override {
return _pubkey.maximumEncryptSize (alg);
}
virtual
SecureArray
encrypt (
const SecureArray &in,
EncryptionAlgorithm alg
) {
) override {
return _pubkey.encrypt (in, alg);
}
virtual
bool
decrypt (
const SecureArray &in,
SecureArray *out,
EncryptionAlgorithm alg
) {
) override {
bool session_locked = false;
bool ret = false;
@ -721,12 +692,11 @@ public:
return ret;
}
virtual
void
startSign (
SignatureAlgorithm alg,
SignatureFormat
) {
) override {
_clearSign ();
_sign_data.alg = alg;
@ -758,20 +728,18 @@ public:
}
}
virtual
void
startVerify (
SignatureAlgorithm alg,
SignatureFormat sf
) {
) override {
_pubkey.startVerify (alg, sf);
}
virtual
void
update (
const MemoryRegion &in
) {
) override {
if (_has_privateKeyRole) {
if (_sign_data.hash != NULL) {
_sign_data.hash->update (in);
@ -785,9 +753,8 @@ public:
}
}
virtual
QByteArray
endSign () {
endSign () override {
QByteArray result;
bool session_locked = false;
@ -913,19 +880,17 @@ public:
return _pubkey.validSignature (sig);
}
virtual
void
createPrivate (
int bits,
int exp,
bool block
) {
) override {
Q_UNUSED(bits);
Q_UNUSED(exp);
Q_UNUSED(block);
}
virtual
void
createPrivate (
const BigInteger &n,
@ -933,7 +898,7 @@ public:
const BigInteger &p,
const BigInteger &q,
const BigInteger &d
) {
) override {
Q_UNUSED(n);
Q_UNUSED(e);
Q_UNUSED(p);
@ -941,43 +906,37 @@ public:
Q_UNUSED(d);
}
virtual
void
createPublic (
const BigInteger &n,
const BigInteger &e
) {
) override {
Q_UNUSED(n);
Q_UNUSED(e);
}
virtual
BigInteger
n () const {
n () const override {
return _pubkey.n ();
}
virtual
BigInteger
e () const {
e () const override {
return _pubkey.e ();
}
virtual
BigInteger
p () const {
p () const override {
return BigInteger();
}
virtual
BigInteger
q () const {
q () const override {
return BigInteger();
}
virtual
BigInteger
d () const {
d () const override {
return BigInteger();
}
@ -1097,62 +1056,54 @@ public:
_k = NULL;
}
virtual
Provider::Context *
clone () const {
clone () const override {
pkcs11PKeyContext *c = new pkcs11PKeyContext (*this);
c->_k = (PKeyBase *)_k->clone();
return c;
}
public:
virtual
QList<PKey::Type>
supportedTypes () const {
supportedTypes () const override {
QList<PKey::Type> list;
list += PKey::RSA;
return list;
}
virtual
QList<PKey::Type>
supportedIOTypes () const {
supportedIOTypes () const override {
QList<PKey::Type> list;
list += PKey::RSA;
return list;
}
virtual
QList<PBEAlgorithm>
supportedPBEAlgorithms () const {
supportedPBEAlgorithms () const override {
QList<PBEAlgorithm> list;
return list;
}
virtual
PKeyBase *
key () {
key () override {
return _k;
}
virtual
const PKeyBase *
key () const {
key () const override {
return _k;
}
virtual
void
setKey (PKeyBase *key) {
setKey (PKeyBase *key) override {
delete _k;
_k = key;
}
virtual
bool
importKey (
const PKeyBase *key
) {
) override {
Q_UNUSED(key);
return false;
}
@ -1172,75 +1123,67 @@ public:
return 0;
}
virtual
QByteArray
publicToDER () const {
publicToDER () const override {
return static_cast<pkcs11RSAContext *>(_k)->_publicKey ().toDER ();
}
virtual
QString
publicToPEM () const {
publicToPEM () const override {
return static_cast<pkcs11RSAContext *>(_k)->_publicKey ().toPEM ();
}
virtual
ConvertResult
publicFromDER (
const QByteArray &in
) {
) override {
Q_UNUSED(in);
return ErrorDecode;
}
virtual
ConvertResult
publicFromPEM (
const QString &s
) {
) override {
Q_UNUSED(s);
return ErrorDecode;
}
virtual
SecureArray
privateToDER(
const SecureArray &passphrase,
PBEAlgorithm pbe
) const {
) const override {
Q_UNUSED(passphrase);
Q_UNUSED(pbe);
return SecureArray ();
}
virtual
QString
privateToPEM (
const SecureArray &passphrase,
PBEAlgorithm pbe
) const {
) const override {
Q_UNUSED(passphrase);
Q_UNUSED(pbe);
return QString ();
}
virtual
ConvertResult
privateFromDER (
const SecureArray &in,
const SecureArray &passphrase
) {
) override {
Q_UNUSED(in);
Q_UNUSED(passphrase);
return ErrorDecode;
}
virtual
ConvertResult
privateFromPEM (
const QString &s,
const SecureArray &passphrase
) {
) override {
Q_UNUSED(s);
Q_UNUSED(passphrase);
return ErrorDecode;
@ -1309,70 +1252,59 @@ public:
_name = from._name;
}
virtual
Provider::Context *
clone () const {
clone () const override {
return new pkcs11KeyStoreEntryContext (*this);
}
public:
virtual
KeyStoreEntry::Type
type () const {
type () const override {
return _item_type;
}
virtual
QString
name () const {
name () const override {
return _name;
}
virtual
QString
id () const {
id () const override {
return _id;
}
virtual
KeyBundle
keyBundle () const {
keyBundle () const override {
return _key;
}
virtual
Certificate
certificate () const {
certificate () const override {
return _cert;
}
virtual
QString
storeId () const {
storeId () const override {
return _storeId;
}
virtual
QString
storeName () const {
storeName () const override {
return _storeName;
}
virtual
bool
isAvailable() const {
isAvailable() const override {
return static_cast<pkcs11RSAContext *>(static_cast<PKeyContext *>(_key.privateKey ().context ())->key ())->_isTokenAvailable ();
}
virtual
bool
ensureAccess () {
ensureAccess () override {
return static_cast<pkcs11RSAContext *>(static_cast<PKeyContext *>(_key.privateKey ().context ())->key ())->_ensureTokenAccess ();
}
virtual
QString
serialize () const {
serialize () const override {
return _serialized;
}
};
@ -3103,7 +3035,7 @@ class pkcs11Plugin : public QObject, public QCAPlugin
Q_INTERFACES(QCAPlugin)
public:
virtual Provider *createProvider() { return new pkcs11Provider; }
Provider *createProvider() override { return new pkcs11Provider; }
};
#include "qca-pkcs11.moc"

@ -132,40 +132,34 @@ public:
);
}
virtual
Provider::Context *
clone () const {
clone () const override {
return new softstorePKeyBase (*this);
}
public:
virtual
bool
isNull () const {
isNull () const override {
return _pubkey.isNull ();
}
virtual
PKey::Type
type () const {
type () const override {
return _pubkey.type ();
}
virtual
bool
isPrivate () const {
isPrivate () const override {
return _has_privateKeyRole;
}
virtual
bool
canExport () const {
canExport () const override {
return !_has_privateKeyRole;
}
virtual
void
convertToPublic () {
convertToPublic () override {
QCA_logTextMessage (
"softstorePKeyBase::convertToPublic - entry",
Logger::Debug
@ -181,36 +175,32 @@ public:
);
}
virtual
int
bits () const {
bits () const override {
return _pubkey.bitSize ();
}
virtual
int
maximumEncryptSize (
EncryptionAlgorithm alg
) const {
) const override {
return _pubkey.maximumEncryptSize (alg);
}
virtual
SecureArray
encrypt (
const SecureArray &in,
EncryptionAlgorithm alg
) {
) override {
return _pubkey.encrypt (in, alg);
}
virtual
bool
decrypt (
const SecureArray &in,
SecureArray *out,
EncryptionAlgorithm alg
) {
) override {
if (_ensureAccess ()) {
return _privkey.decrypt (in, out, alg);
}
@ -219,12 +209,11 @@ public:
}
}
virtual
void
startSign (
SignatureAlgorithm alg,
SignatureFormat format
) {
) override {
if (_ensureAccess ()) {
/*
* We must use one object thought
@ -236,20 +225,18 @@ public:
}
}
virtual
void
startVerify (
SignatureAlgorithm alg,
SignatureFormat sf
) {
) override {
_pubkey.startVerify (alg, sf);
}
virtual
void
update (
const MemoryRegion &in
) {
) override {
if (_has_privateKeyRole) {
_privkeySign.update (in);
}
@ -258,9 +245,8 @@ public:
}
}
virtual
QByteArray
endSign () {
endSign () override {
QByteArray r = _privkeySign.signature ();
_privkeySign = PrivateKey ();
return r;
@ -503,62 +489,54 @@ public:
_k = NULL;
}
virtual
Provider::Context *
clone () const {
clone () const override {
softstorePKeyContext *c = new softstorePKeyContext (*this);
c->_k = (PKeyBase *)_k->clone();
return c;
}
public:
virtual
QList<PKey::Type>
supportedTypes () const {
supportedTypes () const override {
QList<PKey::Type> list;
list += static_cast<softstorePKeyBase *>(_k)->_publicKey ().type ();
return list;
}
virtual
QList<PKey::Type>
supportedIOTypes () const {
supportedIOTypes () const override {
QList<PKey::Type> list;
list += static_cast<softstorePKeyBase *>(_k)->_publicKey ().type ();
return list;
}
virtual
QList<PBEAlgorithm>
supportedPBEAlgorithms () const {
supportedPBEAlgorithms () const override {
QList<PBEAlgorithm> list;
return list;
}
virtual
PKeyBase *
key () {
key () override {
return _k;
}
virtual
const PKeyBase *
key () const {
key () const override {
return _k;
}
virtual
void
setKey (PKeyBase *key) {
setKey (PKeyBase *key) override {
delete _k;
_k = key;
}
virtual
bool
importKey (
const PKeyBase *key
) {
) override {
Q_UNUSED(key);
return false;
}
@ -578,75 +556,67 @@ public:
return 0;
}
virtual
QByteArray
publicToDER () const {
publicToDER () const override {
return static_cast<softstorePKeyBase *>(_k)->_publicKey ().toDER ();
}
virtual
QString
publicToPEM () const {
publicToPEM () const override {
return static_cast<softstorePKeyBase *>(_k)->_publicKey ().toPEM ();
}
virtual
ConvertResult
publicFromDER (
const QByteArray &in
) {
) override {
Q_UNUSED(in);
return ErrorDecode;
}
virtual
ConvertResult
publicFromPEM (
const QString &s
) {
) override {
Q_UNUSED(s);
return ErrorDecode;
}
virtual
SecureArray
privateToDER(
const SecureArray &passphrase,
PBEAlgorithm pbe
) const {
) const override {
Q_UNUSED(passphrase);
Q_UNUSED(pbe);
return SecureArray ();
}
virtual
QString
privateToPEM (
const SecureArray &passphrase,
PBEAlgorithm pbe
) const {
) const override {
Q_UNUSED(passphrase);
Q_UNUSED(pbe);
return QString ();
}
virtual
ConvertResult
privateFromDER (
const SecureArray &in,
const SecureArray &passphrase
) {
) override {
Q_UNUSED(in);
Q_UNUSED(passphrase);
return ErrorDecode;
}
virtual
ConvertResult
privateFromPEM (
const QString &s,
const SecureArray &passphrase
) {
) override {
Q_UNUSED(s);
Q_UNUSED(passphrase);
return ErrorDecode;
@ -683,64 +653,54 @@ public:
_serialized = from._serialized;
}
virtual
Provider::Context *
clone () const {
clone () const override {
return new softstoreKeyStoreEntryContext (*this);
}
public:
virtual
KeyStoreEntry::Type
type () const {
type () const override {
return KeyStoreEntry::TypeKeyBundle;
}
virtual
QString
name () const {
name () const override {
return _entry.name;
}
virtual
QString
id () const {
id () const override {
return _entry.name;
}
virtual
KeyBundle
keyBundle () const {
keyBundle () const override {
return _key;
}
virtual
Certificate
certificate () const {
certificate () const override {
return _entry.chain.primary ();
}
virtual
QString
storeId () const {
storeId () const override {
return QString ().sprintf ("%s/%s", "qca-softstore", myPrintable (_entry.name));
}
virtual
QString
storeName () const {
storeName () const override {
return _entry.name;
}
virtual
bool
ensureAccess () {
ensureAccess () override {
return static_cast<softstorePKeyBase *>(static_cast<PKeyContext *>(_key.privateKey ().context ())->key ())->_ensureAccess ();
}
virtual
QString
serialize () const {
serialize () const override {
return _serialized;
}
};
@ -785,9 +745,8 @@ public:
);
}
virtual
Provider::Context *
clone () const {
clone () const override {
QCA_logTextMessage (
"softstoreKeyStoreListContext::clone - entry/return",
Logger::Debug
@ -796,9 +755,8 @@ public:
}
public:
virtual
void
start () {
start () override {
QCA_logTextMessage (
"softstoreKeyStoreListContext::start - entry",
Logger::Debug
@ -812,9 +770,8 @@ public:
);
}
virtual
void
setUpdatesEnabled (bool enabled) {
setUpdatesEnabled (bool enabled) override {
QCA_logTextMessage (
QString ().sprintf (
"softstoreKeyStoreListContext::setUpdatesEnabled - entry/return enabled=%d",
@ -824,12 +781,11 @@ public:
);
}
virtual
KeyStoreEntryContext *
entry (
int id,
const QString &entryId
) {
) override {
QCA_logTextMessage (
QString ().sprintf (
"softstoreKeyStoreListContext::entry - entry/return id=%d entryId='%s'",
@ -844,11 +800,10 @@ public:
return NULL;
}
virtual
KeyStoreEntryContext *
entryPassive (
const QString &serialized
) {
) override {
KeyStoreEntryContext *entry = NULL;
QCA_logTextMessage (
@ -878,9 +833,8 @@ public:
return entry;
}
virtual
KeyStore::Type
type (int id) const {
type (int id) const override {
Q_UNUSED(id);
QCA_logTextMessage (
@ -894,9 +848,8 @@ public:
return KeyStore::User;
}
virtual
QString
storeId (int id) const {
storeId (int id) const override {
QString ret;
QCA_logTextMessage (
@ -920,9 +873,8 @@ public:
return ret;
}
virtual
QString
name (int id) const {
name (int id) const override {
QString ret;
QCA_logTextMessage (
@ -946,9 +898,8 @@ public:
return ret;
}
virtual
QList<KeyStoreEntry::Type>
entryTypes (int id) const {
entryTypes (int id) const override {
Q_UNUSED(id);
QCA_logTextMessage (
@ -965,9 +916,8 @@ public:
return list;
}
virtual
QList<int>
keyStores () {
keyStores () override {
QList<int> list;
QCA_logTextMessage (
@ -988,9 +938,8 @@ public:
return list;
}
virtual
QList<KeyStoreEntryContext *>
entryList (int id) {
entryList (int id) override {
QList<KeyStoreEntryContext*> list;
QCA_logTextMessage (
@ -1386,26 +1335,22 @@ public:
}
public:
virtual
int
qcaVersion() const {
qcaVersion() const override {
return QCA_VERSION;
}
virtual
void
init () {
init () override {
}
virtual
QString
name () const {
name () const override {
return "qca-softstore";
}
virtual
QStringList
features () const {
features () const override {
QCA_logTextMessage (
"softstoreProvider::features - entry/return",
Logger::Debug
@ -1417,11 +1362,10 @@ public:
return list;
}
virtual
Context *
createContext (
const QString &type
) {
) override {
Provider::Context *context = NULL;
QCA_logTextMessage (
@ -1451,9 +1395,8 @@ public:
return context;
}
virtual
QVariantMap
defaultConfig () const {
defaultConfig () const override {
QVariantMap mytemplate;
QCA_logTextMessage (
@ -1476,9 +1419,8 @@ public:
return mytemplate;
}
virtual
void
configChanged (const QVariantMap &config) {
configChanged (const QVariantMap &config) override {
QCA_logTextMessage (
"softstoreProvider::configChanged - entry",
@ -1509,7 +1451,7 @@ class softstorePlugin : public QObject, public QCAPlugin
Q_INTERFACES(QCAPlugin)
public:
virtual Provider *createProvider() { return new softstoreProvider; }
Provider *createProvider() override { return new softstoreProvider; }
};
#include "qca-softstore.moc"

@ -46,10 +46,10 @@ class Malloc_Allocator : public Pooling_Allocator
{
public:
Malloc_Allocator() : Pooling_Allocator(64*1024, false) {}
std::string type() const { return "malloc"; }
std::string type() const override { return "malloc"; }
private:
void* alloc_block(u32bit);
void dealloc_block(void*, u32bit);
void* alloc_block(u32bit) override;
void dealloc_block(void*, u32bit) override;
};
/*************************************************
@ -59,10 +59,10 @@ class Locking_Allocator : public Pooling_Allocator
{
public:
Locking_Allocator() : Pooling_Allocator(64*1024, true) {}
std::string type() const { return "locking"; }
std::string type() const override { return "locking"; }
private:
void* alloc_block(u32bit);
void dealloc_block(void*, u32bit);
void* alloc_block(u32bit) override;
void dealloc_block(void*, u32bit) override;
};
}

@ -51,7 +51,7 @@ namespace Botan {
class Exception : public std::exception
{
public:
const char* what() const throw() { return msg.c_str(); }
const char* what() const throw() override { return msg.c_str(); }
Exception(const std::string& m = "Unknown error") { set_msg(m); }
virtual ~Exception() throw() {}
protected:

@ -57,10 +57,10 @@ namespace Botan {
class Pooling_Allocator : public Allocator
{
public:
void* allocate(u32bit);
void deallocate(void*, u32bit);
void* allocate(u32bit) override;
void deallocate(void*, u32bit) override;
void destroy();
void destroy() override;
Pooling_Allocator(u32bit, bool);
~Pooling_Allocator() QCA_NOEXCEPT(false);

@ -46,10 +46,10 @@ class MemoryMapping_Allocator : public Pooling_Allocator
{
public:
MemoryMapping_Allocator() : Pooling_Allocator(64*1024, false) {}
std::string type() const { return "mmap"; }
std::string type() const override { return "mmap"; }
private:
void* alloc_block(u32bit);
void dealloc_block(void*, u32bit);
void* alloc_block(u32bit) override;
void dealloc_block(void*, u32bit) override;
};
}

@ -76,15 +76,15 @@ class Modules
class Builtin_Modules : public Modules
{
public:
class Mutex_Factory* mutex_factory() const;
class Mutex_Factory* mutex_factory() const override;
#ifndef BOTAN_TOOLS_ONLY
class Timer* timer() const;
class Charset_Transcoder* transcoder() const;
#endif
std::string default_allocator() const;
std::string default_allocator() const override;
std::vector<class Allocator*> allocators() const;
std::vector<class Allocator*> allocators() const override;
#ifndef BOTAN_TOOLS_ONLY
std::vector<class EntropySource*> entropy_sources() const;
std::vector<class Engine*> engines() const;

@ -66,7 +66,7 @@ class Mutex_Factory
class Default_Mutex_Factory : public Mutex_Factory
{
public:
Mutex* make();
Mutex* make() override;
};
/*************************************************

@ -45,7 +45,7 @@ namespace Botan {
class Qt_Mutex_Factory : public Mutex_Factory
{
public:
Mutex* make();
Mutex* make() override;
};
}

@ -101,14 +101,14 @@ Mutex* Default_Mutex_Factory::make()
"Mutex is already " + where + "ed") {}
};
void lock()
void lock() override
{
if(locked)
throw Mutex_State_Error("lock");
locked = true;
}
void unlock()
void unlock() override
{
if(!locked)
throw Mutex_State_Error("unlock");

@ -51,8 +51,8 @@ Mutex* Qt_Mutex_Factory::make()
class Qt_Mutex : public Mutex
{
public:
void lock() { mutex.lock(); }
void unlock() { mutex.unlock(); }
void lock() override { mutex.lock(); }
void unlock() override { mutex.unlock(); }
private:
QMutex mutex;
};

@ -2837,7 +2837,7 @@ public:
}
protected:
virtual void run()
void run() override
{
if(in.type == PKPEMFile)
out.privateKey = PrivateKey::fromPEMFile(in.fileName, SecureArray(), &out.convertResult);

@ -1966,7 +1966,7 @@ public:
}
public slots:
virtual void ask(int id, const QCA::Event &e)
void ask(int id, const QCA::Event &e) override
{
activeIds += id;
emit q->eventReady(id, e);
@ -2086,7 +2086,7 @@ public:
asker_cancel(this);
}
virtual void set_accepted(const SecureArray &_password)
void set_accepted(const SecureArray &_password) override
{
QMutexLocker locker(&m);
accepted = true;
@ -2098,7 +2098,7 @@ public:
QMetaObject::invokeMethod(this, "emitResponseReady", Qt::QueuedConnection);
}
virtual void set_rejected()
void set_rejected() override
{
QMutexLocker locker(&m);
done = true;
@ -2129,7 +2129,7 @@ public:
{
}
virtual void emitResponseReady()
void emitResponseReady() override
{
emit passwordAsker->responseReady();
}
@ -2190,7 +2190,7 @@ public:
{
}
virtual void emitResponseReady()
void emitResponseReady() override
{
emit tokenAsker->responseReady();
}

@ -90,12 +90,12 @@ class DefaultRandomContext : public RandomContext
public:
DefaultRandomContext(Provider *p) : RandomContext(p) {}
virtual Provider::Context *clone() const
Provider::Context *clone() const override
{
return new DefaultRandomContext(provider());
}
virtual SecureArray nextBytes(int size)
SecureArray nextBytes(int size) override
{
SecureArray buf(size);
for(int n = 0; n < (int)buf.size(); ++n)
@ -518,25 +518,25 @@ public:
clear();
}
virtual Provider::Context *clone() const
Provider::Context *clone() const override
{
return new DefaultMD5Context(*this);
}
virtual void clear()
void clear() override
{
secure = true;
md5_init(&md5);
}
virtual void update(const MemoryRegion &in)
void update(const MemoryRegion &in) override
{
if(!in.isSecure())
secure = false;
md5_append(&md5, (const md5_byte_t *)in.data(), in.size());
}
virtual MemoryRegion final()
MemoryRegion final() override
{
if(secure)
{
@ -623,25 +623,25 @@ public:
clear();
}
virtual Provider::Context *clone() const
Provider::Context *clone() const override
{
return new DefaultSHA1Context(*this);
}
virtual void clear()
void clear() override
{
secure = true;
sha1_init(&_context);
}
virtual void update(const MemoryRegion &in)
void update(const MemoryRegion &in) override
{
if(!in.isSecure())
secure = false;
sha1_update(&_context, (unsigned char *)in.data(), (unsigned int)in.size());
}
virtual MemoryRegion final()
MemoryRegion final() override
{
if(secure)
{
@ -928,47 +928,47 @@ public:
_crl = crl;
}
virtual Provider::Context *clone() const
Provider::Context *clone() const override
{
return new DefaultKeyStoreEntry(*this);
}
virtual KeyStoreEntry::Type type() const
KeyStoreEntry::Type type() const override
{
return _type;
}
virtual QString id() const
QString id() const override
{
return _id;
}
virtual QString name() const
QString name() const override
{
return _name;
}
virtual QString storeId() const
QString storeId() const override
{
return _storeId;
}
virtual QString storeName() const
QString storeName() const override
{
return _storeName;
}
virtual Certificate certificate() const
Certificate certificate() const override
{
return _cert;
}
virtual CRL crl() const
CRL crl() const override
{
return _crl;
}
virtual QString serialize() const
QString serialize() const override
{
if(_serialized.isEmpty())
{
@ -1067,19 +1067,19 @@ public:
{
}
virtual Provider::Context *clone() const
Provider::Context *clone() const override
{
return 0;
}
virtual void start()
void start() override
{
x509_supported = false;
QMetaObject::invokeMethod(this, "busyEnd", Qt::QueuedConnection);
}
virtual QList<int> keyStores()
QList<int> keyStores() override
{
if(!x509_supported)
{
@ -1103,22 +1103,22 @@ public:
return list;
}
virtual KeyStore::Type type(int) const
KeyStore::Type type(int) const override
{
return KeyStore::System;
}
virtual QString storeId(int) const
QString storeId(int) const override
{
return "qca-default-systemstore";
}
virtual QString name(int) const
QString name(int) const override
{
return "System Trusted Certificates";
}
virtual QList<KeyStoreEntry::Type> entryTypes(int) const
QList<KeyStoreEntry::Type> entryTypes(int) const override
{
QList<KeyStoreEntry::Type> list;
list += KeyStoreEntry::TypeCertificate;
@ -1126,7 +1126,7 @@ public:
return list;
}
virtual QList<KeyStoreEntryContext*> entryList(int)
QList<KeyStoreEntryContext*> entryList(int) override
{
QList<KeyStoreEntryContext*> out;
@ -1177,7 +1177,7 @@ public:
return out;
}
virtual KeyStoreEntryContext *entryPassive(const QString &serialized)
KeyStoreEntryContext *entryPassive(const QString &serialized) override
{
return DefaultKeyStoreEntry::deserialize(serialized, provider());
}
@ -1206,7 +1206,7 @@ class DefaultProvider : public Provider
public:
DefaultShared shared;
virtual void init()
void init() override
{
QDateTime now = QDateTime::currentDateTime();
@ -1216,22 +1216,22 @@ public:
qsrand(t);
}
virtual int version() const
int version() const override
{
return QCA_VERSION;
}
virtual int qcaVersion() const
int qcaVersion() const override
{
return QCA_VERSION;
}
virtual QString name() const
QString name() const override
{
return "default";
}
virtual QStringList features() const
QStringList features() const override
{
QStringList list;
list += "random";
@ -1241,7 +1241,7 @@ public:
return list;
}
virtual Provider::Context *createContext(const QString &type)
Provider::Context *createContext(const QString &type) override
{
if(type == "random")
return new DefaultRandomContext(this);
@ -1255,7 +1255,7 @@ public:
return 0;
}
virtual QVariantMap defaultConfig() const
QVariantMap defaultConfig() const override
{
QVariantMap config;
config["formtype"] = "http://affinix.com/qca/forms/default#1.0";
@ -1266,7 +1266,7 @@ public:
return config;
}
virtual void configChanged(const QVariantMap &config)
void configChanged(const QVariantMap &config) override
{
bool use_system = config["use_system"].toBool();
QString roots_file = config["roots_file"].toString();

@ -620,12 +620,12 @@ public:
stop();
}
void atStart()
void atStart() override
{
tracker = new KeyStoreTracker;
}
void atEnd()
void atEnd() override
{
delete tracker;
}
@ -997,7 +997,7 @@ public:
}
protected:
virtual void run()
void run() override
{
if(type == EntryList)
#if QT_VERSION >= 0x050000

@ -55,8 +55,8 @@ signals:
void needFix();
protected:
bool event(QEvent *event);
void timerEvent(QTimerEvent *event);
bool event(QEvent *event) override;
void timerEvent(QTimerEvent *event) override;
};
SafeTimer::Private::Private(QObject *parent)

@ -330,7 +330,7 @@ signals:
void outputClosed();
protected:
virtual void atStart()
void atStart() override
{
worker = new ConsoleWorker;
@ -345,7 +345,7 @@ protected:
worker->start(_in_id, _out_id);
}
virtual void atEnd()
void atEnd() override
{
in_left = worker->takeBytesToRead();
out_left = worker->takeBytesToWrite();

@ -105,7 +105,7 @@ public:
#endif
}
virtual bool event(QEvent *e)
bool event(QEvent *e) override
{
switch(e->type())
{
@ -121,7 +121,7 @@ public:
return QObject::event(e);
}
virtual bool eventFilter(QObject *, QEvent *e)
bool eventFilter(QObject *, QEvent *e) override
{
switch(e->type())
{
@ -461,7 +461,7 @@ public:
}
protected:
virtual void run()
void run() override
{
m.lock();
QEventLoop eventLoop;

@ -86,12 +86,12 @@ public:
QCA::logger()->unregisterLogDevice (name ());
}
void logTextMessage( const QString &message, enum QCA::Logger::Severity severity )
void logTextMessage( const QString &message, enum QCA::Logger::Severity severity ) override
{
_stream << now () << " " << severityName (severity) << " " << message << endl;
}
void logBinaryMessage( const QByteArray &blob, enum QCA::Logger::Severity severity )
void logBinaryMessage( const QByteArray &blob, enum QCA::Logger::Severity severity ) override
{
Q_UNUSED(blob);
_stream << now () << " " << severityName (severity) << " " << "Binary blob not implemented yet" << endl;
@ -695,12 +695,12 @@ public:
}
protected:
virtual void atStart()
void atStart() override
{
pp = new PassphrasePrompt;
}
virtual void atEnd()
void atEnd() override
{
delete pp;
}

@ -62,17 +62,17 @@ class TestClientProvider : public QObject, public QCA::Provider
Q_OBJECT
public:
int qcaVersion() const
int qcaVersion() const override
{
return QCA_VERSION;
}
QString name() const
QString name() const override
{
return providerName;
}
QStringList features() const
QStringList features() const override
{
QStringList list;
list += "testClientSideProviderFeature1";
@ -80,7 +80,7 @@ public:
return list;
}
Provider::Context *createContext(const QString &type)
Provider::Context *createContext(const QString &type) override
{
if(type == "testClientSideProviderFeature1")
// return new Feature1Context(this);

@ -99,12 +99,12 @@ public:
}
protected:
void atStart()
void atStart() override
{
prov = new PGPPassphraseProvider;
}
void atEnd()
void atEnd() override
{
delete prov;
}