Skip to content

Commit 1e70c67

Browse files
Fix handling of padded TLS fragments in handshake
When multiple handshake messages are sent in a single fragment, there may be some padding (i.e. pkt_size will be larger than the amount of bytes processed). When this happens, the old code would only advance the working pointer to the end of processed data, which would not be the start of the next packet per the sent pkt_size, causing handshake failure. Now simply advance the working pointer to the next packet irrespective of how many bytes in the current one were processed in the server_hello message. Also fix a CI problem introduced when the Arduino core common.sh started checking for a valid defined BUILD_TYPE.
1 parent 0c3a9f7 commit 1e70c67

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

.travis.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,12 @@ script:
3131
- export PATH="$HOME/arduino_ide:$PATH"
3232
- which arduino
3333
- cd $ESP8266_ARDUINO_DIR
34+
# 2.4.2 common.sh errors out if there is no valid build_type set, so ignore error
35+
- sed -i 's/exit 1//' tests/common.sh
3436
- source tests/common.sh
3537
- arduino --board esp8266com:esp8266:generic --save-prefs
3638
- arduino --get-pref sketchbook.path
37-
- build_sketches $HOME/arduino_ide $ESP8266_ARDUINO_DIR/libraries/ESP8266WiFi/examples/HTTPSRequest
39+
- build_sketches $HOME/arduino_ide $ESP8266_ARDUINO_DIR/libraries/ESP8266WiFi/examples/HTTPSRequest "-l $ESP8266_ARDUINO_DIR/libraries" 1 0
3840
# Feel free to add more test cases (for other environments) here
3941

4042
notifications:

ssl/tls1_clnt.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,8 +392,9 @@ static int process_server_hello(SSL *ssl)
392392
}
393393
}
394394

395-
ssl->dc->bm_proc_index = offset;
396-
PARANOIA_CHECK(pkt_size, offset);
395+
ssl->dc->bm_proc_index = pkt_size;
396+
/* This check not always valid w/padding: */
397+
/* PARANOIA_CHECK(pkt_size, offset); */
397398

398399
error:
399400
return ret;

0 commit comments

Comments
 (0)