equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2002, 2018, 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. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
24 */ |
24 */ |
25 |
25 |
26 package com.sun.crypto.provider; |
26 package com.sun.crypto.provider; |
27 |
27 |
28 import java.security.InvalidKeyException; |
28 import java.security.InvalidKeyException; |
29 import java.util.Objects; |
|
30 |
29 |
31 import jdk.internal.HotSpotIntrinsicCandidate; |
30 import jdk.internal.HotSpotIntrinsicCandidate; |
|
31 import sun.security.util.ArrayUtil; |
32 |
32 |
33 /** |
33 /** |
34 * This class represents ciphers in counter (CTR) mode. |
34 * This class represents ciphers in counter (CTR) mode. |
35 * |
35 * |
36 * <p>This mode is implemented independently of a particular cipher. |
36 * <p>This mode is implemented independently of a particular cipher. |
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 if (len == 0) { |
175 if (len == 0) { |
176 return 0; |
176 return 0; |
177 } |
177 } |
178 Objects.checkFromIndexSize(inOff, len, in.length); |
178 |
179 Objects.checkFromIndexSize(outOff, len, out.length); |
179 ArrayUtil.nullAndBoundsCheck(in, inOff, len); |
|
180 ArrayUtil.nullAndBoundsCheck(out, outOff, len); |
180 return implCrypt(in, inOff, len, out, outOff); |
181 return implCrypt(in, inOff, len, out, outOff); |
181 } |
182 } |
182 |
183 |
183 // Implementation of crpyt() method. Possibly replaced with a compiler intrinsic. |
184 // Implementation of crpyt() method. Possibly replaced with a compiler intrinsic. |
184 @HotSpotIntrinsicCandidate |
185 @HotSpotIntrinsicCandidate |