aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils
diff options
context:
space:
mode:
authororivej <orivej@yandex-team.ru>2022-02-10 16:45:01 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:01 +0300
commit2d37894b1b037cf24231090eda8589bbb44fb6fc (patch)
treebe835aa92c6248212e705f25388ebafcf84bc7a1 /contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils
parent718c552901d703c502ccbefdfc3c9028d608b947 (diff)
downloadydb-2d37894b1b037cf24231090eda8589bbb44fb6fc.tar.gz
Restoring authorship annotation for <orivej@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils')
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/ARN.cpp92
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/Array.cpp8
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/DNS.cpp8
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/DateTimeCommon.cpp870
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/Directory.cpp8
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/EnumParseOverflowContainer.cpp8
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/FileSystemUtils.cpp6
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/GetTheLights.cpp8
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/HashingUtils.cpp8
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/StringUtils.cpp98
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/TempFile.cpp8
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/UUID.cpp8
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/base64/Base64.cpp8
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/Cipher.cpp24
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/ContentCryptoMaterial.cpp8
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/ContentCryptoScheme.cpp8
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/CryptoBuf.cpp34
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/CryptoStream.cpp10
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/EncryptionMaterials.cpp8
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/KeyWrapAlgorithm.cpp38
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/MD5.cpp8
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/Sha256.cpp8
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/Sha256HMAC.cpp8
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/factory/Factories.cpp368
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/openssl/CryptoImpl.cpp344
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventDecoderStream.cpp44
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventEncoderStream.cpp56
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventHeader.cpp6
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventMessage.cpp122
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventStreamBuf.cpp10
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventStreamDecoder.cpp14
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventStreamEncoder.cpp36
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventStreamErrors.cpp6
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/json/JsonSerializer.cpp94
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/logging/AWSLogging.cpp8
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/logging/ConsoleLogSystem.cpp18
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/logging/DefaultLogSystem.cpp24
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/logging/FormattedLogSystem.cpp12
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/logging/LogLevel.cpp8
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/memory/AWSMemory.cpp72
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/memory/stl/SimpleStringStream.cpp16
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/stream/ConcurrentStreamBuf.cpp36
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/stream/PreallocatedStreamBuf.cpp14
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/stream/ResponseStream.cpp8
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/stream/SimpleStreamBuf.cpp8
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/threading/Executor.cpp8
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/threading/ReaderWriterLock.cpp8
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/threading/Semaphore.cpp6
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/threading/ThreadTask.cpp8
-rw-r--r--contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/xml/XmlSerializer.cpp188
50 files changed, 1417 insertions, 1417 deletions
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/ARN.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/ARN.cpp
index c4fce2ccac..dac358c09d 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/ARN.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/ARN.cpp
@@ -1,46 +1,46 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
-
-#include <aws/core/utils/ARN.h>
-#include <aws/core/utils/StringUtils.h>
-#include <aws/core/utils/logging/LogMacros.h>
-
-namespace Aws
-{
- namespace Utils
- {
- ARN::ARN(const Aws::String& arnString)
- {
- m_valid = false;
-
- // An ARN can be identified as any string starting with arn: with 6 defined segments each separated by a :
- const auto result = StringUtils::Split(arnString, ':', StringUtils::SplitOptions::INCLUDE_EMPTY_ENTRIES);
-
- if (result.size() < 6)
- {
- return;
- }
-
- if (result[0] != "arn")
- {
- return;
- }
-
- m_arnString = arnString;
- m_partition = result[1];
- m_service = result[2];
- m_region = result[3];
- m_accountId = result[4];
- m_resource = result[5];
-
- for (size_t i = 6; i < result.size(); i++)
- {
- m_resource += ":" + result[i];
- }
-
- m_valid = true;
- }
- }
-} \ No newline at end of file
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
+
+#include <aws/core/utils/ARN.h>
+#include <aws/core/utils/StringUtils.h>
+#include <aws/core/utils/logging/LogMacros.h>
+
+namespace Aws
+{
+ namespace Utils
+ {
+ ARN::ARN(const Aws::String& arnString)
+ {
+ m_valid = false;
+
+ // An ARN can be identified as any string starting with arn: with 6 defined segments each separated by a :
+ const auto result = StringUtils::Split(arnString, ':', StringUtils::SplitOptions::INCLUDE_EMPTY_ENTRIES);
+
+ if (result.size() < 6)
+ {
+ return;
+ }
+
+ if (result[0] != "arn")
+ {
+ return;
+ }
+
+ m_arnString = arnString;
+ m_partition = result[1];
+ m_service = result[2];
+ m_region = result[3];
+ m_accountId = result[4];
+ m_resource = result[5];
+
+ for (size_t i = 6; i < result.size(); i++)
+ {
+ m_resource += ":" + result[i];
+ }
+
+ m_valid = true;
+ }
+ }
+} \ No newline at end of file
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/Array.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/Array.cpp
index ce9ad56703..43e7863421 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/Array.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/Array.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/Array.h>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/DNS.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/DNS.cpp
index 667f181900..ce588150e2 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/DNS.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/DNS.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/DNS.h>
#include <aws/core/utils/StringUtils.h>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/DateTimeCommon.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/DateTimeCommon.cpp
index 639688d255..b690c90c2d 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/DateTimeCommon.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/DateTimeCommon.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/DateTime.h>
@@ -17,7 +17,7 @@ static const char* CLASS_TAG = "DateTime";
static const char* RFC822_DATE_FORMAT_STR_MINUS_Z = "%a, %d %b %Y %H:%M:%S";
static const char* RFC822_DATE_FORMAT_STR_WITH_Z = "%a, %d %b %Y %H:%M:%S %Z";
static const char* ISO_8601_LONG_DATE_FORMAT_STR = "%Y-%m-%dT%H:%M:%SZ";
-static const char* ISO_8601_LONG_BASIC_DATE_FORMAT_STR = "%Y%m%dT%H%M%SZ";
+static const char* ISO_8601_LONG_BASIC_DATE_FORMAT_STR = "%Y%m%dT%H%M%SZ";
using namespace Aws::Utils;
@@ -79,7 +79,7 @@ static int GetWeekDayNumberFromStr(const char* timeString, size_t startIndex, si
case 'n':
return 0;
default:
- return -1;
+ return -1;
}
default:
return -1;
@@ -210,7 +210,7 @@ static int GetMonthNumberFromStr(const char* timeString, size_t startIndex, size
return 2;
default:
return -1;
- }
+ }
default:
return -1;
}
@@ -376,8 +376,8 @@ static int GetMonthNumberFromStr(const char* timeString, size_t startIndex, size
return -1;
}
}
-// Ensure local classes with generic names have internal linkage
-namespace {
+// Ensure local classes with generic names have internal linkage
+namespace {
class DateParser
{
@@ -385,7 +385,7 @@ public:
DateParser(const char* toParse) : m_error(false), m_toParse(toParse), m_utcAssumed(true)
{
m_parsedTimestamp = CreateZeroedTm();
- memset(m_tz, 0, 7);
+ memset(m_tz, 0, 7);
}
virtual ~DateParser() = default;
@@ -401,8 +401,8 @@ protected:
const char* m_toParse;
std::tm m_parsedTimestamp;
bool m_utcAssumed;
- // The size should be at least one byte greater than the maximum possible size so that we could use the last char to indicate the end of the string.
- char m_tz[7];
+ // The size should be at least one byte greater than the maximum possible size so that we could use the last char to indicate the end of the string.
+ char m_tz[7];
};
static const int MAX_LEN = 100;
@@ -414,8 +414,8 @@ static const int MAX_LEN = 100;
class RFC822DateParser : public DateParser
{
public:
- RFC822DateParser(const char* toParse) : DateParser(toParse), m_state(0)
- {
+ RFC822DateParser(const char* toParse) : DateParser(toParse), m_state(0)
+ {
}
/**
@@ -423,13 +423,13 @@ public:
*/
void Parse() override
{
- size_t len = strlen(m_toParse);
+ size_t len = strlen(m_toParse);
//DOS check
if (len > MAX_LEN)
{
- AWS_LOGSTREAM_WARN(CLASS_TAG, "Incoming String to parse too long with length: " << len)
- m_error = true;
+ AWS_LOGSTREAM_WARN(CLASS_TAG, "Incoming String to parse too long with length: " << len)
+ m_error = true;
return;
}
@@ -445,7 +445,7 @@ public:
{
case 0:
if(c == ',')
- {
+ {
int weekNumber = GetWeekDayNumberFromStr(m_toParse, stateStartIndex, index + 1);
if (weekNumber > -1)
@@ -464,10 +464,10 @@ public:
m_error = true;
}
break;
- case 1:
+ case 1:
if (isspace(c))
{
- m_state = 2;
+ m_state = 2;
stateStartIndex = index + 1;
}
else
@@ -579,18 +579,18 @@ public:
}
break;
case 8:
- if ((isalnum(c) || c == '+' || c == '-') && (index - stateStartIndex < 5))
+ if ((isalnum(c) || c == '+' || c == '-') && (index - stateStartIndex < 5))
{
m_tz[index - stateStartIndex] = c;
- }
- else
- {
- m_error = true;
- }
+ }
+ else
+ {
+ m_error = true;
+ }
+ break;
+ default:
+ m_error = true;
break;
- default:
- m_error = true;
- break;
}
index++;
@@ -598,7 +598,7 @@ public:
if (m_tz[0] != 0)
{
- m_utcAssumed = IsUTCTimeZoneDesignator(m_tz);
+ m_utcAssumed = IsUTCTimeZoneDesignator(m_tz);
}
m_error = (m_error || m_state != finalState);
@@ -607,101 +607,101 @@ public:
int GetState() const { return m_state; }
private:
- //Detects whether or not the passed in timezone string is a UTC zone.
- static bool IsUTCTimeZoneDesignator(const char* str)
- {
- size_t len = strlen(str);
- if (len < 3)
- {
- return false;
- }
-
- int index = 0;
- char c = str[index];
- switch (c)
- {
- case 'U':
- case 'u':
- c = str[++index];
- switch(c)
- {
- case 'T':
- case 't':
- c = str[++index];
- switch(c)
- {
- case 'C':
- case 'c':
- return true;
- default:
- return false;
- }
-
- case 'C':
- case 'c':
- c = str[++index];
- switch (c)
- {
- case 'T':
- case 't':
- return true;
- default:
- return false;
- }
- default:
- return false;
- }
- case 'G':
- case 'g':
- c = str[++index];
- switch (c)
- {
- case 'M':
- case 'm':
- c = str[++index];
- switch (c)
- {
- case 'T':
- case 't':
- return true;
- default:
- return false;
- }
- default:
- return false;
- }
- case '+':
- case '-':
- c = str[++index];
- switch (c)
- {
- case '0':
- c = str[++index];
- switch (c)
- {
- case '0':
- c = str[++index];
- switch (c)
- {
- case '0':
- return true;
- default:
- return false;
- }
- default:
- return false;
- }
- default:
- return false;
- }
- case 'Z':
- return true;
- default:
- return false;
- }
-
- }
-
+ //Detects whether or not the passed in timezone string is a UTC zone.
+ static bool IsUTCTimeZoneDesignator(const char* str)
+ {
+ size_t len = strlen(str);
+ if (len < 3)
+ {
+ return false;
+ }
+
+ int index = 0;
+ char c = str[index];
+ switch (c)
+ {
+ case 'U':
+ case 'u':
+ c = str[++index];
+ switch(c)
+ {
+ case 'T':
+ case 't':
+ c = str[++index];
+ switch(c)
+ {
+ case 'C':
+ case 'c':
+ return true;
+ default:
+ return false;
+ }
+
+ case 'C':
+ case 'c':
+ c = str[++index];
+ switch (c)
+ {
+ case 'T':
+ case 't':
+ return true;
+ default:
+ return false;
+ }
+ default:
+ return false;
+ }
+ case 'G':
+ case 'g':
+ c = str[++index];
+ switch (c)
+ {
+ case 'M':
+ case 'm':
+ c = str[++index];
+ switch (c)
+ {
+ case 'T':
+ case 't':
+ return true;
+ default:
+ return false;
+ }
+ default:
+ return false;
+ }
+ case '+':
+ case '-':
+ c = str[++index];
+ switch (c)
+ {
+ case '0':
+ c = str[++index];
+ switch (c)
+ {
+ case '0':
+ c = str[++index];
+ switch (c)
+ {
+ case '0':
+ return true;
+ default:
+ return false;
+ }
+ default:
+ return false;
+ }
+ default:
+ return false;
+ }
+ case 'Z':
+ return true;
+ default:
+ return false;
+ }
+
+ }
+
int m_state;
};
@@ -724,7 +724,7 @@ public:
//DOS check
if (len > MAX_LEN)
{
- AWS_LOGSTREAM_WARN(CLASS_TAG, "Incoming String to parse too long with length: " << len)
+ AWS_LOGSTREAM_WARN(CLASS_TAG, "Incoming String to parse too long with length: " << len)
m_error = true;
return;
}
@@ -820,10 +820,10 @@ public:
break;
case 5:
- if ((c == 'Z' || c == '+' || c == '-' ) && (index - stateStartIndex == 2))
+ if ((c == 'Z' || c == '+' || c == '-' ) && (index - stateStartIndex == 2))
{
- m_tz[0] = c;
- m_state = 7;
+ m_tz[0] = c;
+ m_state = 7;
stateStartIndex = index + 1;
}
else if (c == '.' && index - stateStartIndex == 2)
@@ -842,10 +842,10 @@ public:
break;
case 6:
- if ((c == 'Z' || c == '+' || c == '-' ) && (index - stateStartIndex == 3))
+ if ((c == 'Z' || c == '+' || c == '-' ) && (index - stateStartIndex == 3))
{
- m_tz[0] = c;
- m_state = 7;
+ m_tz[0] = c;
+ m_state = 7;
stateStartIndex = index + 1;
}
else if(!isdigit(c))
@@ -853,263 +853,263 @@ public:
m_error = true;
}
break;
- case 7:
- if ((isdigit(c) || c == ':') && (index - stateStartIndex < 5))
- {
- m_tz[1 + index - stateStartIndex] = c;
- }
- else
- {
- m_error = true;
- }
- break;
- default:
- m_error = true;
- break;
+ case 7:
+ if ((isdigit(c) || c == ':') && (index - stateStartIndex < 5))
+ {
+ m_tz[1 + index - stateStartIndex] = c;
+ }
+ else
+ {
+ m_error = true;
+ }
+ break;
+ default:
+ m_error = true;
+ break;
}
index++;
}
- if (m_tz[0] != 0)
- {
- m_utcAssumed = IsUTCTimeZoneDesignator(m_tz);
- }
-
+ if (m_tz[0] != 0)
+ {
+ m_utcAssumed = IsUTCTimeZoneDesignator(m_tz);
+ }
+
m_error = (m_error || m_state != finalState);
}
-private:
- //Detects whether or not the passed in timezone string is a UTC zone.
- static bool IsUTCTimeZoneDesignator(const char* str)
- {
- size_t len = strlen(str);
-
- if (len > 0)
- {
- if (len == 1 && str[0] == 'Z')
- {
- return true;
- }
-
- if (len == 6 && str[0] == '+'
- && str[1] == '0'
- && str[2] == '0'
- && str[3] == ':'
- && str[4] == '0'
- && str[5] == '0')
- {
- return true;
- }
-
- return false;
- }
-
- return false;
- }
-
- int m_state;
-};
-
-class ISO_8601BasicDateParser : public DateParser
-{
-public:
- ISO_8601BasicDateParser(const char* stringToParse) : DateParser(stringToParse), m_state(0)
- {
- }
-
- //parses "%Y%m%dT%H%M%SZ or "%Y%m%dT%H%M%S000Z"
- void Parse() override
- {
- size_t len = strlen(m_toParse);
-
- //DOS check
- if (len > MAX_LEN)
- {
- AWS_LOGSTREAM_WARN(CLASS_TAG, "Incoming String to parse too long with length: " << len)
- m_error = true;
- return;
- }
-
- size_t index = 0;
- size_t stateStartIndex = 0;
- const int finalState = 7;
-
- while (m_state <= finalState && !m_error && index < len)
- {
- char c = m_toParse[index];
- switch (m_state)
- {
- // On year: %Y
- case 0:
- if (isdigit(c))
- {
- m_parsedTimestamp.tm_year = m_parsedTimestamp.tm_year * 10 + (c - '0');
- if (index - stateStartIndex == 3)
- {
- m_state = 1;
- stateStartIndex = index + 1;
- m_parsedTimestamp.tm_year -= 1900;
- }
- }
- else
- {
- m_error = true;
- }
- break;
- // On month: %m
- case 1:
- if (isdigit(c))
- {
- m_parsedTimestamp.tm_mon = m_parsedTimestamp.tm_mon * 10 + (c - '0');
- if (index - stateStartIndex == 1)
- {
- m_state = 2;
- stateStartIndex = index + 1;
- m_parsedTimestamp.tm_mon -= 1;
- }
- }
- else
- {
- m_error = true;
- }
- break;
- // On month day: %d
- case 2:
- if (c == 'T' && index - stateStartIndex == 2)
- {
- m_state = 3;
- stateStartIndex = index + 1;
- }
- else if (isdigit(c))
- {
- m_parsedTimestamp.tm_mday = m_parsedTimestamp.tm_mday * 10 + (c - '0');
- }
- else
- {
- m_error = true;
- }
- break;
- // On hour: %H
- case 3:
- if (isdigit(c))
- {
- m_parsedTimestamp.tm_hour = m_parsedTimestamp.tm_hour * 10 + (c - '0');
- if (index - stateStartIndex == 1)
- {
- m_state = 4;
- stateStartIndex = index + 1;
- }
- }
- else
- {
- m_error = true;
- }
- break;
- // On minute: %M
- case 4:
- if (isdigit(c))
- {
- m_parsedTimestamp.tm_min = m_parsedTimestamp.tm_min * 10 + (c - '0');
- if (index - stateStartIndex == 1)
- {
- m_state = 5;
- stateStartIndex = index + 1;
- }
- }
- else
- {
- m_error = true;
- }
- break;
- // On second: %S
- case 5:
- if (isdigit(c))
- {
- m_parsedTimestamp.tm_sec = m_parsedTimestamp.tm_sec * 10 + (c - '0');
- if (index - stateStartIndex == 1)
- {
- m_state = 6;
- stateStartIndex = index + 1;
- }
- }
- else
- {
- m_error = true;
- }
- break;
- // On TZ: Z or 000Z
- case 6:
- if ((c == 'Z' || c == '+' || c == '-' ) && (index - stateStartIndex == 0 || index - stateStartIndex == 3))
- {
- m_tz[0] = c;
- m_state = 7;
- stateStartIndex = index + 1;
- }
- else if (!isdigit(c) || index - stateStartIndex > 3)
- {
- m_error = true;
- }
- break;
- case 7:
- if ((isdigit(c) || c == ':') && (index - stateStartIndex < 5))
- {
- m_tz[1 + index - stateStartIndex] = c;
- }
- else
- {
- m_error = true;
- }
- break;
- default:
- m_error = true;
- break;
- }
- index++;
- }
-
- if (m_tz[0] != 0)
- {
- m_utcAssumed = IsUTCTimeZoneDesignator(m_tz);
- }
-
- m_error = (m_error || m_state != finalState);
- }
-
private:
- //Detects whether or not the passed in timezone string is a UTC zone.
- static bool IsUTCTimeZoneDesignator(const char* str)
- {
- size_t len = strlen(str);
-
- if (len > 0)
- {
- if (len == 1 && str[0] == 'Z')
- {
- return true;
- }
-
- if (len == 5 && str[0] == '+'
- && str[1] == '0'
- && str[2] == '0'
- && str[3] == '0'
- && str[4] == '0')
- {
- return true;
- }
-
- return false;
- }
-
- return false;
- }
-
+ //Detects whether or not the passed in timezone string is a UTC zone.
+ static bool IsUTCTimeZoneDesignator(const char* str)
+ {
+ size_t len = strlen(str);
+
+ if (len > 0)
+ {
+ if (len == 1 && str[0] == 'Z')
+ {
+ return true;
+ }
+
+ if (len == 6 && str[0] == '+'
+ && str[1] == '0'
+ && str[2] == '0'
+ && str[3] == ':'
+ && str[4] == '0'
+ && str[5] == '0')
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ return false;
+ }
+
int m_state;
};
-
-} // namespace
+
+class ISO_8601BasicDateParser : public DateParser
+{
+public:
+ ISO_8601BasicDateParser(const char* stringToParse) : DateParser(stringToParse), m_state(0)
+ {
+ }
+
+ //parses "%Y%m%dT%H%M%SZ or "%Y%m%dT%H%M%S000Z"
+ void Parse() override
+ {
+ size_t len = strlen(m_toParse);
+
+ //DOS check
+ if (len > MAX_LEN)
+ {
+ AWS_LOGSTREAM_WARN(CLASS_TAG, "Incoming String to parse too long with length: " << len)
+ m_error = true;
+ return;
+ }
+
+ size_t index = 0;
+ size_t stateStartIndex = 0;
+ const int finalState = 7;
+
+ while (m_state <= finalState && !m_error && index < len)
+ {
+ char c = m_toParse[index];
+ switch (m_state)
+ {
+ // On year: %Y
+ case 0:
+ if (isdigit(c))
+ {
+ m_parsedTimestamp.tm_year = m_parsedTimestamp.tm_year * 10 + (c - '0');
+ if (index - stateStartIndex == 3)
+ {
+ m_state = 1;
+ stateStartIndex = index + 1;
+ m_parsedTimestamp.tm_year -= 1900;
+ }
+ }
+ else
+ {
+ m_error = true;
+ }
+ break;
+ // On month: %m
+ case 1:
+ if (isdigit(c))
+ {
+ m_parsedTimestamp.tm_mon = m_parsedTimestamp.tm_mon * 10 + (c - '0');
+ if (index - stateStartIndex == 1)
+ {
+ m_state = 2;
+ stateStartIndex = index + 1;
+ m_parsedTimestamp.tm_mon -= 1;
+ }
+ }
+ else
+ {
+ m_error = true;
+ }
+ break;
+ // On month day: %d
+ case 2:
+ if (c == 'T' && index - stateStartIndex == 2)
+ {
+ m_state = 3;
+ stateStartIndex = index + 1;
+ }
+ else if (isdigit(c))
+ {
+ m_parsedTimestamp.tm_mday = m_parsedTimestamp.tm_mday * 10 + (c - '0');
+ }
+ else
+ {
+ m_error = true;
+ }
+ break;
+ // On hour: %H
+ case 3:
+ if (isdigit(c))
+ {
+ m_parsedTimestamp.tm_hour = m_parsedTimestamp.tm_hour * 10 + (c - '0');
+ if (index - stateStartIndex == 1)
+ {
+ m_state = 4;
+ stateStartIndex = index + 1;
+ }
+ }
+ else
+ {
+ m_error = true;
+ }
+ break;
+ // On minute: %M
+ case 4:
+ if (isdigit(c))
+ {
+ m_parsedTimestamp.tm_min = m_parsedTimestamp.tm_min * 10 + (c - '0');
+ if (index - stateStartIndex == 1)
+ {
+ m_state = 5;
+ stateStartIndex = index + 1;
+ }
+ }
+ else
+ {
+ m_error = true;
+ }
+ break;
+ // On second: %S
+ case 5:
+ if (isdigit(c))
+ {
+ m_parsedTimestamp.tm_sec = m_parsedTimestamp.tm_sec * 10 + (c - '0');
+ if (index - stateStartIndex == 1)
+ {
+ m_state = 6;
+ stateStartIndex = index + 1;
+ }
+ }
+ else
+ {
+ m_error = true;
+ }
+ break;
+ // On TZ: Z or 000Z
+ case 6:
+ if ((c == 'Z' || c == '+' || c == '-' ) && (index - stateStartIndex == 0 || index - stateStartIndex == 3))
+ {
+ m_tz[0] = c;
+ m_state = 7;
+ stateStartIndex = index + 1;
+ }
+ else if (!isdigit(c) || index - stateStartIndex > 3)
+ {
+ m_error = true;
+ }
+ break;
+ case 7:
+ if ((isdigit(c) || c == ':') && (index - stateStartIndex < 5))
+ {
+ m_tz[1 + index - stateStartIndex] = c;
+ }
+ else
+ {
+ m_error = true;
+ }
+ break;
+ default:
+ m_error = true;
+ break;
+ }
+ index++;
+ }
+
+ if (m_tz[0] != 0)
+ {
+ m_utcAssumed = IsUTCTimeZoneDesignator(m_tz);
+ }
+
+ m_error = (m_error || m_state != finalState);
+ }
+
+private:
+ //Detects whether or not the passed in timezone string is a UTC zone.
+ static bool IsUTCTimeZoneDesignator(const char* str)
+ {
+ size_t len = strlen(str);
+
+ if (len > 0)
+ {
+ if (len == 1 && str[0] == 'Z')
+ {
+ return true;
+ }
+
+ if (len == 5 && str[0] == '+'
+ && str[1] == '0'
+ && str[2] == '0'
+ && str[3] == '0'
+ && str[4] == '0')
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ return false;
+ }
+
+ int m_state;
+};
+
+} // namespace
DateTime::DateTime(const std::chrono::system_clock::time_point& timepointToAssign) : m_time(timepointToAssign), m_valid(true)
-{
+{
}
DateTime::DateTime(int64_t millisSinceEpoch) : m_valid(true)
@@ -1213,10 +1213,10 @@ Aws::String DateTime::ToLocalTimeString(DateFormat format) const
{
case DateFormat::ISO_8601:
return ToLocalTimeString(ISO_8601_LONG_DATE_FORMAT_STR);
- case DateFormat::ISO_8601_BASIC:
- return ToLocalTimeString(ISO_8601_LONG_BASIC_DATE_FORMAT_STR);
+ case DateFormat::ISO_8601_BASIC:
+ return ToLocalTimeString(ISO_8601_LONG_BASIC_DATE_FORMAT_STR);
case DateFormat::RFC822:
- return ToLocalTimeString(RFC822_DATE_FORMAT_STR_WITH_Z);
+ return ToLocalTimeString(RFC822_DATE_FORMAT_STR_WITH_Z);
default:
assert(0);
return "";
@@ -1238,11 +1238,11 @@ Aws::String DateTime::ToGmtString(DateFormat format) const
{
case DateFormat::ISO_8601:
return ToGmtString(ISO_8601_LONG_DATE_FORMAT_STR);
- case DateFormat::ISO_8601_BASIC:
- return ToGmtString(ISO_8601_LONG_BASIC_DATE_FORMAT_STR);
+ case DateFormat::ISO_8601_BASIC:
+ return ToGmtString(ISO_8601_LONG_BASIC_DATE_FORMAT_STR);
case DateFormat::RFC822:
{
- //Windows erroneously drops the local timezone in for %Z
+ //Windows erroneously drops the local timezone in for %Z
Aws::String rfc822GmtString = ToGmtString(RFC822_DATE_FORMAT_STR_MINUS_Z);
rfc822GmtString += " GMT";
return rfc822GmtString;
@@ -1254,7 +1254,7 @@ Aws::String DateTime::ToGmtString(DateFormat format) const
}
Aws::String DateTime::ToGmtString(const char* formatStr) const
-{
+{
struct tm gmtTimeStamp = ConvertTimestampToGmtStruct();
char formattedString[100];
@@ -1343,31 +1343,31 @@ Aws::String DateTime::CalculateGmtTimestampAsString(const char* formatStr)
return now.ToGmtString(formatStr);
}
-Aws::String DateTime::CalculateGmtTimeWithMsPrecision()
-{
- auto now = DateTime::Now();
- struct tm gmtTimeStamp = now.ConvertTimestampToGmtStruct();
-
- char formattedString[100];
- auto len = std::strftime(formattedString, sizeof(formattedString), "%Y-%m-%d %H:%M:%S", &gmtTimeStamp);
- if (len)
- {
- auto ms = now.Millis();
- ms = ms - ms / 1000 * 1000; // calculate the milliseconds as fraction.
- formattedString[len++] = '.';
- int divisor = 100;
- while(divisor)
- {
- auto digit = ms / divisor;
- formattedString[len++] = char('0' + digit);
- ms = ms - divisor * digit;
- divisor /= 10;
- }
- formattedString[len] = '\0';
- }
- return formattedString;
-}
-
+Aws::String DateTime::CalculateGmtTimeWithMsPrecision()
+{
+ auto now = DateTime::Now();
+ struct tm gmtTimeStamp = now.ConvertTimestampToGmtStruct();
+
+ char formattedString[100];
+ auto len = std::strftime(formattedString, sizeof(formattedString), "%Y-%m-%d %H:%M:%S", &gmtTimeStamp);
+ if (len)
+ {
+ auto ms = now.Millis();
+ ms = ms - ms / 1000 * 1000; // calculate the milliseconds as fraction.
+ formattedString[len++] = '.';
+ int divisor = 100;
+ while(divisor)
+ {
+ auto digit = ms / divisor;
+ formattedString[len++] = char('0' + digit);
+ ms = ms - divisor * digit;
+ divisor /= 10;
+ }
+ formattedString[len] = '\0';
+ }
+ return formattedString;
+}
+
int DateTime::CalculateCurrentHour()
{
return Now().GetHour(true);
@@ -1384,14 +1384,14 @@ std::chrono::milliseconds DateTime::Diff(const DateTime& a, const DateTime& b)
return std::chrono::duration_cast<std::chrono::milliseconds>(diff);
}
-std::chrono::milliseconds DateTime::operator-(const DateTime& other) const
+std::chrono::milliseconds DateTime::operator-(const DateTime& other) const
{
auto diff = this->m_time - other.m_time;
return std::chrono::duration_cast<std::chrono::milliseconds>(diff);
}
void DateTime::ConvertTimestampStringToTimePoint(const char* timestamp, DateFormat format)
-{
+{
std::tm timeStruct;
bool isUtc = true;
@@ -1413,17 +1413,17 @@ void DateTime::ConvertTimestampStringToTimePoint(const char* timestamp, DateForm
m_valid = parser.WasParseSuccessful();
isUtc = parser.ShouldIAssumeThisIsUTC();
timeStruct = parser.GetParsedTimestamp();
- break;
+ break;
+ }
+ case DateFormat::ISO_8601_BASIC:
+ {
+ ISO_8601BasicDateParser parser(timestamp);
+ parser.Parse();
+ m_valid = parser.WasParseSuccessful();
+ isUtc = parser.ShouldIAssumeThisIsUTC();
+ timeStruct = parser.GetParsedTimestamp();
+ break;
}
- case DateFormat::ISO_8601_BASIC:
- {
- ISO_8601BasicDateParser parser(timestamp);
- parser.Parse();
- m_valid = parser.WasParseSuccessful();
- isUtc = parser.ShouldIAssumeThisIsUTC();
- timeStruct = parser.GetParsedTimestamp();
- break;
- }
case DateFormat::AutoDetect:
{
RFC822DateParser rfcParser(timestamp);
@@ -1444,24 +1444,24 @@ void DateTime::ConvertTimestampStringToTimePoint(const char* timestamp, DateForm
timeStruct = isoParser.GetParsedTimestamp();
break;
}
- ISO_8601BasicDateParser isoBasicParser(timestamp);
- isoBasicParser.Parse();
- if (isoBasicParser.WasParseSuccessful())
- {
- m_valid = true;
- isUtc = isoBasicParser.ShouldIAssumeThisIsUTC();
- timeStruct = isoBasicParser.GetParsedTimestamp();
- break;
- }
+ ISO_8601BasicDateParser isoBasicParser(timestamp);
+ isoBasicParser.Parse();
+ if (isoBasicParser.WasParseSuccessful())
+ {
+ m_valid = true;
+ isUtc = isoBasicParser.ShouldIAssumeThisIsUTC();
+ timeStruct = isoBasicParser.GetParsedTimestamp();
+ break;
+ }
m_valid = false;
break;
}
- default:
+ default:
assert(0);
- }
-
+ }
+
if (m_valid)
- {
+ {
std::time_t tt;
if(isUtc)
{
@@ -1474,7 +1474,7 @@ void DateTime::ConvertTimestampStringToTimePoint(const char* timestamp, DateForm
tt = std::mktime(&timeStruct);
}
m_time = std::chrono::system_clock::from_time_t(tt);
- }
+ }
}
tm DateTime::GetTimeStruct(bool localTime) const
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/Directory.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/Directory.cpp
index 53df08a0df..49ca56b280 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/Directory.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/Directory.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/platform/FileSystem.h>
#include <aws/core/utils/memory/stl/AWSQueue.h>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/EnumParseOverflowContainer.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/EnumParseOverflowContainer.cpp
index dda261995b..eaeba1d910 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/EnumParseOverflowContainer.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/EnumParseOverflowContainer.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/EnumParseOverflowContainer.h>
#include <aws/core/utils/logging/LogMacros.h>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/FileSystemUtils.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/FileSystemUtils.cpp
index 7ddb31c829..c47f750960 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/FileSystemUtils.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/FileSystemUtils.cpp
@@ -1,6 +1,6 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/core/utils/FileSystemUtils.h>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/GetTheLights.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/GetTheLights.cpp
index d693ccedf0..6e78b546ab 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/GetTheLights.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/GetTheLights.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/GetTheLights.h>
#include <cassert>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/HashingUtils.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/HashingUtils.cpp
index e077530c80..147bddf33e 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/HashingUtils.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/HashingUtils.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/logging/LogMacros.h>
#include <aws/core/utils/HashingUtils.h>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/StringUtils.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/StringUtils.cpp
index 00c940a9bf..e1deb3f046 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/StringUtils.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/StringUtils.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/StringUtils.h>
@@ -75,56 +75,56 @@ bool StringUtils::CaselessCompare(const char* value1, const char* value2)
Aws::Vector<Aws::String> StringUtils::Split(const Aws::String& toSplit, char splitOn)
{
- return Split(toSplit, splitOn, SIZE_MAX, SplitOptions::NOT_SET);
+ return Split(toSplit, splitOn, SIZE_MAX, SplitOptions::NOT_SET);
+}
+
+Aws::Vector<Aws::String> StringUtils::Split(const Aws::String& toSplit, char splitOn, SplitOptions option)
+{
+ return Split(toSplit, splitOn, SIZE_MAX, option);
}
-Aws::Vector<Aws::String> StringUtils::Split(const Aws::String& toSplit, char splitOn, SplitOptions option)
-{
- return Split(toSplit, splitOn, SIZE_MAX, option);
-}
-
Aws::Vector<Aws::String> StringUtils::Split(const Aws::String& toSplit, char splitOn, size_t numOfTargetParts)
{
- return Split(toSplit, splitOn, numOfTargetParts, SplitOptions::NOT_SET);
-}
-
-Aws::Vector<Aws::String> StringUtils::Split(const Aws::String& toSplit, char splitOn, size_t numOfTargetParts, SplitOptions option)
-{
+ return Split(toSplit, splitOn, numOfTargetParts, SplitOptions::NOT_SET);
+}
+
+Aws::Vector<Aws::String> StringUtils::Split(const Aws::String& toSplit, char splitOn, size_t numOfTargetParts, SplitOptions option)
+{
Aws::Vector<Aws::String> returnValues;
Aws::StringStream input(toSplit);
Aws::String item;
while(returnValues.size() < numOfTargetParts - 1 && std::getline(input, item, splitOn))
{
- if (!item.empty() || option == SplitOptions::INCLUDE_EMPTY_ENTRIES)
+ if (!item.empty() || option == SplitOptions::INCLUDE_EMPTY_ENTRIES)
{
returnValues.emplace_back(std::move(item));
}
}
- if (std::getline(input, item, static_cast<char>(EOF)))
+ if (std::getline(input, item, static_cast<char>(EOF)))
{
- if (option != SplitOptions::INCLUDE_EMPTY_ENTRIES)
- {
- // Trim all leading delimiters.
- item.erase(item.begin(), std::find_if(item.begin(), item.end(), [splitOn](int ch) { return ch != splitOn; }));
- if (!item.empty())
- {
- returnValues.emplace_back(std::move(item));
- }
- }
- else
- {
- returnValues.emplace_back(std::move(item));
- }
-
+ if (option != SplitOptions::INCLUDE_EMPTY_ENTRIES)
+ {
+ // Trim all leading delimiters.
+ item.erase(item.begin(), std::find_if(item.begin(), item.end(), [splitOn](int ch) { return ch != splitOn; }));
+ if (!item.empty())
+ {
+ returnValues.emplace_back(std::move(item));
+ }
+ }
+ else
+ {
+ returnValues.emplace_back(std::move(item));
+ }
+
+ }
+ // To handle the case when there are trailing delimiters.
+ else if (!toSplit.empty() && toSplit.back() == splitOn && option == SplitOptions::INCLUDE_EMPTY_ENTRIES)
+ {
+ returnValues.emplace_back();
}
- // To handle the case when there are trailing delimiters.
- else if (!toSplit.empty() && toSplit.back() == splitOn && option == SplitOptions::INCLUDE_EMPTY_ENTRIES)
- {
- returnValues.emplace_back();
- }
-
+
return returnValues;
}
@@ -282,20 +282,20 @@ Aws::String StringUtils::URLDecode(const char* safe)
return unescaped;
}
-static bool IsSpace(int ch)
-{
- if (ch < -1 || ch > 255)
- {
- return false;
- }
-
- return ::isspace(ch) != 0;
-}
-
+static bool IsSpace(int ch)
+{
+ if (ch < -1 || ch > 255)
+ {
+ return false;
+ }
+
+ return ::isspace(ch) != 0;
+}
+
Aws::String StringUtils::LTrim(const char* source)
{
Aws::String copy(source);
- copy.erase(copy.begin(), std::find_if(copy.begin(), copy.end(), [](int ch) { return !IsSpace(ch); }));
+ copy.erase(copy.begin(), std::find_if(copy.begin(), copy.end(), [](int ch) { return !IsSpace(ch); }));
return copy;
}
@@ -303,7 +303,7 @@ Aws::String StringUtils::LTrim(const char* source)
Aws::String StringUtils::RTrim(const char* source)
{
Aws::String copy(source);
- copy.erase(std::find_if(copy.rbegin(), copy.rend(), [](int ch) { return !IsSpace(ch); }).base(), copy.end());
+ copy.erase(std::find_if(copy.rbegin(), copy.rend(), [](int ch) { return !IsSpace(ch); }).base(), copy.end());
return copy;
}
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/TempFile.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/TempFile.cpp
index 74f5d0327e..7bc07266c9 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/TempFile.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/TempFile.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/FileSystemUtils.h>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/UUID.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/UUID.cpp
index 5fdd6d800a..862f3eacdd 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/UUID.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/UUID.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/UUID.h>
#include <aws/core/utils/HashingUtils.h>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/base64/Base64.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/base64/Base64.cpp
index 9ea8afd0de..2103d6d5a6 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/base64/Base64.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/base64/Base64.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/base64/Base64.h>
#include <cstring>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/Cipher.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/Cipher.cpp
index 03a518f073..1c844273f4 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/Cipher.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/Cipher.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/crypto/Cipher.h>
#include <aws/core/utils/crypto/Factories.h>
@@ -27,31 +27,31 @@ namespace Aws
//swap byte ordering
template<class T>
typename std::enable_if<std::is_unsigned<T>::value, T>::type
- bswap(T i, T j = 0u, std::size_t n = 0u)
+ bswap(T i, T j = 0u, std::size_t n = 0u)
{
return n == sizeof(T) ? j :
bswap<T>(i >> CHAR_BIT, (j << CHAR_BIT) | (i & (T)(unsigned char)(-1)), n + 1);
}
CryptoBuffer IncrementCTRCounter(const CryptoBuffer& counter, uint32_t numberOfBlocks)
- {
+ {
// minium counter size is 12 bytes. This isn't a variable because some compilers
// are stupid and thing that variable is unused.
assert(counter.GetLength() >= 12);
- CryptoBuffer incrementedCounter(counter);
+ CryptoBuffer incrementedCounter(counter);
//get the last 4 bytes and manipulate them as an integer.
- uint32_t* ctrPtr = (uint32_t*)(incrementedCounter.GetUnderlyingData() + incrementedCounter.GetLength() - sizeof(int32_t));
+ uint32_t* ctrPtr = (uint32_t*)(incrementedCounter.GetUnderlyingData() + incrementedCounter.GetLength() - sizeof(int32_t));
if(IS_BIG_ENDIAN)
{
//you likely are not Big Endian, but
//if it's big endian, just go ahead and increment it... done
- *ctrPtr += numberOfBlocks;
+ *ctrPtr += numberOfBlocks;
}
else
{
- //otherwise, swap the byte ordering of the integer we loaded from the buffer (because it is backwards). However, the number of blocks is already properly
+ //otherwise, swap the byte ordering of the integer we loaded from the buffer (because it is backwards). However, the number of blocks is already properly
//aligned. Once we compute the new value, swap it back so that the mirroring operation goes back to the actual buffer.
*ctrPtr = bswap<uint32_t>(bswap<uint32_t>(*ctrPtr) + numberOfBlocks);
}
@@ -65,14 +65,14 @@ namespace Aws
CryptoBuffer bytes(lengthBytes);
size_t lengthToGenerate = ctrMode ? (3 * bytes.GetLength()) / 4 : bytes.GetLength();
-
+
rng->GetBytes(bytes.GetUnderlyingData(), lengthToGenerate);
if(!*rng)
{
AWS_LOGSTREAM_FATAL(LOG_TAG, "Random Number generation failed. Abort all crypto operations.");
assert(false);
- abort();
+ abort();
}
return bytes;
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/ContentCryptoMaterial.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/ContentCryptoMaterial.cpp
index 38542bef76..3036bd70eb 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/ContentCryptoMaterial.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/ContentCryptoMaterial.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/crypto/ContentCryptoMaterial.h>
#include <aws/core/utils/crypto/Cipher.h>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/ContentCryptoScheme.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/ContentCryptoScheme.cpp
index 7bd0fd8d75..f39a75df2c 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/ContentCryptoScheme.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/ContentCryptoScheme.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/crypto/ContentCryptoScheme.h>
#include <aws/core/utils/HashingUtils.h>
#include <aws/core/utils/EnumParseOverflowContainer.h>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/CryptoBuf.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/CryptoBuf.cpp
index 9e000ad1b4..2b47097679 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/CryptoBuf.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/CryptoBuf.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/crypto/CryptoBuf.h>
@@ -94,7 +94,7 @@ namespace Aws
if (cryptoBuffer.GetLength() && m_cipher)
{
CryptoBuffer putBackArea(m_putBack);
-
+
m_isBuf = CryptoBuffer({&putBackArea, &cryptoBuffer});
//in the very unlikely case that the cipher had less output than the source stream.
assert(seekTo <= index);
@@ -294,19 +294,19 @@ namespace Aws
if(cryptoBuf.GetLength())
{
//allow mid block decryption. We have to decrypt it, but we don't have to write it to the stream.
- //the assumption here is that tellp() will always be 0 or >= 16 bytes. The block offset should only
+ //the assumption here is that tellp() will always be 0 or >= 16 bytes. The block offset should only
//be the offset of the first block read.
- size_t len = cryptoBuf.GetLength();
- size_t blockOffset = m_stream.tellp() > m_blockOffset ? 0 : m_blockOffset;
- if (len > blockOffset)
- {
- m_stream.write(reinterpret_cast<char*>(cryptoBuf.GetUnderlyingData() + blockOffset), len - blockOffset);
- m_blockOffset = 0;
- }
- else
- {
- m_blockOffset -= static_cast<int16_t>(len);
- }
+ size_t len = cryptoBuf.GetLength();
+ size_t blockOffset = m_stream.tellp() > m_blockOffset ? 0 : m_blockOffset;
+ if (len > blockOffset)
+ {
+ m_stream.write(reinterpret_cast<char*>(cryptoBuf.GetUnderlyingData() + blockOffset), len - blockOffset);
+ m_blockOffset = 0;
+ }
+ else
+ {
+ m_blockOffset -= static_cast<int16_t>(len);
+ }
}
return true;
}
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/CryptoStream.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/CryptoStream.cpp
index 7d46b9d9ea..2d645f7427 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/CryptoStream.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/CryptoStream.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/crypto/CryptoStream.h>
namespace Aws
@@ -44,7 +44,7 @@ namespace Aws
void SymmetricCryptoStream::Finalize()
{
- assert(m_cryptoBuf);
+ assert(m_cryptoBuf);
m_cryptoBuf->Finalize();
}
}
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/EncryptionMaterials.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/EncryptionMaterials.cpp
index 7ea98027ff..d000c86baa 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/EncryptionMaterials.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/EncryptionMaterials.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/crypto/EncryptionMaterials.h>
namespace Aws
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/KeyWrapAlgorithm.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/KeyWrapAlgorithm.cpp
index 9b9b5b144f..b9e098775c 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/KeyWrapAlgorithm.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/KeyWrapAlgorithm.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/crypto/KeyWrapAlgorithm.h>
#include <aws/core/utils/HashingUtils.h>
#include <aws/core/utils/EnumParseOverflowContainer.h>
@@ -18,9 +18,9 @@ namespace Aws
namespace KeyWrapAlgorithmMapper
{
static const int keyWrapAlgorithm_KMS_HASH = HashingUtils::HashString("kms");
- static const int keyWrapAlgorithm_KMS_CONTEXT_HASH = HashingUtils::HashString("kms+context");
+ static const int keyWrapAlgorithm_KMS_CONTEXT_HASH = HashingUtils::HashString("kms+context");
static const int keyWrapAlgorithm_KeyWrap_HASH = HashingUtils::HashString("AESWrap");
- static const int keyWrapAlgorithm_AES_GCM_HASH = HashingUtils::HashString("AES/GCM");
+ static const int keyWrapAlgorithm_AES_GCM_HASH = HashingUtils::HashString("AES/GCM");
KeyWrapAlgorithm GetKeyWrapAlgorithmForName(const Aws::String& name)
{
@@ -29,17 +29,17 @@ namespace Aws
{
return KeyWrapAlgorithm::KMS;
}
- else if (hashcode == keyWrapAlgorithm_KMS_CONTEXT_HASH)
- {
- return KeyWrapAlgorithm::KMS_CONTEXT;
- }
+ else if (hashcode == keyWrapAlgorithm_KMS_CONTEXT_HASH)
+ {
+ return KeyWrapAlgorithm::KMS_CONTEXT;
+ }
else if (hashcode == keyWrapAlgorithm_KeyWrap_HASH)
{
return KeyWrapAlgorithm::AES_KEY_WRAP;
- }
- else if (hashcode == keyWrapAlgorithm_AES_GCM_HASH)
- {
- return KeyWrapAlgorithm::AES_GCM;
+ }
+ else if (hashcode == keyWrapAlgorithm_AES_GCM_HASH)
+ {
+ return KeyWrapAlgorithm::AES_GCM;
}
assert(0);
return KeyWrapAlgorithm::NONE;
@@ -51,12 +51,12 @@ namespace Aws
{
case KeyWrapAlgorithm::KMS:
return "kms";
- case KeyWrapAlgorithm::KMS_CONTEXT:
- return "kms+context";
+ case KeyWrapAlgorithm::KMS_CONTEXT:
+ return "kms+context";
case KeyWrapAlgorithm::AES_KEY_WRAP:
return "AESWrap";
- case KeyWrapAlgorithm::AES_GCM:
- return "AES/GCM";
+ case KeyWrapAlgorithm::AES_GCM:
+ return "AES/GCM";
default:
assert(0);
}
@@ -65,4 +65,4 @@ namespace Aws
}//namespace KeyWrapAlgorithmMapper
}//namespace Crypto
}//namespace Utils
-}//namespace Aws
+}//namespace Aws
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/MD5.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/MD5.cpp
index 3a26004c79..bf14ace1ad 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/MD5.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/MD5.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/crypto/MD5.h>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/Sha256.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/Sha256.cpp
index a9a36e6b3b..178df00d37 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/Sha256.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/Sha256.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/crypto/Sha256.h>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/Sha256HMAC.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/Sha256HMAC.cpp
index a1a362bb9c..ecc1f06529 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/Sha256HMAC.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/Sha256HMAC.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/crypto/Sha256HMAC.h>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/factory/Factories.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/factory/Factories.cpp
index 220968cffc..bff0382241 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/factory/Factories.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/factory/Factories.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/crypto/Factories.h>
@@ -9,11 +9,11 @@
#include <aws/core/utils/crypto/HMAC.h>
#if ENABLE_BCRYPT_ENCRYPTION
- #error #include <aws/core/utils/crypto/bcrypt/CryptoImpl.h>
+ #error #include <aws/core/utils/crypto/bcrypt/CryptoImpl.h>
#elif ENABLE_OPENSSL_ENCRYPTION
#include <aws/core/utils/crypto/openssl/CryptoImpl.h>
#elif ENABLE_COMMONCRYPTO_ENCRYPTION
- #error #include <aws/core/utils/crypto/commoncrypto/CryptoImpl.h>
+ #error #include <aws/core/utils/crypto/commoncrypto/CryptoImpl.h>
#include <aws/core/utils/logging/LogMacros.h>
#else
// if you don't have any encryption you still need to pull in the interface definitions
@@ -29,60 +29,60 @@ using namespace Aws::Utils::Crypto;
static const char *s_allocationTag = "CryptoFactory";
-static std::shared_ptr<HashFactory>& GetMD5Factory()
-{
- static std::shared_ptr<HashFactory> s_MD5Factory(nullptr);
- return s_MD5Factory;
-}
-
-static std::shared_ptr<HashFactory>& GetSha256Factory()
-{
- static std::shared_ptr<HashFactory> s_Sha256Factory(nullptr);
- return s_Sha256Factory;
-}
-
-static std::shared_ptr<HMACFactory>& GetSha256HMACFactory()
-{
- static std::shared_ptr<HMACFactory> s_Sha256HMACFactory(nullptr);
- return s_Sha256HMACFactory;
-}
-
-static std::shared_ptr<SymmetricCipherFactory>& GetAES_CBCFactory()
-{
- static std::shared_ptr<SymmetricCipherFactory> s_AES_CBCFactory(nullptr);
- return s_AES_CBCFactory;
-}
-
-static std::shared_ptr<SymmetricCipherFactory>& GetAES_CTRFactory()
-{
- static std::shared_ptr<SymmetricCipherFactory> s_AES_CTRFactory(nullptr);
- return s_AES_CTRFactory;
-}
-
-static std::shared_ptr<SymmetricCipherFactory>& GetAES_GCMFactory()
-{
- static std::shared_ptr<SymmetricCipherFactory> s_AES_GCMFactory(nullptr);
- return s_AES_GCMFactory;
-}
-
-static std::shared_ptr<SymmetricCipherFactory>& GetAES_KeyWrapFactory()
-{
- static std::shared_ptr<SymmetricCipherFactory> s_AES_KeyWrapFactory(nullptr);
- return s_AES_KeyWrapFactory;
-}
-
-static std::shared_ptr<SecureRandomFactory>& GetSecureRandomFactory()
-{
- static std::shared_ptr<SecureRandomFactory> s_SecureRandomFactory(nullptr);
- return s_SecureRandomFactory;
-}
-
-static std::shared_ptr<SecureRandomBytes>& GetSecureRandom()
-{
- static std::shared_ptr<SecureRandomBytes> s_SecureRandom(nullptr);
- return s_SecureRandom;
-}
-
+static std::shared_ptr<HashFactory>& GetMD5Factory()
+{
+ static std::shared_ptr<HashFactory> s_MD5Factory(nullptr);
+ return s_MD5Factory;
+}
+
+static std::shared_ptr<HashFactory>& GetSha256Factory()
+{
+ static std::shared_ptr<HashFactory> s_Sha256Factory(nullptr);
+ return s_Sha256Factory;
+}
+
+static std::shared_ptr<HMACFactory>& GetSha256HMACFactory()
+{
+ static std::shared_ptr<HMACFactory> s_Sha256HMACFactory(nullptr);
+ return s_Sha256HMACFactory;
+}
+
+static std::shared_ptr<SymmetricCipherFactory>& GetAES_CBCFactory()
+{
+ static std::shared_ptr<SymmetricCipherFactory> s_AES_CBCFactory(nullptr);
+ return s_AES_CBCFactory;
+}
+
+static std::shared_ptr<SymmetricCipherFactory>& GetAES_CTRFactory()
+{
+ static std::shared_ptr<SymmetricCipherFactory> s_AES_CTRFactory(nullptr);
+ return s_AES_CTRFactory;
+}
+
+static std::shared_ptr<SymmetricCipherFactory>& GetAES_GCMFactory()
+{
+ static std::shared_ptr<SymmetricCipherFactory> s_AES_GCMFactory(nullptr);
+ return s_AES_GCMFactory;
+}
+
+static std::shared_ptr<SymmetricCipherFactory>& GetAES_KeyWrapFactory()
+{
+ static std::shared_ptr<SymmetricCipherFactory> s_AES_KeyWrapFactory(nullptr);
+ return s_AES_KeyWrapFactory;
+}
+
+static std::shared_ptr<SecureRandomFactory>& GetSecureRandomFactory()
+{
+ static std::shared_ptr<SecureRandomFactory> s_SecureRandomFactory(nullptr);
+ return s_SecureRandomFactory;
+}
+
+static std::shared_ptr<SecureRandomBytes>& GetSecureRandom()
+{
+ static std::shared_ptr<SecureRandomBytes> s_SecureRandom(nullptr);
+ return s_SecureRandom;
+}
+
static bool s_InitCleanupOpenSSLFlag(false);
class DefaultMD5Factory : public HashFactory
@@ -240,7 +240,7 @@ public:
/**
* Factory method. Returns cipher implementation. See the SymmetricCipher class for more details.
*/
- std::shared_ptr<SymmetricCipher> CreateImplementation(const CryptoBuffer& key, const CryptoBuffer& iv, const CryptoBuffer&, const CryptoBuffer&) const override
+ std::shared_ptr<SymmetricCipher> CreateImplementation(const CryptoBuffer& key, const CryptoBuffer& iv, const CryptoBuffer&, const CryptoBuffer&) const override
{
#if ENABLE_BCRYPT_ENCRYPTION
return Aws::MakeShared<AES_CBC_Cipher_BCrypt>(s_allocationTag, key, iv);
@@ -258,7 +258,7 @@ public:
/**
* Factory method. Returns cipher implementation. See the SymmetricCipher class for more details.
*/
- std::shared_ptr<SymmetricCipher> CreateImplementation(CryptoBuffer&& key, CryptoBuffer&& iv, CryptoBuffer&&, CryptoBuffer&&) const override
+ std::shared_ptr<SymmetricCipher> CreateImplementation(CryptoBuffer&& key, CryptoBuffer&& iv, CryptoBuffer&&, CryptoBuffer&&) const override
{
#if ENABLE_BCRYPT_ENCRYPTION
return Aws::MakeShared<AES_CBC_Cipher_BCrypt>(s_allocationTag, key, iv);
@@ -322,7 +322,7 @@ public:
/**
* Factory method. Returns cipher implementation. See the SymmetricCipher class for more details.
*/
- std::shared_ptr<SymmetricCipher> CreateImplementation(const CryptoBuffer& key, const CryptoBuffer& iv, const CryptoBuffer&, const CryptoBuffer&) const override
+ std::shared_ptr<SymmetricCipher> CreateImplementation(const CryptoBuffer& key, const CryptoBuffer& iv, const CryptoBuffer&, const CryptoBuffer&) const override
{
#if ENABLE_BCRYPT_ENCRYPTION
return Aws::MakeShared<AES_CTR_Cipher_BCrypt>(s_allocationTag, key, iv);
@@ -340,7 +340,7 @@ public:
/**
* Factory method. Returns cipher implementation. See the SymmetricCipher class for more details.
*/
- std::shared_ptr<SymmetricCipher> CreateImplementation(CryptoBuffer&& key, CryptoBuffer&& iv, CryptoBuffer&&, CryptoBuffer&&) const override
+ std::shared_ptr<SymmetricCipher> CreateImplementation(CryptoBuffer&& key, CryptoBuffer&& iv, CryptoBuffer&&, CryptoBuffer&&) const override
{
#if ENABLE_BCRYPT_ENCRYPTION
return Aws::MakeShared<AES_CTR_Cipher_BCrypt>(s_allocationTag, key, iv);
@@ -395,64 +395,64 @@ public:
#elif ENABLE_OPENSSL_ENCRYPTION
return Aws::MakeShared<AES_GCM_Cipher_OpenSSL>(s_allocationTag, key);
#elif ENABLE_COMMONCRYPTO_ENCRYPTION
- return Aws::MakeShared<AES_GCM_Cipher_CommonCrypto>(s_allocationTag, key);
-#else
+ return Aws::MakeShared<AES_GCM_Cipher_CommonCrypto>(s_allocationTag, key);
+#else
AWS_UNREFERENCED_PARAM(key);
-
+
return nullptr;
-#endif
- }
-
- std::shared_ptr<SymmetricCipher> CreateImplementation(const CryptoBuffer& key, const CryptoBuffer* aad) const override
- {
-#if ENABLE_BCRYPT_ENCRYPTION
- return Aws::MakeShared<AES_GCM_Cipher_BCrypt>(s_allocationTag, key, aad);
-#elif ENABLE_OPENSSL_ENCRYPTION
- return Aws::MakeShared<AES_GCM_Cipher_OpenSSL>(s_allocationTag, key, aad);
-#elif ENABLE_COMMONCRYPTO_ENCRYPTION
- return Aws::MakeShared<AES_GCM_Cipher_CommonCrypto>(s_allocationTag, key, aad);
+#endif
+ }
+
+ std::shared_ptr<SymmetricCipher> CreateImplementation(const CryptoBuffer& key, const CryptoBuffer* aad) const override
+ {
+#if ENABLE_BCRYPT_ENCRYPTION
+ return Aws::MakeShared<AES_GCM_Cipher_BCrypt>(s_allocationTag, key, aad);
+#elif ENABLE_OPENSSL_ENCRYPTION
+ return Aws::MakeShared<AES_GCM_Cipher_OpenSSL>(s_allocationTag, key, aad);
+#elif ENABLE_COMMONCRYPTO_ENCRYPTION
+ return Aws::MakeShared<AES_GCM_Cipher_CommonCrypto>(s_allocationTag, key, aad);
#else
AWS_UNREFERENCED_PARAM(key);
- AWS_UNREFERENCED_PARAM(aad);
+ AWS_UNREFERENCED_PARAM(aad);
return nullptr;
#endif
}
-
+
/**
* Factory method. Returns cipher implementation. See the SymmetricCipher class for more details.
*/
- std::shared_ptr<SymmetricCipher> CreateImplementation(const CryptoBuffer& key, const CryptoBuffer& iv, const CryptoBuffer& tag, const CryptoBuffer& aad) const override
+ std::shared_ptr<SymmetricCipher> CreateImplementation(const CryptoBuffer& key, const CryptoBuffer& iv, const CryptoBuffer& tag, const CryptoBuffer& aad) const override
{
#if ENABLE_BCRYPT_ENCRYPTION
- return Aws::MakeShared<AES_GCM_Cipher_BCrypt>(s_allocationTag, key, iv, tag, aad);
+ return Aws::MakeShared<AES_GCM_Cipher_BCrypt>(s_allocationTag, key, iv, tag, aad);
#elif ENABLE_OPENSSL_ENCRYPTION
- return Aws::MakeShared<AES_GCM_Cipher_OpenSSL>(s_allocationTag, key, iv, tag, aad);
+ return Aws::MakeShared<AES_GCM_Cipher_OpenSSL>(s_allocationTag, key, iv, tag, aad);
#elif ENABLE_COMMONCRYPTO_ENCRYPTION
- return Aws::MakeShared<AES_GCM_Cipher_CommonCrypto>(s_allocationTag, key, iv, tag, aad);
+ return Aws::MakeShared<AES_GCM_Cipher_CommonCrypto>(s_allocationTag, key, iv, tag, aad);
#else
AWS_UNREFERENCED_PARAM(key);
AWS_UNREFERENCED_PARAM(iv);
AWS_UNREFERENCED_PARAM(tag);
- AWS_UNREFERENCED_PARAM(aad);
+ AWS_UNREFERENCED_PARAM(aad);
return nullptr;
#endif
}
/**
* Factory method. Returns cipher implementation. See the SymmetricCipher class for more details.
*/
- std::shared_ptr<SymmetricCipher> CreateImplementation(CryptoBuffer&& key, CryptoBuffer&& iv, CryptoBuffer&& tag, CryptoBuffer&& aad) const override
+ std::shared_ptr<SymmetricCipher> CreateImplementation(CryptoBuffer&& key, CryptoBuffer&& iv, CryptoBuffer&& tag, CryptoBuffer&& aad) const override
{
#if ENABLE_BCRYPT_ENCRYPTION
- return Aws::MakeShared<AES_GCM_Cipher_BCrypt>(s_allocationTag, std::move(key), std::move(iv), std::move(tag), std::move(aad));
+ return Aws::MakeShared<AES_GCM_Cipher_BCrypt>(s_allocationTag, std::move(key), std::move(iv), std::move(tag), std::move(aad));
#elif ENABLE_OPENSSL_ENCRYPTION
- return Aws::MakeShared<AES_GCM_Cipher_OpenSSL>(s_allocationTag, std::move(key), std::move(iv), std::move(tag), std::move(aad));
+ return Aws::MakeShared<AES_GCM_Cipher_OpenSSL>(s_allocationTag, std::move(key), std::move(iv), std::move(tag), std::move(aad));
#elif ENABLE_COMMONCRYPTO_ENCRYPTION
- return Aws::MakeShared<AES_GCM_Cipher_CommonCrypto>(s_allocationTag, std::move(key), std::move(iv), std::move(tag), std::move(aad));
+ return Aws::MakeShared<AES_GCM_Cipher_CommonCrypto>(s_allocationTag, std::move(key), std::move(iv), std::move(tag), std::move(aad));
#else
AWS_UNREFERENCED_PARAM(key);
AWS_UNREFERENCED_PARAM(iv);
AWS_UNREFERENCED_PARAM(tag);
- AWS_UNREFERENCED_PARAM(aad);
+ AWS_UNREFERENCED_PARAM(aad);
return nullptr;
#endif
}
@@ -505,7 +505,7 @@ public:
/**
* Factory method. Returns cipher implementation. See the SymmetricCipher class for more details.
*/
- std::shared_ptr<SymmetricCipher> CreateImplementation(const CryptoBuffer& key, const CryptoBuffer& iv, const CryptoBuffer& tag, const CryptoBuffer&) const override
+ std::shared_ptr<SymmetricCipher> CreateImplementation(const CryptoBuffer& key, const CryptoBuffer& iv, const CryptoBuffer& tag, const CryptoBuffer&) const override
{
AWS_UNREFERENCED_PARAM(key);
AWS_UNREFERENCED_PARAM(iv);
@@ -515,7 +515,7 @@ public:
/**
* Factory method. Returns cipher implementation. See the SymmetricCipher class for more details.
*/
- std::shared_ptr<SymmetricCipher> CreateImplementation(CryptoBuffer&& key, CryptoBuffer&& iv, CryptoBuffer&& tag, CryptoBuffer&&) const override
+ std::shared_ptr<SymmetricCipher> CreateImplementation(CryptoBuffer&& key, CryptoBuffer&& iv, CryptoBuffer&& tag, CryptoBuffer&&) const override
{
AWS_UNREFERENCED_PARAM(key);
AWS_UNREFERENCED_PARAM(iv);
@@ -606,190 +606,190 @@ void Aws::Utils::Crypto::SetInitCleanupOpenSSLFlag(bool initCleanupFlag)
void Aws::Utils::Crypto::InitCrypto()
{
- if(GetMD5Factory())
+ if(GetMD5Factory())
{
- GetMD5Factory()->InitStaticState();
+ GetMD5Factory()->InitStaticState();
}
else
{
- GetMD5Factory() = Aws::MakeShared<DefaultMD5Factory>(s_allocationTag);
- GetMD5Factory()->InitStaticState();
+ GetMD5Factory() = Aws::MakeShared<DefaultMD5Factory>(s_allocationTag);
+ GetMD5Factory()->InitStaticState();
}
- if(GetSha256Factory())
+ if(GetSha256Factory())
{
- GetSha256Factory()->InitStaticState();
+ GetSha256Factory()->InitStaticState();
}
else
{
- GetSha256Factory() = Aws::MakeShared<DefaultSHA256Factory>(s_allocationTag);
- GetSha256Factory()->InitStaticState();
+ GetSha256Factory() = Aws::MakeShared<DefaultSHA256Factory>(s_allocationTag);
+ GetSha256Factory()->InitStaticState();
}
- if(GetSha256HMACFactory())
+ if(GetSha256HMACFactory())
{
- GetSha256HMACFactory()->InitStaticState();
+ GetSha256HMACFactory()->InitStaticState();
}
else
{
- GetSha256HMACFactory() = Aws::MakeShared<DefaultSHA256HmacFactory>(s_allocationTag);
- GetSha256HMACFactory()->InitStaticState();
+ GetSha256HMACFactory() = Aws::MakeShared<DefaultSHA256HmacFactory>(s_allocationTag);
+ GetSha256HMACFactory()->InitStaticState();
}
- if(GetAES_CBCFactory())
+ if(GetAES_CBCFactory())
{
- GetAES_CBCFactory()->InitStaticState();
+ GetAES_CBCFactory()->InitStaticState();
}
else
{
- GetAES_CBCFactory() = Aws::MakeShared<DefaultAES_CBCFactory>(s_allocationTag);
- GetAES_CBCFactory()->InitStaticState();
+ GetAES_CBCFactory() = Aws::MakeShared<DefaultAES_CBCFactory>(s_allocationTag);
+ GetAES_CBCFactory()->InitStaticState();
}
- if(GetAES_CTRFactory())
+ if(GetAES_CTRFactory())
{
- GetAES_CTRFactory()->InitStaticState();
+ GetAES_CTRFactory()->InitStaticState();
}
else
{
- GetAES_CTRFactory() = Aws::MakeShared<DefaultAES_CTRFactory>(s_allocationTag);
- GetAES_CTRFactory()->InitStaticState();
+ GetAES_CTRFactory() = Aws::MakeShared<DefaultAES_CTRFactory>(s_allocationTag);
+ GetAES_CTRFactory()->InitStaticState();
}
- if(GetAES_GCMFactory())
+ if(GetAES_GCMFactory())
{
- GetAES_GCMFactory()->InitStaticState();
+ GetAES_GCMFactory()->InitStaticState();
}
else
{
- GetAES_GCMFactory() = Aws::MakeShared<DefaultAES_GCMFactory>(s_allocationTag);
- GetAES_GCMFactory()->InitStaticState();
+ GetAES_GCMFactory() = Aws::MakeShared<DefaultAES_GCMFactory>(s_allocationTag);
+ GetAES_GCMFactory()->InitStaticState();
}
- if (!GetAES_KeyWrapFactory())
+ if (!GetAES_KeyWrapFactory())
{
- GetAES_KeyWrapFactory() = Aws::MakeShared<DefaultAES_KeyWrapFactory>(s_allocationTag);
+ GetAES_KeyWrapFactory() = Aws::MakeShared<DefaultAES_KeyWrapFactory>(s_allocationTag);
}
- GetAES_KeyWrapFactory()->InitStaticState();
+ GetAES_KeyWrapFactory()->InitStaticState();
- if(GetSecureRandomFactory())
+ if(GetSecureRandomFactory())
{
- GetSecureRandomFactory()->InitStaticState();
+ GetSecureRandomFactory()->InitStaticState();
}
else
{
- GetSecureRandomFactory() = Aws::MakeShared<DefaultSecureRandFactory>(s_allocationTag);
- GetSecureRandomFactory()->InitStaticState();
- }
-
- GetSecureRandom() = GetSecureRandomFactory()->CreateImplementation();
+ GetSecureRandomFactory() = Aws::MakeShared<DefaultSecureRandFactory>(s_allocationTag);
+ GetSecureRandomFactory()->InitStaticState();
+ }
+
+ GetSecureRandom() = GetSecureRandomFactory()->CreateImplementation();
}
void Aws::Utils::Crypto::CleanupCrypto()
{
- if(GetMD5Factory())
+ if(GetMD5Factory())
{
- GetMD5Factory()->CleanupStaticState();
- GetMD5Factory() = nullptr;
+ GetMD5Factory()->CleanupStaticState();
+ GetMD5Factory() = nullptr;
}
- if(GetSha256Factory())
+ if(GetSha256Factory())
{
- GetSha256Factory()->CleanupStaticState();
- GetSha256Factory() = nullptr;
+ GetSha256Factory()->CleanupStaticState();
+ GetSha256Factory() = nullptr;
}
- if(GetSha256HMACFactory())
+ if(GetSha256HMACFactory())
{
- GetSha256HMACFactory()->CleanupStaticState();
- GetSha256HMACFactory() = nullptr;
+ GetSha256HMACFactory()->CleanupStaticState();
+ GetSha256HMACFactory() = nullptr;
}
- if(GetAES_CBCFactory())
+ if(GetAES_CBCFactory())
{
- GetAES_CBCFactory()->CleanupStaticState();
- GetAES_CBCFactory() = nullptr;
+ GetAES_CBCFactory()->CleanupStaticState();
+ GetAES_CBCFactory() = nullptr;
}
- if(GetAES_CTRFactory())
+ if(GetAES_CTRFactory())
{
- GetAES_CTRFactory()->CleanupStaticState();
- GetAES_CTRFactory() = nullptr;
+ GetAES_CTRFactory()->CleanupStaticState();
+ GetAES_CTRFactory() = nullptr;
}
- if(GetAES_GCMFactory())
+ if(GetAES_GCMFactory())
{
- GetAES_GCMFactory()->CleanupStaticState();
- GetAES_GCMFactory() = nullptr;
+ GetAES_GCMFactory()->CleanupStaticState();
+ GetAES_GCMFactory() = nullptr;
}
- if(GetAES_KeyWrapFactory())
+ if(GetAES_KeyWrapFactory())
{
- GetAES_KeyWrapFactory()->CleanupStaticState();
- GetAES_KeyWrapFactory() = nullptr;
+ GetAES_KeyWrapFactory()->CleanupStaticState();
+ GetAES_KeyWrapFactory() = nullptr;
}
- if(GetSecureRandomFactory())
+ if(GetSecureRandomFactory())
{
- GetSecureRandom() = nullptr;
- GetSecureRandomFactory()->CleanupStaticState();
- GetSecureRandomFactory() = nullptr;
- }
+ GetSecureRandom() = nullptr;
+ GetSecureRandomFactory()->CleanupStaticState();
+ GetSecureRandomFactory() = nullptr;
+ }
}
void Aws::Utils::Crypto::SetMD5Factory(const std::shared_ptr<HashFactory>& factory)
{
- GetMD5Factory() = factory;
+ GetMD5Factory() = factory;
}
void Aws::Utils::Crypto::SetSha256Factory(const std::shared_ptr<HashFactory>& factory)
{
- GetSha256Factory() = factory;
+ GetSha256Factory() = factory;
}
void Aws::Utils::Crypto::SetSha256HMACFactory(const std::shared_ptr<HMACFactory>& factory)
{
- GetSha256HMACFactory() = factory;
+ GetSha256HMACFactory() = factory;
}
void Aws::Utils::Crypto::SetAES_CBCFactory(const std::shared_ptr<SymmetricCipherFactory>& factory)
{
- GetAES_CBCFactory() = factory;
+ GetAES_CBCFactory() = factory;
}
void Aws::Utils::Crypto::SetAES_CTRFactory(const std::shared_ptr<SymmetricCipherFactory>& factory)
{
- GetAES_CTRFactory() = factory;
+ GetAES_CTRFactory() = factory;
}
void Aws::Utils::Crypto::SetAES_GCMFactory(const std::shared_ptr<SymmetricCipherFactory>& factory)
{
- GetAES_GCMFactory() = factory;
+ GetAES_GCMFactory() = factory;
}
void Aws::Utils::Crypto::SetAES_KeyWrapFactory(const std::shared_ptr<SymmetricCipherFactory>& factory)
{
- GetAES_KeyWrapFactory() = factory;
+ GetAES_KeyWrapFactory() = factory;
}
void Aws::Utils::Crypto::SetSecureRandomFactory(const std::shared_ptr<SecureRandomFactory>& factory)
{
- GetSecureRandomFactory() = factory;
+ GetSecureRandomFactory() = factory;
}
std::shared_ptr<Hash> Aws::Utils::Crypto::CreateMD5Implementation()
{
- return GetMD5Factory()->CreateImplementation();
+ return GetMD5Factory()->CreateImplementation();
}
std::shared_ptr<Hash> Aws::Utils::Crypto::CreateSha256Implementation()
{
- return GetSha256Factory()->CreateImplementation();
+ return GetSha256Factory()->CreateImplementation();
}
std::shared_ptr<Aws::Utils::Crypto::HMAC> Aws::Utils::Crypto::CreateSha256HMACImplementation()
{
- return GetSha256HMACFactory()->CreateImplementation();
+ return GetSha256HMACFactory()->CreateImplementation();
}
#ifdef _WIN32
@@ -802,7 +802,7 @@ std::shared_ptr<SymmetricCipher> Aws::Utils::Crypto::CreateAES_CBCImplementation
#ifdef NO_SYMMETRIC_ENCRYPTION
return nullptr;
#endif
- return GetAES_CBCFactory()->CreateImplementation(key);
+ return GetAES_CBCFactory()->CreateImplementation(key);
}
std::shared_ptr<SymmetricCipher> Aws::Utils::Crypto::CreateAES_CBCImplementation(const CryptoBuffer& key, const CryptoBuffer& iv)
@@ -810,7 +810,7 @@ std::shared_ptr<SymmetricCipher> Aws::Utils::Crypto::CreateAES_CBCImplementation
#ifdef NO_SYMMETRIC_ENCRYPTION
return nullptr;
#endif
- return GetAES_CBCFactory()->CreateImplementation(key, iv);
+ return GetAES_CBCFactory()->CreateImplementation(key, iv);
}
std::shared_ptr<SymmetricCipher> Aws::Utils::Crypto::CreateAES_CBCImplementation(CryptoBuffer&& key, CryptoBuffer&& iv)
@@ -818,7 +818,7 @@ std::shared_ptr<SymmetricCipher> Aws::Utils::Crypto::CreateAES_CBCImplementation
#ifdef NO_SYMMETRIC_ENCRYPTION
return nullptr;
#endif
- return GetAES_CBCFactory()->CreateImplementation(std::move(key), std::move(iv));
+ return GetAES_CBCFactory()->CreateImplementation(std::move(key), std::move(iv));
}
std::shared_ptr<SymmetricCipher> Aws::Utils::Crypto::CreateAES_CTRImplementation(const CryptoBuffer& key)
@@ -826,7 +826,7 @@ std::shared_ptr<SymmetricCipher> Aws::Utils::Crypto::CreateAES_CTRImplementation
#ifdef NO_SYMMETRIC_ENCRYPTION
return nullptr;
#endif
- return GetAES_CTRFactory()->CreateImplementation(key);
+ return GetAES_CTRFactory()->CreateImplementation(key);
}
std::shared_ptr<SymmetricCipher> Aws::Utils::Crypto::CreateAES_CTRImplementation(const CryptoBuffer& key, const CryptoBuffer& iv)
@@ -834,7 +834,7 @@ std::shared_ptr<SymmetricCipher> Aws::Utils::Crypto::CreateAES_CTRImplementation
#ifdef NO_SYMMETRIC_ENCRYPTION
return nullptr;
#endif
- return GetAES_CTRFactory()->CreateImplementation(key, iv);
+ return GetAES_CTRFactory()->CreateImplementation(key, iv);
}
std::shared_ptr<SymmetricCipher> Aws::Utils::Crypto::CreateAES_CTRImplementation(CryptoBuffer&& key, CryptoBuffer&& iv)
@@ -842,7 +842,7 @@ std::shared_ptr<SymmetricCipher> Aws::Utils::Crypto::CreateAES_CTRImplementation
#ifdef NO_SYMMETRIC_ENCRYPTION
return nullptr;
#endif
- return GetAES_CTRFactory()->CreateImplementation(std::move(key), std::move(iv));
+ return GetAES_CTRFactory()->CreateImplementation(std::move(key), std::move(iv));
}
std::shared_ptr<SymmetricCipher> Aws::Utils::Crypto::CreateAES_GCMImplementation(const CryptoBuffer& key)
@@ -850,39 +850,39 @@ std::shared_ptr<SymmetricCipher> Aws::Utils::Crypto::CreateAES_GCMImplementation
#ifdef NO_SYMMETRIC_ENCRYPTION
return nullptr;
#endif
- return GetAES_GCMFactory()->CreateImplementation(key);
+ return GetAES_GCMFactory()->CreateImplementation(key);
+}
+
+std::shared_ptr<SymmetricCipher> Aws::Utils::Crypto::CreateAES_GCMImplementation(const CryptoBuffer& key, const CryptoBuffer* aad)
+{
+#ifdef NO_SYMMETRIC_ENCRYPTION
+ return nullptr;
+#endif
+ return GetAES_GCMFactory()->CreateImplementation(key, aad);
}
-std::shared_ptr<SymmetricCipher> Aws::Utils::Crypto::CreateAES_GCMImplementation(const CryptoBuffer& key, const CryptoBuffer* aad)
+std::shared_ptr<SymmetricCipher> Aws::Utils::Crypto::CreateAES_GCMImplementation(const CryptoBuffer& key, const CryptoBuffer& iv, const CryptoBuffer& tag, const CryptoBuffer& aad)
{
#ifdef NO_SYMMETRIC_ENCRYPTION
return nullptr;
#endif
- return GetAES_GCMFactory()->CreateImplementation(key, aad);
+ return GetAES_GCMFactory()->CreateImplementation(key, iv, tag, aad);
}
-std::shared_ptr<SymmetricCipher> Aws::Utils::Crypto::CreateAES_GCMImplementation(const CryptoBuffer& key, const CryptoBuffer& iv, const CryptoBuffer& tag, const CryptoBuffer& aad)
+std::shared_ptr<SymmetricCipher> Aws::Utils::Crypto::CreateAES_GCMImplementation(CryptoBuffer&& key, CryptoBuffer&& iv, CryptoBuffer&& tag, CryptoBuffer&& aad)
{
#ifdef NO_SYMMETRIC_ENCRYPTION
return nullptr;
#endif
- return GetAES_GCMFactory()->CreateImplementation(key, iv, tag, aad);
+ return GetAES_GCMFactory()->CreateImplementation(std::move(key), std::move(iv), std::move(tag), std::move(aad));
}
-std::shared_ptr<SymmetricCipher> Aws::Utils::Crypto::CreateAES_GCMImplementation(CryptoBuffer&& key, CryptoBuffer&& iv, CryptoBuffer&& tag, CryptoBuffer&& aad)
-{
-#ifdef NO_SYMMETRIC_ENCRYPTION
- return nullptr;
-#endif
- return GetAES_GCMFactory()->CreateImplementation(std::move(key), std::move(iv), std::move(tag), std::move(aad));
-}
-
std::shared_ptr<SymmetricCipher> Aws::Utils::Crypto::CreateAES_KeyWrapImplementation(const CryptoBuffer& key)
{
#ifdef NO_SYMMETRIC_ENCRYPTION
return nullptr;
#endif
- return GetAES_KeyWrapFactory()->CreateImplementation(key);
+ return GetAES_KeyWrapFactory()->CreateImplementation(key);
}
#ifdef _WIN32
@@ -891,5 +891,5 @@ std::shared_ptr<SymmetricCipher> Aws::Utils::Crypto::CreateAES_KeyWrapImplementa
std::shared_ptr<SecureRandomBytes> Aws::Utils::Crypto::CreateSecureRandomBytesImplementation()
{
- return GetSecureRandom();
+ return GetSecureRandom();
}
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/openssl/CryptoImpl.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/openssl/CryptoImpl.cpp
index b76930d1fc..911838864b 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/openssl/CryptoImpl.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/crypto/openssl/CryptoImpl.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <cstring>
@@ -9,21 +9,21 @@
#include <aws/core/utils/crypto/openssl/CryptoImpl.h>
#include <aws/core/utils/Outcome.h>
#include <openssl/md5.h>
-
-#ifdef OPENSSL_IS_BORINGSSL
-#ifdef _MSC_VER
-AWS_SUPPRESS_WARNING_PUSH(4201)
-#else
-AWS_SUPPRESS_WARNING_PUSH("-Wpedantic")
-#endif
-#endif
-
+
+#ifdef OPENSSL_IS_BORINGSSL
+#ifdef _MSC_VER
+AWS_SUPPRESS_WARNING_PUSH(4201)
+#else
+AWS_SUPPRESS_WARNING_PUSH("-Wpedantic")
+#endif
+#endif
+
#include <openssl/sha.h>
-
-#ifdef OPENSSL_IS_BORINGSSL
-AWS_SUPPRESS_WARNING_POP
-#endif
-
+
+#ifdef OPENSSL_IS_BORINGSSL
+AWS_SUPPRESS_WARNING_POP
+#endif
+
#include <openssl/err.h>
#include <aws/core/utils/logging/LogMacros.h>
#include <thread>
@@ -41,7 +41,7 @@ namespace Aws
{
/**
* openssl with OPENSSL_VERSION_NUMBER < 0x10100003L made data type details unavailable
- * libressl use openssl with data type details available, but mandatorily set
+ * libressl use openssl with data type details available, but mandatorily set
* OPENSSL_VERSION_NUMBER = 0x20000000L, insane!
* https://github.com/aws/aws-sdk-cpp/pull/507/commits/2c99f1fe0c4b4683280caeb161538d4724d6a179
*/
@@ -60,14 +60,14 @@ namespace Aws
void init_static_state()
{
-#if OPENSSL_VERSION_LESS_1_1 || defined(OPENSSL_IS_BORINGSSL)
- ERR_load_crypto_strings();
-#else
- OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS /*options*/ ,NULL /* OpenSSL init settings*/ );
-#endif
-#if !defined(OPENSSL_IS_BORINGSSL)
+#if OPENSSL_VERSION_LESS_1_1 || defined(OPENSSL_IS_BORINGSSL)
+ ERR_load_crypto_strings();
+#else
+ OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS /*options*/ ,NULL /* OpenSSL init settings*/ );
+#endif
+#if !defined(OPENSSL_IS_BORINGSSL)
OPENSSL_add_all_algorithms_noconf();
-#endif
+#endif
#if OPENSSL_VERSION_LESS_1_1
if (!CRYPTO_get_locking_callback())
{
@@ -122,22 +122,22 @@ namespace Aws
#endif
}
- static const char* OPENSSL_LOG_TAG = "OpenSSLCipher";
-
+ static const char* OPENSSL_LOG_TAG = "OpenSSLCipher";
+
void SecureRandomBytes_OpenSSLImpl::GetBytes(unsigned char* buffer, size_t bufferSize)
{
- if (!bufferSize)
- {
- return;
- }
-
- if (!buffer)
- {
- AWS_LOGSTREAM_FATAL(OPENSSL_LOG_TAG, "Secure Random Bytes generator can't generate: " << bufferSize << " bytes with nullptr buffer.");
- assert(buffer);
- return;
- }
-
+ if (!bufferSize)
+ {
+ return;
+ }
+
+ if (!buffer)
+ {
+ AWS_LOGSTREAM_FATAL(OPENSSL_LOG_TAG, "Secure Random Bytes generator can't generate: " << bufferSize << " bytes with nullptr buffer.");
+ assert(buffer);
+ return;
+ }
+
int success = RAND_bytes(buffer, static_cast<int>(bufferSize));
if (success != 1)
{
@@ -145,22 +145,22 @@ namespace Aws
}
}
- class OpensslCtxRAIIGuard
+ class OpensslCtxRAIIGuard
{
- public:
- OpensslCtxRAIIGuard()
+ public:
+ OpensslCtxRAIIGuard()
{
m_ctx = EVP_MD_CTX_create();
assert(m_ctx != nullptr);
}
- ~OpensslCtxRAIIGuard()
+ ~OpensslCtxRAIIGuard()
{
EVP_MD_CTX_destroy(m_ctx);
m_ctx = nullptr;
}
- EVP_MD_CTX* getResource()
+ EVP_MD_CTX* getResource()
{
return m_ctx;
}
@@ -172,9 +172,9 @@ namespace Aws
{
OpensslCtxRAIIGuard guard;
auto ctx = guard.getResource();
-#if !defined(OPENSSL_IS_BORINGSSL)
+#if !defined(OPENSSL_IS_BORINGSSL)
EVP_MD_CTX_set_flags(ctx, EVP_MD_CTX_FLAG_NON_FIPS_ALLOW);
-#endif
+#endif
EVP_DigestInit_ex(ctx, EVP_md5(), nullptr);
EVP_DigestUpdate(ctx, str.c_str(), str.size());
@@ -188,9 +188,9 @@ namespace Aws
{
OpensslCtxRAIIGuard guard;
auto ctx = guard.getResource();
-#if !defined(OPENSSL_IS_BORINGSSL)
+#if !defined(OPENSSL_IS_BORINGSSL)
EVP_MD_CTX_set_flags(ctx, EVP_MD_CTX_FLAG_NON_FIPS_ALLOW);
-#endif
+#endif
EVP_DigestInit_ex(ctx, EVP_md5(), nullptr);
auto currentPos = stream.tellg();
@@ -304,7 +304,7 @@ namespace Aws
unsigned int length = SHA256_DIGEST_LENGTH;
ByteBuffer digest(length);
memset(digest.GetUnderlyingData(), 0, length);
-
+
HMACRAIIGuard guard;
HMAC_CTX* m_ctx = guard.getResource();
@@ -381,11 +381,11 @@ namespace Aws
void OpenSSLCipher::Init()
{
- if (m_failure)
- {
- return;
- }
-
+ if (m_failure)
+ {
+ return;
+ }
+
if (!m_encryptor_ctx)
{
// EVP_CIPHER_CTX_init() will be called inside EVP_CIPHER_CTX_new().
@@ -406,7 +406,7 @@ namespace Aws
{ // _init is the same as _reset after openssl 1.1
EVP_CIPHER_CTX_init(m_decryptor_ctx);
}
- m_emptyPlaintext = false;
+ m_emptyPlaintext = false;
}
CryptoBuffer OpenSSLCipher::EncryptBuffer(const CryptoBuffer& unEncryptedData)
@@ -440,7 +440,7 @@ namespace Aws
{
if (m_failure)
{
- AWS_LOGSTREAM_FATAL(OPENSSL_LOG_TAG, "Cipher not properly initialized for encryption finalization. Aborting");
+ AWS_LOGSTREAM_FATAL(OPENSSL_LOG_TAG, "Cipher not properly initialized for encryption finalization. Aborting");
return CryptoBuffer();
}
@@ -475,10 +475,10 @@ namespace Aws
return CryptoBuffer();
}
- if (lengthWritten == 0)
- {
- m_emptyPlaintext = true;
- }
+ if (lengthWritten == 0)
+ {
+ m_emptyPlaintext = true;
+ }
if (static_cast<size_t>(lengthWritten) < decryptedText.GetLength())
{
return CryptoBuffer(decryptedText.GetUnderlyingData(), static_cast<size_t>(lengthWritten));
@@ -490,18 +490,18 @@ namespace Aws
{
if (m_failure)
{
- AWS_LOGSTREAM_FATAL(OPENSSL_LOG_TAG, "Cipher not properly initialized for decryption finalization. Aborting");
+ AWS_LOGSTREAM_FATAL(OPENSSL_LOG_TAG, "Cipher not properly initialized for decryption finalization. Aborting");
return CryptoBuffer();
}
CryptoBuffer finalBlock(GetBlockSizeBytes());
int writtenSize = static_cast<int>(finalBlock.GetLength());
- int ret = EVP_DecryptFinal_ex(m_decryptor_ctx, finalBlock.GetUnderlyingData(), &writtenSize);
-#if OPENSSL_VERSION_NUMBER > 0x1010104fL //1.1.1d
- if (ret <= 0)
-#else
- if (ret <= 0 && !m_emptyPlaintext) // see details why making exception for empty string at: https://github.com/aws/aws-sdk-cpp/issues/1413
-#endif
+ int ret = EVP_DecryptFinal_ex(m_decryptor_ctx, finalBlock.GetUnderlyingData(), &writtenSize);
+#if OPENSSL_VERSION_NUMBER > 0x1010104fL //1.1.1d
+ if (ret <= 0)
+#else
+ if (ret <= 0 && !m_emptyPlaintext) // see details why making exception for empty string at: https://github.com/aws/aws-sdk-cpp/issues/1413
+#endif
{
m_failure = true;
LogErrors();
@@ -519,18 +519,18 @@ namespace Aws
void OpenSSLCipher::Cleanup()
{
m_failure = false;
- if (m_encryptor_ctx) EVP_CIPHER_CTX_cleanup(m_encryptor_ctx);
- if (m_decryptor_ctx) EVP_CIPHER_CTX_cleanup(m_decryptor_ctx);
- }
+ if (m_encryptor_ctx) EVP_CIPHER_CTX_cleanup(m_encryptor_ctx);
+ if (m_decryptor_ctx) EVP_CIPHER_CTX_cleanup(m_decryptor_ctx);
+ }
- bool OpenSSLCipher::CheckKeyAndIVLength(size_t expectedKeyLength, size_t expectedIVLength)
- {
- if (!m_failure && ((m_key.GetLength() != expectedKeyLength) || m_initializationVector.GetLength() != expectedIVLength))
- {
- AWS_LOGSTREAM_ERROR(OPENSSL_LOG_TAG, "Expected Key size is: " << expectedKeyLength << " and expected IV size is: " << expectedIVLength);
- m_failure = true;
- }
- return !m_failure;
+ bool OpenSSLCipher::CheckKeyAndIVLength(size_t expectedKeyLength, size_t expectedIVLength)
+ {
+ if (!m_failure && ((m_key.GetLength() != expectedKeyLength) || m_initializationVector.GetLength() != expectedIVLength))
+ {
+ AWS_LOGSTREAM_ERROR(OPENSSL_LOG_TAG, "Expected Key size is: " << expectedKeyLength << " and expected IV size is: " << expectedIVLength);
+ m_failure = true;
+ }
+ return !m_failure;
}
size_t AES_CBC_Cipher_OpenSSL::BlockSizeBytes = 16;
@@ -557,11 +557,11 @@ namespace Aws
void AES_CBC_Cipher_OpenSSL::InitCipher()
{
- if (m_failure || !CheckKeyAndIVLength(KeyLengthBits/8, BlockSizeBytes))
- {
- return;
- }
-
+ if (m_failure || !CheckKeyAndIVLength(KeyLengthBits/8, BlockSizeBytes))
+ {
+ return;
+ }
+
if (!EVP_EncryptInit_ex(m_encryptor_ctx, EVP_aes_256_cbc(), nullptr, m_key.GetUnderlyingData(),
m_initializationVector.GetUnderlyingData()) ||
!EVP_DecryptInit_ex(m_decryptor_ctx, EVP_aes_256_cbc(), nullptr, m_key.GetUnderlyingData(),
@@ -582,12 +582,12 @@ namespace Aws
return KeyLengthBits;
}
- void AES_CBC_Cipher_OpenSSL::Reset()
- {
- OpenSSLCipher::Reset();
- InitCipher();
- }
-
+ void AES_CBC_Cipher_OpenSSL::Reset()
+ {
+ OpenSSLCipher::Reset();
+ InitCipher();
+ }
+
size_t AES_CTR_Cipher_OpenSSL::BlockSizeBytes = 16;
size_t AES_CTR_Cipher_OpenSSL::KeyLengthBits = 256;
static const char* CTR_LOG_TAG = "AES_CTR_Cipher_OpenSSL";
@@ -613,11 +613,11 @@ namespace Aws
void AES_CTR_Cipher_OpenSSL::InitCipher()
{
- if (m_failure || !CheckKeyAndIVLength(KeyLengthBits/8, BlockSizeBytes))
- {
- return;
- }
-
+ if (m_failure || !CheckKeyAndIVLength(KeyLengthBits/8, BlockSizeBytes))
+ {
+ return;
+ }
+
if (!(EVP_EncryptInit_ex(m_encryptor_ctx, EVP_aes_256_ctr(), nullptr, m_key.GetUnderlyingData(),
m_initializationVector.GetUnderlyingData())
&& EVP_CIPHER_CTX_set_padding(m_encryptor_ctx, 0)) ||
@@ -640,12 +640,12 @@ namespace Aws
return KeyLengthBits;
}
- void AES_CTR_Cipher_OpenSSL::Reset()
- {
- OpenSSLCipher::Reset();
- InitCipher();
- }
-
+ void AES_CTR_Cipher_OpenSSL::Reset()
+ {
+ OpenSSLCipher::Reset();
+ InitCipher();
+ }
+
size_t AES_GCM_Cipher_OpenSSL::BlockSizeBytes = 16;
size_t AES_GCM_Cipher_OpenSSL::KeyLengthBits = 256;
size_t AES_GCM_Cipher_OpenSSL::IVLengthBytes = 12;
@@ -653,62 +653,62 @@ namespace Aws
static const char* GCM_LOG_TAG = "AES_GCM_Cipher_OpenSSL";
- AES_GCM_Cipher_OpenSSL::AES_GCM_Cipher_OpenSSL(const CryptoBuffer& key)
- : OpenSSLCipher(key, IVLengthBytes)
+ AES_GCM_Cipher_OpenSSL::AES_GCM_Cipher_OpenSSL(const CryptoBuffer& key)
+ : OpenSSLCipher(key, IVLengthBytes)
+ {
+ InitCipher();
+ }
+
+ AES_GCM_Cipher_OpenSSL::AES_GCM_Cipher_OpenSSL(const CryptoBuffer& key, const CryptoBuffer* aad)
+ : OpenSSLCipher(key, IVLengthBytes), m_aad(*aad)
{
InitCipher();
}
- AES_GCM_Cipher_OpenSSL::AES_GCM_Cipher_OpenSSL(const CryptoBuffer& key, const CryptoBuffer* aad)
- : OpenSSLCipher(key, IVLengthBytes), m_aad(*aad)
- {
- InitCipher();
- }
-
AES_GCM_Cipher_OpenSSL::AES_GCM_Cipher_OpenSSL(CryptoBuffer&& key, CryptoBuffer&& initializationVector,
- CryptoBuffer&& tag, CryptoBuffer&& aad) :
- OpenSSLCipher(std::move(key), std::move(initializationVector), std::move(tag)), m_aad(std::move(aad))
+ CryptoBuffer&& tag, CryptoBuffer&& aad) :
+ OpenSSLCipher(std::move(key), std::move(initializationVector), std::move(tag)), m_aad(std::move(aad))
{
InitCipher();
}
- AES_GCM_Cipher_OpenSSL::AES_GCM_Cipher_OpenSSL(const CryptoBuffer& key, const CryptoBuffer& initializationVector,
- const CryptoBuffer& tag, const CryptoBuffer& aad) :
- OpenSSLCipher(key, initializationVector, tag), m_aad(std::move(aad))
+ AES_GCM_Cipher_OpenSSL::AES_GCM_Cipher_OpenSSL(const CryptoBuffer& key, const CryptoBuffer& initializationVector,
+ const CryptoBuffer& tag, const CryptoBuffer& aad) :
+ OpenSSLCipher(key, initializationVector, tag), m_aad(std::move(aad))
{
InitCipher();
}
CryptoBuffer AES_GCM_Cipher_OpenSSL::FinalizeEncryption()
{
- if (m_failure)
- {
- AWS_LOGSTREAM_FATAL(GCM_LOG_TAG, "Cipher not properly initialized for encryption finalization. Aborting");
- return CryptoBuffer();
- }
-
- int writtenSize = 0;
- CryptoBuffer finalBlock(GetBlockSizeBytes());
- EVP_EncryptFinal_ex(m_encryptor_ctx, finalBlock.GetUnderlyingData(), &writtenSize);
-
+ if (m_failure)
+ {
+ AWS_LOGSTREAM_FATAL(GCM_LOG_TAG, "Cipher not properly initialized for encryption finalization. Aborting");
+ return CryptoBuffer();
+ }
+
+ int writtenSize = 0;
+ CryptoBuffer finalBlock(GetBlockSizeBytes());
+ EVP_EncryptFinal_ex(m_encryptor_ctx, finalBlock.GetUnderlyingData(), &writtenSize);
+
m_tag = CryptoBuffer(TagLengthBytes);
- if (!EVP_CIPHER_CTX_ctrl(m_encryptor_ctx, EVP_CTRL_GCM_GET_TAG, static_cast<int>(m_tag.GetLength()),
+ if (!EVP_CIPHER_CTX_ctrl(m_encryptor_ctx, EVP_CTRL_GCM_GET_TAG, static_cast<int>(m_tag.GetLength()),
m_tag.GetUnderlyingData()))
{
m_failure = true;
LogErrors(GCM_LOG_TAG);
}
- return CryptoBuffer();
+ return CryptoBuffer();
}
void AES_GCM_Cipher_OpenSSL::InitCipher()
{
- if (m_failure || !CheckKeyAndIVLength(KeyLengthBits/8, IVLengthBytes))
- {
- return;
- }
-
+ if (m_failure || !CheckKeyAndIVLength(KeyLengthBits/8, IVLengthBytes))
+ {
+ return;
+ }
+
if (!(EVP_EncryptInit_ex(m_encryptor_ctx, EVP_aes_256_gcm(), nullptr, nullptr, nullptr) &&
EVP_EncryptInit_ex(m_encryptor_ctx, nullptr, nullptr, m_key.GetUnderlyingData(),
m_initializationVector.GetUnderlyingData()) &&
@@ -723,29 +723,29 @@ namespace Aws
return;
}
- if (m_aad.GetLength() > 0)
- {
- int outLen = 0;
- if(!EVP_EncryptUpdate(m_encryptor_ctx, nullptr, &outLen, m_aad.GetUnderlyingData(), m_aad.GetLength())
- || !EVP_DecryptUpdate(m_decryptor_ctx, nullptr, &outLen, m_aad.GetUnderlyingData(), m_aad.GetLength()))
- {
- m_failure = true;
- LogErrors(GCM_LOG_TAG);
- return;
- }
- }
-
+ if (m_aad.GetLength() > 0)
+ {
+ int outLen = 0;
+ if(!EVP_EncryptUpdate(m_encryptor_ctx, nullptr, &outLen, m_aad.GetUnderlyingData(), m_aad.GetLength())
+ || !EVP_DecryptUpdate(m_decryptor_ctx, nullptr, &outLen, m_aad.GetUnderlyingData(), m_aad.GetLength()))
+ {
+ m_failure = true;
+ LogErrors(GCM_LOG_TAG);
+ return;
+ }
+ }
+
//tag should always be set in GCM decrypt mode
if (m_tag.GetLength() > 0)
{
if (m_tag.GetLength() < TagLengthBytes)
{
- AWS_LOGSTREAM_ERROR(GCM_LOG_TAG, "Illegal attempt to decrypt an AES GCM payload without a valid tag set: tag length=" << m_tag.GetLength());
+ AWS_LOGSTREAM_ERROR(GCM_LOG_TAG, "Illegal attempt to decrypt an AES GCM payload without a valid tag set: tag length=" << m_tag.GetLength());
m_failure = true;
return;
}
- if (!EVP_CIPHER_CTX_ctrl(m_decryptor_ctx, EVP_CTRL_GCM_SET_TAG, static_cast<int>(m_tag.GetLength()), m_tag.GetUnderlyingData()))
+ if (!EVP_CIPHER_CTX_ctrl(m_decryptor_ctx, EVP_CTRL_GCM_SET_TAG, static_cast<int>(m_tag.GetLength()), m_tag.GetUnderlyingData()))
{
m_failure = true;
LogErrors(GCM_LOG_TAG);
@@ -768,12 +768,12 @@ namespace Aws
return TagLengthBytes;
}
- void AES_GCM_Cipher_OpenSSL::Reset()
- {
- OpenSSLCipher::Reset();
- InitCipher();
- }
-
+ void AES_GCM_Cipher_OpenSSL::Reset()
+ {
+ OpenSSLCipher::Reset();
+ InitCipher();
+ }
+
size_t AES_KeyWrap_Cipher_OpenSSL::KeyLengthBits = 256;
size_t AES_KeyWrap_Cipher_OpenSSL::BlockSizeBytes = 8;
static const unsigned char INTEGRITY_VALUE = 0xA6;
@@ -788,10 +788,10 @@ namespace Aws
CryptoBuffer AES_KeyWrap_Cipher_OpenSSL::EncryptBuffer(const CryptoBuffer& plainText)
{
- if (!m_failure)
- {
- m_workingKeyBuffer = CryptoBuffer({&m_workingKeyBuffer, (CryptoBuffer*) &plainText});
- }
+ if (!m_failure)
+ {
+ m_workingKeyBuffer = CryptoBuffer({&m_workingKeyBuffer, (CryptoBuffer*) &plainText});
+ }
return CryptoBuffer();
}
@@ -811,7 +811,7 @@ namespace Aws
}
//the following is an in place implementation of
- //RFC 3394 using the alternate in-place implementation.
+ //RFC 3394 using the alternate in-place implementation.
//we use one in-place buffer instead of the copy at the end.
//the one letter variable names are meant to directly reflect the variables in the RFC
CryptoBuffer cipherText(m_workingKeyBuffer.GetLength() + BlockSizeBytes);
@@ -869,10 +869,10 @@ namespace Aws
CryptoBuffer AES_KeyWrap_Cipher_OpenSSL::DecryptBuffer(const CryptoBuffer& cipherText)
{
- if (!m_failure)
- {
- m_workingKeyBuffer = CryptoBuffer({&m_workingKeyBuffer, (CryptoBuffer*)&cipherText});
- }
+ if (!m_failure)
+ {
+ m_workingKeyBuffer = CryptoBuffer({&m_workingKeyBuffer, (CryptoBuffer*)&cipherText});
+ }
return CryptoBuffer();
}
@@ -961,11 +961,11 @@ namespace Aws
void AES_KeyWrap_Cipher_OpenSSL::InitCipher()
{
- if (m_failure || !CheckKeyAndIVLength(KeyLengthBits/8, 0))
- {
- return;
- }
-
+ if (m_failure || !CheckKeyAndIVLength(KeyLengthBits/8, 0))
+ {
+ return;
+ }
+
if (!(EVP_EncryptInit_ex(m_encryptor_ctx, EVP_aes_256_ecb(), nullptr, m_key.GetUnderlyingData(), nullptr) &&
EVP_CIPHER_CTX_set_padding(m_encryptor_ctx, 0)) ||
!(EVP_DecryptInit_ex(m_decryptor_ctx, EVP_aes_256_ecb(), nullptr, m_key.GetUnderlyingData(), nullptr) &&
@@ -975,13 +975,13 @@ namespace Aws
LogErrors(KEY_WRAP_TAG);
}
}
-
- void AES_KeyWrap_Cipher_OpenSSL::Reset()
- {
- m_workingKeyBuffer = CryptoBuffer();
- OpenSSLCipher::Reset();
- InitCipher();
- }
+
+ void AES_KeyWrap_Cipher_OpenSSL::Reset()
+ {
+ m_workingKeyBuffer = CryptoBuffer();
+ OpenSSLCipher::Reset();
+ InitCipher();
+ }
}
}
}
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventDecoderStream.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventDecoderStream.cpp
index 16fc5e69d6..5ecd2d0444 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventDecoderStream.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventDecoderStream.cpp
@@ -1,22 +1,22 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
-#include <aws/core/utils/event/EventDecoderStream.h>
-#include <iostream>
-
-namespace Aws
-{
- namespace Utils
- {
- namespace Event
- {
- EventDecoderStream::EventDecoderStream(EventStreamDecoder& decoder, size_t bufferSize) :
- Aws::IOStream(&m_eventStreamBuf),
- m_eventStreamBuf(decoder, bufferSize)
-
- {
- }
- }
- }
-}
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
+#include <aws/core/utils/event/EventDecoderStream.h>
+#include <iostream>
+
+namespace Aws
+{
+ namespace Utils
+ {
+ namespace Event
+ {
+ EventDecoderStream::EventDecoderStream(EventStreamDecoder& decoder, size_t bufferSize) :
+ Aws::IOStream(&m_eventStreamBuf),
+ m_eventStreamBuf(decoder, bufferSize)
+
+ {
+ }
+ }
+ }
+}
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventEncoderStream.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventEncoderStream.cpp
index 08b791ed56..f8640f0e8c 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventEncoderStream.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventEncoderStream.cpp
@@ -1,28 +1,28 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
-#include <aws/core/utils/event/EventEncoderStream.h>
-#include <iostream>
-
-namespace Aws
-{
- namespace Utils
- {
- namespace Event
- {
- EventEncoderStream::EventEncoderStream(size_t bufferSize) :
- Aws::IOStream(&m_streambuf),
- m_streambuf(bufferSize)
- {
- }
-
- EventEncoderStream& EventEncoderStream::WriteEvent(const Aws::Utils::Event::Message& msg)
- {
- auto bits = m_encoder.EncodeAndSign(msg);
- write(reinterpret_cast<char*>(bits.data()), bits.size());
- return *this;
- }
- }
- }
-}
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
+#include <aws/core/utils/event/EventEncoderStream.h>
+#include <iostream>
+
+namespace Aws
+{
+ namespace Utils
+ {
+ namespace Event
+ {
+ EventEncoderStream::EventEncoderStream(size_t bufferSize) :
+ Aws::IOStream(&m_streambuf),
+ m_streambuf(bufferSize)
+ {
+ }
+
+ EventEncoderStream& EventEncoderStream::WriteEvent(const Aws::Utils::Event::Message& msg)
+ {
+ auto bits = m_encoder.EncodeAndSign(msg);
+ write(reinterpret_cast<char*>(bits.data()), bits.size());
+ return *this;
+ }
+ }
+ }
+}
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventHeader.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventHeader.cpp
index b79dd2b4a5..c3c989bedb 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventHeader.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventHeader.cpp
@@ -1,6 +1,6 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/core/utils/event/EventHeader.h>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventMessage.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventMessage.cpp
index ed21d7d7d6..de8b904775 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventMessage.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventMessage.cpp
@@ -1,6 +1,6 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/core/utils/event/EventMessage.h>
@@ -19,16 +19,16 @@ namespace Aws
const char MESSAGE_TYPE_HEADER[] = ":message-type";
const char ERROR_CODE_HEADER[] = ":error-code";
const char ERROR_MESSAGE_HEADER[] = ":error-message";
- const char EXCEPTION_TYPE_HEADER[] = ":exception-type";
+ const char EXCEPTION_TYPE_HEADER[] = ":exception-type";
static const int EVENT_HASH = HashingUtils::HashString("event");
static const int ERROR_HASH = HashingUtils::HashString("error");
- static const int EXCEPTION_HASH = HashingUtils::HashString("exception");
+ static const int EXCEPTION_HASH = HashingUtils::HashString("exception");
+
+ static const int CONTENT_TYPE_APPLICATION_OCTET_STREAM_HASH = HashingUtils::HashString("application/octet-stream");
+ static const int CONTENT_TYPE_APPLICATION_JSON_HASH = HashingUtils::HashString("application/json");
+ static const int CONTENT_TYPE_TEXT_PLAIN_HASH = HashingUtils::HashString("text/plain");
- static const int CONTENT_TYPE_APPLICATION_OCTET_STREAM_HASH = HashingUtils::HashString("application/octet-stream");
- static const int CONTENT_TYPE_APPLICATION_JSON_HASH = HashingUtils::HashString("application/json");
- static const int CONTENT_TYPE_TEXT_PLAIN_HASH = HashingUtils::HashString("text/plain");
-
Message::MessageType Message::GetMessageTypeForName(const Aws::String& name)
{
int hashCode = Aws::Utils::HashingUtils::HashString(name.c_str());
@@ -40,10 +40,10 @@ namespace Aws
{
return MessageType::REQUEST_LEVEL_ERROR;
}
- else if (hashCode == EXCEPTION_HASH)
- {
- return MessageType::REQUEST_LEVEL_EXCEPTION;
- }
+ else if (hashCode == EXCEPTION_HASH)
+ {
+ return MessageType::REQUEST_LEVEL_EXCEPTION;
+ }
else
{
return MessageType::UNKNOWN;
@@ -58,49 +58,49 @@ namespace Aws
return "event";
case MessageType::REQUEST_LEVEL_ERROR:
return "error";
- case MessageType::REQUEST_LEVEL_EXCEPTION:
- return "exception";
+ case MessageType::REQUEST_LEVEL_EXCEPTION:
+ return "exception";
+ default:
+ return "unknown";
+ }
+ }
+
+ Message::ContentType Message::GetContentTypeForName(const Aws::String& name)
+ {
+ int hashCode = Aws::Utils::HashingUtils::HashString(name.c_str());
+ if (hashCode == CONTENT_TYPE_APPLICATION_OCTET_STREAM_HASH)
+ {
+ return ContentType::APPLICATION_OCTET_STREAM;
+ }
+ else if (hashCode == CONTENT_TYPE_APPLICATION_JSON_HASH)
+ {
+ return ContentType::APPLICATION_JSON;
+ }
+ else if (hashCode == CONTENT_TYPE_TEXT_PLAIN_HASH)
+ {
+ return ContentType::TEXT_PLAIN;
+ }
+ else
+ {
+ return ContentType::UNKNOWN;
+ }
+ }
+
+ Aws::String Message::GetNameForContentType(ContentType value)
+ {
+ switch (value)
+ {
+ case ContentType::APPLICATION_OCTET_STREAM:
+ return "application/octet-stream";
+ case ContentType::APPLICATION_JSON:
+ return "application/json";
+ case ContentType::TEXT_PLAIN:
+ return "text/plain";
default:
return "unknown";
}
}
- Message::ContentType Message::GetContentTypeForName(const Aws::String& name)
- {
- int hashCode = Aws::Utils::HashingUtils::HashString(name.c_str());
- if (hashCode == CONTENT_TYPE_APPLICATION_OCTET_STREAM_HASH)
- {
- return ContentType::APPLICATION_OCTET_STREAM;
- }
- else if (hashCode == CONTENT_TYPE_APPLICATION_JSON_HASH)
- {
- return ContentType::APPLICATION_JSON;
- }
- else if (hashCode == CONTENT_TYPE_TEXT_PLAIN_HASH)
- {
- return ContentType::TEXT_PLAIN;
- }
- else
- {
- return ContentType::UNKNOWN;
- }
- }
-
- Aws::String Message::GetNameForContentType(ContentType value)
- {
- switch (value)
- {
- case ContentType::APPLICATION_OCTET_STREAM:
- return "application/octet-stream";
- case ContentType::APPLICATION_JSON:
- return "application/json";
- case ContentType::TEXT_PLAIN:
- return "text/plain";
- default:
- return "unknown";
- }
- }
-
void Message::Reset()
{
m_totalLength = 0;
@@ -111,21 +111,21 @@ namespace Aws
m_eventPayload.clear();
}
- void Message::WriteEventPayload(const unsigned char* data, size_t length)
- {
- std::copy(data, data + length, std::back_inserter(m_eventPayload));
- }
-
+ void Message::WriteEventPayload(const unsigned char* data, size_t length)
+ {
+ std::copy(data, data + length, std::back_inserter(m_eventPayload));
+ }
+
void Message::WriteEventPayload(const Aws::Vector<unsigned char>& bits)
{
std::copy(bits.cbegin(), bits.cend(), std::back_inserter(m_eventPayload));
}
- void Message::WriteEventPayload(const Aws::String& bits)
- {
- std::copy(bits.cbegin(), bits.cend(), std::back_inserter(m_eventPayload));
- }
-
+ void Message::WriteEventPayload(const Aws::String& bits)
+ {
+ std::copy(bits.cbegin(), bits.cend(), std::back_inserter(m_eventPayload));
+ }
+
} // namespace Event
} // namespace Utils
} // namespace Aws
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventStreamBuf.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventStreamBuf.cpp
index 4c52368e07..6a1766bb9f 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventStreamBuf.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventStreamBuf.cpp
@@ -1,6 +1,6 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/core/utils/event/EventStreamBuf.h>
#include <cassert>
@@ -11,8 +11,8 @@ namespace Aws
{
namespace Event
{
- const size_t DEFAULT_BUF_SIZE = 1024;
-
+ const size_t DEFAULT_BUF_SIZE = 1024;
+
EventStreamBuf::EventStreamBuf(EventStreamDecoder& decoder, size_t bufferLength) :
m_byteBuffer(bufferLength),
m_bufferLength(bufferLength),
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventStreamDecoder.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventStreamDecoder.cpp
index d0474f77eb..f70a6c88f6 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventStreamDecoder.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventStreamDecoder.cpp
@@ -1,6 +1,6 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/common/common.h>
@@ -9,7 +9,7 @@
#include <aws/core/utils/event/EventStreamDecoder.h>
#include <aws/core/utils/logging/LogMacros.h>
#include <aws/core/utils/UnreferencedParam.h>
-#include <aws/core/utils/memory/AWSMemory.h>
+#include <aws/core/utils/memory/AWSMemory.h>
namespace Aws
{
@@ -21,8 +21,8 @@ namespace Aws
EventStreamDecoder::EventStreamDecoder(EventStreamHandler* handler) : m_eventStreamHandler(handler)
{
- aws_event_stream_streaming_decoder_init(&m_decoder,
- get_aws_allocator(),
+ aws_event_stream_streaming_decoder_init(&m_decoder,
+ get_aws_allocator(),
onPayloadSegment,
onPreludeReceived,
onHeaderReceived,
@@ -53,7 +53,7 @@ namespace Aws
void EventStreamDecoder::ResetEventStreamHandler(EventStreamHandler* handler)
{
- aws_event_stream_streaming_decoder_init(&m_decoder, get_aws_allocator(),
+ aws_event_stream_streaming_decoder_init(&m_decoder, get_aws_allocator(),
onPayloadSegment,
onPreludeReceived,
onHeaderReceived,
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventStreamEncoder.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventStreamEncoder.cpp
index 5380a793e1..ef7104e839 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventStreamEncoder.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventStreamEncoder.cpp
@@ -1,6 +1,6 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/core/utils/event/EventHeader.h>
@@ -9,7 +9,7 @@
#include <aws/core/utils/logging/LogMacros.h>
#include <aws/core/auth/AWSAuthSigner.h>
#include <aws/common/byte_order.h>
-#include <aws/core/utils/memory/AWSMemory.h>
+#include <aws/core/utils/memory/AWSMemory.h>
#include <cassert>
@@ -23,7 +23,7 @@ namespace Aws
static void EncodeHeaders(const Aws::Utils::Event::Message& msg, aws_array_list* headers)
{
- aws_array_list_init_dynamic(headers, get_aws_allocator(), msg.GetEventHeaders().size(), sizeof(aws_event_stream_header_value_pair));
+ aws_array_list_init_dynamic(headers, get_aws_allocator(), msg.GetEventHeaders().size(), sizeof(aws_event_stream_header_value_pair));
for (auto&& header : msg.GetEventHeaders())
{
const uint8_t headerKeyLen = static_cast<uint8_t>(header.first.length());
@@ -37,18 +37,18 @@ namespace Aws
aws_event_stream_add_bool_header(headers, header.first.c_str(), headerKeyLen, header.second.GetEventHeaderValueAsByte());
break;
case EventHeaderValue::EventHeaderType::INT16:
- aws_event_stream_add_int16_header(headers, header.first.c_str(), headerKeyLen, header.second.GetEventHeaderValueAsInt16());
+ aws_event_stream_add_int16_header(headers, header.first.c_str(), headerKeyLen, header.second.GetEventHeaderValueAsInt16());
break;
case EventHeaderValue::EventHeaderType::INT32:
- aws_event_stream_add_int32_header(headers, header.first.c_str(), headerKeyLen, header.second.GetEventHeaderValueAsInt32());
+ aws_event_stream_add_int32_header(headers, header.first.c_str(), headerKeyLen, header.second.GetEventHeaderValueAsInt32());
break;
case EventHeaderValue::EventHeaderType::INT64:
- aws_event_stream_add_int64_header(headers, header.first.c_str(), headerKeyLen, header.second.GetEventHeaderValueAsInt64());
+ aws_event_stream_add_int64_header(headers, header.first.c_str(), headerKeyLen, header.second.GetEventHeaderValueAsInt64());
break;
case EventHeaderValue::EventHeaderType::BYTE_BUF:
{
const auto& bytes = header.second.GetEventHeaderValueAsBytebuf();
- aws_event_stream_add_bytebuf_header(headers, header.first.c_str(), headerKeyLen, bytes.GetUnderlyingData(), static_cast<uint16_t>(bytes.GetLength()), 1 /*copy*/);
+ aws_event_stream_add_bytebuf_header(headers, header.first.c_str(), headerKeyLen, bytes.GetUnderlyingData(), static_cast<uint16_t>(bytes.GetLength()), 1 /*copy*/);
}
break;
case EventHeaderValue::EventHeaderType::STRING:
@@ -58,7 +58,7 @@ namespace Aws
}
break;
case EventHeaderValue::EventHeaderType::TIMESTAMP:
- aws_event_stream_add_timestamp_header(headers, header.first.c_str(), headerKeyLen, header.second.GetEventHeaderValueAsTimestamp());
+ aws_event_stream_add_timestamp_header(headers, header.first.c_str(), headerKeyLen, header.second.GetEventHeaderValueAsTimestamp());
break;
case EventHeaderValue::EventHeaderType::UUID:
{
@@ -104,16 +104,16 @@ namespace Aws
payload.allocator = nullptr;
aws_event_stream_message encoded;
- if(aws_event_stream_message_init(&encoded, get_aws_allocator(), &headers, &payload) == AWS_OP_ERR)
+ if(aws_event_stream_message_init(&encoded, get_aws_allocator(), &headers, &payload) == AWS_OP_ERR)
{
- AWS_LOGSTREAM_ERROR(TAG, "Error creating event-stream message from payload.");
- aws_event_stream_headers_list_cleanup(&headers);
+ AWS_LOGSTREAM_ERROR(TAG, "Error creating event-stream message from payload.");
+ aws_event_stream_headers_list_cleanup(&headers);
// GCC 4.9.4 issues a warning with -Wextra if we simply do
// return {};
aws_event_stream_message empty{nullptr, nullptr, 0};
return empty;
}
- aws_event_stream_headers_list_cleanup(&headers);
+ aws_event_stream_headers_list_cleanup(&headers);
return encoded;
}
@@ -143,16 +143,16 @@ namespace Aws
payload.allocator = nullptr;
aws_event_stream_message signedmsg;
- if(aws_event_stream_message_init(&signedmsg, get_aws_allocator(), &headers, &payload))
+ if(aws_event_stream_message_init(&signedmsg, get_aws_allocator(), &headers, &payload))
{
- AWS_LOGSTREAM_ERROR(TAG, "Error creating event-stream message from payload.");
- aws_event_stream_headers_list_cleanup(&headers);
+ AWS_LOGSTREAM_ERROR(TAG, "Error creating event-stream message from payload.");
+ aws_event_stream_headers_list_cleanup(&headers);
// GCC 4.9.4 issues a warning with -Wextra if we simply do
// return {};
aws_event_stream_message empty{nullptr, nullptr, 0};
return empty;
}
- aws_event_stream_headers_list_cleanup(&headers);
+ aws_event_stream_headers_list_cleanup(&headers);
return signedmsg;
}
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventStreamErrors.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventStreamErrors.cpp
index c8736b8ffa..836d0b47c5 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventStreamErrors.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/event/EventStreamErrors.cpp
@@ -1,6 +1,6 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/core/client/AWSError.h>
#include <aws/core/utils/HashingUtils.h>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/json/JsonSerializer.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/json/JsonSerializer.cpp
index 3a4b34fa38..9b785d1995 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/json/JsonSerializer.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/json/JsonSerializer.cpp
@@ -1,14 +1,14 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/json/JsonSerializer.h>
#include <iterator>
#include <algorithm>
#include <aws/core/utils/memory/stl/AWSStringStream.h>
-#include <aws/core/utils/StringUtils.h>
+#include <aws/core/utils/StringUtils.h>
using namespace Aws::Utils;
using namespace Aws::Utils::Json;
@@ -186,26 +186,26 @@ JsonValue& JsonValue::AsInteger(int value)
JsonValue& JsonValue::WithInt64(const char* key, long long value)
{
- if (!m_value)
- {
- m_value = cJSON_CreateObject();
- }
-
- const auto val = cJSON_CreateInt64(value);
- AddOrReplace(m_value, key, val);
- return *this;
+ if (!m_value)
+ {
+ m_value = cJSON_CreateObject();
+ }
+
+ const auto val = cJSON_CreateInt64(value);
+ AddOrReplace(m_value, key, val);
+ return *this;
}
JsonValue& JsonValue::WithInt64(const Aws::String& key, long long value)
{
- return WithInt64(key.c_str(), value);
+ return WithInt64(key.c_str(), value);
}
JsonValue& JsonValue::AsInt64(long long value)
{
- Destroy();
- m_value = cJSON_CreateInt64(value);
- return *this;
+ Destroy();
+ m_value = cJSON_CreateInt64(value);
+ return *this;
}
JsonValue& JsonValue::WithDouble(const char* key, double value)
@@ -449,30 +449,30 @@ int JsonView::AsInteger() const
int64_t JsonView::GetInt64(const Aws::String& key) const
{
- assert(m_value);
- auto item = cJSON_GetObjectItemCaseSensitive(m_value, key.c_str());
- assert(item);
- if (item->valuestring)
- {
- return Aws::Utils::StringUtils::ConvertToInt64(item->valuestring);
- }
- else
- {
- return static_cast<int64_t>(item->valuedouble);
- }
+ assert(m_value);
+ auto item = cJSON_GetObjectItemCaseSensitive(m_value, key.c_str());
+ assert(item);
+ if (item->valuestring)
+ {
+ return Aws::Utils::StringUtils::ConvertToInt64(item->valuestring);
+ }
+ else
+ {
+ return static_cast<int64_t>(item->valuedouble);
+ }
}
int64_t JsonView::AsInt64() const
{
assert(cJSON_IsNumber(m_value));
- if (m_value->valuestring)
- {
- return Aws::Utils::StringUtils::ConvertToInt64(m_value->valuestring);
- }
- else
- {
- return static_cast<int64_t>(m_value->valuedouble);
- }
+ if (m_value->valuestring)
+ {
+ return Aws::Utils::StringUtils::ConvertToInt64(m_value->valuestring);
+ }
+ else
+ {
+ return static_cast<int64_t>(m_value->valuedouble);
+ }
}
double JsonView::GetDouble(const Aws::String& key) const
@@ -498,7 +498,7 @@ JsonView JsonView::GetObject(const Aws::String& key) const
JsonView JsonView::AsObject() const
{
- assert(cJSON_IsObject(m_value) || cJSON_IsNull(m_value));
+ assert(cJSON_IsObject(m_value) || cJSON_IsNull(m_value));
return m_value;
}
@@ -592,11 +592,11 @@ bool JsonView::IsIntegerType() const
return false;
}
- if (m_value->valuestring)
- {
- Aws::String valueString = m_value->valuestring;
- return std::all_of(valueString.begin(), valueString.end(), [](unsigned char c){ return ::isdigit(c) || c == '+' || c == '-'; });
- }
+ if (m_value->valuestring)
+ {
+ Aws::String valueString = m_value->valuestring;
+ return std::all_of(valueString.begin(), valueString.end(), [](unsigned char c){ return ::isdigit(c) || c == '+' || c == '-'; });
+ }
return m_value->valuedouble == static_cast<long long>(m_value->valuedouble);
}
@@ -607,11 +607,11 @@ bool JsonView::IsFloatingPointType() const
return false;
}
- if (m_value->valuestring)
- {
- Aws::String valueString = m_value->valuestring;
- return std::any_of(valueString.begin(), valueString.end(), [](unsigned char c){ return !::isdigit(c) && c != '+' && c != '-'; });
- }
+ if (m_value->valuestring)
+ {
+ Aws::String valueString = m_value->valuestring;
+ return std::any_of(valueString.begin(), valueString.end(), [](unsigned char c){ return !::isdigit(c) && c != '+' && c != '-'; });
+ }
return m_value->valuedouble != static_cast<long long>(m_value->valuedouble);
}
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/logging/AWSLogging.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/logging/AWSLogging.cpp
index c872c1cf64..fc1b9fcc2e 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/logging/AWSLogging.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/logging/AWSLogging.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/logging/AWSLogging.h>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/logging/ConsoleLogSystem.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/logging/ConsoleLogSystem.cpp
index c166c6dfca..dec7cef82f 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/logging/ConsoleLogSystem.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/logging/ConsoleLogSystem.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/logging/ConsoleLogSystem.h>
@@ -15,8 +15,8 @@ void ConsoleLogSystem::ProcessFormattedStatement(Aws::String&& statement)
{
std::cout << statement;
}
-
-void ConsoleLogSystem::Flush()
-{
- std::cout.flush();
-}
+
+void ConsoleLogSystem::Flush()
+{
+ std::cout.flush();
+}
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/logging/DefaultLogSystem.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/logging/DefaultLogSystem.cpp
index 21cbf2e0dd..7286bb6378 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/logging/DefaultLogSystem.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/logging/DefaultLogSystem.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/logging/DefaultLogSystem.h>
@@ -17,7 +17,7 @@ using namespace Aws::Utils::Logging;
static const char* AllocationTag = "DefaultLogSystem";
static const int BUFFERED_MSG_COUNT = 100;
-static std::shared_ptr<Aws::OFStream> MakeDefaultLogFile(const Aws::String& filenamePrefix)
+static std::shared_ptr<Aws::OFStream> MakeDefaultLogFile(const Aws::String& filenamePrefix)
{
Aws::String newFileName = filenamePrefix + DateTime::CalculateGmtTimestampAsString("%Y-%m-%d-%H") + ".log";
return Aws::MakeShared<Aws::OFStream>(AllocationTag, newFileName.c_str(), Aws::OFStream::out | Aws::OFStream::app);
@@ -32,7 +32,7 @@ static void LogThread(DefaultLogSystem::LogSynchronizationData* syncData, const
for(;;)
{
std::unique_lock<std::mutex> locker(syncData->m_logQueueMutex);
- syncData->m_queueSignal.wait(locker, [&](){ return syncData->m_stopLogging == true || syncData->m_queuedLogMessages.size() > 0; } );
+ syncData->m_queueSignal.wait(locker, [&](){ return syncData->m_stopLogging == true || syncData->m_queuedLogMessages.size() > 0; } );
if (syncData->m_stopLogging && syncData->m_queuedLogMessages.size() == 0)
{
@@ -87,7 +87,7 @@ DefaultLogSystem::~DefaultLogSystem()
{
{
std::lock_guard<std::mutex> locker(m_syncData.m_logQueueMutex);
- m_syncData.m_stopLogging = true;
+ m_syncData.m_stopLogging = true;
}
m_syncData.m_queueSignal.notify_one();
@@ -110,8 +110,8 @@ void DefaultLogSystem::ProcessFormattedStatement(Aws::String&& statement)
}
}
-void DefaultLogSystem::Flush()
-{
- m_syncData.m_queueSignal.notify_one();
-}
-
+void DefaultLogSystem::Flush()
+{
+ m_syncData.m_queueSignal.notify_one();
+}
+
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/logging/FormattedLogSystem.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/logging/FormattedLogSystem.cpp
index ba5d759e02..41c4d7e09c 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/logging/FormattedLogSystem.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/logging/FormattedLogSystem.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/logging/FormattedLogSystem.h>
@@ -52,7 +52,7 @@ static Aws::String CreateLogPrefixLine(LogLevel logLevel, const char* tag)
break;
}
- ss << DateTime::Now().CalculateGmtTimeWithMsPrecision() << " " << tag << " [" << std::this_thread::get_id() << "] ";
+ ss << DateTime::Now().CalculateGmtTimeWithMsPrecision() << " " << tag << " [" << std::this_thread::get_id() << "] ";
return ss.str();
}
@@ -95,5 +95,5 @@ void FormattedLogSystem::Log(LogLevel logLevel, const char* tag, const char* for
void FormattedLogSystem::LogStream(LogLevel logLevel, const char* tag, const Aws::OStringStream &message_stream)
{
- ProcessFormattedStatement(CreateLogPrefixLine(logLevel, tag) + message_stream.str() + "\n");
+ ProcessFormattedStatement(CreateLogPrefixLine(logLevel, tag) + message_stream.str() + "\n");
}
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/logging/LogLevel.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/logging/LogLevel.cpp
index 1a83275cd2..9ff1bf3126 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/logging/LogLevel.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/logging/LogLevel.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/logging/LogLevel.h>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/memory/AWSMemory.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/memory/AWSMemory.cpp
index 0b6d273f21..96d339d385 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/memory/AWSMemory.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/memory/AWSMemory.cpp
@@ -1,12 +1,12 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/memory/AWSMemory.h>
#include <aws/core/utils/memory/MemorySystemInterface.h>
-#include <aws/common/common.h>
+#include <aws/common/common.h>
#include <atomic>
@@ -98,37 +98,37 @@ void Free(void* memoryPtr)
}
}
-static void* MemAcquire(aws_allocator* allocator, size_t size)
-{
- (void)allocator; // unused;
- return Aws::Malloc("MemAcquire", size);
-}
-
-static void MemRelease(aws_allocator* allocator, void* ptr)
-{
- (void)allocator; // unused;
- return Aws::Free(ptr);
-}
-
-static aws_allocator create_aws_allocator()
-{
-#if (__GNUC__ == 4) && !defined(__clang__)
- AWS_SUPPRESS_WARNING("-Wmissing-field-initializers", aws_allocator wrapper{};);
-#else
- aws_allocator wrapper{};
-#endif
- wrapper.mem_acquire = MemAcquire;
- wrapper.mem_release = MemRelease;
- wrapper.mem_realloc = nullptr;
- return wrapper;
-}
-
-aws_allocator* get_aws_allocator()
-{
- static aws_allocator wrapper = create_aws_allocator();
- return &wrapper;
-}
-
+static void* MemAcquire(aws_allocator* allocator, size_t size)
+{
+ (void)allocator; // unused;
+ return Aws::Malloc("MemAcquire", size);
+}
+
+static void MemRelease(aws_allocator* allocator, void* ptr)
+{
+ (void)allocator; // unused;
+ return Aws::Free(ptr);
+}
+
+static aws_allocator create_aws_allocator()
+{
+#if (__GNUC__ == 4) && !defined(__clang__)
+ AWS_SUPPRESS_WARNING("-Wmissing-field-initializers", aws_allocator wrapper{};);
+#else
+ aws_allocator wrapper{};
+#endif
+ wrapper.mem_acquire = MemAcquire;
+ wrapper.mem_release = MemRelease;
+ wrapper.mem_realloc = nullptr;
+ return wrapper;
+}
+
+aws_allocator* get_aws_allocator()
+{
+ static aws_allocator wrapper = create_aws_allocator();
+ return &wrapper;
+}
+
} // namespace Aws
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/memory/stl/SimpleStringStream.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/memory/stl/SimpleStringStream.cpp
index 945c345c63..4662749872 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/memory/stl/SimpleStringStream.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/memory/stl/SimpleStringStream.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/memory/stl/SimpleStringStream.h>
@@ -20,7 +20,7 @@ SimpleStringStream::SimpleStringStream(const Aws::String& value) :
{
}
-void SimpleStringStream::str(const Aws::String& value)
+void SimpleStringStream::str(const Aws::String& value)
{
m_streamBuffer.str(value);
}
@@ -39,7 +39,7 @@ SimpleIStringStream::SimpleIStringStream(const Aws::String& value) :
{
}
-void SimpleIStringStream::str(const Aws::String& value)
+void SimpleIStringStream::str(const Aws::String& value)
{
m_streamBuffer.str(value);
}
@@ -58,9 +58,9 @@ SimpleOStringStream::SimpleOStringStream(const Aws::String& value) :
{
}
-void SimpleOStringStream::str(const Aws::String& value)
+void SimpleOStringStream::str(const Aws::String& value)
{
m_streamBuffer.str(value);
}
-} // namespace Aws
+} // namespace Aws
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/stream/ConcurrentStreamBuf.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/stream/ConcurrentStreamBuf.cpp
index bbfc27da99..3f59dbe96d 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/stream/ConcurrentStreamBuf.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/stream/ConcurrentStreamBuf.cpp
@@ -1,6 +1,6 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/core/utils/stream/ConcurrentStreamBuf.h>
#include <aws/core/utils/logging/LogMacros.h>
@@ -42,11 +42,11 @@ namespace Aws
// scope the lock
{
std::unique_lock<std::mutex> lock(m_lock);
- m_signal.wait(lock, [this, bitslen]{ return m_eof || bitslen <= (m_backbuf.capacity() - m_backbuf.size()); });
- if (m_eof)
- {
- return;
- }
+ m_signal.wait(lock, [this, bitslen]{ return m_eof || bitslen <= (m_backbuf.capacity() - m_backbuf.size()); });
+ if (m_eof)
+ {
+ return;
+ }
std::copy(pbase(), pptr(), std::back_inserter(m_backbuf));
}
m_signal.notify_one();
@@ -104,16 +104,16 @@ namespace Aws
}
FlushPutArea();
- {
- std::unique_lock<std::mutex> lock(m_lock);
- if (m_eof)
- {
- return eof;
- }
- *pptr() = static_cast<char>(ch);
- pbump(1);
- return ch;
- }
+ {
+ std::unique_lock<std::mutex> lock(m_lock);
+ if (m_eof)
+ {
+ return eof;
+ }
+ *pptr() = static_cast<char>(ch);
+ pbump(1);
+ return ch;
+ }
}
int ConcurrentStreamBuf::sync()
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/stream/PreallocatedStreamBuf.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/stream/PreallocatedStreamBuf.cpp
index 94f23c3f2f..f656fc8613 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/stream/PreallocatedStreamBuf.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/stream/PreallocatedStreamBuf.cpp
@@ -1,8 +1,8 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/stream/PreallocatedStreamBuf.h>
#include <cassert>
@@ -13,7 +13,7 @@ namespace Aws
{
namespace Stream
{
- PreallocatedStreamBuf::PreallocatedStreamBuf(unsigned char* buffer, uint64_t lengthToRead) :
+ PreallocatedStreamBuf::PreallocatedStreamBuf(unsigned char* buffer, uint64_t lengthToRead) :
m_underlyingBuffer(buffer), m_lengthToRead(lengthToRead)
{
char* end = reinterpret_cast<char*>(m_underlyingBuffer + m_lengthToRead);
@@ -36,11 +36,11 @@ namespace Aws
{
if(which == std::ios_base::in)
{
- return seekpos((gptr() - reinterpret_cast<char*>(m_underlyingBuffer)) + off, which);
+ return seekpos((gptr() - reinterpret_cast<char*>(m_underlyingBuffer)) + off, which);
}
else
{
- return seekpos((pptr() - reinterpret_cast<char*>(m_underlyingBuffer)) + off, which);
+ return seekpos((pptr() - reinterpret_cast<char*>(m_underlyingBuffer)) + off, which);
}
}
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/stream/ResponseStream.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/stream/ResponseStream.cpp
index b31b20fcb2..6d1f90ed12 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/stream/ResponseStream.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/stream/ResponseStream.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/stream/ResponseStream.h>
#include <aws/core/utils/memory/stl/AWSStringStream.h>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/stream/SimpleStreamBuf.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/stream/SimpleStreamBuf.cpp
index b70968cbb4..6e42994744 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/stream/SimpleStreamBuf.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/stream/SimpleStreamBuf.cpp
@@ -1,8 +1,8 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/stream/SimpleStreamBuf.h>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/threading/Executor.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/threading/Executor.cpp
index 6b9a979a05..4a3c4209c4 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/threading/Executor.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/threading/Executor.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/threading/Executor.h>
#include <aws/core/utils/threading/ThreadTask.h>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/threading/ReaderWriterLock.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/threading/ReaderWriterLock.cpp
index a7846cddaf..ddb5860563 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/threading/ReaderWriterLock.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/threading/ReaderWriterLock.cpp
@@ -1,6 +1,6 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/core/utils/threading/ReaderWriterLock.h>
@@ -10,7 +10,7 @@
using namespace Aws::Utils::Threading;
-static const int64_t MaxReaders = (std::numeric_limits<std::int32_t>::max)();
+static const int64_t MaxReaders = (std::numeric_limits<std::int32_t>::max)();
ReaderWriterLock::ReaderWriterLock() :
m_readers(0),
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/threading/Semaphore.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/threading/Semaphore.cpp
index 74a0bc2c08..86dabc9acf 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/threading/Semaphore.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/threading/Semaphore.cpp
@@ -1,6 +1,6 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/core/utils/threading/Semaphore.h>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/threading/ThreadTask.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/threading/ThreadTask.cpp
index 7120275542..a899fe045d 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/threading/ThreadTask.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/threading/ThreadTask.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/threading/ThreadTask.h>
#include <aws/core/utils/threading/Executor.h>
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/xml/XmlSerializer.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/xml/XmlSerializer.cpp
index 9c8c54c277..c06befaf9b 100644
--- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/xml/XmlSerializer.cpp
+++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/xml/XmlSerializer.cpp
@@ -1,7 +1,7 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
#include <aws/core/utils/xml/XmlSerializer.h>
@@ -56,8 +56,8 @@ void XmlNode::SetName(const Aws::String& name)
const Aws::String XmlNode::GetAttributeValue(const Aws::String& name) const
{
- auto pointer = m_node->ToElement()->Attribute(name.c_str(), nullptr);
- return pointer ? pointer : "";
+ auto pointer = m_node->ToElement()->Attribute(name.c_str(), nullptr);
+ return pointer ? pointer : "";
}
void XmlNode::SetAttributeValue(const Aws::String& name, const Aws::String& value)
@@ -158,106 +158,106 @@ static const char* XML_SERIALIZER_ALLOCATION_TAG = "XmlDocument";
XmlDocument::XmlDocument()
{
- m_doc = nullptr;
+ m_doc = nullptr;
}
-XmlDocument::XmlDocument(const XmlDocument& doc)
-{
- if (doc.m_doc == nullptr)
- {
- m_doc = nullptr;
- }
- else
- {
- InitDoc();
- doc.m_doc->DeepCopy(m_doc);
- }
-}
-
-XmlDocument::XmlDocument(XmlDocument&& doc) : m_doc{ doc.m_doc } // take the innards
+XmlDocument::XmlDocument(const XmlDocument& doc)
+{
+ if (doc.m_doc == nullptr)
+ {
+ m_doc = nullptr;
+ }
+ else
+ {
+ InitDoc();
+ doc.m_doc->DeepCopy(m_doc);
+ }
+}
+
+XmlDocument::XmlDocument(XmlDocument&& doc) : m_doc{ doc.m_doc } // take the innards
{
doc.m_doc = nullptr; // leave nothing behind
}
-XmlDocument& XmlDocument::operator=(const XmlDocument& other)
-{
- if (this == &other)
- {
- return *this;
- }
-
- if (other.m_doc == nullptr)
- {
- if (m_doc != nullptr)
- {
- m_doc->Clear();
- m_doc = nullptr;
- }
- }
- else
- {
- if (m_doc == nullptr)
- {
- InitDoc();
- }
- else
- {
- m_doc->Clear();
- }
- other.m_doc->DeepCopy(m_doc);
- }
-
- return *this;
-}
-
-XmlDocument& XmlDocument::operator=(XmlDocument&& other)
-{
- if (this == &other)
- {
- return *this;
- }
-
- std::swap(m_doc, other.m_doc);
- return *this;
-}
-
+XmlDocument& XmlDocument::operator=(const XmlDocument& other)
+{
+ if (this == &other)
+ {
+ return *this;
+ }
+
+ if (other.m_doc == nullptr)
+ {
+ if (m_doc != nullptr)
+ {
+ m_doc->Clear();
+ m_doc = nullptr;
+ }
+ }
+ else
+ {
+ if (m_doc == nullptr)
+ {
+ InitDoc();
+ }
+ else
+ {
+ m_doc->Clear();
+ }
+ other.m_doc->DeepCopy(m_doc);
+ }
+
+ return *this;
+}
+
+XmlDocument& XmlDocument::operator=(XmlDocument&& other)
+{
+ if (this == &other)
+ {
+ return *this;
+ }
+
+ std::swap(m_doc, other.m_doc);
+ return *this;
+}
+
XmlDocument::~XmlDocument()
{
- if (m_doc)
- {
- Aws::Delete(m_doc);
- }
+ if (m_doc)
+ {
+ Aws::Delete(m_doc);
+ }
+}
+
+void XmlDocument::InitDoc()
+{
+ m_doc = Aws::New<Aws::External::tinyxml2::XMLDocument>(XML_SERIALIZER_ALLOCATION_TAG, true, Aws::External::tinyxml2::Whitespace::PRESERVE_WHITESPACE);
}
-void XmlDocument::InitDoc()
-{
- m_doc = Aws::New<Aws::External::tinyxml2::XMLDocument>(XML_SERIALIZER_ALLOCATION_TAG, true, Aws::External::tinyxml2::Whitespace::PRESERVE_WHITESPACE);
-}
-
XmlNode XmlDocument::GetRootElement() const
{
- if (m_doc)
- {
- return XmlNode(m_doc->FirstChildElement(), *this);
- }
- else
- {
- return XmlNode(nullptr, *this);
- }
-
+ if (m_doc)
+ {
+ return XmlNode(m_doc->FirstChildElement(), *this);
+ }
+ else
+ {
+ return XmlNode(nullptr, *this);
+ }
+
}
bool XmlDocument::WasParseSuccessful() const
{
- if (m_doc)
- {
- return !m_doc->Error();
- }
- else
- {
- return true;
- }
-
+ if (m_doc)
+ {
+ return !m_doc->Error();
+ }
+ else
+ {
+ return true;
+ }
+
}
Aws::String XmlDocument::GetErrorMessage() const
@@ -267,8 +267,8 @@ Aws::String XmlDocument::GetErrorMessage() const
Aws::String XmlDocument::ConvertToString() const
{
- if (!m_doc) return "";
-
+ if (!m_doc) return "";
+
Aws::External::tinyxml2::XMLPrinter printer;
printer.PushHeader(false, true);
m_doc->Accept(&printer);
@@ -285,7 +285,7 @@ XmlDocument XmlDocument::CreateFromXmlStream(Aws::IOStream& xmlStream)
XmlDocument XmlDocument::CreateFromXmlString(const Aws::String& xmlText)
{
XmlDocument xmlDocument;
- xmlDocument.InitDoc();
+ xmlDocument.InitDoc();
xmlDocument.m_doc->Parse(xmlText.c_str(), xmlText.size());
return xmlDocument;
}
@@ -293,7 +293,7 @@ XmlDocument XmlDocument::CreateFromXmlString(const Aws::String& xmlText)
XmlDocument XmlDocument::CreateWithRootNode(const Aws::String& rootNodeName)
{
XmlDocument xmlDocument;
- xmlDocument.InitDoc();
+ xmlDocument.InitDoc();
Aws::External::tinyxml2::XMLElement* rootNode = xmlDocument.m_doc->NewElement(rootNodeName.c_str());
xmlDocument.m_doc->LinkEndChild(rootNode);