Skip to content

Commit 4f8ede4

Browse files
author
gefeili
committed
Merge branch 'main' into io-overlap-dbbc-child
# Conflicts: # core/src/main/java/org/bouncycastle/crypto/DefaultBufferedBlockCipher.java # core/src/main/java/org/bouncycastle/crypto/paddings/PaddedBufferedBlockCipher.java
2 parents 7868d58 + afbde47 commit 4f8ede4

File tree

1 file changed

+50
-50
lines changed

1 file changed

+50
-50
lines changed

core/src/main/java/org/bouncycastle/crypto/DefaultBufferedBlockCipher.java

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414
public class DefaultBufferedBlockCipher
1515
extends BufferedBlockCipher
1616
{
17-
protected byte[] buf;
18-
protected int bufOff;
17+
protected byte[] buf;
18+
protected int bufOff;
1919

20-
protected boolean forEncryption;
21-
protected BlockCipher cipher;
20+
protected boolean forEncryption;
21+
protected BlockCipher cipher;
2222
protected MultiBlockCipher mbCipher;
2323

24-
protected boolean partialBlockOkay;
25-
protected boolean pgpCFB;
24+
protected boolean partialBlockOkay;
25+
protected boolean pgpCFB;
2626

2727
/**
2828
* constructor for subclasses
@@ -37,7 +37,7 @@ protected DefaultBufferedBlockCipher()
3737
* @param cipher the underlying block cipher this buffering object wraps.
3838
*/
3939
public DefaultBufferedBlockCipher(
40-
BlockCipher cipher)
40+
BlockCipher cipher)
4141
{
4242
this.cipher = cipher;
4343

@@ -57,8 +57,8 @@ public DefaultBufferedBlockCipher(
5757
//
5858
// check if we can handle partial blocks on doFinal.
5959
//
60-
String name = cipher.getAlgorithmName();
61-
int idx = name.indexOf('/') + 1;
60+
String name = cipher.getAlgorithmName();
61+
int idx = name.indexOf('/') + 1;
6262

6363
pgpCFB = (idx > 0 && name.startsWith("PGP", idx));
6464

@@ -86,14 +86,14 @@ public BlockCipher getUnderlyingCipher()
8686
* initialise the cipher.
8787
*
8888
* @param forEncryption if true the cipher is initialised for
89-
* encryption, if false for decryption.
90-
* @param params the key and other data required by the cipher.
91-
* @throws IllegalArgumentException if the params argument is
92-
* inappropriate.
89+
* encryption, if false for decryption.
90+
* @param params the key and other data required by the cipher.
91+
* @exception IllegalArgumentException if the params argument is
92+
* inappropriate.
9393
*/
9494
public void init(
95-
boolean forEncryption,
96-
CipherParameters params)
95+
boolean forEncryption,
96+
CipherParameters params)
9797
throws IllegalArgumentException
9898
{
9999
this.forEncryption = forEncryption;
@@ -114,7 +114,7 @@ public int getBlockSize()
114114
}
115115

116116
/**
117-
* return the size of the output buffer required for an update
117+
* return the size of the output buffer required for an update
118118
* an input of len bytes.
119119
*
120120
* @param len the length of the input.
@@ -124,7 +124,7 @@ public int getBlockSize()
124124
public int getUpdateOutputSize(
125125
int len)
126126
{
127-
int total = len + bufOff;
127+
int total = len + bufOff;
128128
int leftOver;
129129

130130
if (pgpCFB)
@@ -140,7 +140,7 @@ public int getUpdateOutputSize(
140140
}
141141
else
142142
{
143-
leftOver = total % buf.length;
143+
leftOver = total % buf.length;
144144
}
145145

146146
return total - leftOver;
@@ -169,20 +169,20 @@ public int getOutputSize(
169169
/**
170170
* process a single byte, producing an output block if necessary.
171171
*
172-
* @param in the input byte.
173-
* @param out the space for any output that might be produced.
172+
* @param in the input byte.
173+
* @param out the space for any output that might be produced.
174174
* @param outOff the offset from which the output will be copied.
175175
* @return the number of output bytes copied to out.
176-
* @throws DataLengthException if there isn't enough space in out.
177-
* @throws IllegalStateException if the cipher isn't initialised.
176+
* @exception DataLengthException if there isn't enough space in out.
177+
* @exception IllegalStateException if the cipher isn't initialised.
178178
*/
179179
public int processByte(
180-
byte in,
181-
byte[] out,
182-
int outOff)
180+
byte in,
181+
byte[] out,
182+
int outOff)
183183
throws DataLengthException, IllegalStateException
184184
{
185-
int resultLen = 0;
185+
int resultLen = 0;
186186

187187
buf[bufOff++] = in;
188188

@@ -198,31 +198,31 @@ public int processByte(
198198
/**
199199
* process an array of bytes, producing output if necessary.
200200
*
201-
* @param in the input byte array.
202-
* @param inOff the offset at which the input data starts.
203-
* @param len the number of bytes to be copied out of the input array.
204-
* @param out the space for any output that might be produced.
201+
* @param in the input byte array.
202+
* @param inOff the offset at which the input data starts.
203+
* @param len the number of bytes to be copied out of the input array.
204+
* @param out the space for any output that might be produced.
205205
* @param outOff the offset from which the output will be copied.
206206
* @return the number of output bytes copied to out.
207-
* @throws DataLengthException if there isn't enough space in out.
208-
* @throws IllegalStateException if the cipher isn't initialised.
207+
* @exception DataLengthException if there isn't enough space in out.
208+
* @exception IllegalStateException if the cipher isn't initialised.
209209
*/
210210
public int processBytes(
211-
byte[] in,
212-
int inOff,
213-
int len,
214-
byte[] out,
215-
int outOff)
211+
byte[] in,
212+
int inOff,
213+
int len,
214+
byte[] out,
215+
int outOff)
216216
throws DataLengthException, IllegalStateException
217217
{
218218
if (len < 0)
219219
{
220220
throw new IllegalArgumentException("Can't have a negative input length!");
221221
}
222222

223-
int blockSize = getBlockSize();
224-
int length = getUpdateOutputSize(len);
225-
223+
int blockSize = getBlockSize();
224+
int length = getUpdateOutputSize(len);
225+
226226
if (length > 0)
227227
{
228228
if ((outOff + length) > out.length)
@@ -293,20 +293,20 @@ public int processBytes(
293293
/**
294294
* Process the last block in the buffer.
295295
*
296-
* @param out the array the block currently being held is copied into.
296+
* @param out the array the block currently being held is copied into.
297297
* @param outOff the offset at which the copying starts.
298298
* @return the number of output bytes copied to out.
299-
* @throws DataLengthException if there is insufficient space in out for
300-
* the output, or the input is not block size aligned and should be.
301-
* @throws IllegalStateException if the underlying cipher is not
302-
* initialised.
303-
* @throws InvalidCipherTextException if padding is expected and not found.
304-
* @throws DataLengthException if the input is not block size
305-
* aligned.
299+
* @exception DataLengthException if there is insufficient space in out for
300+
* the output, or the input is not block size aligned and should be.
301+
* @exception IllegalStateException if the underlying cipher is not
302+
* initialised.
303+
* @exception InvalidCipherTextException if padding is expected and not found.
304+
* @exception DataLengthException if the input is not block size
305+
* aligned.
306306
*/
307307
public int doFinal(
308-
byte[] out,
309-
int outOff)
308+
byte[] out,
309+
int outOff)
310310
throws DataLengthException, IllegalStateException, InvalidCipherTextException
311311
{
312312
try

0 commit comments

Comments
 (0)