@@ -312,8 +312,8 @@ module AwsCryptographyDbEncryptionSdkStructuredEncryptionOperations refines Abst
312
312
function method {:tailrecursion} {:opaque} ResolveLegend (
313
313
fields : CanonAuthList ,
314
314
legend : Header .Legend,
315
- ghost origFields : CanonAuthList := fields ,
316
- acc : CanonCryptoList := []
315
+ ghost origFields : CanonAuthList ,
316
+ acc : CanonCryptoList
317
317
)
318
318
: (ret : Result< CanonCryptoList, Error> )
319
319
requires |fields| + |acc| == |origFields|
@@ -363,7 +363,11 @@ module AwsCryptographyDbEncryptionSdkStructuredEncryptionOperations refines Abst
363
363
assert forall k < - canonSorted :: Paths. ValidPath (k.origKey);
364
364
assert forall k < - canonSorted :: k. key == Paths. CanonPath (tableName, k.origKey);
365
365
366
- var canonResolved :- ResolveLegend (canonSorted, legend);
366
+ var acc : CanonCryptoList := [];
367
+ assert |canonSorted| + |acc| == |canonSorted|;
368
+ assert forall i | 0 <= i < |acc| :: Same (canonSorted[i], acc[i]);
369
+ assert forall i | |acc| <= i < |canonSorted| :: canonSorted[i] == canonSorted[i- |acc|];
370
+ var canonResolved :- ResolveLegend (canonSorted, legend, canonSorted, acc);
367
371
368
372
assert |canonResolved| == |data|;
369
373
assert forall k < - data :: (exists x :: x in canonResolved && k. key == x. origKey);
@@ -944,6 +948,13 @@ module AwsCryptographyDbEncryptionSdkStructuredEncryptionOperations refines Abst
944
948
encryptionContext := encryptionContext + newEncryptionContext;
945
949
assert cmm. Modifies !! {config. materialProviders. History};
946
950
951
+ var contextKeysX := SortedSets. ComputeSetToOrderedSequence2 (newEncryptionContext.Keys, ByteLess);
952
+ assert forall k < - contextKeysX :: ValidUTF8Seq (k) by {
953
+ assert forall k < - newEncryptionContext. Keys :: ValidUTF8Seq (k);
954
+ assert forall k < - contextKeysX :: k in newEncryptionContext. Keys;
955
+ }
956
+ var contextKeys : seq < UTF8. ValidUTF8Bytes> := contextKeysX;
957
+
947
958
// = specification/structured-encryption/decrypt-structure.md#create-new-encryption-context-and-cmm
948
959
// # Then, this operation MUST create a [Required Encryption Context CMM](https://github.com/awslabs/private-aws-encryption-sdk-specification-staging/blob/dafny-verified/framework/required-encryption-context-cmm.md)
949
960
// # with the following inputs:
@@ -953,7 +964,7 @@ module AwsCryptographyDbEncryptionSdkStructuredEncryptionOperations refines Abst
953
964
CMP.CreateRequiredEncryptionContextCMMInput(
954
965
underlyingCMM := Some(input.cmm),
955
966
keyring := None,
956
- requiredEncryptionContextKeys := SortedSets . ComputeSetToOrderedSequence2 (newEncryptionContext.Keys, ByteLess)
967
+ requiredEncryptionContextKeys := contextKeys
957
968
)
958
969
);
959
970
cmm :- cmmR. MapFailure (e => AwsCryptographyMaterialProviders(e));
@@ -1049,7 +1060,7 @@ module AwsCryptographyDbEncryptionSdkStructuredEncryptionOperations refines Abst
1049
1060
assert ! exists x :: x in smallResult && x. key == HeaderPath;
1050
1061
assert ! exists x :: x in smallResult && x. key == FooterPath;
1051
1062
assume {:axiom} forall k < - input. encryptedStructure | k. key ! in HeaderPaths ::
1052
- (exists x :: x in smallResult && x. key == k. key);
1063
+ (exists x :: x in smallResult && x. key == k. key);
1053
1064
1054
1065
// = specification/structured-encryption/decrypt-structure.md#construct-decrypted-structured-data
1055
1066
// = type=implication
0 commit comments