Skip to content

Commit 5776d0a

Browse files
committed
Formatting pass, decide whether to keep or skip before merging
1 parent 382f56d commit 5776d0a

16 files changed

+64
-54
lines changed

src/main/java/se/uu/it/dtlsfuzzer/components/sul/mapper/TlsExecutionContext.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,10 @@ protected TlsStepContext buildStepContext() {
133133
}
134134

135135
/*
136-
public Long incrementWriteRecordNumberEpoch0() {
137-
Long old = writeRecordNumberEpoch0;
138-
writeRecordNumberEpoch0++;
139-
return old;
140-
}
141-
*/
136+
* public Long incrementWriteRecordNumberEpoch0() {
137+
* Long old = writeRecordNumberEpoch0;
138+
* writeRecordNumberEpoch0++;
139+
* return old;
140+
* }
141+
*/
142142
}

src/main/java/se/uu/it/dtlsfuzzer/components/sul/mapper/TlsStepContext.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ public List<ProtocolMessage> getReceivedMessages() {
6060
return receivedMessages;
6161
}
6262

63-
6463
public List<ProtocolMessage> getSentMessages() {
6564
return sentMessages;
6665
}
@@ -86,9 +85,10 @@ public TlsInput getInput() {
8685
return (TlsInput) input;
8786
}
8887

89-
public List<Pair<ProtocolMessage, Record>> getReceivedMessageRecordPairs() {
88+
public List<Pair<ProtocolMessage, Record>> getReceivedMessageRecordPairs() {
9089
assert receivedRecords.size() == receivedMessages.size();
91-
return IntStream.range(0, receivedMessages.size()).boxed().map(i ->
92-
Pair.<ProtocolMessage, Record>of(receivedMessages.get(i), receivedRecords.get(i))).collect(Collectors.toList());
90+
return IntStream.range(0, receivedMessages.size()).boxed()
91+
.map(i -> Pair.<ProtocolMessage, Record>of(receivedMessages.get(i), receivedRecords.get(i)))
92+
.collect(Collectors.toList());
9393
}
9494
}

src/main/java/se/uu/it/dtlsfuzzer/components/sul/mapper/symbols/inputs/AlertInput.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public AlertInput() {
2222
@Override
2323
public TlsProtocolMessage generateProtocolMessage(TlsExecutionContext context) {
2424
AlertMessage alert = new AlertMessage();
25-
alert.setConfig(new byte [] {level.getValue(), description.getValue()});
25+
alert.setConfig(new byte[] { level.getValue(), description.getValue() });
2626
return new TlsProtocolMessage(alert);
2727
}
2828

src/main/java/se/uu/it/dtlsfuzzer/components/sul/mapper/symbols/inputs/CertificateInput.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
public class CertificateInput extends DtlsInput {
1010

11-
@XmlAttribute(name="empty", required=false)
11+
@XmlAttribute(name = "empty", required = false)
1212
private boolean empty = false;
1313

1414
public CertificateInput() {

src/main/java/se/uu/it/dtlsfuzzer/components/sul/mapper/symbols/inputs/CertificateRequestInput.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
public class CertificateRequestInput extends DtlsInput {
1212

13-
@XmlAttribute(name="certificate", required=true)
13+
@XmlAttribute(name = "certificate", required = true)
1414
ClientCertificateType certificateType;
1515

1616
public CertificateRequestInput() {
@@ -27,7 +27,8 @@ public TlsProtocolMessage generateProtocolMessage(TlsExecutionContext context) {
2727
CertificateRequestMessage message = new CertificateRequestMessage();
2828
if (certificateType != null) {
2929
ModifiableByteArray ctbyte = new ModifiableByteArray();
30-
ctbyte.setModification(ByteArrayModificationFactory.explicitValue(new byte[] {certificateType.getValue()}));
30+
ctbyte.setModification(
31+
ByteArrayModificationFactory.explicitValue(new byte[] { certificateType.getValue() }));
3132
message.setClientCertificateTypes(ctbyte);
3233
}
3334
return new TlsProtocolMessage(message);

src/main/java/se/uu/it/dtlsfuzzer/components/sul/mapper/symbols/inputs/ChangeCipherSpecInput.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,11 @@ public TlsProtocolMessage generateProtocolMessage(TlsExecutionContext context) {
3232

3333
@Override
3434
public void postSendDtlsUpdate(TlsExecutionContext context) {
35-
// TLS-Attacker instantiates non-null ciphers even when the pre-master secret has not been yet negotiated.
35+
// TLS-Attacker instantiates non-null ciphers even when the pre-master secret
36+
// has not been yet negotiated.
3637
// Here, we replace the ciphers instantiated in such cases by null ciphers.
37-
// This ensures that encrypted messages are more likely to make sense to the SUT.
38+
// This ensures that encrypted messages are more likely to make sense to the
39+
// SUT.
3840
if (getTlsContext(context).getPreMasterSecret() == null) {
3941
makeNullCipherAsMostRecent(getTlsContext(context).getRecordLayer().getEncryptor(), getTlsContext(context));
4042
makeNullCipherAsMostRecent(getTlsContext(context).getRecordLayer().getDecryptor(), getTlsContext(context));
@@ -43,7 +45,7 @@ public void postSendDtlsUpdate(TlsExecutionContext context) {
4345

4446
private void makeNullCipherAsMostRecent(RecordCryptoUnit cryptoUnit, TlsContext context) {
4547
RecordCipher cipher = cryptoUnit.getRecordMostRecentCipher();
46-
if (! (cipher instanceof RecordNullCipher)) {
48+
if (!(cipher instanceof RecordNullCipher)) {
4749
cryptoUnit.removeCiphers(1);
4850
CipherState cipherState = cipher.getState();
4951
cryptoUnit.addNewRecordCipher(new RecordNullCipher(context, cipherState));

src/main/java/se/uu/it/dtlsfuzzer/components/sul/mapper/symbols/inputs/ClientHelloInput.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ public void postSendDtlsUpdate(State state, TlsExecutionContext context) {
8484
// to work also with 1-CH DTLS handshakes.
8585
// (in which case, the clienthello is digested)
8686
if (forceDigest && state.getTlsContext().getDigest().getRawBytes().length == 0) {
87-
DtlsHandshakeMessageFragment fragment = state.getTlsContext().getDtlsFragmentLayer().wrapInSingleFragment(state.getTlsContext().getContext(), message, true);
87+
DtlsHandshakeMessageFragment fragment = state.getTlsContext().getDtlsFragmentLayer()
88+
.wrapInSingleFragment(state.getTlsContext().getContext(), message, true);
8889
state.getTlsContext().getDigest().append(fragment.getCompleteResultingMessage().getValue());
8990
}
9091
}

src/main/java/se/uu/it/dtlsfuzzer/components/sul/mapper/symbols/inputs/ClientHelloRenegotiationInput.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,18 @@ public ClientHelloRenegotiationInput() {
3939
@Override
4040
public boolean isEnabled(TlsExecutionContext context) {
4141
switch (enabled) {
42-
case OWN_EPOCH_CHANGE :
42+
case OWN_EPOCH_CHANGE:
4343
// send epoch is 1 or more
4444
return getTlsContext(context).getWriteEpoch() > 0;
45-
case SERVER_EPOCH_CHANGE :
45+
case SERVER_EPOCH_CHANGE:
4646
// receive epoch is 1 or more
4747
return getTlsContext(context).getReadEpoch() > 0;
48-
case ONCE :
48+
case ONCE:
4949
return getTlsExecutionContext(context)
5050
.getTlsStepContextStream()
51-
.noneMatch(s -> this.equals(s.getInput()) && s.getIndex() != getTlsExecutionContext(context).getStepCount() - 1);
52-
default :
51+
.noneMatch(s -> this.equals(s.getInput())
52+
&& s.getIndex() != getTlsExecutionContext(context).getStepCount() - 1);
53+
default:
5354
return true;
5455
}
5556
}
@@ -68,15 +69,15 @@ public TlsProtocolMessage generateProtocolMessage(TlsExecutionContext context) {
6869
if (!isShort) {
6970
ModifiableByteArray sbyte = new ModifiableByteArray();
7071
sbyte.setModification(new ByteArrayExplicitValueModification(
71-
new byte[]{}));
72+
new byte[] {}));
7273
message.setSessionId(sbyte);
7374
}
7475

7576
// mbedtls will only engage in renegotiation if the cookie is empty
7677
if (!withCookie && getTlsContext(context).getDtlsCookie() != null) {
7778
ModifiableByteArray sbyte = new ModifiableByteArray();
7879
sbyte.setModification(new ByteArrayExplicitValueModification(
79-
new byte[]{}));
80+
new byte[] {}));
8081
message.setCookie(sbyte);
8182
}
8283

@@ -87,12 +88,12 @@ public TlsProtocolMessage generateProtocolMessage(TlsExecutionContext context) {
8788
public void postReceiveUpdate(TlsOutput output, OutputChecker<TlsOutput> abstractOutputChecker,
8889
TlsExecutionContext context) {
8990
switch (enabled) {
90-
case ON_SERVER_HELLO :
91+
case ON_SERVER_HELLO:
9192
if (!TlsOutputChecker.hasServerHello(output)) {
9293
getTlsExecutionContext(context).disableExecution();
9394
}
9495
break;
95-
default :
96+
default:
9697
break;
9798
}
9899
super.postReceiveUpdate(output, abstractOutputChecker, context);

src/main/java/se/uu/it/dtlsfuzzer/components/sul/mapper/symbols/inputs/ClientKeyExchangeInput.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,28 +38,28 @@ public TlsProtocolMessage generateProtocolMessage(TlsExecutionContext context) {
3838
throw new RuntimeException("Algorithm not set");
3939
}
4040
switch (algorithm) {
41-
case RSA :
41+
case RSA:
4242
message = new RSAClientKeyExchangeMessage();
4343
break;
44-
case PSK :
44+
case PSK:
4545
message = new PskClientKeyExchangeMessage();
4646
break;
47-
case DH :
47+
case DH:
4848
message = new DHClientKeyExchangeMessage();
4949
break;
50-
case ECDH :
50+
case ECDH:
5151
message = new ECDHClientKeyExchangeMessage();
5252
break;
53-
case PSK_RSA :
53+
case PSK_RSA:
5454
message = new PskRsaClientKeyExchangeMessage();
5555
break;
56-
case GOST :
56+
case GOST:
5757
message = new GOSTClientKeyExchangeMessage();
5858
break;
59-
case SRP :
59+
case SRP:
6060
message = new SrpClientKeyExchangeMessage();
6161
break;
62-
default :
62+
default:
6363
throw new RuntimeException("Algorithm " + algorithm
6464
+ " not supported");
6565

src/main/java/se/uu/it/dtlsfuzzer/components/sul/mapper/symbols/inputs/DtlsInputWrapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import se.uu.it.dtlsfuzzer.components.sul.mapper.TlsProtocolMessage;
66
import se.uu.it.dtlsfuzzer.components.sul.mapper.symbols.outputs.TlsOutput;
77

8-
public class DtlsInputWrapper extends DtlsInput{
8+
public class DtlsInputWrapper extends DtlsInput {
99
private DtlsInput input;
1010

1111
public DtlsInputWrapper(DtlsInput input) {

0 commit comments

Comments
 (0)