mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-26 00:15:37 +01:00
Populate TLS <= 1.2 handshake source files
This commit moves generic/client/server handshake handling code from ssl_tls.c, ssl_cli.c and ssl_srv.c to the newly created files ssl_12_gen.c, ssl_12_cli.c and ssl_12_srv.c. No functional changes have been made. Changes are confined to moving, reordering, and commenting the code for ease of reading.
This commit is contained in:
parent
e9a19c062b
commit
bd78add5d9
@ -1101,4 +1101,8 @@ void mbedtls_ssl_buffering_free( mbedtls_ssl_context *ssl );
|
||||
void mbedtls_ssl_flight_free( mbedtls_ssl_flight_item *flight );
|
||||
#endif /* MBEDTLS_SSL_PROTO_DTLS */
|
||||
|
||||
#if defined(MBEDTLS_X509_CRT_PARSE_C)
|
||||
void mbedtls_ssl_clear_peer_cert( mbedtls_ssl_session *session );
|
||||
#endif /* MBEDTLS_X509_CRT_PARSE_C */
|
||||
|
||||
#endif /* ssl_internal.h */
|
||||
|
2098
library/ssl_12_cli.c
2098
library/ssl_12_cli.c
File diff suppressed because it is too large
Load Diff
6817
library/ssl_12_gen.c
6817
library/ssl_12_gen.c
File diff suppressed because it is too large
Load Diff
3311
library/ssl_12_srv.c
3311
library/ssl_12_srv.c
File diff suppressed because it is too large
Load Diff
3983
library/ssl_cli.c
3983
library/ssl_cli.c
File diff suppressed because it is too large
Load Diff
@ -458,6 +458,51 @@ static void ssl_extract_add_data_from_record( unsigned char* add_data,
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(MBEDTLS_SSL_PROTO_SSL3)
|
||||
/*
|
||||
* SSLv3.0 MAC functions
|
||||
*/
|
||||
#define SSL_MAC_MAX_BYTES 20 /* MD-5 or SHA-1 */
|
||||
static void ssl_mac( mbedtls_md_context_t *md_ctx,
|
||||
const unsigned char *secret,
|
||||
const unsigned char *buf, size_t len,
|
||||
const unsigned char *ctr, int type,
|
||||
unsigned char out[SSL_MAC_MAX_BYTES] )
|
||||
{
|
||||
unsigned char header[11];
|
||||
unsigned char padding[48];
|
||||
int padlen;
|
||||
int md_size = mbedtls_md_get_size( md_ctx->md_info );
|
||||
int md_type = mbedtls_md_get_type( md_ctx->md_info );
|
||||
|
||||
/* Only MD5 and SHA-1 supported */
|
||||
if( md_type == MBEDTLS_MD_MD5 )
|
||||
padlen = 48;
|
||||
else
|
||||
padlen = 40;
|
||||
|
||||
memcpy( header, ctr, 8 );
|
||||
header[ 8] = (unsigned char) type;
|
||||
header[ 9] = (unsigned char)( len >> 8 );
|
||||
header[10] = (unsigned char)( len );
|
||||
|
||||
memset( padding, 0x36, padlen );
|
||||
mbedtls_md_starts( md_ctx );
|
||||
mbedtls_md_update( md_ctx, secret, md_size );
|
||||
mbedtls_md_update( md_ctx, padding, padlen );
|
||||
mbedtls_md_update( md_ctx, header, 11 );
|
||||
mbedtls_md_update( md_ctx, buf, len );
|
||||
mbedtls_md_finish( md_ctx, out );
|
||||
|
||||
memset( padding, 0x5C, padlen );
|
||||
mbedtls_md_starts( md_ctx );
|
||||
mbedtls_md_update( md_ctx, secret, md_size );
|
||||
mbedtls_md_update( md_ctx, padding, padlen );
|
||||
mbedtls_md_update( md_ctx, out, md_size );
|
||||
mbedtls_md_finish( md_ctx, out );
|
||||
}
|
||||
#endif /* MBEDTLS_SSL_PROTO_SSL3 */
|
||||
|
||||
int mbedtls_ssl_encrypt_buf( mbedtls_ssl_context *ssl,
|
||||
mbedtls_ssl_transform *transform,
|
||||
mbedtls_record *rec,
|
||||
|
4493
library/ssl_srv.c
4493
library/ssl_srv.c
File diff suppressed because it is too large
Load Diff
1081
library/ssl_tls.c
1081
library/ssl_tls.c
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user