mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-03-24 22:15:07 +00:00
Merge remote-tracking branch 'origin/pr/619' into baremetal
This commit is contained in:
commit
7c1380d9d4
|
@ -1317,7 +1317,6 @@ struct mbedtls_ssl_context
|
||||||
* (the end is marked by in_len). */
|
* (the end is marked by in_len). */
|
||||||
#endif /* MBEDTLS_SSL_DTLS_CONNECTION_ID */
|
#endif /* MBEDTLS_SSL_DTLS_CONNECTION_ID */
|
||||||
unsigned char *in_len; /*!< two-bytes message length field */
|
unsigned char *in_len; /*!< two-bytes message length field */
|
||||||
unsigned char *in_iv; /*!< ivlen-byte IV */
|
|
||||||
unsigned char *in_msg; /*!< message contents (in_iv+ivlen) */
|
unsigned char *in_msg; /*!< message contents (in_iv+ivlen) */
|
||||||
unsigned char *in_offt; /*!< read offset in application data */
|
unsigned char *in_offt; /*!< read offset in application data */
|
||||||
|
|
||||||
|
|
|
@ -789,18 +789,29 @@ static inline int mbedtls_ssl_transform_uses_aead(
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
uint8_t ctr[8]; /* Record sequence number */
|
uint8_t ctr[8]; /* In TLS: The implicit record sequence number.
|
||||||
uint8_t type; /* Record type */
|
* In DTLS: The 2-byte epoch followed by
|
||||||
uint8_t ver[2]; /* SSL/TLS version */
|
* the 6-byte sequence number.
|
||||||
|
* This is stored as a raw big endian byte array
|
||||||
|
* as opposed to a uint64_t because we rarely
|
||||||
|
* need to perform arithmetic on this, but do
|
||||||
|
* need it as a Byte array for the purpose of
|
||||||
|
* MAC computations. */
|
||||||
|
uint8_t type; /* The record content type. */
|
||||||
|
uint8_t ver[2]; /* SSL/TLS version as present on the wire.
|
||||||
|
* Convert to internal presentation of versions
|
||||||
|
* using mbedtls_ssl_read_version() and
|
||||||
|
* mbedtls_ssl_write_version().
|
||||||
|
* Keep wire-format for MAC computations. */
|
||||||
|
|
||||||
unsigned char *buf; /* Memory buffer enclosing the record content */
|
unsigned char *buf; /* Memory buffer enclosing the record content */
|
||||||
size_t buf_len; /* Buffer length */
|
size_t buf_len; /* Buffer length */
|
||||||
size_t data_offset; /* Offset of record content */
|
size_t data_offset; /* Offset of record content */
|
||||||
size_t data_len; /* Length of record content */
|
size_t data_len; /* Length of record content */
|
||||||
|
|
||||||
#if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID)
|
#if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID)
|
||||||
uint8_t cid_len; /* Length of the CID (0 if not present) */
|
uint8_t cid_len; /* Length of the CID (0 if not present) */
|
||||||
unsigned char cid[ MBEDTLS_SSL_CID_LEN_MAX ]; /* The CID */
|
unsigned char cid[ MBEDTLS_SSL_CID_LEN_MAX ]; /* The CID */
|
||||||
#endif /* MBEDTLS_SSL_DTLS_CONNECTION_ID */
|
#endif /* MBEDTLS_SSL_DTLS_CONNECTION_ID */
|
||||||
} mbedtls_record;
|
} mbedtls_record;
|
||||||
|
|
||||||
|
@ -1062,7 +1073,22 @@ int mbedtls_ssl_check_cert_usage( const mbedtls_x509_crt *cert,
|
||||||
|
|
||||||
static inline size_t mbedtls_ssl_in_hdr_len( const mbedtls_ssl_context *ssl )
|
static inline size_t mbedtls_ssl_in_hdr_len( const mbedtls_ssl_context *ssl )
|
||||||
{
|
{
|
||||||
return( (size_t) ( ssl->in_iv - ssl->in_hdr ) );
|
#if !defined(MBEDTLS_SSL_PROTO__BOTH)
|
||||||
|
((void) ssl);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_SSL_PROTO_DTLS)
|
||||||
|
if( MBEDTLS_SSL_TRANSPORT_IS_DTLS( ssl->conf->transport ) )
|
||||||
|
{
|
||||||
|
return( 13 );
|
||||||
|
}
|
||||||
|
MBEDTLS_SSL_TRANSPORT_ELSE
|
||||||
|
#endif /* MBEDTLS_SSL_PROTO_DTLS */
|
||||||
|
#if defined(MBEDTLS_SSL_PROTO_TLS)
|
||||||
|
{
|
||||||
|
return( 5 );
|
||||||
|
}
|
||||||
|
#endif /* MBEDTLS_SSL_PROTO_TLS */
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline size_t mbedtls_ssl_out_hdr_len( const mbedtls_ssl_context *ssl )
|
static inline size_t mbedtls_ssl_out_hdr_len( const mbedtls_ssl_context *ssl )
|
||||||
|
@ -1095,7 +1121,7 @@ int mbedtls_ssl_flight_transmit( mbedtls_ssl_context *ssl );
|
||||||
|
|
||||||
/* Visible for testing purposes only */
|
/* Visible for testing purposes only */
|
||||||
#if defined(MBEDTLS_SSL_DTLS_ANTI_REPLAY)
|
#if defined(MBEDTLS_SSL_DTLS_ANTI_REPLAY)
|
||||||
int mbedtls_ssl_dtls_replay_check( mbedtls_ssl_context *ssl );
|
int mbedtls_ssl_dtls_replay_check( mbedtls_ssl_context const *ssl );
|
||||||
void mbedtls_ssl_dtls_replay_update( mbedtls_ssl_context *ssl );
|
void mbedtls_ssl_dtls_replay_update( mbedtls_ssl_context *ssl );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1212,7 +1238,7 @@ int mbedtls_ssl_encrypt_buf( mbedtls_ssl_context *ssl,
|
||||||
mbedtls_record *rec,
|
mbedtls_record *rec,
|
||||||
int (*f_rng)(void *, unsigned char *, size_t),
|
int (*f_rng)(void *, unsigned char *, size_t),
|
||||||
void *p_rng );
|
void *p_rng );
|
||||||
int mbedtls_ssl_decrypt_buf( mbedtls_ssl_context *ssl,
|
int mbedtls_ssl_decrypt_buf( mbedtls_ssl_context const *ssl,
|
||||||
mbedtls_ssl_transform *transform,
|
mbedtls_ssl_transform *transform,
|
||||||
mbedtls_record *rec );
|
mbedtls_record *rec );
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -97,6 +97,7 @@
|
||||||
#include "mbedtls/timing.h"
|
#include "mbedtls/timing.h"
|
||||||
#include "mbedtls/version.h"
|
#include "mbedtls/version.h"
|
||||||
#include "mbedtls/x509.h"
|
#include "mbedtls/x509.h"
|
||||||
|
#include "mbedtls/x509_internal.h"
|
||||||
#include "mbedtls/x509_crl.h"
|
#include "mbedtls/x509_crl.h"
|
||||||
#include "mbedtls/x509_crt.h"
|
#include "mbedtls/x509_crt.h"
|
||||||
#include "mbedtls/x509_csr.h"
|
#include "mbedtls/x509_csr.h"
|
||||||
|
|
|
@ -7872,8 +7872,10 @@ run_test "DTLS proxy: reference" \
|
||||||
0 \
|
0 \
|
||||||
-C "replayed record" \
|
-C "replayed record" \
|
||||||
-S "replayed record" \
|
-S "replayed record" \
|
||||||
-C "record from another epoch" \
|
-C "Buffer record from epoch" \
|
||||||
-S "record from another epoch" \
|
-S "Buffer record from epoch" \
|
||||||
|
-C "ssl_buffer_message" \
|
||||||
|
-S "ssl_buffer_message" \
|
||||||
-C "discarding invalid record" \
|
-C "discarding invalid record" \
|
||||||
-S "discarding invalid record" \
|
-S "discarding invalid record" \
|
||||||
-S "resend" \
|
-S "resend" \
|
||||||
|
|
Loading…
Reference in a new issue