mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-04-25 09:02:48 +00:00
Reorder blocks to avoid double negations
Convert `#if !... A #else B #endif` to `#if ... B #else A`. No semantic change. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
parent
bdd16d4cb1
commit
0e3704f0a0
@ -434,12 +434,12 @@ uint64_t mbedtls_test_parse_binary_string(data_t *bin_string);
|
|||||||
* This is like #PSA_DONE except it does nothing under the same conditions as
|
* This is like #PSA_DONE except it does nothing under the same conditions as
|
||||||
* #AES_PSA_INIT.
|
* #AES_PSA_INIT.
|
||||||
*/
|
*/
|
||||||
#if !defined(MBEDTLS_CTR_DRBG_USE_PSA_CRYPTO)
|
#if defined(MBEDTLS_CTR_DRBG_USE_PSA_CRYPTO)
|
||||||
#define AES_PSA_INIT() ((void) 0)
|
|
||||||
#define AES_PSA_DONE() ((void) 0)
|
|
||||||
#else /* MBEDTLS_CTR_DRBG_USE_PSA_CRYPTO */
|
|
||||||
#define AES_PSA_INIT() PSA_INIT()
|
#define AES_PSA_INIT() PSA_INIT()
|
||||||
#define AES_PSA_DONE() PSA_DONE()
|
#define AES_PSA_DONE() PSA_DONE()
|
||||||
|
#else /* MBEDTLS_CTR_DRBG_USE_PSA_CRYPTO */
|
||||||
|
#define AES_PSA_INIT() ((void) 0)
|
||||||
|
#define AES_PSA_DONE() ((void) 0)
|
||||||
#endif /* MBEDTLS_CTR_DRBG_USE_PSA_CRYPTO */
|
#endif /* MBEDTLS_CTR_DRBG_USE_PSA_CRYPTO */
|
||||||
|
|
||||||
#endif /* PSA_CRYPTO_HELPERS_H */
|
#endif /* PSA_CRYPTO_HELPERS_H */
|
||||||
|
@ -49,10 +49,10 @@
|
|||||||
#define MBEDTLS_CTR_DRBG_USE_PSA_CRYPTO
|
#define MBEDTLS_CTR_DRBG_USE_PSA_CRYPTO
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(MBEDTLS_CTR_DRBG_USE_PSA_CRYPTO)
|
#if defined(MBEDTLS_CTR_DRBG_USE_PSA_CRYPTO)
|
||||||
#include "mbedtls/aes.h"
|
|
||||||
#else
|
|
||||||
#include "psa/crypto.h"
|
#include "psa/crypto.h"
|
||||||
|
#else
|
||||||
|
#include "mbedtls/aes.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "entropy.h"
|
#include "entropy.h"
|
||||||
@ -204,10 +204,10 @@ typedef struct mbedtls_ctr_drbg_context {
|
|||||||
* This is the maximum number of requests
|
* This is the maximum number of requests
|
||||||
* that can be made between reseedings. */
|
* that can be made between reseedings. */
|
||||||
|
|
||||||
#if !defined(MBEDTLS_CTR_DRBG_USE_PSA_CRYPTO)
|
#if defined(MBEDTLS_CTR_DRBG_USE_PSA_CRYPTO)
|
||||||
mbedtls_aes_context MBEDTLS_PRIVATE(aes_ctx); /*!< The AES context. */
|
|
||||||
#else
|
|
||||||
mbedtls_ctr_drbg_psa_context MBEDTLS_PRIVATE(psa_ctx); /*!< The PSA context. */
|
mbedtls_ctr_drbg_psa_context MBEDTLS_PRIVATE(psa_ctx); /*!< The PSA context. */
|
||||||
|
#else
|
||||||
|
mbedtls_aes_context MBEDTLS_PRIVATE(aes_ctx); /*!< The AES context. */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -73,11 +73,11 @@ static void ctr_drbg_destroy_psa_contex(mbedtls_ctr_drbg_psa_context *psa_ctx)
|
|||||||
void mbedtls_ctr_drbg_init(mbedtls_ctr_drbg_context *ctx)
|
void mbedtls_ctr_drbg_init(mbedtls_ctr_drbg_context *ctx)
|
||||||
{
|
{
|
||||||
memset(ctx, 0, sizeof(mbedtls_ctr_drbg_context));
|
memset(ctx, 0, sizeof(mbedtls_ctr_drbg_context));
|
||||||
#if !defined(MBEDTLS_CTR_DRBG_USE_PSA_CRYPTO)
|
#if defined(MBEDTLS_CTR_DRBG_USE_PSA_CRYPTO)
|
||||||
mbedtls_aes_init(&ctx->aes_ctx);
|
|
||||||
#else
|
|
||||||
ctx->psa_ctx.key_id = MBEDTLS_SVC_KEY_ID_INIT;
|
ctx->psa_ctx.key_id = MBEDTLS_SVC_KEY_ID_INIT;
|
||||||
ctx->psa_ctx.operation = psa_cipher_operation_init();
|
ctx->psa_ctx.operation = psa_cipher_operation_init();
|
||||||
|
#else
|
||||||
|
mbedtls_aes_init(&ctx->aes_ctx);
|
||||||
#endif
|
#endif
|
||||||
/* Indicate that the entropy nonce length is not set explicitly.
|
/* Indicate that the entropy nonce length is not set explicitly.
|
||||||
* See mbedtls_ctr_drbg_set_nonce_len(). */
|
* See mbedtls_ctr_drbg_set_nonce_len(). */
|
||||||
@ -102,10 +102,10 @@ void mbedtls_ctr_drbg_free(mbedtls_ctr_drbg_context *ctx)
|
|||||||
mbedtls_mutex_free(&ctx->mutex);
|
mbedtls_mutex_free(&ctx->mutex);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if !defined(MBEDTLS_CTR_DRBG_USE_PSA_CRYPTO)
|
#if defined(MBEDTLS_CTR_DRBG_USE_PSA_CRYPTO)
|
||||||
mbedtls_aes_free(&ctx->aes_ctx);
|
|
||||||
#else
|
|
||||||
ctr_drbg_destroy_psa_contex(&ctx->psa_ctx);
|
ctr_drbg_destroy_psa_contex(&ctx->psa_ctx);
|
||||||
|
#else
|
||||||
|
mbedtls_aes_free(&ctx->aes_ctx);
|
||||||
#endif
|
#endif
|
||||||
mbedtls_platform_zeroize(ctx, sizeof(mbedtls_ctr_drbg_context));
|
mbedtls_platform_zeroize(ctx, sizeof(mbedtls_ctr_drbg_context));
|
||||||
ctx->reseed_interval = MBEDTLS_CTR_DRBG_RESEED_INTERVAL;
|
ctx->reseed_interval = MBEDTLS_CTR_DRBG_RESEED_INTERVAL;
|
||||||
@ -168,15 +168,15 @@ static int block_cipher_df(unsigned char *output,
|
|||||||
unsigned char chain[MBEDTLS_CTR_DRBG_BLOCKSIZE];
|
unsigned char chain[MBEDTLS_CTR_DRBG_BLOCKSIZE];
|
||||||
unsigned char *p, *iv;
|
unsigned char *p, *iv;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
#if !defined(MBEDTLS_CTR_DRBG_USE_PSA_CRYPTO)
|
#if defined(MBEDTLS_CTR_DRBG_USE_PSA_CRYPTO)
|
||||||
mbedtls_aes_context aes_ctx;
|
|
||||||
#else
|
|
||||||
psa_status_t status;
|
psa_status_t status;
|
||||||
size_t tmp_len;
|
size_t tmp_len;
|
||||||
mbedtls_ctr_drbg_psa_context psa_ctx;
|
mbedtls_ctr_drbg_psa_context psa_ctx;
|
||||||
|
|
||||||
psa_ctx.key_id = MBEDTLS_SVC_KEY_ID_INIT;
|
psa_ctx.key_id = MBEDTLS_SVC_KEY_ID_INIT;
|
||||||
psa_ctx.operation = psa_cipher_operation_init();
|
psa_ctx.operation = psa_cipher_operation_init();
|
||||||
|
#else
|
||||||
|
mbedtls_aes_context aes_ctx;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int i, j;
|
int i, j;
|
||||||
@ -209,19 +209,19 @@ static int block_cipher_df(unsigned char *output,
|
|||||||
key[i] = i;
|
key[i] = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(MBEDTLS_CTR_DRBG_USE_PSA_CRYPTO)
|
#if defined(MBEDTLS_CTR_DRBG_USE_PSA_CRYPTO)
|
||||||
|
status = ctr_drbg_setup_psa_context(&psa_ctx, key, sizeof(key));
|
||||||
|
if (status != PSA_SUCCESS) {
|
||||||
|
ret = psa_generic_status_to_mbedtls(status);
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
#else
|
||||||
mbedtls_aes_init(&aes_ctx);
|
mbedtls_aes_init(&aes_ctx);
|
||||||
|
|
||||||
if ((ret = mbedtls_aes_setkey_enc(&aes_ctx, key,
|
if ((ret = mbedtls_aes_setkey_enc(&aes_ctx, key,
|
||||||
MBEDTLS_CTR_DRBG_KEYBITS)) != 0) {
|
MBEDTLS_CTR_DRBG_KEYBITS)) != 0) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
status = ctr_drbg_setup_psa_context(&psa_ctx, key, sizeof(key));
|
|
||||||
if (status != PSA_SUCCESS) {
|
|
||||||
ret = psa_generic_status_to_mbedtls(status);
|
|
||||||
goto exit;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -238,18 +238,18 @@ static int block_cipher_df(unsigned char *output,
|
|||||||
use_len -= (use_len >= MBEDTLS_CTR_DRBG_BLOCKSIZE) ?
|
use_len -= (use_len >= MBEDTLS_CTR_DRBG_BLOCKSIZE) ?
|
||||||
MBEDTLS_CTR_DRBG_BLOCKSIZE : use_len;
|
MBEDTLS_CTR_DRBG_BLOCKSIZE : use_len;
|
||||||
|
|
||||||
#if !defined(MBEDTLS_CTR_DRBG_USE_PSA_CRYPTO)
|
#if defined(MBEDTLS_CTR_DRBG_USE_PSA_CRYPTO)
|
||||||
if ((ret = mbedtls_aes_crypt_ecb(&aes_ctx, MBEDTLS_AES_ENCRYPT,
|
|
||||||
chain, chain)) != 0) {
|
|
||||||
goto exit;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
status = psa_cipher_update(&psa_ctx.operation, chain, MBEDTLS_CTR_DRBG_BLOCKSIZE,
|
status = psa_cipher_update(&psa_ctx.operation, chain, MBEDTLS_CTR_DRBG_BLOCKSIZE,
|
||||||
chain, MBEDTLS_CTR_DRBG_BLOCKSIZE, &tmp_len);
|
chain, MBEDTLS_CTR_DRBG_BLOCKSIZE, &tmp_len);
|
||||||
if (status != PSA_SUCCESS) {
|
if (status != PSA_SUCCESS) {
|
||||||
ret = psa_generic_status_to_mbedtls(status);
|
ret = psa_generic_status_to_mbedtls(status);
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
if ((ret = mbedtls_aes_crypt_ecb(&aes_ctx, MBEDTLS_AES_ENCRYPT,
|
||||||
|
chain, chain)) != 0) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -264,12 +264,7 @@ static int block_cipher_df(unsigned char *output,
|
|||||||
/*
|
/*
|
||||||
* Do final encryption with reduced data
|
* Do final encryption with reduced data
|
||||||
*/
|
*/
|
||||||
#if !defined(MBEDTLS_CTR_DRBG_USE_PSA_CRYPTO)
|
#if defined(MBEDTLS_CTR_DRBG_USE_PSA_CRYPTO)
|
||||||
if ((ret = mbedtls_aes_setkey_enc(&aes_ctx, tmp,
|
|
||||||
MBEDTLS_CTR_DRBG_KEYBITS)) != 0) {
|
|
||||||
goto exit;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
ctr_drbg_destroy_psa_contex(&psa_ctx);
|
ctr_drbg_destroy_psa_contex(&psa_ctx);
|
||||||
|
|
||||||
status = ctr_drbg_setup_psa_context(&psa_ctx, tmp, MBEDTLS_CTR_DRBG_KEYSIZE);
|
status = ctr_drbg_setup_psa_context(&psa_ctx, tmp, MBEDTLS_CTR_DRBG_KEYSIZE);
|
||||||
@ -277,32 +272,37 @@ static int block_cipher_df(unsigned char *output,
|
|||||||
ret = psa_generic_status_to_mbedtls(status);
|
ret = psa_generic_status_to_mbedtls(status);
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
if ((ret = mbedtls_aes_setkey_enc(&aes_ctx, tmp,
|
||||||
|
MBEDTLS_CTR_DRBG_KEYBITS)) != 0) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
iv = tmp + MBEDTLS_CTR_DRBG_KEYSIZE;
|
iv = tmp + MBEDTLS_CTR_DRBG_KEYSIZE;
|
||||||
p = output;
|
p = output;
|
||||||
|
|
||||||
for (j = 0; j < MBEDTLS_CTR_DRBG_SEEDLEN; j += MBEDTLS_CTR_DRBG_BLOCKSIZE) {
|
for (j = 0; j < MBEDTLS_CTR_DRBG_SEEDLEN; j += MBEDTLS_CTR_DRBG_BLOCKSIZE) {
|
||||||
#if !defined(MBEDTLS_CTR_DRBG_USE_PSA_CRYPTO)
|
#if defined(MBEDTLS_CTR_DRBG_USE_PSA_CRYPTO)
|
||||||
if ((ret = mbedtls_aes_crypt_ecb(&aes_ctx, MBEDTLS_AES_ENCRYPT,
|
|
||||||
iv, iv)) != 0) {
|
|
||||||
goto exit;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
status = psa_cipher_update(&psa_ctx.operation, iv, MBEDTLS_CTR_DRBG_BLOCKSIZE,
|
status = psa_cipher_update(&psa_ctx.operation, iv, MBEDTLS_CTR_DRBG_BLOCKSIZE,
|
||||||
iv, MBEDTLS_CTR_DRBG_BLOCKSIZE, &tmp_len);
|
iv, MBEDTLS_CTR_DRBG_BLOCKSIZE, &tmp_len);
|
||||||
if (status != PSA_SUCCESS) {
|
if (status != PSA_SUCCESS) {
|
||||||
ret = psa_generic_status_to_mbedtls(status);
|
ret = psa_generic_status_to_mbedtls(status);
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
if ((ret = mbedtls_aes_crypt_ecb(&aes_ctx, MBEDTLS_AES_ENCRYPT,
|
||||||
|
iv, iv)) != 0) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
memcpy(p, iv, MBEDTLS_CTR_DRBG_BLOCKSIZE);
|
memcpy(p, iv, MBEDTLS_CTR_DRBG_BLOCKSIZE);
|
||||||
p += MBEDTLS_CTR_DRBG_BLOCKSIZE;
|
p += MBEDTLS_CTR_DRBG_BLOCKSIZE;
|
||||||
}
|
}
|
||||||
exit:
|
exit:
|
||||||
#if !defined(MBEDTLS_CTR_DRBG_USE_PSA_CRYPTO)
|
#if defined(MBEDTLS_CTR_DRBG_USE_PSA_CRYPTO)
|
||||||
mbedtls_aes_free(&aes_ctx);
|
|
||||||
#else
|
|
||||||
ctr_drbg_destroy_psa_contex(&psa_ctx);
|
ctr_drbg_destroy_psa_contex(&psa_ctx);
|
||||||
|
#else
|
||||||
|
mbedtls_aes_free(&aes_ctx);
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
* tidy up the stack
|
* tidy up the stack
|
||||||
@ -352,18 +352,18 @@ static int ctr_drbg_update_internal(mbedtls_ctr_drbg_context *ctx,
|
|||||||
/*
|
/*
|
||||||
* Crypt counter block
|
* Crypt counter block
|
||||||
*/
|
*/
|
||||||
#if !defined(MBEDTLS_CTR_DRBG_USE_PSA_CRYPTO)
|
#if defined(MBEDTLS_CTR_DRBG_USE_PSA_CRYPTO)
|
||||||
if ((ret = mbedtls_aes_crypt_ecb(&ctx->aes_ctx, MBEDTLS_AES_ENCRYPT,
|
|
||||||
ctx->counter, p)) != 0) {
|
|
||||||
goto exit;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
status = psa_cipher_update(&ctx->psa_ctx.operation, ctx->counter, sizeof(ctx->counter),
|
status = psa_cipher_update(&ctx->psa_ctx.operation, ctx->counter, sizeof(ctx->counter),
|
||||||
p, MBEDTLS_CTR_DRBG_BLOCKSIZE, &tmp_len);
|
p, MBEDTLS_CTR_DRBG_BLOCKSIZE, &tmp_len);
|
||||||
if (status != PSA_SUCCESS) {
|
if (status != PSA_SUCCESS) {
|
||||||
ret = psa_generic_status_to_mbedtls(status);
|
ret = psa_generic_status_to_mbedtls(status);
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
if ((ret = mbedtls_aes_crypt_ecb(&ctx->aes_ctx, MBEDTLS_AES_ENCRYPT,
|
||||||
|
ctx->counter, p)) != 0) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
p += MBEDTLS_CTR_DRBG_BLOCKSIZE;
|
p += MBEDTLS_CTR_DRBG_BLOCKSIZE;
|
||||||
@ -374,12 +374,7 @@ static int ctr_drbg_update_internal(mbedtls_ctr_drbg_context *ctx,
|
|||||||
/*
|
/*
|
||||||
* Update key and counter
|
* Update key and counter
|
||||||
*/
|
*/
|
||||||
#if !defined(MBEDTLS_CTR_DRBG_USE_PSA_CRYPTO)
|
#if defined(MBEDTLS_CTR_DRBG_USE_PSA_CRYPTO)
|
||||||
if ((ret = mbedtls_aes_setkey_enc(&ctx->aes_ctx, tmp,
|
|
||||||
MBEDTLS_CTR_DRBG_KEYBITS)) != 0) {
|
|
||||||
goto exit;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
ctr_drbg_destroy_psa_contex(&ctx->psa_ctx);
|
ctr_drbg_destroy_psa_contex(&ctx->psa_ctx);
|
||||||
|
|
||||||
status = ctr_drbg_setup_psa_context(&ctx->psa_ctx, tmp, MBEDTLS_CTR_DRBG_KEYSIZE);
|
status = ctr_drbg_setup_psa_context(&ctx->psa_ctx, tmp, MBEDTLS_CTR_DRBG_KEYSIZE);
|
||||||
@ -387,6 +382,11 @@ static int ctr_drbg_update_internal(mbedtls_ctr_drbg_context *ctx,
|
|||||||
ret = psa_generic_status_to_mbedtls(status);
|
ret = psa_generic_status_to_mbedtls(status);
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
if ((ret = mbedtls_aes_setkey_enc(&ctx->aes_ctx, tmp,
|
||||||
|
MBEDTLS_CTR_DRBG_KEYBITS)) != 0) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
memcpy(ctx->counter, tmp + MBEDTLS_CTR_DRBG_KEYSIZE,
|
memcpy(ctx->counter, tmp + MBEDTLS_CTR_DRBG_KEYSIZE,
|
||||||
MBEDTLS_CTR_DRBG_BLOCKSIZE);
|
MBEDTLS_CTR_DRBG_BLOCKSIZE);
|
||||||
@ -564,12 +564,7 @@ int mbedtls_ctr_drbg_seed(mbedtls_ctr_drbg_context *ctx,
|
|||||||
good_nonce_len(ctx->entropy_len));
|
good_nonce_len(ctx->entropy_len));
|
||||||
|
|
||||||
/* Initialize with an empty key. */
|
/* Initialize with an empty key. */
|
||||||
#if !defined(MBEDTLS_CTR_DRBG_USE_PSA_CRYPTO)
|
#if defined(MBEDTLS_CTR_DRBG_USE_PSA_CRYPTO)
|
||||||
if ((ret = mbedtls_aes_setkey_enc(&ctx->aes_ctx, key,
|
|
||||||
MBEDTLS_CTR_DRBG_KEYBITS)) != 0) {
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
psa_status_t status;
|
psa_status_t status;
|
||||||
|
|
||||||
status = ctr_drbg_setup_psa_context(&ctx->psa_ctx, key, MBEDTLS_CTR_DRBG_KEYSIZE);
|
status = ctr_drbg_setup_psa_context(&ctx->psa_ctx, key, MBEDTLS_CTR_DRBG_KEYSIZE);
|
||||||
@ -577,6 +572,11 @@ int mbedtls_ctr_drbg_seed(mbedtls_ctr_drbg_context *ctx,
|
|||||||
ret = psa_generic_status_to_mbedtls(status);
|
ret = psa_generic_status_to_mbedtls(status);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
if ((ret = mbedtls_aes_setkey_enc(&ctx->aes_ctx, key,
|
||||||
|
MBEDTLS_CTR_DRBG_KEYBITS)) != 0) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Do the initial seeding. */
|
/* Do the initial seeding. */
|
||||||
@ -655,12 +655,7 @@ int mbedtls_ctr_drbg_random_with_add(void *p_rng,
|
|||||||
/*
|
/*
|
||||||
* Crypt counter block
|
* Crypt counter block
|
||||||
*/
|
*/
|
||||||
#if !defined(MBEDTLS_CTR_DRBG_USE_PSA_CRYPTO)
|
#if defined(MBEDTLS_CTR_DRBG_USE_PSA_CRYPTO)
|
||||||
if ((ret = mbedtls_aes_crypt_ecb(&ctx->aes_ctx, MBEDTLS_AES_ENCRYPT,
|
|
||||||
ctx->counter, locals.tmp)) != 0) {
|
|
||||||
goto exit;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
psa_status_t status;
|
psa_status_t status;
|
||||||
size_t tmp_len;
|
size_t tmp_len;
|
||||||
|
|
||||||
@ -670,6 +665,11 @@ int mbedtls_ctr_drbg_random_with_add(void *p_rng,
|
|||||||
ret = psa_generic_status_to_mbedtls(status);
|
ret = psa_generic_status_to_mbedtls(status);
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
if ((ret = mbedtls_aes_crypt_ecb(&ctx->aes_ctx, MBEDTLS_AES_ENCRYPT,
|
||||||
|
ctx->counter, locals.tmp)) != 0) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
use_len = (output_len > MBEDTLS_CTR_DRBG_BLOCKSIZE)
|
use_len = (output_len > MBEDTLS_CTR_DRBG_BLOCKSIZE)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user