[NUC472] Fix DES alternative function not thread-safe

pull/4925/head
ccli8 2017-08-17 13:40:07 +08:00
parent 61d9e69be4
commit 19e9dbf799
1 changed files with 5 additions and 5 deletions

View File

@ -24,11 +24,6 @@
#include "nu_bitutil.h"
#include "mbed_toolchain.h"
// Must be a multiple of 64-bit block size
#define MAXSIZE_DMABUF (8 * 5)
static uint8_t dmabuf_in[MAXSIZE_DMABUF] MBED_ALIGN(4);
static uint8_t dmabuf_out[MAXSIZE_DMABUF] MBED_ALIGN(4);
static int mbedtls_des_docrypt(uint16_t keyopt, uint8_t key[3][MBEDTLS_DES_KEY_SIZE], int enc, uint32_t tdes_opmode, size_t length,
unsigned char iv[8], const unsigned char *input, unsigned char *output);
@ -341,6 +336,11 @@ static int mbedtls_des_docrypt(uint16_t keyopt, uint8_t key[3][MBEDTLS_DES_KEY_S
const unsigned char *in_pos = input;
unsigned char *out_pos = output;
// Must be a multiple of 64-bit block size
#define MAXSIZE_DMABUF (8 * 5)
MBED_ALIGN(4) uint8_t dmabuf_in[MAXSIZE_DMABUF];
MBED_ALIGN(4) uint8_t dmabuf_out[MAXSIZE_DMABUF];
while (rmn) {
uint32_t data_len = (rmn <= MAXSIZE_DMABUF) ? rmn : MAXSIZE_DMABUF;