mirror of
https://github.com/vlang/v.git
synced 2025-09-14 23:12:33 +03:00
thirdparty,net.mbedtls: update mbedtls
to latest compatible version v3.3.0 (#21118)
This commit is contained in:
parent
cb402a3340
commit
64a336932c
156 changed files with 16293 additions and 4396 deletions
31
thirdparty/mbedtls/library/poly1305.c
vendored
31
thirdparty/mbedtls/library/poly1305.c
vendored
|
@ -28,28 +28,10 @@
|
|||
|
||||
#include <string.h>
|
||||
|
||||
#if defined(MBEDTLS_SELF_TEST)
|
||||
#if defined(MBEDTLS_PLATFORM_C)
|
||||
#include "mbedtls/platform.h"
|
||||
#else
|
||||
#include <stdio.h>
|
||||
#define mbedtls_printf printf
|
||||
#endif /* MBEDTLS_PLATFORM_C */
|
||||
#endif /* MBEDTLS_SELF_TEST */
|
||||
|
||||
#if !defined(MBEDTLS_POLY1305_ALT)
|
||||
|
||||
#if ( defined(__ARMCC_VERSION) || defined(_MSC_VER) ) && \
|
||||
!defined(inline) && !defined(__cplusplus)
|
||||
#define inline __inline
|
||||
#endif
|
||||
|
||||
/* Parameter validation macros */
|
||||
#define POLY1305_VALIDATE_RET( cond ) \
|
||||
MBEDTLS_INTERNAL_VALIDATE_RET( cond, MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA )
|
||||
#define POLY1305_VALIDATE( cond ) \
|
||||
MBEDTLS_INTERNAL_VALIDATE( cond )
|
||||
|
||||
#define POLY1305_BLOCK_SIZE_BYTES ( 16U )
|
||||
|
||||
/*
|
||||
|
@ -258,8 +240,6 @@ static void poly1305_compute_mac( const mbedtls_poly1305_context *ctx,
|
|||
|
||||
void mbedtls_poly1305_init( mbedtls_poly1305_context *ctx )
|
||||
{
|
||||
POLY1305_VALIDATE( ctx != NULL );
|
||||
|
||||
mbedtls_platform_zeroize( ctx, sizeof( mbedtls_poly1305_context ) );
|
||||
}
|
||||
|
||||
|
@ -274,9 +254,6 @@ void mbedtls_poly1305_free( mbedtls_poly1305_context *ctx )
|
|||
int mbedtls_poly1305_starts( mbedtls_poly1305_context *ctx,
|
||||
const unsigned char key[32] )
|
||||
{
|
||||
POLY1305_VALIDATE_RET( ctx != NULL );
|
||||
POLY1305_VALIDATE_RET( key != NULL );
|
||||
|
||||
/* r &= 0x0ffffffc0ffffffc0ffffffc0fffffff */
|
||||
ctx->r[0] = MBEDTLS_GET_UINT32_LE( key, 0 ) & 0x0FFFFFFFU;
|
||||
ctx->r[1] = MBEDTLS_GET_UINT32_LE( key, 4 ) & 0x0FFFFFFCU;
|
||||
|
@ -310,8 +287,6 @@ int mbedtls_poly1305_update( mbedtls_poly1305_context *ctx,
|
|||
size_t remaining = ilen;
|
||||
size_t queue_free_len;
|
||||
size_t nblocks;
|
||||
POLY1305_VALIDATE_RET( ctx != NULL );
|
||||
POLY1305_VALIDATE_RET( ilen == 0 || input != NULL );
|
||||
|
||||
if( ( remaining > 0U ) && ( ctx->queue_len > 0U ) )
|
||||
{
|
||||
|
@ -369,9 +344,6 @@ int mbedtls_poly1305_update( mbedtls_poly1305_context *ctx,
|
|||
int mbedtls_poly1305_finish( mbedtls_poly1305_context *ctx,
|
||||
unsigned char mac[16] )
|
||||
{
|
||||
POLY1305_VALIDATE_RET( ctx != NULL );
|
||||
POLY1305_VALIDATE_RET( mac != NULL );
|
||||
|
||||
/* Process any leftover data */
|
||||
if( ctx->queue_len > 0U )
|
||||
{
|
||||
|
@ -400,9 +372,6 @@ int mbedtls_poly1305_mac( const unsigned char key[32],
|
|||
{
|
||||
mbedtls_poly1305_context ctx;
|
||||
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
||||
POLY1305_VALIDATE_RET( key != NULL );
|
||||
POLY1305_VALIDATE_RET( mac != NULL );
|
||||
POLY1305_VALIDATE_RET( ilen == 0 || input != NULL );
|
||||
|
||||
mbedtls_poly1305_init( &ctx );
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue