Skip to content

Commit 96091d8

Browse files
authored
Merge branch 'main' into ajewell/rust
2 parents fc423f4 + 28d06fe commit 96091d8

File tree

26 files changed

+143
-37
lines changed

26 files changed

+143
-37
lines changed

.github/workflows/check-files.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
env:
1515
# unfortunately we can't check if the approver is part of the CODEOWNERS. This is a subset of aws/aws-crypto-tools-team
1616
# to add more allowlisted approvers just modify this env variable
17-
maintainers: seebees, texastony, ShubhamChaturvedi7, lucasmcdonald3, josecorella, imabhichow, rishav-karanjit, antonf-amzn, justplaz, ajewellamz
17+
maintainers: seebees, texastony, ShubhamChaturvedi7, lucasmcdonald3, josecorella, imabhichow, rishav-karanjit, antonf-amzn, kessplas, ajewellamz, RitvikKapila
1818
steps:
1919
- uses: actions/checkout@v3
2020
with:

.github/workflows/ci_examples_java.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
max-parallel: 1
3030
matrix:
3131
java-version: [8, 11, 16, 17]
32-
os: [macos-12]
32+
os: [macos-13]
3333
runs-on: ${{ matrix.os }}
3434
permissions:
3535
id-token: write

.github/workflows/ci_examples_net.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
matrix:
2828
library: [DynamoDbEncryption]
2929
dotnet-version: ["6.0.x"]
30-
os: [macos-12]
30+
os: [macos-13]
3131
runs-on: ${{ matrix.os }}
3232
permissions:
3333
id-token: write

.github/workflows/ci_test_java.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
matrix:
3030
library: [DynamoDbEncryption]
3131
java-version: [8, 11, 16, 17]
32-
os: [macos-12]
32+
os: [macos-13]
3333
runs-on: ${{ matrix.os }}
3434
permissions:
3535
id-token: write

.github/workflows/ci_test_net.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
matrix:
2626
library: [DynamoDbEncryption]
2727
dotnet-version: ["6.0.x"]
28-
os: [macos-12, ubuntu-latest, windows-latest]
28+
os: [macos-13, ubuntu-latest, windows-latest]
2929
runs-on: ${{ matrix.os }}
3030
permissions:
3131
id-token: write

.github/workflows/ci_todos.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99

1010
jobs:
1111
findTodos:
12-
runs-on: macos-12
12+
runs-on: macos-13
1313
steps:
1414
- uses: actions/checkout@v3
1515

.github/workflows/dafny_interop_examples_java.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
max-parallel: 1
2929
matrix:
3030
java-version: [8, 11, 16, 17]
31-
os: [macos-12]
31+
os: [macos-13]
3232
runs-on: ${{ matrix.os }}
3333
permissions:
3434
id-token: write

.github/workflows/dafny_interop_examples_net.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
matrix:
2525
library: [DynamoDbEncryption]
2626
dotnet-version: ["6.0.x"]
27-
os: [macos-12]
27+
os: [macos-13]
2828
runs-on: ${{ matrix.os }}
2929
permissions:
3030
id-token: write

.github/workflows/dafny_interop_java.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
matrix:
2929
library: [DynamoDbEncryption]
3030
java-version: [8, 11, 16, 17]
31-
os: [macos-12]
31+
os: [macos-13]
3232
runs-on: ${{ matrix.os }}
3333
permissions:
3434
id-token: write

.github/workflows/dafny_interop_test_net.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
matrix:
2525
library: [DynamoDbEncryption]
2626
dotnet-version: ["6.0.x"]
27-
os: [macos-12, ubuntu-latest, windows-latest]
27+
os: [macos-13, ubuntu-latest, windows-latest]
2828
runs-on: ${{ matrix.os }}
2929
permissions:
3030
id-token: write

.github/workflows/library_dafny_verification.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
DynamoDbItemEncryptor,
4040
StructuredEncryption,
4141
]
42-
os: [macos-12]
42+
os: [macos-13]
4343
runs-on: ${{ matrix.os }}
4444
defaults:
4545
run:
@@ -72,7 +72,7 @@ jobs:
7272
sed "s/mplDependencyJavaVersion=.*/mplDependencyJavaVersion=${{inputs.mpl-version}}/g" project.properties > project.properties2; mv project.properties2 project.properties
7373
7474
# dafny-reportgenerator requires next6
75-
# but only 7.0 is installed on macos-12-large
75+
# but only 7.0 is installed on macos-13-large
7676
- name: Setup .NET Core SDK '6.0.x'
7777
uses: actions/setup-dotnet@v4
7878
with:

.github/workflows/library_format.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
if: github.event_name != 'schedule' || github.repository_owner == 'aws'
2020
strategy:
2121
matrix:
22-
os: [macos-12]
22+
os: [macos-13]
2323
runs-on: ${{ matrix.os }}
2424
defaults:
2525
run:
@@ -39,7 +39,7 @@ jobs:
3939
- name: Setup Dafny
4040
uses: dafny-lang/[email protected]
4141
with:
42-
dafny-version: ${{ '4.2.0' }}
42+
dafny-version: ${{ inputs.dafny }}
4343

4444
- name: Check format of Java code et al
4545
run: |

.github/workflows/sem_ver.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66

77
jobs:
88
semantic-release:
9-
runs-on: macos-12
9+
runs-on: macos-13
1010
permissions:
1111
id-token: write
1212
contents: read

.github/workflows/semantic_release.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ jobs:
1414
# there is no easy way in gha to check if the actor is part of the team, running semantic release is a more
1515
# privileged operation, so we must make sure this list of users is a subset of the users labeled as maintainers of
1616
# https://github.com/orgs/aws/teams/aws-crypto-tools
17-
if: contains('["seebees","texastony","ShubhamChaturvedi7","lucasmcdonald3","josecorella","imabhichow","rishav-karanjit","antonf-amzn","justplaz","ajewellamz","RitvikKapila"]', github.actor)
18-
runs-on: macos-12
17+
if: contains('["seebees","texastony","ShubhamChaturvedi7","lucasmcdonald3","josecorella","imabhichow","rishav-karanjit","antonf-amzn","kessplas","ajewellamz","RitvikKapila"]', github.actor)
18+
runs-on: macos-13
1919
permissions:
2020
id-token: write
2121
contents: write

.github/workflows/test_vector_verification.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
if: github.event_name != 'schedule' || github.repository_owner == 'aws'
3030
strategy:
3131
matrix:
32-
os: [macos-12]
32+
os: [macos-13]
3333
runs-on: ${{ matrix.os }}
3434
defaults:
3535
run:
@@ -62,7 +62,7 @@ jobs:
6262
sed "s/mplDependencyJavaVersion=.*/mplDependencyJavaVersion=${{inputs.mpl-version}}/g" project.properties > project.properties2; mv project.properties2 project.properties
6363
6464
# dafny-reportgenerator requires next6
65-
# but only 7.0 is installed on macos-12-large
65+
# but only 7.0 is installed on macos-13-large
6666
- name: Setup .NET Core SDK '6.0.x'
6767
uses: actions/setup-dotnet@v4
6868
with:

DynamoDbEncryption/dafny/DynamoDbEncryption/src/ConfigToInfo.dfy

+13-8
Original file line numberDiff line numberDiff line change
@@ -137,14 +137,19 @@ module SearchConfigToInfo {
137137
else
138138
MPT.Default(Default := MPT.DefaultCache(entryCapacity := 1));
139139

140-
//= specification/searchable-encryption/search-config.md#key-store-cache
141-
//# For a Beacon Key Source a [CMC](../../submodules/MaterialProviders/aws-encryption-sdk-specification/framework/cryptographic-materials-cache.md)
142-
//# MUST be created.
143-
var input := MPT.CreateCryptographicMaterialsCacheInput(
144-
cache := cacheType
145-
);
146-
var maybeCache := mpl.CreateCryptographicMaterialsCache(input);
147-
var cache :- maybeCache.MapFailure(e => AwsCryptographyMaterialProviders(e));
140+
var cache;
141+
if cacheType.Shared? {
142+
cache := cacheType.Shared;
143+
} else {
144+
//= specification/searchable-encryption/search-config.md#key-store-cache
145+
//# For a Beacon Key Source a [CMC](../../submodules/MaterialProviders/aws-encryption-sdk-specification/framework/cryptographic-materials-cache.md)
146+
//# MUST be created.
147+
var input := MPT.CreateCryptographicMaterialsCacheInput(
148+
cache := cacheType
149+
);
150+
var maybeCache := mpl.CreateCryptographicMaterialsCache(input);
151+
cache :- maybeCache.MapFailure(e => AwsCryptographyMaterialProviders(e));
152+
}
148153

149154
if config.multi? {
150155
:- Need(0 < config.multi.cacheTTL, E("Beacon Cache TTL must be at least 1."));

DynamoDbEncryption/dafny/DynamoDbEncryption/src/SearchInfo.dfy

+5-5
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@ module SearchableEncryptionInfo {
7171
//# MUST be generated in accordance with [HMAC Key Generation](#hmac-key-generation).
7272
var newKey :- GetBeaconKey(client, key, keysLeft[0]);
7373
reveal Seq.HasNoDuplicates();
74-
//= specification/searchable-encryption/search-config.md#get-beacon-key-materials
75-
//# [Beacon Key Materials](../../submodules/MaterialProviders/aws-encryption-sdk-specification/framework/structures.md#beacon-key-materials) MUST be generated
76-
//# with the [beacon key id](#beacon-key-id) equal to the `beacon key id`
77-
//# and the [HMAC Keys](../../submodules/MaterialProviders/aws-encryption-sdk-specification/framework/structures.md#hmac-keys) equal to a map
78-
//# of every [standard beacons](beacons.md#standard-beacon-initialization) name to its generated HMAC key.
74+
//= specification/searchable-encryption/search-config.md#get-beacon-key-materials
75+
//# [Beacon Key Materials](../../submodules/MaterialProviders/aws-encryption-sdk-specification/framework/structures.md#beacon-key-materials) MUST be generated
76+
//# with the [beacon key id](#beacon-key-id) equal to the `beacon key id`
77+
//# and the [HMAC Keys](../../submodules/MaterialProviders/aws-encryption-sdk-specification/framework/structures.md#hmac-keys) equal to a map
78+
//# of every [standard beacons](beacons.md#standard-beacon-initialization) name to its generated HMAC key.
7979
output := GetHmacKeys(client, allKeys, keysLeft[1..], key, acc[keysLeft[0] := newKey]);
8080
}
8181
}

DynamoDbEncryption/dafny/DynamoDbEncryption/test/BeaconTestFixtures.dfy

+3
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,9 @@ module BeaconTestFixtures {
181181
ensures output.keyStore.ValidState()
182182
ensures fresh(output.keyStore.Modifies)
183183
ensures output.version == 1
184+
ensures
185+
&& output.keySource.multi?
186+
&& output.keySource.multi.cache.None?
184187
{
185188
var store := GetKeyStore();
186189
return BeaconVersion (

DynamoDbEncryption/dafny/StructuredEncryption/src/Header.dfy

+2-2
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ module StructuredEncryptionHeader {
132132
+ SerializeLegend(legend)
133133
+ SerializeContext(encContext)
134134
+ SerializeDataKeys(dataKeys)
135-
)
135+
)
136136
{
137137
var context := SerializeContext(encContext);
138138
var keys := SerializeDataKeys(dataKeys);
@@ -630,7 +630,7 @@ module StructuredEncryptionHeader {
630630
+ k.keyProviderInfo
631631
+ UInt16ToSeq(cipherSize)
632632
+ k.ciphertext
633-
)
633+
)
634634
{
635635
UInt16ToSeq(|k.keyProviderId| as uint16)
636636
+ k.keyProviderId

DynamoDbEncryption/runtimes/java/src/main/java/software/amazon/cryptography/dbencryptionsdk/dynamodb/enhancedclient/DynamoDbEnhancedClientEncryption.java

+4
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,10 @@ private static DynamoDbTableEncryptionConfig getTableConfig(
382382
builder = builder.plaintextOverride(configWithSchema.plaintextOverride());
383383
}
384384

385+
if (!Objects.isNull(configWithSchema.algorithmSuiteId())) {
386+
builder = builder.algorithmSuiteId(configWithSchema.algorithmSuiteId());
387+
}
388+
385389
return builder
386390
.allowedUnsignedAttributePrefix(
387391
configWithSchema.allowedUnsignedAttributePrefix()

DynamoDbEncryption/runtimes/java/src/test/java/software/amazon/cryptography/dbencryptionsdk/dynamodb/enhancedclient/DynamoDbEnhancedClientEncryptionTest.java

+7
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ public void TestMultipleTables() {
5656
.keyring(createKmsKeyring())
5757
.allowedUnsignedAttributes(Arrays.asList("doNothing"))
5858
.schemaOnEncrypt(simpleSchema)
59+
.algorithmSuiteId(
60+
DBEAlgorithmSuiteId.ALG_AES_256_GCM_HKDF_SHA512_COMMIT_KEY_SYMSIG_HMAC_SHA384
61+
)
5962
.build()
6063
);
6164
tableConfigs.put(
@@ -102,6 +105,10 @@ public void TestMultipleTables() {
102105
.config()
103106
.tableEncryptionConfigs()
104107
.get("SimpleClassTestTable");
108+
assertEquals(
109+
DBEAlgorithmSuiteId.ALG_AES_256_GCM_HKDF_SHA512_COMMIT_KEY_SYMSIG_HMAC_SHA384,
110+
simpleConfig.algorithmSuiteId()
111+
);
105112
assertEquals(
106113
CryptoAction.DO_NOTHING,
107114
simpleConfig.attributeActionsOnEncrypt().get("doNothing")

DynamoDbEncryption/runtimes/net/DynamoDbEncryption.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@
5757
</PropertyGroup>
5858

5959
<ItemGroup>
60-
<PackageReference Include="AWSSDK.DynamoDBv2" Version="3.7.303.14"/>
61-
<PackageReference Include="AWSSDK.Core" Version="3.7.304.16"/>
60+
<PackageReference Include="AWSSDK.DynamoDBv2" Version="3.7.402.2"/>
61+
<PackageReference Include="AWSSDK.Core" Version="3.7.400.38"/>
6262
<PackageReference Include="DafnyRuntime" Version="$(DafnyVersion)" />
6363
<ProjectReference Include="../../../submodules/MaterialProviders/AwsCryptographicMaterialProviders/runtimes/net/MPL.csproj"/>
6464
<!--

DynamoDbEncryption/runtimes/net/Generated/DynamoDbEncryption/TypeConversion.cs

+29
Original file line numberDiff line numberDiff line change
@@ -958,6 +958,11 @@ public static AWS.Cryptography.MaterialProviders.CacheType FromDafny_N3_aws__N12
958958
converted.StormTracking = FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S9_CacheType__M13_StormTracking(concrete.dtor_StormTracking);
959959
return converted;
960960
}
961+
if (value.is_Shared)
962+
{
963+
converted.Shared = FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S9_CacheType__M6_Shared(concrete.dtor_Shared);
964+
return converted;
965+
}
961966
throw new System.ArgumentException("Invalid AWS.Cryptography.MaterialProviders.CacheType state");
962967
}
963968
public static software.amazon.cryptography.materialproviders.internaldafny.types._ICacheType ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S9_CacheType(AWS.Cryptography.MaterialProviders.CacheType value)
@@ -982,6 +987,10 @@ public static software.amazon.cryptography.materialproviders.internaldafny.types
982987
{
983988
return software.amazon.cryptography.materialproviders.internaldafny.types.CacheType.create_StormTracking(ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S9_CacheType__M13_StormTracking(value.StormTracking));
984989
}
990+
if (value.IsSetShared())
991+
{
992+
return software.amazon.cryptography.materialproviders.internaldafny.types.CacheType.create_Shared(ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S9_CacheType__M6_Shared(value.Shared));
993+
}
985994
throw new System.ArgumentException("Invalid AWS.Cryptography.MaterialProviders.CacheType state");
986995
}
987996
public static string FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S13_AttributeName(Dafny.ISequence<char> value)
@@ -1154,6 +1163,14 @@ public static software.amazon.cryptography.materialproviders.internaldafny.types
11541163
{
11551164
return ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache(value);
11561165
}
1166+
public static AWS.Cryptography.MaterialProviders.ICryptographicMaterialsCache FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S9_CacheType__M6_Shared(software.amazon.cryptography.materialproviders.internaldafny.types.ICryptographicMaterialsCache value)
1167+
{
1168+
return FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S36_CryptographicMaterialsCacheReference(value);
1169+
}
1170+
public static software.amazon.cryptography.materialproviders.internaldafny.types.ICryptographicMaterialsCache ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S9_CacheType__M6_Shared(AWS.Cryptography.MaterialProviders.ICryptographicMaterialsCache value)
1171+
{
1172+
return ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S36_CryptographicMaterialsCacheReference(value);
1173+
}
11571174
public static string FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S14_AttributeValue__M1_S(Dafny.ISequence<char> value)
11581175
{
11591176
return FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S20_StringAttributeValue(value);
@@ -1324,6 +1341,18 @@ public static software.amazon.cryptography.materialproviders.internaldafny.types
13241341
int? var_entryPruningTailSize = value.IsSetEntryPruningTailSize() ? value.EntryPruningTailSize : (int?)null;
13251342
return new software.amazon.cryptography.materialproviders.internaldafny.types.StormTrackingCache(ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M13_entryCapacity(value.EntryCapacity), ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M20_entryPruningTailSize(var_entryPruningTailSize), ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M11_gracePeriod(value.GracePeriod), ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M13_graceInterval(value.GraceInterval), ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M6_fanOut(value.FanOut), ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M11_inFlightTTL(value.InFlightTTL), ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S18_StormTrackingCache__M10_sleepMilli(value.SleepMilli));
13261343
}
1344+
public static AWS.Cryptography.MaterialProviders.ICryptographicMaterialsCache FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S36_CryptographicMaterialsCacheReference(software.amazon.cryptography.materialproviders.internaldafny.types.ICryptographicMaterialsCache value)
1345+
{
1346+
// This is converting a reference type in a dependant module.
1347+
// Therefore it defers to the dependant module for conversion
1348+
return AWS.Cryptography.MaterialProviders.TypeConversion.FromDafny_N3_aws__N12_cryptography__N17_materialProviders__S36_CryptographicMaterialsCacheReference(value);
1349+
}
1350+
public static software.amazon.cryptography.materialproviders.internaldafny.types.ICryptographicMaterialsCache ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S36_CryptographicMaterialsCacheReference(AWS.Cryptography.MaterialProviders.ICryptographicMaterialsCache value)
1351+
{
1352+
// This is converting a reference type in a dependant module.
1353+
// Therefore it defers to the dependant module for conversion
1354+
return AWS.Cryptography.MaterialProviders.TypeConversion.ToDafny_N3_aws__N12_cryptography__N17_materialProviders__S36_CryptographicMaterialsCacheReference(value);
1355+
}
13271356
public static string FromDafny_N3_com__N9_amazonaws__N8_dynamodb__S20_StringAttributeValue(Dafny.ISequence<char> value)
13281357
{
13291358
return new string(value.Elements);

0 commit comments

Comments
 (0)