mirror of
				https://github.com/cuberite/polarssl.git
				synced 2025-11-03 20:22:59 -05:00 
			
		
		
		
	fix wrong version header for tls1.3
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
This commit is contained in:
		
							parent
							
								
									4313d3ac87
								
							
						
					
					
						commit
						47413c2c8f
					
				@ -2560,8 +2560,14 @@ int mbedtls_ssl_write_record( mbedtls_ssl_context *ssl, uint8_t force_flush )
 | 
				
			|||||||
#endif
 | 
					#endif
 | 
				
			||||||
        /* Skip writing the record content type to after the encryption,
 | 
					        /* Skip writing the record content type to after the encryption,
 | 
				
			||||||
         * as it may change when using the CID extension. */
 | 
					         * as it may change when using the CID extension. */
 | 
				
			||||||
 | 
					        int minor_ver = ssl->minor_ver;
 | 
				
			||||||
        mbedtls_ssl_write_version( ssl->major_ver, ssl->minor_ver,
 | 
					#if defined(MBEDTLS_SSL_PROTO_TLS1_3_EXPERIMENTAL)
 | 
				
			||||||
 | 
					        /* TLS 1.3 still uses the TLS 1.3 version identifier
 | 
				
			||||||
 | 
					        * for backwards compatibility. */
 | 
				
			||||||
 | 
					        if( minor_ver == MBEDTLS_SSL_MINOR_VERSION_4 )
 | 
				
			||||||
 | 
					            minor_ver = MBEDTLS_SSL_MINOR_VERSION_3;
 | 
				
			||||||
 | 
					#endif /* MBEDTLS_SSL_PROTO_TLS1_3_EXPERIMENTAL */
 | 
				
			||||||
 | 
					        mbedtls_ssl_write_version( ssl->major_ver, minor_ver,
 | 
				
			||||||
                                   ssl->conf->transport, ssl->out_hdr + 1 );
 | 
					                                   ssl->conf->transport, ssl->out_hdr + 1 );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        memcpy( ssl->out_ctr, ssl->cur_out_ctr, MBEDTLS_SSL_SEQUENCE_NUMBER_LEN );
 | 
					        memcpy( ssl->out_ctr, ssl->cur_out_ctr, MBEDTLS_SSL_SEQUENCE_NUMBER_LEN );
 | 
				
			||||||
@ -2577,7 +2583,7 @@ int mbedtls_ssl_write_record( mbedtls_ssl_context *ssl, uint8_t force_flush )
 | 
				
			|||||||
            rec.data_offset = ssl->out_msg - rec.buf;
 | 
					            rec.data_offset = ssl->out_msg - rec.buf;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            memcpy( &rec.ctr[0], ssl->out_ctr, sizeof( rec.ctr ) );
 | 
					            memcpy( &rec.ctr[0], ssl->out_ctr, sizeof( rec.ctr ) );
 | 
				
			||||||
            mbedtls_ssl_write_version( ssl->major_ver, ssl->minor_ver,
 | 
					            mbedtls_ssl_write_version( ssl->major_ver, minor_ver,
 | 
				
			||||||
                                       ssl->conf->transport, rec.ver );
 | 
					                                       ssl->conf->transport, rec.ver );
 | 
				
			||||||
            rec.type = ssl->out_msgtype;
 | 
					            rec.type = ssl->out_msgtype;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -5619,6 +5625,7 @@ static void ssl_buffering_free_slot( mbedtls_ssl_context *ssl,
 | 
				
			|||||||
void mbedtls_ssl_write_version( int major, int minor, int transport,
 | 
					void mbedtls_ssl_write_version( int major, int minor, int transport,
 | 
				
			||||||
                        unsigned char ver[2] )
 | 
					                        unsigned char ver[2] )
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined(MBEDTLS_SSL_PROTO_DTLS)
 | 
					#if defined(MBEDTLS_SSL_PROTO_DTLS)
 | 
				
			||||||
    if( transport == MBEDTLS_SSL_TRANSPORT_DATAGRAM )
 | 
					    if( transport == MBEDTLS_SSL_TRANSPORT_DATAGRAM )
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user