Skip to content

Commit 94366b0

Browse files
Merge branch 'master' into dependabot/maven/com.fasterxml.jackson.core-jackson-annotations-2.20
2 parents bc58322 + 600e735 commit 94366b0

File tree

2 files changed

+4
-35
lines changed

2 files changed

+4
-35
lines changed

.github/workflows/run-codebuild-ci.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,16 @@ jobs:
2626
with:
2727
project-name: java-ddb-ec
2828
buildspec-override: codebuild/static-analysis.yml
29-
image-override: aws/codebuild/amazonlinux2-x86_64-standard:3.0
29+
image-override: aws/codebuild/amazonlinux-x86_64-standard:5.0
3030
build:
3131
name: Build
3232
runs-on: ubuntu-latest
3333
strategy:
3434
fail-fast: true
3535
matrix:
3636
platform:
37-
- distribution: openjdk
38-
image: "aws/codebuild/standard:3.0"
3937
- distribution: corretto
40-
image: "aws/codebuild/amazonlinux2-x86_64-standard:3.0" # Corretto only runs on AL2
38+
image: "aws/codebuild/standard:7.0"
4139
version: [ 8, 11 ]
4240
steps:
4341
- name: Configure AWS Credentials

sdk1/src/main/java/com/amazonaws/services/dynamodbv2/datamodeling/internal/Hkdf.java

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import java.util.Arrays;
2424
import javax.crypto.Mac;
2525
import javax.crypto.SecretKey;
26-
import javax.crypto.ShortBufferException;
2726
import javax.crypto.spec.SecretKeySpec;
2827

2928
/**
@@ -193,36 +192,7 @@ public byte[] deriveKey(final String info, final int length) throws IllegalState
193192
*/
194193
public byte[] deriveKey(final byte[] info, final int length) throws IllegalStateException {
195194
byte[] result = new byte[length];
196-
try {
197-
deriveKey(info, length, result, 0);
198-
} catch (ShortBufferException ex) {
199-
// This exception is impossible as we ensure the buffer is long
200-
// enough
201-
throw new RuntimeException(ex);
202-
}
203-
return result;
204-
}
205-
206-
/**
207-
* Derives a pseudorandom key of <code>length</code> bytes and stores the result in <code>output
208-
* </code>.
209-
*
210-
* @param info optional context and application specific information (can be a zero-length array).
211-
* @param length the length of the output key in bytes
212-
* @param output the buffer where the pseudorandom key will be stored
213-
* @param offset the offset in <code>output</code> where the key will be stored
214-
* @throws ShortBufferException if the given output buffer is too small to hold the result
215-
* @throws IllegalStateException if this object has not been initialized
216-
*/
217-
public void deriveKey(final byte[] info, final int length, final byte[] output, final int offset)
218-
throws ShortBufferException, IllegalStateException {
219195
assertInitialized();
220-
if (length < 0) {
221-
throw new IllegalArgumentException("Length must be a non-negative value.");
222-
}
223-
if (output.length < offset + length) {
224-
throw new ShortBufferException();
225-
}
226196
Mac mac = createMac();
227197

228198
if (length > 255 * mac.getMacLength()) {
@@ -241,14 +211,15 @@ public void deriveKey(final byte[] info, final int length, final byte[] output,
241211
t = mac.doFinal();
242212

243213
for (int x = 0; x < t.length && loc < length; x++, loc++) {
244-
output[loc] = t[x];
214+
result[loc] = t[x];
245215
}
246216

247217
i++;
248218
}
249219
} finally {
250220
Arrays.fill(t, (byte) 0); // Zeroize temporary array
251221
}
222+
return result;
252223
}
253224

254225
private Mac createMac() {

0 commit comments

Comments
 (0)