summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2009-11-19 19:25:56 (GMT)
committerRemko Tronçon <git@el-tramo.be>2009-11-19 19:25:56 (GMT)
commite9bdc38536488b76e5e3a715961a94085302cc15 (patch)
tree57dd253c436a3419152e568be902dab5ad99fc51
parentb2a55163964c835a4b0b61af0f0d959ec58a5a0e (diff)
downloadswift-e9bdc38536488b76e5e3a715961a94085302cc15.zip
swift-e9bdc38536488b76e5e3a715961a94085302cc15.tar.bz2
Added HMAC-SHA1 and SCRAM-SHA1 implementations.
We don't authenticate with SCRAM-SHA1 yet.
-rw-r--r--Swiften/Base/ByteArray.h7
-rw-r--r--Swiften/SConscript3
2 files changed, 10 insertions, 0 deletions
diff --git a/Swiften/Base/ByteArray.h b/Swiften/Base/ByteArray.h
index ea96d09..ab256a4 100644
--- a/Swiften/Base/ByteArray.h
+++ b/Swiften/Base/ByteArray.h
@@ -53,12 +53,19 @@ namespace Swift {
friend ByteArray operator+(const ByteArray& a, const ByteArray&b) {
ByteArray result(a);
result.data_.insert(result.data_.end(), b.data_.begin(), b.data_.end());
return result;
}
+ friend ByteArray operator+(const ByteArray& a, char b) {
+ ByteArray x;
+ x.resize(1);
+ x[0] = b;
+ return a + x;
+ }
+
ByteArray& operator+=(const ByteArray& b) {
data_.insert(data_.end(), b.data_.begin(), b.data_.end());
return *this;
}
friend bool operator==(const ByteArray& a, const ByteArray& b) {
diff --git a/Swiften/SConscript b/Swiften/SConscript
index 6ebc865..039856e 100644
--- a/Swiften/SConscript
+++ b/Swiften/SConscript
@@ -40,12 +40,13 @@ sources = [
"Queries/Responders/DiscoInfoResponder.cpp",
"Queries/Responders/SoftwareVersionResponder.cpp",
"Roster/ContactRosterItem.cpp",
"Roster/Roster.cpp",
"Roster/XMPPRoster.cpp",
"SASL/PLAINMessage.cpp",
+ "SASL/SCRAMSHA1ClientAuthenticator.cpp",
"Serializer/AuthRequestSerializer.cpp",
"Serializer/CompressRequestSerializer.cpp",
"Serializer/ElementSerializer.cpp",
"Serializer/MessageSerializer.cpp",
"Serializer/PayloadSerializer.cpp",
"Serializer/PayloadSerializerCollection.cpp",
@@ -76,12 +77,13 @@ sources = [
"Server/UserRegistry.cpp",
"Session/Session.cpp",
"Session/SessionStream.cpp",
"Session/BasicSessionStream.cpp",
"StringCodecs/Base64.cpp",
"StringCodecs/SHA1.cpp",
+ "StringCodecs/HMACSHA1.cpp",
]
# "Notifier/GrowlNotifier.cpp",
if myenv.get("HAVE_OPENSSL", 0) :
sources += ["TLS/OpenSSL/OpenSSLContext.cpp"]
@@ -176,7 +178,8 @@ env.Append(UNITTEST_SOURCES = [
File("Serializer/XML/UnitTest/XMLElementTest.cpp"),
File("Server/UnitTest/ServerStanzaRouterTest.cpp"),
File("StreamStack/UnitTest/StreamStackTest.cpp"),
File("StreamStack/UnitTest/XMPPLayerTest.cpp"),
File("StringCodecs/UnitTest/Base64Test.cpp"),
File("StringCodecs/UnitTest/SHA1Test.cpp"),
+ File("StringCodecs/UnitTest/HMACSHA1Test.cpp"),
])