Skip to content

Commit d63677f

Browse files
committed
crypto: Update to Mbed Crypto 1.0.0d7
1 parent d96c9e8 commit d63677f

File tree

4 files changed

+20
-19
lines changed

4 files changed

+20
-19
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
mbedcrypto-1.0.0d6
1+
mbedcrypto-1.0.0d7

features/mbedtls/mbed-crypto/importer/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
# Set the Mbed Crypto release to import (this can/should be edited before
3131
# import)
32-
CRYPTO_RELEASE ?= mbedcrypto-1.0.0d6
32+
CRYPTO_RELEASE ?= mbedcrypto-1.0.0d7
3333
CRYPTO_REPO_URL ?= [email protected]:ARMmbed/mbed-crypto.git
3434

3535
# Translate between Mbed Crypto namespace and Mbed OS namespace

features/mbedtls/mbed-crypto/inc/psa/crypto_extra.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
#ifndef PSA_CRYPTO_EXTRA_H
3131
#define PSA_CRYPTO_EXTRA_H
3232

33+
#include "mbedtls/platform_util.h"
34+
3335
#ifdef __cplusplus
3436
extern "C" {
3537
#endif

features/mbedtls/mbed-crypto/platform/TARGET_PSA/COMPONENT_PSA_SRV_IMPL/psa_crypto.c

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2902,8 +2902,8 @@ static psa_status_t psa_cipher_setup( psa_cipher_operation_t *operation,
29022902
psa_algorithm_t alg,
29032903
mbedtls_operation_t cipher_operation )
29042904
{
2905-
int ret = MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE;
2906-
psa_status_t status;
2905+
int ret = 0;
2906+
psa_status_t status = PSA_ERROR_GENERIC_ERROR;
29072907
psa_key_slot_t *slot;
29082908
size_t key_bits;
29092909
const mbedtls_cipher_info_t *cipher_info = NULL;
@@ -2923,19 +2923,19 @@ static psa_status_t psa_cipher_setup( psa_cipher_operation_t *operation,
29232923

29242924
status = psa_get_key_from_slot( handle, &slot, usage, alg);
29252925
if( status != PSA_SUCCESS )
2926-
return( status );
2926+
goto exit;
29272927
key_bits = psa_get_key_bits( slot );
29282928

29292929
cipher_info = mbedtls_cipher_info_from_psa( alg, slot->type, key_bits, NULL );
29302930
if( cipher_info == NULL )
2931-
return( PSA_ERROR_NOT_SUPPORTED );
2931+
{
2932+
status = PSA_ERROR_NOT_SUPPORTED;
2933+
goto exit;
2934+
}
29322935

29332936
ret = mbedtls_cipher_setup( &operation->ctx.cipher, cipher_info );
29342937
if( ret != 0 )
2935-
{
2936-
psa_cipher_abort( operation );
2937-
return( mbedtls_to_psa_error( ret ) );
2938-
}
2938+
goto exit;
29392939

29402940
#if defined(MBEDTLS_DES_C)
29412941
if( slot->type == PSA_KEY_TYPE_DES && key_bits == 128 )
@@ -2956,10 +2956,7 @@ static psa_status_t psa_cipher_setup( psa_cipher_operation_t *operation,
29562956
(int) key_bits, cipher_operation );
29572957
}
29582958
if( ret != 0 )
2959-
{
2960-
psa_cipher_abort( operation );
2961-
return( mbedtls_to_psa_error( ret ) );
2962-
}
2959+
goto exit;
29632960

29642961
#if defined(MBEDTLS_CIPHER_MODE_WITH_PADDING)
29652962
switch( alg )
@@ -2978,10 +2975,7 @@ static psa_status_t psa_cipher_setup( psa_cipher_operation_t *operation,
29782975
break;
29792976
}
29802977
if( ret != 0 )
2981-
{
2982-
psa_cipher_abort( operation );
2983-
return( mbedtls_to_psa_error( ret ) );
2984-
}
2978+
goto exit;
29852979
#endif //MBEDTLS_CIPHER_MODE_WITH_PADDING
29862980

29872981
operation->key_set = 1;
@@ -2992,7 +2986,12 @@ static psa_status_t psa_cipher_setup( psa_cipher_operation_t *operation,
29922986
operation->iv_size = PSA_BLOCK_CIPHER_BLOCK_SIZE( slot->type );
29932987
}
29942988

2995-
return( PSA_SUCCESS );
2989+
exit:
2990+
if( status == 0 )
2991+
status = mbedtls_to_psa_error( ret );
2992+
if( status != 0 )
2993+
psa_cipher_abort( operation );
2994+
return( status );
29962995
}
29972996

29982997
psa_status_t psa_cipher_encrypt_setup( psa_cipher_operation_t *operation,

0 commit comments

Comments
 (0)