Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit cc942d0

Browse files
committedApr 21, 2024
m
1 parent 6f3b8a8 commit cc942d0

File tree

3 files changed

+6
-20
lines changed

3 files changed

+6
-20
lines changed
 

‎DynamoDbEncryption/dafny/StructuredEncryption/src/AwsCryptographyDbEncryptionSdkStructuredEncryptionOperations.dfy

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -571,20 +571,12 @@ module AwsCryptographyDbEncryptionSdkStructuredEncryptionOperations refines Abst
571571
BuildAuthMap2(keys[1..], plaintextStructure, authSchema, acc + [item])
572572
}
573573

574-
const HEADER_AUTH : AuthenticateSchemaMap :=
575-
map[
576-
HeaderField := DO_NOT_SIGN,
577-
FooterField := DO_NOT_SIGN
578-
]
579574
function method BuildAuthMap(plaintextStructure: StructuredDataMap, authSchema: AuthenticateSchemaMap) :
580575
Result<AuthList, Error>
581-
requires HeaderField !in authSchema
582-
requires FooterField !in authSchema
576+
requires plaintextStructure.Keys == authSchema.Keys
583577
{
584-
var fullAuthSchema := authSchema + HEADER_AUTH;
585-
:- Need(plaintextStructure.Keys == fullAuthSchema.Keys, E("Auth Keys don't match."));
586578
var keys := SortedSets.ComputeSetToOrderedSequence2(plaintextStructure.Keys, CharLess);
587-
BuildAuthMap2(keys, plaintextStructure, fullAuthSchema)
579+
BuildAuthMap2(keys, plaintextStructure, authSchema)
588580
}
589581

590582
function method UnBuildCryptoMap(list : CryptoList, dataSoFar : StructuredDataMap := map[], actionsSoFar : CryptoSchemaMap := map[]) :
@@ -853,8 +845,7 @@ module AwsCryptographyDbEncryptionSdkStructuredEncryptionOperations refines Abst
853845
method {:vcs_split_on_every_assert} DecryptStructure (config: InternalConfig, input: DecryptStructureInput)
854846
returns (output: Result<DecryptStructureOutput, Error>)
855847
{
856-
:- Need(HeaderField !in input.authenticateSchema, E("DecryptStructure authenticateSchema must not include " + HeaderField + "."));
857-
:- Need(FooterField !in input.authenticateSchema, E("DecryptStructure authenticateSchema must not include " + FooterField + "."));
848+
:- Need(input.encryptedStructure.Keys == input.authenticateSchema.Keys, E("DecryptStructure requires encryptedStructure and authenticateSchema have the same keys."));
858849
var cryptoMap :- BuildAuthMap(input.encryptedStructure, input.authenticateSchema);
859850
var pathInput := DecryptPathStructureInput(
860851
tableName := input.tableName,

‎DynamoDbEncryption/dafny/StructuredEncryption/test/HappyCaseTests.dfy

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,9 @@ module HappyCaseTests {
6060
print "\n\n",decryptRes,"\n\n";
6161
}
6262
expect decryptRes.Success?;
63-
<<<<<<< HEAD
6463
var newResult := decryptRes.value.plaintextStructure;
6564
var testResult := StructuredDataTestFixtures.TEST_STRUCTURED_DATA;
6665
expect newResult == testResult;
67-
=======
68-
var newResult := decryptRes.value.plaintextStructure.content;
69-
var testResult := StructuredDataTestFixtures.TEST_STRUCTURED_DATA.content;
70-
expect newResult.DataMap?;
71-
expect newResult.DataMap == testResult.DataMap;
72-
>>>>>>> main
7366

7467
//= specification/structured-encryption/decrypt-structure.md#construct-decrypted-structured-data
7568
//= type=test

‎DynamoDbEncryption/dafny/StructuredEncryption/test/StructuredDataTestFixtures.dfy

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ module StructuredDataTestFixtures {
4646
map[
4747
"foo" := SIGN,
4848
"bar" := SIGN,
49-
"fizzbuzz" := DO_NOT_SIGN
49+
"fizzbuzz" := DO_NOT_SIGN,
50+
"aws_dbe_head" := DO_NOT_SIGN,
51+
"aws_dbe_foot" := DO_NOT_SIGN
5052
]
5153

5254
const PUBLIC_US_WEST_2_KMS_TEST_KEY := "arn:aws:kms:us-west-2:658956600833:key/b3537ef1-d8dc-4780-9f5a-55776cbb2f7f"

0 commit comments

Comments
 (0)
Please sign in to comment.