Skip to content

Commit f79101f

Browse files
author
jan
committed
Added SupplementalDataEntryParserTest
1 parent aca233f commit f79101f

File tree

4 files changed

+14
-10
lines changed

4 files changed

+14
-10
lines changed

TLS-Core/src/main/java/de/rub/nds/tlsattacker/core/constants/HandshakeByteLength.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ public class HandshakeByteLength {
220220
* Length of the Supplemental Data Field
221221
*/
222222
public static final int SUPPLEMENTAL_DATA_LENGTH = 3;
223-
223+
224224
/**
225225
* Length of the Supplemental Data Entry Type
226226
*/

TLS-Core/src/main/java/de/rub/nds/tlsattacker/core/protocol/message/suppData/SupplementalDataEntry.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ public void setSupplementalDataEntry(ModifiableByteArray supplementalDataEntry)
3737
}
3838

3939
public void setSupplementalDataEntry(byte[] supplementalDataEntry) {
40-
this.supplementalDataEntry = ModifiableVariableFactory.safelySetValue(this.supplementalDataEntry, supplementalDataEntry);
40+
this.supplementalDataEntry = ModifiableVariableFactory.safelySetValue(this.supplementalDataEntry,
41+
supplementalDataEntry);
4142
}
4243

4344
public ModifiableInteger getSupplementalDataEntryType() {

TLS-Core/src/main/java/de/rub/nds/tlsattacker/core/protocol/parser/SupplementalDataParser.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,19 @@ private void parseSupplementalDataLength(SupplementalDataMessage msg) {
5757
msg.setSupplementalDataLength(parseIntField(HandshakeByteLength.SUPPLEMENTAL_DATA_LENGTH));
5858
LOGGER.debug("SupplementalDataLength: " + msg.getSupplementalDataLength().getValue());
5959
}
60-
60+
6161
private void parseSupplementalDataBytes(SupplementalDataMessage msg) {
6262
msg.setSupplementalDataBytes(parseByteArrayField(msg.getSupplementalDataLength().getValue()));
63-
LOGGER.debug("SupplementalDataBytes: " + ArrayConverter.bytesToHexString(msg.getSupplementalDataBytes().getValue()));
63+
LOGGER.debug("SupplementalDataBytes: "
64+
+ ArrayConverter.bytesToHexString(msg.getSupplementalDataBytes().getValue()));
6465
}
6566

6667
private void parseSupplementalDataEntries(SupplementalDataMessage msg) {
6768
int pointer = 0;
6869
List<SupplementalDataEntry> entryList = new LinkedList<>();
6970
while (pointer < msg.getSupplementalDataLength().getValue()) {
70-
SupplementalDataEntryParser parser = new SupplementalDataEntryParser(pointer, msg.getSupplementalDataBytes().getValue());
71+
SupplementalDataEntryParser parser = new SupplementalDataEntryParser(pointer, msg
72+
.getSupplementalDataBytes().getValue());
7173
entryList.add(parser.parse());
7274
if (pointer == parser.getPointer()) {
7375
throw new ParserException("Ran into infinite Loop while parsing SupplementalDataEntries");

TLS-Core/src/main/java/de/rub/nds/tlsattacker/core/protocol/parser/suppData/SupplementalDataEntryParser.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,22 @@ public SupplementalDataEntry parse() {
2424
LOGGER.debug("Parsing SupplementalDataEntry");
2525
SupplementalDataEntry entry = new SupplementalDataEntry();
2626
parseSupplementalDataEntryType(entry);
27-
parseSupplementalDataEntryLength(entry);
27+
parseSupplementalDataEntryLength(entry);
28+
parseSupplementalDataEntry(entry);
2829
return entry;
2930
}
30-
31+
3132
private void parseSupplementalDataEntryType(SupplementalDataEntry entry) {
3233
entry.setSupplementalDataEntryType(parseIntField(HandshakeByteLength.SUPPLEMENTAL_DATA_ENTRY_TYPE_LENGTH));
3334
LOGGER.debug("SupplementalDataEntryType: " + entry.getSupplementalDataEntryType().getValue());
3435
}
35-
36+
3637
private void parseSupplementalDataEntryLength(SupplementalDataEntry entry) {
3738
entry.setSupplementalDataEntryLength(parseIntField(HandshakeByteLength.SUPPLEMENTAL_DATA_ENTRY_LENGTH));
3839
LOGGER.debug("SupplementalDataEntryLength: " + entry.getSupplementalDataEntryLength().getValue());
3940
}
40-
41-
private void parseSupplementalDataEntryBytes(SupplementalDataEntry entry) {
41+
42+
private void parseSupplementalDataEntry(SupplementalDataEntry entry) {
4243
entry.setSupplementalDataEntry(parseByteArrayField(entry.getSupplementalDataEntryLength().getValue()));
4344
LOGGER.debug("SupplementalDataEntry: " + ArrayConverter.bytesToHexString(entry.getSupplementalDataEntry().getValue()));
4445
}

0 commit comments

Comments
 (0)