@@ -54,6 +54,7 @@ include "../../StandardLibrary/src/Index.dfy"
54
54
CreateRawRsaKeyring := [];
55
55
CreateAwsKmsRsaKeyring := [];
56
56
CreateDefaultCryptographicMaterialsManager := [];
57
+ CreateExpectedEncryptionContextCMM := [];
57
58
CreateCryptographicMaterialsCache := [];
58
59
CreateDefaultClientSupplier := [];
59
60
InitializeEncryptionMaterials := [];
@@ -81,6 +82,7 @@ include "../../StandardLibrary/src/Index.dfy"
81
82
ghost var CreateRawRsaKeyring: seq < DafnyCallEvent< CreateRawRsaKeyringInput, Result< IKeyring, Error>>>
82
83
ghost var CreateAwsKmsRsaKeyring: seq < DafnyCallEvent< CreateAwsKmsRsaKeyringInput, Result< IKeyring, Error>>>
83
84
ghost var CreateDefaultCryptographicMaterialsManager: seq < DafnyCallEvent< CreateDefaultCryptographicMaterialsManagerInput, Result< ICryptographicMaterialsManager, Error>>>
85
+ ghost var CreateExpectedEncryptionContextCMM: seq < DafnyCallEvent< CreateExpectedEncryptionContextCMMInput, Result< ICryptographicMaterialsManager, Error>>>
84
86
ghost var CreateCryptographicMaterialsCache: seq < DafnyCallEvent< CreateCryptographicMaterialsCacheInput, Result< ICryptographicMaterialsCache, Error>>>
85
87
ghost var CreateDefaultClientSupplier: seq < DafnyCallEvent< CreateDefaultClientSupplierInput, Result< IClientSupplier, Error>>>
86
88
ghost var InitializeEncryptionMaterials: seq < DafnyCallEvent< InitializeEncryptionMaterialsInput, Result< EncryptionMaterials, Error>>>
@@ -464,6 +466,36 @@ include "../../StandardLibrary/src/Index.dfy"
464
466
ensures CreateDefaultCryptographicMaterialsManagerEnsuresPublicly (input, output)
465
467
ensures History. CreateDefaultCryptographicMaterialsManager == old (History. CreateDefaultCryptographicMaterialsManager) + [DafnyCallEvent (input, output)]
466
468
469
+ predicate CreateExpectedEncryptionContextCMMEnsuresPublicly (input: CreateExpectedEncryptionContextCMMInput , output: Result <ICryptographicMaterialsManager , Error>)
470
+ // The public method to be called by library consumers
471
+ method CreateExpectedEncryptionContextCMM ( input: CreateExpectedEncryptionContextCMMInput )
472
+ returns (output: Result< ICryptographicMaterialsManager, Error> )
473
+ requires
474
+ && ValidState () && ( input. underlyingCMM. Some? ==>
475
+ && input. underlyingCMM. value. ValidState ()
476
+ && input. underlyingCMM. value. Modifies !! {History}
477
+ ) && ( input. keyring. Some? ==>
478
+ && input. keyring. value. ValidState ()
479
+ && input. keyring. value. Modifies !! {History}
480
+ )
481
+ modifies Modifies - {History} ,
482
+ (if input. underlyingCMM. Some? then input. underlyingCMM. value. Modifies else {}) ,
483
+ (if input. keyring. Some? then input. keyring. value. Modifies else {}) ,
484
+ History`CreateExpectedEncryptionContextCMM
485
+ // Dafny will skip type parameters when generating a default decreases clause.
486
+ decreases Modifies - {History} ,
487
+ (if input. underlyingCMM. Some? then input. underlyingCMM. value. Modifies else {}) ,
488
+ (if input. keyring. Some? then input. keyring. value. Modifies else {})
489
+ ensures
490
+ && ValidState ()
491
+ && ( output. Success? ==>
492
+ && output. value. ValidState ()
493
+ && output. value. Modifies !! {History}
494
+ && fresh (output. value)
495
+ && fresh ( output. value. Modifies - Modifies - {History} - (if input. underlyingCMM. Some? then input. underlyingCMM. value. Modifies else {}) - (if input. keyring. Some? then input. keyring. value. Modifies else {}) ) )
496
+ ensures CreateExpectedEncryptionContextCMMEnsuresPublicly (input, output)
497
+ ensures History. CreateExpectedEncryptionContextCMM == old (History. CreateExpectedEncryptionContextCMM) + [DafnyCallEvent (input, output)]
498
+
467
499
predicate CreateCryptographicMaterialsCacheEnsuresPublicly (input: CreateCryptographicMaterialsCacheInput , output: Result <ICryptographicMaterialsCache , Error>)
468
500
// The public method to be called by library consumers
469
501
method CreateCryptographicMaterialsCache ( input: CreateCryptographicMaterialsCacheInput )
@@ -715,6 +747,11 @@ include "../../StandardLibrary/src/Index.dfy"
715
747
datatype CreateDefaultCryptographicMaterialsManagerInput = | CreateDefaultCryptographicMaterialsManagerInput (
716
748
nameonly keyring: IKeyring
717
749
)
750
+ datatype CreateExpectedEncryptionContextCMMInput = | CreateExpectedEncryptionContextCMMInput (
751
+ nameonly underlyingCMM: Option <ICryptographicMaterialsManager > ,
752
+ nameonly keyring: Option <IKeyring > ,
753
+ nameonly requiredEncryptionContextKeys: EncryptionContextKeys
754
+ )
718
755
datatype CreateMultiKeyringInput = | CreateMultiKeyringInput (
719
756
nameonly generator: Option <IKeyring > ,
720
757
nameonly childKeyrings: KeyringList
@@ -1825,6 +1862,41 @@ include "../../StandardLibrary/src/Index.dfy"
1825
1862
History. CreateDefaultCryptographicMaterialsManager := History. CreateDefaultCryptographicMaterialsManager + [DafnyCallEvent (input, output)];
1826
1863
}
1827
1864
1865
+ predicate CreateExpectedEncryptionContextCMMEnsuresPublicly (input: CreateExpectedEncryptionContextCMMInput , output: Result <ICryptographicMaterialsManager , Error>)
1866
+ {Operations. CreateExpectedEncryptionContextCMMEnsuresPublicly (input, output)}
1867
+ // The public method to be called by library consumers
1868
+ method CreateExpectedEncryptionContextCMM ( input: CreateExpectedEncryptionContextCMMInput )
1869
+ returns (output: Result< ICryptographicMaterialsManager, Error> )
1870
+ requires
1871
+ && ValidState () && ( input. underlyingCMM. Some? ==>
1872
+ && input. underlyingCMM. value. ValidState ()
1873
+ && input. underlyingCMM. value. Modifies !! {History}
1874
+ ) && ( input. keyring. Some? ==>
1875
+ && input. keyring. value. ValidState ()
1876
+ && input. keyring. value. Modifies !! {History}
1877
+ )
1878
+ modifies Modifies - {History} ,
1879
+ (if input. underlyingCMM. Some? then input. underlyingCMM. value. Modifies else {}) ,
1880
+ (if input. keyring. Some? then input. keyring. value. Modifies else {}) ,
1881
+ History`CreateExpectedEncryptionContextCMM
1882
+ // Dafny will skip type parameters when generating a default decreases clause.
1883
+ decreases Modifies - {History} ,
1884
+ (if input. underlyingCMM. Some? then input. underlyingCMM. value. Modifies else {}) ,
1885
+ (if input. keyring. Some? then input. keyring. value. Modifies else {})
1886
+ ensures
1887
+ && ValidState ()
1888
+ && ( output. Success? ==>
1889
+ && output. value. ValidState ()
1890
+ && output. value. Modifies !! {History}
1891
+ && fresh (output. value)
1892
+ && fresh ( output. value. Modifies - Modifies - {History} - (if input. underlyingCMM. Some? then input. underlyingCMM. value. Modifies else {}) - (if input. keyring. Some? then input. keyring. value. Modifies else {}) ) )
1893
+ ensures CreateExpectedEncryptionContextCMMEnsuresPublicly (input, output)
1894
+ ensures History. CreateExpectedEncryptionContextCMM == old (History. CreateExpectedEncryptionContextCMM) + [DafnyCallEvent (input, output)]
1895
+ {
1896
+ output := Operations. CreateExpectedEncryptionContextCMM (config, input);
1897
+ History. CreateExpectedEncryptionContextCMM := History. CreateExpectedEncryptionContextCMM + [DafnyCallEvent (input, output)];
1898
+ }
1899
+
1828
1900
predicate CreateCryptographicMaterialsCacheEnsuresPublicly (input: CreateCryptographicMaterialsCacheInput , output: Result <ICryptographicMaterialsCache , Error>)
1829
1901
{Operations. CreateCryptographicMaterialsCacheEnsuresPublicly (input, output)}
1830
1902
// The public method to be called by library consumers
@@ -2304,6 +2376,34 @@ include "../../StandardLibrary/src/Index.dfy"
2304
2376
ensures CreateDefaultCryptographicMaterialsManagerEnsuresPublicly (input, output)
2305
2377
2306
2378
2379
+ predicate CreateExpectedEncryptionContextCMMEnsuresPublicly (input: CreateExpectedEncryptionContextCMMInput , output: Result <ICryptographicMaterialsManager , Error>)
2380
+ // The private method to be refined by the library developer
2381
+
2382
+
2383
+ method CreateExpectedEncryptionContextCMM ( config: InternalConfig , input: CreateExpectedEncryptionContextCMMInput )
2384
+ returns (output: Result< ICryptographicMaterialsManager, Error> )
2385
+ requires
2386
+ && ValidInternalConfig?(config) && ( input. underlyingCMM. Some? ==>
2387
+ && input. underlyingCMM. value. ValidState ()
2388
+ ) && ( input. keyring. Some? ==>
2389
+ && input. keyring. value. ValidState ()
2390
+ )
2391
+ modifies ModifiesInternalConfig (config) ,
2392
+ (if input. underlyingCMM. Some? then input. underlyingCMM. value. Modifies else {}) ,
2393
+ (if input. keyring. Some? then input. keyring. value. Modifies else {})
2394
+ // Dafny will skip type parameters when generating a default decreases clause.
2395
+ decreases ModifiesInternalConfig (config) ,
2396
+ (if input. underlyingCMM. Some? then input. underlyingCMM. value. Modifies else {}) ,
2397
+ (if input. keyring. Some? then input. keyring. value. Modifies else {})
2398
+ ensures
2399
+ && ValidInternalConfig?(config)
2400
+ && ( output. Success? ==>
2401
+ && output. value. ValidState ()
2402
+ && fresh (output. value)
2403
+ && fresh ( output. value. Modifies - ModifiesInternalConfig (config) - (if input. underlyingCMM. Some? then input. underlyingCMM. value. Modifies else {}) - (if input. keyring. Some? then input. keyring. value. Modifies else {}) ) )
2404
+ ensures CreateExpectedEncryptionContextCMMEnsuresPublicly (input, output)
2405
+
2406
+
2307
2407
predicate CreateCryptographicMaterialsCacheEnsuresPublicly (input: CreateCryptographicMaterialsCacheInput , output: Result <ICryptographicMaterialsCache , Error>)
2308
2408
// The private method to be refined by the library developer
2309
2409
0 commit comments