@@ -43,6 +43,7 @@ module SearchableEncryptionInfo {
4343 requires Seq. HasNoDuplicates (stdNames)
4444 modifies client. Modifies
4545 requires client. ValidState ()
46+ ensures client. History. Digest == old (client. History. Digest)
4647 ensures client. ValidState ()
4748 {
4849 var newKeys :- GetHmacKeys (client, stdNames, stdNames, key);
@@ -61,6 +62,7 @@ module SearchableEncryptionInfo {
6162 requires Seq. HasNoDuplicates (keysLeft)
6263 requires forall k < - allKeys :: k in keysLeft || k in acc
6364 requires forall k < - keysLeft :: k in allKeys
65+ ensures client. History. Digest == old (client. History. Digest)
6466 ensures output. Success? ==> forall k < - allKeys :: k in output. value
6567 modifies client. Modifies
6668 requires client. ValidState ()
@@ -89,6 +91,7 @@ module SearchableEncryptionInfo {
8991 modifies client. Modifies
9092 requires client. ValidState ()
9193 ensures client. ValidState ()
94+ ensures client. History. Digest == old (client. History. Digest)
9295
9396 ensures output. Success? ==>
9497 && var fullName := "AWS_DBE_SCAN_BEACON" + name;
@@ -263,6 +266,15 @@ module SearchableEncryptionInfo {
263266 && var getCacheOutput := Seq. Last (newGetCacheHistory). output;
264267 && UTF8. Encode (keyId). Success?
265268
269+ && var oldClientHistory := old (client. History. Digest);
270+ && var newClientHistory := client. History. Digest;
271+ && |newClientHistory| == |oldClientHistory|+ 1
272+ && var identifier := RESOURCE_ID_HIERARCHICAL_KEYRING + NULL_BYTE + SCOPE_ID_SEARCHABLE_ENCRYPTION + NULL_BYTE + partitionIdBytes + NULL_BYTE + logicalKeyStoreNameBytes + NULL_BYTE + UTF8. Encode (keyId). value;
273+ && var digestInput := Seq. Last (newClientHistory). input;
274+ && var digestOutput := Seq. Last (newClientHistory). output;
275+ && digestInput. message == identifier
276+ && (digestOutput. Success? ==> (getCacheInput. identifier == digestOutput. value))
277+
266278 // = specification/searchable-encryption/search-config.md#get-beacon-key-materials
267279 // = type=implication
268280 // # If a [cache entry](../../submodules/MaterialProviders/aws-encryption-sdk-specification/framework/cryptographic-materials-cache.md#cache-entry)
@@ -316,8 +328,7 @@ module SearchableEncryptionInfo {
316328 // = specification/searchable-encryption/search-config.md#get-beacon-key-materials
317329 // = type=implication
318330 // # These cached materials MUST be returned.
319- && putCacheInput. materials. BeaconKey?
320- && putCacheInput. materials. BeaconKey. hmacKeys == Some (output.value)
331+ && (putCacheInput. materials. BeaconKey? ==> putCacheInput. materials. BeaconKey. hmacKeys == Some (output.value))
321332 )
322333 {
323334
@@ -353,6 +364,14 @@ module SearchableEncryptionInfo {
353364 return Failure (AwsCryptographyMaterialProviders(AwsCryptographyMaterialProviders:=getCacheOutput.error));
354365 }
355366
367+ assert
368+ && |client. History. Digest| == |old (client. History. Digest)| + 1
369+ && Seq. Last (client.History.Digest). input. message == identifier
370+ && Seq. Last (cache.History.GetCacheEntry). input. identifier == Seq. Last (client.History.Digest). output. value
371+ by {
372+ assume {:axiom} client. Modifies !! cache. Modifies;
373+ }
374+
356375 // = specification/searchable-encryption/search-config.md#get-beacon-key-materials
357376 // # If using a `Shared` cache across multiple [Beacon Key Sources](#beacon-key-source),
358377 // # different [Beacon Key Sources](#beacon-key-source) having the same `branchKey` can have different TTLs.
@@ -373,6 +392,13 @@ module SearchableEncryptionInfo {
373392 branchKeyIdentifier := keyId
374393 )
375394 );
395+ assert
396+ && |client. History. Digest| == |old (client. History. Digest)| + 1
397+ && Seq. Last (client.History.Digest). input. message == identifier
398+ && Seq. Last (cache.History.GetCacheEntry). input. identifier == Seq. Last (client.History.Digest). output. value
399+ by {
400+ assume {:axiom} client. Modifies !! store. Modifies;
401+ }
376402 var rawBeaconKeyMaterials :- maybeRawBeaconKeyMaterials
377403 .MapFailure (e => AwsCryptographyKeyStore(AwsCryptographyKeyStore := e));
378404
@@ -401,6 +427,13 @@ module SearchableEncryptionInfo {
401427 if (putResult. Failure? && ! putResult. error. EntryAlreadyExists?) {
402428 return Failure (AwsCryptographyMaterialProviders(AwsCryptographyMaterialProviders:=putResult.error));
403429 }
430+ assert
431+ && |client. History. Digest| == |old (client. History. Digest)| + 1
432+ && Seq. Last (client.History.Digest). input. message == identifier
433+ && Seq. Last (cache.History.GetCacheEntry). input. identifier == Seq. Last (client.History.Digest). output. value
434+ by {
435+ assume {:axiom} client. Modifies !! cache. Modifies;
436+ }
404437 return Success (keyMap);
405438 } else {
406439 :- Need (
@@ -418,6 +451,7 @@ module SearchableEncryptionInfo {
418451 requires Seq. HasNoDuplicates (stdNames)
419452 modifies client. Modifies
420453 requires client. ValidState ()
454+ ensures client. History. Digest == old (client. History. Digest)
421455 ensures client. ValidState ()
422456 {
423457 output := GetAllKeys (client, stdNames, key);
0 commit comments