mirror of
https://github.com/vlang/v.git
synced 2025-09-15 07:22:27 +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
15
thirdparty/mbedtls/library/psa_crypto_rsa.c
vendored
15
thirdparty/mbedtls/library/psa_crypto_rsa.c
vendored
|
@ -32,15 +32,12 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "mbedtls/platform.h"
|
||||
#if !defined(MBEDTLS_PLATFORM_C)
|
||||
#define mbedtls_calloc calloc
|
||||
#define mbedtls_free free
|
||||
#endif
|
||||
|
||||
#include <mbedtls/rsa.h>
|
||||
#include <mbedtls/error.h>
|
||||
#include <mbedtls/pk.h>
|
||||
#include "pk_wrap.h"
|
||||
#include "hash_info.h"
|
||||
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_RSA_PKCS1V15_CRYPT) || \
|
||||
defined(MBEDTLS_PSA_BUILTIN_ALG_RSA_OAEP) || \
|
||||
|
@ -326,8 +323,7 @@ static psa_status_t psa_rsa_decode_md_type( psa_algorithm_t alg,
|
|||
mbedtls_md_type_t *md_alg )
|
||||
{
|
||||
psa_algorithm_t hash_alg = PSA_ALG_SIGN_GET_HASH( alg );
|
||||
const mbedtls_md_info_t *md_info = mbedtls_md_info_from_psa( hash_alg );
|
||||
*md_alg = mbedtls_md_get_type( md_info );
|
||||
*md_alg = mbedtls_hash_info_md_from_psa( hash_alg );
|
||||
|
||||
/* The Mbed TLS RSA module uses an unsigned int for hash length
|
||||
* parameters. Validate that it fits so that we don't risk an
|
||||
|
@ -340,9 +336,9 @@ static psa_status_t psa_rsa_decode_md_type( psa_algorithm_t alg,
|
|||
/* For signatures using a hash, the hash length must be correct. */
|
||||
if( alg != PSA_ALG_RSA_PKCS1V15_SIGN_RAW )
|
||||
{
|
||||
if( md_info == NULL )
|
||||
if( *md_alg == MBEDTLS_MD_NONE )
|
||||
return( PSA_ERROR_NOT_SUPPORTED );
|
||||
if( mbedtls_md_get_size( md_info ) != hash_length )
|
||||
if( mbedtls_hash_info_get_size( *md_alg ) != hash_length )
|
||||
return( PSA_ERROR_INVALID_ARGUMENT );
|
||||
}
|
||||
|
||||
|
@ -543,8 +539,7 @@ static int psa_rsa_oaep_set_padding_mode( psa_algorithm_t alg,
|
|||
mbedtls_rsa_context *rsa )
|
||||
{
|
||||
psa_algorithm_t hash_alg = PSA_ALG_RSA_OAEP_GET_HASH( alg );
|
||||
const mbedtls_md_info_t *md_info = mbedtls_md_info_from_psa( hash_alg );
|
||||
mbedtls_md_type_t md_alg = mbedtls_md_get_type( md_info );
|
||||
mbedtls_md_type_t md_alg = mbedtls_hash_info_md_from_psa( hash_alg );
|
||||
|
||||
return( mbedtls_rsa_set_padding( rsa, MBEDTLS_RSA_PKCS_V21, md_alg ) );
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue