1 /* |
1 /* |
2 * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
30 |
30 |
31 public class TestAESEncode extends TestAESBase { |
31 public class TestAESEncode extends TestAESBase { |
32 @Override |
32 @Override |
33 public void run() { |
33 public void run() { |
34 try { |
34 try { |
35 if (!noReinit) cipher.init(Cipher.ENCRYPT_MODE, key, algParams); |
35 if (mode.equals("GCM")) { |
|
36 gcm_init(true); |
|
37 } else if (!noReinit) { |
|
38 cipher.init(Cipher.ENCRYPT_MODE, key, algParams); |
|
39 } |
36 encode = new byte[encodeLength]; |
40 encode = new byte[encodeLength]; |
37 if (testingMisalignment) { |
41 if (testingMisalignment) { |
38 int tempSize = cipher.update(input, encInputOffset, (msgSize - lastChunkSize), encode, encOutputOffset); |
42 int tempSize = cipher.update(input, encInputOffset, (msgSize - lastChunkSize), encode, encOutputOffset); |
39 cipher.doFinal(input, (encInputOffset + msgSize - lastChunkSize), lastChunkSize, encode, (encOutputOffset + tempSize)); |
43 cipher.doFinal(input, (encInputOffset + msgSize - lastChunkSize), lastChunkSize, encode, (encOutputOffset + tempSize)); |
40 } else { |
44 } else { |