@@ -43,6 +43,7 @@ module SearchableEncryptionInfo {
43
43
requires Seq. HasNoDuplicates (stdNames)
44
44
modifies client. Modifies
45
45
requires client. ValidState ()
46
+ ensures client. History. Digest == old (client. History. Digest)
46
47
ensures client. ValidState ()
47
48
{
48
49
var newKeys :- GetHmacKeys (client, stdNames, stdNames, key);
@@ -61,6 +62,7 @@ module SearchableEncryptionInfo {
61
62
requires Seq. HasNoDuplicates (keysLeft)
62
63
requires forall k < - allKeys :: k in keysLeft || k in acc
63
64
requires forall k < - keysLeft :: k in allKeys
65
+ ensures client. History. Digest == old (client. History. Digest)
64
66
ensures output. Success? ==> forall k < - allKeys :: k in output. value
65
67
modifies client. Modifies
66
68
requires client. ValidState ()
@@ -89,6 +91,7 @@ module SearchableEncryptionInfo {
89
91
modifies client. Modifies
90
92
requires client. ValidState ()
91
93
ensures client. ValidState ()
94
+ ensures client. History. Digest == old (client. History. Digest)
92
95
93
96
ensures output. Success? ==>
94
97
&& var fullName := "AWS_DBE_SCAN_BEACON" + name;
@@ -263,6 +266,15 @@ module SearchableEncryptionInfo {
263
266
&& var getCacheOutput := Seq. Last (newGetCacheHistory). output;
264
267
&& UTF8. Encode (keyId). Success?
265
268
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
+
266
278
// = specification/searchable-encryption/search-config.md#get-beacon-key-materials
267
279
// = type=implication
268
280
// # If a [cache entry](../../submodules/MaterialProviders/aws-encryption-sdk-specification/framework/cryptographic-materials-cache.md#cache-entry)
@@ -316,8 +328,7 @@ module SearchableEncryptionInfo {
316
328
// = specification/searchable-encryption/search-config.md#get-beacon-key-materials
317
329
// = type=implication
318
330
// # 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))
321
332
)
322
333
{
323
334
@@ -353,6 +364,14 @@ module SearchableEncryptionInfo {
353
364
return Failure (AwsCryptographyMaterialProviders(AwsCryptographyMaterialProviders:=getCacheOutput.error));
354
365
}
355
366
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
+
356
375
// = specification/searchable-encryption/search-config.md#get-beacon-key-materials
357
376
// # If using a `Shared` cache across multiple [Beacon Key Sources](#beacon-key-source),
358
377
// # different [Beacon Key Sources](#beacon-key-source) having the same `branchKey` can have different TTLs.
@@ -373,6 +392,13 @@ module SearchableEncryptionInfo {
373
392
branchKeyIdentifier := keyId
374
393
)
375
394
);
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
+ }
376
402
var rawBeaconKeyMaterials :- maybeRawBeaconKeyMaterials
377
403
.MapFailure (e => AwsCryptographyKeyStore(AwsCryptographyKeyStore := e));
378
404
@@ -401,6 +427,13 @@ module SearchableEncryptionInfo {
401
427
if (putResult. Failure? && ! putResult. error. EntryAlreadyExists?) {
402
428
return Failure (AwsCryptographyMaterialProviders(AwsCryptographyMaterialProviders:=putResult.error));
403
429
}
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
+ }
404
437
return Success (keyMap);
405
438
} else {
406
439
:- Need (
@@ -418,6 +451,7 @@ module SearchableEncryptionInfo {
418
451
requires Seq. HasNoDuplicates (stdNames)
419
452
modifies client. Modifies
420
453
requires client. ValidState ()
454
+ ensures client. History. Digest == old (client. History. Digest)
421
455
ensures client. ValidState ()
422
456
{
423
457
output := GetAllKeys (client, stdNames, key);
0 commit comments