summaryrefslogtreecommitdiff
path: root/src/mongo/crypto/aead_encryption.cpp
diff options
context:
space:
mode:
authorclang-format-7.0.1 <adam.martin@10gen.com>2019-07-26 18:20:35 -0400
committerADAM David Alan Martin <adam.martin@10gen.com>2019-07-27 11:02:23 -0400
commit134a4083953270e8a11430395357fb70a29047ad (patch)
treedd428e1230e31d92b20b393dfdc17ffe7fa79cb6 /src/mongo/crypto/aead_encryption.cpp
parent1e46b5049003f427047e723ea5fab15b5a9253ca (diff)
downloadmongo-134a4083953270e8a11430395357fb70a29047ad.tar.gz
SERVER-41772 Apply clang-format 7.0.1 to the codebase
Diffstat (limited to 'src/mongo/crypto/aead_encryption.cpp')
-rw-r--r--src/mongo/crypto/aead_encryption.cpp27
1 files changed, 8 insertions, 19 deletions
diff --git a/src/mongo/crypto/aead_encryption.cpp b/src/mongo/crypto/aead_encryption.cpp
index 030758850c1..b5e0ae4ce1c 100644
--- a/src/mongo/crypto/aead_encryption.cpp
+++ b/src/mongo/crypto/aead_encryption.cpp
@@ -101,9 +101,7 @@ Status _aesEncrypt(const SymmetricKey& key,
if (len != aesCBCCipherOutputLength(inLen)) {
return {ErrorCodes::BadValue,
str::stream() << "Encrypt error, expected cipher text of length "
- << aesCBCCipherOutputLength(inLen)
- << " but found "
- << len};
+ << aesCBCCipherOutputLength(inLen) << " but found " << len};
}
return Status::OK();
@@ -117,12 +115,11 @@ Status _aesDecrypt(const SymmetricKey& key,
std::size_t outLen,
std::size_t* resultLen) try {
// Check the plaintext buffer can fit the product of decryption
- auto[lowerBound, upperBound] = aesCBCExpectedPlaintextLen(in.length());
+ auto [lowerBound, upperBound] = aesCBCExpectedPlaintextLen(in.length());
if (upperBound > outLen) {
return {ErrorCodes::BadValue,
str::stream() << "Cleartext buffer of size " << outLen
- << " too small for output which can be as large as "
- << upperBound
+ << " too small for output which can be as large as " << upperBound
<< "]"};
}
@@ -145,13 +142,8 @@ Status _aesDecrypt(const SymmetricKey& key,
if (*resultLen < lowerBound || *resultLen > upperBound) {
return {ErrorCodes::BadValue,
str::stream() << "Decrypt error, expected clear text length in interval"
- << "["
- << lowerBound
- << ","
- << upperBound
- << "]"
- << "but found "
- << *resultLen};
+ << "[" << lowerBound << "," << upperBound << "]"
+ << "but found " << *resultLen};
}
/* Check that padding was removed.
@@ -211,8 +203,7 @@ Status aeadEncrypt(const SymmetricKey& key,
return Status(ErrorCodes::BadValue,
str::stream()
<< "AssociatedData for encryption is too large. Cannot be larger than "
- << kMaxAssociatedDataLength
- << " bytes.");
+ << kMaxAssociatedDataLength << " bytes.");
}
// According to the rfc on AES encryption, the associatedDataLength is defined as the
@@ -292,8 +283,7 @@ Status aeadEncryptWithIV(ConstDataRange key,
return Status(ErrorCodes::BadValue,
str::stream()
<< "AssociatedData for encryption is too large. Cannot be larger than "
- << kMaxAssociatedDataLength
- << " bytes.");
+ << kMaxAssociatedDataLength << " bytes.");
}
const uint8_t* macKey = reinterpret_cast<const uint8_t*>(key.data());
@@ -357,8 +347,7 @@ Status aeadDecrypt(const SymmetricKey& key,
return Status(ErrorCodes::BadValue,
str::stream()
<< "AssociatedData for encryption is too large. Cannot be larger than "
- << kMaxAssociatedDataLength
- << " bytes.");
+ << kMaxAssociatedDataLength << " bytes.");
}
const uint8_t* macKey = key.getKey();