mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8284112: Minor cleanup could be done in javax.crypto
Reviewed-by: wetmore
This commit is contained in:
parent
897d6c0dc7
commit
41fc078323
37 changed files with 204 additions and 270 deletions
|
@ -25,16 +25,9 @@
|
|||
|
||||
package javax.crypto;
|
||||
|
||||
import java.security.AlgorithmParameters;
|
||||
import java.security.Key;
|
||||
import java.security.SecureRandom;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.InvalidAlgorithmParameterException;
|
||||
import java.security.ProviderException;
|
||||
import java.security.spec.AlgorithmParameterSpec;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.security.*;
|
||||
import java.security.spec.AlgorithmParameterSpec;
|
||||
|
||||
/**
|
||||
* This class defines the <i>Service Provider Interface</i> (<b>SPI</b>)
|
||||
|
@ -540,7 +533,7 @@ public abstract class CipherSpi {
|
|||
* process ByteBuffers more efficiently than byte arrays.
|
||||
*
|
||||
* @param input the input ByteBuffer
|
||||
* @param output the output ByteByffer
|
||||
* @param output the output ByteBuffer
|
||||
*
|
||||
* @return the number of bytes stored in <code>output</code>
|
||||
*
|
||||
|
@ -701,7 +694,7 @@ public abstract class CipherSpi {
|
|||
* process ByteBuffers more efficiently than byte arrays.
|
||||
*
|
||||
* @param input the input ByteBuffer
|
||||
* @param output the output ByteByffer
|
||||
* @param output the output ByteBuffer
|
||||
*
|
||||
* @return the number of bytes stored in <code>output</code>
|
||||
*
|
||||
|
@ -771,8 +764,9 @@ public abstract class CipherSpi {
|
|||
byte[] inArray = input.array();
|
||||
int inOfs = input.arrayOffset() + inPos;
|
||||
|
||||
byte[] outArray;
|
||||
if (a2) { // output has an accessible byte[]
|
||||
byte[] outArray = output.array();
|
||||
outArray = output.array();
|
||||
int outPos = output.position();
|
||||
int outOfs = output.arrayOffset() + outPos;
|
||||
|
||||
|
@ -797,10 +791,7 @@ public abstract class CipherSpi {
|
|||
// adjust output position manually
|
||||
output.position(outPos + total);
|
||||
}
|
||||
// adjust input position manually
|
||||
input.position(inLimit);
|
||||
} else { // output does not have an accessible byte[]
|
||||
byte[] outArray = null;
|
||||
if (isUpdate) {
|
||||
outArray = engineUpdate(inArray, inOfs, inLen);
|
||||
} else {
|
||||
|
@ -810,9 +801,9 @@ public abstract class CipherSpi {
|
|||
output.put(outArray);
|
||||
total = outArray.length;
|
||||
}
|
||||
// adjust input position manually
|
||||
input.position(inLimit);
|
||||
}
|
||||
// adjust input position manually
|
||||
input.position(inLimit);
|
||||
} else { // input does not have an accessible byte[]
|
||||
// have to assume the worst, since we have no way of determine
|
||||
// if input and output overlaps or not
|
||||
|
@ -934,7 +925,7 @@ public abstract class CipherSpi {
|
|||
}
|
||||
|
||||
/**
|
||||
* Continues a multi-part update of the Additional Authentication
|
||||
* Continues a multipart update of the Additional Authentication
|
||||
* Data (AAD), using a subset of the provided buffer.
|
||||
* <p>
|
||||
* Calls to this method provide AAD to the cipher when operating in
|
||||
|
@ -964,7 +955,7 @@ public abstract class CipherSpi {
|
|||
}
|
||||
|
||||
/**
|
||||
* Continues a multi-part update of the Additional Authentication
|
||||
* Continues a multipart update of the Additional Authentication
|
||||
* Data (AAD).
|
||||
* <p>
|
||||
* Calls to this method provide AAD to the cipher when operating in
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue