diff options
author | Shreyas Kalyan <shreyas.kalyan@10gen.com> | 2019-06-20 16:20:12 -0400 |
---|---|---|
committer | Shreyas Kalyan <shreyas.kalyan@10gen.com> | 2019-07-15 13:47:52 -0400 |
commit | ac6c8db70db94645a96cfeada8859c6b7b77c6b3 (patch) | |
tree | 1ec1f21f3595b948db140e40b06b4489545b9bce /src/mongo/crypto/aead_encryption.cpp | |
parent | 70a3df4dd5d102b2370a871c9182be281100a487 (diff) | |
download | mongo-ac6c8db70db94645a96cfeada8859c6b7b77c6b3.tar.gz |
SERVER-41313 Evaluate Driver's Client Side FLE Specification Tests in Shell
Diffstat (limited to 'src/mongo/crypto/aead_encryption.cpp')
-rw-r--r-- | src/mongo/crypto/aead_encryption.cpp | 26 |
1 files changed, 3 insertions, 23 deletions
diff --git a/src/mongo/crypto/aead_encryption.cpp b/src/mongo/crypto/aead_encryption.cpp index e3dc9c8072d..3f898c48ff1 100644 --- a/src/mongo/crypto/aead_encryption.cpp +++ b/src/mongo/crypto/aead_encryption.cpp @@ -215,29 +215,8 @@ Status aeadEncrypt(const SymmetricKey& key, DataRange dataLenBitsEncoded(dataLenBitsEncodedStorage); dataLenBitsEncoded.write<BigEndian<uint64_t>>(associatedDataLen * 8); - auto keySize = key.getKeySize(); - if (keySize < kAeadAesHmacKeySize) { - return Status(ErrorCodes::BadValue, - "AEAD encryption key too short. " - "Must be either 64 or 96 bytes."); - } - ConstDataRange aeadKey(key.getKey(), kAeadAesHmacKeySize); - if (key.getKeySize() == kAeadAesHmacKeySize) { - // local key store key encryption - return aeadEncryptWithIV(aeadKey, - in, - inLen, - nullptr, - 0, - associatedData, - associatedDataLen, - dataLenBitsEncoded, - out, - outLen); - } - if (key.getKeySize() != kFieldLevelEncryptionKeySize) { return Status(ErrorCodes::BadValue, "Invalid key size."); } @@ -252,8 +231,9 @@ Status aeadEncrypt(const SymmetricKey& key, ConstDataRange hmacCDR(nullptr, 0); SHA512Block hmacOutput; - if (static_cast<int>(associatedData[0]) == - FleAlgorithmInt_serializer(FleAlgorithmInt::kDeterministic)) { + if (associatedData != nullptr && + static_cast<int>(associatedData[0]) == + FleAlgorithmInt_serializer(FleAlgorithmInt::kDeterministic)) { const uint8_t* ivKey = key.getKey() + kAeadAesHmacKeySize; hmacOutput = SHA512Block::computeHmac(ivKey, sym256KeySize, |