Skip to content

Commit f0938ee

Browse files
authored
Merge branch 'main' into benchmark
2 parents 0c2a4f7 + c397bf2 commit f0938ee

3 files changed

Lines changed: 75 additions & 42 deletions

File tree

  • DynamoDbEncryption/runtimes
    • java/src/main/sdkv1/com/amazonaws/services/dynamodbv2/datamodeling/internal
    • rust
  • cfn

DynamoDbEncryption/runtimes/java/src/main/sdkv1/com/amazonaws/services/dynamodbv2/datamodeling/internal/Hkdf.java

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -207,42 +207,7 @@ public byte[] deriveKey(final String info, final int length)
207207
public byte[] deriveKey(final byte[] info, final int length)
208208
throws IllegalStateException {
209209
byte[] result = new byte[length];
210-
try {
211-
deriveKey(info, length, result, 0);
212-
} catch (ShortBufferException ex) {
213-
// This exception is impossible as we ensure the buffer is long
214-
// enough
215-
throw new RuntimeException(ex);
216-
}
217-
return result;
218-
}
219-
220-
/**
221-
* Derives a pseudorandom key of <code>length</code> bytes and stores the result in <code>output
222-
* </code>.
223-
*
224-
* @param info optional context and application specific information (can be a zero-length array).
225-
* @param length the length of the output key in bytes
226-
* @param output the buffer where the pseudorandom key will be stored
227-
* @param offset the offset in <code>output</code> where the key will be stored
228-
* @throws ShortBufferException if the given output buffer is too small to hold the result
229-
* @throws IllegalStateException if this object has not been initialized
230-
*/
231-
public void deriveKey(
232-
final byte[] info,
233-
final int length,
234-
final byte[] output,
235-
final int offset
236-
) throws ShortBufferException, IllegalStateException {
237210
assertInitialized();
238-
if (length < 0) {
239-
throw new IllegalArgumentException(
240-
"Length must be a non-negative value."
241-
);
242-
}
243-
if (output.length < offset + length) {
244-
throw new ShortBufferException();
245-
}
246211
Mac mac = createMac();
247212

248213
if (length > 255 * mac.getMacLength()) {
@@ -262,14 +227,15 @@ public void deriveKey(
262227
t = mac.doFinal();
263228

264229
for (int x = 0; x < t.length && loc < length; x++, loc++) {
265-
output[loc] = t[x];
230+
result[loc] = t[x];
266231
}
267232

268233
i++;
269234
}
270235
} finally {
271236
Arrays.fill(t, (byte) 0); // Zeroize temporary array
272237
}
238+
return result;
273239
}
274240

275241
private Mac createMac() {

DynamoDbEncryption/runtimes/rust/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ readme = "README.md"
1818
[dependencies]
1919
aws-config = "1.8.10"
2020
aws-lc-rs = {version = "1.15.0"}
21-
aws-lc-sys = { version = "0.33", optional = true }
21+
aws-lc-sys = { version = "0.36", optional = true }
2222
aws-lc-fips-sys = { version = "0.13", optional = true }
2323
aws-sdk-dynamodb = "1.99.0"
2424
aws-sdk-kms = "1.94.0"

cfn/CI.yaml

Lines changed: 72 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,6 @@ Resources:
5959
KeyType: "HASH"
6060
- AttributeName: "sort_key"
6161
KeyType: "RANGE"
62-
ProvisionedThroughput:
63-
ReadCapacityUnits: "5"
64-
WriteCapacityUnits: "5"
6562
TableName: !Ref TableName
6663

6764
# These tables were manually created but not used in CI
@@ -88,7 +85,26 @@ Resources:
8885
AttributeType: "S"
8986
- AttributeName: "aws_dbe_b_stateAndHasSensitiveData"
9087
AttributeType: "S"
88+
- AttributeName: "aws_dbe_b_address"
89+
AttributeType: "S"
90+
- AttributeName: "aws_dbe_b_birthday"
91+
AttributeType: "S"
92+
- AttributeName: "aws_dbe_b_buildingAndFloor"
93+
AttributeType: "S"
94+
- AttributeName: "aws_dbe_b_email"
95+
AttributeType: "S"
96+
- AttributeName: "aws_dbe_b_stateAndHasTestResult"
97+
AttributeType: "S"
9198
GlobalSecondaryIndexes:
99+
- IndexName: "stateAndHasTestResult-index"
100+
KeySchema:
101+
- AttributeName: "aws_dbe_b_stateAndHasTestResult"
102+
KeyType: "HASH"
103+
Projection:
104+
ProjectionType: ALL
105+
ProvisionedThroughput:
106+
ReadCapacityUnits: "5"
107+
WriteCapacityUnits: "5"
92108
- IndexName: "state-zip-index"
93109
KeySchema:
94110
- AttributeName: "aws_dbe_b_state"
@@ -118,6 +134,37 @@ Resources:
118134
ProvisionedThroughput:
119135
ReadCapacityUnits: "5"
120136
WriteCapacityUnits: "5"
137+
- IndexName: "buildingAndFloor-index"
138+
KeySchema:
139+
- AttributeName: "aws_dbe_b_buildingAndFloor"
140+
KeyType: "HASH"
141+
Projection:
142+
ProjectionType: ALL
143+
ProvisionedThroughput:
144+
ReadCapacityUnits: "5"
145+
WriteCapacityUnits: "5"
146+
- IndexName: "email-birthday-index"
147+
KeySchema:
148+
- AttributeName: "aws_dbe_b_email"
149+
KeyType: "HASH"
150+
- AttributeName: "aws_dbe_b_birthday"
151+
KeyType: "RANGE"
152+
Projection:
153+
ProjectionType: ALL
154+
ProvisionedThroughput:
155+
ReadCapacityUnits: "5"
156+
WriteCapacityUnits: "5"
157+
- IndexName: "address-birthday-index"
158+
KeySchema:
159+
- AttributeName: "aws_dbe_b_address"
160+
KeyType: "HASH"
161+
- AttributeName: "aws_dbe_b_birthday"
162+
KeyType: "RANGE"
163+
Projection:
164+
ProjectionType: ALL
165+
ProvisionedThroughput:
166+
ReadCapacityUnits: "5"
167+
WriteCapacityUnits: "5"
121168
KeySchema:
122169
- AttributeName: "customer_id"
123170
KeyType: "HASH"
@@ -272,6 +319,8 @@ Resources:
272319
- !Sub "arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/${SearchTestJavaTableName}/index/*"
273320
- !Sub "arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/${SearchTestDotnetTableName}"
274321
- !Sub "arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/${SearchTestDotnetTableName}/index/*"
322+
- "arn:aws:dynamodb:us-west-2:370957321024:table/v2MostRecentKeyProviderPerfTestKeys"
323+
- "arn:aws:dynamodb:us-west-2:370957321024:table/v2MostRecentKeyProviderPerfTestKeys/index/*"
275324

276325
KMSUsage:
277326
Type: "AWS::IAM::ManagedPolicy"
@@ -324,18 +373,35 @@ Resources:
324373
- !Sub "arn:aws:kms:eu-west-1:658956600833:key/*"
325374
- !Sub "arn:aws:kms:eu-west-1:658956600833:alias/*"
326375

376+
PerformanceBenchmarksCloudWatchUsage:
377+
Type: "AWS::IAM::ManagedPolicy"
378+
Properties:
379+
Description: "Allow CloudWatch Logs operations for performance benchmarks"
380+
ManagedPolicyName: !Sub "DBESDK-Performance-Benchmarks-CloudWatch-${AWS::Region}"
381+
PolicyDocument:
382+
Version: "2012-10-17"
383+
Statement:
384+
- Effect: Allow
385+
Action:
386+
- logs:CreateLogGroup
387+
- logs:CreateLogStream
388+
- logs:PutLogEvents
389+
- logs:DescribeLogStreams
390+
Resource: !Sub "arn:aws:logs:*:*:log-group:aws-dbesdk-performance-benchmarks:*"
391+
327392
GitHubCIRole:
328393
Type: "AWS::IAM::Role"
329394
Properties:
330395
RoleName: !Sub "GitHub-CI-${ProjectName}-Role-${AWS::Region}"
331-
Description: "Access DDB, KMS, & CA Resources for CI from GitHub"
396+
Description: "Access DDB, KMS, and CA Resources for CI from GitHub"
332397
ManagedPolicyArns:
333398
- Fn::ImportValue: "Polymorph-CA-GitHubCAReadPolicyArn"
334399
- "arn:aws:iam::370957321024:policy/ESDK-Dafny-DDB-ReadWriteDelete-us-west-2"
335400
- "arn:aws:iam::370957321024:policy/Hierarchical-GitHub-KMS-Key-Policy"
336401
- "arn:aws:iam::370957321024:policy/Github-ECDH-KMS"
337402
- !Ref KMSUsage
338403
- !Ref DDBUsage
404+
- !Ref PerformanceBenchmarksCloudWatchUsage
339405
AssumeRolePolicyDocument: !Sub |
340406
{
341407
"Version": "2012-10-17",
@@ -351,7 +417,8 @@ Resources:
351417
"StringLike": {
352418
"token.actions.githubusercontent.com:sub": [
353419
"repo:aws/aws-database-encryption-sdk-dynamodb:*",
354-
"repo:aws/private-aws-database-encryption-sdk-dynamodb-java-staging:*"
420+
"repo:aws/private-aws-database-encryption-sdk-dynamodb-java-staging:*",
421+
"repo:aws/aws-cryptographic-material-providers-library:*"
355422
]
356423
}
357424
}

0 commit comments

Comments
 (0)