@@ -387,6 +387,13 @@ void toEncryptedBinData(StringData field,
387
387
builder->appendBinData (field, buf.size (), BinDataType::Encrypt, buf.data ());
388
388
}
389
389
390
+ std::pair<EncryptedBinDataType, ConstDataRange> fromEncryptedBinData (const BSONElement element) {
391
+ uassert (
392
+ 6672414 , " Expected binData with subtype Encrypt" , element.isBinData (BinDataType::Encrypt));
393
+
394
+ return fromEncryptedConstDataRange (binDataToCDR (element));
395
+ }
396
+
390
397
template <FLETokenType TokenT>
391
398
FLEToken<TokenT> FLETokenFromCDR (ConstDataRange cdr) {
392
399
auto block = PrfBlockfromCDR (cdr);
@@ -425,6 +432,14 @@ StatusWith<std::vector<uint8_t>> encryptData(ConstDataRange key, ConstDataRange
425
432
return {out};
426
433
}
427
434
435
+ StatusWith<std::vector<uint8_t >> encryptData (ConstDataRange key, uint64_t value) {
436
+
437
+ std::array<char , sizeof (uint64_t )> bufValue;
438
+ DataView (bufValue.data ()).write <LittleEndian<uint64_t >>(value);
439
+
440
+ return encryptData (key, bufValue);
441
+ }
442
+
428
443
StatusWith<std::vector<uint8_t >> decryptDataWithAssociatedData (ConstDataRange key,
429
444
ConstDataRange associatedData,
430
445
ConstDataRange cipherText,
@@ -1451,6 +1466,21 @@ void collectIndexedFields(std::vector<EDCIndexedFields>* pFields,
1451
1466
}
1452
1467
}
1453
1468
1469
+ void collectFieldValidationInfo (stdx::unordered_map<std::string, ConstDataRange>* pFields,
1470
+ ConstDataRange cdr,
1471
+ StringData fieldPath) {
1472
+ pFields->insert ({fieldPath.toString (), cdr});
1473
+ }
1474
+
1475
+ stdx::unordered_map<std::string, EncryptedField> toFieldMap (const EncryptedFieldConfig& efc) {
1476
+ stdx::unordered_map<std::string, EncryptedField> fields;
1477
+ for (const auto & field : efc.getFields ()) {
1478
+ fields.insert ({field.getPath ().toString (), field});
1479
+ }
1480
+
1481
+ return fields;
1482
+ }
1483
+
1454
1484
uint64_t generateRandomContention (uint64_t cm) {
1455
1485
// For non-contentious fields, we select the partition number, u, to be equal to 0.
1456
1486
//
@@ -4171,7 +4201,6 @@ std::size_t Edges::size() const {
4171
4201
return (_trimFactor == 0 ? 1 : 0 ) + edges;
4172
4202
}
4173
4203
4174
- namespace {
4175
4204
template <typename T>
4176
4205
std::unique_ptr<Edges> getEdgesT (
4177
4206
T value, T min, T max, int sparsity, const boost::optional<int >& trimFactor) {
@@ -4187,7 +4216,6 @@ std::unique_ptr<Edges> getEdgesT(
4187
4216
std::string valueBinTrimmed = valueBin.substr (bits - maxlen, maxlen);
4188
4217
return std::make_unique<Edges>(valueBinTrimmed, sparsity, trimFactor);
4189
4218
}
4190
- } // namespace
4191
4219
4192
4220
std::unique_ptr<Edges> getEdgesInt32 (int32_t value,
4193
4221
boost::optional<int32_t > min,
@@ -4274,7 +4302,6 @@ std::uint64_t getEdgesLength(BSONType fieldType, StringData fieldPath, QueryType
4274
4302
MONGO_UNREACHABLE;
4275
4303
}
4276
4304
4277
- namespace {
4278
4305
template <typename T>
4279
4306
class MinCoverGenerator {
4280
4307
public:
@@ -4407,7 +4434,6 @@ void adjustBounds(T& lowerBound, bool includeLowerBound, T& upperBound, bool inc
4407
4434
upperBound.value -= 1 ;
4408
4435
}
4409
4436
}
4410
- } // namespace
4411
4437
4412
4438
std::vector<std::string> minCoverInt32 (int32_t lowerBound,
4413
4439
bool includeLowerBound,
0 commit comments