Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/quite/humla-spongycastle.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2013-09-17 14:24:39 +0400
committerPeter Dettman <peter.dettman@bouncycastle.org>2013-09-17 14:24:39 +0400
commitd03a1a1a45b922c970da7895878a91270b9d3567 (patch)
tree7d336574b3aa4b8926acd519809bd50dc07ec492 /core/src/main/java/org/bouncycastle/crypto/tls/TlsStreamCipher.java
parentbca63325a489aea4c649ee992cc7df22d4dc9349 (diff)
Add some TODOs related to draft-josefsson-salsa20-tls-02
Diffstat (limited to 'core/src/main/java/org/bouncycastle/crypto/tls/TlsStreamCipher.java')
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/tls/TlsStreamCipher.java14
1 files changed, 14 insertions, 0 deletions
diff --git a/core/src/main/java/org/bouncycastle/crypto/tls/TlsStreamCipher.java b/core/src/main/java/org/bouncycastle/crypto/tls/TlsStreamCipher.java
index effa6545..178731d3 100644
--- a/core/src/main/java/org/bouncycastle/crypto/tls/TlsStreamCipher.java
+++ b/core/src/main/java/org/bouncycastle/crypto/tls/TlsStreamCipher.java
@@ -89,6 +89,13 @@ public class TlsStreamCipher
public byte[] encodePlaintext(long seqNo, short type, byte[] plaintext, int offset, int len)
{
+ /*
+ * TODO[draft-josefsson-salsa20-tls-02] Note that Salsa20 requires a 64-bit nonce. That
+ * nonce is updated on the encryption of every TLS record, and is set to be the 64-bit TLS
+ * record sequence number. In case of DTLS the 64-bit nonce is formed as the concatenation
+ * of the 16-bit epoch with the 48-bit sequence number.
+ */
+
byte[] outBuf = new byte[len + writeMac.getSize()];
encryptCipher.processBytes(plaintext, offset, len, outBuf, 0);
@@ -110,6 +117,13 @@ public class TlsStreamCipher
public byte[] decodeCiphertext(long seqNo, short type, byte[] ciphertext, int offset, int len)
throws IOException
{
+ /*
+ * TODO[draft-josefsson-salsa20-tls-02] Note that Salsa20 requires a 64-bit nonce. That
+ * nonce is updated on the encryption of every TLS record, and is set to be the 64-bit TLS
+ * record sequence number. In case of DTLS the 64-bit nonce is formed as the concatenation
+ * of the 16-bit epoch with the 48-bit sequence number.
+ */
+
int macSize = readMac.getSize();
if (len < macSize)
{