@@ -59,6 +59,18 @@ module {:options "/functionSyntax:4" } KMSKeystoreOperations {
59
59
case mrDiscovery (obj) => KmsArn. ValidKmsArn?(encryptionContext[Structure. KMS_FIELD])
60
60
}
61
61
62
+ // The input KeyID MUST be from Dynamodb item of keystore
63
+ predicate AttemptKmsOperationForHV2?(kmsConfiguration: Types. KMSConfiguration, keyID: string )
64
+ ensures AttemptKmsOperationForHV2?(kmsConfiguration, keyID) && HasKeyId (kmsConfiguration)
65
+ ==> Compatible?(kmsConfiguration, keyID)
66
+ {
67
+ match kmsConfiguration
68
+ case kmsKeyArn (arn) => (arn == keyID) && KmsArn. ValidKmsArn?(arn)
69
+ case kmsMRKeyArn (arn) => MrkMatch (arn, keyID) && KmsArn. ValidKmsArn?(arn)
70
+ case discovery (obj) => KmsArn. ValidKmsArn?(keyID)
71
+ case mrDiscovery (obj) => KmsArn. ValidKmsArn?(keyID)
72
+ }
73
+
62
74
predicate Compatible?(kmsConfiguration: Types. KMSConfiguration, keyId : string )
63
75
requires (HasKeyId(kmsConfiguration))
64
76
{
@@ -576,7 +588,7 @@ module {:options "/functionSyntax:4" } KMSKeystoreOperations {
576
588
ensures output. Success?
577
589
==>
578
590
&& |kmsClient. History. Decrypt| == |old (kmsClient. History. Decrypt)| + 1
579
- && AwsKmsBranchKeyDecryption ?(
591
+ && AwsKmsBranchKeyDecryptionForHV1 ?(
580
592
encryptedKey,
581
593
kmsConfiguration,
582
594
grantTokens,
@@ -643,12 +655,12 @@ module {:options "/functionSyntax:4" } KMSKeystoreOperations {
643
655
ensures kmsClient. ValidState ()
644
656
645
657
ensures ! KmsArn. ValidKmsArn?(encryptedKey. KmsArn) ==> output. Failure?
646
- ensures ! AttemptKmsOperationForHV1 ?(kmsConfiguration, encryptedKey. EncryptionContext ) ==> output. Failure?
658
+ ensures ! AttemptKmsOperationForHV2 ?(kmsConfiguration, encryptedKey. KmsArn ) ==> output. Failure?
647
659
648
660
ensures output. Success?
649
661
==>
650
662
&& |kmsClient. History. Decrypt| == |old (kmsClient. History. Decrypt)| + 1
651
- && AwsKmsBranchKeyDecryption ?(
663
+ && AwsKmsBranchKeyDecryptionForHV1 ?(
652
664
encryptedKey,
653
665
kmsConfiguration,
654
666
grantTokens,
@@ -702,7 +714,7 @@ module {:options "/functionSyntax:4" } KMSKeystoreOperations {
702
714
}
703
715
704
716
705
- ghost predicate AwsKmsBranchKeyDecryption ?(
717
+ ghost predicate AwsKmsBranchKeyDecryptionForHV1 ?(
706
718
versionItem: Types. EncryptedHierarchicalKey,
707
719
kmsConfiguration: Types. KMSConfiguration,
708
720
grantTokens: KMS. GrantTokenList,
0 commit comments