Skip to content

Commit

Permalink
[nrf fromlist] Another fix to the additional data computation
Browse files Browse the repository at this point in the history
Upstream PR: Mbed-TLS/mbedtls#5061

Jira: NCSDK-16493

Signed-off-by: Pete Skeggs <peter.skeggs@nordicsemi.no>
  • Loading branch information
hannestschofenig authored and plskeggs committed Sep 12, 2022
1 parent 059740e commit e6b6eb0
Showing 1 changed file with 16 additions and 24 deletions.
40 changes: 16 additions & 24 deletions library/ssl_msg.c
Original file line number Diff line number Diff line change
Expand Up @@ -539,35 +539,27 @@ static void ssl_extract_add_data_from_record( unsigned char* add_data,
{
((void) minor_ver);

#if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID)
if( rec->cid_len == 0 )
{
memcpy( cur, rec->ctr, sizeof( rec->ctr ) );
cur += sizeof( rec->ctr );
} else
#endif /* MBEDTLS_SSL_DTLS_CONNECTION_ID */
{
memcpy(cur, rec->ctr, sizeof(rec->ctr));
cur += sizeof(rec->ctr);
}
}

#if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID)
if( rec->cid_len != 0 )
{
// seq_num_placeholder
memcpy( cur, seq_num_placeholder, sizeof(seq_num_placeholder) );
cur += sizeof( seq_num_placeholder );

// tls12_cid type
*cur = rec->type;
cur++;
if( rec->cid_len != 0 )
{
// seq_num_placeholder
memcpy(cur, seq_num_placeholder, sizeof(seq_num_placeholder));
cur += sizeof(seq_num_placeholder);

// cid_length
*cur = rec->cid_len;
cur++;
// type
*cur = rec->type;
cur++;

// cid_length
*cur = rec->cid_len;
cur++;
}
#else
memcpy( cur, rec->ctr, sizeof( rec->ctr ) );
cur += sizeof( rec->ctr );
#endif /* MBEDTLS_SSL_DTLS_CONNECTION_ID */

}

// type
Expand Down

0 comments on commit e6b6eb0

Please sign in to comment.