170 * Essentially we XOR the input plaintext/ciphertext stream with a |
170 * Essentially we XOR the input plaintext/ciphertext stream with a |
171 * keystream generated by encrypting the counter values. Counter values |
171 * keystream generated by encrypting the counter values. Counter values |
172 * are encrypted on demand. |
172 * are encrypted on demand. |
173 */ |
173 */ |
174 private int crypt(byte[] in, int inOff, int len, byte[] out, int outOff) { |
174 private int crypt(byte[] in, int inOff, int len, byte[] out, int outOff) { |
175 |
175 if (len == 0) { |
176 Objects.checkFromIndexSize(inOff, len, in.length); |
176 return 0; |
177 Objects.checkFromIndexSize(outOff, len, out.length); |
177 } |
178 return implCrypt(in, inOff, len, out, outOff); |
178 Objects.checkFromIndexSize(inOff, len, in.length); |
|
179 Objects.checkFromIndexSize(outOff, len, out.length); |
|
180 return implCrypt(in, inOff, len, out, outOff); |
179 } |
181 } |
180 |
182 |
181 // Implementation of crpyt() method. Possibly replaced with a compiler intrinsic. |
183 // Implementation of crpyt() method. Possibly replaced with a compiler intrinsic. |
182 @HotSpotIntrinsicCandidate |
184 @HotSpotIntrinsicCandidate |
183 private int implCrypt(byte[] in, int inOff, int len, byte[] out, int outOff) { |
185 private int implCrypt(byte[] in, int inOff, int len, byte[] out, int outOff) { |