Skip to content

Commit a286555

Browse files
authored
chore(MPL): update MPL submodule and update to Dafny 4.1.0 (#182)
1 parent 2c3ef6c commit a286555

File tree

9 files changed

+25
-20
lines changed

9 files changed

+25
-20
lines changed

.github/workflows/ci_examples_java.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ jobs:
9090
uses: dafny-lang/[email protected]
9191
with:
9292
# A && B || C is the closest thing to an if .. then ... else ... or ?: expression the GitHub Actions syntax supports.
93-
dafny-version: ${{ (github.event_name == 'schedule' || inputs.nightly) && 'nightly-latest' || 'nightly-2023-04-12-f4836e9' }}
93+
dafny-version: ${{ (github.event_name == 'schedule' || inputs.nightly) && 'nightly-latest' || '4.1.0' }}
9494

9595
- name: Build and locally deploy dependencies for examples
9696
shell: bash

.github/workflows/ci_test_java.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ jobs:
8686
uses: dafny-lang/[email protected]
8787
with:
8888
# A && B || C is the closest thing to an if .. then ... else ... or ?: expression the GitHub Actions syntax supports.
89-
dafny-version: ${{ (github.event_name == 'schedule' || inputs.nightly) && 'nightly-latest' || 'nightly-2023-04-12-f4836e9' }}
89+
dafny-version: ${{ (github.event_name == 'schedule' || inputs.nightly) && 'nightly-latest' || '4.1.0' }}
9090

9191
- name: Setup Java ${{ matrix.java-version }}
9292
uses: actions/setup-java@v3

.github/workflows/ci_test_net.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ jobs:
7171
uses: dafny-lang/[email protected]
7272
with:
7373
# A && B || C is the closest thing to an if .. then ... else ... or ?: expression the GitHub Actions syntax supports.
74-
dafny-version: ${{ (github.event_name == 'schedule' || inputs.nightly) && 'nightly-latest' || 'nightly-2023-04-12-f4836e9' }}
74+
dafny-version: ${{ (github.event_name == 'schedule' || inputs.nightly) && 'nightly-latest' || '4.1.0' }}
7575

7676
- name: Download Dependencies
7777
working-directory: ./${{ matrix.library }}

.github/workflows/ci_verification.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ jobs:
6161
uses: dafny-lang/[email protected]
6262
with:
6363
# A && B || C is the closest thing to an if .. then ... else ... or ?: expression the GitHub Actions syntax supports.
64-
dafny-version: ${{ (github.event_name == 'schedule' || inputs.nightly) && 'nightly-latest' || 'nightly-2023-04-12-f4836e9' }}
64+
dafny-version: ${{ (github.event_name == 'schedule' || inputs.nightly) && 'nightly-latest' || '4.1.0' }}
6565

6666
- name: Verify ${{ matrix.library }} Dafny code
6767
shell: bash

DynamoDbEncryption/dafny/DynamoDbEncryption/src/Beacon.dfy

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,5 @@ module BaseBeacon {
305305
&& BytesToHex(bytes, 6) == "37"
306306
&& BytesToHex(bytes, 7) == "37"
307307
&& BytesToHex(bytes, 8) == "b7"
308-
&& BytesToHex(bytes, 9) == "1b7"
309-
&& BytesToHex(bytes, 10) == "3b7"
310308
{}
311309
}

DynamoDbEncryption/dafny/StructuredEncryption/src/Header.dfy

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ module StructuredEncryptionHeader {
4949
type CMPEncryptionContext = x : CMP.EncryptionContext | ValidEncryptionContext(x) witness *
5050
type CMPEncryptedDataKeyListEmptyOK = x : seq<CMPEncryptedDataKey> | |x| < UINT8_LIMIT
5151
type LegendByte = x : uint8 | ValidLegendByte(x) witness SIGN_ONLY_LEGEND
52-
type Legend = x : seq<LegendByte> | |x| < UINT16_LIMIT
53-
type CMPUtf8Bytes = x : CMP.Utf8Bytes | |x| < UINT16_LIMIT
52+
type Legend = x : seq<LegendByte> | |x| <= UINT16_LIMIT
53+
type CMPUtf8Bytes = x : CMP.Utf8Bytes | |x| <= UINT16_LIMIT
5454

5555
predicate method ValidVersion(x : uint8) {
5656
x == 1
@@ -73,15 +73,15 @@ module StructuredEncryptionHeader {
7373
}
7474

7575
predicate method ValidEncryptionContext(x : CMP.EncryptionContext) {
76-
&& |x| < UINT16_LIMIT
77-
&& (forall k <- x :: |k| < UINT16_LIMIT && |x[k]| < UINT16_LIMIT)
76+
&& |x| <= UINT16_LIMIT
77+
&& (forall k <- x :: |k| <= UINT16_LIMIT && |x[k]| <= UINT16_LIMIT)
7878
}
7979

8080
predicate method ValidEncryptedDataKey(x : CMP.EncryptedDataKey)
8181
{
82-
&& |x.keyProviderId| < UINT16_LIMIT
83-
&& |x.keyProviderInfo| < UINT16_LIMIT
84-
&& |x.ciphertext| < UINT16_LIMIT
82+
&& |x.keyProviderId| <= UINT16_LIMIT
83+
&& |x.keyProviderInfo| <= UINT16_LIMIT
84+
&& |x.ciphertext| <= UINT16_LIMIT
8585
}
8686

8787
// header without commitment
@@ -331,9 +331,9 @@ module StructuredEncryptionHeader {
331331

332332
function method ToUInt16(x : nat)
333333
: (ret : Result<uint16, Error>)
334-
ensures x < UINT16_LIMIT ==> ret.Success?
334+
ensures x <= UINT16_LIMIT ==> ret.Success?
335335
{
336-
:- Need(x < UINT16_LIMIT, E("Value too big for 16 bits"));
336+
:- Need(x <= UINT16_LIMIT, E("Value too big for 16 bits"));
337337
Success(x as uint16)
338338
}
339339

@@ -408,7 +408,7 @@ module StructuredEncryptionHeader {
408408
if |attrs| == 0 then
409409
Success(serialized)
410410
else
411-
:- Need((|serialized| + 1) < UINT16_LIMIT, E("Legend Too Long."));
411+
:- Need((|serialized| + 1) <= UINT16_LIMIT, E("Legend Too Long."));
412412
:- Need(data[attrs[0]].content.Action?, E("Schema must be flat"));
413413
var legendChar := GetActionLegend(data[attrs[0]].content.Action);
414414
MakeLegend2(attrs[1..], data, serialized + [legendChar])
@@ -579,7 +579,7 @@ module StructuredEncryptionHeader {
579579
if count == 0 then
580580
Success(deserialized)
581581
else
582-
:- Need(|deserialized.0| + 1 < UINT16_LIMIT, E("Too much context"));
582+
:- Need(|deserialized.0| + 1 <= UINT16_LIMIT, E("Too much context"));
583583
var kv :- GetOneKVPair(data);
584584
//= specification/structured-encryption/header.md#key-value-pair-entries
585585
//# This sequence MUST NOT contain duplicate entries.
@@ -852,6 +852,13 @@ module StructuredEncryptionHeader {
852852
assert provIdSize + 2 < |data|;
853853
var provId := data[2..2+provIdSize];
854854
assert provId == k.keyProviderId;
855+
856+
var part1Size := 2 + provIdSize;
857+
assert part1Size+2 <= |data|;
858+
var provInfoSize := SeqToUInt16(data[part1Size..part1Size+2]) as nat;
859+
assert part1Size + provInfoSize + 2 < |data|;
860+
var provInfo := data[part1Size+2..part1Size+2+provInfoSize];
861+
assert provInfo == k.keyProviderInfo;
855862
}
856863

857864
// GetOneDataKey ==> SerializeOneDataKey

DynamoDbEncryption/runtimes/java/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ repositories {
6464
val dynamodb by configurations.creating
6565

6666
dependencies {
67-
implementation("org.dafny:DafnyRuntime:4.0.0")
67+
implementation("org.dafny:DafnyRuntime:4.1.0")
6868
implementation("software.amazon.dafny:conversion:1.0-SNAPSHOT")
6969
implementation("software.amazon.cryptography:StandardLibrary:1.0-SNAPSHOT")
7070
implementation("software.amazon.cryptography:AwsCryptographyPrimitives:1.0-SNAPSHOT")

submodules/smithy-dafny

0 commit comments

Comments
 (0)