Skip to content

Commit 3182609

Browse files
committed
bugfix in parser
1 parent 3c2debd commit 3182609

File tree

2 files changed

+14
-16
lines changed

2 files changed

+14
-16
lines changed

crates/sdk-core/src/verifier.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ impl SdkVerifier {
108108
}
109109
let verifier_config = builder
110110
.build()
111-
.map_err(|e| SdkError::protocol(e.to_string()))?;
111+
.map_err(|e| SdkError::config(e.to_string()))?;
112112
let verifier = handle
113113
.new_verifier(verifier_config)
114114
.map_err(|e| SdkError::protocol(e.to_string()))?;

crates/tlsn/src/proxy/parser.rs

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -170,25 +170,23 @@ fn parse_app_records(
170170

171171
if let Some(start) = find_ccs(raw_records) {
172172
// Skip the CCS and Finished handshake message by adding 2.
173-
for record in raw_records
174-
.iter()
175-
.skip(start + 2)
176-
.filter(|record| record.hdr.record_type == APP_DATA)
177-
{
173+
for record in raw_records.iter().skip(start + 2) {
178174
let mut record = split_into_record(seq as u64, record.data, &record.hdr.record_type)?;
179175

180-
if let Role::Prover = role {
181-
let cipher_len = record.ciphertext.len();
182-
if app_data[consumed..].len() >= cipher_len {
183-
let plaintext = app_data[consumed..consumed + cipher_len].to_vec();
184-
185-
record.plaintext = Some(plaintext);
186-
consumed += cipher_len;
187-
} else {
188-
return Err(TlsParserError::parse().with_msg("insufficient plaintext data"));
176+
if record.typ == ContentType::ApplicationData {
177+
if let Role::Prover = role {
178+
let cipher_len = record.ciphertext.len();
179+
if app_data[consumed..].len() >= cipher_len {
180+
let plaintext = app_data[consumed..consumed + cipher_len].to_vec();
181+
182+
record.plaintext = Some(plaintext);
183+
consumed += cipher_len;
184+
} else {
185+
return Err(TlsParserError::parse().with_msg("insufficient plaintext data"));
186+
}
189187
}
188+
parsed_app_records.push(record);
190189
}
191-
parsed_app_records.push(record);
192190
seq += 1;
193191
}
194192
}

0 commit comments

Comments
 (0)