mirror of https://github.com/ARMmbed/mbed-os.git
[M487] Conform to mbed TLS H/W acceleration support released with mbed OS 5.3
parent
7578541021
commit
12536436f8
|
@ -0,0 +1,31 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2015-2016 Nuvoton
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef MBEDTLS_DEVICE_H
|
||||
#define MBEDTLS_DEVICE_H
|
||||
|
||||
#define MBEDTLS_DES_ALT
|
||||
|
||||
#define MBEDTLS_SHA1_ALT
|
||||
#define MBEDTLS_SHA256_ALT
|
||||
#define MBEDTLS_SHA512_ALT
|
||||
|
||||
#define MBEDTLS_AES_ALT
|
||||
#define MBEDTLS_AES_SETKEY_ENC_ALT
|
||||
#define MBEDTLS_AES_SETKEY_DEC_ALT
|
||||
#define MBEDTLS_AES_ENCRYPT_ALT
|
||||
#define MBEDTLS_AES_DECRYPT_ALT
|
||||
|
||||
#endif /* MBEDTLS_DEVICE_H */
|
|
@ -35,7 +35,7 @@
|
|||
#include "mbedtls/aes.h"
|
||||
|
||||
#include "M480.h"
|
||||
#include "toolchain.h"
|
||||
#include "mbed_toolchain.h"
|
||||
#include "mbed_assert.h"
|
||||
|
||||
//static int aes_init_done = 0;
|
||||
|
@ -135,7 +135,7 @@ void mbedtls_aes_init( mbedtls_aes_context *ctx )
|
|||
|
||||
/* Unlock protected registers */
|
||||
SYS_UnlockReg();
|
||||
CLK_EnableModuleClock(CRYPTO_MODULE);
|
||||
CLK_EnableModuleClock(CRPT_MODULE);
|
||||
/* Lock protected registers */
|
||||
SYS_LockReg();
|
||||
|
|
@ -20,7 +20,16 @@
|
|||
*
|
||||
* This file is part of mbed TLS (https://tls.mbed.org)
|
||||
*/
|
||||
#ifndef MBEDTLS_AES_ALT_H
|
||||
#define MBEDTLS_AES_ALT_H
|
||||
|
||||
#if !defined(MBEDTLS_CONFIG_FILE)
|
||||
#include "mbedtls/config.h"
|
||||
#else
|
||||
#include MBEDTLS_CONFIG_FILE
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_AES_C)
|
||||
#if defined(MBEDTLS_AES_ALT)
|
||||
// Regular implementation
|
||||
//
|
||||
|
@ -270,5 +279,6 @@ void mbedtls_aes_decrypt( mbedtls_aes_context *ctx,
|
|||
|
||||
|
||||
#endif /* MBEDTLS_AES_ALT */
|
||||
#endif /* MBEDTLS_AES_C */
|
||||
|
||||
|
||||
#endif /* aes_alt.h */
|
|
@ -14,9 +14,6 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* Compatible with mbed OS 2 which doesn't support mbedtls */
|
||||
#if MBED_CONF_RTOS_PRESENT
|
||||
|
||||
#if !defined(MBEDTLS_CONFIG_FILE)
|
||||
#include "mbedtls/config.h"
|
||||
#else
|
||||
|
@ -31,7 +28,7 @@
|
|||
#include "des_alt.h"
|
||||
#include "crypto-misc.h"
|
||||
#include "nu_bitutil.h"
|
||||
#include "toolchain.h"
|
||||
#include "mbed_toolchain.h"
|
||||
|
||||
// Must be a multiple of 64-bit block size
|
||||
#define MAXSIZE_DMABUF (8 * 5)
|
||||
|
@ -411,6 +408,3 @@ static int mbedtls_des_docrypt(uint16_t keyopt, uint8_t key[3][MBEDTLS_DES_KEY_S
|
|||
|
||||
#endif /* MBEDTLS_DES_ALT */
|
||||
#endif /* MBEDTLS_DES_C */
|
||||
|
||||
#endif /* MBED_CONF_RTOS_PRESENT */
|
||||
|
|
@ -23,6 +23,7 @@
|
|||
#include MBEDTLS_CONFIG_FILE
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_DES_C)
|
||||
#if defined(MBEDTLS_DES_ALT)
|
||||
|
||||
#include <stddef.h>
|
||||
|
@ -276,5 +277,6 @@ void mbedtls_des_setkey( uint32_t SK[32],
|
|||
#endif
|
||||
|
||||
#endif /* MBEDTLS_DES_ALT */
|
||||
#endif /* MBEDTLS_DES_C */
|
||||
|
||||
#endif /* des_alt.h */
|
|
@ -25,9 +25,6 @@
|
|||
* http://csrc.nist.gov/publications/fips/fips46-3/fips46-3.pdf
|
||||
*/
|
||||
|
||||
/* Compatible with mbed OS 2 which doesn't support mbedtls */
|
||||
#if MBED_CONF_RTOS_PRESENT
|
||||
|
||||
#if !defined(MBEDTLS_CONFIG_FILE)
|
||||
#include "mbedtls/config.h"
|
||||
#else
|
||||
|
@ -798,5 +795,3 @@ int mbedtls_des3_sw_crypt_cbc( mbedtls_des3_sw_context *ctx,
|
|||
|
||||
#endif /* MBEDTLS_DES_ALT */
|
||||
#endif /* MBEDTLS_DES_C */
|
||||
|
||||
#endif /* MBED_CONF_RTOS_PRESENT */
|
|
@ -14,9 +14,6 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* Compatible with mbed OS 2 which doesn't support mbedtls */
|
||||
#if MBED_CONF_RTOS_PRESENT
|
||||
|
||||
#if !defined(MBEDTLS_CONFIG_FILE)
|
||||
#include "mbedtls/config.h"
|
||||
#else
|
||||
|
@ -139,5 +136,3 @@ void mbedtls_sha1_process(mbedtls_sha1_context *ctx, const unsigned char data[64
|
|||
|
||||
#endif /* MBEDTLS_SHA1_ALT */
|
||||
#endif /* MBEDTLS_SHA1_C */
|
||||
|
||||
#endif /* MBED_CONF_RTOS_PRESENT */
|
|
@ -24,9 +24,6 @@
|
|||
* http://www.itl.nist.gov/fipspubs/fip180-1.htm
|
||||
*/
|
||||
|
||||
/* Compatible with mbed OS 2 which doesn't support mbedtls */
|
||||
#if MBED_CONF_RTOS_PRESENT
|
||||
|
||||
#if !defined(MBEDTLS_CONFIG_FILE)
|
||||
#include "mbedtls/config.h"
|
||||
#else
|
||||
|
@ -344,7 +341,4 @@ void mbedtls_sha1_sw_finish( mbedtls_sha1_sw_context *ctx, unsigned char output[
|
|||
}
|
||||
|
||||
#endif /* MBEDTLS_SHA1_ALT */
|
||||
|
||||
#endif /* MBEDTLS_SHA1_C */
|
||||
|
||||
#endif /* MBED_CONF_RTOS_PRESENT */
|
|
@ -14,9 +14,6 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* Compatible with mbed OS 2 which doesn't support mbedtls */
|
||||
#if MBED_CONF_RTOS_PRESENT
|
||||
|
||||
#if !defined(MBEDTLS_CONFIG_FILE)
|
||||
#include "mbedtls/config.h"
|
||||
#else
|
||||
|
@ -140,5 +137,3 @@ void mbedtls_sha256_process(mbedtls_sha256_context *ctx, const unsigned char dat
|
|||
|
||||
#endif /* MBEDTLS_SHA256_ALT */
|
||||
#endif /* MBEDTLS_SHA256_C */
|
||||
|
||||
#endif /* MBED_CONF_RTOS_PRESENT */
|
|
@ -24,9 +24,6 @@
|
|||
* http://csrc.nist.gov/publications/fips/fips180-2/fips180-2.pdf
|
||||
*/
|
||||
|
||||
/* Compatible with mbed OS 2 which doesn't support mbedtls */
|
||||
#if MBED_CONF_RTOS_PRESENT
|
||||
|
||||
#if !defined(MBEDTLS_CONFIG_FILE)
|
||||
#include "mbedtls/config.h"
|
||||
#else
|
||||
|
@ -318,7 +315,4 @@ void mbedtls_sha256_sw_finish( mbedtls_sha256_sw_context *ctx, unsigned char out
|
|||
}
|
||||
|
||||
#endif /* MBEDTLS_SHA256_ALT */
|
||||
|
||||
#endif /* MBEDTLS_SHA256_C */
|
||||
|
||||
#endif /* MBED_CONF_RTOS_PRESENT */
|
|
@ -14,9 +14,6 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* Compatible with mbed OS 2 which doesn't support mbedtls */
|
||||
#if MBED_CONF_RTOS_PRESENT
|
||||
|
||||
#if !defined(MBEDTLS_CONFIG_FILE)
|
||||
#include "mbedtls/config.h"
|
||||
#else
|
||||
|
@ -141,5 +138,3 @@ void mbedtls_sha512_process(mbedtls_sha512_context *ctx, const unsigned char dat
|
|||
|
||||
#endif /* MBEDTLS_SHA512_ALT */
|
||||
#endif /* MBEDTLS_SHA512_C */
|
||||
|
||||
#endif /* MBED_CONF_RTOS_PRESENT */
|
|
@ -24,17 +24,14 @@
|
|||
* http://csrc.nist.gov/publications/fips/fips180-2/fips180-2.pdf
|
||||
*/
|
||||
|
||||
/* Compatible with mbed OS 2 which doesn't support mbedtls */
|
||||
#if MBED_CONF_RTOS_PRESENT
|
||||
|
||||
#if !defined(MBEDTLS_CONFIG_FILE)
|
||||
#include "mbedtls/config.h"
|
||||
#else
|
||||
#include MBEDTLS_CONFIG_FILE
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_SHA256_C)
|
||||
#if defined(MBEDTLS_SHA256_ALT)
|
||||
#if defined(MBEDTLS_SHA512_C)
|
||||
#if defined(MBEDTLS_SHA512_ALT)
|
||||
|
||||
#include "mbedtls/sha512.h"
|
||||
|
||||
|
@ -357,7 +354,4 @@ void mbedtls_sha512_sw_finish( mbedtls_sha512_sw_context *ctx, unsigned char out
|
|||
}
|
||||
|
||||
#endif /* MBEDTLS_SHA512_ALT */
|
||||
|
||||
#endif /* MBEDTLS_SHA512_C */
|
||||
|
||||
#endif /* MBED_CONF_RTOS_PRESENT */
|
|
@ -14,9 +14,6 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* Compatible with mbed OS 2 which doesn't support mbedtls */
|
||||
#if MBED_CONF_RTOS_PRESENT
|
||||
|
||||
#if !defined(MBEDTLS_CONFIG_FILE)
|
||||
#include "mbedtls/config.h"
|
||||
#else
|
||||
|
@ -51,6 +48,7 @@ void crypto_sha_getinternstate(unsigned char output[], size_t olen);
|
|||
|
||||
#endif /* MBEDTLS_SHA1_ALT || MBEDTLS_SHA256_ALT || MBEDTLS_SHA512_ALT */
|
||||
|
||||
#if defined(MBEDTLS_SHA1_C)
|
||||
#if defined(MBEDTLS_SHA1_ALT)
|
||||
|
||||
void mbedtls_sha1_hw_init(crypto_sha_context *ctx)
|
||||
|
@ -123,7 +121,9 @@ void mbedtls_sha1_hw_process(crypto_sha_context *ctx, const unsigned char data[6
|
|||
}
|
||||
|
||||
#endif /* MBEDTLS_SHA1_ALT */
|
||||
#endif /* MBEDTLS_SHA1_C */
|
||||
|
||||
#if defined(MBEDTLS_SHA256_C)
|
||||
#if defined(MBEDTLS_SHA256_ALT)
|
||||
|
||||
void mbedtls_sha256_hw_init(crypto_sha_context *ctx)
|
||||
|
@ -197,9 +197,10 @@ void mbedtls_sha256_hw_process(crypto_sha_context *ctx, const unsigned char data
|
|||
}
|
||||
|
||||
#endif /* MBEDTLS_SHA256_ALT */
|
||||
#endif /* MBEDTLS_SHA256_C */
|
||||
|
||||
|
||||
|
||||
#if defined(MBEDTLS_SHA512_C)
|
||||
#if defined(MBEDTLS_SHA512_ALT)
|
||||
|
||||
void mbedtls_sha512_hw_init(crypto_sha_context *ctx)
|
||||
|
@ -273,7 +274,9 @@ void mbedtls_sha512_hw_process(crypto_sha_context *ctx, const unsigned char data
|
|||
}
|
||||
|
||||
#endif /* MBEDTLS_SHA512_ALT */
|
||||
#endif /* MBEDTLS_SHA512_C */
|
||||
|
||||
#if defined(MBEDTLS_SHA1_C) || defined(MBEDTLS_SHA256_C) || defined(MBEDTLS_SHA512_C)
|
||||
#if defined(MBEDTLS_SHA1_ALT) || defined(MBEDTLS_SHA256_ALT) || defined(MBEDTLS_SHA512_ALT)
|
||||
|
||||
void crypto_sha_update(crypto_sha_context *ctx, const unsigned char *input, size_t ilen)
|
||||
|
@ -431,8 +434,6 @@ void crypto_sha_getinternstate(unsigned char output[], size_t olen)
|
|||
}
|
||||
|
||||
#endif /* MBEDTLS_SHA1_ALT || MBEDTLS_SHA256_ALT || MBEDTLS_SHA512_ALT */
|
||||
|
||||
#endif /* MBEDTLS_SHA1_C || MBEDTLS_SHA256_C || MBEDTLS_SHA512_C */
|
||||
|
||||
#endif /* MBED_CONF_RTOS_PRESENT */
|
||||
|
||||
#endif /* MBEDTLS_SHA1_C || MBEDTLS_SHA256_C || MBEDTLS_SHA512_C */
|
|
@ -23,6 +23,7 @@
|
|||
#endif
|
||||
|
||||
#if defined(MBEDTLS_SHA1_C) || defined(MBEDTLS_SHA256_C) || defined(MBEDTLS_SHA512_C)
|
||||
#if defined(MBEDTLS_SHA1_ALT) || defined(MBEDTLS_SHA256_ALT) || defined(MBEDTLS_SHA512_ALT)
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
@ -50,6 +51,7 @@ void crypto_sha_update(crypto_sha_context *ctx, const unsigned char *input, size
|
|||
void crypto_sha_update_nobuf(crypto_sha_context *ctx, const unsigned char *input, size_t ilen, int islast);
|
||||
void crypto_sha_getinternstate(unsigned char output[], size_t olen);
|
||||
|
||||
#if defined(MBEDTLS_SHA1_C)
|
||||
#if defined(MBEDTLS_SHA1_ALT)
|
||||
|
||||
void mbedtls_sha1_hw_init( crypto_sha_context *ctx );
|
||||
|
@ -62,7 +64,9 @@ void mbedtls_sha1_hw_finish( crypto_sha_context *ctx, unsigned char output[20] )
|
|||
void mbedtls_sha1_hw_process( crypto_sha_context *ctx, const unsigned char data[64] );
|
||||
|
||||
#endif /* MBEDTLS_SHA1_ALT */
|
||||
#endif /* MBEDTLS_SHA1_C */
|
||||
|
||||
#if defined(MBEDTLS_SHA256_C)
|
||||
#if defined(MBEDTLS_SHA256_ALT)
|
||||
|
||||
void mbedtls_sha256_hw_init( crypto_sha_context *ctx );
|
||||
|
@ -76,7 +80,9 @@ void mbedtls_sha256_hw_finish( crypto_sha_context *ctx, unsigned char output[32]
|
|||
void mbedtls_sha256_hw_process( crypto_sha_context *ctx, const unsigned char data[64] );
|
||||
|
||||
#endif /* MBEDTLS_SHA256_ALT */
|
||||
#endif /* MBEDTLS_SHA256_C */
|
||||
|
||||
#if defined(MBEDTLS_SHA512_C)
|
||||
#if defined(MBEDTLS_SHA512_ALT)
|
||||
|
||||
void mbedtls_sha512_hw_init( crypto_sha_context *ctx );
|
||||
|
@ -90,11 +96,13 @@ void mbedtls_sha512_hw_finish( crypto_sha_context *ctx, unsigned char output[64]
|
|||
void mbedtls_sha512_hw_process( crypto_sha_context *ctx, const unsigned char data[128] );
|
||||
|
||||
#endif /* MBEDTLS_SHA512_ALT */
|
||||
#endif /* MBEDTLS_SHA512_C */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* MBEDTLS_SHA1_ALT || MBEDTLS_SHA256_ALT || MBEDTLS_SHA512_ALT */
|
||||
#endif /* MBEDTLS_SHA1_C || MBEDTLS_SHA256_C || MBEDTLS_SHA512_C*/
|
||||
|
||||
#endif /* sha_alt.h */
|
|
@ -3264,6 +3264,7 @@
|
|||
"is_disk_virtual": true,
|
||||
"supported_toolchains": ["ARM", "uARM", "GCC_ARM", "IAR"],
|
||||
"inherits": ["Target"],
|
||||
"macros_add": ["MBEDTLS_CONFIG_HW_SUPPORT"],
|
||||
"device_has": ["ANALOGIN", "I2C", "I2CSLAVE", "I2C_ASYNCH", "INTERRUPTIN", "LOWPOWERTIMER", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_ASYNCH", "SERIAL_FC", "STDIO_MESSAGES", "SLEEP", "SPI", "SPISLAVE", "SPI_ASYNCH", "TRNG", "CAN", "FLASH"],
|
||||
"features": [],
|
||||
"release_versions": ["5"],
|
||||
|
|
Loading…
Reference in New Issue