@@ -450,17 +450,18 @@ class ESCCollectionCommon {
450450 /* *
451451 * Generate the _id value for an anchor record
452452 */
453- static PrfBlock generateAnchorId (const TagToken& tagToken, uint64_t apos);
453+ static PrfBlock generateAnchorId (HmacContext* context, const TagToken& tagToken, uint64_t apos);
454454
455455 /* *
456456 * Generate the _id value for a null anchor record
457457 */
458- static PrfBlock generateNullAnchorId (const TagToken& tagToken);
458+ static PrfBlock generateNullAnchorId (HmacContext* context, const TagToken& tagToken);
459459
460460 /* *
461461 * Calculate AnchorBinaryHops as described in OST.
462462 */
463- static boost::optional<uint64_t > anchorBinaryHops (const FLEStateCollectionReader& reader,
463+ static boost::optional<uint64_t > anchorBinaryHops (HmacContext* context,
464+ const FLEStateCollectionReader& reader,
464465 const TagToken& tagToken,
465466 const ValueToken& valueToken,
466467 FLEStatusSection::EmuBinaryTracker& tracker);
@@ -489,6 +490,7 @@ class ESCCollectionCommon {
489490 * padding cleanup.
490491 */
491492 static FLEEdgeCountInfo getEdgeCountInfoForPaddingCleanupCommon (
493+ HmacContext* hmacCtx,
492494 const FLEStateCollectionReader& reader,
493495 const TagToken& tagToken,
494496 const ValueToken& valueToken,
@@ -505,21 +507,24 @@ class ESCCollection
505507 /* *
506508 * Generate the _id value
507509 */
508- static PrfBlock generateId (const ESCTwiceDerivedTagToken& tagToken,
510+ static PrfBlock generateId (HmacContext* context,
511+ const ESCTwiceDerivedTagToken& tagToken,
509512 boost::optional<uint64_t > index);
510513
511514 /* *
512515 * Generate a null document which will be the "first" document for a given field.
513516 */
514- static BSONObj generateNullDocument (const ESCTwiceDerivedTagToken& tagToken,
517+ static BSONObj generateNullDocument (HmacContext* context,
518+ const ESCTwiceDerivedTagToken& tagToken,
515519 const ESCTwiceDerivedValueToken& valueToken,
516520 uint64_t pos,
517521 uint64_t count);
518522
519523 /* *
520524 * Generate a insert ESC document.
521525 */
522- static BSONObj generateInsertDocument (const ESCTwiceDerivedTagToken& tagToken,
526+ static BSONObj generateInsertDocument (HmacContext* context,
527+ const ESCTwiceDerivedTagToken& tagToken,
523528 const ESCTwiceDerivedValueToken& valueToken,
524529 uint64_t index,
525530 uint64_t count);
@@ -528,6 +533,7 @@ class ESCCollection
528533 * Generate a compaction placeholder ESC document.
529534 */
530535 static BSONObj generateCompactionPlaceholderDocument (
536+ HmacContext* context,
531537 const ESCTwiceDerivedTagToken& tagToken,
532538 const ESCTwiceDerivedValueToken& valueToken,
533539 uint64_t index,
@@ -556,26 +562,31 @@ class ESCCollection
556562 /* *
557563 * Generate the _id value for a non-anchor record
558564 */
559- static PrfBlock generateNonAnchorId (const ESCTwiceDerivedTagToken& tagToken, uint64_t cpos);
565+ static PrfBlock generateNonAnchorId (HmacContext* context,
566+ const ESCTwiceDerivedTagToken& tagToken,
567+ uint64_t cpos);
560568
561569 /* *
562570 * Generate a non-anchor ESC document for inserts.
563571 */
564- static BSONObj generateNonAnchorDocument (const ESCTwiceDerivedTagToken& tagToken,
572+ static BSONObj generateNonAnchorDocument (HmacContext* context,
573+ const ESCTwiceDerivedTagToken& tagToken,
565574 uint64_t cpos);
566575
567576 /* *
568577 * Generate an anchor ESC document for compacts.
569578 */
570- static BSONObj generateAnchorDocument (const ESCTwiceDerivedTagToken& tagToken,
579+ static BSONObj generateAnchorDocument (HmacContext* context,
580+ const ESCTwiceDerivedTagToken& tagToken,
571581 const ESCTwiceDerivedValueToken& valueToken,
572582 uint64_t apos,
573583 uint64_t cpos);
574584
575585 /* *
576586 * Generate a null anchor ESC document for cleanups.
577587 */
578- static BSONObj generateNullAnchorDocument (const ESCTwiceDerivedTagToken& tagToken,
588+ static BSONObj generateNullAnchorDocument (HmacContext* context,
589+ const ESCTwiceDerivedTagToken& tagToken,
579590 const ESCTwiceDerivedValueToken& valueToken,
580591 uint64_t apos,
581592 uint64_t cpos);
@@ -596,10 +607,12 @@ class ESCCollection
596607 * (x > 0) means non-null anchors exist without a null anchor OR new non-null anchors
597608 * have been added since the last-recorded apos in the null anchor.
598609 */
599- static EmuBinaryResult emuBinaryV2 (const FLEStateCollectionReader& reader,
610+ static EmuBinaryResult emuBinaryV2 (HmacContext* context,
611+ const FLEStateCollectionReader& reader,
600612 const ESCTwiceDerivedTagToken& tagToken,
601613 const ESCTwiceDerivedValueToken& valueToken);
602- static boost::optional<uint64_t > binaryHops (const FLEStateCollectionReader& reader,
614+ static boost::optional<uint64_t > binaryHops (HmacContext* context,
615+ const FLEStateCollectionReader& reader,
603616 const ESCTwiceDerivedTagToken& tagToken,
604617 const ESCTwiceDerivedValueToken& valueToken,
605618 boost::optional<uint64_t > x,
@@ -624,15 +637,20 @@ class ESCCollection
624637class ESCCollectionAnchorPadding
625638 : public ESCCollectionCommon<AnchorPaddingKeyToken, AnchorPaddingValueToken> {
626639public:
627- static PrfBlock generateNullAnchorId (const AnchorPaddingKeyToken& tagToken);
628- static PrfBlock generateAnchorId (const AnchorPaddingKeyToken& tagToken, uint64_t apos);
629-
630- static BSONObj generateNullAnchorDocument (const AnchorPaddingKeyToken& keyToken,
640+ static PrfBlock generateNullAnchorId (HmacContext* context,
641+ const AnchorPaddingKeyToken& tagToken);
642+ static PrfBlock generateAnchorId (HmacContext* context,
643+ const AnchorPaddingKeyToken& tagToken,
644+ uint64_t apos);
645+
646+ static BSONObj generateNullAnchorDocument (HmacContext* context,
647+ const AnchorPaddingKeyToken& keyToken,
631648 const AnchorPaddingValueToken& valueToken,
632649 uint64_t apos,
633650 uint64_t /* cpos ignored */ );
634651
635- static BSONObj generatePaddingDocument (const AnchorPaddingKeyToken& keyToken,
652+ static BSONObj generatePaddingDocument (HmacContext* context,
653+ const AnchorPaddingKeyToken& keyToken,
636654 const AnchorPaddingValueToken& valueToken,
637655 uint64_t apos);
638656};
@@ -745,12 +763,15 @@ class ECCCollection {
745763 /* *
746764 * Generate the _id value
747765 */
748- static PrfBlock generateId (ECCTwiceDerivedTagToken tagToken, boost::optional<uint64_t > index);
766+ static PrfBlock generateId (HmacContext* context,
767+ ECCTwiceDerivedTagToken tagToken,
768+ boost::optional<uint64_t > index);
749769
750770 /* *
751771 * Generate a null document which will be the "first" document for a given field.
752772 */
753- static BSONObj generateNullDocument (ECCTwiceDerivedTagToken tagToken,
773+ static BSONObj generateNullDocument (HmacContext* context,
774+ ECCTwiceDerivedTagToken tagToken,
754775 ECCTwiceDerivedValueToken valueToken,
755776 uint64_t count);
756777
@@ -759,15 +780,17 @@ class ECCCollection {
759780 *
760781 * Note: it is stored as (count, count)
761782 */
762- static BSONObj generateDocument (ECCTwiceDerivedTagToken tagToken,
783+ static BSONObj generateDocument (HmacContext* context,
784+ ECCTwiceDerivedTagToken tagToken,
763785 ECCTwiceDerivedValueToken valueToken,
764786 uint64_t index,
765787 uint64_t count);
766788
767789 /* *
768790 * Generate a regular ECC document for (start, end)
769791 */
770- static BSONObj generateDocument (ECCTwiceDerivedTagToken tagToken,
792+ static BSONObj generateDocument (HmacContext* context,
793+ ECCTwiceDerivedTagToken tagToken,
771794 ECCTwiceDerivedValueToken valueToken,
772795 uint64_t index,
773796 uint64_t start,
@@ -776,7 +799,8 @@ class ECCCollection {
776799 /* *
777800 * Generate a compaction ECC document.
778801 */
779- static BSONObj generateCompactionDocument (ECCTwiceDerivedTagToken tagToken,
802+ static BSONObj generateCompactionDocument (HmacContext* context,
803+ ECCTwiceDerivedTagToken tagToken,
780804 ECCTwiceDerivedValueToken valueToken,
781805 uint64_t index);
782806
@@ -1604,6 +1628,8 @@ class FLEUtil {
16041628 /* *
16051629 * Compute HMAC-SHA-256
16061630 */
1631+ static PrfBlock prf (HmacContext* hmacCtx, ConstDataRange key, uint64_t value, int64_t value2);
1632+
16071633 static PrfBlock prf (HmacContext* hmacCtx, ConstDataRange key, ConstDataRange cdr);
16081634
16091635 static PrfBlock prf (HmacContext* hmacCtx, ConstDataRange key, uint64_t value);
0 commit comments