summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2017-07-13 06:07:37 (GMT)
committerTobias Markmann <tm@ayena.de>2017-07-13 06:07:37 (GMT)
commit497dfb8ab128b0bbfdb6b3045caa03f8b38bc9fc (patch)
tree4d69e5ce56c755cf3b61aaf78e24729130f77e2e /Swiften/Crypto/CommonCryptoCryptoProvider.cpp
parent8f4d198c4d3aa55a5215061e84572d5faf4e4117 (diff)
downloadswift-497dfb8ab128b0bbfdb6b3045caa03f8b38bc9fc.zip
swift-497dfb8ab128b0bbfdb6b3045caa03f8b38bc9fc.tar.bz2
Remove Swiften/Base/Override.h
Replaced SWIFTEN_OVERRIDE with C++11 standard override keyword. Test-Information: Tested on macOS 10.12.5 with clang trunk. Change-Id: If89c6cc2a648662522a320834c314496c943a55a
Diffstat (limited to 'Swiften/Crypto/CommonCryptoCryptoProvider.cpp')
-rw-r--r--Swiften/Crypto/CommonCryptoCryptoProvider.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/Swiften/Crypto/CommonCryptoCryptoProvider.cpp b/Swiften/Crypto/CommonCryptoCryptoProvider.cpp
index 63dfc4c..d4257e0 100644
--- a/Swiften/Crypto/CommonCryptoCryptoProvider.cpp
+++ b/Swiften/Crypto/CommonCryptoCryptoProvider.cpp
@@ -1,112 +1,112 @@
/*
* Copyright (c) 2013-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
#include <Swiften/Crypto/CommonCryptoCryptoProvider.h>
#include <cassert>
#include <boost/numeric/conversion/cast.hpp>
#include <CommonCrypto/CommonDigest.h>
#include <CommonCrypto/CommonHMAC.h>
#include <Swiften/Base/ByteArray.h>
#include <Swiften/Crypto/Hash.h>
using namespace Swift;
namespace {
class SHA1Hash : public Hash {
public:
SHA1Hash() : finalized(false) {
if (!CC_SHA1_Init(&context)) {
assert(false);
}
}
- virtual ~SHA1Hash() SWIFTEN_OVERRIDE {
+ virtual ~SHA1Hash() override {
}
- virtual Hash& update(const ByteArray& data) SWIFTEN_OVERRIDE {
+ virtual Hash& update(const ByteArray& data) override {
return updateInternal(data);
}
- virtual Hash& update(const SafeByteArray& data) SWIFTEN_OVERRIDE {
+ virtual Hash& update(const SafeByteArray& data) override {
return updateInternal(data);
}
- virtual std::vector<unsigned char> getHash() SWIFTEN_OVERRIDE {
+ virtual std::vector<unsigned char> getHash() override {
assert(!finalized);
std::vector<unsigned char> result(CC_SHA1_DIGEST_LENGTH);
CC_SHA1_Final(vecptr(result), &context);
return result;
}
private:
template<typename ContainerType>
Hash& updateInternal(const ContainerType& data) {
assert(!finalized);
if (!CC_SHA1_Update(&context, vecptr(data), boost::numeric_cast<CC_LONG>(data.size()))) {
assert(false);
}
return *this;
}
private:
CC_SHA1_CTX context;
bool finalized;
};
class MD5Hash : public Hash {
public:
MD5Hash() : finalized(false) {
if (!CC_MD5_Init(&context)) {
assert(false);
}
}
- virtual ~MD5Hash() SWIFTEN_OVERRIDE {
+ virtual ~MD5Hash() override {
}
- virtual Hash& update(const ByteArray& data) SWIFTEN_OVERRIDE {
+ virtual Hash& update(const ByteArray& data) override {
return updateInternal(data);
}
- virtual Hash& update(const SafeByteArray& data) SWIFTEN_OVERRIDE {
+ virtual Hash& update(const SafeByteArray& data) override {
return updateInternal(data);
}
- virtual std::vector<unsigned char> getHash() SWIFTEN_OVERRIDE {
+ virtual std::vector<unsigned char> getHash() override {
assert(!finalized);
std::vector<unsigned char> result(CC_MD5_DIGEST_LENGTH);
CC_MD5_Final(vecptr(result), &context);
return result;
}
private:
template<typename ContainerType>
Hash& updateInternal(const ContainerType& data) {
assert(!finalized);
if (!CC_MD5_Update(&context, vecptr(data), boost::numeric_cast<CC_LONG>(data.size()))) {
assert(false);
}
return *this;
}
private:
CC_MD5_CTX context;
bool finalized;
};
template<typename T>
ByteArray getHMACSHA1Internal(const T& key, const ByteArray& data) {
std::vector<unsigned char> result(CC_SHA1_DIGEST_LENGTH);
CCHmac(kCCHmacAlgSHA1, vecptr(key), key.size(), vecptr(data), boost::numeric_cast<CC_LONG>(data.size()), vecptr(result));
return result;
}
}
CommonCryptoCryptoProvider::CommonCryptoCryptoProvider() {