libtls: Allow tls_aead_t to change the content type
The actual content type is encrypted with TLS 1.3, the type in the record header is always Application Data.
This commit is contained in:
@@ -55,13 +55,13 @@ typedef struct __attribute__((__packed__)) {
|
||||
|
||||
METHOD(tls_aead_t, encrypt, bool,
|
||||
private_tls_aead_t *this, tls_version_t version,
|
||||
tls_content_type_t type, uint64_t seq, chunk_t *data)
|
||||
tls_content_type_t *type, uint64_t seq, chunk_t *data)
|
||||
{
|
||||
chunk_t assoc, mac, padding;
|
||||
uint8_t bs, padlen;
|
||||
sigheader_t hdr;
|
||||
|
||||
hdr.type = type;
|
||||
hdr.type = *type;
|
||||
htoun64(&hdr.seq, seq);
|
||||
htoun16(&hdr.version, version);
|
||||
htoun16(&hdr.length, data->len);
|
||||
@@ -95,7 +95,7 @@ METHOD(tls_aead_t, encrypt, bool,
|
||||
|
||||
METHOD(tls_aead_t, decrypt, bool,
|
||||
private_tls_aead_t *this, tls_version_t version,
|
||||
tls_content_type_t type, uint64_t seq, chunk_t *data)
|
||||
tls_content_type_t *type, uint64_t seq, chunk_t *data)
|
||||
{
|
||||
chunk_t assoc, mac, iv;
|
||||
uint8_t bs, padlen;
|
||||
@@ -135,7 +135,7 @@ METHOD(tls_aead_t, decrypt, bool,
|
||||
mac = chunk_skip(*data, data->len - bs);
|
||||
data->len -= bs;
|
||||
|
||||
hdr.type = type;
|
||||
hdr.type = *type;
|
||||
htoun64(&hdr.seq, seq);
|
||||
htoun16(&hdr.version, version);
|
||||
htoun16(&hdr.length, data->len);
|
||||
|
||||
Reference in New Issue
Block a user