You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-13 13:31:48 +00:00
mbedtls: Update to upstream version 2.28.2
(cherry picked from commit 6e65244b6b)
This commit is contained in:
44
thirdparty/mbedtls/library/ssl_ticket.c
vendored
44
thirdparty/mbedtls/library/ssl_ticket.c
vendored
@@ -21,13 +21,7 @@
|
||||
|
||||
#if defined(MBEDTLS_SSL_TICKET_C)
|
||||
|
||||
#if defined(MBEDTLS_PLATFORM_C)
|
||||
#include "mbedtls/platform.h"
|
||||
#else
|
||||
#include <stdlib.h>
|
||||
#define mbedtls_calloc calloc
|
||||
#define mbedtls_free free
|
||||
#endif
|
||||
|
||||
#include "mbedtls/ssl_internal.h"
|
||||
#include "mbedtls/ssl_ticket.h"
|
||||
@@ -152,27 +146,45 @@ int mbedtls_ssl_ticket_setup( mbedtls_ssl_ticket_context *ctx,
|
||||
if( cipher_info->key_bitlen > 8 * MAX_KEY_BYTES )
|
||||
return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA );
|
||||
|
||||
int do_mbedtls_cipher_setup = 1;
|
||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||
ret = mbedtls_cipher_setup_psa( &ctx->keys[0].ctx,
|
||||
cipher_info, TICKET_AUTH_TAG_BYTES );
|
||||
if( ret != 0 && ret != MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE )
|
||||
return( ret );
|
||||
/* We don't yet expect to support all ciphers through PSA,
|
||||
* so allow fallback to ordinary mbedtls_cipher_setup(). */
|
||||
if( ret == MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE )
|
||||
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||
if( ( ret = mbedtls_cipher_setup( &ctx->keys[0].ctx, cipher_info ) ) != 0 )
|
||||
return( ret );
|
||||
|
||||
switch( ret )
|
||||
{
|
||||
case 0:
|
||||
do_mbedtls_cipher_setup = 0;
|
||||
break;
|
||||
case MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE:
|
||||
/* We don't yet expect to support all ciphers through PSA,
|
||||
* so allow fallback to ordinary mbedtls_cipher_setup(). */
|
||||
do_mbedtls_cipher_setup = 1;
|
||||
break;
|
||||
default:
|
||||
return( ret );
|
||||
}
|
||||
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||
if( do_mbedtls_cipher_setup )
|
||||
if( ( ret = mbedtls_cipher_setup( &ctx->keys[0].ctx, cipher_info ) )
|
||||
!= 0 )
|
||||
return( ret );
|
||||
|
||||
do_mbedtls_cipher_setup = 1;
|
||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||
do_mbedtls_cipher_setup = 0;
|
||||
|
||||
ret = mbedtls_cipher_setup_psa( &ctx->keys[1].ctx,
|
||||
cipher_info, TICKET_AUTH_TAG_BYTES );
|
||||
if( ret != 0 && ret != MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE )
|
||||
return( ret );
|
||||
if( ret == MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE )
|
||||
do_mbedtls_cipher_setup = 1;
|
||||
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||
if( ( ret = mbedtls_cipher_setup( &ctx->keys[1].ctx, cipher_info ) ) != 0 )
|
||||
return( ret );
|
||||
if( do_mbedtls_cipher_setup )
|
||||
if( ( ret = mbedtls_cipher_setup( &ctx->keys[1].ctx, cipher_info ) )
|
||||
!= 0 )
|
||||
return( ret );
|
||||
|
||||
if( ( ret = ssl_ticket_gen_key( ctx, 0 ) ) != 0 ||
|
||||
( ret = ssl_ticket_gen_key( ctx, 1 ) ) != 0 )
|
||||
|
||||
Reference in New Issue
Block a user