Skip to content

Commit 785d57a

Browse files
author
gefeili
committed
Add Romulus M
1 parent 788a212 commit 785d57a

File tree

5 files changed

+305
-195
lines changed

5 files changed

+305
-195
lines changed

core/src/main/java/org/bouncycastle/crypto/engines/AEADBufferBaseEngine.java

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ protected enum DataOperatorType
2929
{
3030
Default,
3131
Counter,
32-
Stream
32+
Stream,
33+
//StreamCipher
3334
}
3435

3536
protected enum State
@@ -103,8 +104,12 @@ protected void setInnerMembers(ProcessingBufferType type, AADOperatorType aadOpe
103104
dataOperator = new CounterDataOperator();
104105
break;
105106
case Stream:
107+
m_buf = new byte[MAC_SIZE];
106108
dataOperator = new StreamDataOperator();
107109
break;
110+
// case StreamCipher:
111+
// dataOperator = new StreamCipherOperator();
112+
// break;
108113
}
109114
}
110115

@@ -382,15 +387,17 @@ public void reset()
382387
}
383388
}
384389

385-
protected static class StreamDataOperator
390+
protected class StreamDataOperator
386391
implements DataOperator
387392
{
388393
private final ErasableOutputStream stream = new ErasableOutputStream();
389394

390395
@Override
391396
public int processBytes(byte[] input, int inOff, int len, byte[] output, int outOff)
392397
{
398+
ensureInitialized();
393399
stream.write(input, inOff, len);
400+
m_bufPos = stream.size();
394401
return 0;
395402
}
396403

@@ -412,6 +419,31 @@ public void reset()
412419
}
413420
}
414421

422+
// protected class StreamCipherOperator
423+
// implements DataOperator
424+
// {
425+
// private int len;
426+
// @Override
427+
// public int processBytes(byte[] input, int inOff, int len, byte[] output, int outOff)
428+
// {
429+
// this.len = len;
430+
// processBufferEncrypt(input, inOff, output, outOff);
431+
// return len;
432+
// }
433+
//
434+
// @Override
435+
// public int getLen()
436+
// {
437+
// return 0;
438+
// }
439+
//
440+
// @Override
441+
// public void reset()
442+
// {
443+
//
444+
// }
445+
// }
446+
415447
protected static final class ErasableOutputStream
416448
extends ByteArrayOutputStream
417449
{

core/src/main/java/org/bouncycastle/crypto/engines/Grain128AEADEngine.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import org.bouncycastle.crypto.DataLengthException;
66
import org.bouncycastle.crypto.InvalidCipherTextException;
77
import org.bouncycastle.crypto.OutputLengthException;
8-
import org.bouncycastle.util.Arrays;
98
import org.bouncycastle.util.Pack;
109

1110
/**

0 commit comments

Comments
 (0)