Use the same maximum frame length for all transports.

This commit is contained in:
akwizgran
2015-01-05 16:24:44 +00:00
parent 358166bc12
commit d3bf2d59a1
60 changed files with 194 additions and 321 deletions

View File

@@ -2,7 +2,7 @@ package org.briarproject.api.crypto;
import java.security.GeneralSecurityException;
/** An authenticated cipher that support additional authenticated data. */
/** An authenticated cipher that supports additional authenticated data. */
public interface AuthenticatedCipher {
/**

View File

@@ -7,12 +7,11 @@ import org.briarproject.api.transport.StreamContext;
public interface StreamDecrypterFactory {
/** Creates a {@link StreamDecrypter} for decrypting a transport stream. */
StreamDecrypter createStreamDecrypter(InputStream in, int maxFrameLength,
StreamContext ctx);
StreamDecrypter createStreamDecrypter(InputStream in, StreamContext ctx);
/**
* Creates a {@link StreamDecrypter} for decrypting an invitation stream.
*/
StreamDecrypter createInvitationStreamDecrypter(InputStream in,
int maxFrameLength, byte[] secret, boolean alice);
byte[] secret, boolean alice);
}

View File

@@ -7,12 +7,11 @@ import org.briarproject.api.transport.StreamContext;
public interface StreamEncrypterFactory {
/** Creates a {@link StreamEncrypter} for encrypting a transport stream. */
StreamEncrypter createStreamEncrypter(OutputStream out,
int maxFrameLength, StreamContext ctx);
StreamEncrypter createStreamEncrypter(OutputStream out, StreamContext ctx);
/**
* Creates a {@link StreamEncrypter} for encrypting an invitation stream.
*/
StreamEncrypter createInvitationStreamEncrypter(OutputStream out,
int maxFrameLength, byte[] secret, boolean alice);
byte[] secret, boolean alice);
}

View File

@@ -11,9 +11,6 @@ public interface Plugin {
/** Returns the plugin's transport identifier. */
TransportId getId();
/** Returns the transport's maximum frame length in bytes. */
int getMaxFrameLength();
/** Returns the transport's maximum latency in milliseconds. */
int getMaxLatency();

View File

@@ -9,9 +9,6 @@ import java.io.InputStream;
*/
public interface TransportConnectionReader {
/** Returns the maximum frame length of the transport in bytes. */
int getMaxFrameLength();
/** Returns the maximum latency of the transport in milliseconds. */
long getMaxLatency();

View File

@@ -9,9 +9,6 @@ import java.io.OutputStream;
*/
public interface TransportConnectionWriter {
/** Returns the maximum frame length of the transport in bytes. */
int getMaxFrameLength();
/** Returns the maximum latency of the transport in milliseconds. */
int getMaxLatency();

View File

@@ -8,13 +8,12 @@ public interface StreamReaderFactory {
* Creates an {@link java.io.InputStream InputStream} for reading from a
* transport stream.
*/
InputStream createStreamReader(InputStream in, int maxFrameLength,
StreamContext ctx);
InputStream createStreamReader(InputStream in, StreamContext ctx);
/**
* Creates an {@link java.io.InputStream InputStream} for reading from an
* invitation stream.
*/
InputStream createInvitationStreamReader(InputStream in,
int maxFrameLength, byte[] secret, boolean alice);
byte[] secret, boolean alice);
}

View File

@@ -8,13 +8,12 @@ public interface StreamWriterFactory {
* Creates an {@link java.io.OutputStream OutputStream} for writing to a
* transport stream
*/
OutputStream createStreamWriter(OutputStream out, int maxFrameLength,
StreamContext ctx);
OutputStream createStreamWriter(OutputStream out, StreamContext ctx);
/**
* Creates an {@link java.io.OutputStream OutputStream} for writing to an
* invitation stream.
*/
OutputStream createInvitationStreamWriter(OutputStream out,
int maxFrameLength, byte[] secret, boolean alice);
byte[] secret, boolean alice);
}

View File

@@ -6,7 +6,7 @@ public interface TransportConstants {
int TAG_LENGTH = 16;
/** The maximum length of a frame in bytes, including the header and MAC. */
int MAX_FRAME_LENGTH = 32768; // 2^15, 32 KiB
int MAX_FRAME_LENGTH = 1024;
/** The length of the initalisation vector (IV) in bytes. */
int IV_LENGTH = 12;