summaryrefslogtreecommitdiffstats
path: root/kopete/protocols/jabber/libiris/qca/src/qca.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kopete/protocols/jabber/libiris/qca/src/qca.cpp')
-rw-r--r--kopete/protocols/jabber/libiris/qca/src/qca.cpp128
1 files changed, 64 insertions, 64 deletions
diff --git a/kopete/protocols/jabber/libiris/qca/src/qca.cpp b/kopete/protocols/jabber/libiris/qca/src/qca.cpp
index bad05fcd..26891798 100644
--- a/kopete/protocols/jabber/libiris/qca/src/qca.cpp
+++ b/kopete/protocols/jabber/libiris/qca/src/qca.cpp
@@ -40,12 +40,12 @@
#define PLUGIN_EXT "so"
#endif
-using namespace QCA;
+using namespace TQCA;
class ProviderItem
{
public:
- QCAProvider *p;
+ TQCAProvider *p;
TQString fname;
static ProviderItem *load(const TQString &fname)
@@ -60,8 +60,8 @@ public:
delete lib;
return 0;
}
- QCAProvider *(*createProvider)() = (QCAProvider *(*)())s;
- QCAProvider *p = createProvider();
+ TQCAProvider *(*createProvider)() = (TQCAProvider *(*)())s;
+ TQCAProvider *p = createProvider();
if(!p) {
delete lib;
return 0;
@@ -71,7 +71,7 @@ public:
return i;
}
- static ProviderItem *fromClass(QCAProvider *p)
+ static ProviderItem *fromClass(TQCAProvider *p)
{
ProviderItem *i = new ProviderItem(0, p);
return i;
@@ -95,7 +95,7 @@ private:
TQLibrary *lib;
bool init_done;
- ProviderItem(TQLibrary *_lib, QCAProvider *_p)
+ ProviderItem(TQLibrary *_lib, TQCAProvider *_p)
{
lib = _lib;
p = _p;
@@ -142,7 +142,7 @@ static void plugin_scan()
ProviderItem *i = ProviderItem::load(fname);
if(!i)
continue;
- if(i->p->qcaVersion() != QCA_PLUGIN_VERSION) {
+ if(i->p->qcaVersion() != TQCA_PLUGIN_VERSION) {
delete i;
continue;
}
@@ -152,7 +152,7 @@ static void plugin_scan()
}
}
-static void plugin_addClass(QCAProvider *p)
+static void plugin_addClass(TQCAProvider *p)
{
ProviderItem *i = ProviderItem::fromClass(p);
providerList.prepend(i);
@@ -172,7 +172,7 @@ static int plugin_caps()
return caps;
}
-TQString QCA::arrayToHex(const TQByteArray &a)
+TQString TQCA::arrayToHex(const TQByteArray &a)
{
TQString out;
for(int n = 0; n < (int)a.size(); ++n) {
@@ -183,7 +183,7 @@ TQString QCA::arrayToHex(const TQByteArray &a)
return out;
}
-TQByteArray QCA::hexToArray(const TQString &str)
+TQByteArray TQCA::hexToArray(const TQString &str)
{
TQByteArray out(str.length() / 2);
int at = 0;
@@ -196,7 +196,7 @@ TQByteArray QCA::hexToArray(const TQString &str)
return out;
}
-void QCA::init()
+void TQCA::init()
{
if(qca_init)
return;
@@ -204,7 +204,7 @@ void QCA::init()
providerList.setAutoDelete(true);
}
-bool QCA::isSupported(int capabilities)
+bool TQCA::isSupported(int capabilities)
{
init();
@@ -221,12 +221,12 @@ bool QCA::isSupported(int capabilities)
return false;
}
-void QCA::insertProvider(QCAProvider *p)
+void TQCA::insertProvider(TQCAProvider *p)
{
plugin_addClass(p);
}
-void QCA::unloadAllPlugins()
+void TQCA::unloadAllPlugins()
{
plugin_unloadall();
}
@@ -236,7 +236,7 @@ static void *getContext(int cap)
init();
// this call will also trip a scan for new plugins if needed
- if(!QCA::isSupported(cap))
+ if(!TQCA::isSupported(cap))
return 0;
TQPtrListIterator<ProviderItem> it(providerList);
@@ -271,10 +271,10 @@ public:
c->reset();
}
- QCA_HashContext *c;
+ TQCA_HashContext *c;
};
-Hash::Hash(QCA_HashContext *c)
+Hash::Hash(TQCA_HashContext *c)
{
d = new Private;
d->c = c;
@@ -340,14 +340,14 @@ public:
err = false;
}
- QCA_CipherContext *c;
+ TQCA_CipherContext *c;
int dir;
int mode;
TQByteArray key, iv;
bool err;
};
-Cipher::Cipher(QCA_CipherContext *c, int dir, int mode, const TQByteArray &key, const TQByteArray &iv, bool pad)
+Cipher::Cipher(TQCA_CipherContext *c, int dir, int mode, const TQByteArray &key, const TQByteArray &iv, bool pad)
{
d = new Private;
d->c = c;
@@ -447,7 +447,7 @@ TQByteArray Cipher::final(bool *ok)
// SHA1
//----------------------------------------------------------------------------
SHA1::SHA1()
-:Hash((QCA_HashContext *)getContext(CAP_SHA1))
+:Hash((TQCA_HashContext *)getContext(CAP_SHA1))
{
}
@@ -456,7 +456,7 @@ SHA1::SHA1()
// SHA256
//----------------------------------------------------------------------------
SHA256::SHA256()
-:Hash((QCA_HashContext *)getContext(CAP_SHA256))
+:Hash((TQCA_HashContext *)getContext(CAP_SHA256))
{
}
@@ -465,7 +465,7 @@ SHA256::SHA256()
// MD5
//----------------------------------------------------------------------------
MD5::MD5()
-:Hash((QCA_HashContext *)getContext(CAP_MD5))
+:Hash((TQCA_HashContext *)getContext(CAP_MD5))
{
}
@@ -474,7 +474,7 @@ MD5::MD5()
// BlowFish
//----------------------------------------------------------------------------
BlowFish::BlowFish(int dir, int mode, const TQByteArray &key, const TQByteArray &iv, bool pad)
-:Cipher((QCA_CipherContext *)getContext(CAP_BlowFish), dir, mode, key, iv, pad)
+:Cipher((TQCA_CipherContext *)getContext(CAP_BlowFish), dir, mode, key, iv, pad)
{
}
@@ -483,7 +483,7 @@ BlowFish::BlowFish(int dir, int mode, const TQByteArray &key, const TQByteArray
// TripleDES
//----------------------------------------------------------------------------
TripleDES::TripleDES(int dir, int mode, const TQByteArray &key, const TQByteArray &iv, bool pad)
-:Cipher((QCA_CipherContext *)getContext(CAP_TripleDES), dir, mode, key, iv, pad)
+:Cipher((TQCA_CipherContext *)getContext(CAP_TripleDES), dir, mode, key, iv, pad)
{
}
@@ -492,7 +492,7 @@ TripleDES::TripleDES(int dir, int mode, const TQByteArray &key, const TQByteArra
// AES128
//----------------------------------------------------------------------------
AES128::AES128(int dir, int mode, const TQByteArray &key, const TQByteArray &iv, bool pad)
-:Cipher((QCA_CipherContext *)getContext(CAP_AES128), dir, mode, key, iv, pad)
+:Cipher((TQCA_CipherContext *)getContext(CAP_AES128), dir, mode, key, iv, pad)
{
}
@@ -501,7 +501,7 @@ AES128::AES128(int dir, int mode, const TQByteArray &key, const TQByteArray &iv,
// AES256
//----------------------------------------------------------------------------
AES256::AES256(int dir, int mode, const TQByteArray &key, const TQByteArray &iv, bool pad)
-:Cipher((QCA_CipherContext *)getContext(CAP_AES256), dir, mode, key, iv, pad)
+:Cipher((TQCA_CipherContext *)getContext(CAP_AES256), dir, mode, key, iv, pad)
{
}
@@ -522,13 +522,13 @@ public:
delete c;
}
- QCA_RSAKeyContext *c;
+ TQCA_RSAKeyContext *c;
};
RSAKey::RSAKey()
{
d = new Private;
- d->c = (QCA_RSAKeyContext *)getContext(CAP_RSA);
+ d->c = (TQCA_RSAKeyContext *)getContext(CAP_RSA);
}
RSAKey::RSAKey(const RSAKey &from)
@@ -685,13 +685,13 @@ public:
delete c;
}
- QCA_CertContext *c;
+ TQCA_CertContext *c;
};
Cert::Cert()
{
d = new Private;
- d->c = (QCA_CertContext *)getContext(CAP_X509);
+ d->c = (TQCA_CertContext *)getContext(CAP_X509);
}
Cert::Cert(const Cert &from)
@@ -712,7 +712,7 @@ Cert::~Cert()
delete d;
}
-void Cert::fromContext(QCA_CertContext *ctx)
+void Cert::fromContext(TQCA_CertContext *ctx)
{
delete d->c;
d->c = ctx;
@@ -746,18 +746,18 @@ TQString Cert::issuerString() const
CertProperties Cert::subject() const
{
- TQValueList<QCA_CertProperty> list = d->c->subject();
+ TQValueList<TQCA_CertProperty> list = d->c->subject();
CertProperties props;
- for(TQValueList<QCA_CertProperty>::ConstIterator it = list.begin(); it != list.end(); ++it)
+ for(TQValueList<TQCA_CertProperty>::ConstIterator it = list.begin(); it != list.end(); ++it)
props[(*it).var] = (*it).val;
return props;
}
CertProperties Cert::issuer() const
{
- TQValueList<QCA_CertProperty> list = d->c->issuer();
+ TQValueList<TQCA_CertProperty> list = d->c->issuer();
CertProperties props;
- for(TQValueList<QCA_CertProperty>::ConstIterator it = list.begin(); it != list.end(); ++it)
+ for(TQValueList<TQCA_CertProperty>::ConstIterator it = list.begin(); it != list.end(); ++it)
props[(*it).var] = (*it).val;
return props;
}
@@ -814,7 +814,7 @@ class TLS::Private
public:
Private()
{
- c = (QCA_TLSContext *)getContext(CAP_TLS);
+ c = (TQCA_TLSContext *)getContext(CAP_TLS);
}
~Private()
@@ -845,7 +845,7 @@ public:
}
Cert cert;
- QCA_TLSContext *c;
+ TQCA_TLSContext *c;
TQByteArray in, out, to_net, from_net;
int bytesEncoded;
bool tryMore;
@@ -856,7 +856,7 @@ public:
Cert ourCert;
RSAKey ourKey;
- TQPtrList<QCA_CertContext> store;
+ TQPtrList<TQCA_CertContext> store;
};
TLS::TLS(TQObject *parent)
@@ -966,7 +966,7 @@ const Cert & TLS::peerCertificate() const
int TLS::certificateValidityResult() const
{
if(d->hostMismatch)
- return QCA::TLS::HostMismatch;
+ return TQCA::TLS::HostMismatch;
else
return d->c->validityResult();
}
@@ -982,12 +982,12 @@ void TLS::update()
TQByteArray a;
int r = d->c->shutdown(d->from_net, &a);
d->from_net.resize(0);
- if(r == QCA_TLSContext::Error) {
+ if(r == TQCA_TLSContext::Error) {
reset();
error(ErrHandshake);
return;
}
- if(r == QCA_TLSContext::Success) {
+ if(r == TQCA_TLSContext::Success) {
d->from_net = d->c->unprocessed().copy();
done = true;
}
@@ -998,15 +998,15 @@ void TLS::update()
TQByteArray a;
int r = d->c->handshake(d->from_net, &a);
d->from_net.resize(0);
- if(r == QCA_TLSContext::Error) {
+ if(r == TQCA_TLSContext::Error) {
reset();
error(ErrHandshake);
return;
}
d->appendArray(&d->to_net, a);
- if(r == QCA_TLSContext::Success) {
- QCA_CertContext *cc = d->c->peerCertificate();
- if(cc && !d->host.isEmpty() && d->c->validityResult() == QCA::TLS::Valid) {
+ if(r == TQCA_TLSContext::Success) {
+ TQCA_CertContext *cc = d->c->peerCertificate();
+ if(cc && !d->host.isEmpty() && d->c->validityResult() == TQCA::TLS::Valid) {
if(!cc->matchesAddress(d->host))
d->hostMismatch = true;
}
@@ -1097,7 +1097,7 @@ class SASL::Private
public:
Private()
{
- c = (QCA_SASLContext *)getContext(CAP_SASL);
+ c = (TQCA_SASLContext *)getContext(CAP_SASL);
}
~Private()
@@ -1117,7 +1117,7 @@ public:
int ext_ssf;
bool tried;
- QCA_SASLContext *c;
+ TQCA_SASLContext *c;
TQHostAddress localAddr, remoteAddr;
int localPort, remotePort;
TQByteArray stepData;
@@ -1241,7 +1241,7 @@ void SASL::setRemoteAddr(const TQHostAddress &addr, TQ_UINT16 port)
bool SASL::startClient(const TQString &service, const TQString &host, const TQStringList &mechlist, bool allowClientSendFirst)
{
- QCA_SASLHostPort la, ra;
+ TQCA_SASLHostPort la, ra;
if(d->localPort != -1) {
la.addr = d->localAddr;
la.port = d->localPort;
@@ -1266,7 +1266,7 @@ bool SASL::startClient(const TQString &service, const TQString &host, const TQSt
bool SASL::startServer(const TQString &service, const TQString &host, const TQString &realm, TQStringList *mechlist)
{
- QCA_SASLHostPort la, ra;
+ TQCA_SASLHostPort la, ra;
if(d->localPort != -1) {
la.addr = d->localAddr;
la.port = d->localPort;
@@ -1301,11 +1301,11 @@ void SASL::putServerFirstStep(const TQString &mech, const TQByteArray &clientIni
void SASL::handleServerFirstStep(int r)
{
- if(r == QCA_SASLContext::Success)
+ if(r == TQCA_SASLContext::Success)
authenticated();
- else if(r == QCA_SASLContext::Continue)
+ else if(r == TQCA_SASLContext::Continue)
nextStep(d->c->result());
- else if(r == QCA_SASLContext::AuthCheck)
+ else if(r == TQCA_SASLContext::AuthCheck)
tryAgain();
else
error(ErrAuth);
@@ -1360,16 +1360,16 @@ void SASL::tryAgain()
r = d->c->tryAgain();
}
- if(r == QCA_SASLContext::Error) {
+ if(r == TQCA_SASLContext::Error) {
error(ErrAuth);
return;
}
- else if(r == QCA_SASLContext::Continue) {
+ else if(r == TQCA_SASLContext::Continue) {
d->tried = false;
nextStep(d->c->result());
return;
}
- else if(r == QCA_SASLContext::AuthCheck) {
+ else if(r == TQCA_SASLContext::AuthCheck) {
authCheck(d->c->username(), d->c->authzid());
return;
}
@@ -1383,13 +1383,13 @@ void SASL::tryAgain()
else
r = d->c->tryAgain();
- if(r == QCA_SASLContext::Error) {
+ if(r == TQCA_SASLContext::Error) {
error(ErrAuth);
return;
}
- else if(r == QCA_SASLContext::NeedParams) {
+ else if(r == TQCA_SASLContext::NeedParams) {
//d->tried = false;
- QCA_SASLNeedParams np = d->c->clientParamsNeeded();
+ TQCA_SASLNeedParams np = d->c->clientParamsNeeded();
needParams(np.user, np.authzid, np.pass, np.realm);
return;
}
@@ -1409,27 +1409,27 @@ void SASL::tryAgain()
else
r = d->c->tryAgain();
- if(r == QCA_SASLContext::Error) {
+ if(r == TQCA_SASLContext::Error) {
error(ErrAuth);
return;
}
- else if(r == QCA_SASLContext::NeedParams) {
+ else if(r == TQCA_SASLContext::NeedParams) {
//d->tried = false;
- QCA_SASLNeedParams np = d->c->clientParamsNeeded();
+ TQCA_SASLNeedParams np = d->c->clientParamsNeeded();
needParams(np.user, np.authzid, np.pass, np.realm);
return;
}
d->tried = false;
- //else if(r == QCA_SASLContext::Continue) {
+ //else if(r == TQCA_SASLContext::Continue) {
nextStep(d->c->result());
// return;
//}
}
}
- if(r == QCA_SASLContext::Success)
+ if(r == TQCA_SASLContext::Success)
authenticated();
- else if(r == QCA_SASLContext::Error)
+ else if(r == TQCA_SASLContext::Error)
error(ErrAuth);
}